@rohal12/spindle 0.64.11 → 0.64.13

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.
@@ -5657,10 +5657,14 @@ var CLOSERS = /* @__PURE__ */ new Set([
5657
5657
  * After an operand, a `/` divides.
5658
5658
  */
5659
5659
  function tokenizerAt(src, start, goal, { onComment, afterOperand = false } = {}) {
5660
- const p = new SigilParser(onComment ? {
5660
+ const p = new SigilParser({
5661
5661
  ...OPTIONS,
5662
+ startLocation: {
5663
+ line: 1,
5664
+ column: 0
5665
+ },
5662
5666
  onComment
5663
- } : OPTIONS, src, start);
5667
+ }, src, start);
5664
5668
  if (goal === "expression") p.type = types$1.parenL;
5665
5669
  if (afterOperand) p.exprAllowed = false;
5666
5670
  return p;
@@ -9875,11 +9879,14 @@ var peg$SyntaxError = class extends SyntaxError {
9875
9879
  if (nonPrintable) return s.replace(nonPrintable, (ch) => "\\u{" + hex(ch) + "}");
9876
9880
  return s;
9877
9881
  }
9882
+ function escape(s, special) {
9883
+ return unicodeEscape(s.replace(special, "\\$&").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
9884
+ }
9878
9885
  function literalEscape(s) {
9879
- return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
9886
+ return escape(s, /[\\"]/g);
9880
9887
  }
9881
9888
  function classEscape(s) {
9882
- return unicodeEscape(s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
9889
+ return escape(s, /[\\\]^-]/g);
9883
9890
  }
9884
9891
  const DESCRIBE_EXPECTATION_FNS = {
9885
9892
  literal(expectation) {
@@ -9953,28 +9960,6 @@ function peg$parse(input, options) {
9953
9960
  const peg$c16 = "=";
9954
9961
  const peg$c17 = "\"";
9955
9962
  const peg$c18 = "'";
9956
- const peg$r0 = /^[^\\{[<]/;
9957
- const peg$r1 = /^[{}]/;
9958
- const peg$r2 = /^[$_@%(!\/a-zA-Z]/;
9959
- const peg$r3 = /^[.#]/;
9960
- const peg$r4 = /^[a-zA-Z0-9_\-]/;
9961
- const peg$r5 = /^[$_@%]/;
9962
- const peg$r6 = /^[a-zA-Z0-9_.]/;
9963
- const peg$r7 = /^[$_@%(!]/;
9964
- const peg$r8 = /^[a-zA-Z]/;
9965
- const peg$r9 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF}]/;
9966
- const peg$r10 = /^[a-zA-Z0-9.!#$%&'*+\/=?\^_`|~\-]/;
9967
- const peg$r11 = /^[a-zA-Z0-9.\-]/;
9968
- const peg$r12 = /^[a-zA-Z0-9+.\-]/;
9969
- const peg$r13 = /^[^\0- \x7F<>{}]/;
9970
- const peg$r14 = /^[\t-\r \/>\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
9971
- const peg$r15 = /^[a-zA-Z0-9\-]/;
9972
- const peg$r16 = /^[\t-\r "'\/<->{}\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
9973
- const peg$r17 = /^[^"]/;
9974
- const peg$r18 = /^[^']/;
9975
- const peg$r19 = /^["']/;
9976
- const peg$r20 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF>]/;
9977
- const peg$r21 = /^[ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;
9978
9963
  const peg$e0 = peg$anyExpectation();
9979
9964
  const peg$e1 = peg$classExpectation([
9980
9965
  "\\",
@@ -10539,6 +10524,7 @@ function peg$parse(input, options) {
10539
10524
  let peg$maxFailExpected = options.peg$maxFailExpected || [];
10540
10525
  let peg$silentFails = options.peg$silentFails | 0;
10541
10526
  let peg$result;
10527
+ let peg$charCode;
10542
10528
  if (options.startRule) {
10543
10529
  if (!(options.startRule in peg$startRuleFunctions)) throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
10544
10530
  peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
@@ -10646,10 +10632,10 @@ function peg$parse(input, options) {
10646
10632
  let s0, s1, s2;
10647
10633
  s0 = peg$currPos;
10648
10634
  s1 = [];
10649
- s2 = peg$parseTokenItem();
10650
- while (s2 !== peg$FAILED) {
10651
- s1.push(s2);
10635
+ for (;;) {
10652
10636
  s2 = peg$parseTokenItem();
10637
+ if (s2 === peg$FAILED) break;
10638
+ s1.push(s2);
10653
10639
  }
10654
10640
  peg$savedPos = s0;
10655
10641
  s1 = peg$f0(s1);
@@ -10934,15 +10920,7 @@ function peg$parse(input, options) {
10934
10920
  if (s1 !== peg$FAILED) {
10935
10921
  s2 = peg$currPos;
10936
10922
  s3 = [];
10937
- if (input.length > peg$currPos) {
10938
- s4 = input.charAt(peg$currPos);
10939
- peg$currPos++;
10940
- } else {
10941
- s4 = peg$FAILED;
10942
- if (peg$silentFails === 0) peg$fail(peg$e0);
10943
- }
10944
- while (s4 !== peg$FAILED) {
10945
- s3.push(s4);
10923
+ for (;;) {
10946
10924
  if (input.length > peg$currPos) {
10947
10925
  s4 = input.charAt(peg$currPos);
10948
10926
  peg$currPos++;
@@ -10950,6 +10928,8 @@ function peg$parse(input, options) {
10950
10928
  s4 = peg$FAILED;
10951
10929
  if (peg$silentFails === 0) peg$fail(peg$e0);
10952
10930
  }
10931
+ if (s4 === peg$FAILED) break;
10932
+ s3.push(s4);
10953
10933
  }
10954
10934
  s2 = input.substring(s2, peg$currPos);
10955
10935
  peg$savedPos = s0;
@@ -10975,22 +10955,17 @@ function peg$parse(input, options) {
10975
10955
  s0 = peg$currPos;
10976
10956
  s1 = peg$currPos;
10977
10957
  s2 = [];
10978
- s3 = input.charAt(peg$currPos);
10979
- if (peg$r0.test(s3)) peg$currPos++;
10980
- else {
10981
- s3 = peg$FAILED;
10982
- if (peg$silentFails === 0) peg$fail(peg$e1);
10983
- }
10984
- if (s3 !== peg$FAILED) while (s3 !== peg$FAILED) {
10985
- s2.push(s3);
10958
+ for (;;) {
10986
10959
  s3 = input.charAt(peg$currPos);
10987
- if (peg$r0.test(s3)) peg$currPos++;
10960
+ if (s3 !== "" && !(peg$charCode = s3.charCodeAt(0), peg$charCode === 92 || peg$charCode === 123 || peg$charCode === 91 || peg$charCode === 60)) peg$currPos++;
10988
10961
  else {
10989
10962
  s3 = peg$FAILED;
10990
10963
  if (peg$silentFails === 0) peg$fail(peg$e1);
10991
10964
  }
10965
+ if (s3 === peg$FAILED) break;
10966
+ s2.push(s3);
10992
10967
  }
10993
- else s2 = peg$FAILED;
10968
+ if (s2.length < 1) s2 = peg$FAILED;
10994
10969
  if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
10995
10970
  else s1 = s2;
10996
10971
  if (s1 !== peg$FAILED) {
@@ -11036,43 +11011,7 @@ function peg$parse(input, options) {
11036
11011
  else s5 = peg$FAILED;
11037
11012
  if (s5 !== peg$FAILED) {
11038
11013
  s6 = [];
11039
- s7 = peg$currPos;
11040
- s8 = peg$currPos;
11041
- peg$silentFails++;
11042
- if (input.substr(peg$currPos, 3) === peg$c3) {
11043
- s9 = peg$c3;
11044
- peg$currPos += 3;
11045
- } else {
11046
- s9 = peg$FAILED;
11047
- if (peg$silentFails === 0) peg$fail(peg$e5);
11048
- }
11049
- peg$silentFails--;
11050
- if (s9 === peg$FAILED) s8 = void 0;
11051
- else {
11052
- peg$currPos = s8;
11053
- s8 = peg$FAILED;
11054
- }
11055
- if (s8 !== peg$FAILED) {
11056
- if (input.length > peg$currPos) {
11057
- s9 = input.charAt(peg$currPos);
11058
- peg$currPos++;
11059
- } else {
11060
- s9 = peg$FAILED;
11061
- if (peg$silentFails === 0) peg$fail(peg$e0);
11062
- }
11063
- if (s9 !== peg$FAILED) {
11064
- s8 = [s8, s9];
11065
- s7 = s8;
11066
- } else {
11067
- peg$currPos = s7;
11068
- s7 = peg$FAILED;
11069
- }
11070
- } else {
11071
- peg$currPos = s7;
11072
- s7 = peg$FAILED;
11073
- }
11074
- while (s7 !== peg$FAILED) {
11075
- s6.push(s7);
11014
+ for (;;) {
11076
11015
  s7 = peg$currPos;
11077
11016
  s8 = peg$currPos;
11078
11017
  peg$silentFails++;
@@ -11108,6 +11047,8 @@ function peg$parse(input, options) {
11108
11047
  peg$currPos = s7;
11109
11048
  s7 = peg$FAILED;
11110
11049
  }
11050
+ if (s7 === peg$FAILED) break;
11051
+ s6.push(s7);
11111
11052
  }
11112
11053
  if (input.substr(peg$currPos, 3) === peg$c3) {
11113
11054
  s7 = peg$c3;
@@ -11159,15 +11100,7 @@ function peg$parse(input, options) {
11159
11100
  s0 = peg$currPos;
11160
11101
  s1 = peg$currPos;
11161
11102
  s2 = [];
11162
- if (input.charCodeAt(peg$currPos) === 92) {
11163
- s3 = peg$c4;
11164
- peg$currPos++;
11165
- } else {
11166
- s3 = peg$FAILED;
11167
- if (peg$silentFails === 0) peg$fail(peg$e6);
11168
- }
11169
- if (s3 !== peg$FAILED) while (s3 !== peg$FAILED) {
11170
- s2.push(s3);
11103
+ for (;;) {
11171
11104
  if (input.charCodeAt(peg$currPos) === 92) {
11172
11105
  s3 = peg$c4;
11173
11106
  peg$currPos++;
@@ -11175,8 +11108,10 @@ function peg$parse(input, options) {
11175
11108
  s3 = peg$FAILED;
11176
11109
  if (peg$silentFails === 0) peg$fail(peg$e6);
11177
11110
  }
11111
+ if (s3 === peg$FAILED) break;
11112
+ s2.push(s3);
11178
11113
  }
11179
- else s2 = peg$FAILED;
11114
+ if (s2.length < 1) s2 = peg$FAILED;
11180
11115
  if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
11181
11116
  else s1 = s2;
11182
11117
  if (s1 !== peg$FAILED) {
@@ -11187,7 +11122,7 @@ function peg$parse(input, options) {
11187
11122
  else s3 = peg$FAILED;
11188
11123
  if (s3 !== peg$FAILED) {
11189
11124
  s4 = input.charAt(peg$currPos);
11190
- if (peg$r1.test(s4)) peg$currPos++;
11125
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 123 || peg$charCode === 125) peg$currPos++;
11191
11126
  else {
11192
11127
  s4 = peg$FAILED;
11193
11128
  if (peg$silentFails === 0) peg$fail(peg$e7);
@@ -11229,7 +11164,7 @@ function peg$parse(input, options) {
11229
11164
  s4 = peg$parseSelectors();
11230
11165
  if (s4 !== peg$FAILED) {
11231
11166
  s5 = input.charAt(peg$currPos);
11232
- if (peg$r2.test(s5)) peg$currPos++;
11167
+ if (peg$charCode = s5.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33 || peg$charCode === 47 || peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
11233
11168
  else {
11234
11169
  s5 = peg$FAILED;
11235
11170
  if (peg$silentFails === 0) peg$fail(peg$e9);
@@ -11408,52 +11343,7 @@ function peg$parse(input, options) {
11408
11343
  function peg$parseLinkText() {
11409
11344
  let s0, s1, s2, s3;
11410
11345
  s0 = [];
11411
- s1 = peg$currPos;
11412
- s2 = peg$currPos;
11413
- peg$silentFails++;
11414
- if (input.substr(peg$currPos, 2) === peg$c9) {
11415
- s3 = peg$c9;
11416
- peg$currPos += 2;
11417
- } else {
11418
- s3 = peg$FAILED;
11419
- if (peg$silentFails === 0) peg$fail(peg$e13);
11420
- }
11421
- if (s3 === peg$FAILED) {
11422
- if (input.substr(peg$currPos, 2) === peg$c8) {
11423
- s3 = peg$c8;
11424
- peg$currPos += 2;
11425
- } else {
11426
- s3 = peg$FAILED;
11427
- if (peg$silentFails === 0) peg$fail(peg$e12);
11428
- }
11429
- }
11430
- peg$silentFails--;
11431
- if (s3 === peg$FAILED) s2 = void 0;
11432
- else {
11433
- peg$currPos = s2;
11434
- s2 = peg$FAILED;
11435
- }
11436
- if (s2 !== peg$FAILED) {
11437
- if (input.length > peg$currPos) {
11438
- s3 = input.charAt(peg$currPos);
11439
- peg$currPos++;
11440
- } else {
11441
- s3 = peg$FAILED;
11442
- if (peg$silentFails === 0) peg$fail(peg$e0);
11443
- }
11444
- if (s3 !== peg$FAILED) {
11445
- s2 = [s2, s3];
11446
- s1 = s2;
11447
- } else {
11448
- peg$currPos = s1;
11449
- s1 = peg$FAILED;
11450
- }
11451
- } else {
11452
- peg$currPos = s1;
11453
- s1 = peg$FAILED;
11454
- }
11455
- while (s1 !== peg$FAILED) {
11456
- s0.push(s1);
11346
+ for (;;) {
11457
11347
  s1 = peg$currPos;
11458
11348
  s2 = peg$currPos;
11459
11349
  peg$silentFails++;
@@ -11498,6 +11388,8 @@ function peg$parse(input, options) {
11498
11388
  peg$currPos = s1;
11499
11389
  s1 = peg$FAILED;
11500
11390
  }
11391
+ if (s1 === peg$FAILED) break;
11392
+ s0.push(s1);
11501
11393
  }
11502
11394
  return s0;
11503
11395
  }
@@ -11505,12 +11397,12 @@ function peg$parse(input, options) {
11505
11397
  let s0, s1, s2;
11506
11398
  s0 = peg$currPos;
11507
11399
  s1 = [];
11508
- s2 = peg$parseSelectorPart();
11509
- if (s2 !== peg$FAILED) while (s2 !== peg$FAILED) {
11510
- s1.push(s2);
11400
+ for (;;) {
11511
11401
  s2 = peg$parseSelectorPart();
11402
+ if (s2 === peg$FAILED) break;
11403
+ s1.push(s2);
11512
11404
  }
11513
- else s1 = peg$FAILED;
11405
+ if (s1.length < 1) s1 = peg$FAILED;
11514
11406
  if (s1 !== peg$FAILED) {
11515
11407
  if (input.charCodeAt(peg$currPos) === 32) {
11516
11408
  s2 = peg$c10;
@@ -11542,15 +11434,7 @@ function peg$parse(input, options) {
11542
11434
  if (s1 !== peg$FAILED) {
11543
11435
  s2 = peg$parseHere();
11544
11436
  s3 = [];
11545
- if (input.length > peg$currPos) {
11546
- s4 = input.charAt(peg$currPos);
11547
- peg$currPos++;
11548
- } else {
11549
- s4 = peg$FAILED;
11550
- if (peg$silentFails === 0) peg$fail(peg$e0);
11551
- }
11552
- while (s4 !== peg$FAILED) {
11553
- s3.push(s4);
11437
+ for (;;) {
11554
11438
  if (input.length > peg$currPos) {
11555
11439
  s4 = input.charAt(peg$currPos);
11556
11440
  peg$currPos++;
@@ -11558,6 +11442,8 @@ function peg$parse(input, options) {
11558
11442
  s4 = peg$FAILED;
11559
11443
  if (peg$silentFails === 0) peg$fail(peg$e0);
11560
11444
  }
11445
+ if (s4 === peg$FAILED) break;
11446
+ s3.push(s4);
11561
11447
  }
11562
11448
  peg$savedPos = s0;
11563
11449
  s0 = peg$f39(s1, s2);
@@ -11571,7 +11457,7 @@ function peg$parse(input, options) {
11571
11457
  let s0, s1, s2, s3, s4;
11572
11458
  s0 = peg$currPos;
11573
11459
  s1 = input.charAt(peg$currPos);
11574
- if (peg$r3.test(s1)) peg$currPos++;
11460
+ if (peg$charCode = s1.charCodeAt(0), peg$charCode === 46 || peg$charCode === 35) peg$currPos++;
11575
11461
  else {
11576
11462
  s1 = peg$FAILED;
11577
11463
  if (peg$silentFails === 0) peg$fail(peg$e15);
@@ -11579,10 +11465,10 @@ function peg$parse(input, options) {
11579
11465
  if (s1 !== peg$FAILED) {
11580
11466
  s2 = peg$currPos;
11581
11467
  s3 = [];
11582
- s4 = peg$parseSelectorChar();
11583
- while (s4 !== peg$FAILED) {
11584
- s3.push(s4);
11468
+ for (;;) {
11585
11469
  s4 = peg$parseSelectorChar();
11470
+ if (s4 === peg$FAILED) break;
11471
+ s3.push(s4);
11586
11472
  }
11587
11473
  s2 = input.substring(s2, peg$currPos);
11588
11474
  peg$savedPos = s0;
@@ -11596,7 +11482,7 @@ function peg$parse(input, options) {
11596
11482
  function peg$parseSelectorChar() {
11597
11483
  let s0, s1, s2, s3, s4;
11598
11484
  s0 = input.charAt(peg$currPos);
11599
- if (peg$r4.test(s0)) peg$currPos++;
11485
+ if (peg$charCode = s0.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 45) peg$currPos++;
11600
11486
  else {
11601
11487
  s0 = peg$FAILED;
11602
11488
  if (peg$silentFails === 0) peg$fail(peg$e16);
@@ -11612,27 +11498,22 @@ function peg$parse(input, options) {
11612
11498
  }
11613
11499
  if (s1 !== peg$FAILED) {
11614
11500
  s2 = input.charAt(peg$currPos);
11615
- if (peg$r5.test(s2)) peg$currPos++;
11501
+ if (peg$charCode = s2.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
11616
11502
  else {
11617
11503
  s2 = peg$FAILED;
11618
11504
  if (peg$silentFails === 0) peg$fail(peg$e17);
11619
11505
  }
11620
11506
  if (s2 !== peg$FAILED) {
11621
11507
  s3 = [];
11622
- s4 = input.charAt(peg$currPos);
11623
- if (peg$r6.test(s4)) peg$currPos++;
11624
- else {
11625
- s4 = peg$FAILED;
11626
- if (peg$silentFails === 0) peg$fail(peg$e18);
11627
- }
11628
- while (s4 !== peg$FAILED) {
11629
- s3.push(s4);
11508
+ for (;;) {
11630
11509
  s4 = input.charAt(peg$currPos);
11631
- if (peg$r6.test(s4)) peg$currPos++;
11510
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
11632
11511
  else {
11633
11512
  s4 = peg$FAILED;
11634
11513
  if (peg$silentFails === 0) peg$fail(peg$e18);
11635
11514
  }
11515
+ if (s4 === peg$FAILED) break;
11516
+ s3.push(s4);
11636
11517
  }
11637
11518
  if (input.charCodeAt(peg$currPos) === 125) {
11638
11519
  s4 = peg$c11;
@@ -11679,7 +11560,7 @@ function peg$parse(input, options) {
11679
11560
  s3 = peg$parseSelectors();
11680
11561
  if (s3 !== peg$FAILED) {
11681
11562
  s4 = input.charAt(peg$currPos);
11682
- if (peg$r5.test(s4)) peg$currPos++;
11563
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
11683
11564
  else {
11684
11565
  s4 = peg$FAILED;
11685
11566
  if (peg$silentFails === 0) peg$fail(peg$e17);
@@ -11688,20 +11569,15 @@ function peg$parse(input, options) {
11688
11569
  s5 = peg$parseHere();
11689
11570
  s6 = peg$currPos;
11690
11571
  s7 = [];
11691
- s8 = input.charAt(peg$currPos);
11692
- if (peg$r6.test(s8)) peg$currPos++;
11693
- else {
11694
- s8 = peg$FAILED;
11695
- if (peg$silentFails === 0) peg$fail(peg$e18);
11696
- }
11697
- while (s8 !== peg$FAILED) {
11698
- s7.push(s8);
11572
+ for (;;) {
11699
11573
  s8 = input.charAt(peg$currPos);
11700
- if (peg$r6.test(s8)) peg$currPos++;
11574
+ if (peg$charCode = s8.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
11701
11575
  else {
11702
11576
  s8 = peg$FAILED;
11703
11577
  if (peg$silentFails === 0) peg$fail(peg$e18);
11704
11578
  }
11579
+ if (s8 === peg$FAILED) break;
11580
+ s7.push(s8);
11705
11581
  }
11706
11582
  s6 = input.substring(s6, peg$currPos);
11707
11583
  s7 = peg$parseBraceEnd();
@@ -11741,7 +11617,7 @@ function peg$parse(input, options) {
11741
11617
  s5 = peg$currPos;
11742
11618
  peg$silentFails++;
11743
11619
  s6 = input.charAt(peg$currPos);
11744
- if (peg$r7.test(s6)) peg$currPos++;
11620
+ if (peg$charCode = s6.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
11745
11621
  else {
11746
11622
  s6 = peg$FAILED;
11747
11623
  if (peg$silentFails === 0) peg$fail(peg$e20);
@@ -11793,7 +11669,7 @@ function peg$parse(input, options) {
11793
11669
  s3 = peg$currPos;
11794
11670
  peg$silentFails++;
11795
11671
  s4 = input.charAt(peg$currPos);
11796
- if (peg$r7.test(s4)) peg$currPos++;
11672
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
11797
11673
  else {
11798
11674
  s4 = peg$FAILED;
11799
11675
  if (peg$silentFails === 0) peg$fail(peg$e20);
@@ -12058,27 +11934,22 @@ function peg$parse(input, options) {
12058
11934
  s0 = peg$currPos;
12059
11935
  s1 = peg$currPos;
12060
11936
  s2 = input.charAt(peg$currPos);
12061
- if (peg$r8.test(s2)) peg$currPos++;
11937
+ if (peg$charCode = s2.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
12062
11938
  else {
12063
11939
  s2 = peg$FAILED;
12064
11940
  if (peg$silentFails === 0) peg$fail(peg$e22);
12065
11941
  }
12066
11942
  if (s2 !== peg$FAILED) {
12067
11943
  s3 = [];
12068
- s4 = input.charAt(peg$currPos);
12069
- if (peg$r9.test(s4)) peg$currPos++;
12070
- else {
12071
- s4 = peg$FAILED;
12072
- if (peg$silentFails === 0) peg$fail(peg$e23);
12073
- }
12074
- while (s4 !== peg$FAILED) {
12075
- s3.push(s4);
11944
+ for (;;) {
12076
11945
  s4 = input.charAt(peg$currPos);
12077
- if (peg$r9.test(s4)) peg$currPos++;
11946
+ if (s4 !== "" && !(peg$charCode = s4.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279 || peg$charCode === 125)) peg$currPos++;
12078
11947
  else {
12079
11948
  s4 = peg$FAILED;
12080
11949
  if (peg$silentFails === 0) peg$fail(peg$e23);
12081
11950
  }
11951
+ if (s4 === peg$FAILED) break;
11952
+ s3.push(s4);
12082
11953
  }
12083
11954
  s2 = [s2, s3];
12084
11955
  s1 = s2;
@@ -12104,22 +11975,17 @@ function peg$parse(input, options) {
12104
11975
  }
12105
11976
  if (s3 !== peg$FAILED) {
12106
11977
  s4 = [];
12107
- s5 = input.charAt(peg$currPos);
12108
- if (peg$r10.test(s5)) peg$currPos++;
12109
- else {
12110
- s5 = peg$FAILED;
12111
- if (peg$silentFails === 0) peg$fail(peg$e24);
12112
- }
12113
- if (s5 !== peg$FAILED) while (s5 !== peg$FAILED) {
12114
- s4.push(s5);
11978
+ for (;;) {
12115
11979
  s5 = input.charAt(peg$currPos);
12116
- if (peg$r10.test(s5)) peg$currPos++;
11980
+ if (peg$charCode = s5.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 46 || peg$charCode === 33 || peg$charCode === 35 || peg$charCode === 36 || peg$charCode === 37 || peg$charCode === 38 || peg$charCode === 39 || peg$charCode === 42 || peg$charCode === 43 || peg$charCode === 47 || peg$charCode === 61 || peg$charCode === 63 || peg$charCode === 94 || peg$charCode === 95 || peg$charCode === 96 || peg$charCode === 124 || peg$charCode === 126 || peg$charCode === 45) peg$currPos++;
12117
11981
  else {
12118
11982
  s5 = peg$FAILED;
12119
11983
  if (peg$silentFails === 0) peg$fail(peg$e24);
12120
11984
  }
11985
+ if (s5 === peg$FAILED) break;
11986
+ s4.push(s5);
12121
11987
  }
12122
- else s4 = peg$FAILED;
11988
+ if (s4.length < 1) s4 = peg$FAILED;
12123
11989
  if (s4 !== peg$FAILED) {
12124
11990
  if (input.charCodeAt(peg$currPos) === 64) {
12125
11991
  s5 = peg$c13;
@@ -12130,22 +11996,17 @@ function peg$parse(input, options) {
12130
11996
  }
12131
11997
  if (s5 !== peg$FAILED) {
12132
11998
  s6 = [];
12133
- s7 = input.charAt(peg$currPos);
12134
- if (peg$r11.test(s7)) peg$currPos++;
12135
- else {
12136
- s7 = peg$FAILED;
12137
- if (peg$silentFails === 0) peg$fail(peg$e26);
12138
- }
12139
- if (s7 !== peg$FAILED) while (s7 !== peg$FAILED) {
12140
- s6.push(s7);
11999
+ for (;;) {
12141
12000
  s7 = input.charAt(peg$currPos);
12142
- if (peg$r11.test(s7)) peg$currPos++;
12001
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
12143
12002
  else {
12144
12003
  s7 = peg$FAILED;
12145
12004
  if (peg$silentFails === 0) peg$fail(peg$e26);
12146
12005
  }
12006
+ if (s7 === peg$FAILED) break;
12007
+ s6.push(s7);
12147
12008
  }
12148
- else s6 = peg$FAILED;
12009
+ if (s6.length < 1) s6 = peg$FAILED;
12149
12010
  if (s6 !== peg$FAILED) {
12150
12011
  if (input.charCodeAt(peg$currPos) === 62) {
12151
12012
  s7 = peg$c1;
@@ -12217,7 +12078,7 @@ function peg$parse(input, options) {
12217
12078
  }
12218
12079
  if (s3 !== peg$FAILED) {
12219
12080
  s4 = input.charAt(peg$currPos);
12220
- if (peg$r8.test(s4)) peg$currPos++;
12081
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
12221
12082
  else {
12222
12083
  s4 = peg$FAILED;
12223
12084
  if (peg$silentFails === 0) peg$fail(peg$e22);
@@ -12226,7 +12087,7 @@ function peg$parse(input, options) {
12226
12087
  s5 = peg$currPos;
12227
12088
  s6 = [];
12228
12089
  s7 = input.charAt(peg$currPos);
12229
- if (peg$r12.test(s7)) peg$currPos++;
12090
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 43 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
12230
12091
  else {
12231
12092
  s7 = peg$FAILED;
12232
12093
  if (peg$silentFails === 0) peg$fail(peg$e27);
@@ -12236,7 +12097,7 @@ function peg$parse(input, options) {
12236
12097
  if (s6.length >= 31) s7 = peg$FAILED;
12237
12098
  else {
12238
12099
  s7 = input.charAt(peg$currPos);
12239
- if (peg$r12.test(s7)) peg$currPos++;
12100
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 43 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
12240
12101
  else {
12241
12102
  s7 = peg$FAILED;
12242
12103
  if (peg$silentFails === 0) peg$fail(peg$e27);
@@ -12257,42 +12118,7 @@ function peg$parse(input, options) {
12257
12118
  }
12258
12119
  if (s6 !== peg$FAILED) {
12259
12120
  s7 = [];
12260
- s8 = peg$currPos;
12261
- s9 = peg$currPos;
12262
- peg$silentFails++;
12263
- if (input.substr(peg$currPos, 2) === peg$c8) {
12264
- s10 = peg$c8;
12265
- peg$currPos += 2;
12266
- } else {
12267
- s10 = peg$FAILED;
12268
- if (peg$silentFails === 0) peg$fail(peg$e12);
12269
- }
12270
- peg$silentFails--;
12271
- if (s10 === peg$FAILED) s9 = void 0;
12272
- else {
12273
- peg$currPos = s9;
12274
- s9 = peg$FAILED;
12275
- }
12276
- if (s9 !== peg$FAILED) {
12277
- s10 = input.charAt(peg$currPos);
12278
- if (peg$r13.test(s10)) peg$currPos++;
12279
- else {
12280
- s10 = peg$FAILED;
12281
- if (peg$silentFails === 0) peg$fail(peg$e29);
12282
- }
12283
- if (s10 !== peg$FAILED) {
12284
- s9 = [s9, s10];
12285
- s8 = s9;
12286
- } else {
12287
- peg$currPos = s8;
12288
- s8 = peg$FAILED;
12289
- }
12290
- } else {
12291
- peg$currPos = s8;
12292
- s8 = peg$FAILED;
12293
- }
12294
- while (s8 !== peg$FAILED) {
12295
- s7.push(s8);
12121
+ for (;;) {
12296
12122
  s8 = peg$currPos;
12297
12123
  s9 = peg$currPos;
12298
12124
  peg$silentFails++;
@@ -12311,7 +12137,7 @@ function peg$parse(input, options) {
12311
12137
  }
12312
12138
  if (s9 !== peg$FAILED) {
12313
12139
  s10 = input.charAt(peg$currPos);
12314
- if (peg$r13.test(s10)) peg$currPos++;
12140
+ if (s10 !== "" && !(peg$charCode = s10.charCodeAt(0), peg$charCode >= 0 && peg$charCode <= 32 || peg$charCode === 127 || peg$charCode === 60 || peg$charCode === 62 || peg$charCode === 123 || peg$charCode === 125)) peg$currPos++;
12315
12141
  else {
12316
12142
  s10 = peg$FAILED;
12317
12143
  if (peg$silentFails === 0) peg$fail(peg$e29);
@@ -12327,6 +12153,8 @@ function peg$parse(input, options) {
12327
12153
  peg$currPos = s8;
12328
12154
  s8 = peg$FAILED;
12329
12155
  }
12156
+ if (s8 === peg$FAILED) break;
12157
+ s7.push(s8);
12330
12158
  }
12331
12159
  if (input.charCodeAt(peg$currPos) === 62) {
12332
12160
  s8 = peg$c1;
@@ -12389,10 +12217,10 @@ function peg$parse(input, options) {
12389
12217
  s3 = peg$parseTagName();
12390
12218
  if (s3 !== peg$FAILED) {
12391
12219
  s4 = [];
12392
- s5 = peg$parseAttribute();
12393
- while (s5 !== peg$FAILED) {
12394
- s4.push(s5);
12220
+ for (;;) {
12395
12221
  s5 = peg$parseAttribute();
12222
+ if (s5 === peg$FAILED) break;
12223
+ s4.push(s5);
12396
12224
  }
12397
12225
  s5 = peg$parse_();
12398
12226
  if (input.charCodeAt(peg$currPos) === 47) {
@@ -12441,7 +12269,7 @@ function peg$parse(input, options) {
12441
12269
  s3 = peg$currPos;
12442
12270
  peg$silentFails++;
12443
12271
  s4 = input.charAt(peg$currPos);
12444
- if (peg$r14.test(s4)) peg$currPos++;
12272
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 9 && peg$charCode <= 13 || peg$charCode === 32 || peg$charCode === 47 || peg$charCode === 62 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode >= 8232 && peg$charCode <= 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
12445
12273
  else {
12446
12274
  s4 = peg$FAILED;
12447
12275
  if (peg$silentFails === 0) peg$fail(peg$e30);
@@ -12470,10 +12298,10 @@ function peg$parse(input, options) {
12470
12298
  } else s3 = peg$FAILED;
12471
12299
  if (s3 !== peg$FAILED) {
12472
12300
  s4 = [];
12473
- s5 = peg$parseAttribute();
12474
- while (s5 !== peg$FAILED) {
12475
- s4.push(s5);
12301
+ for (;;) {
12476
12302
  s5 = peg$parseAttribute();
12303
+ if (s5 === peg$FAILED) break;
12304
+ s4.push(s5);
12477
12305
  }
12478
12306
  s5 = peg$parse_();
12479
12307
  s6 = peg$parseHere();
@@ -12538,27 +12366,22 @@ function peg$parse(input, options) {
12538
12366
  s0 = peg$currPos;
12539
12367
  s1 = peg$currPos;
12540
12368
  s2 = input.charAt(peg$currPos);
12541
- if (peg$r8.test(s2)) peg$currPos++;
12369
+ if (peg$charCode = s2.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
12542
12370
  else {
12543
12371
  s2 = peg$FAILED;
12544
12372
  if (peg$silentFails === 0) peg$fail(peg$e22);
12545
12373
  }
12546
12374
  if (s2 !== peg$FAILED) {
12547
12375
  s3 = [];
12548
- s4 = input.charAt(peg$currPos);
12549
- if (peg$r15.test(s4)) peg$currPos++;
12550
- else {
12551
- s4 = peg$FAILED;
12552
- if (peg$silentFails === 0) peg$fail(peg$e32);
12553
- }
12554
- while (s4 !== peg$FAILED) {
12555
- s3.push(s4);
12376
+ for (;;) {
12556
12377
  s4 = input.charAt(peg$currPos);
12557
- if (peg$r15.test(s4)) peg$currPos++;
12378
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 45) peg$currPos++;
12558
12379
  else {
12559
12380
  s4 = peg$FAILED;
12560
12381
  if (peg$silentFails === 0) peg$fail(peg$e32);
12561
12382
  }
12383
+ if (s4 === peg$FAILED) break;
12384
+ s3.push(s4);
12562
12385
  }
12563
12386
  s2 = [s2, s3];
12564
12387
  s1 = s2;
@@ -12577,47 +12400,12 @@ function peg$parse(input, options) {
12577
12400
  s2 = peg$parseHere();
12578
12401
  s3 = peg$currPos;
12579
12402
  s4 = [];
12580
- s5 = peg$currPos;
12581
- s6 = peg$currPos;
12582
- peg$silentFails++;
12583
- s7 = input.charAt(peg$currPos);
12584
- if (peg$r16.test(s7)) peg$currPos++;
12585
- else {
12586
- s7 = peg$FAILED;
12587
- if (peg$silentFails === 0) peg$fail(peg$e33);
12588
- }
12589
- peg$silentFails--;
12590
- if (s7 === peg$FAILED) s6 = void 0;
12591
- else {
12592
- peg$currPos = s6;
12593
- s6 = peg$FAILED;
12594
- }
12595
- if (s6 !== peg$FAILED) {
12596
- if (input.length > peg$currPos) {
12597
- s7 = input.charAt(peg$currPos);
12598
- peg$currPos++;
12599
- } else {
12600
- s7 = peg$FAILED;
12601
- if (peg$silentFails === 0) peg$fail(peg$e0);
12602
- }
12603
- if (s7 !== peg$FAILED) {
12604
- s6 = [s6, s7];
12605
- s5 = s6;
12606
- } else {
12607
- peg$currPos = s5;
12608
- s5 = peg$FAILED;
12609
- }
12610
- } else {
12611
- peg$currPos = s5;
12612
- s5 = peg$FAILED;
12613
- }
12614
- if (s5 !== peg$FAILED) while (s5 !== peg$FAILED) {
12615
- s4.push(s5);
12403
+ for (;;) {
12616
12404
  s5 = peg$currPos;
12617
12405
  s6 = peg$currPos;
12618
12406
  peg$silentFails++;
12619
12407
  s7 = input.charAt(peg$currPos);
12620
- if (peg$r16.test(s7)) peg$currPos++;
12408
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 9 && peg$charCode <= 13 || peg$charCode === 32 || peg$charCode === 34 || peg$charCode === 39 || peg$charCode === 47 || peg$charCode >= 60 && peg$charCode <= 62 || peg$charCode === 123 || peg$charCode === 125 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode >= 8232 && peg$charCode <= 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
12621
12409
  else {
12622
12410
  s7 = peg$FAILED;
12623
12411
  if (peg$silentFails === 0) peg$fail(peg$e33);
@@ -12647,8 +12435,10 @@ function peg$parse(input, options) {
12647
12435
  peg$currPos = s5;
12648
12436
  s5 = peg$FAILED;
12649
12437
  }
12438
+ if (s5 === peg$FAILED) break;
12439
+ s4.push(s5);
12650
12440
  }
12651
- else s4 = peg$FAILED;
12441
+ if (s4.length < 1) s4 = peg$FAILED;
12652
12442
  if (s4 !== peg$FAILED) s3 = input.substring(s3, peg$currPos);
12653
12443
  else s3 = s4;
12654
12444
  if (s3 !== peg$FAILED) {
@@ -12707,26 +12497,18 @@ function peg$parse(input, options) {
12707
12497
  s2 = peg$parseHere();
12708
12498
  s3 = peg$currPos;
12709
12499
  s4 = [];
12710
- s5 = peg$parseValuePart();
12711
- if (s5 === peg$FAILED) {
12712
- s5 = input.charAt(peg$currPos);
12713
- if (peg$r17.test(s5)) peg$currPos++;
12714
- else {
12715
- s5 = peg$FAILED;
12716
- if (peg$silentFails === 0) peg$fail(peg$e36);
12717
- }
12718
- }
12719
- while (s5 !== peg$FAILED) {
12720
- s4.push(s5);
12500
+ for (;;) {
12721
12501
  s5 = peg$parseValuePart();
12722
12502
  if (s5 === peg$FAILED) {
12723
12503
  s5 = input.charAt(peg$currPos);
12724
- if (peg$r17.test(s5)) peg$currPos++;
12504
+ if (s5 !== "" && !(peg$charCode = s5.charCodeAt(0), peg$charCode === 34)) peg$currPos++;
12725
12505
  else {
12726
12506
  s5 = peg$FAILED;
12727
12507
  if (peg$silentFails === 0) peg$fail(peg$e36);
12728
12508
  }
12729
12509
  }
12510
+ if (s5 === peg$FAILED) break;
12511
+ s4.push(s5);
12730
12512
  }
12731
12513
  s3 = input.substring(s3, peg$currPos);
12732
12514
  s4 = peg$parseHere();
@@ -12762,26 +12544,18 @@ function peg$parse(input, options) {
12762
12544
  s2 = peg$parseHere();
12763
12545
  s3 = peg$currPos;
12764
12546
  s4 = [];
12765
- s5 = peg$parseValuePart();
12766
- if (s5 === peg$FAILED) {
12767
- s5 = input.charAt(peg$currPos);
12768
- if (peg$r18.test(s5)) peg$currPos++;
12769
- else {
12770
- s5 = peg$FAILED;
12771
- if (peg$silentFails === 0) peg$fail(peg$e38);
12772
- }
12773
- }
12774
- while (s5 !== peg$FAILED) {
12775
- s4.push(s5);
12547
+ for (;;) {
12776
12548
  s5 = peg$parseValuePart();
12777
12549
  if (s5 === peg$FAILED) {
12778
12550
  s5 = input.charAt(peg$currPos);
12779
- if (peg$r18.test(s5)) peg$currPos++;
12551
+ if (s5 !== "" && !(peg$charCode = s5.charCodeAt(0), peg$charCode === 39)) peg$currPos++;
12780
12552
  else {
12781
12553
  s5 = peg$FAILED;
12782
12554
  if (peg$silentFails === 0) peg$fail(peg$e38);
12783
12555
  }
12784
12556
  }
12557
+ if (s5 === peg$FAILED) break;
12558
+ s4.push(s5);
12785
12559
  }
12786
12560
  s3 = input.substring(s3, peg$currPos);
12787
12561
  s4 = peg$parseHere();
@@ -12807,7 +12581,7 @@ function peg$parse(input, options) {
12807
12581
  if (s0 === peg$FAILED) {
12808
12582
  s0 = peg$currPos;
12809
12583
  s1 = input.charAt(peg$currPos);
12810
- if (peg$r19.test(s1)) peg$currPos++;
12584
+ if (peg$charCode = s1.charCodeAt(0), peg$charCode === 34 || peg$charCode === 39) peg$currPos++;
12811
12585
  else {
12812
12586
  s1 = peg$FAILED;
12813
12587
  if (peg$silentFails === 0) peg$fail(peg$e39);
@@ -12822,20 +12596,15 @@ function peg$parse(input, options) {
12822
12596
  s1 = peg$parseHere();
12823
12597
  s2 = peg$currPos;
12824
12598
  s3 = [];
12825
- s4 = input.charAt(peg$currPos);
12826
- if (peg$r20.test(s4)) peg$currPos++;
12827
- else {
12828
- s4 = peg$FAILED;
12829
- if (peg$silentFails === 0) peg$fail(peg$e40);
12830
- }
12831
- while (s4 !== peg$FAILED) {
12832
- s3.push(s4);
12599
+ for (;;) {
12833
12600
  s4 = input.charAt(peg$currPos);
12834
- if (peg$r20.test(s4)) peg$currPos++;
12601
+ if (s4 !== "" && !(peg$charCode = s4.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279 || peg$charCode === 62)) peg$currPos++;
12835
12602
  else {
12836
12603
  s4 = peg$FAILED;
12837
12604
  if (peg$silentFails === 0) peg$fail(peg$e40);
12838
12605
  }
12606
+ if (s4 === peg$FAILED) break;
12607
+ s3.push(s4);
12839
12608
  }
12840
12609
  s2 = input.substring(s2, peg$currPos);
12841
12610
  s3 = peg$parseHere();
@@ -12856,15 +12625,7 @@ function peg$parse(input, options) {
12856
12625
  if (s1 !== peg$FAILED) {
12857
12626
  s2 = peg$currPos;
12858
12627
  s3 = [];
12859
- if (input.charCodeAt(peg$currPos) === 92) {
12860
- s4 = peg$c4;
12861
- peg$currPos++;
12862
- } else {
12863
- s4 = peg$FAILED;
12864
- if (peg$silentFails === 0) peg$fail(peg$e6);
12865
- }
12866
- if (s4 !== peg$FAILED) while (s4 !== peg$FAILED) {
12867
- s3.push(s4);
12628
+ for (;;) {
12868
12629
  if (input.charCodeAt(peg$currPos) === 92) {
12869
12630
  s4 = peg$c4;
12870
12631
  peg$currPos++;
@@ -12872,8 +12633,10 @@ function peg$parse(input, options) {
12872
12633
  s4 = peg$FAILED;
12873
12634
  if (peg$silentFails === 0) peg$fail(peg$e6);
12874
12635
  }
12636
+ if (s4 === peg$FAILED) break;
12637
+ s3.push(s4);
12875
12638
  }
12876
- else s3 = peg$FAILED;
12639
+ if (s3.length < 1) s3 = peg$FAILED;
12877
12640
  if (s3 !== peg$FAILED) s2 = input.substring(s2, peg$currPos);
12878
12641
  else s2 = s3;
12879
12642
  if (s2 !== peg$FAILED) {
@@ -12884,7 +12647,7 @@ function peg$parse(input, options) {
12884
12647
  else s4 = peg$FAILED;
12885
12648
  if (s4 !== peg$FAILED) {
12886
12649
  s5 = input.charAt(peg$currPos);
12887
- if (peg$r1.test(s5)) peg$currPos++;
12650
+ if (peg$charCode = s5.charCodeAt(0), peg$charCode === 123 || peg$charCode === 125) peg$currPos++;
12888
12651
  else {
12889
12652
  s5 = peg$FAILED;
12890
12653
  if (peg$silentFails === 0) peg$fail(peg$e7);
@@ -13052,7 +12815,7 @@ function peg$parse(input, options) {
13052
12815
  }
13053
12816
  if (s6 === peg$FAILED) s6 = null;
13054
12817
  s7 = input.charAt(peg$currPos);
13055
- if (peg$r8.test(s7)) peg$currPos++;
12818
+ if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
13056
12819
  else {
13057
12820
  s7 = peg$FAILED;
13058
12821
  if (peg$silentFails === 0) peg$fail(peg$e22);
@@ -13126,7 +12889,7 @@ function peg$parse(input, options) {
13126
12889
  s3 = peg$currPos;
13127
12890
  peg$silentFails++;
13128
12891
  s4 = input.charAt(peg$currPos);
13129
- if (peg$r5.test(s4)) peg$currPos++;
12892
+ if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
13130
12893
  else {
13131
12894
  s4 = peg$FAILED;
13132
12895
  if (peg$silentFails === 0) peg$fail(peg$e17);
@@ -13177,17 +12940,17 @@ function peg$parse(input, options) {
13177
12940
  function peg$parse_() {
13178
12941
  let s0, s1;
13179
12942
  s0 = [];
13180
- s1 = peg$parse_c();
13181
- while (s1 !== peg$FAILED) {
13182
- s0.push(s1);
12943
+ for (;;) {
13183
12944
  s1 = peg$parse_c();
12945
+ if (s1 === peg$FAILED) break;
12946
+ s0.push(s1);
13184
12947
  }
13185
12948
  return s0;
13186
12949
  }
13187
12950
  function peg$parse_c() {
13188
12951
  let s0;
13189
12952
  s0 = input.charAt(peg$currPos);
13190
- if (peg$r21.test(s0)) peg$currPos++;
12953
+ if (peg$charCode = s0.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
13191
12954
  else {
13192
12955
  s0 = peg$FAILED;
13193
12956
  if (peg$silentFails === 0) peg$fail(peg$e41);
@@ -15780,7 +15543,7 @@ function widgetDefinitions(passages, parametersOf = registeredParameters) {
15780
15543
  });
15781
15544
  }
15782
15545
  } else if (open.length > 0 && (token.type === "variable" && token.scope === "local" && token.name === "children" || tokenTextContainsChildren(token, parametersOf, passage.content, hooks, budget))) open[open.length - 1].isBlock = true;
15783
- done.push(...open);
15546
+ for (const def of open) done.push(def);
15784
15547
  const defs = [];
15785
15548
  for (const { token, isBlock, closeStart } of done) try {
15786
15549
  const [from, to] = nameSpan(token.rawArgs);
@@ -15795,7 +15558,8 @@ function widgetDefinitions(passages, parametersOf = registeredParameters) {
15795
15558
  ...closeStart === void 0 ? {} : { closeStart }
15796
15559
  });
15797
15560
  } catch {}
15798
- found.push(...defs.sort((a, b) => a.start - b.start));
15561
+ defs.sort((a, b) => a.start - b.start);
15562
+ for (const def of defs) found.push(def);
15799
15563
  }
15800
15564
  return found;
15801
15565
  };
@@ -20712,13 +20476,25 @@ function tabIndexAttr(el) {
20712
20476
  if (raw === null || !/^\s*[+-]?\d+\s*$/.test(raw)) return null;
20713
20477
  return parseInt(raw, 10);
20714
20478
  }
20479
+ /** Eligible radio stops in one DOM tree, including external form controls. */
20480
+ function radioTabStops(root) {
20481
+ const groups = /* @__PURE__ */ new Map();
20482
+ for (const radio of root.querySelectorAll("input[type=\"radio\"]")) {
20483
+ if (!radio.name || (tabIndexAttr(radio) ?? 0) < 0 || !isAvailable(radio)) continue;
20484
+ let names = groups.get(radio.form);
20485
+ if (!names) groups.set(radio.form, names = /* @__PURE__ */ new Map());
20486
+ const stop = names.get(radio.name);
20487
+ if (!stop || !stop.checked && radio.checked) names.set(radio.name, radio);
20488
+ }
20489
+ return new Set([...groups.values()].flatMap((names) => [...names.values()]));
20490
+ }
20715
20491
  /**
20716
20492
  * Whether the tab key can reach `el`, an available element (see
20717
20493
  * isAvailable): a negative tabindex only allows scripted focus, and of a
20718
20494
  * radio group the browser tabs to the checked member only (the first one
20719
20495
  * when none is checked), of the members it can reach.
20720
20496
  */
20721
- function isTabStop(el) {
20497
+ function isTabStop(el, radioStops) {
20722
20498
  const tabIndex = tabIndexAttr(el);
20723
20499
  if (tabIndex !== null && tabIndex < 0) return false;
20724
20500
  if (tabIndex === null && el.hasAttribute("contenteditable") && !el.matches("a[href], button, input, select, textarea, iframe, summary") && (!el.isContentEditable || el.parentElement?.isContentEditable)) return false;
@@ -20728,8 +20504,13 @@ function isTabStop(el) {
20728
20504
  }
20729
20505
  const input = el;
20730
20506
  if (el.localName === "input" && input.type === "radio" && input.name) {
20731
- const group = Array.from(el.getRootNode().querySelectorAll("input[type=\"radio\"]")).filter((r) => r.name === input.name && r.form === input.form && (tabIndexAttr(r) ?? 0) >= 0 && isAvailable(r));
20732
- return el === (group.find((r) => r.checked) ?? group[0]);
20507
+ const tree = el.getRootNode();
20508
+ let stops = radioStops.get(tree);
20509
+ if (!stops) {
20510
+ stops = radioTabStops(tree);
20511
+ radioStops.set(tree, stops);
20512
+ }
20513
+ return stops.has(input);
20733
20514
  }
20734
20515
  return true;
20735
20516
  }
@@ -20738,18 +20519,18 @@ function isTabStop(el) {
20738
20519
  * order Tab visits them: positive tabindexes first, ascending, then the
20739
20520
  * others in document order.
20740
20521
  */
20741
- function focusables(root) {
20522
+ function focusables(root, radioStops = /* @__PURE__ */ new Map()) {
20742
20523
  const scopes = [];
20743
20524
  const collect = (parent) => {
20744
20525
  for (const element of composedChildren(parent)) {
20745
20526
  const el = element;
20746
20527
  const nested = el.shadowRoot ?? (el.localName === "slot" ? el : null);
20747
- const stop = el.matches(FOCUSABLE) && isAvailable(el) && isTabStop(el);
20528
+ const stop = el.matches(FOCUSABLE) && isAvailable(el) && isTabStop(el, radioStops);
20748
20529
  if (nested) {
20749
20530
  if ((tabIndexAttr(el) ?? 0) < 0) continue;
20750
20531
  scopes.push({
20751
20532
  el,
20752
- stops: [...stop && !el.shadowRoot?.delegatesFocus ? [el] : [], ...focusables(nested)]
20533
+ stops: [...stop && !el.shadowRoot?.delegatesFocus ? [el] : [], ...focusables(nested, radioStops)]
20753
20534
  });
20754
20535
  } else {
20755
20536
  if (stop) scopes.push({