@weapp-tailwindcss/postcss 3.3.8 → 3.3.9

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.
@@ -1,4 +1,4 @@
1
- import { ParseError as ParseError$1, a as a$1, isToken, isTokenCloseParen, isTokenColon, isTokenComma, isTokenComment, isTokenDelim, isTokenDimension, isTokenEOF, isTokenFunction, isTokenHash, isTokenIdent, isTokenNumber, isTokenNumeric, isTokenOpenCurly, isTokenOpenParen, isTokenOpenSquare, isTokenPercentage, isTokenSemicolon, isTokenWhiteSpaceOrComment, isTokenWhitespace, mirrorVariant, mirrorVariantType, mutateUnit, parseCssImportSpecifier, stringify, tokenize, tokenizer, u as u$1 } from "./resolve-D-FbFBpF.js";
1
+ import { ParseError as ParseError$1, a as a$1, isToken, isTokenCloseParen, isTokenColon, isTokenComma, isTokenComment, isTokenDelim, isTokenDimension, isTokenEOF, isTokenFunction, isTokenHash, isTokenIdent, isTokenNumber, isTokenNumeric, isTokenOpenCurly, isTokenOpenParen, isTokenOpenSquare, isTokenPercentage, isTokenSemicolon, isTokenWhiteSpaceOrComment, isTokenWhitespace, mirrorVariant, mirrorVariantType, mutateUnit, parseCssImportSpecifier, stringify, tokenize, tokenizer, u as u$1 } from "./resolve-Cb3XkcFk.js";
2
2
  import { postcss as postcss$1 } from "./postcss-runtime-i5rHe_mj.js";
3
3
  import { internalCssSelectorReplacer } from "./shared-CfQUwapA.js";
4
4
  import postcssCalc from "@weapp-tailwindcss/postcss-calc";
@@ -702,7 +702,7 @@ function hasUnsupportedModernColorFunction(value) {
702
702
  return hasUnsupported;
703
703
  }
704
704
  //#endregion
705
- //#region ../../node_modules/.pnpm/@csstools+color-helpers@6.1.1/node_modules/@csstools/color-helpers/dist/index.mjs
705
+ //#region ../../node_modules/.pnpm/@csstools+color-helpers@6.1.2/node_modules/@csstools/color-helpers/dist/index.mjs
706
706
  function multiplyMatrices(_, t) {
707
707
  return [
708
708
  _[0] * t[0] + _[1] * t[1] + _[2] * t[2],
@@ -1236,10 +1236,10 @@ const h = [
1236
1236
  lin_ProPhoto_channel(_[2])
1237
1237
  ];
1238
1238
  }
1239
- const f$1 = 16 / 512;
1239
+ const f = 16 / 512;
1240
1240
  function lin_ProPhoto_channel(_) {
1241
1241
  const t = _ < 0 ? -1 : 1, n = Math.abs(_);
1242
- return n <= f$1 ? _ / 16 : t * Math.pow(n, 1.8);
1242
+ return n <= f ? _ / 16 : t * Math.pow(n, 1.8);
1243
1243
  }
1244
1244
  const m = [
1245
1245
  .7977666449006423,
@@ -2370,54 +2370,60 @@ function contrast_ratio_wcag_2_1(_, t) {
2370
2370
  return (Math.max(n, o) + .05) / (Math.min(n, o) + .05);
2371
2371
  }
2372
2372
  //#endregion
2373
- //#region ../../node_modules/.pnpm/@csstools+css-parser-algorithms@4.0.0_@csstools+css-tokenizer@4.0.1/node_modules/@csstools/css-parser-algorithms/dist/index.mjs
2374
- var f;
2373
+ //#region ../../node_modules/.pnpm/@csstools+css-parser-algorithms@4.0.1_@csstools+css-tokenizer@4.0.2/node_modules/@csstools/css-parser-algorithms/dist/index.mjs
2374
+ var k$1;
2375
2375
  function walkerIndexGenerator(e) {
2376
- let n = e.slice();
2377
- return (e, t, o) => {
2378
- let s = -1;
2379
- for (let i = n.indexOf(t); i < n.length && (s = e.indexOf(n[i]), -1 === s || s < o); i++);
2380
- return -1 === s || s === o && t === e[o] && (s++, s >= e.length) ? -1 : (n = e.slice(), s);
2376
+ let n, t = e.slice(), o = -1;
2377
+ return (e, s, i) => {
2378
+ if (e === n && e.length === o && e[i] === s) {
2379
+ o = e.length;
2380
+ const n = i + 1;
2381
+ return n < e.length ? n : -1;
2382
+ }
2383
+ let r = -1;
2384
+ for (let n = t.indexOf(s); n < t.length && (r = e.indexOf(t[n]), -1 === r || r < i); n++);
2385
+ return -1 === r || r === i && s === e[i] && (r++, r >= e.length) ? (n = e, o = e.length, -1) : (t = e.slice(), n = e, o = e.length, r);
2381
2386
  };
2382
2387
  }
2383
- function consumeComponentValue(e, n) {
2384
- const t = n[0];
2385
- if (isTokenOpenParen(t) || isTokenOpenCurly(t) || isTokenOpenSquare(t)) {
2386
- const t = consumeSimpleBlock(e, n);
2388
+ (function(e) {
2389
+ e.Function = "function", e.SimpleBlock = "simple-block", e.Whitespace = "whitespace", e.Comment = "comment", e.Token = "token";
2390
+ })(k$1 || (k$1 = {}));
2391
+ const N = 512;
2392
+ function consumeComponentValue(e, n, t = 0, o = 0) {
2393
+ const s = n[t];
2394
+ if (isTokenOpenParen(s) || isTokenOpenCurly(s) || isTokenOpenSquare(s)) {
2395
+ const s = consumeSimpleBlock(e, n, t, o);
2387
2396
  return {
2388
- advance: t.advance,
2389
- node: t.node
2397
+ advance: s.advance,
2398
+ node: s.node
2390
2399
  };
2391
2400
  }
2392
- if (isTokenFunction(t)) {
2393
- const t = consumeFunction(e, n);
2401
+ if (isTokenFunction(s)) {
2402
+ const s = consumeFunction(e, n, t, o);
2394
2403
  return {
2395
- advance: t.advance,
2396
- node: t.node
2404
+ advance: s.advance,
2405
+ node: s.node
2397
2406
  };
2398
2407
  }
2399
- if (isTokenWhitespace(t)) {
2400
- const t = consumeWhitespace(e, n);
2408
+ if (isTokenWhitespace(s)) {
2409
+ const o = consumeWhitespace(e, n, t);
2401
2410
  return {
2402
- advance: t.advance,
2403
- node: t.node
2411
+ advance: o.advance,
2412
+ node: o.node
2404
2413
  };
2405
2414
  }
2406
- if (isTokenComment(t)) {
2407
- const t = consumeComment(e, n);
2415
+ if (isTokenComment(s)) {
2416
+ const o = consumeComment(e, n, t);
2408
2417
  return {
2409
- advance: t.advance,
2410
- node: t.node
2418
+ advance: o.advance,
2419
+ node: o.node
2411
2420
  };
2412
2421
  }
2413
2422
  return {
2414
2423
  advance: 1,
2415
- node: new TokenNode(t)
2424
+ node: new TokenNode(s)
2416
2425
  };
2417
2426
  }
2418
- (function(e) {
2419
- e.Function = "function", e.SimpleBlock = "simple-block", e.Whitespace = "whitespace", e.Comment = "comment", e.Token = "token";
2420
- })(f || (f = {}));
2421
2427
  var ContainerNodeBaseClass = class {
2422
2428
  value = [];
2423
2429
  indexOf(e) {
@@ -2442,11 +2448,11 @@ var ContainerNodeBaseClass = class {
2442
2448
  }
2443
2449
  }
2444
2450
  walk(e, n) {
2445
- 0 !== this.value.length && this.forEach((n, t) => !1 !== e(n, t) && (!("walk" in n.node) || !this.value.includes(n.node) || !1 !== n.node.walk(e, n.state)) && void 0, n);
2451
+ 0 !== this.value.length && this.forEach((n, t) => !1 !== e(n, t) && (!("walk" in n.node) || !("number" == typeof t && this.value[t] === n.node || this.value.includes(n.node)) || !1 !== n.node.walk(e, n.state)) && void 0, n);
2446
2452
  }
2447
2453
  };
2448
2454
  var FunctionNode = class FunctionNode extends ContainerNodeBaseClass {
2449
- type = f.Function;
2455
+ type = k$1.Function;
2450
2456
  name;
2451
2457
  endToken;
2452
2458
  constructor(e, n, t) {
@@ -2472,8 +2478,8 @@ var FunctionNode = class FunctionNode extends ContainerNodeBaseClass {
2472
2478
  ];
2473
2479
  }
2474
2480
  toString() {
2475
- const e = this.value.map((e) => isToken(e) ? stringify(e) : e.toString()).join("");
2476
- return stringify(this.name) + e + stringify(this.endToken);
2481
+ const n = this.value.map((n) => isToken(n) ? stringify(n) : n.toString()).join("");
2482
+ return stringify(this.name) + n + stringify(this.endToken);
2477
2483
  }
2478
2484
  toJSON() {
2479
2485
  return {
@@ -2487,33 +2493,35 @@ var FunctionNode = class FunctionNode extends ContainerNodeBaseClass {
2487
2493
  return FunctionNode.isFunctionNode(this);
2488
2494
  }
2489
2495
  static isFunctionNode(e) {
2490
- return !!e && e instanceof FunctionNode && e.type === f.Function;
2496
+ return !!e && e instanceof FunctionNode && e.type === k$1.Function;
2491
2497
  }
2492
2498
  };
2493
- function consumeFunction(n, t) {
2494
- const o = [];
2495
- let s = 1;
2499
+ function consumeFunction(e, t, o, s) {
2500
+ if (s >= N) throw new Error("Maximum nesting depth of 512 exceeded, reduce the complexity of your stylesheet.");
2501
+ const i = [];
2502
+ let r = o + 1;
2496
2503
  for (;;) {
2497
- const i = t[s];
2498
- if (!i || isTokenEOF(i)) return n.onParseError(new ParseError$1("Unexpected EOF while consuming a function.", t[0][2], t[t.length - 1][3], ["5.4.9. Consume a function", "Unexpected EOF"])), {
2499
- advance: t.length,
2500
- node: new FunctionNode(t[0], i, o)
2504
+ const a = t[r];
2505
+ if (!a || isTokenEOF(a)) return e.onParseError(new ParseError$1("Unexpected EOF while consuming a function.", t[o][2], t[t.length - 1][3], ["5.4.9. Consume a function", "Unexpected EOF"])), {
2506
+ advance: t.length - o,
2507
+ node: new FunctionNode(t[o], a, i)
2501
2508
  };
2502
- if (isTokenCloseParen(i)) return {
2503
- advance: s + 1,
2504
- node: new FunctionNode(t[0], i, o)
2509
+ if (isTokenCloseParen(a)) return {
2510
+ advance: r - o + 1,
2511
+ node: new FunctionNode(t[o], a, i)
2505
2512
  };
2506
- if (isTokenWhiteSpaceOrComment(i)) {
2507
- const e = consumeAllCommentsAndWhitespace(n, t.slice(s));
2508
- s += e.advance, o.push(...e.nodes);
2513
+ if (isTokenWhiteSpaceOrComment(a)) {
2514
+ const n = consumeAllCommentsAndWhitespace(e, t, r);
2515
+ r += n.advance;
2516
+ for (let e = 0; e < n.nodes.length; e++) i.push(n.nodes[e]);
2509
2517
  continue;
2510
2518
  }
2511
- const r = consumeComponentValue(n, t.slice(s));
2512
- s += r.advance, o.push(r.node);
2519
+ const c = consumeComponentValue(e, t, r, s + 1);
2520
+ r += c.advance, i.push(c.node);
2513
2521
  }
2514
2522
  }
2515
2523
  var SimpleBlockNode = class SimpleBlockNode extends ContainerNodeBaseClass {
2516
- type = f.SimpleBlock;
2524
+ type = k$1.SimpleBlock;
2517
2525
  startToken;
2518
2526
  endToken;
2519
2527
  constructor(e, n, t) {
@@ -2533,8 +2541,8 @@ var SimpleBlockNode = class SimpleBlockNode extends ContainerNodeBaseClass {
2533
2541
  ];
2534
2542
  }
2535
2543
  toString() {
2536
- const e = this.value.map((e) => isToken(e) ? stringify(e) : e.toString()).join("");
2537
- return stringify(this.startToken) + e + stringify(this.endToken);
2544
+ const n = this.value.map((n) => isToken(n) ? stringify(n) : n.toString()).join("");
2545
+ return stringify(this.startToken) + n + stringify(this.endToken);
2538
2546
  }
2539
2547
  toJSON() {
2540
2548
  return {
@@ -2548,35 +2556,37 @@ var SimpleBlockNode = class SimpleBlockNode extends ContainerNodeBaseClass {
2548
2556
  return SimpleBlockNode.isSimpleBlockNode(this);
2549
2557
  }
2550
2558
  static isSimpleBlockNode(e) {
2551
- return !!e && e instanceof SimpleBlockNode && e.type === f.SimpleBlock;
2559
+ return !!e && e instanceof SimpleBlockNode && e.type === k$1.SimpleBlock;
2552
2560
  }
2553
2561
  };
2554
- function consumeSimpleBlock(n, t) {
2555
- const o = mirrorVariantType(t[0][0]);
2556
- if (!o) throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");
2557
- const s = [];
2558
- let i = 1;
2562
+ function consumeSimpleBlock(e, t, o, s) {
2563
+ if (s >= N) throw new Error("Maximum nesting depth of 512 exceeded, reduce the complexity of your stylesheet.");
2564
+ const i = mirrorVariantType(t[o][0]);
2565
+ if (!i) throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");
2566
+ const r = [];
2567
+ let a = o + 1;
2559
2568
  for (;;) {
2560
- const r = t[i];
2561
- if (!r || isTokenEOF(r)) return n.onParseError(new ParseError$1("Unexpected EOF while consuming a simple block.", t[0][2], t[t.length - 1][3], ["5.4.8. Consume a simple block", "Unexpected EOF"])), {
2562
- advance: t.length,
2563
- node: new SimpleBlockNode(t[0], r, s)
2569
+ const c = t[a];
2570
+ if (!c || isTokenEOF(c)) return e.onParseError(new ParseError$1("Unexpected EOF while consuming a simple block.", t[o][2], t[t.length - 1][3], ["5.4.8. Consume a simple block", "Unexpected EOF"])), {
2571
+ advance: t.length - o,
2572
+ node: new SimpleBlockNode(t[o], c, r)
2564
2573
  };
2565
- if (r[0] === o) return {
2566
- advance: i + 1,
2567
- node: new SimpleBlockNode(t[0], r, s)
2574
+ if (c[0] === i) return {
2575
+ advance: a - o + 1,
2576
+ node: new SimpleBlockNode(t[o], c, r)
2568
2577
  };
2569
- if (isTokenWhiteSpaceOrComment(r)) {
2570
- const e = consumeAllCommentsAndWhitespace(n, t.slice(i));
2571
- i += e.advance, s.push(...e.nodes);
2578
+ if (isTokenWhiteSpaceOrComment(c)) {
2579
+ const n = consumeAllCommentsAndWhitespace(e, t, a);
2580
+ a += n.advance;
2581
+ for (let e = 0; e < n.nodes.length; e++) r.push(n.nodes[e]);
2572
2582
  continue;
2573
2583
  }
2574
- const a = consumeComponentValue(n, t.slice(i));
2575
- i += a.advance, s.push(a.node);
2584
+ const u = consumeComponentValue(e, t, a, s + 1);
2585
+ a += u.advance, r.push(u.node);
2576
2586
  }
2577
2587
  }
2578
2588
  var WhitespaceNode = class WhitespaceNode {
2579
- type = f.Whitespace;
2589
+ type = k$1.Whitespace;
2580
2590
  value;
2581
2591
  constructor(e) {
2582
2592
  this.value = e;
@@ -2585,7 +2595,7 @@ var WhitespaceNode = class WhitespaceNode {
2585
2595
  return this.value;
2586
2596
  }
2587
2597
  toString() {
2588
- return stringify(...this.value);
2598
+ return stringify(this.value);
2589
2599
  }
2590
2600
  toJSON() {
2591
2601
  return {
@@ -2597,22 +2607,22 @@ var WhitespaceNode = class WhitespaceNode {
2597
2607
  return WhitespaceNode.isWhitespaceNode(this);
2598
2608
  }
2599
2609
  static isWhitespaceNode(e) {
2600
- return !!e && e instanceof WhitespaceNode && e.type === f.Whitespace;
2610
+ return !!e && e instanceof WhitespaceNode && e.type === k$1.Whitespace;
2601
2611
  }
2602
2612
  };
2603
- function consumeWhitespace(e, n) {
2604
- let t = 0;
2613
+ function consumeWhitespace(e, n, t) {
2614
+ let o = t;
2605
2615
  for (;;) {
2606
- const e = n[t];
2616
+ const e = n[o];
2607
2617
  if (!isTokenWhitespace(e)) return {
2608
- advance: t,
2609
- node: new WhitespaceNode(n.slice(0, t))
2618
+ advance: o - t,
2619
+ node: new WhitespaceNode(n.slice(t, o))
2610
2620
  };
2611
- t++;
2621
+ o++;
2612
2622
  }
2613
2623
  }
2614
2624
  var CommentNode = class CommentNode {
2615
- type = f.Comment;
2625
+ type = k$1.Comment;
2616
2626
  value;
2617
2627
  constructor(e) {
2618
2628
  this.value = e;
@@ -2633,33 +2643,33 @@ var CommentNode = class CommentNode {
2633
2643
  return CommentNode.isCommentNode(this);
2634
2644
  }
2635
2645
  static isCommentNode(e) {
2636
- return !!e && e instanceof CommentNode && e.type === f.Comment;
2646
+ return !!e && e instanceof CommentNode && e.type === k$1.Comment;
2637
2647
  }
2638
2648
  };
2639
- function consumeComment(e, n) {
2649
+ function consumeComment(e, n, t) {
2640
2650
  return {
2641
2651
  advance: 1,
2642
- node: new CommentNode(n[0])
2652
+ node: new CommentNode(n[t])
2643
2653
  };
2644
2654
  }
2645
- function consumeAllCommentsAndWhitespace(e, n) {
2646
- const t = [];
2647
- let o = 0;
2655
+ function consumeAllCommentsAndWhitespace(e, n, t) {
2656
+ const o = [];
2657
+ let s = t;
2648
2658
  for (;;) {
2649
- if (isTokenWhitespace(n[o])) {
2650
- const e = consumeWhitespace(0, n.slice(o));
2651
- o += e.advance, t.push(e.node);
2659
+ if (isTokenWhitespace(n[s])) {
2660
+ const e = consumeWhitespace(0, n, s);
2661
+ s += e.advance, o.push(e.node);
2652
2662
  continue;
2653
2663
  }
2654
- if (!isTokenComment(n[o])) return {
2655
- advance: o,
2656
- nodes: t
2664
+ if (!isTokenComment(n[s])) return {
2665
+ advance: s - t,
2666
+ nodes: o
2657
2667
  };
2658
- t.push(new CommentNode(n[o])), o++;
2668
+ o.push(new CommentNode(n[s])), s++;
2659
2669
  }
2660
2670
  }
2661
2671
  var TokenNode = class TokenNode {
2662
- type = f.Token;
2672
+ type = k$1.Token;
2663
2673
  value;
2664
2674
  constructor(e) {
2665
2675
  this.value = e;
@@ -2680,11 +2690,12 @@ var TokenNode = class TokenNode {
2680
2690
  return TokenNode.isTokenNode(this);
2681
2691
  }
2682
2692
  static isTokenNode(e) {
2683
- return !!e && e instanceof TokenNode && e.type === f.Token;
2693
+ return !!e && e instanceof TokenNode && e.type === k$1.Token;
2684
2694
  }
2685
2695
  };
2686
- function parseComponentValue(t, o) {
2687
- const s = { onParseError: o?.onParseError ?? (() => {}) }, i = [...t];
2696
+ function parseComponentValue(e, o) {
2697
+ const s = { onParseError: o?.onParseError ?? (() => {}) }, i = [...e];
2698
+ if (0 === i.length) return;
2688
2699
  isTokenEOF(i[i.length - 1]) || i.push([
2689
2700
  u$1.EOF,
2690
2701
  "",
@@ -2694,7 +2705,7 @@ function parseComponentValue(t, o) {
2694
2705
  ]);
2695
2706
  const r = consumeComponentValue(s, i);
2696
2707
  if (isTokenEOF(i[Math.min(r.advance, i.length - 1)])) return r.node;
2697
- s.onParseError(new ParseError$1("Expected EOF after parsing a component value.", t[0][2], t[t.length - 1][3], ["5.3.9. Parse a component value", "Expected EOF"]));
2708
+ s.onParseError(new ParseError$1("Expected EOF after parsing a component value.", e[0][2], e[e.length - 1][3], ["5.3.9. Parse a component value", "Expected EOF"]));
2698
2709
  }
2699
2710
  function forEach(e, n, t) {
2700
2711
  if (0 === e.length) return;
@@ -2712,7 +2723,7 @@ function forEach(e, n, t) {
2712
2723
  }
2713
2724
  }
2714
2725
  function walk(e, n, t) {
2715
- 0 !== e.length && forEach(e, (t, o) => !1 !== n(t, o) && (!("walk" in t.node) || !e.includes(t.node) || !1 !== t.node.walk(n, t.state)) && void 0, t);
2726
+ 0 !== e.length && forEach(e, (t, o) => !1 !== n(t, o) && (!("walk" in t.node) || !("number" == typeof o && e[o] === t.node || e.includes(t.node)) || !1 !== t.node.walk(n, t.state)) && void 0, t);
2716
2727
  }
2717
2728
  function replaceComponentValues$1(e, n) {
2718
2729
  for (let t = 0; t < e.length; t++) walk(e[t], (e, t) => {
@@ -2751,7 +2762,7 @@ function sourceIndices(e) {
2751
2762
  return t && o ? [t[2], o[3]] : [0, 0];
2752
2763
  }
2753
2764
  //#endregion
2754
- //#region ../../node_modules/.pnpm/@csstools+css-calc@3.4.0_@csstools+css-parser-algorithms@4.0.0_@csstools+css-tokenizer@_2890c6a65aa9b6b5d7856150ce77fa7e/node_modules/@csstools/css-calc/dist/index.mjs
2765
+ //#region ../../node_modules/.pnpm/@csstools+css-calc@3.4.1_@csstools+css-parser-algorithms@4.0.1_@csstools+css-tokenizer@_c27b91014f1d16725d86a05c76dde1c4/node_modules/@csstools/css-calc/dist/index.mjs
2755
2766
  var ParseError = class extends Error {
2756
2767
  sourceStart;
2757
2768
  sourceEnd;
@@ -2765,15 +2776,15 @@ var ParseErrorWithComponentValues = class extends ParseError {
2765
2776
  super(n, ...sourceIndices(t)), this.componentValues = t;
2766
2777
  }
2767
2778
  };
2768
- const I = {
2779
+ const S = {
2769
2780
  UnexpectedAdditionOfDimensionOrPercentageWithNumber: "Unexpected addition of a dimension or percentage with a number.",
2770
2781
  UnexpectedSubtractionOfDimensionOrPercentageWithNumber: "Unexpected subtraction of a dimension or percentage with a number."
2771
2782
  };
2772
- const x = /[A-Z]/g;
2783
+ const y = /[A-Z]/g;
2773
2784
  function toLowerCaseAZ$1(e) {
2774
- return e.replace(x, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
2785
+ return e.replace(y, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
2775
2786
  }
2776
- const M = {
2787
+ const I = {
2777
2788
  cm: "px",
2778
2789
  in: "px",
2779
2790
  mm: "px",
@@ -2790,7 +2801,7 @@ const M = {
2790
2801
  hz: "hz",
2791
2802
  khz: "hz"
2792
2803
  };
2793
- const T = /* @__PURE__ */ new Map([
2804
+ const x = /* @__PURE__ */ new Map([
2794
2805
  ["cm", (e) => e],
2795
2806
  ["mm", (e) => 10 * e],
2796
2807
  ["q", (e) => 40 * e],
@@ -2799,20 +2810,20 @@ const T = /* @__PURE__ */ new Map([
2799
2810
  ["pt", (e) => e / 2.54 * 72],
2800
2811
  ["px", (e) => e / 2.54 * 96]
2801
2812
  ]);
2802
- const P = /* @__PURE__ */ new Map([
2813
+ const M = /* @__PURE__ */ new Map([
2803
2814
  ["deg", (e) => e],
2804
2815
  ["grad", (e) => e / .9],
2805
2816
  ["rad", (e) => e / 180 * Math.PI],
2806
2817
  ["turn", (e) => e / 360]
2807
2818
  ]);
2808
- const k = /* @__PURE__ */ new Map([
2819
+ const T = /* @__PURE__ */ new Map([
2809
2820
  ["deg", (e) => .9 * e],
2810
2821
  ["grad", (e) => e],
2811
2822
  ["rad", (e) => .9 * e / 180 * Math.PI],
2812
2823
  ["turn", (e) => .9 * e / 360]
2813
2824
  ]);
2814
- const W = /* @__PURE__ */ new Map([["hz", (e) => e], ["khz", (e) => e / 1e3]]);
2815
- const O = /* @__PURE__ */ new Map([
2825
+ const P = /* @__PURE__ */ new Map([["hz", (e) => e], ["khz", (e) => e / 1e3]]);
2826
+ const k = /* @__PURE__ */ new Map([
2816
2827
  ["cm", (e) => 2.54 * e],
2817
2828
  ["mm", (e) => 25.4 * e],
2818
2829
  ["q", (e) => 25.4 * e * 4],
@@ -2821,8 +2832,8 @@ const O = /* @__PURE__ */ new Map([
2821
2832
  ["pt", (e) => 72 * e],
2822
2833
  ["px", (e) => 96 * e]
2823
2834
  ]);
2824
- const U = /* @__PURE__ */ new Map([["hz", (e) => 1e3 * e], ["khz", (e) => e]]);
2825
- const L = /* @__PURE__ */ new Map([
2835
+ const W = /* @__PURE__ */ new Map([["hz", (e) => 1e3 * e], ["khz", (e) => e]]);
2836
+ const O = /* @__PURE__ */ new Map([
2826
2837
  ["cm", (e) => e / 10],
2827
2838
  ["mm", (e) => e],
2828
2839
  ["q", (e) => 4 * e],
@@ -2831,8 +2842,8 @@ const L = /* @__PURE__ */ new Map([
2831
2842
  ["pt", (e) => e / 25.4 * 72],
2832
2843
  ["px", (e) => e / 25.4 * 96]
2833
2844
  ]);
2834
- const $ = /* @__PURE__ */ new Map([["ms", (e) => e], ["s", (e) => e / 1e3]]);
2835
- const V = /* @__PURE__ */ new Map([
2845
+ const U = /* @__PURE__ */ new Map([["ms", (e) => e], ["s", (e) => e / 1e3]]);
2846
+ const L = /* @__PURE__ */ new Map([
2836
2847
  ["cm", (e) => e / 6 * 2.54],
2837
2848
  ["mm", (e) => e / 6 * 25.4],
2838
2849
  ["q", (e) => e / 6 * 25.4 * 4],
@@ -2841,7 +2852,7 @@ const V = /* @__PURE__ */ new Map([
2841
2852
  ["pt", (e) => e / 6 * 72],
2842
2853
  ["px", (e) => e / 6 * 96]
2843
2854
  ]);
2844
- const Z = /* @__PURE__ */ new Map([
2855
+ const $ = /* @__PURE__ */ new Map([
2845
2856
  ["cm", (e) => e / 72 * 2.54],
2846
2857
  ["mm", (e) => e / 72 * 25.4],
2847
2858
  ["q", (e) => e / 72 * 25.4 * 4],
@@ -2850,7 +2861,7 @@ const Z = /* @__PURE__ */ new Map([
2850
2861
  ["pt", (e) => e],
2851
2862
  ["px", (e) => e / 72 * 96]
2852
2863
  ]);
2853
- const z = /* @__PURE__ */ new Map([
2864
+ const V = /* @__PURE__ */ new Map([
2854
2865
  ["cm", (e) => e / 96 * 2.54],
2855
2866
  ["mm", (e) => e / 96 * 25.4],
2856
2867
  ["q", (e) => e / 96 * 25.4 * 4],
@@ -2859,7 +2870,7 @@ const z = /* @__PURE__ */ new Map([
2859
2870
  ["pt", (e) => e / 96 * 72],
2860
2871
  ["px", (e) => e]
2861
2872
  ]);
2862
- const q = /* @__PURE__ */ new Map([
2873
+ const Z = /* @__PURE__ */ new Map([
2863
2874
  ["cm", (e) => e / 4 / 10],
2864
2875
  ["mm", (e) => e / 4],
2865
2876
  ["q", (e) => e],
@@ -2868,123 +2879,123 @@ const q = /* @__PURE__ */ new Map([
2868
2879
  ["pt", (e) => e / 4 / 25.4 * 72],
2869
2880
  ["px", (e) => e / 4 / 25.4 * 96]
2870
2881
  ]);
2871
- const G = /* @__PURE__ */ new Map([
2882
+ const z = /* @__PURE__ */ new Map([
2872
2883
  ["deg", (e) => 180 * e / Math.PI],
2873
2884
  ["grad", (e) => 180 * e / Math.PI / .9],
2874
2885
  ["rad", (e) => e],
2875
2886
  ["turn", (e) => 180 * e / Math.PI / 360]
2876
2887
  ]);
2877
- const R = /* @__PURE__ */ new Map([["ms", (e) => 1e3 * e], ["s", (e) => e]]);
2878
- const j = /* @__PURE__ */ new Map([
2888
+ const q = /* @__PURE__ */ new Map([["ms", (e) => 1e3 * e], ["s", (e) => e]]);
2889
+ const R = /* @__PURE__ */ new Map([
2879
2890
  ["deg", (e) => 360 * e],
2880
2891
  ["grad", (e) => 360 * e / .9],
2881
2892
  ["rad", (e) => 360 * e / 180 * Math.PI],
2882
2893
  ["turn", (e) => e]
2883
2894
  ]);
2884
- const Y = /* @__PURE__ */ new Map([
2885
- ["cm", T],
2886
- ["mm", L],
2887
- ["q", q],
2888
- ["in", O],
2889
- ["pc", V],
2890
- ["pt", Z],
2891
- ["px", z],
2892
- ["ms", $],
2893
- ["s", R],
2894
- ["deg", P],
2895
- ["grad", k],
2896
- ["rad", G],
2897
- ["turn", j],
2898
- ["hz", W],
2899
- ["khz", U]
2895
+ const G = /* @__PURE__ */ new Map([
2896
+ ["cm", x],
2897
+ ["mm", O],
2898
+ ["q", Z],
2899
+ ["in", k],
2900
+ ["pc", L],
2901
+ ["pt", $],
2902
+ ["px", V],
2903
+ ["ms", U],
2904
+ ["s", q],
2905
+ ["deg", M],
2906
+ ["grad", T],
2907
+ ["rad", z],
2908
+ ["turn", R],
2909
+ ["hz", P],
2910
+ ["khz", W]
2900
2911
  ]);
2901
2912
  function convertUnit(e, n) {
2902
2913
  if (!isTokenDimension(e)) return n;
2903
2914
  if (!isTokenDimension(n)) return n;
2904
2915
  const t = toLowerCaseAZ$1(e[4].unit), r = toLowerCaseAZ$1(n[4].unit);
2905
2916
  if (t === r) return n;
2906
- const a = Y.get(r);
2907
- if (!a) return n;
2908
- const u = a.get(t);
2917
+ const u = G.get(r);
2909
2918
  if (!u) return n;
2910
- const o = u(n[4].value), i = [
2919
+ const a = u.get(t);
2920
+ if (!a) return n;
2921
+ const i = a(n[4].value), o = [
2911
2922
  u$1.Dimension,
2912
2923
  "",
2913
2924
  n[2],
2914
2925
  n[3],
2915
2926
  {
2916
2927
  ...n[4],
2917
- signCharacter: o < 0 ? "-" : void 0,
2918
- type: Number.isInteger(o) ? a$1.Integer : a$1.Number,
2919
- value: o
2928
+ signCharacter: i < 0 ? "-" : void 0,
2929
+ type: Number.isInteger(i) ? a$1.Integer : a$1.Number,
2930
+ value: i
2920
2931
  }
2921
2932
  ];
2922
- return mutateUnit(i, e[4].unit), i;
2933
+ return mutateUnit(o, e[4].unit), o;
2923
2934
  }
2924
2935
  function toCanonicalUnit(e) {
2925
2936
  if (!isTokenDimension(e)) return e;
2926
- const n = toLowerCaseAZ$1(e[4].unit), t = M[n];
2937
+ const n = toLowerCaseAZ$1(e[4].unit), t = I[n];
2927
2938
  if (n === t) return e;
2928
- const r = Y.get(n);
2939
+ const r = G.get(n);
2929
2940
  if (!r) return e;
2930
- const a = r.get(t);
2931
- if (!a) return e;
2932
- const u = a(e[4].value), o = [
2941
+ const u = r.get(t);
2942
+ if (!u) return e;
2943
+ const a = u(e[4].value), i = [
2933
2944
  u$1.Dimension,
2934
2945
  "",
2935
2946
  e[2],
2936
2947
  e[3],
2937
2948
  {
2938
2949
  ...e[4],
2939
- signCharacter: u < 0 ? "-" : void 0,
2940
- type: Number.isInteger(u) ? a$1.Integer : a$1.Number,
2941
- value: u
2950
+ signCharacter: a < 0 ? "-" : void 0,
2951
+ type: Number.isInteger(a) ? a$1.Integer : a$1.Number,
2952
+ value: a
2942
2953
  }
2943
2954
  ];
2944
- return mutateUnit(o, t), o;
2955
+ return mutateUnit(i, t), i;
2945
2956
  }
2946
2957
  function addition(e, t) {
2947
2958
  if (2 !== e.length) return -1;
2948
2959
  const r = e[0].value;
2949
- let a = e[1].value;
2950
- if (isTokenNumber(r) && isTokenNumber(a)) {
2951
- const e = r[4].value + a[4].value;
2960
+ let u = e[1].value;
2961
+ if (isTokenNumber(r) && isTokenNumber(u)) {
2962
+ const e = r[4].value + u[4].value;
2952
2963
  return new TokenNode([
2953
2964
  u$1.Number,
2954
2965
  e.toString(),
2955
2966
  r[2],
2956
- a[3],
2967
+ u[3],
2957
2968
  {
2958
2969
  value: e,
2959
- type: r[4].type === a$1.Integer && a[4].type === a$1.Integer ? a$1.Integer : a$1.Number
2970
+ type: r[4].type === a$1.Integer && u[4].type === a$1.Integer ? a$1.Integer : a$1.Number
2960
2971
  }
2961
2972
  ]);
2962
2973
  }
2963
- if (isTokenPercentage(r) && isTokenPercentage(a)) {
2964
- const e = r[4].value + a[4].value;
2974
+ if (isTokenPercentage(r) && isTokenPercentage(u)) {
2975
+ const e = r[4].value + u[4].value;
2965
2976
  return new TokenNode([
2966
2977
  u$1.Percentage,
2967
2978
  e.toString() + "%",
2968
2979
  r[2],
2969
- a[3],
2980
+ u[3],
2970
2981
  { value: e }
2971
2982
  ]);
2972
2983
  }
2973
- if (isTokenDimension(r) && isTokenDimension(a) && (a = convertUnit(r, a), toLowerCaseAZ$1(r[4].unit) === toLowerCaseAZ$1(a[4].unit))) {
2974
- const e = r[4].value + a[4].value;
2984
+ if (isTokenDimension(r) && isTokenDimension(u) && (u = convertUnit(r, u), toLowerCaseAZ$1(r[4].unit) === toLowerCaseAZ$1(u[4].unit))) {
2985
+ const e = r[4].value + u[4].value;
2975
2986
  return new TokenNode([
2976
2987
  u$1.Dimension,
2977
2988
  e.toString() + r[4].unit,
2978
2989
  r[2],
2979
- a[3],
2990
+ u[3],
2980
2991
  {
2981
2992
  value: e,
2982
- type: r[4].type === a$1.Integer && a[4].type === a$1.Integer ? a$1.Integer : a$1.Number,
2993
+ type: r[4].type === a$1.Integer && u[4].type === a$1.Integer ? a$1.Integer : a$1.Number,
2983
2994
  unit: r[4].unit
2984
2995
  }
2985
2996
  ]);
2986
2997
  }
2987
- return (isTokenNumber(r) && (isTokenDimension(a) || isTokenPercentage(a)) || isTokenNumber(a) && (isTokenDimension(r) || isTokenPercentage(r))) && t.onParseError?.(new ParseErrorWithComponentValues(I.UnexpectedAdditionOfDimensionOrPercentageWithNumber, e)), -1;
2998
+ return (isTokenNumber(r) && (isTokenDimension(u) || isTokenPercentage(u)) || isTokenNumber(u) && (isTokenDimension(r) || isTokenPercentage(r))) && t.onParseError?.(new ParseErrorWithComponentValues(S.UnexpectedAdditionOfDimensionOrPercentageWithNumber, e)), -1;
2988
2999
  }
2989
3000
  function division(e) {
2990
3001
  if (2 !== e.length) return -1;
@@ -3033,18 +3044,36 @@ function isCalculation(e) {
3033
3044
  }
3034
3045
  function solve(e, n) {
3035
3046
  if (-1 === e) return -1;
3036
- const r = [];
3037
- for (let a = 0; a < e.inputs.length; a++) {
3038
- const u = e.inputs[a];
3039
- if (isTokenNode(u)) {
3040
- r.push(u);
3047
+ const r = [{
3048
+ calculation: e,
3049
+ inputs: [],
3050
+ index: 0
3051
+ }];
3052
+ let u = -1;
3053
+ for (; r.length;) {
3054
+ const e = r[r.length - 1];
3055
+ if (e.index < e.calculation.inputs.length) {
3056
+ const n = e.calculation.inputs[e.index];
3057
+ if (e.index++, isTokenNode(n)) {
3058
+ e.inputs.push(n);
3059
+ continue;
3060
+ }
3061
+ r.push({
3062
+ calculation: n,
3063
+ inputs: [],
3064
+ index: 0
3065
+ });
3041
3066
  continue;
3042
3067
  }
3043
- const o = solve(u, n);
3044
- if (-1 === o) return -1;
3045
- r.push(o);
3068
+ const a = e.calculation.operation(e.inputs, n);
3069
+ if (r.pop(), -1 === a) return -1;
3070
+ if (!r.length) {
3071
+ u = a;
3072
+ break;
3073
+ }
3074
+ r[r.length - 1].inputs.push(a);
3046
3075
  }
3047
- return e.operation(r, n);
3076
+ return u;
3048
3077
  }
3049
3078
  function multiplication(e) {
3050
3079
  if (2 !== e.length) return -1;
@@ -3113,19 +3142,19 @@ function multiplication(e) {
3113
3142
  return -1;
3114
3143
  }
3115
3144
  function resolveGlobalsAndConstants(e, r) {
3116
- for (let a = 0; a < e.length; a++) {
3117
- const u = e[a];
3118
- if (!isTokenNode(u)) continue;
3119
- const o = u.value;
3120
- if (!isTokenIdent(o)) continue;
3121
- const i = toLowerCaseAZ$1(o[4].value);
3122
- switch (i) {
3145
+ for (let u = 0; u < e.length; u++) {
3146
+ const a = e[u];
3147
+ if (!isTokenNode(a)) continue;
3148
+ const i = a.value;
3149
+ if (!isTokenIdent(i)) continue;
3150
+ const o = toLowerCaseAZ$1(i[4].value);
3151
+ switch (o) {
3123
3152
  case "e":
3124
- e.splice(a, 1, new TokenNode([
3153
+ e.splice(u, 1, new TokenNode([
3125
3154
  u$1.Number,
3126
3155
  Math.E.toString(),
3127
- o[2],
3128
- o[3],
3156
+ i[2],
3157
+ i[3],
3129
3158
  {
3130
3159
  value: Math.E,
3131
3160
  type: a$1.Number
@@ -3133,11 +3162,11 @@ function resolveGlobalsAndConstants(e, r) {
3133
3162
  ]));
3134
3163
  break;
3135
3164
  case "pi":
3136
- e.splice(a, 1, new TokenNode([
3165
+ e.splice(u, 1, new TokenNode([
3137
3166
  u$1.Number,
3138
3167
  Math.PI.toString(),
3139
- o[2],
3140
- o[3],
3168
+ i[2],
3169
+ i[3],
3141
3170
  {
3142
3171
  value: Math.PI,
3143
3172
  type: a$1.Number
@@ -3145,11 +3174,11 @@ function resolveGlobalsAndConstants(e, r) {
3145
3174
  ]));
3146
3175
  break;
3147
3176
  case "infinity":
3148
- e.splice(a, 1, new TokenNode([
3177
+ e.splice(u, 1, new TokenNode([
3149
3178
  u$1.Number,
3150
3179
  "infinity",
3151
- o[2],
3152
- o[3],
3180
+ i[2],
3181
+ i[3],
3153
3182
  {
3154
3183
  value: 1 / 0,
3155
3184
  type: a$1.Number
@@ -3157,11 +3186,11 @@ function resolveGlobalsAndConstants(e, r) {
3157
3186
  ]));
3158
3187
  break;
3159
3188
  case "-infinity":
3160
- e.splice(a, 1, new TokenNode([
3189
+ e.splice(u, 1, new TokenNode([
3161
3190
  u$1.Number,
3162
3191
  "-infinity",
3163
- o[2],
3164
- o[3],
3192
+ i[2],
3193
+ i[3],
3165
3194
  {
3166
3195
  value: -1 / 0,
3167
3196
  type: a$1.Number
@@ -3169,20 +3198,20 @@ function resolveGlobalsAndConstants(e, r) {
3169
3198
  ]));
3170
3199
  break;
3171
3200
  case "nan":
3172
- e.splice(a, 1, new TokenNode([
3201
+ e.splice(u, 1, new TokenNode([
3173
3202
  u$1.Number,
3174
3203
  "NaN",
3175
- o[2],
3176
- o[3],
3204
+ i[2],
3205
+ i[3],
3177
3206
  {
3178
3207
  value: NaN,
3179
3208
  type: a$1.Number
3180
3209
  }
3181
3210
  ]));
3182
3211
  break;
3183
- default: if (r.has(i)) {
3184
- const t = r.get(i);
3185
- e.splice(a, 1, new TokenNode(t));
3212
+ default: if (r.has(o)) {
3213
+ const t = r.get(o);
3214
+ e.splice(u, 1, new TokenNode(t));
3186
3215
  }
3187
3216
  }
3188
3217
  }
@@ -3197,13 +3226,13 @@ function resultToCalculation(e, n, t) {
3197
3226
  return isTokenDimension(n) ? dimensionToCalculation(e, n[4].unit, t) : isTokenPercentage(n) ? percentageToCalculation(e, t) : isTokenNumber(n) ? numberToCalculation(e, t) : -1;
3198
3227
  }
3199
3228
  function dimensionToCalculation(e, t, r) {
3200
- const a = e.tokens();
3229
+ const u = e.tokens();
3201
3230
  return {
3202
3231
  inputs: [new TokenNode([
3203
3232
  u$1.Dimension,
3204
3233
  r.toString() + t,
3205
- a[0][2],
3206
- a[a.length - 1][3],
3234
+ u[0][2],
3235
+ u[u.length - 1][3],
3207
3236
  {
3208
3237
  value: r,
3209
3238
  type: Number.isInteger(r) ? a$1.Integer : a$1.Number,
@@ -3268,9 +3297,9 @@ function arrayOfSameNumeric(e) {
3268
3297
  if (isTokenDimension(n)) {
3269
3298
  const t = toLowerCaseAZ$1(n[4].unit);
3270
3299
  for (let r = 1; r < e.length; r++) {
3271
- const a = e[r];
3272
- if (n[0] !== a[0]) return !1;
3273
- if (t !== toLowerCaseAZ$1(a[4].unit)) return !1;
3300
+ const u = e[r];
3301
+ if (n[0] !== u[0]) return !1;
3302
+ if (t !== toLowerCaseAZ$1(u[4].unit)) return !1;
3274
3303
  }
3275
3304
  return !0;
3276
3305
  }
@@ -3286,26 +3315,28 @@ function twoOfSameNumeric(e, n) {
3286
3315
  function solveATan2(e, n, t) {
3287
3316
  const r = n.value;
3288
3317
  if (!isDimensionOrNumber(r)) return -1;
3289
- const a = convertUnit(r, t.value);
3290
- if (!twoOfSameNumeric(r, a)) return -1;
3291
- return dimensionToCalculation(e, "rad", Math.atan2(r[4].value, a[4].value));
3318
+ const u = convertUnit(r, t.value);
3319
+ if (!twoOfSameNumeric(r, u)) return -1;
3320
+ return dimensionToCalculation(e, "rad", Math.atan2(r[4].value, u[4].value));
3292
3321
  }
3293
3322
  function solveAbs(e, n, t) {
3294
3323
  const r = n.value;
3295
3324
  if (!isTokenNumeric(r)) return -1;
3325
+ if (Number.isNaN(r[4].value)) return resultToCalculation(e, r, NaN);
3296
3326
  if (!t.rawPercentages && isTokenPercentage(r)) return -1;
3297
3327
  return resultToCalculation(e, r, Math.abs(r[4].value));
3298
3328
  }
3299
- function solveClamp(e, n, r, a, u) {
3300
- if (!isTokenNode(n) || !isTokenNode(r) || !isTokenNode(a)) return -1;
3301
- const o = n.value;
3302
- if (!isTokenNumeric(o)) return -1;
3303
- if (!u.rawPercentages && isTokenPercentage(o)) return -1;
3304
- const i = convertUnit(o, r.value);
3305
- if (!twoOfSameNumeric(o, i)) return -1;
3306
- const l = convertUnit(o, a.value);
3307
- if (!twoOfSameNumeric(o, l)) return -1;
3308
- return resultToCalculation(e, o, Math.max(o[4].value, Math.min(i[4].value, l[4].value)));
3329
+ function solveClamp(e, n, r, u, a) {
3330
+ if (!isTokenNode(n) || !isTokenNode(r) || !isTokenNode(u)) return -1;
3331
+ const i = n.value;
3332
+ if (!isTokenNumeric(i)) return -1;
3333
+ const o = convertUnit(i, r.value);
3334
+ if (!twoOfSameNumeric(i, o)) return -1;
3335
+ const l = convertUnit(i, u.value);
3336
+ if (!twoOfSameNumeric(i, l)) return -1;
3337
+ if (Number.isNaN(i[4].value) || Number.isNaN(o[4].value) || Number.isNaN(l[4].value)) return resultToCalculation(e, i, NaN);
3338
+ if (!a.rawPercentages && isTokenPercentage(i)) return -1;
3339
+ return resultToCalculation(e, i, Math.max(i[4].value, Math.min(o[4].value, l[4].value)));
3309
3340
  }
3310
3341
  function solveCos(e, n) {
3311
3342
  const t = n.value;
@@ -3314,13 +3345,13 @@ function solveCos(e, n) {
3314
3345
  if (isTokenDimension(t)) switch (t[4].unit.toLowerCase()) {
3315
3346
  case "rad": break;
3316
3347
  case "deg":
3317
- r = P.get("rad")(t[4].value);
3348
+ r = M.get("rad")(t[4].value);
3318
3349
  break;
3319
3350
  case "grad":
3320
- r = k.get("rad")(t[4].value);
3351
+ r = T.get("rad")(t[4].value);
3321
3352
  break;
3322
3353
  case "turn":
3323
- r = j.get("rad")(t[4].value);
3354
+ r = R.get("rad")(t[4].value);
3324
3355
  break;
3325
3356
  default: return -1;
3326
3357
  }
@@ -3333,59 +3364,64 @@ function solveExp(e, n) {
3333
3364
  }
3334
3365
  function solveHypot(e, n, r) {
3335
3366
  if (!n.every(isTokenNode)) return -1;
3336
- const a = n[0].value;
3337
- if (!isTokenNumeric(a)) return -1;
3338
- if (!r.rawPercentages && isTokenPercentage(a)) return -1;
3339
- const u = n.map((e) => convertUnit(a, e.value));
3340
- if (!arrayOfSameNumeric(u)) return -1;
3341
- const o = u.map((e) => e[4].value);
3342
- return resultToCalculation(e, a, Math.hypot(...o));
3367
+ const u = n[0].value;
3368
+ if (!isTokenNumeric(u)) return -1;
3369
+ const a = n.map((e) => convertUnit(u, e.value));
3370
+ if (!arrayOfSameNumeric(a)) return -1;
3371
+ if (a.some((e) => Number.isNaN(e[4].value))) return resultToCalculation(e, u, NaN);
3372
+ if (!r.rawPercentages && isTokenPercentage(u)) return -1;
3373
+ const i = a.map((e) => e[4].value);
3374
+ if (i.some(Number.isNaN)) return resultToCalculation(e, u, NaN);
3375
+ return resultToCalculation(e, u, Math.hypot(...i));
3343
3376
  }
3344
3377
  function solveMax(e, n, r) {
3345
3378
  if (!n.every(isTokenNode)) return -1;
3346
- const a = n[0].value;
3347
- if (!isTokenNumeric(a)) return -1;
3348
- if (!r.rawPercentages && isTokenPercentage(a)) return -1;
3349
- const u = n.map((e) => convertUnit(a, e.value));
3350
- if (!arrayOfSameNumeric(u)) return -1;
3351
- const o = u.map((e) => e[4].value);
3352
- return resultToCalculation(e, a, Math.max(...o));
3379
+ const u = n[0].value;
3380
+ if (!isTokenNumeric(u)) return -1;
3381
+ const a = n.map((e) => convertUnit(u, e.value));
3382
+ if (!arrayOfSameNumeric(a)) return -1;
3383
+ if (a.some((e) => Number.isNaN(e[4].value))) return resultToCalculation(e, u, NaN);
3384
+ if (!r.rawPercentages && isTokenPercentage(u)) return -1;
3385
+ const i = a.map((e) => e[4].value);
3386
+ return resultToCalculation(e, u, Math.max(...i));
3353
3387
  }
3354
3388
  function solveMin(e, n, r) {
3355
3389
  if (!n.every(isTokenNode)) return -1;
3356
- const a = n[0].value;
3357
- if (!isTokenNumeric(a)) return -1;
3358
- if (!r.rawPercentages && isTokenPercentage(a)) return -1;
3359
- const u = n.map((e) => convertUnit(a, e.value));
3360
- if (!arrayOfSameNumeric(u)) return -1;
3361
- const o = u.map((e) => e[4].value);
3362
- return resultToCalculation(e, a, Math.min(...o));
3390
+ const u = n[0].value;
3391
+ if (!isTokenNumeric(u)) return -1;
3392
+ const a = n.map((e) => convertUnit(u, e.value));
3393
+ if (!arrayOfSameNumeric(a)) return -1;
3394
+ if (a.some((e) => Number.isNaN(e[4].value))) return resultToCalculation(e, u, NaN);
3395
+ if (!r.rawPercentages && isTokenPercentage(u)) return -1;
3396
+ const i = a.map((e) => e[4].value);
3397
+ return resultToCalculation(e, u, Math.min(...i));
3363
3398
  }
3364
3399
  function solveMod(e, n, t) {
3365
3400
  const r = n.value;
3366
3401
  if (!isTokenNumeric(r)) return -1;
3367
- const a = convertUnit(r, t.value);
3368
- if (!twoOfSameNumeric(r, a)) return -1;
3369
- let u;
3370
- return u = 0 === a[4].value ? NaN : Number.isFinite(r[4].value) && (Number.isFinite(a[4].value) || (a[4].value !== Number.POSITIVE_INFINITY || r[4].value !== Number.NEGATIVE_INFINITY && !Object.is(0 * r[4].value, -0)) && (a[4].value !== Number.NEGATIVE_INFINITY || r[4].value !== Number.POSITIVE_INFINITY && !Object.is(0 * r[4].value, 0))) ? Number.isFinite(a[4].value) ? (r[4].value % a[4].value + a[4].value) % a[4].value : r[4].value : NaN, resultToCalculation(e, r, u);
3402
+ const u = convertUnit(r, t.value);
3403
+ if (!twoOfSameNumeric(r, u)) return -1;
3404
+ let a;
3405
+ return a = Number.isNaN(r[4].value) || Number.isNaN(u[4].value) || 0 === u[4].value ? NaN : Number.isFinite(r[4].value) && (Number.isFinite(u[4].value) || (u[4].value !== Number.POSITIVE_INFINITY || r[4].value !== Number.NEGATIVE_INFINITY && !Object.is(0 * r[4].value, -0)) && (u[4].value !== Number.NEGATIVE_INFINITY || r[4].value !== Number.POSITIVE_INFINITY && !Object.is(0 * r[4].value, 0))) ? Number.isFinite(u[4].value) ? (r[4].value % u[4].value + u[4].value) % u[4].value : r[4].value : NaN, resultToCalculation(e, r, a);
3371
3406
  }
3372
3407
  function solvePow(e, n, t) {
3373
- const r = n.value, a = t.value;
3408
+ const r = n.value, u = t.value;
3374
3409
  if (!isTokenNumber(r)) return -1;
3375
- if (!twoOfSameNumeric(r, a)) return -1;
3376
- return numberToCalculation(e, Math.pow(r[4].value, a[4].value));
3410
+ if (!twoOfSameNumeric(r, u)) return -1;
3411
+ if (Number.isNaN(r[4].value) || Number.isNaN(u[4].value)) return numberToCalculation(e, NaN);
3412
+ return numberToCalculation(e, Math.pow(r[4].value, u[4].value));
3377
3413
  }
3378
3414
  function solveRem(e, n, t) {
3379
3415
  const r = n.value;
3380
3416
  if (!isTokenNumeric(r)) return -1;
3381
- const a = convertUnit(r, t.value);
3382
- if (!twoOfSameNumeric(r, a)) return -1;
3383
- let u;
3384
- return u = 0 === a[4].value ? NaN : Number.isFinite(r[4].value) ? Number.isFinite(a[4].value) ? r[4].value % a[4].value : r[4].value : NaN, resultToCalculation(e, r, u);
3417
+ const u = convertUnit(r, t.value);
3418
+ if (!twoOfSameNumeric(r, u)) return -1;
3419
+ let a;
3420
+ return a = Number.isNaN(r[4].value) || Number.isNaN(u[4].value) || 0 === u[4].value ? NaN : Number.isFinite(r[4].value) ? Number.isFinite(u[4].value) ? r[4].value % u[4].value : r[4].value : NaN, resultToCalculation(e, r, a);
3385
3421
  }
3386
3422
  function snapAsBorderWidth(e, n, t) {
3387
3423
  if (!isTokenDimension(n)) return -1;
3388
- const r = t.devicePixelLength ?? 1, a = [
3424
+ const r = t.devicePixelLength ?? 1, u = [
3389
3425
  u$1.Dimension,
3390
3426
  `${r}px`,
3391
3427
  n[2],
@@ -3395,67 +3431,69 @@ function snapAsBorderWidth(e, n, t) {
3395
3431
  type: a$1.Integer,
3396
3432
  unit: "px"
3397
3433
  }
3398
- ], u = convertUnit(a, n);
3399
- if (!twoOfSameNumeric(u, a)) return -1;
3400
- if (Number.isInteger(u[4].value / r)) return resultToCalculation(e, n, n[4].value);
3401
- if (u[4].value > 0) {
3402
- if (u[4].value < r) return resultToCalculation(e, n, convertUnit(n, a)[4].value);
3403
- const t = Math.floor(u[4].value / a[4].value) * a[4].value;
3404
- return u[4].value = t, resultToCalculation(e, n, convertUnit(n, u)[4].value);
3434
+ ], a = convertUnit(u, n);
3435
+ if (!twoOfSameNumeric(a, u)) return -1;
3436
+ if (Number.isInteger(a[4].value / r)) return resultToCalculation(e, n, n[4].value);
3437
+ if (a[4].value > 0) {
3438
+ if (a[4].value < r) return resultToCalculation(e, n, convertUnit(n, u)[4].value);
3439
+ const t = Math.floor(a[4].value / u[4].value) * u[4].value;
3440
+ return a[4].value = t, resultToCalculation(e, n, convertUnit(n, a)[4].value);
3405
3441
  }
3406
- if (Math.abs(u[4].value) < r) return resultToCalculation(e, n, -1 * convertUnit(n, a)[4].value);
3407
- const o = Math.ceil(u[4].value / a[4].value) * a[4].value;
3408
- return u[4].value = o, resultToCalculation(e, n, convertUnit(n, u)[4].value);
3442
+ if (Math.abs(a[4].value) < r) return resultToCalculation(e, n, -1 * convertUnit(n, u)[4].value);
3443
+ const i = Math.ceil(a[4].value / u[4].value) * u[4].value;
3444
+ return a[4].value = i, resultToCalculation(e, n, convertUnit(n, a)[4].value);
3409
3445
  }
3410
- function solveRound(e, n, t, r, a) {
3411
- const u = t.value;
3412
- if (!isTokenNumeric(u)) return -1;
3413
- if ("line-width" === n && !isTokenDimension(u)) return -1;
3414
- if (!a.rawPercentages && isTokenPercentage(u)) return -1;
3415
- const o = convertUnit(u, r.value);
3416
- if (!twoOfSameNumeric(u, o)) return -1;
3417
- let i;
3418
- if (0 === o[4].value) i = NaN;
3419
- else if (Number.isFinite(u[4].value) || Number.isFinite(o[4].value)) if (!Number.isFinite(u[4].value) && Number.isFinite(o[4].value)) i = u[4].value;
3420
- else if (Number.isFinite(u[4].value) && !Number.isFinite(o[4].value)) switch (n) {
3446
+ function solveRound(e, n, t, r, u) {
3447
+ const a = t.value;
3448
+ if (!isTokenNumeric(a)) return -1;
3449
+ if ("line-width" === n && !isTokenDimension(a)) return -1;
3450
+ const i = convertUnit(a, r.value);
3451
+ if (!twoOfSameNumeric(a, i)) return -1;
3452
+ if (Number.isNaN(a[4].value) || Number.isNaN(i[4].value)) return resultToCalculation(e, a, NaN);
3453
+ if (!u.rawPercentages && isTokenPercentage(a)) return -1;
3454
+ let o;
3455
+ if (0 === i[4].value) o = NaN;
3456
+ else if (Number.isFinite(a[4].value) || Number.isFinite(i[4].value)) if (!Number.isFinite(a[4].value) && Number.isFinite(i[4].value)) o = a[4].value;
3457
+ else if (Number.isFinite(a[4].value) && !Number.isFinite(i[4].value)) switch (n) {
3421
3458
  case "down":
3422
- i = u[4].value < 0 ? -1 / 0 : Object.is(-0, 0 * u[4].value) ? -0 : 0;
3459
+ o = a[4].value < 0 ? -1 / 0 : Object.is(-0, 0 * a[4].value) ? -0 : 0;
3423
3460
  break;
3424
3461
  case "up":
3425
- i = u[4].value > 0 ? 1 / 0 : Object.is(0, 0 * u[4].value) ? 0 : -0;
3462
+ o = a[4].value > 0 ? 1 / 0 : Object.is(0, 0 * a[4].value) ? 0 : -0;
3426
3463
  break;
3427
- default: i = Object.is(0, 0 * u[4].value) ? 0 : -0;
3464
+ default: o = Object.is(0, 0 * a[4].value) ? 0 : -0;
3428
3465
  }
3429
3466
  else switch (n) {
3430
3467
  case "down":
3431
- i = Math.floor(u[4].value / o[4].value) * o[4].value;
3468
+ o = (i[4].value > 0 ? Math.floor : Math.ceil)(a[4].value / i[4].value) * i[4].value;
3432
3469
  break;
3433
3470
  case "up":
3434
- i = Math.ceil(u[4].value / o[4].value) * o[4].value;
3471
+ o = (i[4].value > 0 ? Math.ceil : Math.floor)(a[4].value / i[4].value) * i[4].value;
3435
3472
  break;
3436
3473
  case "to-zero":
3437
- i = Math.trunc(u[4].value / o[4].value) * o[4].value;
3474
+ o = Math.trunc(a[4].value / i[4].value) * i[4].value;
3438
3475
  break;
3439
3476
  default: {
3440
- let t = Math.floor(u[4].value / o[4].value) * o[4].value, r = Math.ceil(u[4].value / o[4].value) * o[4].value;
3477
+ let t = Math.floor(a[4].value / i[4].value) * i[4].value, r = Math.ceil(a[4].value / i[4].value) * i[4].value;
3441
3478
  if (t > r) {
3442
3479
  const e = t;
3443
3480
  t = r, r = e;
3444
3481
  }
3445
- const l = Math.abs(u[4].value - t), c = Math.abs(u[4].value - r);
3446
- if (i = "line-width" === n && u[4].value >= 0 && (0 === r || 0 === t) ? 0 !== r ? r : t : l === c ? r : l < c ? t : r, "line-width" === n) {
3447
- const n = solve(resultToCalculation(e, u, i), a);
3448
- return -1 === n ? -1 : snapAsBorderWidth(e, n.value, a);
3482
+ const l = Math.abs(a[4].value - t), c = Math.abs(a[4].value - r);
3483
+ if (o = "line-width" !== n || 0 !== r && 0 !== t ? l === c ? r : l < c ? t : r : 0 !== r ? r : t, "line-width" === n) {
3484
+ const n = solve(resultToCalculation(e, a, o), u);
3485
+ return -1 === n ? -1 : snapAsBorderWidth(e, n.value, u);
3449
3486
  }
3450
3487
  break;
3451
3488
  }
3452
3489
  }
3453
- else i = NaN;
3454
- return resultToCalculation(e, u, i);
3490
+ else o = NaN;
3491
+ return resultToCalculation(e, a, o);
3455
3492
  }
3456
3493
  function solveSign(e, n, t) {
3457
3494
  const r = n.value;
3458
3495
  if (!isTokenNumeric(r)) return -1;
3496
+ if (Number.isNaN(r[4].value)) return numberToCalculation(e, NaN);
3459
3497
  if (!t.rawPercentages && isTokenPercentage(r)) return -1;
3460
3498
  return numberToCalculation(e, Math.sign(r[4].value));
3461
3499
  }
@@ -3466,13 +3504,13 @@ function solveSin(e, n) {
3466
3504
  if (isTokenDimension(t)) switch (toLowerCaseAZ$1(t[4].unit)) {
3467
3505
  case "rad": break;
3468
3506
  case "deg":
3469
- r = P.get("rad")(t[4].value);
3507
+ r = M.get("rad")(t[4].value);
3470
3508
  break;
3471
3509
  case "grad":
3472
- r = k.get("rad")(t[4].value);
3510
+ r = T.get("rad")(t[4].value);
3473
3511
  break;
3474
3512
  case "turn":
3475
- r = j.get("rad")(t[4].value);
3513
+ r = R.get("rad")(t[4].value);
3476
3514
  break;
3477
3515
  default: return -1;
3478
3516
  }
@@ -3487,154 +3525,165 @@ function solveTan(e, n) {
3487
3525
  const t = n.value;
3488
3526
  if (!isDimensionOrNumber(t)) return -1;
3489
3527
  const r = t[4].value;
3490
- let a = 0, u = t[4].value;
3528
+ let u = 0, a = t[4].value;
3491
3529
  if (isTokenDimension(t)) switch (toLowerCaseAZ$1(t[4].unit)) {
3492
3530
  case "rad":
3493
- a = G.get("deg")(r);
3531
+ u = z.get("deg")(r);
3494
3532
  break;
3495
3533
  case "deg":
3496
- a = r, u = P.get("rad")(r);
3534
+ u = r, a = M.get("rad")(r);
3497
3535
  break;
3498
3536
  case "grad":
3499
- a = k.get("deg")(r), u = k.get("rad")(r);
3537
+ u = T.get("deg")(r), a = T.get("rad")(r);
3500
3538
  break;
3501
3539
  case "turn":
3502
- a = j.get("deg")(r), u = j.get("rad")(r);
3540
+ u = R.get("deg")(r), a = R.get("rad")(r);
3503
3541
  break;
3504
3542
  default: return -1;
3505
3543
  }
3506
- const o = a / 90;
3507
- return u = a % 90 == 0 && o % 2 != 0 ? o > 0 ? 1 / 0 : -1 / 0 : Math.tan(u), numberToCalculation(e, u);
3544
+ const i = u / 90;
3545
+ return a = u % 90 == 0 && i % 2 != 0 ? (i % 4 + 4) % 4 == 1 ? 1 / 0 : -1 / 0 : Math.tan(a), numberToCalculation(e, a);
3508
3546
  }
3509
3547
  function subtraction(e, t) {
3510
3548
  if (2 !== e.length) return -1;
3511
3549
  const r = e[0].value;
3512
- let a = e[1].value;
3513
- if (isTokenNumber(r) && isTokenNumber(a)) {
3514
- const e = r[4].value - a[4].value;
3550
+ let u = e[1].value;
3551
+ if (isTokenNumber(r) && isTokenNumber(u)) {
3552
+ const e = r[4].value - u[4].value;
3515
3553
  return new TokenNode([
3516
3554
  u$1.Number,
3517
3555
  e.toString(),
3518
3556
  r[2],
3519
- a[3],
3557
+ u[3],
3520
3558
  {
3521
3559
  value: e,
3522
- type: r[4].type === a$1.Integer && a[4].type === a$1.Integer ? a$1.Integer : a$1.Number
3560
+ type: r[4].type === a$1.Integer && u[4].type === a$1.Integer ? a$1.Integer : a$1.Number
3523
3561
  }
3524
3562
  ]);
3525
3563
  }
3526
- if (isTokenPercentage(r) && isTokenPercentage(a)) {
3527
- const e = r[4].value - a[4].value;
3564
+ if (isTokenPercentage(r) && isTokenPercentage(u)) {
3565
+ const e = r[4].value - u[4].value;
3528
3566
  return new TokenNode([
3529
3567
  u$1.Percentage,
3530
3568
  e.toString() + "%",
3531
3569
  r[2],
3532
- a[3],
3570
+ u[3],
3533
3571
  { value: e }
3534
3572
  ]);
3535
3573
  }
3536
- if (isTokenDimension(r) && isTokenDimension(a) && (a = convertUnit(r, a), toLowerCaseAZ$1(r[4].unit) === toLowerCaseAZ$1(a[4].unit))) {
3537
- const e = r[4].value - a[4].value;
3574
+ if (isTokenDimension(r) && isTokenDimension(u) && (u = convertUnit(r, u), toLowerCaseAZ$1(r[4].unit) === toLowerCaseAZ$1(u[4].unit))) {
3575
+ const e = r[4].value - u[4].value;
3538
3576
  return new TokenNode([
3539
3577
  u$1.Dimension,
3540
3578
  e.toString() + r[4].unit,
3541
3579
  r[2],
3542
- a[3],
3580
+ u[3],
3543
3581
  {
3544
3582
  value: e,
3545
- type: r[4].type === a$1.Integer && a[4].type === a$1.Integer ? a$1.Integer : a$1.Number,
3583
+ type: r[4].type === a$1.Integer && u[4].type === a$1.Integer ? a$1.Integer : a$1.Number,
3546
3584
  unit: r[4].unit
3547
3585
  }
3548
3586
  ]);
3549
3587
  }
3550
- return (isTokenNumber(r) && (isTokenDimension(a) || isTokenPercentage(a)) || isTokenNumber(a) && (isTokenDimension(r) || isTokenPercentage(r))) && t.onParseError?.(new ParseErrorWithComponentValues(I.UnexpectedSubtractionOfDimensionOrPercentageWithNumber, e)), -1;
3588
+ return (isTokenNumber(r) && (isTokenDimension(u) || isTokenPercentage(u)) || isTokenNumber(u) && (isTokenDimension(r) || isTokenPercentage(r))) && t.onParseError?.(new ParseErrorWithComponentValues(S.UnexpectedSubtractionOfDimensionOrPercentageWithNumber, e)), -1;
3551
3589
  }
3552
3590
  function solveLog(e, n) {
3553
3591
  if (1 === n.length) {
3554
3592
  const r = n[0];
3555
3593
  if (!r || !isTokenNode(r)) return -1;
3556
- const a = r.value;
3557
- if (!isTokenNumber(a)) return -1;
3558
- return numberToCalculation(e, Math.log(a[4].value));
3594
+ const u = r.value;
3595
+ if (!isTokenNumber(u)) return -1;
3596
+ return numberToCalculation(e, Math.log(u[4].value));
3559
3597
  }
3560
3598
  if (2 === n.length) {
3561
3599
  const r = n[0];
3562
3600
  if (!r || !isTokenNode(r)) return -1;
3563
- const a = r.value;
3564
- if (!isTokenNumber(a)) return -1;
3565
- const u = n[1];
3566
- if (!u || !isTokenNode(u)) return -1;
3567
- const o = u.value;
3568
- if (!isTokenNumber(o)) return -1;
3569
- return numberToCalculation(e, Math.log(a[4].value) / Math.log(o[4].value));
3601
+ const u = r.value;
3602
+ if (!isTokenNumber(u)) return -1;
3603
+ const a = n[1];
3604
+ if (!a || !isTokenNode(a)) return -1;
3605
+ const i = a.value;
3606
+ if (!isTokenNumber(i)) return -1;
3607
+ if (Number.isNaN(u[4].value) || Number.isNaN(i[4].value)) return numberToCalculation(e, NaN);
3608
+ if (1 === i[4].value || i[4].value <= 0) return numberToCalculation(e, NaN);
3609
+ if (1 === u[4].value) return numberToCalculation(e, 0);
3610
+ return numberToCalculation(e, Math.log(u[4].value) / Math.log(i[4].value));
3570
3611
  }
3571
3612
  return -1;
3572
3613
  }
3573
- const _ = /^none$/i;
3614
+ const j = /^none$/i;
3574
3615
  function isNone(e) {
3575
3616
  if (Array.isArray(e)) {
3576
- const n = e.filter((e) => !(isWhitespaceNode(e) && isCommentNode(e)));
3617
+ const n = e.filter((e) => !isWhiteSpaceOrCommentNode(e));
3577
3618
  return 1 === n.length && isNone(n[0]);
3578
3619
  }
3579
3620
  if (!isTokenNode(e)) return !1;
3580
3621
  const n = e.value;
3581
- return !!isTokenIdent(n) && _.test(n[4].value);
3582
- }
3583
- const H = String.fromCodePoint(0);
3584
- function solveRandom(e, n, t, r, a, u) {
3585
- if (-1 === n.fixed && !u.randomCaching) return -1;
3586
- u.randomCaching || (u.randomCaching = {
3587
- propertyName: "",
3588
- propertyN: 0,
3589
- elementID: "",
3590
- documentID: ""
3591
- }), u.randomCaching && !u.randomCaching.propertyN && (u.randomCaching.propertyN = 0);
3592
- const o = t.value;
3593
- if (!isTokenNumeric(o)) return -1;
3594
- const i = convertUnit(o, r.value);
3595
- if (!twoOfSameNumeric(o, i)) return -1;
3622
+ return !!isTokenIdent(n) && j.test(n[4].value);
3623
+ }
3624
+ function patchPrecision(e, n = 13) {
3625
+ if (-1 === e) return -1;
3626
+ if (n <= 0) return e;
3627
+ if (isFunctionNode(e)) return e;
3628
+ const t = e.value;
3629
+ if (!isTokenNumeric(t)) return e;
3630
+ if (shouldSkipPrecisionRounding(t[4].value)) return e;
3631
+ const r = roundToPrecision(t[4].value, n).toString();
3632
+ return isTokenNumber(t) ? t[1] = r : isTokenPercentage(t) ? t[1] = r + "%" : isTokenDimension(t) && (t[1] = r + t[4].unit), e;
3633
+ }
3634
+ function shouldSkipPrecisionRounding(e) {
3635
+ if (!Number.isFinite(e) || 0 === e) return !0;
3636
+ if (Number.isInteger(e)) return !0;
3637
+ const n = e.toString();
3638
+ return n.includes("e") || n.includes("E");
3639
+ }
3640
+ function roundToPrecision(e, n = 13) {
3641
+ return shouldSkipPrecisionRounding(e) ? e : Number(e.toFixed(n));
3642
+ }
3643
+ const Y = String.fromCodePoint(0);
3644
+ function solveRandom(e, n, t, r, u, a) {
3645
+ if (-1 === n.fixed && !a.randomCaching) return -1;
3646
+ const i = t.value;
3647
+ if (!isTokenNumeric(i)) return -1;
3648
+ const o = convertUnit(i, r.value);
3649
+ if (!twoOfSameNumeric(i, o)) return -1;
3596
3650
  let l = null;
3597
- if (a && (l = convertUnit(o, a.value), !twoOfSameNumeric(o, l))) return -1;
3598
- if (!Number.isFinite(o[4].value)) return resultToCalculation(e, o, NaN);
3599
- if (!Number.isFinite(i[4].value)) return resultToCalculation(e, o, NaN);
3600
- if (!Number.isFinite(i[4].value - o[4].value)) return resultToCalculation(e, o, NaN);
3601
- if (l && !Number.isFinite(l[4].value)) return resultToCalculation(e, o, o[4].value);
3602
- const c = -1 === n.fixed ? sfc32(crc32([
3651
+ if (u && (l = convertUnit(i, u.value), !twoOfSameNumeric(i, l))) return -1;
3652
+ if (Number.isNaN(i[4].value) || Number.isNaN(o[4].value)) return resultToCalculation(e, i, NaN);
3653
+ if (!Number.isFinite(i[4].value)) return resultToCalculation(e, i, i[4].value);
3654
+ if (!Number.isFinite(o[4].value) || !Number.isFinite(o[4].value - i[4].value)) return resultToCalculation(e, i, NaN);
3655
+ if (l) {
3656
+ if (Number.isNaN(l[4].value)) return resultToCalculation(e, i, NaN);
3657
+ if (!Number.isFinite(l[4].value)) return resultToCalculation(e, i, i[4].value);
3658
+ }
3659
+ const c = -1 !== n.fixed ? () => n.fixed : (a.randomCaching.propertyN || (a.randomCaching.propertyN = 0), sfc32(crc32([
3603
3660
  n.dashedIdent ? n.dashedIdent : "",
3604
- n.elementScoped ? u.randomCaching.elementID : "",
3605
- n.propertyScoped || n.propertyIndexScoped ? u.randomCaching.propertyName : "",
3606
- n.propertyIndexScoped ? u.randomCaching.propertyN : "",
3607
- u.randomCaching.documentID
3608
- ].join(H))) : () => n.fixed;
3609
- let s = o[4].value, v = i[4].value;
3610
- if (s > v && ([s, v] = [v, s]), l && (l[4].value <= 0 || Math.abs(s - v) / l[4].value > 1e10) && (l = null), l) {
3611
- const n = Math.max(l[4].value / 1e3, 1e-9), t = [s];
3612
- let r = 0;
3613
- for (;;) {
3614
- r += l[4].value;
3615
- const e = s + r;
3616
- if (!(e + n < v)) {
3617
- t.push(v);
3618
- break;
3619
- }
3620
- if (t.push(e), e + l[4].value - n > v) break;
3621
- }
3622
- const a = c();
3623
- return resultToCalculation(e, o, Number(t[Math.floor(t.length * a)].toFixed(5)));
3624
- }
3625
- const f = c();
3626
- return resultToCalculation(e, o, Number((f * (v - s) + s).toFixed(5)));
3661
+ n.elementScoped ? a.randomCaching.elementID : "",
3662
+ n.propertyScoped || n.propertyIndexScoped ? a.randomCaching.propertyName : "",
3663
+ n.propertyIndexScoped ? a.randomCaching.propertyN : "",
3664
+ a.randomCaching.documentID
3665
+ ].join(Y)))), s = i[4].value;
3666
+ let v = o[4].value;
3667
+ if (v < s && (v = s), l && (l[4].value <= 0 || Math.abs(s - v) / l[4].value > 1e10) && (l = null), l) {
3668
+ const n = l[4].value, t = Math.max(n / 1e3, 1e-9);
3669
+ let r = Math.floor((v - s) / n);
3670
+ Math.abs(s + r * n - v) >= t && Math.abs(s + (r + 1) * n - v) < t && (r += 1);
3671
+ const u = Math.floor(c() * (r + 1));
3672
+ let a = s + u * n;
3673
+ return u === r && Math.abs(a - v) < t && (a = v), resultToCalculation(e, i, roundToPrecision(a, 5));
3674
+ }
3675
+ return resultToCalculation(e, i, roundToPrecision(c() * (v - s) + s, 5));
3627
3676
  }
3628
3677
  function sfc32(e = .34944106645296036, n = .19228640875738723, t = .8784393832007205, r = .04850964319275053) {
3629
3678
  return () => {
3630
- const a = ((e |= 0) + (n |= 0) | 0) + (r |= 0) | 0;
3631
- return r = r + 1 | 0, e = n ^ n >>> 9, n = (t |= 0) + (t << 3) | 0, t = (t = t << 21 | t >>> 11) + a | 0, (a >>> 0) / 4294967296;
3679
+ const u = ((e |= 0) + (n |= 0) | 0) + (r |= 0) | 0;
3680
+ return r = r + 1 | 0, e = n ^ n >>> 9, n = (t |= 0) + (t << 3) | 0, t = (t = t << 21 | t >>> 11) + u | 0, (u >>> 0) / 4294967296;
3632
3681
  };
3633
3682
  }
3634
3683
  function crc32(e) {
3635
3684
  let n, t, r = 0;
3636
3685
  r ^= -1;
3637
- for (let a = 0, u = e.length; a < u; a++) t = 255 & (r ^ e.charCodeAt(a)), n = Number("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 * t, 9 * t + 8)), r = r >>> 8 ^ n;
3686
+ for (let u = 0, a = e.length; u < a; u++) t = 255 & (r ^ e.charCodeAt(u)), n = Number("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 * t, 9 * t + 8)), r = r >>> 8 ^ n;
3638
3687
  return (-1 ^ r) >>> 0;
3639
3688
  }
3640
3689
  function solveCalcMix(e, n) {
@@ -3645,27 +3694,27 @@ function solveCalcMix(e, n) {
3645
3694
  percentage: e.percentage
3646
3695
  }));
3647
3696
  if (!arrayOfSameNumeric(r.map((e) => e.calcSum))) return -1;
3648
- const { items: a } = normalizeMixPercentages$1(r, !1), u = a.map((e) => e.calcSum[4].value * e.percentage / 100);
3649
- let o = 0;
3650
- for (let e = 0; e < u.length; e++) o += u[e];
3651
- return resultToCalculation(e, t, o);
3697
+ const { items: u } = normalizeMixPercentages$1(r, !1), a = u.map((e) => e.calcSum[4].value * e.percentage / 100);
3698
+ let i = 0;
3699
+ for (let e = 0; e < a.length; e++) i += a[e];
3700
+ return resultToCalculation(e, t, i);
3652
3701
  }
3653
3702
  function normalizeMixPercentages$1(e, n = !1) {
3654
3703
  let t = 0, r = 0;
3655
3704
  for (const n of e) n.percentage && (t += n.percentage), !1 === n.percentage && r++;
3656
3705
  t = Math.min(100, t);
3657
3706
  for (const n of e) !1 === n.percentage && (n.percentage = (100 - t) / r);
3658
- const a = e.slice();
3659
- let u = 0;
3660
- for (const e of a) u += e.percentage;
3661
- if (u > 100 || u > 0 && n) for (const e of a) e.percentage = e.percentage * (100 / u);
3662
- let o = 0;
3663
- return u < 100 && (o = 100 - u), {
3664
- items: a,
3665
- leftover: o
3707
+ const u = e.slice();
3708
+ let a = 0;
3709
+ for (const e of u) a += e.percentage;
3710
+ if (a > 100 || a > 0 && n) for (const e of u) e.percentage = e.percentage * (100 / a);
3711
+ let i = 0;
3712
+ return a < 100 && (i = 100 - a), {
3713
+ items: u,
3714
+ leftover: i
3666
3715
  };
3667
3716
  }
3668
- const J = /* @__PURE__ */ new Map([
3717
+ const _ = /* @__PURE__ */ new Map([
3669
3718
  ["abs", function abs(e, n, t) {
3670
3719
  return singleNodeSolver(e, n, t, solveAbs);
3671
3720
  }],
@@ -3687,16 +3736,16 @@ const J = /* @__PURE__ */ new Map([
3687
3736
  if (-1 === r) return -1;
3688
3737
  return solveCalcMix(e, r);
3689
3738
  }],
3690
- ["clamp", function clamp(r, a, o) {
3691
- const i = resolveGlobalsAndConstants([...r.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], a), c = [], s = [], v = [];
3739
+ ["clamp", function clamp(u, a, o) {
3740
+ const l = resolveGlobalsAndConstants([...u.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], a), c = [], s = [], f = [];
3692
3741
  {
3693
3742
  let e = c;
3694
- for (let n = 0; n < i.length; n++) {
3695
- const r = i[n];
3743
+ for (let n = 0; n < l.length; n++) {
3744
+ const r = l[n];
3696
3745
  if (isTokenNode(r) && isTokenComma(r.value)) {
3697
- if (e === v) return -1;
3746
+ if (e === f) return -1;
3698
3747
  if (e === s) {
3699
- e = v;
3748
+ e = f;
3700
3749
  continue;
3701
3750
  }
3702
3751
  if (e === c) {
@@ -3708,45 +3757,45 @@ const J = /* @__PURE__ */ new Map([
3708
3757
  e.push(r);
3709
3758
  }
3710
3759
  }
3711
- const f = isNone(c), m = isNone(v);
3712
- if (f && m) return calc$1(calcWrapper(r, s), a, o);
3713
- const d = solve(calc$1(calcWrapper(r, s), a, o), o);
3760
+ const p = isNone(c), m = isNone(f);
3761
+ if (p && m) return calc$1(calcWrapper(u, s), a, o);
3762
+ const d = solve(calc$1(calcWrapper(u, s), a, o), o);
3714
3763
  if (-1 === d) return -1;
3715
- if (f) {
3716
- const t = solve(calc$1(calcWrapper(r, v), a, o), o);
3717
- return -1 === t ? -1 : solveMin((C = r, g = d, D = t, new FunctionNode([
3764
+ if (p) {
3765
+ const t = solve(calc$1(calcWrapper(u, f), a, o), o);
3766
+ return -1 === t ? -1 : solveMin((N = u, C = d, g = t, new FunctionNode([
3718
3767
  u$1.Function,
3719
3768
  "min(",
3720
- C.name[2],
3721
- C.name[3],
3769
+ N.name[2],
3770
+ N.name[3],
3722
3771
  { value: "min" }
3723
3772
  ], [
3724
3773
  u$1.CloseParen,
3725
3774
  ")",
3726
- C.endToken[2],
3727
- C.endToken[3],
3775
+ N.endToken[2],
3776
+ N.endToken[3],
3728
3777
  void 0
3729
3778
  ], [
3730
- g,
3779
+ C,
3731
3780
  new TokenNode([
3732
3781
  u$1.Comma,
3733
3782
  ",",
3734
- ...sourceIndices(g),
3783
+ ...sourceIndices(C),
3735
3784
  void 0
3736
3785
  ]),
3737
- D
3786
+ g
3738
3787
  ])), [d, t], o);
3739
3788
  }
3740
3789
  if (m) {
3741
- const e = solve(calc$1(calcWrapper(r, c), a, o), o);
3742
- return -1 === e ? -1 : solveMax(maxWrapper(r, e, d), [e, d], o);
3790
+ const e = solve(calc$1(calcWrapper(u, c), a, o), o);
3791
+ return -1 === e ? -1 : solveMax(maxWrapper(u, e, d), [e, d], o);
3743
3792
  }
3744
- var C, g, D;
3745
- const h = solve(calc$1(calcWrapper(r, c), a, o), o);
3793
+ var N, C, g;
3794
+ const h = solve(calc$1(calcWrapper(u, c), a, o), o);
3746
3795
  if (-1 === h) return -1;
3747
- const N = solve(calc$1(calcWrapper(r, v), a, o), o);
3748
- if (-1 === N) return -1;
3749
- return solveClamp(r, h, d, N, o);
3796
+ const b = solve(calc$1(calcWrapper(u, f), a, o), o);
3797
+ if (-1 === b) return -1;
3798
+ return solveClamp(u, h, d, b, o);
3750
3799
  }],
3751
3800
  ["cos", function cos(e, n, t) {
3752
3801
  return singleNodeSolver(e, n, t, solveCos);
@@ -3773,37 +3822,37 @@ const J = /* @__PURE__ */ new Map([
3773
3822
  return twoCommaSeparatedNodesSolver(e, n, t, solvePow);
3774
3823
  }],
3775
3824
  ["random", function random(e, n, t) {
3776
- const r = parseRandomValueSharing(e, e.value.filter((e) => !isWhiteSpaceOrCommentNode(e)), n, t);
3777
- if (-1 === r) return -1;
3778
- const [a, o] = r, i = variadicArguments(e, o, n, t);
3779
- if (-1 === i) return -1;
3780
- const [l, c, s] = i;
3825
+ const u = parseRandomValueSharing(e, e.value.filter((e) => !isWhiteSpaceOrCommentNode(e)), n, t);
3826
+ if (-1 === u) return -1;
3827
+ const [a, i] = u, o = variadicArguments(e, i, n, t);
3828
+ if (-1 === o) return -1;
3829
+ const [l, c, s] = o;
3781
3830
  if (!l || !c) return -1;
3782
3831
  return solveRandom(e, a, l, c, s, t);
3783
3832
  }],
3784
3833
  ["rem", function rem(e, n, t) {
3785
3834
  return twoCommaSeparatedNodesSolver(e, n, t, solveRem);
3786
3835
  }],
3787
- ["round", function round(e, r, a) {
3788
- const o = resolveGlobalsAndConstants([...e.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], r);
3789
- let i = "", l = !1;
3790
- const c = [], s = [];
3836
+ ["round", function round(e, u, a) {
3837
+ const i = resolveGlobalsAndConstants([...e.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], u);
3838
+ let o = "", l = !1;
3839
+ const c = [], p = [];
3791
3840
  {
3792
3841
  let e = c;
3793
- for (let n = 0; n < o.length; n++) {
3794
- const r = o[n];
3795
- if (!i && 0 === c.length && 0 === s.length && isTokenNode(r) && isTokenIdent(r.value)) {
3842
+ for (let n = 0; n < i.length; n++) {
3843
+ const r = i[n];
3844
+ if (!o && 0 === c.length && 0 === p.length && isTokenNode(r) && isTokenIdent(r.value)) {
3796
3845
  const e = r.value[4].value.toLowerCase();
3797
- if (K.has(e)) {
3798
- i = e;
3846
+ if (J.has(e)) {
3847
+ o = e;
3799
3848
  continue;
3800
3849
  }
3801
3850
  }
3802
3851
  if (isTokenNode(r) && isTokenComma(r.value)) {
3803
- if (e === s) return -1;
3804
- if (e === c && i && 0 === c.length) continue;
3852
+ if (e === p) return -1;
3853
+ if (e === c && o && 0 === c.length) continue;
3805
3854
  if (e === c) {
3806
- l = !0, e = s;
3855
+ l = !0, e = p;
3807
3856
  continue;
3808
3857
  }
3809
3858
  return -1;
@@ -3811,39 +3860,39 @@ const J = /* @__PURE__ */ new Map([
3811
3860
  e.push(r);
3812
3861
  }
3813
3862
  }
3814
- const v = solve(calc$1(calcWrapper(e, c), r, a), a);
3815
- if (-1 === v) return -1;
3816
- if ("line-width" === i) {
3863
+ const m = solve(calc$1(calcWrapper(e, c), u, a), a);
3864
+ if (-1 === m) return -1;
3865
+ if ("line-width" === o) {
3817
3866
  const e = convertUnit([
3818
3867
  u$1.Dimension,
3819
3868
  "1px",
3820
- v.value[2],
3821
- v.value[3],
3869
+ m.value[2],
3870
+ m.value[3],
3822
3871
  {
3823
3872
  value: 1,
3824
3873
  type: a$1.Integer,
3825
3874
  unit: "px"
3826
3875
  }
3827
- ], v.value);
3876
+ ], m.value);
3828
3877
  if (!isTokenDimension(e) || "px" !== e[4].unit) return -1;
3829
3878
  }
3830
- if (!l && 0 === s.length) {
3831
- if ("line-width" === i) return snapAsBorderWidth(e, v.value, a);
3832
- s.push(new TokenNode([
3879
+ if (!l && 0 === p.length) {
3880
+ if ("line-width" === o) return snapAsBorderWidth(e, m.value, a);
3881
+ p.push(new TokenNode([
3833
3882
  u$1.Number,
3834
3883
  "1",
3835
- v.value[2],
3836
- v.value[3],
3884
+ m.value[2],
3885
+ m.value[3],
3837
3886
  {
3838
3887
  value: 1,
3839
3888
  type: a$1.Integer
3840
3889
  }
3841
3890
  ]));
3842
3891
  }
3843
- const d = solve(calc$1(calcWrapper(e, s), r, a), a);
3892
+ const d = solve(calc$1(calcWrapper(e, p), u, a), a);
3844
3893
  if (-1 === d) return -1;
3845
- i || (i = "nearest");
3846
- return solveRound(e, i, v, d, a);
3894
+ o || (o = "nearest");
3895
+ return solveRound(e, o, m, d, a);
3847
3896
  }],
3848
3897
  ["sign", function sign(e, n, t) {
3849
3898
  return singleNodeSolver(e, n, t, solveSign);
@@ -3858,39 +3907,41 @@ const J = /* @__PURE__ */ new Map([
3858
3907
  return singleNodeSolver(e, n, t, solveTan);
3859
3908
  }]
3860
3909
  ]);
3861
- function calc$1(e, n, r) {
3862
- const a = resolveGlobalsAndConstants([...e.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], n);
3863
- if (1 === a.length && isTokenNode(a[0])) return {
3864
- inputs: [a[0]],
3910
+ const H = 5e4;
3911
+ function calc$1(e, n, i) {
3912
+ const o = resolveGlobalsAndConstants([...e.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], n);
3913
+ if (o.length > H) throw new Error(`Maximum number of nodes in a math function (${H}) exceeded, reduce the complexity of your expression`);
3914
+ if (1 === o.length && isTokenNode(o[0])) return {
3915
+ inputs: [o[0]],
3865
3916
  operation: unary
3866
3917
  };
3867
3918
  let l = 0;
3868
- for (; l < a.length;) {
3869
- const e = a[l];
3919
+ for (; l < o.length;) {
3920
+ const e = o[l];
3870
3921
  if (isSimpleBlockNode(e) && isTokenOpenParen(e.startToken)) {
3871
- const t = calc$1(e, n, r);
3922
+ const t = calc$1(e, n, i);
3872
3923
  if (-1 === t) return -1;
3873
- a.splice(l, 1, t);
3924
+ o.splice(l, 1, t);
3874
3925
  continue;
3875
3926
  }
3876
3927
  if (isFunctionNode(e)) {
3877
- const t = J.get(e.getName().toLowerCase());
3928
+ const t = _.get(e.getName().toLowerCase());
3878
3929
  if (!t) return -1;
3879
- const u = t(e, n, r);
3880
- if (-1 === u) return -1;
3881
- a.splice(l, 1, u);
3930
+ const r = t(e, n, i);
3931
+ if (-1 === r) return -1;
3932
+ o.splice(l, 1, r);
3882
3933
  continue;
3883
3934
  }
3884
3935
  l++;
3885
3936
  }
3886
- if (l = 0, 1 === a.length && isCalculation(a[0])) return a[0];
3887
- for (; l < a.length;) {
3888
- const e = a[l];
3937
+ if (l = 0, 1 === o.length && isCalculation(o[0])) return o[0];
3938
+ for (; l < o.length;) {
3939
+ const e = o[l];
3889
3940
  if (!e || !isTokenNode(e) && !isCalculation(e)) {
3890
3941
  l++;
3891
3942
  continue;
3892
3943
  }
3893
- const n = a[l + 1];
3944
+ const n = o[l + 1];
3894
3945
  if (!n || !isTokenNode(n)) {
3895
3946
  l++;
3896
3947
  continue;
@@ -3900,24 +3951,24 @@ function calc$1(e, n, r) {
3900
3951
  l++;
3901
3952
  continue;
3902
3953
  }
3903
- const u = a[l + 2];
3954
+ const u = o[l + 2];
3904
3955
  if (!u || !isTokenNode(u) && !isCalculation(u)) return -1;
3905
- "*" !== r[4].value ? "/" !== r[4].value ? l++ : a.splice(l, 3, {
3956
+ "*" !== r[4].value ? "/" !== r[4].value ? l++ : o.splice(l, 3, {
3906
3957
  inputs: [e, u],
3907
3958
  operation: division
3908
- }) : a.splice(l, 3, {
3959
+ }) : o.splice(l, 3, {
3909
3960
  inputs: [e, u],
3910
3961
  operation: multiplication
3911
3962
  });
3912
3963
  }
3913
- if (l = 0, 1 === a.length && isCalculation(a[0])) return a[0];
3914
- for (; l < a.length;) {
3915
- const e = a[l];
3964
+ if (l = 0, 1 === o.length && isCalculation(o[0])) return o[0];
3965
+ for (; l < o.length;) {
3966
+ const e = o[l];
3916
3967
  if (!e || !isTokenNode(e) && !isCalculation(e)) {
3917
3968
  l++;
3918
3969
  continue;
3919
3970
  }
3920
- const n = a[l + 1];
3971
+ const n = o[l + 1];
3921
3972
  if (!n || !isTokenNode(n)) {
3922
3973
  l++;
3923
3974
  continue;
@@ -3927,42 +3978,42 @@ function calc$1(e, n, r) {
3927
3978
  l++;
3928
3979
  continue;
3929
3980
  }
3930
- const u = a[l + 2];
3981
+ const u = o[l + 2];
3931
3982
  if (!u || !isTokenNode(u) && !isCalculation(u)) return -1;
3932
- "+" !== r[4].value ? "-" !== r[4].value ? l++ : a.splice(l, 3, {
3983
+ "+" !== r[4].value ? "-" !== r[4].value ? l++ : o.splice(l, 3, {
3933
3984
  inputs: [e, u],
3934
3985
  operation: subtraction
3935
- }) : a.splice(l, 3, {
3986
+ }) : o.splice(l, 3, {
3936
3987
  inputs: [e, u],
3937
3988
  operation: addition
3938
3989
  });
3939
3990
  }
3940
- return 1 === a.length && isCalculation(a[0]) ? a[0] : -1;
3991
+ return 1 === o.length && isCalculation(o[0]) ? o[0] : -1;
3941
3992
  }
3942
3993
  function singleNodeSolver(e, n, t, r) {
3943
- const a = singleArgument(e, n, t);
3944
- return -1 === a ? -1 : r(e, a, t);
3994
+ const u = singleArgument(e, n, t);
3995
+ return -1 === u ? -1 : r(e, u, t);
3945
3996
  }
3946
3997
  function singleArgument(e, n, t) {
3947
3998
  const a = solve(calc$1(calcWrapper(e, resolveGlobalsAndConstants([...e.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], n)), n, t), t);
3948
3999
  return -1 === a ? -1 : a;
3949
4000
  }
3950
4001
  function twoCommaSeparatedNodesSolver(e, n, t, r) {
3951
- const a = twoCommaSeparatedArguments(e, n, t);
3952
- if (-1 === a) return -1;
3953
- const [u, o] = a;
3954
- return r(e, u, o, t);
4002
+ const u = twoCommaSeparatedArguments(e, n, t);
4003
+ if (-1 === u) return -1;
4004
+ const [a, i] = u;
4005
+ return r(e, a, i, t);
3955
4006
  }
3956
- function twoCommaSeparatedArguments(e, n, r) {
3957
- const a = resolveGlobalsAndConstants([...e.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], n), o = [], i = [];
4007
+ function twoCommaSeparatedArguments(e, n, u) {
4008
+ const a = resolveGlobalsAndConstants([...e.value.filter((e) => !isWhiteSpaceOrCommentNode(e))], n), i = [], o = [];
3958
4009
  {
3959
- let e = o;
4010
+ let e = i;
3960
4011
  for (let n = 0; n < a.length; n++) {
3961
4012
  const r = a[n];
3962
4013
  if (isTokenNode(r) && isTokenComma(r.value)) {
3963
- if (e === i) return -1;
3964
- if (e === o) {
3965
- e = i;
4014
+ if (e === o) return -1;
4015
+ if (e === i) {
4016
+ e = o;
3966
4017
  continue;
3967
4018
  }
3968
4019
  return -1;
@@ -3970,55 +4021,55 @@ function twoCommaSeparatedArguments(e, n, r) {
3970
4021
  e.push(r);
3971
4022
  }
3972
4023
  }
3973
- const l = solve(calc$1(calcWrapper(e, o), n, r), r);
4024
+ const l = solve(calc$1(calcWrapper(e, i), n, u), u);
3974
4025
  if (-1 === l) return -1;
3975
- const c = solve(calc$1(calcWrapper(e, i), n, r), r);
4026
+ const c = solve(calc$1(calcWrapper(e, o), n, u), u);
3976
4027
  return -1 === c ? -1 : [l, c];
3977
4028
  }
3978
4029
  function variadicNodesSolver(e, n, t, r) {
3979
- const a = variadicArguments(e, e.value, n, t);
3980
- return -1 === a ? -1 : r(e, a, t);
4030
+ const u = variadicArguments(e, e.value, n, t);
4031
+ return -1 === u ? -1 : r(e, u, t);
3981
4032
  }
3982
- function variadicArguments(e, n, r, a) {
3983
- const o = resolveGlobalsAndConstants([...n.filter((e) => !isWhiteSpaceOrCommentNode(e))], r), i = [];
4033
+ function variadicArguments(e, n, u, a) {
4034
+ const i = resolveGlobalsAndConstants([...n.filter((e) => !isWhiteSpaceOrCommentNode(e))], u), o = [];
3984
4035
  {
3985
4036
  const n = [];
3986
- let u = [];
3987
- for (let e = 0; e < o.length; e++) {
3988
- const r = o[e];
3989
- isTokenNode(r) && isTokenComma(r.value) ? (n.push(u), u = []) : u.push(r);
4037
+ let r = [];
4038
+ for (let e = 0; e < i.length; e++) {
4039
+ const u = i[e];
4040
+ isTokenNode(u) && isTokenComma(u.value) ? (n.push(r), r = []) : r.push(u);
3990
4041
  }
3991
- n.push(u);
4042
+ n.push(r);
3992
4043
  for (let t = 0; t < n.length; t++) {
3993
4044
  if (0 === n[t].length) return -1;
3994
- const u = solve(calc$1(calcWrapper(e, n[t]), r, a), a);
3995
- if (-1 === u) return -1;
3996
- i.push(u);
4045
+ const r = solve(calc$1(calcWrapper(e, n[t]), u, a), a);
4046
+ if (-1 === r) return -1;
4047
+ o.push(r);
3997
4048
  }
3998
4049
  }
3999
- return i;
4050
+ return o;
4000
4051
  }
4001
- function variadicArgumentsCalcMix(e, n, r, a) {
4002
- const o = resolveGlobalsAndConstants([...n.filter((e) => !isWhiteSpaceOrCommentNode(e))], r), i = [];
4052
+ function variadicArgumentsCalcMix(e, n, u, a) {
4053
+ const i = resolveGlobalsAndConstants([...n.filter((e) => !isWhiteSpaceOrCommentNode(e))], u), o = [];
4003
4054
  {
4004
4055
  const n = [];
4005
4056
  let l = [];
4006
- for (let e = 0; e < o.length; e++) {
4007
- const r = o[e];
4057
+ for (let e = 0; e < i.length; e++) {
4058
+ const r = i[e];
4008
4059
  isTokenNode(r) && isTokenComma(r.value) ? (n.push(l), l = []) : l.push(r);
4009
4060
  }
4010
4061
  n.push(l);
4011
- for (let o = 0; o < n.length; o++) {
4012
- if (0 === n[o].length) return -1;
4062
+ for (let i = 0; i < n.length; i++) {
4063
+ if (0 === n[i].length) return -1;
4013
4064
  let l = -1, c = !1;
4014
- for (let i = n[o].length - 1; i >= 0; i--) {
4015
- if (isWhiteSpaceOrCommentNode(n[o][i])) continue;
4016
- if (l = solve(calc$1(calcWrapper(e, n[o].slice(0, i + 1)), r, a), a), -1 === l) continue;
4017
- const s = n[o].slice(i + 1).filter((e) => !isWhiteSpaceOrCommentNode(e));
4065
+ for (let o = n[i].length - 1; o >= 0; o--) {
4066
+ if (isWhiteSpaceOrCommentNode(n[i][o])) continue;
4067
+ if (l = solve(calc$1(calcWrapper(e, n[i].slice(0, o + 1)), u, a), a), -1 === l) continue;
4068
+ const s = n[i].slice(o + 1).filter((e) => !isWhiteSpaceOrCommentNode(e));
4018
4069
  if (s.length) if (1 === s.length && isTokenNode(s[0]) && isTokenPercentage(s[0].value)) {
4019
4070
  if (c = s[0].value[4].value, c < 0 || c > 100) return -1;
4020
4071
  } else {
4021
- const n = solve(calc$1(calcWrapper(e, s), r, a), a);
4072
+ const n = solve(calc$1(calcWrapper(e, s), u, a), a);
4022
4073
  if (-1 === n) return -1;
4023
4074
  if (!isTokenPercentage(n.value)) return -1;
4024
4075
  c = n.value[4].value, c = Math.min(100, Math.max(0, c));
@@ -4026,70 +4077,70 @@ function variadicArgumentsCalcMix(e, n, r, a) {
4026
4077
  break;
4027
4078
  }
4028
4079
  if (-1 === l) return -1;
4029
- i.push({
4080
+ o.push({
4030
4081
  calcSum: l,
4031
4082
  percentage: c
4032
4083
  });
4033
4084
  }
4034
4085
  }
4035
- return i;
4086
+ return o;
4036
4087
  }
4037
- const K = /* @__PURE__ */ new Set([
4088
+ const J = /* @__PURE__ */ new Set([
4038
4089
  "nearest",
4039
4090
  "line-width",
4040
4091
  "up",
4041
4092
  "down",
4042
4093
  "to-zero"
4043
4094
  ]);
4044
- function parseRandomValueSharing(e, n, r, a) {
4045
- const u = {
4095
+ function parseRandomValueSharing(e, n, r, u) {
4096
+ const a = {
4046
4097
  dashedIdent: "",
4047
4098
  fixed: -1,
4048
4099
  elementScoped: !1,
4049
4100
  propertyScoped: !1,
4050
4101
  propertyIndexScoped: !1
4051
4102
  };
4052
- let o = !1;
4053
- const i = n[0];
4054
- if (!isTokenNode(i) || !isTokenIdent(i.value)) return [u, n];
4055
- for (let i = 0; i < n.length; i++) {
4056
- const l = n[i];
4103
+ let i = !1;
4104
+ const o = n[0];
4105
+ if (!isTokenNode(o) || !isTokenIdent(o.value)) return [a, n];
4106
+ for (let o = 0; o < n.length; o++) {
4107
+ const l = n[o];
4057
4108
  if (!isTokenNode(l)) return -1;
4058
- if (isTokenComma(l.value)) return [u, n.slice(i + 1)];
4109
+ if (isTokenComma(l.value)) return [a, n.slice(o + 1)];
4059
4110
  if (!isTokenIdent(l.value)) return -1;
4060
4111
  const c = l.value[4].value.toLowerCase();
4061
4112
  if ("element-scoped" !== c) if ("property-scoped" !== c) if ("property-index-scoped" !== c) {
4062
4113
  if ("fixed" === c) {
4063
- if (-1 !== u.fixed || o || u.dashedIdent || u.elementScoped || u.propertyScoped || u.propertyIndexScoped) return -1;
4064
- i++;
4065
- const t = n[i];
4114
+ if (-1 !== a.fixed || i || a.dashedIdent || a.elementScoped || a.propertyScoped || a.propertyIndexScoped) return -1;
4115
+ o++;
4116
+ const t = n[o];
4066
4117
  if (!t) return -1;
4067
- const l = solve(calc$1(calcWrapper(e, [t]), r, a), a);
4118
+ const l = solve(calc$1(calcWrapper(e, [t]), r, u), u);
4068
4119
  if (-1 === l) return -1;
4069
4120
  if (!isTokenNumber(l.value)) return -1;
4070
4121
  if (l.value[4].value < 0 || l.value[4].value > 1) return -1;
4071
- u.fixed = Math.max(0, Math.min(l.value[4].value, 1 - 1e-9));
4122
+ a.fixed = Math.max(0, Math.min(l.value[4].value, 1 - Number.EPSILON / 2));
4072
4123
  continue;
4073
4124
  }
4074
4125
  if ("auto" !== c) {
4075
- if (!c.startsWith("--")) return -1;
4076
- if (-1 !== u.fixed || o || u.dashedIdent) return -1;
4077
- u.dashedIdent = c;
4126
+ if (!c.startsWith("--")) return 0 === o ? [a, n] : -1;
4127
+ if (-1 !== a.fixed || i || a.dashedIdent) return -1;
4128
+ a.dashedIdent = c;
4078
4129
  } else {
4079
- if (-1 !== u.fixed || o || u.dashedIdent || u.elementScoped || u.propertyScoped || u.propertyIndexScoped) return -1;
4080
- u.elementScoped = !0, u.propertyIndexScoped = !0, o = !0;
4130
+ if (-1 !== a.fixed || i || a.dashedIdent || a.elementScoped || a.propertyScoped || a.propertyIndexScoped) return -1;
4131
+ a.elementScoped = !0, a.propertyIndexScoped = !0, i = !0;
4081
4132
  }
4082
4133
  } else {
4083
- if (-1 !== u.fixed || o || u.propertyScoped || u.propertyIndexScoped) return -1;
4084
- u.propertyIndexScoped = !0;
4134
+ if (-1 !== a.fixed || i || a.propertyScoped || a.propertyIndexScoped) return -1;
4135
+ a.propertyIndexScoped = !0;
4085
4136
  }
4086
4137
  else {
4087
- if (-1 !== u.fixed || o || u.propertyScoped || u.propertyIndexScoped) return -1;
4088
- u.propertyScoped = !0;
4138
+ if (-1 !== a.fixed || i || a.propertyScoped || a.propertyIndexScoped) return -1;
4139
+ a.propertyScoped = !0;
4089
4140
  }
4090
4141
  else {
4091
- if (-1 !== u.fixed || o || u.elementScoped) return -1;
4092
- u.elementScoped = !0;
4142
+ if (-1 !== a.fixed || i || a.elementScoped) return -1;
4143
+ a.elementScoped = !0;
4093
4144
  }
4094
4145
  }
4095
4146
  return -1;
@@ -4109,7 +4160,7 @@ function calcWrapper(e, n) {
4109
4160
  void 0
4110
4161
  ], n);
4111
4162
  }
4112
- function maxWrapper(t, r, a) {
4163
+ function maxWrapper(t, r, u) {
4113
4164
  return new FunctionNode([
4114
4165
  u$1.Function,
4115
4166
  "max(",
@@ -4130,7 +4181,7 @@ function maxWrapper(t, r, a) {
4130
4181
  ...sourceIndices(r),
4131
4182
  void 0
4132
4183
  ]),
4133
- a
4184
+ u
4134
4185
  ]);
4135
4186
  }
4136
4187
  function patchNaN(e) {
@@ -4390,16 +4441,6 @@ function patchMinusZero(e) {
4390
4441
  const n = e.value;
4391
4442
  return isTokenNumeric(n) && Object.is(-0, n[4].value) ? ("-0" === n[1] || (isTokenPercentage(n) ? n[1] = "-0%" : isTokenDimension(n) ? n[1] = "-0" + n[4].unit : n[1] = "-0"), e) : e;
4392
4443
  }
4393
- function patchPrecision(e, n = 13) {
4394
- if (-1 === e) return -1;
4395
- if (n <= 0) return e;
4396
- if (isFunctionNode(e)) return e;
4397
- const t = e.value;
4398
- if (!isTokenNumeric(t)) return e;
4399
- if (Number.isInteger(t[4].value)) return e;
4400
- const r = Number(t[4].value.toFixed(n)).toString();
4401
- return isTokenNumber(t) ? t[1] = r : isTokenPercentage(t) ? t[1] = r + "%" : isTokenDimension(t) && (t[1] = r + t[4].unit), e;
4402
- }
4403
4444
  function patchCanonicalUnit(e) {
4404
4445
  return -1 === e ? -1 : isFunctionNode(e) ? e : isTokenDimension(e.value) ? (e.value = toCanonicalUnit(e.value), e) : e;
4405
4446
  }
@@ -4412,10 +4453,10 @@ function tokenizeGlobals(e) {
4412
4453
  if (!e) return n;
4413
4454
  for (const [t, r] of e) if (isToken(r)) n.set(t, r);
4414
4455
  else if ("string" == typeof r) {
4415
- const e = tokenizer({ css: r }), a = e.nextToken();
4456
+ const e = tokenizer({ css: r }), u = e.nextToken();
4416
4457
  if (e.nextToken(), !e.endOfFile()) continue;
4417
- if (!isTokenNumeric(a)) continue;
4418
- n.set(t, a);
4458
+ if (!isTokenNumeric(u)) continue;
4459
+ n.set(t, u);
4419
4460
  continue;
4420
4461
  }
4421
4462
  return n;
@@ -4424,40 +4465,40 @@ function calcFromComponentValues(e, n) {
4424
4465
  const t = tokenizeGlobals(n?.globals);
4425
4466
  return replaceComponentValues(e, (e) => {
4426
4467
  if (!isFunctionNode(e)) return;
4427
- const r = J.get(e.getName().toLowerCase());
4468
+ const r = _.get(e.getName().toLowerCase());
4428
4469
  if (!r) return;
4429
4470
  const a = patchCalcResult(solve(r(e, t, n ?? {}), n ?? {}), n);
4430
4471
  return -1 !== a ? n?.calcWrapper ? calcWrapper(e, [a]) : a : void 0;
4431
4472
  });
4432
4473
  }
4433
- function replaceComponentValues(n, r) {
4474
+ function replaceComponentValues(n, u) {
4434
4475
  for (let a = 0; a < n.length; a++) {
4435
- const o = n[a];
4436
- walk(o, (n, a) => {
4476
+ const i = n[a];
4477
+ walk(i, (n, a) => {
4437
4478
  if ("number" != typeof a) return;
4438
- const o = r(n.node);
4439
- if (!o) return;
4440
- const i = [o], l = n.parent.value[a - 1];
4441
- isTokenNode(l) && isTokenDelim(l.value) && ("-" === l.value[4].value || "+" === l.value[4].value) && i.splice(0, 0, new WhitespaceNode([[
4479
+ const i = u(n.node);
4480
+ if (!i) return;
4481
+ const l = [i], c = n.parent.value[a - 1];
4482
+ isTokenNode(c) && isTokenDelim(c.value) && ("-" === c.value[4].value || "+" === c.value[4].value) && l.splice(0, 0, new WhitespaceNode([[
4442
4483
  u$1.Whitespace,
4443
4484
  " ",
4444
4485
  ...sourceIndices(n.node),
4445
4486
  void 0
4446
4487
  ]]));
4447
4488
  const s = n.parent.value[a + 1];
4448
- !s || isWhiteSpaceOrCommentNode(s) || isTokenNode(s) && (isTokenComma(s.value) || isTokenColon(s.value) || isTokenSemicolon(s.value) || isTokenDelim(s.value) && "-" !== s.value[4].value && "+" !== s.value[4].value) || i.push(new WhitespaceNode([[
4489
+ !s || isWhiteSpaceOrCommentNode(s) || isTokenNode(s) && (isTokenComma(s.value) || isTokenColon(s.value) || isTokenSemicolon(s.value) || isTokenDelim(s.value) && "-" !== s.value[4].value && "+" !== s.value[4].value) || l.push(new WhitespaceNode([[
4449
4490
  u$1.Whitespace,
4450
4491
  " ",
4451
4492
  ...sourceIndices(n.node),
4452
4493
  void 0
4453
- ]])), n.parent.value.splice(a, 1, ...i);
4494
+ ]])), n.parent.value.splice(a, 1, ...l);
4454
4495
  });
4455
4496
  }
4456
4497
  return n;
4457
4498
  }
4458
- const Q = new Set(J.keys());
4499
+ const K = new Set(_.keys());
4459
4500
  //#endregion
4460
- //#region ../../node_modules/.pnpm/@csstools+css-color-parser@4.2.3_@csstools+css-parser-algorithms@4.0.0_@csstools+css-to_0211899857d0b31ddb20171e5feaa18a/node_modules/@csstools/css-color-parser/dist/index.mjs
4501
+ //#region ../../node_modules/.pnpm/@csstools+css-color-parser@4.2.4_@csstools+css-parser-algorithms@4.0.1_@csstools+css-to_3cec8fdb911b5b73345a3ccb5bd79466/node_modules/@csstools/css-color-parser/dist/index.mjs
4461
4502
  var xe;
4462
4503
  var De;
4463
4504
  function normalize(e, n, a, o) {
@@ -5048,7 +5089,7 @@ function color$1(e, n) {
5048
5089
  p.syntaxFlags.add(De.HasVariableAlpha), b.push(v);
5049
5090
  continue;
5050
5091
  }
5051
- if (!Q.has(toLowerCaseAZ(v.getName()))) return !1;
5092
+ if (!K.has(toLowerCaseAZ(v.getName()))) return !1;
5052
5093
  const [[e]] = calcFromComponentValues([[v]], {
5053
5094
  censorIntoStandardRepresentableValues: !0,
5054
5095
  globals: h,
@@ -5196,7 +5237,7 @@ function colorMixComponents(e, n) {
5196
5237
  }
5197
5238
  }
5198
5239
  if (!t) {
5199
- if (isFunctionNode(i) && Q.has(toLowerCaseAZ(i.getName()))) {
5240
+ if (isFunctionNode(i) && K.has(toLowerCaseAZ(i.getName()))) {
5200
5241
  if ([[i]] = calcFromComponentValues([[i]], {
5201
5242
  censorIntoStandardRepresentableValues: !0,
5202
5243
  precision: -1,
@@ -5620,7 +5661,7 @@ function threeChannelLegacySyntax(e, n, a, o) {
5620
5661
  h.syntaxFlags.add(De.HasVariableAlpha), N.push(a);
5621
5662
  continue;
5622
5663
  }
5623
- if (!Q.has(a.getName().toLowerCase())) return !1;
5664
+ if (!K.has(a.getName().toLowerCase())) return !1;
5624
5665
  const [[e]] = calcFromComponentValues([[a]], {
5625
5666
  censorIntoStandardRepresentableValues: !0,
5626
5667
  precision: -1,
@@ -5685,7 +5726,7 @@ function threeChannelSpaceSeparated(e, n, o, s, c) {
5685
5726
  v.syntaxFlags.add(De.HasVariableAlpha), f.push(r);
5686
5727
  continue;
5687
5728
  }
5688
- if (!Q.has(r.getName().toLowerCase())) return !1;
5729
+ if (!K.has(r.getName().toLowerCase())) return !1;
5689
5730
  const [[e]] = calcFromComponentValues([[r]], {
5690
5731
  censorIntoStandardRepresentableValues: !0,
5691
5732
  globals: p,
@@ -6154,7 +6195,7 @@ function alpha(e, n) {
6154
6195
  if (isWhitespaceNode(m) || isCommentNode(m)) for (; isWhitespaceNode(e.value[N + 1]) || isCommentNode(e.value[N + 1]);) N++;
6155
6196
  else if (u && !c && !i && isTokenNode(m) && isTokenDelim(m.value) && "/" === m.value[4].value) c = !0;
6156
6197
  else {
6157
- if (isFunctionNode(m) && Q.has(toLowerCaseAZ(m.getName()))) {
6198
+ if (isFunctionNode(m) && K.has(toLowerCaseAZ(m.getName()))) {
6158
6199
  const [[e]] = calcFromComponentValues([[m]], {
6159
6200
  censorIntoStandardRepresentableValues: !0,
6160
6201
  globals: s,
@@ -7713,13 +7754,16 @@ function collectThemeVariableRule(root, options = {}) {
7713
7754
  if (isDisplayP3Declaration(decl)) return;
7714
7755
  if (decl.prop.startsWith("--tw-")) return;
7715
7756
  if (!shouldPreserveContentInit && isEmptyTwContentDeclaration(decl)) return;
7716
- declarations.set(decl.prop, decl.clone());
7757
+ const values = declarations.get(decl.prop) ?? [];
7758
+ const previous = values.at(-1);
7759
+ if (!previous || previous.value !== decl.value || previous.important !== decl.important) values.push(decl.clone());
7760
+ declarations.set(decl.prop, values);
7717
7761
  });
7718
7762
  }
7719
7763
  for (const rule of themeRules) rule.remove();
7720
7764
  if (declarations.size === 0) return;
7721
7765
  const rule = postcss.rule({ selector: normalizeMiniProgramThemeScopeSelector(options.cssSelectorReplacement?.root) });
7722
- for (const decl of declarations.values()) rule.append(decl);
7766
+ for (const decl of declarations.values()) rule.append(...decl);
7723
7767
  return rule;
7724
7768
  }
7725
7769
  //#endregion