@rohal12/spindle 0.59.9 → 0.59.11

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.
@@ -388,20 +388,23 @@ function peg$parse(input, options) {
388
388
  SelectorsPrefix: peg$parseSelectorsPrefix
389
389
  };
390
390
  let peg$startRuleFunction = peg$parseMarkup;
391
- const peg$c0 = "\\";
392
- const peg$c1 = "{";
393
- const peg$c2 = "<";
394
- const peg$c3 = "[";
395
- const peg$c4 = "[[";
396
- const peg$c5 = "]]";
397
- const peg$c6 = " ";
398
- const peg$c7 = "}";
399
- const peg$c8 = "/";
400
- const peg$c9 = ">";
401
- const peg$c10 = "</";
402
- const peg$c11 = "=";
403
- const peg$c12 = "\"";
404
- const peg$c13 = "'";
391
+ const peg$c0 = "<!--";
392
+ const peg$c1 = ">";
393
+ const peg$c2 = "->";
394
+ const peg$c3 = "-->";
395
+ const peg$c4 = "\\";
396
+ const peg$c5 = "{";
397
+ const peg$c6 = "<";
398
+ const peg$c7 = "[";
399
+ const peg$c8 = "[[";
400
+ const peg$c9 = "]]";
401
+ const peg$c10 = " ";
402
+ const peg$c11 = "}";
403
+ const peg$c12 = "/";
404
+ const peg$c13 = "</";
405
+ const peg$c14 = "=";
406
+ const peg$c15 = "\"";
407
+ const peg$c16 = "'";
405
408
  const peg$r0 = /^[^\\{[<]/;
406
409
  const peg$r1 = /^[{}]/;
407
410
  const peg$r2 = /^[$_@%(!\/a-zA-Z]/;
@@ -427,10 +430,14 @@ function peg$parse(input, options) {
427
430
  "[",
428
431
  "<"
429
432
  ], true, false, false);
430
- const peg$e2 = peg$literalExpectation("\\", false);
431
- const peg$e3 = peg$classExpectation(["{", "}"], false, false, false);
432
- const peg$e4 = peg$literalExpectation("{", false);
433
- const peg$e5 = peg$classExpectation([
433
+ const peg$e2 = peg$literalExpectation("<!--", false);
434
+ const peg$e3 = peg$literalExpectation(">", false);
435
+ const peg$e4 = peg$literalExpectation("->", false);
436
+ const peg$e5 = peg$literalExpectation("-->", false);
437
+ const peg$e6 = peg$literalExpectation("\\", false);
438
+ const peg$e7 = peg$classExpectation(["{", "}"], false, false, false);
439
+ const peg$e8 = peg$literalExpectation("{", false);
440
+ const peg$e9 = peg$classExpectation([
434
441
  "$",
435
442
  "_",
436
443
  "@",
@@ -441,34 +448,34 @@ function peg$parse(input, options) {
441
448
  ["a", "z"],
442
449
  ["A", "Z"]
443
450
  ], false, false, false);
444
- const peg$e6 = peg$literalExpectation("<", false);
445
- const peg$e7 = peg$literalExpectation("[", false);
446
- const peg$e8 = peg$literalExpectation("[[", false);
447
- const peg$e9 = peg$literalExpectation("]]", false);
448
- const peg$e10 = peg$literalExpectation(" ", false);
449
- const peg$e11 = peg$classExpectation([".", "#"], false, false, false);
450
- const peg$e12 = peg$classExpectation([
451
+ const peg$e10 = peg$literalExpectation("<", false);
452
+ const peg$e11 = peg$literalExpectation("[", false);
453
+ const peg$e12 = peg$literalExpectation("[[", false);
454
+ const peg$e13 = peg$literalExpectation("]]", false);
455
+ const peg$e14 = peg$literalExpectation(" ", false);
456
+ const peg$e15 = peg$classExpectation([".", "#"], false, false, false);
457
+ const peg$e16 = peg$classExpectation([
451
458
  ["a", "z"],
452
459
  ["A", "Z"],
453
460
  ["0", "9"],
454
461
  "_",
455
462
  "-"
456
463
  ], false, false, false);
457
- const peg$e13 = peg$classExpectation([
464
+ const peg$e17 = peg$classExpectation([
458
465
  "$",
459
466
  "_",
460
467
  "@",
461
468
  "%"
462
469
  ], false, false, false);
463
- const peg$e14 = peg$classExpectation([
470
+ const peg$e18 = peg$classExpectation([
464
471
  ["a", "z"],
465
472
  ["A", "Z"],
466
473
  ["0", "9"],
467
474
  "_",
468
475
  "."
469
476
  ], false, false, false);
470
- const peg$e15 = peg$literalExpectation("}", false);
471
- const peg$e16 = peg$classExpectation([
477
+ const peg$e19 = peg$literalExpectation("}", false);
478
+ const peg$e20 = peg$classExpectation([
472
479
  "$",
473
480
  "_",
474
481
  "@",
@@ -476,9 +483,9 @@ function peg$parse(input, options) {
476
483
  "(",
477
484
  "!"
478
485
  ], false, false, false);
479
- const peg$e17 = peg$literalExpectation("/", false);
480
- const peg$e18 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
481
- const peg$e19 = peg$classExpectation([
486
+ const peg$e21 = peg$literalExpectation("/", false);
487
+ const peg$e22 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
488
+ const peg$e23 = peg$classExpectation([
482
489
  " ",
483
490
  " ",
484
491
  "\n",
@@ -496,8 +503,7 @@ function peg$parse(input, options) {
496
503
  "",
497
504
  "}"
498
505
  ], true, false, false);
499
- const peg$e20 = peg$literalExpectation(">", false);
500
- const peg$e21 = peg$classExpectation([
506
+ const peg$e24 = peg$classExpectation([
501
507
  [" ", "\r"],
502
508
  " ",
503
509
  "/",
@@ -511,14 +517,14 @@ function peg$parse(input, options) {
511
517
  " ",
512
518
  ""
513
519
  ], false, false, false);
514
- const peg$e22 = peg$literalExpectation("</", false);
515
- const peg$e23 = peg$classExpectation([
520
+ const peg$e25 = peg$literalExpectation("</", false);
521
+ const peg$e26 = peg$classExpectation([
516
522
  ["a", "z"],
517
523
  ["A", "Z"],
518
524
  ["0", "9"],
519
525
  "-"
520
526
  ], false, false, false);
521
- const peg$e24 = peg$classExpectation([
527
+ const peg$e27 = peg$classExpectation([
522
528
  [" ", "\r"],
523
529
  " ",
524
530
  "\"",
@@ -536,13 +542,13 @@ function peg$parse(input, options) {
536
542
  " ",
537
543
  ""
538
544
  ], false, false, false);
539
- const peg$e25 = peg$literalExpectation("=", false);
540
- const peg$e26 = peg$literalExpectation("\"", false);
541
- const peg$e27 = peg$classExpectation(["\""], true, false, false);
542
- const peg$e28 = peg$literalExpectation("'", false);
543
- const peg$e29 = peg$classExpectation(["'"], true, false, false);
544
- const peg$e30 = peg$classExpectation(["\"", "'"], false, false, false);
545
- const peg$e31 = peg$classExpectation([
545
+ const peg$e28 = peg$literalExpectation("=", false);
546
+ const peg$e29 = peg$literalExpectation("\"", false);
547
+ const peg$e30 = peg$classExpectation(["\""], true, false, false);
548
+ const peg$e31 = peg$literalExpectation("'", false);
549
+ const peg$e32 = peg$classExpectation(["'"], true, false, false);
550
+ const peg$e33 = peg$classExpectation(["\"", "'"], false, false, false);
551
+ const peg$e34 = peg$classExpectation([
546
552
  " ",
547
553
  " ",
548
554
  "\n",
@@ -560,7 +566,7 @@ function peg$parse(input, options) {
560
566
  "",
561
567
  ">"
562
568
  ], true, false, false);
563
- const peg$e32 = peg$classExpectation([
569
+ const peg$e35 = peg$classExpectation([
564
570
  " ",
565
571
  " ",
566
572
  "\n",
@@ -734,13 +740,16 @@ function peg$parse(input, options) {
734
740
  function peg$f40(value) {
735
741
  return lexeme("text", location(), { value });
736
742
  }
737
- function peg$f41(bs) {
743
+ function peg$f41(value) {
744
+ return lexeme("text", location(), { value });
745
+ }
746
+ function peg$f42(bs) {
738
747
  return bs.length % 2 === 1;
739
748
  }
740
- function peg$f42(bs, c) {
749
+ function peg$f43(bs, c) {
741
750
  return c;
742
751
  }
743
- function peg$f43(bs, brace) {
752
+ function peg$f44(bs, brace) {
744
753
  const loc = location();
745
754
  const next = input.charAt(loc.end.offset);
746
755
  if (textMode) {
@@ -757,76 +766,76 @@ function peg$parse(input, options) {
757
766
  escaped.escape = true;
758
767
  return bs.length > 1 ? [before, escaped] : escaped;
759
768
  }
760
- function peg$f44() {
769
+ function peg$f45() {
761
770
  return lexeme("text", location(), { value: LB });
762
771
  }
763
- function peg$f45() {
772
+ function peg$f46() {
764
773
  return !textMode;
765
774
  }
766
- function peg$f46() {
775
+ function peg$f47() {
767
776
  return lexeme("text", location(), { value: "<" });
768
777
  }
769
- function peg$f47() {
778
+ function peg$f48() {
770
779
  return lexeme("text", location(), { value: "[" });
771
780
  }
772
- function peg$f48() {
781
+ function peg$f49() {
773
782
  return !textMode;
774
783
  }
775
- function peg$f49(s, at, inner) {
784
+ function peg$f50(s, at, inner) {
776
785
  return withSelectors(lexeme("link", location(), parseLink(inner, at)), s);
777
786
  }
778
- function peg$f50() {
787
+ function peg$f51() {
779
788
  return !textMode;
780
789
  }
781
- function peg$f51() {
790
+ function peg$f52() {
782
791
  fail("Unclosed link: [[ without ]]", location());
783
792
  }
784
- function peg$f52(parts) {
793
+ function peg$f53(parts) {
785
794
  return selectorsOf(parts);
786
795
  }
787
- function peg$f53() {
796
+ function peg$f54() {
788
797
  return NO_SELECTORS;
789
798
  }
790
- function peg$f54(s, end) {
799
+ function peg$f55(s, end) {
791
800
  return {
792
801
  ...s,
793
802
  end
794
803
  };
795
804
  }
796
- function peg$f55(prefix, name) {
805
+ function peg$f56(prefix, name) {
797
806
  return [prefix, name];
798
807
  }
799
- function peg$f56(s, sigil, name) {
808
+ function peg$f57(s, sigil, name) {
800
809
  return withSelectors(lexeme("variable", location(), {
801
810
  name,
802
811
  scope: SIGIL_SCOPES[sigil]
803
812
  }), s);
804
813
  }
805
- function peg$f57(s, expression) {
814
+ function peg$f58(s, expression) {
806
815
  return withSelectors(lexeme("expression", location(), { expression }), s);
807
816
  }
808
- function peg$f58() {
817
+ function peg$f59() {
809
818
  fail("Unclosed " + LB + input.substr(location().end.offset, 1) + "…: no } ends it", location());
810
819
  }
811
- function peg$f59(start) {
820
+ function peg$f60(start) {
812
821
  return skipTo(hooks.closeBrace(input, start, start));
813
822
  }
814
- function peg$f60(start) {
823
+ function peg$f61(start) {
815
824
  return skipEnd - offset();
816
825
  }
817
- function peg$f61(start, code) {
826
+ function peg$f62(start, code) {
818
827
  return code;
819
828
  }
820
- function peg$f62(s, start, close, name, nameEnd) {
829
+ function peg$f63(s, start, close, name, nameEnd) {
821
830
  return skipTo(hooks.closeBrace(input, nameEnd, start));
822
831
  }
823
- function peg$f63(s, start, close, name, nameEnd) {
832
+ function peg$f64(s, start, close, name, nameEnd) {
824
833
  return skipEnd - offset();
825
834
  }
826
- function peg$f64(s, start, close, name, nameEnd, args) {
835
+ function peg$f65(s, start, close, name, nameEnd, args) {
827
836
  return args;
828
837
  }
829
- function peg$f65(s, start, close, name, nameEnd, tail) {
838
+ function peg$f66(s, start, close, name, nameEnd, tail) {
830
839
  const loc = location();
831
840
  const lower = name.toLowerCase();
832
841
  const tag = lexeme("macro", loc, {
@@ -847,19 +856,19 @@ function peg$parse(input, options) {
847
856
  }
848
857
  return tag;
849
858
  }
850
- function peg$f66(s) {
859
+ function peg$f67(s) {
851
860
  fail("A closing tag starts with a letter after " + LB + "/", location());
852
861
  }
853
- function peg$f67() {
862
+ function peg$f68() {
854
863
  return !textMode;
855
864
  }
856
- function peg$f68(tag) {
865
+ function peg$f69(tag) {
857
866
  return VOID_TAGS.has(tag.lower);
858
867
  }
859
- function peg$f69(tag) {
868
+ function peg$f70(tag) {
860
869
  return null;
861
870
  }
862
- function peg$f70(tag, list, slash) {
871
+ function peg$f71(tag, list, slash) {
863
872
  const lower = tag.toLowerCase();
864
873
  return lexeme("html", location(), {
865
874
  tag,
@@ -869,7 +878,7 @@ function peg$parse(input, options) {
869
878
  isSelfClose: !!slash || VOID_TAGS.has(lower)
870
879
  });
871
880
  }
872
- function peg$f71(tag, bad) {
881
+ function peg$f72(tag, bad) {
873
882
  const c = input.charAt(bad);
874
883
  if (!c) fail("Unclosed tag <" + tag + ": no > ends it (write &lt; for a < that starts no tag)", location());
875
884
  const at = {
@@ -887,7 +896,7 @@ function peg$parse(input, options) {
887
896
  };
888
897
  fail("Unexpected " + JSON.stringify(c) + " in the tag <" + tag + ">: expected an attribute, or > to end the tag", at);
889
898
  }
890
- function peg$f72(tag) {
899
+ function peg$f73(tag) {
891
900
  return lexeme("html", location(), {
892
901
  tag,
893
902
  lower: tag.toLowerCase(),
@@ -896,44 +905,44 @@ function peg$parse(input, options) {
896
905
  isSelfClose: false
897
906
  });
898
907
  }
899
- function peg$f73(name) {
908
+ function peg$f74(name) {
900
909
  attrCode = hooks.isCodeAttribute(name);
901
910
  return true;
902
911
  }
903
- function peg$f74(name, v) {
912
+ function peg$f75(name, v) {
904
913
  return v;
905
914
  }
906
- function peg$f75(name, value) {
915
+ function peg$f76(name, value) {
907
916
  return [name, value ?? ""];
908
917
  }
909
- function peg$f76(v) {
918
+ function peg$f77(v) {
910
919
  return v;
911
920
  }
912
- function peg$f77(v) {
921
+ function peg$f78(v) {
913
922
  return v;
914
923
  }
915
- function peg$f78(q) {
924
+ function peg$f79(q) {
916
925
  fail("Unclosed attribute value: the " + q + " here has no closing " + q, location());
917
926
  }
918
- function peg$f79() {
927
+ function peg$f80() {
919
928
  return !attrCode;
920
929
  }
921
- function peg$f80(bs) {
930
+ function peg$f81(bs) {
922
931
  return bs.length % 2 === 1;
923
932
  }
924
- function peg$f81() {
933
+ function peg$f82() {
925
934
  return !attrCode;
926
935
  }
927
- function peg$f82(start, nameEnd) {
936
+ function peg$f83(start, nameEnd) {
928
937
  return skipTo(hooks.closeBrace(input, nameEnd, start));
929
938
  }
930
- function peg$f83(start, nameEnd) {
939
+ function peg$f84(start, nameEnd) {
931
940
  return skipEnd - offset();
932
941
  }
933
- function peg$f84() {
942
+ function peg$f85() {
934
943
  return !attrCode;
935
944
  }
936
- function peg$f85() {
945
+ function peg$f86() {
937
946
  return attrCode;
938
947
  }
939
948
  let peg$currPos = options.peg$currPos | 0;
@@ -1120,16 +1129,19 @@ function peg$parse(input, options) {
1120
1129
  if (s0 === peg$FAILED) {
1121
1130
  s0 = peg$parseEscape();
1122
1131
  if (s0 === peg$FAILED) {
1123
- s0 = peg$parseLinkLexeme();
1132
+ s0 = peg$parseComment();
1124
1133
  if (s0 === peg$FAILED) {
1125
- s0 = peg$parseHtmlElement();
1134
+ s0 = peg$parseLinkLexeme();
1126
1135
  if (s0 === peg$FAILED) {
1127
- s0 = peg$parseVoidCloser();
1136
+ s0 = peg$parseHtmlElement();
1128
1137
  if (s0 === peg$FAILED) {
1129
- s0 = peg$parseValue();
1138
+ s0 = peg$parseVoidCloser();
1130
1139
  if (s0 === peg$FAILED) {
1131
- s0 = peg$parseMacroElement();
1132
- if (s0 === peg$FAILED) s0 = peg$parseLiteral();
1140
+ s0 = peg$parseValue();
1141
+ if (s0 === peg$FAILED) {
1142
+ s0 = peg$parseMacroElement();
1143
+ if (s0 === peg$FAILED) s0 = peg$parseLiteral();
1144
+ }
1133
1145
  }
1134
1146
  }
1135
1147
  }
@@ -1472,37 +1484,20 @@ function peg$parse(input, options) {
1472
1484
  if (s0 === peg$FAILED) {
1473
1485
  s0 = peg$parseEscape();
1474
1486
  if (s0 === peg$FAILED) {
1475
- s0 = peg$parseLinkLexeme();
1487
+ s0 = peg$parseComment();
1476
1488
  if (s0 === peg$FAILED) {
1477
- s0 = peg$currPos;
1478
- peg$savedPos = peg$currPos;
1479
- s1 = peg$f29();
1480
- if (s1) s1 = void 0;
1481
- else s1 = peg$FAILED;
1482
- if (s1 !== peg$FAILED) {
1483
- s2 = peg$parseHtmlOpen();
1484
- if (s2 !== peg$FAILED) {
1485
- peg$savedPos = s0;
1486
- s0 = peg$f30(s2);
1487
- } else {
1488
- peg$currPos = s0;
1489
- s0 = peg$FAILED;
1490
- }
1491
- } else {
1492
- peg$currPos = s0;
1493
- s0 = peg$FAILED;
1494
- }
1489
+ s0 = peg$parseLinkLexeme();
1495
1490
  if (s0 === peg$FAILED) {
1496
1491
  s0 = peg$currPos;
1497
1492
  peg$savedPos = peg$currPos;
1498
- s1 = peg$f31();
1493
+ s1 = peg$f29();
1499
1494
  if (s1) s1 = void 0;
1500
1495
  else s1 = peg$FAILED;
1501
1496
  if (s1 !== peg$FAILED) {
1502
- s2 = peg$parseHtmlClose();
1497
+ s2 = peg$parseHtmlOpen();
1503
1498
  if (s2 !== peg$FAILED) {
1504
1499
  peg$savedPos = s0;
1505
- s0 = peg$f32(s2);
1500
+ s0 = peg$f30(s2);
1506
1501
  } else {
1507
1502
  peg$currPos = s0;
1508
1503
  s0 = peg$FAILED;
@@ -1512,37 +1507,57 @@ function peg$parse(input, options) {
1512
1507
  s0 = peg$FAILED;
1513
1508
  }
1514
1509
  if (s0 === peg$FAILED) {
1515
- s0 = peg$parseValue();
1510
+ s0 = peg$currPos;
1511
+ peg$savedPos = peg$currPos;
1512
+ s1 = peg$f31();
1513
+ if (s1) s1 = void 0;
1514
+ else s1 = peg$FAILED;
1515
+ if (s1 !== peg$FAILED) {
1516
+ s2 = peg$parseHtmlClose();
1517
+ if (s2 !== peg$FAILED) {
1518
+ peg$savedPos = s0;
1519
+ s0 = peg$f32(s2);
1520
+ } else {
1521
+ peg$currPos = s0;
1522
+ s0 = peg$FAILED;
1523
+ }
1524
+ } else {
1525
+ peg$currPos = s0;
1526
+ s0 = peg$FAILED;
1527
+ }
1516
1528
  if (s0 === peg$FAILED) {
1517
- s0 = peg$currPos;
1518
- s1 = peg$parseMacroTag();
1519
- if (s1 !== peg$FAILED) {
1520
- s2 = peg$currPos;
1521
- peg$savedPos = peg$currPos;
1522
- s3 = peg$f33(s1);
1523
- if (s3) s3 = void 0;
1524
- else s3 = peg$FAILED;
1525
- if (s3 !== peg$FAILED) {
1526
- s4 = peg$parseRawTokens();
1527
- if (s4 !== peg$FAILED) {
1528
- peg$savedPos = s2;
1529
- s2 = peg$f34(s1, s4);
1529
+ s0 = peg$parseValue();
1530
+ if (s0 === peg$FAILED) {
1531
+ s0 = peg$currPos;
1532
+ s1 = peg$parseMacroTag();
1533
+ if (s1 !== peg$FAILED) {
1534
+ s2 = peg$currPos;
1535
+ peg$savedPos = peg$currPos;
1536
+ s3 = peg$f33(s1);
1537
+ if (s3) s3 = void 0;
1538
+ else s3 = peg$FAILED;
1539
+ if (s3 !== peg$FAILED) {
1540
+ s4 = peg$parseRawTokens();
1541
+ if (s4 !== peg$FAILED) {
1542
+ peg$savedPos = s2;
1543
+ s2 = peg$f34(s1, s4);
1544
+ } else {
1545
+ peg$currPos = s2;
1546
+ s2 = peg$FAILED;
1547
+ }
1530
1548
  } else {
1531
1549
  peg$currPos = s2;
1532
1550
  s2 = peg$FAILED;
1533
1551
  }
1552
+ if (s2 === peg$FAILED) s2 = null;
1553
+ peg$savedPos = s0;
1554
+ s0 = peg$f35(s1, s2);
1534
1555
  } else {
1535
- peg$currPos = s2;
1536
- s2 = peg$FAILED;
1556
+ peg$currPos = s0;
1557
+ s0 = peg$FAILED;
1537
1558
  }
1538
- if (s2 === peg$FAILED) s2 = null;
1539
- peg$savedPos = s0;
1540
- s0 = peg$f35(s1, s2);
1541
- } else {
1542
- peg$currPos = s0;
1543
- s0 = peg$FAILED;
1559
+ if (s0 === peg$FAILED) s0 = peg$parseLiteral();
1544
1560
  }
1545
- if (s0 === peg$FAILED) s0 = peg$parseLiteral();
1546
1561
  }
1547
1562
  }
1548
1563
  }
@@ -1648,26 +1663,166 @@ function peg$parse(input, options) {
1648
1663
  s0 = s1;
1649
1664
  return s0;
1650
1665
  }
1666
+ function peg$parseComment() {
1667
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8;
1668
+ s0 = peg$currPos;
1669
+ s1 = peg$currPos;
1670
+ s2 = peg$currPos;
1671
+ if (input.substr(peg$currPos, 4) === peg$c0) {
1672
+ s3 = peg$c0;
1673
+ peg$currPos += 4;
1674
+ } else {
1675
+ s3 = peg$FAILED;
1676
+ if (peg$silentFails === 0) peg$fail(peg$e2);
1677
+ }
1678
+ if (s3 !== peg$FAILED) {
1679
+ if (input.charCodeAt(peg$currPos) === 62) {
1680
+ s4 = peg$c1;
1681
+ peg$currPos++;
1682
+ } else {
1683
+ s4 = peg$FAILED;
1684
+ if (peg$silentFails === 0) peg$fail(peg$e3);
1685
+ }
1686
+ if (s4 === peg$FAILED) {
1687
+ if (input.substr(peg$currPos, 2) === peg$c2) {
1688
+ s4 = peg$c2;
1689
+ peg$currPos += 2;
1690
+ } else {
1691
+ s4 = peg$FAILED;
1692
+ if (peg$silentFails === 0) peg$fail(peg$e4);
1693
+ }
1694
+ if (s4 === peg$FAILED) {
1695
+ s4 = peg$currPos;
1696
+ s5 = [];
1697
+ s6 = peg$currPos;
1698
+ s7 = peg$currPos;
1699
+ peg$silentFails++;
1700
+ if (input.substr(peg$currPos, 3) === peg$c3) {
1701
+ s8 = peg$c3;
1702
+ peg$currPos += 3;
1703
+ } else {
1704
+ s8 = peg$FAILED;
1705
+ if (peg$silentFails === 0) peg$fail(peg$e5);
1706
+ }
1707
+ peg$silentFails--;
1708
+ if (s8 === peg$FAILED) s7 = void 0;
1709
+ else {
1710
+ peg$currPos = s7;
1711
+ s7 = peg$FAILED;
1712
+ }
1713
+ if (s7 !== peg$FAILED) {
1714
+ if (input.length > peg$currPos) {
1715
+ s8 = input.charAt(peg$currPos);
1716
+ peg$currPos++;
1717
+ } else {
1718
+ s8 = peg$FAILED;
1719
+ if (peg$silentFails === 0) peg$fail(peg$e0);
1720
+ }
1721
+ if (s8 !== peg$FAILED) {
1722
+ s7 = [s7, s8];
1723
+ s6 = s7;
1724
+ } else {
1725
+ peg$currPos = s6;
1726
+ s6 = peg$FAILED;
1727
+ }
1728
+ } else {
1729
+ peg$currPos = s6;
1730
+ s6 = peg$FAILED;
1731
+ }
1732
+ while (s6 !== peg$FAILED) {
1733
+ s5.push(s6);
1734
+ s6 = peg$currPos;
1735
+ s7 = peg$currPos;
1736
+ peg$silentFails++;
1737
+ if (input.substr(peg$currPos, 3) === peg$c3) {
1738
+ s8 = peg$c3;
1739
+ peg$currPos += 3;
1740
+ } else {
1741
+ s8 = peg$FAILED;
1742
+ if (peg$silentFails === 0) peg$fail(peg$e5);
1743
+ }
1744
+ peg$silentFails--;
1745
+ if (s8 === peg$FAILED) s7 = void 0;
1746
+ else {
1747
+ peg$currPos = s7;
1748
+ s7 = peg$FAILED;
1749
+ }
1750
+ if (s7 !== peg$FAILED) {
1751
+ if (input.length > peg$currPos) {
1752
+ s8 = input.charAt(peg$currPos);
1753
+ peg$currPos++;
1754
+ } else {
1755
+ s8 = peg$FAILED;
1756
+ if (peg$silentFails === 0) peg$fail(peg$e0);
1757
+ }
1758
+ if (s8 !== peg$FAILED) {
1759
+ s7 = [s7, s8];
1760
+ s6 = s7;
1761
+ } else {
1762
+ peg$currPos = s6;
1763
+ s6 = peg$FAILED;
1764
+ }
1765
+ } else {
1766
+ peg$currPos = s6;
1767
+ s6 = peg$FAILED;
1768
+ }
1769
+ }
1770
+ if (input.substr(peg$currPos, 3) === peg$c3) {
1771
+ s6 = peg$c3;
1772
+ peg$currPos += 3;
1773
+ } else {
1774
+ s6 = peg$FAILED;
1775
+ if (peg$silentFails === 0) peg$fail(peg$e5);
1776
+ }
1777
+ if (s6 !== peg$FAILED) {
1778
+ s5 = [s5, s6];
1779
+ s4 = s5;
1780
+ } else {
1781
+ peg$currPos = s4;
1782
+ s4 = peg$FAILED;
1783
+ }
1784
+ }
1785
+ }
1786
+ if (s4 !== peg$FAILED) {
1787
+ s3 = [s3, s4];
1788
+ s2 = s3;
1789
+ } else {
1790
+ peg$currPos = s2;
1791
+ s2 = peg$FAILED;
1792
+ }
1793
+ } else {
1794
+ peg$currPos = s2;
1795
+ s2 = peg$FAILED;
1796
+ }
1797
+ if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
1798
+ else s1 = s2;
1799
+ if (s1 !== peg$FAILED) {
1800
+ peg$savedPos = s0;
1801
+ s1 = peg$f41(s1);
1802
+ }
1803
+ s0 = s1;
1804
+ return s0;
1805
+ }
1651
1806
  function peg$parseEscape() {
1652
1807
  let s0, s1, s2, s3, s4;
1653
1808
  s0 = peg$currPos;
1654
1809
  s1 = peg$currPos;
1655
1810
  s2 = [];
1656
1811
  if (input.charCodeAt(peg$currPos) === 92) {
1657
- s3 = peg$c0;
1812
+ s3 = peg$c4;
1658
1813
  peg$currPos++;
1659
1814
  } else {
1660
1815
  s3 = peg$FAILED;
1661
- if (peg$silentFails === 0) peg$fail(peg$e2);
1816
+ if (peg$silentFails === 0) peg$fail(peg$e6);
1662
1817
  }
1663
1818
  if (s3 !== peg$FAILED) while (s3 !== peg$FAILED) {
1664
1819
  s2.push(s3);
1665
1820
  if (input.charCodeAt(peg$currPos) === 92) {
1666
- s3 = peg$c0;
1821
+ s3 = peg$c4;
1667
1822
  peg$currPos++;
1668
1823
  } else {
1669
1824
  s3 = peg$FAILED;
1670
- if (peg$silentFails === 0) peg$fail(peg$e2);
1825
+ if (peg$silentFails === 0) peg$fail(peg$e6);
1671
1826
  }
1672
1827
  }
1673
1828
  else s2 = peg$FAILED;
@@ -1676,7 +1831,7 @@ function peg$parse(input, options) {
1676
1831
  if (s1 !== peg$FAILED) {
1677
1832
  s2 = peg$currPos;
1678
1833
  peg$savedPos = peg$currPos;
1679
- s3 = peg$f41(s1);
1834
+ s3 = peg$f42(s1);
1680
1835
  if (s3) s3 = void 0;
1681
1836
  else s3 = peg$FAILED;
1682
1837
  if (s3 !== peg$FAILED) {
@@ -1684,11 +1839,11 @@ function peg$parse(input, options) {
1684
1839
  if (peg$r1.test(s4)) peg$currPos++;
1685
1840
  else {
1686
1841
  s4 = peg$FAILED;
1687
- if (peg$silentFails === 0) peg$fail(peg$e3);
1842
+ if (peg$silentFails === 0) peg$fail(peg$e7);
1688
1843
  }
1689
1844
  if (s4 !== peg$FAILED) {
1690
1845
  peg$savedPos = s2;
1691
- s2 = peg$f42(s1, s4);
1846
+ s2 = peg$f43(s1, s4);
1692
1847
  } else {
1693
1848
  peg$currPos = s2;
1694
1849
  s2 = peg$FAILED;
@@ -1699,7 +1854,7 @@ function peg$parse(input, options) {
1699
1854
  }
1700
1855
  if (s2 === peg$FAILED) s2 = null;
1701
1856
  peg$savedPos = s0;
1702
- s0 = peg$f43(s1, s2);
1857
+ s0 = peg$f44(s1, s2);
1703
1858
  } else {
1704
1859
  peg$currPos = s0;
1705
1860
  s0 = peg$FAILED;
@@ -1710,11 +1865,11 @@ function peg$parse(input, options) {
1710
1865
  let s0, s1, s2, s3, s4, s5;
1711
1866
  s0 = peg$currPos;
1712
1867
  if (input.charCodeAt(peg$currPos) === 123) {
1713
- s1 = peg$c1;
1868
+ s1 = peg$c5;
1714
1869
  peg$currPos++;
1715
1870
  } else {
1716
1871
  s1 = peg$FAILED;
1717
- if (peg$silentFails === 0) peg$fail(peg$e4);
1872
+ if (peg$silentFails === 0) peg$fail(peg$e8);
1718
1873
  }
1719
1874
  if (s1 !== peg$FAILED) {
1720
1875
  s2 = peg$currPos;
@@ -1726,7 +1881,7 @@ function peg$parse(input, options) {
1726
1881
  if (peg$r2.test(s5)) peg$currPos++;
1727
1882
  else {
1728
1883
  s5 = peg$FAILED;
1729
- if (peg$silentFails === 0) peg$fail(peg$e5);
1884
+ if (peg$silentFails === 0) peg$fail(peg$e9);
1730
1885
  }
1731
1886
  if (s5 !== peg$FAILED) {
1732
1887
  s4 = [s4, s5];
@@ -1747,7 +1902,7 @@ function peg$parse(input, options) {
1747
1902
  }
1748
1903
  if (s2 !== peg$FAILED) {
1749
1904
  peg$savedPos = s0;
1750
- s0 = peg$f44();
1905
+ s0 = peg$f45();
1751
1906
  } else {
1752
1907
  peg$currPos = s0;
1753
1908
  s0 = peg$FAILED;
@@ -1762,7 +1917,7 @@ function peg$parse(input, options) {
1762
1917
  peg$silentFails++;
1763
1918
  s2 = peg$currPos;
1764
1919
  peg$savedPos = peg$currPos;
1765
- s3 = peg$f45();
1920
+ s3 = peg$f46();
1766
1921
  if (s3) s3 = void 0;
1767
1922
  else s3 = peg$FAILED;
1768
1923
  if (s3 !== peg$FAILED) {
@@ -1786,15 +1941,15 @@ function peg$parse(input, options) {
1786
1941
  }
1787
1942
  if (s1 !== peg$FAILED) {
1788
1943
  if (input.charCodeAt(peg$currPos) === 60) {
1789
- s2 = peg$c2;
1944
+ s2 = peg$c6;
1790
1945
  peg$currPos++;
1791
1946
  } else {
1792
1947
  s2 = peg$FAILED;
1793
- if (peg$silentFails === 0) peg$fail(peg$e6);
1948
+ if (peg$silentFails === 0) peg$fail(peg$e10);
1794
1949
  }
1795
1950
  if (s2 !== peg$FAILED) {
1796
1951
  peg$savedPos = s0;
1797
- s0 = peg$f46();
1952
+ s0 = peg$f47();
1798
1953
  } else {
1799
1954
  peg$currPos = s0;
1800
1955
  s0 = peg$FAILED;
@@ -1806,15 +1961,15 @@ function peg$parse(input, options) {
1806
1961
  if (s0 === peg$FAILED) {
1807
1962
  s0 = peg$currPos;
1808
1963
  if (input.charCodeAt(peg$currPos) === 91) {
1809
- s1 = peg$c3;
1964
+ s1 = peg$c7;
1810
1965
  peg$currPos++;
1811
1966
  } else {
1812
1967
  s1 = peg$FAILED;
1813
- if (peg$silentFails === 0) peg$fail(peg$e7);
1968
+ if (peg$silentFails === 0) peg$fail(peg$e11);
1814
1969
  }
1815
1970
  if (s1 !== peg$FAILED) {
1816
1971
  peg$savedPos = s0;
1817
- s1 = peg$f47();
1972
+ s1 = peg$f48();
1818
1973
  }
1819
1974
  s0 = s1;
1820
1975
  }
@@ -1825,16 +1980,16 @@ function peg$parse(input, options) {
1825
1980
  let s0, s1, s2, s3, s4, s5, s6;
1826
1981
  s0 = peg$currPos;
1827
1982
  peg$savedPos = peg$currPos;
1828
- s1 = peg$f48();
1983
+ s1 = peg$f49();
1829
1984
  if (s1) s1 = void 0;
1830
1985
  else s1 = peg$FAILED;
1831
1986
  if (s1 !== peg$FAILED) {
1832
- if (input.substr(peg$currPos, 2) === peg$c4) {
1833
- s2 = peg$c4;
1987
+ if (input.substr(peg$currPos, 2) === peg$c8) {
1988
+ s2 = peg$c8;
1834
1989
  peg$currPos += 2;
1835
1990
  } else {
1836
1991
  s2 = peg$FAILED;
1837
- if (peg$silentFails === 0) peg$fail(peg$e8);
1992
+ if (peg$silentFails === 0) peg$fail(peg$e12);
1838
1993
  }
1839
1994
  if (s2 !== peg$FAILED) {
1840
1995
  s3 = peg$parseSelectors();
@@ -1843,16 +1998,16 @@ function peg$parse(input, options) {
1843
1998
  s5 = peg$currPos;
1844
1999
  s6 = peg$parseLinkText();
1845
2000
  s5 = input.substring(s5, peg$currPos);
1846
- if (input.substr(peg$currPos, 2) === peg$c5) {
1847
- s6 = peg$c5;
2001
+ if (input.substr(peg$currPos, 2) === peg$c9) {
2002
+ s6 = peg$c9;
1848
2003
  peg$currPos += 2;
1849
2004
  } else {
1850
2005
  s6 = peg$FAILED;
1851
- if (peg$silentFails === 0) peg$fail(peg$e9);
2006
+ if (peg$silentFails === 0) peg$fail(peg$e13);
1852
2007
  }
1853
2008
  if (s6 !== peg$FAILED) {
1854
2009
  peg$savedPos = s0;
1855
- s0 = peg$f49(s3, s4, s5);
2010
+ s0 = peg$f50(s3, s4, s5);
1856
2011
  } else {
1857
2012
  peg$currPos = s0;
1858
2013
  s0 = peg$FAILED;
@@ -1872,20 +2027,20 @@ function peg$parse(input, options) {
1872
2027
  if (s0 === peg$FAILED) {
1873
2028
  s0 = peg$currPos;
1874
2029
  peg$savedPos = peg$currPos;
1875
- s1 = peg$f50();
2030
+ s1 = peg$f51();
1876
2031
  if (s1) s1 = void 0;
1877
2032
  else s1 = peg$FAILED;
1878
2033
  if (s1 !== peg$FAILED) {
1879
- if (input.substr(peg$currPos, 2) === peg$c4) {
1880
- s2 = peg$c4;
2034
+ if (input.substr(peg$currPos, 2) === peg$c8) {
2035
+ s2 = peg$c8;
1881
2036
  peg$currPos += 2;
1882
2037
  } else {
1883
2038
  s2 = peg$FAILED;
1884
- if (peg$silentFails === 0) peg$fail(peg$e8);
2039
+ if (peg$silentFails === 0) peg$fail(peg$e12);
1885
2040
  }
1886
2041
  if (s2 !== peg$FAILED) {
1887
2042
  peg$savedPos = s0;
1888
- s0 = peg$f51();
2043
+ s0 = peg$f52();
1889
2044
  } else {
1890
2045
  peg$currPos = s0;
1891
2046
  s0 = peg$FAILED;
@@ -1903,19 +2058,19 @@ function peg$parse(input, options) {
1903
2058
  s1 = peg$currPos;
1904
2059
  s2 = peg$currPos;
1905
2060
  peg$silentFails++;
1906
- if (input.substr(peg$currPos, 2) === peg$c5) {
1907
- s3 = peg$c5;
2061
+ if (input.substr(peg$currPos, 2) === peg$c9) {
2062
+ s3 = peg$c9;
1908
2063
  peg$currPos += 2;
1909
2064
  } else {
1910
2065
  s3 = peg$FAILED;
1911
- if (peg$silentFails === 0) peg$fail(peg$e9);
2066
+ if (peg$silentFails === 0) peg$fail(peg$e13);
1912
2067
  }
1913
- if (s3 === peg$FAILED) if (input.substr(peg$currPos, 2) === peg$c4) {
1914
- s3 = peg$c4;
2068
+ if (s3 === peg$FAILED) if (input.substr(peg$currPos, 2) === peg$c8) {
2069
+ s3 = peg$c8;
1915
2070
  peg$currPos += 2;
1916
2071
  } else {
1917
2072
  s3 = peg$FAILED;
1918
- if (peg$silentFails === 0) peg$fail(peg$e8);
2073
+ if (peg$silentFails === 0) peg$fail(peg$e12);
1919
2074
  }
1920
2075
  peg$silentFails--;
1921
2076
  if (s3 === peg$FAILED) s2 = void 0;
@@ -1947,19 +2102,19 @@ function peg$parse(input, options) {
1947
2102
  s1 = peg$currPos;
1948
2103
  s2 = peg$currPos;
1949
2104
  peg$silentFails++;
1950
- if (input.substr(peg$currPos, 2) === peg$c5) {
1951
- s3 = peg$c5;
2105
+ if (input.substr(peg$currPos, 2) === peg$c9) {
2106
+ s3 = peg$c9;
1952
2107
  peg$currPos += 2;
1953
2108
  } else {
1954
2109
  s3 = peg$FAILED;
1955
- if (peg$silentFails === 0) peg$fail(peg$e9);
2110
+ if (peg$silentFails === 0) peg$fail(peg$e13);
1956
2111
  }
1957
- if (s3 === peg$FAILED) if (input.substr(peg$currPos, 2) === peg$c4) {
1958
- s3 = peg$c4;
2112
+ if (s3 === peg$FAILED) if (input.substr(peg$currPos, 2) === peg$c8) {
2113
+ s3 = peg$c8;
1959
2114
  peg$currPos += 2;
1960
2115
  } else {
1961
2116
  s3 = peg$FAILED;
1962
- if (peg$silentFails === 0) peg$fail(peg$e8);
2117
+ if (peg$silentFails === 0) peg$fail(peg$e12);
1963
2118
  }
1964
2119
  peg$silentFails--;
1965
2120
  if (s3 === peg$FAILED) s2 = void 0;
@@ -2001,15 +2156,15 @@ function peg$parse(input, options) {
2001
2156
  else s1 = peg$FAILED;
2002
2157
  if (s1 !== peg$FAILED) {
2003
2158
  if (input.charCodeAt(peg$currPos) === 32) {
2004
- s2 = peg$c6;
2159
+ s2 = peg$c10;
2005
2160
  peg$currPos++;
2006
2161
  } else {
2007
2162
  s2 = peg$FAILED;
2008
- if (peg$silentFails === 0) peg$fail(peg$e10);
2163
+ if (peg$silentFails === 0) peg$fail(peg$e14);
2009
2164
  }
2010
2165
  if (s2 === peg$FAILED) s2 = null;
2011
2166
  peg$savedPos = s0;
2012
- s0 = peg$f52(s1);
2167
+ s0 = peg$f53(s1);
2013
2168
  } else {
2014
2169
  peg$currPos = s0;
2015
2170
  s0 = peg$FAILED;
@@ -2018,7 +2173,7 @@ function peg$parse(input, options) {
2018
2173
  s0 = peg$currPos;
2019
2174
  s1 = "";
2020
2175
  peg$savedPos = s0;
2021
- s1 = peg$f53();
2176
+ s1 = peg$f54();
2022
2177
  s0 = s1;
2023
2178
  }
2024
2179
  return s0;
@@ -2048,7 +2203,7 @@ function peg$parse(input, options) {
2048
2203
  }
2049
2204
  }
2050
2205
  peg$savedPos = s0;
2051
- s0 = peg$f54(s1, s2);
2206
+ s0 = peg$f55(s1, s2);
2052
2207
  } else {
2053
2208
  peg$currPos = s0;
2054
2209
  s0 = peg$FAILED;
@@ -2062,7 +2217,7 @@ function peg$parse(input, options) {
2062
2217
  if (peg$r3.test(s1)) peg$currPos++;
2063
2218
  else {
2064
2219
  s1 = peg$FAILED;
2065
- if (peg$silentFails === 0) peg$fail(peg$e11);
2220
+ if (peg$silentFails === 0) peg$fail(peg$e15);
2066
2221
  }
2067
2222
  if (s1 !== peg$FAILED) {
2068
2223
  s2 = peg$currPos;
@@ -2074,7 +2229,7 @@ function peg$parse(input, options) {
2074
2229
  }
2075
2230
  s2 = input.substring(s2, peg$currPos);
2076
2231
  peg$savedPos = s0;
2077
- s0 = peg$f55(s1, s2);
2232
+ s0 = peg$f56(s1, s2);
2078
2233
  } else {
2079
2234
  peg$currPos = s0;
2080
2235
  s0 = peg$FAILED;
@@ -2087,23 +2242,23 @@ function peg$parse(input, options) {
2087
2242
  if (peg$r4.test(s0)) peg$currPos++;
2088
2243
  else {
2089
2244
  s0 = peg$FAILED;
2090
- if (peg$silentFails === 0) peg$fail(peg$e12);
2245
+ if (peg$silentFails === 0) peg$fail(peg$e16);
2091
2246
  }
2092
2247
  if (s0 === peg$FAILED) {
2093
2248
  s0 = peg$currPos;
2094
2249
  if (input.charCodeAt(peg$currPos) === 123) {
2095
- s1 = peg$c1;
2250
+ s1 = peg$c5;
2096
2251
  peg$currPos++;
2097
2252
  } else {
2098
2253
  s1 = peg$FAILED;
2099
- if (peg$silentFails === 0) peg$fail(peg$e4);
2254
+ if (peg$silentFails === 0) peg$fail(peg$e8);
2100
2255
  }
2101
2256
  if (s1 !== peg$FAILED) {
2102
2257
  s2 = input.charAt(peg$currPos);
2103
2258
  if (peg$r5.test(s2)) peg$currPos++;
2104
2259
  else {
2105
2260
  s2 = peg$FAILED;
2106
- if (peg$silentFails === 0) peg$fail(peg$e13);
2261
+ if (peg$silentFails === 0) peg$fail(peg$e17);
2107
2262
  }
2108
2263
  if (s2 !== peg$FAILED) {
2109
2264
  s3 = [];
@@ -2111,7 +2266,7 @@ function peg$parse(input, options) {
2111
2266
  if (peg$r6.test(s4)) peg$currPos++;
2112
2267
  else {
2113
2268
  s4 = peg$FAILED;
2114
- if (peg$silentFails === 0) peg$fail(peg$e14);
2269
+ if (peg$silentFails === 0) peg$fail(peg$e18);
2115
2270
  }
2116
2271
  while (s4 !== peg$FAILED) {
2117
2272
  s3.push(s4);
@@ -2119,15 +2274,15 @@ function peg$parse(input, options) {
2119
2274
  if (peg$r6.test(s4)) peg$currPos++;
2120
2275
  else {
2121
2276
  s4 = peg$FAILED;
2122
- if (peg$silentFails === 0) peg$fail(peg$e14);
2277
+ if (peg$silentFails === 0) peg$fail(peg$e18);
2123
2278
  }
2124
2279
  }
2125
2280
  if (input.charCodeAt(peg$currPos) === 125) {
2126
- s4 = peg$c7;
2281
+ s4 = peg$c11;
2127
2282
  peg$currPos++;
2128
2283
  } else {
2129
2284
  s4 = peg$FAILED;
2130
- if (peg$silentFails === 0) peg$fail(peg$e15);
2285
+ if (peg$silentFails === 0) peg$fail(peg$e19);
2131
2286
  }
2132
2287
  if (s4 !== peg$FAILED) {
2133
2288
  s1 = [
@@ -2156,11 +2311,11 @@ function peg$parse(input, options) {
2156
2311
  let s0, s1, s2, s3, s4, s5, s6;
2157
2312
  s0 = peg$currPos;
2158
2313
  if (input.charCodeAt(peg$currPos) === 123) {
2159
- s1 = peg$c1;
2314
+ s1 = peg$c5;
2160
2315
  peg$currPos++;
2161
2316
  } else {
2162
2317
  s1 = peg$FAILED;
2163
- if (peg$silentFails === 0) peg$fail(peg$e4);
2318
+ if (peg$silentFails === 0) peg$fail(peg$e8);
2164
2319
  }
2165
2320
  if (s1 !== peg$FAILED) {
2166
2321
  s2 = peg$parseSelectors();
@@ -2169,7 +2324,7 @@ function peg$parse(input, options) {
2169
2324
  if (peg$r5.test(s3)) peg$currPos++;
2170
2325
  else {
2171
2326
  s3 = peg$FAILED;
2172
- if (peg$silentFails === 0) peg$fail(peg$e13);
2327
+ if (peg$silentFails === 0) peg$fail(peg$e17);
2173
2328
  }
2174
2329
  if (s3 !== peg$FAILED) {
2175
2330
  s4 = peg$currPos;
@@ -2178,7 +2333,7 @@ function peg$parse(input, options) {
2178
2333
  if (peg$r6.test(s6)) peg$currPos++;
2179
2334
  else {
2180
2335
  s6 = peg$FAILED;
2181
- if (peg$silentFails === 0) peg$fail(peg$e14);
2336
+ if (peg$silentFails === 0) peg$fail(peg$e18);
2182
2337
  }
2183
2338
  while (s6 !== peg$FAILED) {
2184
2339
  s5.push(s6);
@@ -2186,20 +2341,20 @@ function peg$parse(input, options) {
2186
2341
  if (peg$r6.test(s6)) peg$currPos++;
2187
2342
  else {
2188
2343
  s6 = peg$FAILED;
2189
- if (peg$silentFails === 0) peg$fail(peg$e14);
2344
+ if (peg$silentFails === 0) peg$fail(peg$e18);
2190
2345
  }
2191
2346
  }
2192
2347
  s4 = input.substring(s4, peg$currPos);
2193
2348
  if (input.charCodeAt(peg$currPos) === 125) {
2194
- s5 = peg$c7;
2349
+ s5 = peg$c11;
2195
2350
  peg$currPos++;
2196
2351
  } else {
2197
2352
  s5 = peg$FAILED;
2198
- if (peg$silentFails === 0) peg$fail(peg$e15);
2353
+ if (peg$silentFails === 0) peg$fail(peg$e19);
2199
2354
  }
2200
2355
  if (s5 !== peg$FAILED) {
2201
2356
  peg$savedPos = s0;
2202
- s0 = peg$f56(s2, s3, s4);
2357
+ s0 = peg$f57(s2, s3, s4);
2203
2358
  } else {
2204
2359
  peg$currPos = s0;
2205
2360
  s0 = peg$FAILED;
@@ -2219,11 +2374,11 @@ function peg$parse(input, options) {
2219
2374
  if (s0 === peg$FAILED) {
2220
2375
  s0 = peg$currPos;
2221
2376
  if (input.charCodeAt(peg$currPos) === 123) {
2222
- s1 = peg$c1;
2377
+ s1 = peg$c5;
2223
2378
  peg$currPos++;
2224
2379
  } else {
2225
2380
  s1 = peg$FAILED;
2226
- if (peg$silentFails === 0) peg$fail(peg$e4);
2381
+ if (peg$silentFails === 0) peg$fail(peg$e8);
2227
2382
  }
2228
2383
  if (s1 !== peg$FAILED) {
2229
2384
  s2 = peg$parseSelectors();
@@ -2234,7 +2389,7 @@ function peg$parse(input, options) {
2234
2389
  if (peg$r7.test(s4)) peg$currPos++;
2235
2390
  else {
2236
2391
  s4 = peg$FAILED;
2237
- if (peg$silentFails === 0) peg$fail(peg$e16);
2392
+ if (peg$silentFails === 0) peg$fail(peg$e20);
2238
2393
  }
2239
2394
  peg$silentFails--;
2240
2395
  if (s4 !== peg$FAILED) {
@@ -2245,15 +2400,15 @@ function peg$parse(input, options) {
2245
2400
  s4 = peg$parseCodeToBrace();
2246
2401
  if (s4 !== peg$FAILED) {
2247
2402
  if (input.charCodeAt(peg$currPos) === 125) {
2248
- s5 = peg$c7;
2403
+ s5 = peg$c11;
2249
2404
  peg$currPos++;
2250
2405
  } else {
2251
2406
  s5 = peg$FAILED;
2252
- if (peg$silentFails === 0) peg$fail(peg$e15);
2407
+ if (peg$silentFails === 0) peg$fail(peg$e19);
2253
2408
  }
2254
2409
  if (s5 !== peg$FAILED) {
2255
2410
  peg$savedPos = s0;
2256
- s0 = peg$f57(s2, s4);
2411
+ s0 = peg$f58(s2, s4);
2257
2412
  } else {
2258
2413
  peg$currPos = s0;
2259
2414
  s0 = peg$FAILED;
@@ -2277,11 +2432,11 @@ function peg$parse(input, options) {
2277
2432
  if (s0 === peg$FAILED) {
2278
2433
  s0 = peg$currPos;
2279
2434
  if (input.charCodeAt(peg$currPos) === 123) {
2280
- s1 = peg$c1;
2435
+ s1 = peg$c5;
2281
2436
  peg$currPos++;
2282
2437
  } else {
2283
2438
  s1 = peg$FAILED;
2284
- if (peg$silentFails === 0) peg$fail(peg$e4);
2439
+ if (peg$silentFails === 0) peg$fail(peg$e8);
2285
2440
  }
2286
2441
  if (s1 !== peg$FAILED) {
2287
2442
  s2 = peg$parseSelectors();
@@ -2292,7 +2447,7 @@ function peg$parse(input, options) {
2292
2447
  if (peg$r7.test(s4)) peg$currPos++;
2293
2448
  else {
2294
2449
  s4 = peg$FAILED;
2295
- if (peg$silentFails === 0) peg$fail(peg$e16);
2450
+ if (peg$silentFails === 0) peg$fail(peg$e20);
2296
2451
  }
2297
2452
  peg$silentFails--;
2298
2453
  if (s4 !== peg$FAILED) {
@@ -2301,7 +2456,7 @@ function peg$parse(input, options) {
2301
2456
  } else s3 = peg$FAILED;
2302
2457
  if (s3 !== peg$FAILED) {
2303
2458
  peg$savedPos = s0;
2304
- s0 = peg$f58();
2459
+ s0 = peg$f59();
2305
2460
  } else {
2306
2461
  peg$currPos = s0;
2307
2462
  s0 = peg$FAILED;
@@ -2323,12 +2478,12 @@ function peg$parse(input, options) {
2323
2478
  s0 = peg$currPos;
2324
2479
  s1 = peg$parseHere();
2325
2480
  peg$savedPos = peg$currPos;
2326
- s2 = peg$f59(s1);
2481
+ s2 = peg$f60(s1);
2327
2482
  if (s2) s2 = void 0;
2328
2483
  else s2 = peg$FAILED;
2329
2484
  if (s2 !== peg$FAILED) {
2330
2485
  s3 = peg$currPos;
2331
- s4 = peg$f60(s1);
2486
+ s4 = peg$f61(s1);
2332
2487
  s5 = peg$currPos;
2333
2488
  s6 = [];
2334
2489
  if (s6.length >= (s4 | 0)) s7 = peg$FAILED;
@@ -2359,7 +2514,7 @@ function peg$parse(input, options) {
2359
2514
  else s3 = s4;
2360
2515
  if (s3 !== peg$FAILED) {
2361
2516
  peg$savedPos = s0;
2362
- s0 = peg$f61(s1, s3);
2517
+ s0 = peg$f62(s1, s3);
2363
2518
  } else {
2364
2519
  peg$currPos = s0;
2365
2520
  s0 = peg$FAILED;
@@ -2374,22 +2529,22 @@ function peg$parse(input, options) {
2374
2529
  let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
2375
2530
  s0 = peg$currPos;
2376
2531
  if (input.charCodeAt(peg$currPos) === 123) {
2377
- s1 = peg$c1;
2532
+ s1 = peg$c5;
2378
2533
  peg$currPos++;
2379
2534
  } else {
2380
2535
  s1 = peg$FAILED;
2381
- if (peg$silentFails === 0) peg$fail(peg$e4);
2536
+ if (peg$silentFails === 0) peg$fail(peg$e8);
2382
2537
  }
2383
2538
  if (s1 !== peg$FAILED) {
2384
2539
  s2 = peg$parseSelectors();
2385
2540
  if (s2 !== peg$FAILED) {
2386
2541
  s3 = peg$parseHere();
2387
2542
  if (input.charCodeAt(peg$currPos) === 47) {
2388
- s4 = peg$c8;
2543
+ s4 = peg$c12;
2389
2544
  peg$currPos++;
2390
2545
  } else {
2391
2546
  s4 = peg$FAILED;
2392
- if (peg$silentFails === 0) peg$fail(peg$e17);
2547
+ if (peg$silentFails === 0) peg$fail(peg$e21);
2393
2548
  }
2394
2549
  if (s4 === peg$FAILED) s4 = null;
2395
2550
  s5 = peg$parseMacroName();
@@ -2397,12 +2552,12 @@ function peg$parse(input, options) {
2397
2552
  s6 = peg$parseHere();
2398
2553
  s7 = peg$currPos;
2399
2554
  peg$savedPos = peg$currPos;
2400
- s8 = peg$f62(s2, s3, s4, s5, s6);
2555
+ s8 = peg$f63(s2, s3, s4, s5, s6);
2401
2556
  if (s8) s8 = void 0;
2402
2557
  else s8 = peg$FAILED;
2403
2558
  if (s8 !== peg$FAILED) {
2404
2559
  s9 = peg$currPos;
2405
- s10 = peg$f63(s2, s3, s4, s5, s6);
2560
+ s10 = peg$f64(s2, s3, s4, s5, s6);
2406
2561
  s11 = peg$currPos;
2407
2562
  s12 = [];
2408
2563
  if (s12.length >= (s10 | 0)) s13 = peg$FAILED;
@@ -2433,15 +2588,15 @@ function peg$parse(input, options) {
2433
2588
  else s9 = s10;
2434
2589
  if (s9 !== peg$FAILED) {
2435
2590
  if (input.charCodeAt(peg$currPos) === 125) {
2436
- s10 = peg$c7;
2591
+ s10 = peg$c11;
2437
2592
  peg$currPos++;
2438
2593
  } else {
2439
2594
  s10 = peg$FAILED;
2440
- if (peg$silentFails === 0) peg$fail(peg$e15);
2595
+ if (peg$silentFails === 0) peg$fail(peg$e19);
2441
2596
  }
2442
2597
  if (s10 !== peg$FAILED) {
2443
2598
  peg$savedPos = s7;
2444
- s7 = peg$f64(s2, s3, s4, s5, s6, s9);
2599
+ s7 = peg$f65(s2, s3, s4, s5, s6, s9);
2445
2600
  } else {
2446
2601
  peg$currPos = s7;
2447
2602
  s7 = peg$FAILED;
@@ -2456,7 +2611,7 @@ function peg$parse(input, options) {
2456
2611
  }
2457
2612
  if (s7 === peg$FAILED) s7 = null;
2458
2613
  peg$savedPos = s0;
2459
- s0 = peg$f65(s2, s3, s4, s5, s6, s7);
2614
+ s0 = peg$f66(s2, s3, s4, s5, s6, s7);
2460
2615
  } else {
2461
2616
  peg$currPos = s0;
2462
2617
  s0 = peg$FAILED;
@@ -2472,25 +2627,25 @@ function peg$parse(input, options) {
2472
2627
  if (s0 === peg$FAILED) {
2473
2628
  s0 = peg$currPos;
2474
2629
  if (input.charCodeAt(peg$currPos) === 123) {
2475
- s1 = peg$c1;
2630
+ s1 = peg$c5;
2476
2631
  peg$currPos++;
2477
2632
  } else {
2478
2633
  s1 = peg$FAILED;
2479
- if (peg$silentFails === 0) peg$fail(peg$e4);
2634
+ if (peg$silentFails === 0) peg$fail(peg$e8);
2480
2635
  }
2481
2636
  if (s1 !== peg$FAILED) {
2482
2637
  s2 = peg$parseSelectors();
2483
2638
  if (s2 !== peg$FAILED) {
2484
2639
  if (input.charCodeAt(peg$currPos) === 47) {
2485
- s3 = peg$c8;
2640
+ s3 = peg$c12;
2486
2641
  peg$currPos++;
2487
2642
  } else {
2488
2643
  s3 = peg$FAILED;
2489
- if (peg$silentFails === 0) peg$fail(peg$e17);
2644
+ if (peg$silentFails === 0) peg$fail(peg$e21);
2490
2645
  }
2491
2646
  if (s3 !== peg$FAILED) {
2492
2647
  peg$savedPos = s0;
2493
- s0 = peg$f66(s2);
2648
+ s0 = peg$f67(s2);
2494
2649
  } else {
2495
2650
  peg$currPos = s0;
2496
2651
  s0 = peg$FAILED;
@@ -2514,7 +2669,7 @@ function peg$parse(input, options) {
2514
2669
  if (peg$r8.test(s2)) peg$currPos++;
2515
2670
  else {
2516
2671
  s2 = peg$FAILED;
2517
- if (peg$silentFails === 0) peg$fail(peg$e18);
2672
+ if (peg$silentFails === 0) peg$fail(peg$e22);
2518
2673
  }
2519
2674
  if (s2 !== peg$FAILED) {
2520
2675
  s3 = [];
@@ -2522,7 +2677,7 @@ function peg$parse(input, options) {
2522
2677
  if (peg$r9.test(s4)) peg$currPos++;
2523
2678
  else {
2524
2679
  s4 = peg$FAILED;
2525
- if (peg$silentFails === 0) peg$fail(peg$e19);
2680
+ if (peg$silentFails === 0) peg$fail(peg$e23);
2526
2681
  }
2527
2682
  while (s4 !== peg$FAILED) {
2528
2683
  s3.push(s4);
@@ -2530,7 +2685,7 @@ function peg$parse(input, options) {
2530
2685
  if (peg$r9.test(s4)) peg$currPos++;
2531
2686
  else {
2532
2687
  s4 = peg$FAILED;
2533
- if (peg$silentFails === 0) peg$fail(peg$e19);
2688
+ if (peg$silentFails === 0) peg$fail(peg$e23);
2534
2689
  }
2535
2690
  }
2536
2691
  s2 = [s2, s3];
@@ -2547,19 +2702,19 @@ function peg$parse(input, options) {
2547
2702
  let s0, s1, s2, s3;
2548
2703
  s0 = peg$currPos;
2549
2704
  peg$savedPos = peg$currPos;
2550
- s1 = peg$f67();
2705
+ s1 = peg$f68();
2551
2706
  if (s1) s1 = void 0;
2552
2707
  else s1 = peg$FAILED;
2553
2708
  if (s1 !== peg$FAILED) {
2554
2709
  s2 = peg$parseHtmlClose();
2555
2710
  if (s2 !== peg$FAILED) {
2556
2711
  peg$savedPos = peg$currPos;
2557
- s3 = peg$f68(s2);
2712
+ s3 = peg$f69(s2);
2558
2713
  if (s3) s3 = void 0;
2559
2714
  else s3 = peg$FAILED;
2560
2715
  if (s3 !== peg$FAILED) {
2561
2716
  peg$savedPos = s0;
2562
- s0 = peg$f69(s2);
2717
+ s0 = peg$f70(s2);
2563
2718
  } else {
2564
2719
  peg$currPos = s0;
2565
2720
  s0 = peg$FAILED;
@@ -2578,11 +2733,11 @@ function peg$parse(input, options) {
2578
2733
  let s0, s1, s2, s3, s4, s5, s6;
2579
2734
  s0 = peg$currPos;
2580
2735
  if (input.charCodeAt(peg$currPos) === 60) {
2581
- s1 = peg$c2;
2736
+ s1 = peg$c6;
2582
2737
  peg$currPos++;
2583
2738
  } else {
2584
2739
  s1 = peg$FAILED;
2585
- if (peg$silentFails === 0) peg$fail(peg$e6);
2740
+ if (peg$silentFails === 0) peg$fail(peg$e10);
2586
2741
  }
2587
2742
  if (s1 !== peg$FAILED) {
2588
2743
  s2 = peg$parseTagName();
@@ -2595,23 +2750,23 @@ function peg$parse(input, options) {
2595
2750
  }
2596
2751
  s4 = peg$parse_();
2597
2752
  if (input.charCodeAt(peg$currPos) === 47) {
2598
- s5 = peg$c8;
2753
+ s5 = peg$c12;
2599
2754
  peg$currPos++;
2600
2755
  } else {
2601
2756
  s5 = peg$FAILED;
2602
- if (peg$silentFails === 0) peg$fail(peg$e17);
2757
+ if (peg$silentFails === 0) peg$fail(peg$e21);
2603
2758
  }
2604
2759
  if (s5 === peg$FAILED) s5 = null;
2605
2760
  if (input.charCodeAt(peg$currPos) === 62) {
2606
- s6 = peg$c9;
2761
+ s6 = peg$c1;
2607
2762
  peg$currPos++;
2608
2763
  } else {
2609
2764
  s6 = peg$FAILED;
2610
- if (peg$silentFails === 0) peg$fail(peg$e20);
2765
+ if (peg$silentFails === 0) peg$fail(peg$e3);
2611
2766
  }
2612
2767
  if (s6 !== peg$FAILED) {
2613
2768
  peg$savedPos = s0;
2614
- s0 = peg$f70(s2, s3, s5);
2769
+ s0 = peg$f71(s2, s3, s5);
2615
2770
  } else {
2616
2771
  peg$currPos = s0;
2617
2772
  s0 = peg$FAILED;
@@ -2627,11 +2782,11 @@ function peg$parse(input, options) {
2627
2782
  if (s0 === peg$FAILED) {
2628
2783
  s0 = peg$currPos;
2629
2784
  if (input.charCodeAt(peg$currPos) === 60) {
2630
- s1 = peg$c2;
2785
+ s1 = peg$c6;
2631
2786
  peg$currPos++;
2632
2787
  } else {
2633
2788
  s1 = peg$FAILED;
2634
- if (peg$silentFails === 0) peg$fail(peg$e6);
2789
+ if (peg$silentFails === 0) peg$fail(peg$e10);
2635
2790
  }
2636
2791
  if (s1 !== peg$FAILED) {
2637
2792
  s2 = peg$parseTagName();
@@ -2642,7 +2797,7 @@ function peg$parse(input, options) {
2642
2797
  if (peg$r10.test(s4)) peg$currPos++;
2643
2798
  else {
2644
2799
  s4 = peg$FAILED;
2645
- if (peg$silentFails === 0) peg$fail(peg$e21);
2800
+ if (peg$silentFails === 0) peg$fail(peg$e24);
2646
2801
  }
2647
2802
  if (s4 === peg$FAILED) {
2648
2803
  s4 = peg$currPos;
@@ -2676,7 +2831,7 @@ function peg$parse(input, options) {
2676
2831
  s5 = peg$parse_();
2677
2832
  s6 = peg$parseHere();
2678
2833
  peg$savedPos = s0;
2679
- s0 = peg$f71(s2, s6);
2834
+ s0 = peg$f72(s2, s6);
2680
2835
  } else {
2681
2836
  peg$currPos = s0;
2682
2837
  s0 = peg$FAILED;
@@ -2695,27 +2850,27 @@ function peg$parse(input, options) {
2695
2850
  function peg$parseHtmlClose() {
2696
2851
  let s0, s1, s2, s4;
2697
2852
  s0 = peg$currPos;
2698
- if (input.substr(peg$currPos, 2) === peg$c10) {
2699
- s1 = peg$c10;
2853
+ if (input.substr(peg$currPos, 2) === peg$c13) {
2854
+ s1 = peg$c13;
2700
2855
  peg$currPos += 2;
2701
2856
  } else {
2702
2857
  s1 = peg$FAILED;
2703
- if (peg$silentFails === 0) peg$fail(peg$e22);
2858
+ if (peg$silentFails === 0) peg$fail(peg$e25);
2704
2859
  }
2705
2860
  if (s1 !== peg$FAILED) {
2706
2861
  s2 = peg$parseTagName();
2707
2862
  if (s2 !== peg$FAILED) {
2708
2863
  peg$parse_();
2709
2864
  if (input.charCodeAt(peg$currPos) === 62) {
2710
- s4 = peg$c9;
2865
+ s4 = peg$c1;
2711
2866
  peg$currPos++;
2712
2867
  } else {
2713
2868
  s4 = peg$FAILED;
2714
- if (peg$silentFails === 0) peg$fail(peg$e20);
2869
+ if (peg$silentFails === 0) peg$fail(peg$e3);
2715
2870
  }
2716
2871
  if (s4 !== peg$FAILED) {
2717
2872
  peg$savedPos = s0;
2718
- s0 = peg$f72(s2);
2873
+ s0 = peg$f73(s2);
2719
2874
  } else {
2720
2875
  peg$currPos = s0;
2721
2876
  s0 = peg$FAILED;
@@ -2738,7 +2893,7 @@ function peg$parse(input, options) {
2738
2893
  if (peg$r8.test(s2)) peg$currPos++;
2739
2894
  else {
2740
2895
  s2 = peg$FAILED;
2741
- if (peg$silentFails === 0) peg$fail(peg$e18);
2896
+ if (peg$silentFails === 0) peg$fail(peg$e22);
2742
2897
  }
2743
2898
  if (s2 !== peg$FAILED) {
2744
2899
  s3 = [];
@@ -2746,7 +2901,7 @@ function peg$parse(input, options) {
2746
2901
  if (peg$r11.test(s4)) peg$currPos++;
2747
2902
  else {
2748
2903
  s4 = peg$FAILED;
2749
- if (peg$silentFails === 0) peg$fail(peg$e23);
2904
+ if (peg$silentFails === 0) peg$fail(peg$e26);
2750
2905
  }
2751
2906
  while (s4 !== peg$FAILED) {
2752
2907
  s3.push(s4);
@@ -2754,7 +2909,7 @@ function peg$parse(input, options) {
2754
2909
  if (peg$r11.test(s4)) peg$currPos++;
2755
2910
  else {
2756
2911
  s4 = peg$FAILED;
2757
- if (peg$silentFails === 0) peg$fail(peg$e23);
2912
+ if (peg$silentFails === 0) peg$fail(peg$e26);
2758
2913
  }
2759
2914
  }
2760
2915
  s2 = [s2, s3];
@@ -2780,7 +2935,7 @@ function peg$parse(input, options) {
2780
2935
  if (peg$r12.test(s6)) peg$currPos++;
2781
2936
  else {
2782
2937
  s6 = peg$FAILED;
2783
- if (peg$silentFails === 0) peg$fail(peg$e24);
2938
+ if (peg$silentFails === 0) peg$fail(peg$e27);
2784
2939
  }
2785
2940
  peg$silentFails--;
2786
2941
  if (s6 === peg$FAILED) s5 = void 0;
@@ -2816,7 +2971,7 @@ function peg$parse(input, options) {
2816
2971
  if (peg$r12.test(s6)) peg$currPos++;
2817
2972
  else {
2818
2973
  s6 = peg$FAILED;
2819
- if (peg$silentFails === 0) peg$fail(peg$e24);
2974
+ if (peg$silentFails === 0) peg$fail(peg$e27);
2820
2975
  }
2821
2976
  peg$silentFails--;
2822
2977
  if (s6 === peg$FAILED) s5 = void 0;
@@ -2849,25 +3004,25 @@ function peg$parse(input, options) {
2849
3004
  else s2 = s3;
2850
3005
  if (s2 !== peg$FAILED) {
2851
3006
  peg$savedPos = peg$currPos;
2852
- s3 = peg$f73(s2);
3007
+ s3 = peg$f74(s2);
2853
3008
  if (s3) s3 = void 0;
2854
3009
  else s3 = peg$FAILED;
2855
3010
  if (s3 !== peg$FAILED) {
2856
3011
  s4 = peg$currPos;
2857
3012
  s5 = peg$parse_();
2858
3013
  if (input.charCodeAt(peg$currPos) === 61) {
2859
- s6 = peg$c11;
3014
+ s6 = peg$c14;
2860
3015
  peg$currPos++;
2861
3016
  } else {
2862
3017
  s6 = peg$FAILED;
2863
- if (peg$silentFails === 0) peg$fail(peg$e25);
3018
+ if (peg$silentFails === 0) peg$fail(peg$e28);
2864
3019
  }
2865
3020
  if (s6 !== peg$FAILED) {
2866
3021
  peg$parse_();
2867
3022
  s8 = peg$parseAttrValue();
2868
3023
  if (s8 !== peg$FAILED) {
2869
3024
  peg$savedPos = s4;
2870
- s4 = peg$f74(s2, s8);
3025
+ s4 = peg$f75(s2, s8);
2871
3026
  } else {
2872
3027
  peg$currPos = s4;
2873
3028
  s4 = peg$FAILED;
@@ -2878,7 +3033,7 @@ function peg$parse(input, options) {
2878
3033
  }
2879
3034
  if (s4 === peg$FAILED) s4 = null;
2880
3035
  peg$savedPos = s0;
2881
- s0 = peg$f75(s2, s4);
3036
+ s0 = peg$f76(s2, s4);
2882
3037
  } else {
2883
3038
  peg$currPos = s0;
2884
3039
  s0 = peg$FAILED;
@@ -2893,11 +3048,11 @@ function peg$parse(input, options) {
2893
3048
  let s0, s1, s2, s3, s4;
2894
3049
  s0 = peg$currPos;
2895
3050
  if (input.charCodeAt(peg$currPos) === 34) {
2896
- s1 = peg$c12;
3051
+ s1 = peg$c15;
2897
3052
  peg$currPos++;
2898
3053
  } else {
2899
3054
  s1 = peg$FAILED;
2900
- if (peg$silentFails === 0) peg$fail(peg$e26);
3055
+ if (peg$silentFails === 0) peg$fail(peg$e29);
2901
3056
  }
2902
3057
  if (s1 !== peg$FAILED) {
2903
3058
  s2 = peg$currPos;
@@ -2908,7 +3063,7 @@ function peg$parse(input, options) {
2908
3063
  if (peg$r13.test(s4)) peg$currPos++;
2909
3064
  else {
2910
3065
  s4 = peg$FAILED;
2911
- if (peg$silentFails === 0) peg$fail(peg$e27);
3066
+ if (peg$silentFails === 0) peg$fail(peg$e30);
2912
3067
  }
2913
3068
  }
2914
3069
  while (s4 !== peg$FAILED) {
@@ -2919,21 +3074,21 @@ function peg$parse(input, options) {
2919
3074
  if (peg$r13.test(s4)) peg$currPos++;
2920
3075
  else {
2921
3076
  s4 = peg$FAILED;
2922
- if (peg$silentFails === 0) peg$fail(peg$e27);
3077
+ if (peg$silentFails === 0) peg$fail(peg$e30);
2923
3078
  }
2924
3079
  }
2925
3080
  }
2926
3081
  s2 = input.substring(s2, peg$currPos);
2927
3082
  if (input.charCodeAt(peg$currPos) === 34) {
2928
- s3 = peg$c12;
3083
+ s3 = peg$c15;
2929
3084
  peg$currPos++;
2930
3085
  } else {
2931
3086
  s3 = peg$FAILED;
2932
- if (peg$silentFails === 0) peg$fail(peg$e26);
3087
+ if (peg$silentFails === 0) peg$fail(peg$e29);
2933
3088
  }
2934
3089
  if (s3 !== peg$FAILED) {
2935
3090
  peg$savedPos = s0;
2936
- s0 = peg$f76(s2);
3091
+ s0 = peg$f77(s2);
2937
3092
  } else {
2938
3093
  peg$currPos = s0;
2939
3094
  s0 = peg$FAILED;
@@ -2945,11 +3100,11 @@ function peg$parse(input, options) {
2945
3100
  if (s0 === peg$FAILED) {
2946
3101
  s0 = peg$currPos;
2947
3102
  if (input.charCodeAt(peg$currPos) === 39) {
2948
- s1 = peg$c13;
3103
+ s1 = peg$c16;
2949
3104
  peg$currPos++;
2950
3105
  } else {
2951
3106
  s1 = peg$FAILED;
2952
- if (peg$silentFails === 0) peg$fail(peg$e28);
3107
+ if (peg$silentFails === 0) peg$fail(peg$e31);
2953
3108
  }
2954
3109
  if (s1 !== peg$FAILED) {
2955
3110
  s2 = peg$currPos;
@@ -2960,7 +3115,7 @@ function peg$parse(input, options) {
2960
3115
  if (peg$r14.test(s4)) peg$currPos++;
2961
3116
  else {
2962
3117
  s4 = peg$FAILED;
2963
- if (peg$silentFails === 0) peg$fail(peg$e29);
3118
+ if (peg$silentFails === 0) peg$fail(peg$e32);
2964
3119
  }
2965
3120
  }
2966
3121
  while (s4 !== peg$FAILED) {
@@ -2971,21 +3126,21 @@ function peg$parse(input, options) {
2971
3126
  if (peg$r14.test(s4)) peg$currPos++;
2972
3127
  else {
2973
3128
  s4 = peg$FAILED;
2974
- if (peg$silentFails === 0) peg$fail(peg$e29);
3129
+ if (peg$silentFails === 0) peg$fail(peg$e32);
2975
3130
  }
2976
3131
  }
2977
3132
  }
2978
3133
  s2 = input.substring(s2, peg$currPos);
2979
3134
  if (input.charCodeAt(peg$currPos) === 39) {
2980
- s3 = peg$c13;
3135
+ s3 = peg$c16;
2981
3136
  peg$currPos++;
2982
3137
  } else {
2983
3138
  s3 = peg$FAILED;
2984
- if (peg$silentFails === 0) peg$fail(peg$e28);
3139
+ if (peg$silentFails === 0) peg$fail(peg$e31);
2985
3140
  }
2986
3141
  if (s3 !== peg$FAILED) {
2987
3142
  peg$savedPos = s0;
2988
- s0 = peg$f77(s2);
3143
+ s0 = peg$f78(s2);
2989
3144
  } else {
2990
3145
  peg$currPos = s0;
2991
3146
  s0 = peg$FAILED;
@@ -3000,11 +3155,11 @@ function peg$parse(input, options) {
3000
3155
  if (peg$r15.test(s1)) peg$currPos++;
3001
3156
  else {
3002
3157
  s1 = peg$FAILED;
3003
- if (peg$silentFails === 0) peg$fail(peg$e30);
3158
+ if (peg$silentFails === 0) peg$fail(peg$e33);
3004
3159
  }
3005
3160
  if (s1 !== peg$FAILED) {
3006
3161
  peg$savedPos = s0;
3007
- s1 = peg$f78(s1);
3162
+ s1 = peg$f79(s1);
3008
3163
  }
3009
3164
  s0 = s1;
3010
3165
  if (s0 === peg$FAILED) {
@@ -3014,7 +3169,7 @@ function peg$parse(input, options) {
3014
3169
  if (peg$r16.test(s2)) peg$currPos++;
3015
3170
  else {
3016
3171
  s2 = peg$FAILED;
3017
- if (peg$silentFails === 0) peg$fail(peg$e31);
3172
+ if (peg$silentFails === 0) peg$fail(peg$e34);
3018
3173
  }
3019
3174
  while (s2 !== peg$FAILED) {
3020
3175
  s1.push(s2);
@@ -3022,7 +3177,7 @@ function peg$parse(input, options) {
3022
3177
  if (peg$r16.test(s2)) peg$currPos++;
3023
3178
  else {
3024
3179
  s2 = peg$FAILED;
3025
- if (peg$silentFails === 0) peg$fail(peg$e31);
3180
+ if (peg$silentFails === 0) peg$fail(peg$e34);
3026
3181
  }
3027
3182
  }
3028
3183
  s0 = input.substring(s0, peg$currPos);
@@ -3035,27 +3190,27 @@ function peg$parse(input, options) {
3035
3190
  let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
3036
3191
  s0 = peg$currPos;
3037
3192
  peg$savedPos = peg$currPos;
3038
- s1 = peg$f79();
3193
+ s1 = peg$f80();
3039
3194
  if (s1) s1 = void 0;
3040
3195
  else s1 = peg$FAILED;
3041
3196
  if (s1 !== peg$FAILED) {
3042
3197
  s2 = peg$currPos;
3043
3198
  s3 = [];
3044
3199
  if (input.charCodeAt(peg$currPos) === 92) {
3045
- s4 = peg$c0;
3200
+ s4 = peg$c4;
3046
3201
  peg$currPos++;
3047
3202
  } else {
3048
3203
  s4 = peg$FAILED;
3049
- if (peg$silentFails === 0) peg$fail(peg$e2);
3204
+ if (peg$silentFails === 0) peg$fail(peg$e6);
3050
3205
  }
3051
3206
  if (s4 !== peg$FAILED) while (s4 !== peg$FAILED) {
3052
3207
  s3.push(s4);
3053
3208
  if (input.charCodeAt(peg$currPos) === 92) {
3054
- s4 = peg$c0;
3209
+ s4 = peg$c4;
3055
3210
  peg$currPos++;
3056
3211
  } else {
3057
3212
  s4 = peg$FAILED;
3058
- if (peg$silentFails === 0) peg$fail(peg$e2);
3213
+ if (peg$silentFails === 0) peg$fail(peg$e6);
3059
3214
  }
3060
3215
  }
3061
3216
  else s3 = peg$FAILED;
@@ -3064,7 +3219,7 @@ function peg$parse(input, options) {
3064
3219
  if (s2 !== peg$FAILED) {
3065
3220
  s3 = peg$currPos;
3066
3221
  peg$savedPos = peg$currPos;
3067
- s4 = peg$f80(s2);
3222
+ s4 = peg$f81(s2);
3068
3223
  if (s4) s4 = void 0;
3069
3224
  else s4 = peg$FAILED;
3070
3225
  if (s4 !== peg$FAILED) {
@@ -3072,7 +3227,7 @@ function peg$parse(input, options) {
3072
3227
  if (peg$r1.test(s5)) peg$currPos++;
3073
3228
  else {
3074
3229
  s5 = peg$FAILED;
3075
- if (peg$silentFails === 0) peg$fail(peg$e3);
3230
+ if (peg$silentFails === 0) peg$fail(peg$e7);
3076
3231
  }
3077
3232
  if (s5 !== peg$FAILED) {
3078
3233
  s4 = [s4, s5];
@@ -3103,39 +3258,39 @@ function peg$parse(input, options) {
3103
3258
  if (s0 === peg$FAILED) {
3104
3259
  s0 = peg$currPos;
3105
3260
  peg$savedPos = peg$currPos;
3106
- s1 = peg$f81();
3261
+ s1 = peg$f82();
3107
3262
  if (s1) s1 = void 0;
3108
3263
  else s1 = peg$FAILED;
3109
3264
  if (s1 !== peg$FAILED) {
3110
3265
  if (input.charCodeAt(peg$currPos) === 123) {
3111
- s2 = peg$c1;
3266
+ s2 = peg$c5;
3112
3267
  peg$currPos++;
3113
3268
  } else {
3114
3269
  s2 = peg$FAILED;
3115
- if (peg$silentFails === 0) peg$fail(peg$e4);
3270
+ if (peg$silentFails === 0) peg$fail(peg$e8);
3116
3271
  }
3117
3272
  if (s2 !== peg$FAILED) {
3118
3273
  s3 = peg$parseSelectors();
3119
3274
  if (s3 !== peg$FAILED) {
3120
3275
  s4 = peg$parseHere();
3121
3276
  if (input.charCodeAt(peg$currPos) === 47) {
3122
- s5 = peg$c8;
3277
+ s5 = peg$c12;
3123
3278
  peg$currPos++;
3124
3279
  } else {
3125
3280
  s5 = peg$FAILED;
3126
- if (peg$silentFails === 0) peg$fail(peg$e17);
3281
+ if (peg$silentFails === 0) peg$fail(peg$e21);
3127
3282
  }
3128
3283
  if (s5 === peg$FAILED) s5 = null;
3129
3284
  s6 = peg$parseMacroName();
3130
3285
  if (s6 !== peg$FAILED) {
3131
3286
  s7 = peg$parseHere();
3132
3287
  peg$savedPos = peg$currPos;
3133
- s8 = peg$f82(s4, s7);
3288
+ s8 = peg$f83(s4, s7);
3134
3289
  if (s8) s8 = void 0;
3135
3290
  else s8 = peg$FAILED;
3136
3291
  if (s8 !== peg$FAILED) {
3137
3292
  s9 = peg$currPos;
3138
- s10 = peg$f83(s4, s7);
3293
+ s10 = peg$f84(s4, s7);
3139
3294
  s11 = peg$currPos;
3140
3295
  s12 = [];
3141
3296
  if (s12.length >= (s10 | 0)) s13 = peg$FAILED;
@@ -3166,11 +3321,11 @@ function peg$parse(input, options) {
3166
3321
  else s9 = s10;
3167
3322
  if (s9 !== peg$FAILED) {
3168
3323
  if (input.charCodeAt(peg$currPos) === 125) {
3169
- s10 = peg$c7;
3324
+ s10 = peg$c11;
3170
3325
  peg$currPos++;
3171
3326
  } else {
3172
3327
  s10 = peg$FAILED;
3173
- if (peg$silentFails === 0) peg$fail(peg$e15);
3328
+ if (peg$silentFails === 0) peg$fail(peg$e19);
3174
3329
  }
3175
3330
  if (s10 !== peg$FAILED) {
3176
3331
  s1 = [
@@ -3217,16 +3372,16 @@ function peg$parse(input, options) {
3217
3372
  if (s0 === peg$FAILED) {
3218
3373
  s0 = peg$currPos;
3219
3374
  peg$savedPos = peg$currPos;
3220
- s1 = peg$f84();
3375
+ s1 = peg$f85();
3221
3376
  if (s1) s1 = void 0;
3222
3377
  else s1 = peg$FAILED;
3223
3378
  if (s1 !== peg$FAILED) {
3224
3379
  if (input.charCodeAt(peg$currPos) === 123) {
3225
- s2 = peg$c1;
3380
+ s2 = peg$c5;
3226
3381
  peg$currPos++;
3227
3382
  } else {
3228
3383
  s2 = peg$FAILED;
3229
- if (peg$silentFails === 0) peg$fail(peg$e4);
3384
+ if (peg$silentFails === 0) peg$fail(peg$e8);
3230
3385
  }
3231
3386
  if (s2 !== peg$FAILED) {
3232
3387
  s3 = peg$parseSelectors();
@@ -3235,18 +3390,18 @@ function peg$parse(input, options) {
3235
3390
  peg$silentFails++;
3236
3391
  s5 = peg$currPos;
3237
3392
  if (input.charCodeAt(peg$currPos) === 47) {
3238
- s6 = peg$c8;
3393
+ s6 = peg$c12;
3239
3394
  peg$currPos++;
3240
3395
  } else {
3241
3396
  s6 = peg$FAILED;
3242
- if (peg$silentFails === 0) peg$fail(peg$e17);
3397
+ if (peg$silentFails === 0) peg$fail(peg$e21);
3243
3398
  }
3244
3399
  if (s6 === peg$FAILED) s6 = null;
3245
3400
  s7 = input.charAt(peg$currPos);
3246
3401
  if (peg$r8.test(s7)) peg$currPos++;
3247
3402
  else {
3248
3403
  s7 = peg$FAILED;
3249
- if (peg$silentFails === 0) peg$fail(peg$e18);
3404
+ if (peg$silentFails === 0) peg$fail(peg$e22);
3250
3405
  }
3251
3406
  if (s7 !== peg$FAILED) {
3252
3407
  s6 = [s6, s7];
@@ -3265,11 +3420,11 @@ function peg$parse(input, options) {
3265
3420
  s5 = peg$parseCodeToBrace();
3266
3421
  if (s5 !== peg$FAILED) {
3267
3422
  if (input.charCodeAt(peg$currPos) === 125) {
3268
- s6 = peg$c7;
3423
+ s6 = peg$c11;
3269
3424
  peg$currPos++;
3270
3425
  } else {
3271
3426
  s6 = peg$FAILED;
3272
- if (peg$silentFails === 0) peg$fail(peg$e15);
3427
+ if (peg$silentFails === 0) peg$fail(peg$e19);
3273
3428
  }
3274
3429
  if (s6 !== peg$FAILED) {
3275
3430
  s1 = [
@@ -3308,16 +3463,16 @@ function peg$parse(input, options) {
3308
3463
  if (s0 === peg$FAILED) {
3309
3464
  s0 = peg$currPos;
3310
3465
  peg$savedPos = peg$currPos;
3311
- s1 = peg$f85();
3466
+ s1 = peg$f86();
3312
3467
  if (s1) s1 = void 0;
3313
3468
  else s1 = peg$FAILED;
3314
3469
  if (s1 !== peg$FAILED) {
3315
3470
  if (input.charCodeAt(peg$currPos) === 123) {
3316
- s2 = peg$c1;
3471
+ s2 = peg$c5;
3317
3472
  peg$currPos++;
3318
3473
  } else {
3319
3474
  s2 = peg$FAILED;
3320
- if (peg$silentFails === 0) peg$fail(peg$e4);
3475
+ if (peg$silentFails === 0) peg$fail(peg$e8);
3321
3476
  }
3322
3477
  if (s2 !== peg$FAILED) {
3323
3478
  s3 = peg$currPos;
@@ -3326,7 +3481,7 @@ function peg$parse(input, options) {
3326
3481
  if (peg$r5.test(s4)) peg$currPos++;
3327
3482
  else {
3328
3483
  s4 = peg$FAILED;
3329
- if (peg$silentFails === 0) peg$fail(peg$e13);
3484
+ if (peg$silentFails === 0) peg$fail(peg$e17);
3330
3485
  }
3331
3486
  peg$silentFails--;
3332
3487
  if (s4 !== peg$FAILED) {
@@ -3337,11 +3492,11 @@ function peg$parse(input, options) {
3337
3492
  s4 = peg$parseCodeToBrace();
3338
3493
  if (s4 !== peg$FAILED) {
3339
3494
  if (input.charCodeAt(peg$currPos) === 125) {
3340
- s5 = peg$c7;
3495
+ s5 = peg$c11;
3341
3496
  peg$currPos++;
3342
3497
  } else {
3343
3498
  s5 = peg$FAILED;
3344
- if (peg$silentFails === 0) peg$fail(peg$e15);
3499
+ if (peg$silentFails === 0) peg$fail(peg$e19);
3345
3500
  }
3346
3501
  if (s5 !== peg$FAILED) {
3347
3502
  s1 = [
@@ -3393,7 +3548,7 @@ function peg$parse(input, options) {
3393
3548
  if (peg$r17.test(s0)) peg$currPos++;
3394
3549
  else {
3395
3550
  s0 = peg$FAILED;
3396
- if (peg$silentFails === 0) peg$fail(peg$e32);
3551
+ if (peg$silentFails === 0) peg$fail(peg$e35);
3397
3552
  }
3398
3553
  return s0;
3399
3554
  }
@@ -8775,7 +8930,7 @@ var OPERAND_ENDS = new Set([
8775
8930
  * whether a `{` opens a block or an object literal, which decides whether a
8776
8931
  * `/` after its `}` opens a regex and a `%` a transient: after the `:` of a
8777
8932
  * conditional it opens an object literal (`a ? b : {} / 2`), not a block as
8778
- * after a label; after a block's `}` it opens another block (`{}{} %n = 1`),
8933
+ * after a label, and a `function` or `class` there is an expression; after a block's `}` it opens another block (`{}{} %n = 1`),
8779
8934
  * and so it does on a new line after a statement (`p⏎{} %n = 1`).
8780
8935
  */
8781
8936
  var SigilParser = class extends Parser {
@@ -8788,6 +8943,7 @@ var SigilParser = class extends Parser {
8788
8943
  this.ternaries = [];
8789
8944
  this.colonEndsTernary = false;
8790
8945
  this.closedBlock = false;
8946
+ this.typeBeforeLast = types$1.eof;
8791
8947
  this.lookahead = true;
8792
8948
  }
8793
8949
  readToken(code) {
@@ -8832,6 +8988,11 @@ var SigilParser = class extends Parser {
8832
8988
  const prevType = self.type;
8833
8989
  this.prevValue = self.value;
8834
8990
  const property = type.keyword !== void 0 && (prevType === types$1.dot || prevType === types$1.questionDot) || (type === types$1._function || type === types$1._class) && notABody(self.input, self.pos);
8991
+ if (!property && (type === types$1._function || type === types$1._class)) {
8992
+ const before = type === types$1._function && prevType === types$1.name && this.prevValue === "async" && !this.breakHere ? this.typeBeforeLast : prevType;
8993
+ self.type = before === types$1.colon && this.colonEndsTernary ? types$1.parenL : before;
8994
+ }
8995
+ this.typeBeforeLast = prevType;
8835
8996
  super.finishToken(property ? types$1.name : type, value);
8836
8997
  if (type === types$1.name && value === "of" && (prevType === types$1._const || prevType === types$1._var || this.prevValue === "let")) self.exprAllowed = false;
8837
8998
  }
@@ -9735,13 +9896,24 @@ function tokenizeMarkup(source, options = {}) {
9735
9896
  //#endregion
9736
9897
  //#region src/hooks/use-story-fields.ts
9737
9898
  /**
9899
+ * Tells the components below when to keep the state they last rendered with,
9900
+ * given the store's current state: an owner (a click body, see
9901
+ * useDetachedBody; a passage on its way out, see PassageDisplay) provides it
9902
+ * so that a branch skipped earlier cannot run against later state (#351,
9903
+ * #352). It runs inside the store's own notification, before the owner could
9904
+ * re-render, which is why it is a predicate and not a flag.
9905
+ */
9906
+ var FrozenStateContext = createContext(null);
9907
+ /**
9738
9908
  * Story state fields `keys`, re-rendering when any of them changes (as one
9739
9909
  * useStoryStore() selector per field would). The result keeps its identity
9740
9910
  * while the fields don't change, as the store's snapshot must.
9741
9911
  */
9742
9912
  function useStoryFields(...keys) {
9743
9913
  const prev = useRef();
9914
+ const freeze = useContext(FrozenStateContext);
9744
9915
  return useStoryStore((s) => {
9916
+ if (prev.current && freeze?.(s)) return prev.current;
9745
9917
  const next = {};
9746
9918
  for (const key of keys) next[key] = s[key];
9747
9919
  return shallow(prev.current, next) ? prev.current : prev.current = next;
@@ -9754,7 +9926,7 @@ function useStoryFields(...keys) {
9754
9926
  * All four dicts use unprefixed keys suitable for evaluate/execute.
9755
9927
  */
9756
9928
  function useMergedLocals() {
9757
- const { variables, temporary, transient } = useStoryFields("variables", "temporary", "transient");
9929
+ const { variables, temporary, transient, renderCounts } = useStoryFields("variables", "temporary", "transient", "renderCounts");
9758
9930
  const localsValues = useContext(LocalsValuesContext);
9759
9931
  return useMemo(() => {
9760
9932
  return [
@@ -9767,7 +9939,8 @@ function useMergedLocals() {
9767
9939
  variables,
9768
9940
  temporary,
9769
9941
  localsValues,
9770
- transient
9942
+ transient,
9943
+ renderCounts
9771
9944
  ]);
9772
9945
  }
9773
9946
  //#endregion
@@ -10887,7 +11060,11 @@ function LocalsScope({ body, parentValues, ownKeys }) {
10887
11060
  }
10888
11061
  //#endregion
10889
11062
  //#region src/components/macros/WidgetInvocation.tsx
10890
- function WidgetInvocation({ body, params, rawArgs, invocationChildren }) {
11063
+ function WidgetInvocation(props) {
11064
+ const resolve = useInterpolate();
11065
+ return wrapContent(resolve(props.className), resolve(props.id), /* @__PURE__ */ jsx(WidgetContent, { ...props }));
11066
+ }
11067
+ function WidgetContent({ body, params, rawArgs, invocationChildren }) {
10891
11068
  const renderOptions = useRenderOptions();
10892
11069
  const parentValues = renderOptions.locals;
10893
11070
  const [mergedVars, mergedTemps, mergedLocals, mergedTrans] = useMergedLocals();
@@ -11518,20 +11695,33 @@ function useDirectAttributes(direct) {
11518
11695
  }, [JSON.stringify(direct)]);
11519
11696
  return direct.length > 0 ? elementRef : void 0;
11520
11697
  }
11698
+ var decodedText = /* @__PURE__ */ new Map();
11521
11699
  var decodedAttributeText = /* @__PURE__ */ new Map();
11522
11700
  /**
11523
- * Decode character references (`&amp;`, `&#123;`) in attribute text the way
11524
- * the HTML parser decodes an attribute value, by letting it parse one.
11701
+ * Decode character references (`&amp;`, `&#123;`) in `text` the way the HTML
11702
+ * parser decodes them, by letting it parse them: in an attribute value, or
11703
+ * else in element text.
11525
11704
  */
11526
- function decodeAttributeText(text) {
11705
+ function decodeReferences(text, cache, parse) {
11527
11706
  if (!text.includes("&")) return text;
11528
- let decoded = decodedAttributeText.get(text);
11707
+ let decoded = cache.get(text);
11529
11708
  if (decoded === void 0) {
11530
- decoded = parseHtmlInert(`<i title="${text.replace(/"/g, "&quot;")}"></i>`).firstChild.getAttribute("title") ?? text;
11531
- decodedAttributeText.set(text, decoded);
11709
+ decoded = parse(text) ?? text;
11710
+ cache.set(text, decoded);
11532
11711
  }
11533
11712
  return decoded;
11534
11713
  }
11714
+ function decodeAttributeText(text) {
11715
+ return decodeReferences(text, decodedAttributeText, (t) => {
11716
+ return parseHtmlInert(`<i title="${t.replace(/"/g, "&quot;")}"></i>`).firstChild.getAttribute("title");
11717
+ });
11718
+ }
11719
+ /** Literal text outside markdown (preformatted and SVG elements). */
11720
+ function decodeText(text) {
11721
+ return decodeReferences(text, decodedText, (t) => {
11722
+ return parseHtmlInert(`<i>${t.replace(/</g, "&lt;")}</i>`).firstChild.textContent;
11723
+ });
11724
+ }
11535
11725
  /** A `{` and a sigil starting a reference, in a code attribute. */
11536
11726
  var SIGIL_REFERENCE = /\{[$_@%]\w/;
11537
11727
  var attributeNodes = /* @__PURE__ */ new Map();
@@ -11643,18 +11833,21 @@ function nodeKey(node) {
11643
11833
  }
11644
11834
  function renderMacro(node, key) {
11645
11835
  if (isSubMacro(node.name)) return null;
11836
+ const invocation = {
11837
+ rawArgs: node.rawArgs,
11838
+ className: node.className,
11839
+ id: node.id
11840
+ };
11646
11841
  const widget = getWidget(node.name);
11647
11842
  if (widget) return /* @__PURE__ */ jsx(WidgetInvocation, {
11843
+ ...invocation,
11648
11844
  body: widget.body,
11649
11845
  params: widget.params,
11650
- rawArgs: node.rawArgs,
11651
11846
  invocationChildren: node.children
11652
11847
  }, key);
11653
11848
  const Component = getMacro(node.name);
11654
11849
  if (Component) return /* @__PURE__ */ jsx(Component, {
11655
- rawArgs: node.rawArgs,
11656
- className: node.className,
11657
- id: node.id,
11850
+ ...invocation,
11658
11851
  children: node.children,
11659
11852
  branches: node.branches
11660
11853
  }, key);
@@ -11667,7 +11860,7 @@ function renderMacro(node, key) {
11667
11860
  * Render a non-text AST node to a Preact element.
11668
11861
  */
11669
11862
  function renderSingleNode(node) {
11670
- if (node.type === "text") return node.value;
11863
+ if (node.type === "text") return decodeText(node.value);
11671
11864
  const key = nodeKey(node);
11672
11865
  switch (node.type) {
11673
11866
  case "variable":
@@ -14177,6 +14370,7 @@ async function startNewPlaythroughNow(ifid, id = randomUUID()) {
14177
14370
  await backend.setMeta(playthroughCountKey(ifid), num);
14178
14371
  });
14179
14372
  await backend.setMeta(currentPlaythroughKey(ifid), id);
14373
+ saveSessionPlaythrough(ifid, id);
14180
14374
  return id;
14181
14375
  }
14182
14376
  var PLAYTHROUGH_LABEL = /^Playthrough (\d+)$/;
@@ -14216,6 +14410,7 @@ async function adoptPlaythroughNow(ifid, id) {
14216
14410
  await ensurePlaythrough(ifid, id, (/* @__PURE__ */ new Date()).toISOString());
14217
14411
  const key = currentPlaythroughKey(ifid);
14218
14412
  if (await backend.getMeta(key) !== id) await backend.setMeta(key, id);
14413
+ saveSessionPlaythrough(ifid, id);
14219
14414
  }
14220
14415
  /**
14221
14416
  * Record the playthrough `id` of the story as "Imported", created at
@@ -14238,8 +14433,12 @@ async function ensurePlaythrough(ifid, id, createdAt) {
14238
14433
  */
14239
14434
  function establishPlaythrough(ifid) {
14240
14435
  return inOrder(async () => {
14436
+ const backend = await getBackend();
14437
+ const own = loadSessionPlaythrough(ifid);
14438
+ const id = own !== void 0 && (await backend.getPlaythroughsByIfid(ifid)).some((p) => p.id === own) ? own : await backend.getMeta(currentPlaythroughKey(ifid)) ?? await startNewPlaythroughNow(ifid);
14439
+ saveSessionPlaythrough(ifid, id);
14241
14440
  return {
14242
- id: await (await getBackend()).getMeta(currentPlaythroughKey(ifid)) ?? await startNewPlaythroughNow(ifid),
14441
+ id,
14243
14442
  knownSaves: await populateKnownSavesNow(ifid)
14244
14443
  };
14245
14444
  });
@@ -14542,12 +14741,16 @@ readingSlot(livePayload);
14542
14741
  * (see adoptPlaythrough) in the same operation: operations issued after the
14543
14742
  * load take effect in the loaded playthrough. Resolves to the live payload
14544
14743
  * and its playthrough, or undefined if the slot is empty.
14744
+ *
14745
+ * `check` is run on the payload first: when it throws, the load rejects and
14746
+ * the game stays in its playthrough (#357).
14545
14747
  */
14546
- function loadSlotSave(ifid, slot) {
14748
+ function loadSlotSave(ifid, slot, check) {
14547
14749
  return inOrder(async () => {
14548
14750
  const record = await slotRecord(ifid, slot);
14549
14751
  if (!record) return void 0;
14550
14752
  const payload = decodePayload(record.payload);
14753
+ check?.(payload);
14551
14754
  const { playthroughId } = record.meta;
14552
14755
  if (playthroughId) await adoptPlaythroughNow(ifid, playthroughId);
14553
14756
  return {
@@ -14637,6 +14840,26 @@ function clearSession(ifid) {
14637
14840
  sessionStorage.removeItem(`${SESSION_KEY_PREFIX}${ifid}`);
14638
14841
  } catch {}
14639
14842
  }
14843
+ /**
14844
+ * The playthrough this tab's game is in, kept with its session: the shared
14845
+ * current playthrough (a stored meta value) can be changed by another tab.
14846
+ * Written where this tab's storage operations set the current playthrough,
14847
+ * so it follows them in call order. Under the session prefix, so clearing
14848
+ * all data clears it.
14849
+ */
14850
+ var SESSION_PLAYTHROUGH_PREFIX = `${SESSION_KEY_PREFIX}playthrough.`;
14851
+ function saveSessionPlaythrough(ifid, id) {
14852
+ try {
14853
+ sessionStorage.setItem(`${SESSION_PLAYTHROUGH_PREFIX}${ifid}`, id);
14854
+ } catch {}
14855
+ }
14856
+ function loadSessionPlaythrough(ifid) {
14857
+ try {
14858
+ return sessionStorage.getItem(`${SESSION_PLAYTHROUGH_PREFIX}${ifid}`) || void 0;
14859
+ } catch {
14860
+ return;
14861
+ }
14862
+ }
14640
14863
  /** The export of a stored save, if there is one. */
14641
14864
  function toExport(record) {
14642
14865
  if (!record) return void 0;
@@ -15398,7 +15621,7 @@ function checkTriggersOnNavigation() {
15398
15621
  }
15399
15622
  /**
15400
15623
  * Re-evaluate watchers whenever a namespace their conditions can read
15401
- * ($variables, _temporary, %transient) changes. Navigation is left to the
15624
+ * ($variables, _temporary, %transient) or the render counts change. Navigation is left to the
15402
15625
  * store: navigate() checks watchers once the new moment is complete
15403
15626
  * (checkTriggersOnNavigation), while history traversal and loads
15404
15627
  * reinitialize watcher state instead of firing.
@@ -15410,7 +15633,7 @@ function connectTriggersToStore() {
15410
15633
  const before = prev;
15411
15634
  prev = state;
15412
15635
  if (state.navigationId !== before.navigationId) return;
15413
- if (state.variables === before.variables && state.temporary === before.temporary && state.transient === before.transient) return;
15636
+ if (state.variables === before.variables && state.temporary === before.temporary && state.transient === before.transient && state.renderCounts === before.renderCounts) return;
15414
15637
  checkTriggers();
15415
15638
  });
15416
15639
  let connected = true;
@@ -16078,6 +16301,11 @@ function missingPassage(storyData, payload) {
16078
16301
  if (!storyData) return void 0;
16079
16302
  return [payload.passage, ...payload.history.map((m) => m.passage)].find((name) => !storyData.passages.has(name));
16080
16303
  }
16304
+ /** Throw if `payload` refers to a passage `storyData` does not have. */
16305
+ function assertPassagesExist(storyData, payload) {
16306
+ const missing = missingPassage(storyData, payload);
16307
+ if (missing !== void 0) throw new Error(`The save refers to the passage "${missing}", which this version of the story does not have`);
16308
+ }
16081
16309
  var NAMESPACE_KEYS = [
16082
16310
  "variables",
16083
16311
  "temporary",
@@ -16420,7 +16648,7 @@ var useStoryStore = create()(storyStore((set, get) => ({
16420
16648
  state.loadError = null;
16421
16649
  });
16422
16650
  const previous = resolvePlaythroughId();
16423
- const read = loadSlotSave(storyData.ifid, slot);
16651
+ const read = loadSlotSave(storyData.ifid, slot, (payload) => assertPassagesExist(storyData, payload));
16424
16652
  const switched = switchToLookedUpPlaythrough(Promise.all([previous, read.catch(() => void 0)]).then(([prev, loaded]) => loaded?.playthroughId || prev));
16425
16653
  const replacement = ++stateReplacementsIssued;
16426
16654
  return reported(read.then(async (loaded) => {
@@ -16525,8 +16753,7 @@ var useStoryStore = create()(storyStore((set, get) => ({
16525
16753
  console.warn("loadFromPayload: rejecting payload with empty history");
16526
16754
  return;
16527
16755
  }
16528
- const missing = missingPassage(get().storyData, payload);
16529
- if (missing !== void 0) throw new Error(`The save refers to the passage "${missing}", which this version of the story does not have`);
16756
+ assertPassagesExist(get().storyData, payload);
16530
16757
  latestStateApplied = replacement;
16531
16758
  emit("beforeload", slot);
16532
16759
  const ifid = get().storyData?.ifid;
@@ -16637,7 +16864,7 @@ function isRendered(el) {
16637
16864
  return true;
16638
16865
  }
16639
16866
  function focusables(root) {
16640
- return Array.from(root.querySelectorAll(FOCUSABLE)).filter((el) => !el.hidden && !el.closest("[hidden], [inert]") && isRendered(el));
16867
+ return Array.from(root.querySelectorAll(FOCUSABLE)).filter((el) => !el.hidden && !el.closest("[hidden], [inert]") && !el.matches(":disabled") && isRendered(el));
16641
16868
  }
16642
16869
  /** Open modal dialogs, innermost last. Only the topmost handles keys. */
16643
16870
  var openModals = [];
@@ -19105,6 +19332,13 @@ function selectBranch(branches, matches) {
19105
19332
  else if (matches(branch.rawArgs)) return branch;
19106
19333
  return fallback;
19107
19334
  }
19335
+ /**
19336
+ * A selected branch's content, in a wrapper if the branch has CSS selectors
19337
+ * (`{.hot#id case 1}`). The macro must be defined with `interpolate`.
19338
+ */
19339
+ function renderBranch(branch, ctx) {
19340
+ return wrapContent(ctx.resolve(branch.className), ctx.resolve(branch.id), ctx.renderNodes(branch.children));
19341
+ }
19108
19342
  //#endregion
19109
19343
  //#region src/components/macros/If.tsx
19110
19344
  /**
@@ -19132,7 +19366,7 @@ defineMacro({
19132
19366
  });
19133
19367
  }
19134
19368
  if (!branch) return null;
19135
- return wrapContent(ctx.resolve(branch.className), ctx.resolve(branch.id), ctx.renderNodes(branch.children));
19369
+ return renderBranch(branch, ctx);
19136
19370
  },
19137
19371
  text({ branches = [] }, ctx) {
19138
19372
  const branch = selectIfBranch(branches, ctx.evaluate);
@@ -19354,11 +19588,13 @@ defineMacro({
19354
19588
  });
19355
19589
  //#endregion
19356
19590
  //#region src/components/macros/detached-body.tsx
19591
+ var frozenAlways = () => true;
19357
19592
  /**
19358
19593
  * Return a function that runs a macro body once, outside the passage tree:
19359
19594
  * it renders `children` into a detached node, so the body's macros ({set},
19360
19595
  * {if}, {goto}, ...) fire their side effects through the normal Preact
19361
- * pipeline. Used by {button} and {link} on click. The body stays mounted
19596
+ * pipeline. Used by {button} and {link} on click. The body's state is frozen
19597
+ * once it has rendered, so it runs once per click. It stays mounted
19362
19598
  * until the owning macro unmounts (its passage changes, say), so work it
19363
19599
  * starts in an effect, such as the timer of a {timed} or {repeat}, can
19364
19600
  * finish; the passage leaving cancels it.
@@ -19389,24 +19625,27 @@ function useDetachedBody() {
19389
19625
  const run = (children) => {
19390
19626
  const locals = liveLocalsView(updater.getValues);
19391
19627
  const container = document.createElement("div");
19392
- render(/* @__PURE__ */ jsx(LocalsUpdateContext.Provider, {
19393
- value: updater,
19394
- children: /* @__PURE__ */ jsx(LocalsValuesContext.Provider, {
19395
- value: locals,
19396
- children: /* @__PURE__ */ jsx(NobrContext.Provider, {
19397
- value: nobr,
19398
- children: /* @__PURE__ */ jsx(InlineContext.Provider, {
19399
- value: inline,
19400
- children: /* @__PURE__ */ jsx(WidgetChildrenContext.Provider, {
19401
- value: widgetChildren,
19402
- children: /* @__PURE__ */ jsx(RepeatContext.Provider, {
19403
- value: repeat,
19404
- children: /* @__PURE__ */ jsx(DialogCloseContext.Provider, {
19405
- value: closeDialog,
19406
- children: renderNodes(children, {
19407
- nobr,
19408
- inline,
19409
- locals
19628
+ render(/* @__PURE__ */ jsx(FrozenStateContext.Provider, {
19629
+ value: frozenAlways,
19630
+ children: /* @__PURE__ */ jsx(LocalsUpdateContext.Provider, {
19631
+ value: updater,
19632
+ children: /* @__PURE__ */ jsx(LocalsValuesContext.Provider, {
19633
+ value: locals,
19634
+ children: /* @__PURE__ */ jsx(NobrContext.Provider, {
19635
+ value: nobr,
19636
+ children: /* @__PURE__ */ jsx(InlineContext.Provider, {
19637
+ value: inline,
19638
+ children: /* @__PURE__ */ jsx(WidgetChildrenContext.Provider, {
19639
+ value: widgetChildren,
19640
+ children: /* @__PURE__ */ jsx(RepeatContext.Provider, {
19641
+ value: repeat,
19642
+ children: /* @__PURE__ */ jsx(DialogCloseContext.Provider, {
19643
+ value: closeDialog,
19644
+ children: renderNodes(children, {
19645
+ nobr,
19646
+ inline,
19647
+ locals
19648
+ })
19410
19649
  })
19411
19650
  })
19412
19651
  })
@@ -19525,6 +19764,7 @@ defineMacro({
19525
19764
  type: "expression",
19526
19765
  required: true
19527
19766
  }],
19767
+ interpolate: true,
19528
19768
  merged: true,
19529
19769
  render({ rawArgs, branches = [] }, ctx) {
19530
19770
  let switchValue;
@@ -19545,7 +19785,8 @@ defineMacro({
19545
19785
  error: err
19546
19786
  });
19547
19787
  }
19548
- return branch && /* @__PURE__ */ jsx(Fragment$1, { children: ctx.renderNodes(branch.children) });
19788
+ if (!branch) return null;
19789
+ return renderBranch(branch, ctx);
19549
19790
  },
19550
19791
  text({ rawArgs, branches = [] }, ctx) {
19551
19792
  const branch = selectCase(ctx.evaluate(rawArgs), branches, ctx.evaluate);
@@ -20120,12 +20361,15 @@ function SaveManagerContent() {
20120
20361
  if (mode === "load" && group.saves.length === 0 && !isCurrentPt) return null;
20121
20362
  return /* @__PURE__ */ jsxs("div", {
20122
20363
  class: "playthrough-group",
20123
- children: [/* @__PURE__ */ jsxs("div", {
20364
+ children: [/* @__PURE__ */ jsxs("button", {
20365
+ type: "button",
20124
20366
  class: "playthrough-header",
20367
+ "aria-expanded": !isCollapsed,
20125
20368
  onClick: () => toggleCollapse(group.playthrough.id),
20126
20369
  children: [
20127
20370
  /* @__PURE__ */ jsx("span", {
20128
20371
  class: `playthrough-chevron ${isCollapsed ? "" : "open"}`,
20372
+ "aria-hidden": "true",
20129
20373
  children: "▶"
20130
20374
  }),
20131
20375
  /* @__PURE__ */ jsxs("span", {
@@ -20433,13 +20677,19 @@ function defineInputMacro(name, type, toValue = (input) => input !== void 0 ? St
20433
20677
  label: placeholder || ctx.varName,
20434
20678
  perform: (v) => ctx.setValue(toValue(v))
20435
20679
  });
20680
+ const typed = ctx.hooks.useRef(null);
20681
+ const shown = typed.current !== null && toValue(typed.current) === ctx.value && type === "number" ? typed.current : display(ctx.value);
20436
20682
  return h(type ? "input" : "textarea", {
20437
20683
  type,
20438
20684
  id: ctx.id,
20439
20685
  class: ctx.cls,
20440
- value: display(ctx.value),
20686
+ value: shown,
20441
20687
  placeholder,
20442
- onInput: (e) => ctx.setValue(toValue(e.target.value))
20688
+ onInput: (e) => {
20689
+ const text = e.target.value;
20690
+ typed.current = text;
20691
+ ctx.setValue(toValue(text));
20692
+ }
20443
20693
  });
20444
20694
  }
20445
20695
  });
@@ -20831,6 +21081,9 @@ defineMacro({
20831
21081
  });
20832
21082
  const resolvedTypeRef = useRef("fade");
20833
21083
  const prevHistoryLenRef = useRef(0);
21084
+ const displayedId = displayed.id;
21085
+ const isOutgoing = useCallback((state) => state.navigationId !== displayedId, [displayedId]);
21086
+ const lastElement = useRef(null);
20834
21087
  const containerRef = useRef(null);
20835
21088
  const timeoutsRef = useRef([]);
20836
21089
  /** Cancel any in-progress transition. */
@@ -20899,6 +21152,16 @@ defineMacro({
20899
21152
  cleanupSnapshots(containerEl);
20900
21153
  }, config.duration)];
20901
21154
  }, [navigationId]);
21155
+ const shownId = displayedPassage && !renderDeferred ? displayed.id : null;
21156
+ const lastShownId = useRef(shownId);
21157
+ useLayoutEffect(() => {
21158
+ if (shownId === null) return;
21159
+ const previous = lastShownId.current;
21160
+ lastShownId.current = shownId;
21161
+ if (previous === null || previous === shownId) return;
21162
+ const el = containerRef.current?.querySelector(".passage");
21163
+ if (el && el.getBoundingClientRect().top < 0) el.scrollIntoView?.({ block: "start" });
21164
+ }, [shownId]);
20902
21165
  const effectivePassage = renderDeferred ? storyData?.passages.get("StoryLoading") ?? null : displayedPassage ? storyData?.passages.get(displayedPassage) : null;
20903
21166
  if (!effectivePassage && displayedPassage && !renderDeferred) return /* @__PURE__ */ jsxs("div", {
20904
21167
  class: "error",
@@ -20909,6 +21172,12 @@ defineMacro({
20909
21172
  ]
20910
21173
  });
20911
21174
  const readyPassage = storyData?.passages.get("PassageReady");
21175
+ const passageElement = !renderDeferred && displayed.id !== navigationId && lastElement.current ? lastElement.current : effectivePassage && /* @__PURE__ */ jsx(Passage, {
21176
+ passage: effectivePassage,
21177
+ dataTransition: renderDeferred ? "none" : resolvedTypeRef.current,
21178
+ navigationId: renderDeferred ? void 0 : displayed.id
21179
+ }, renderDeferred ? "loading" : `nav-${displayed.id}`);
21180
+ lastElement.current = passageElement || null;
20912
21181
  return /* @__PURE__ */ jsxs("div", {
20913
21182
  id: ctx.id ?? "story",
20914
21183
  class: ctx.className ?? "story",
@@ -20918,11 +21187,10 @@ defineMacro({
20918
21187
  }, `ready-${navigationId}`), /* @__PURE__ */ jsx("div", {
20919
21188
  class: "passage-container",
20920
21189
  ref: containerRef,
20921
- children: effectivePassage && /* @__PURE__ */ jsx(Passage, {
20922
- passage: effectivePassage,
20923
- dataTransition: renderDeferred ? "none" : resolvedTypeRef.current,
20924
- navigationId: renderDeferred ? void 0 : displayed.id
20925
- }, renderDeferred ? "loading" : `nav-${displayed.id}`)
21190
+ children: passageElement && /* @__PURE__ */ jsx(FrozenStateContext.Provider, {
21191
+ value: isOutgoing,
21192
+ children: passageElement
21193
+ })
20926
21194
  })]
20927
21195
  });
20928
21196
  }
@@ -21002,7 +21270,7 @@ defineMacro({
21002
21270
  });
21003
21271
  //#endregion
21004
21272
  //#region src/styles.css?inline
21005
- var styles_default = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nhtml {\n font-size: 16px;\n -webkit-text-size-adjust: 100%;\n}\n\nbody {\n margin: 0;\n padding: 0;\n font-family: Georgia, 'Times New Roman', serif;\n line-height: 1.75;\n color: #e0e0e0;\n background-color: #1a1a2e;\n min-height: 100vh;\n}\n\ntw-storydata {\n display: none !important;\n}\n\n#story {\n max-width: 42em;\n margin: 0 auto;\n padding: 2em 1.5em;\n}\n\n/* Passage transitions */\n\n.passage-container {\n position: relative;\n}\n\n.passage-container--crossfading {\n display: grid;\n}\n\n.passage-container--crossfading > * {\n grid-area: 1 / 1;\n}\n\n.passage {\n animation: passage-fade-in var(--passage-in-duration, 0.3s) ease;\n}\n\n.passage[data-transition='none'] {\n animation: none;\n}\n\n.passage-snapshot {\n animation: passage-fade-out var(--passage-out-duration, 0.3s) ease forwards;\n pointer-events: none;\n user-select: none;\n}\n\n@keyframes passage-fade-in {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes passage-fade-out {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-8px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .passage,\n .passage-snapshot {\n animation-duration: 0.01s !important;\n }\n}\n\n.macro-button {\n background: rgba(100, 181, 246, 0.15);\n color: #64b5f6;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 4px;\n padding: 0.25em 0.75em;\n font: inherit;\n font-size: 0.95em;\n cursor: pointer;\n transition:\n background 0.2s,\n border-color 0.2s;\n}\n\n.macro-button:hover {\n background: rgba(100, 181, 246, 0.25);\n border-color: #90caf9;\n}\n\n.macro-button:active {\n background: rgba(100, 181, 246, 0.35);\n}\n\n.error {\n color: #ef5350;\n font-family: monospace;\n padding: 1em;\n border: 1px solid #ef5350;\n border-radius: 4px;\n background: rgba(239, 83, 80, 0.1);\n}\n\n/* Runtime errors shown on the page (see src/components/RuntimeErrors.tsx) */\n.spindle-error-banners {\n position: fixed;\n top: 0.75em;\n left: 50%;\n z-index: 300;\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n width: min(42em, calc(100% - 1.5em));\n transform: translateX(-50%);\n}\n\n.spindle-error-banner {\n position: relative;\n padding: 0.75em 2.75em 0.75em 1em;\n border: 1px solid #ef5350;\n border-radius: 4px;\n background: #2b1a1e;\n color: #ffcdd2;\n font-size: 0.9em;\n line-height: 1.5;\n box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);\n}\n\n.spindle-error-banner-message {\n font-family: monospace;\n color: #ef9a9a;\n}\n\n.spindle-error-banner-dismiss {\n position: absolute;\n top: 0.5em;\n right: 0.5em;\n background: transparent;\n border: none;\n color: inherit;\n font-size: 1em;\n cursor: pointer;\n}\n\n.spindle-error-banner-dismiss:hover {\n color: #fff;\n}\n\n.loading {\n text-align: center;\n padding: 2em;\n opacity: 0.6;\n}\n\n/* Menu bar */\n\n.story-menubar {\n position: sticky;\n top: 0;\n z-index: 100;\n display: flex;\n align-items: center;\n gap: 0.5em;\n padding: 0.5em 1.5em;\n background: #16213e;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n font-family: system-ui, sans-serif;\n font-size: 0.9em;\n}\n\n.story-title {\n flex: 1;\n font-weight: 600;\n color: #e0e0e0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.menubar-button {\n background: transparent;\n color: #9e9e9e;\n border: 1px solid transparent;\n padding: 0.35em 0.7em;\n border-radius: 4px;\n cursor: pointer;\n font: inherit;\n transition:\n color 0.2s,\n background 0.2s;\n}\n\n.menubar-button:hover {\n color: #e0e0e0;\n background: rgba(255, 255, 255, 0.08);\n}\n\n.menubar-button:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n.menubar-button:disabled:hover {\n color: #9e9e9e;\n background: transparent;\n}\n\n/* Generic dialog */\n\n.dialog-overlay {\n position: fixed;\n inset: 0;\n z-index: 200;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.6);\n}\n\n.dialog-panel {\n background: #16213e;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 8px;\n width: 90%;\n max-width: 500px;\n max-height: 80vh;\n display: flex;\n flex-direction: column;\n color: #e0e0e0;\n font-family: system-ui, sans-serif;\n position: relative;\n}\n\n/* Focused programmatically when the dialog has no focusable content */\n.dialog-panel:focus {\n outline: none;\n}\n\n.dialog-saves {\n max-width: 550px;\n}\n\n.dialog-settings {\n max-width: 400px;\n}\n\n/* Keep the first control clear of the close button above it */\n.dialog-settings .dialog-body {\n padding-top: 2.25em;\n}\n\n.dialog-close {\n position: absolute;\n top: 0.75em;\n right: 0.75em;\n z-index: 1;\n background: transparent;\n border: none;\n color: #9e9e9e;\n font-size: 1.1em;\n cursor: pointer;\n padding: 0.25em;\n line-height: 1;\n}\n\n.dialog-close:hover {\n color: #e0e0e0;\n}\n\n.dialog-body {\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n}\n\n/* Settings controls */\n\n.settings-controls {\n padding: 1em 1.25em;\n display: flex;\n flex-direction: column;\n gap: 1em;\n}\n\n.settings-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1em;\n}\n\n.settings-row select,\n.settings-row input[type='range'] {\n accent-color: #64b5f6;\n}\n\n.settings-row select {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n.settings-row input[type='checkbox'] {\n accent-color: #64b5f6;\n width: 1.1em;\n height: 1.1em;\n}\n\n/* Save manager */\n\n.save-manager {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n\n.saves-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 1em 1.25em;\n padding-right: 3em;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n font-weight: 600;\n flex-shrink: 0;\n}\n\n.saves-header-left {\n display: flex;\n align-items: center;\n gap: 0.75em;\n}\n\n.saves-mode-toggle {\n display: flex;\n gap: 0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n overflow: hidden;\n}\n\n.saves-mode-toggle button {\n background: transparent;\n color: #9e9e9e;\n border: none;\n padding: 0.3em 0.8em;\n font: inherit;\n font-size: 0.85em;\n font-weight: 600;\n cursor: pointer;\n transition:\n background 0.2s,\n color 0.2s;\n}\n\n.saves-mode-toggle button.active {\n background: rgba(100, 181, 246, 0.2);\n color: #64b5f6;\n}\n\n.saves-mode-toggle button:hover:not(.active) {\n color: #e0e0e0;\n}\n\n.saves-body {\n padding: 0.75em 1.25em;\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n}\n\n.saves-empty {\n text-align: center;\n padding: 2em 1em;\n opacity: 0.5;\n font-size: 0.9em;\n}\n\n.saves-toolbar {\n display: flex;\n gap: 0.5em;\n padding: 0.5em 1.25em;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n}\n\n.saves-toolbar-button {\n background: rgba(255, 255, 255, 0.05);\n color: #9e9e9e;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n padding: 0.3em 0.7em;\n font: inherit;\n font-size: 0.8em;\n cursor: pointer;\n transition:\n background 0.2s,\n color 0.2s;\n}\n\n.saves-toolbar-button:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e0e0e0;\n}\n\n.playthrough-group {\n margin-bottom: 0.75em;\n}\n\n.playthrough-header {\n display: flex;\n align-items: center;\n gap: 0.5em;\n padding: 0.4em 0;\n cursor: pointer;\n user-select: none;\n font-size: 0.85em;\n color: #9e9e9e;\n transition: color 0.2s;\n}\n\n.playthrough-header:hover {\n color: #e0e0e0;\n}\n\n.playthrough-chevron {\n display: inline-block;\n font-size: 0.7em;\n transition: transform 0.2s;\n}\n\n.playthrough-chevron.open {\n transform: rotate(90deg);\n}\n\n.playthrough-label {\n font-weight: 600;\n}\n\n.playthrough-date {\n opacity: 0.6;\n font-size: 0.9em;\n}\n\n.playthrough-saves {\n display: flex;\n flex-direction: column;\n gap: 0.4em;\n padding-left: 0.25em;\n}\n\n.save-slot {\n display: flex;\n align-items: center;\n gap: 0.75em;\n padding: 0.5em 0.6em;\n background: rgba(255, 255, 255, 0.03);\n border: 1px solid rgba(255, 255, 255, 0.06);\n border-radius: 6px;\n transition: background 0.15s;\n}\n\n.save-slot:hover {\n background: rgba(255, 255, 255, 0.06);\n}\n\n.save-slot-info {\n flex: 1;\n min-width: 0;\n}\n\n.save-slot-title {\n font-weight: 500;\n font-size: 0.9em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.save-slot-meta {\n font-size: 0.75em;\n color: #9e9e9e;\n display: flex;\n gap: 0.75em;\n}\n\n.save-slot-actions {\n display: flex;\n gap: 0.3em;\n flex-shrink: 0;\n}\n\n.save-slot-action {\n background: transparent;\n color: #9e9e9e;\n border: 1px solid transparent;\n border-radius: 3px;\n padding: 0.2em 0.5em;\n font: inherit;\n font-size: 0.75em;\n cursor: pointer;\n transition:\n color 0.2s,\n background 0.2s;\n white-space: nowrap;\n}\n\n.save-slot-action:hover {\n color: #e0e0e0;\n background: rgba(255, 255, 255, 0.08);\n}\n\n.save-slot-action.primary {\n color: #64b5f6;\n border-color: rgba(100, 181, 246, 0.3);\n}\n\n.save-slot-action.primary:hover {\n background: rgba(100, 181, 246, 0.15);\n}\n\n.save-slot-action.danger:hover {\n color: #ef5350;\n background: rgba(239, 83, 80, 0.1);\n}\n\n.save-slot-new {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0.5em;\n margin-top: 0.25em;\n border: 1px dashed rgba(255, 255, 255, 0.12);\n border-radius: 6px;\n color: #9e9e9e;\n font: inherit;\n font-size: 0.8em;\n background: transparent;\n cursor: pointer;\n width: 100%;\n transition:\n color 0.2s,\n border-color 0.2s,\n background 0.2s;\n}\n\n.save-slot-new:hover {\n color: #64b5f6;\n border-color: rgba(100, 181, 246, 0.3);\n background: rgba(100, 181, 246, 0.05);\n}\n\n.saves-notice {\n padding: 0.5em 1.25em;\n font-size: 0.8em;\n color: #ffb74d;\n border-bottom: 1px solid rgba(255, 183, 77, 0.3);\n background: rgba(255, 183, 77, 0.08);\n flex-shrink: 0;\n}\n\n.saves-status {\n padding: 0.5em 1.25em;\n font-size: 0.8em;\n color: #81c784;\n border-top: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n text-align: center;\n}\n\n.saves-status.error {\n color: #ef5350;\n border: none;\n border-radius: 0;\n padding: 0.5em 1.25em;\n font-family: inherit;\n background: transparent;\n}\n\n.save-rename-input {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 3px;\n padding: 0.15em 0.4em;\n font: inherit;\n font-size: 0.9em;\n width: 100%;\n}\n\n.save-rename-input:focus {\n outline: none;\n border-color: #64b5f6;\n}\n\n/* Macro: link */\n\n.macro-link {\n color: #64b5f6;\n text-decoration: none;\n border-bottom: 1px solid rgba(100, 181, 246, 0.3);\n transition:\n color 0.2s,\n border-color 0.2s;\n cursor: pointer;\n}\n\n.macro-link:hover {\n color: #90caf9;\n border-bottom-color: #90caf9;\n}\n\n.macro-link:active {\n color: #42a5f5;\n}\n\n/* Macro: form inputs */\n\n.macro-textbox,\n.macro-numberbox,\n.macro-textarea {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n.macro-textbox:focus,\n.macro-numberbox:focus,\n.macro-textarea:focus {\n outline: none;\n border-color: #64b5f6;\n}\n\n.macro-textarea {\n min-height: 3em;\n resize: vertical;\n}\n\n.macro-checkbox,\n.macro-radiobutton {\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 0.3em;\n}\n\n.macro-checkbox input,\n.macro-radiobutton input {\n accent-color: #64b5f6;\n}\n\n/* Macro: listbox */\n\n.macro-listbox {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n/* Macro: cycle */\n\n.macro-cycle {\n background: rgba(100, 181, 246, 0.15);\n color: #64b5f6;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 4px;\n padding: 0.25em 0.75em;\n font: inherit;\n cursor: pointer;\n transition:\n background 0.2s,\n border-color 0.2s;\n}\n\n.macro-cycle:hover {\n background: rgba(100, 181, 246, 0.25);\n border-color: #90caf9;\n}\n\n/* Macro: meter */\n\n.macro-meter {\n position: relative;\n width: 100%;\n height: 1.4em;\n background: #2a2a3e;\n border-radius: 0.3em;\n overflow: hidden;\n border: 1px solid #444;\n}\n\n.macro-meter-fill {\n height: 100%;\n background: #64b5f6;\n transition: width 0.3s ease;\n}\n\n.macro-meter-label {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 0.85em;\n color: #e0e0e0;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);\n pointer-events: none;\n}\n\n/* Markdown wrapper — invisible to layout */\n\n.md {\n display: contents;\n}\n\n/* Markdown block elements inside passages */\n\n.passage p {\n margin: 0.6em 0;\n}\n\n.passage p:first-child {\n margin-top: 0;\n}\n\n.passage p:last-child {\n margin-bottom: 0;\n}\n\n.passage h1,\n.passage h2,\n.passage h3,\n.passage h4,\n.passage h5,\n.passage h6 {\n margin: 1em 0 0.4em;\n line-height: 1.3;\n color: #f0f0f0;\n}\n\n.passage h1 {\n font-size: 1.8em;\n}\n.passage h2 {\n font-size: 1.5em;\n}\n.passage h3 {\n font-size: 1.25em;\n}\n.passage h4 {\n font-size: 1.1em;\n}\n.passage h5 {\n font-size: 1em;\n}\n.passage h6 {\n font-size: 0.9em;\n opacity: 0.8;\n}\n\n.passage code {\n font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;\n font-size: 0.9em;\n background: rgba(255, 255, 255, 0.08);\n padding: 0.15em 0.35em;\n border-radius: 3px;\n}\n\n.passage pre {\n background: rgba(0, 0, 0, 0.3);\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 6px;\n padding: 1em;\n overflow-x: auto;\n margin: 0.8em 0;\n}\n\n.passage pre code {\n background: none;\n padding: 0;\n border-radius: 0;\n font-size: 0.85em;\n}\n\n.passage blockquote {\n border-left: 3px solid rgba(100, 181, 246, 0.5);\n margin: 0.8em 0;\n padding: 0.4em 1em;\n color: #b0b0b0;\n}\n\n.passage blockquote p {\n margin: 0.3em 0;\n}\n\n.passage ul,\n.passage ol {\n margin: 0.6em 0;\n padding-left: 1.8em;\n}\n\n.passage li {\n margin: 0.2em 0;\n}\n\n.passage hr {\n border: none;\n border-top: 1px solid rgba(255, 255, 255, 0.12);\n margin: 1.2em 0;\n}\n\n.passage table {\n border-collapse: collapse;\n width: 100%;\n margin: 0.8em 0;\n}\n\n.passage th,\n.passage td {\n border: 1px solid rgba(255, 255, 255, 0.12);\n padding: 0.5em 0.75em;\n text-align: left;\n}\n\n.passage th {\n background: rgba(255, 255, 255, 0.06);\n font-weight: 600;\n}\n\n.passage tr:nth-child(even) {\n background: rgba(255, 255, 255, 0.02);\n}\n\n.passage del {\n opacity: 0.5;\n}\n\n.passage strong {\n color: #f0f0f0;\n}\n\n/* Macro: type (typewriter) */\n\n.macro-type-cursor::after {\n content: '\\2588';\n animation: type-blink 0.7s step-end infinite;\n color: #64b5f6;\n}\n\n.macro-type-done .macro-type-cursor::after {\n display: none;\n}\n\n@keyframes type-blink {\n 50% {\n opacity: 0;\n }\n}\n";
21273
+ var styles_default = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nhtml {\n font-size: 16px;\n -webkit-text-size-adjust: 100%;\n}\n\nbody {\n margin: 0;\n padding: 0;\n font-family: Georgia, 'Times New Roman', serif;\n line-height: 1.75;\n color: #e0e0e0;\n background-color: #1a1a2e;\n min-height: 100vh;\n}\n\ntw-storydata {\n display: none !important;\n}\n\n#story {\n max-width: 42em;\n margin: 0 auto;\n padding: 2em 1.5em;\n}\n\n/* Passage transitions */\n\n.passage-container {\n position: relative;\n}\n\n.passage-container--crossfading {\n display: grid;\n}\n\n.passage-container--crossfading > * {\n grid-area: 1 / 1;\n}\n\n.passage {\n animation: passage-fade-in var(--passage-in-duration, 0.3s) ease;\n}\n\n.passage[data-transition='none'] {\n animation: none;\n}\n\n.passage-snapshot {\n animation: passage-fade-out var(--passage-out-duration, 0.3s) ease forwards;\n pointer-events: none;\n user-select: none;\n}\n\n@keyframes passage-fade-in {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes passage-fade-out {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-8px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .passage,\n .passage-snapshot {\n animation-duration: 0.01s !important;\n }\n}\n\n.macro-button {\n background: rgba(100, 181, 246, 0.15);\n color: #64b5f6;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 4px;\n padding: 0.25em 0.75em;\n font: inherit;\n font-size: 0.95em;\n cursor: pointer;\n transition:\n background 0.2s,\n border-color 0.2s;\n}\n\n.macro-button:hover {\n background: rgba(100, 181, 246, 0.25);\n border-color: #90caf9;\n}\n\n.macro-button:active {\n background: rgba(100, 181, 246, 0.35);\n}\n\n.error {\n color: #ef5350;\n font-family: monospace;\n padding: 1em;\n border: 1px solid #ef5350;\n border-radius: 4px;\n background: rgba(239, 83, 80, 0.1);\n}\n\n/* Runtime errors shown on the page (see src/components/RuntimeErrors.tsx) */\n.spindle-error-banners {\n position: fixed;\n top: 0.75em;\n left: 50%;\n z-index: 300;\n display: flex;\n flex-direction: column;\n gap: 0.5em;\n width: min(42em, calc(100% - 1.5em));\n transform: translateX(-50%);\n}\n\n.spindle-error-banner {\n position: relative;\n padding: 0.75em 2.75em 0.75em 1em;\n border: 1px solid #ef5350;\n border-radius: 4px;\n background: #2b1a1e;\n color: #ffcdd2;\n font-size: 0.9em;\n line-height: 1.5;\n box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);\n}\n\n.spindle-error-banner-message {\n font-family: monospace;\n color: #ef9a9a;\n}\n\n.spindle-error-banner-dismiss {\n position: absolute;\n top: 0.5em;\n right: 0.5em;\n background: transparent;\n border: none;\n color: inherit;\n font-size: 1em;\n cursor: pointer;\n}\n\n.spindle-error-banner-dismiss:hover {\n color: #fff;\n}\n\n.loading {\n text-align: center;\n padding: 2em;\n opacity: 0.6;\n}\n\n/* Menu bar */\n\n.story-menubar {\n position: sticky;\n top: 0;\n z-index: 100;\n display: flex;\n align-items: center;\n gap: 0.5em;\n padding: 0.5em 1.5em;\n background: #16213e;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n font-family: system-ui, sans-serif;\n font-size: 0.9em;\n}\n\n.story-title {\n flex: 1;\n font-weight: 600;\n color: #e0e0e0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.menubar-button {\n background: transparent;\n color: #9e9e9e;\n border: 1px solid transparent;\n padding: 0.35em 0.7em;\n border-radius: 4px;\n cursor: pointer;\n font: inherit;\n transition:\n color 0.2s,\n background 0.2s;\n}\n\n.menubar-button:hover {\n color: #e0e0e0;\n background: rgba(255, 255, 255, 0.08);\n}\n\n.menubar-button:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n.menubar-button:disabled:hover {\n color: #9e9e9e;\n background: transparent;\n}\n\n/* Generic dialog */\n\n.dialog-overlay {\n position: fixed;\n inset: 0;\n z-index: 200;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.6);\n}\n\n.dialog-panel {\n background: #16213e;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 8px;\n width: 90%;\n max-width: 500px;\n max-height: 80vh;\n display: flex;\n flex-direction: column;\n color: #e0e0e0;\n font-family: system-ui, sans-serif;\n position: relative;\n}\n\n/* Focused programmatically when the dialog has no focusable content */\n.dialog-panel:focus {\n outline: none;\n}\n\n.dialog-saves {\n max-width: 550px;\n}\n\n.dialog-settings {\n max-width: 400px;\n}\n\n/* Keep the first control clear of the close button above it */\n.dialog-settings .dialog-body {\n padding-top: 2.25em;\n}\n\n.dialog-close {\n position: absolute;\n top: 0.75em;\n right: 0.75em;\n z-index: 1;\n background: transparent;\n border: none;\n color: #9e9e9e;\n font-size: 1.1em;\n cursor: pointer;\n padding: 0.25em;\n line-height: 1;\n}\n\n.dialog-close:hover {\n color: #e0e0e0;\n}\n\n.dialog-body {\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n}\n\n/* Settings controls */\n\n.settings-controls {\n padding: 1em 1.25em;\n display: flex;\n flex-direction: column;\n gap: 1em;\n}\n\n.settings-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1em;\n}\n\n.settings-row select,\n.settings-row input[type='range'] {\n accent-color: #64b5f6;\n}\n\n.settings-row select {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n.settings-row input[type='checkbox'] {\n accent-color: #64b5f6;\n width: 1.1em;\n height: 1.1em;\n}\n\n/* Save manager */\n\n.save-manager {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n\n.saves-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 1em 1.25em;\n padding-right: 3em;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n font-weight: 600;\n flex-shrink: 0;\n}\n\n.saves-header-left {\n display: flex;\n align-items: center;\n gap: 0.75em;\n}\n\n.saves-mode-toggle {\n display: flex;\n gap: 0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n overflow: hidden;\n}\n\n.saves-mode-toggle button {\n background: transparent;\n color: #9e9e9e;\n border: none;\n padding: 0.3em 0.8em;\n font: inherit;\n font-size: 0.85em;\n font-weight: 600;\n cursor: pointer;\n transition:\n background 0.2s,\n color 0.2s;\n}\n\n.saves-mode-toggle button.active {\n background: rgba(100, 181, 246, 0.2);\n color: #64b5f6;\n}\n\n.saves-mode-toggle button:hover:not(.active) {\n color: #e0e0e0;\n}\n\n.saves-body {\n padding: 0.75em 1.25em;\n overflow-y: auto;\n flex: 1;\n min-height: 0;\n}\n\n.saves-empty {\n text-align: center;\n padding: 2em 1em;\n opacity: 0.5;\n font-size: 0.9em;\n}\n\n.saves-toolbar {\n display: flex;\n gap: 0.5em;\n padding: 0.5em 1.25em;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n}\n\n.saves-toolbar-button {\n background: rgba(255, 255, 255, 0.05);\n color: #9e9e9e;\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n padding: 0.3em 0.7em;\n font: inherit;\n font-size: 0.8em;\n cursor: pointer;\n transition:\n background 0.2s,\n color 0.2s;\n}\n\n.saves-toolbar-button:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e0e0e0;\n}\n\n.playthrough-group {\n margin-bottom: 0.75em;\n}\n\n.playthrough-header {\n display: flex;\n width: 100%;\n border: 0;\n background: none;\n font-family: inherit;\n text-align: left;\n align-items: center;\n gap: 0.5em;\n padding: 0.4em 0;\n cursor: pointer;\n user-select: none;\n font-size: 0.85em;\n color: #9e9e9e;\n transition: color 0.2s;\n}\n\n.playthrough-header:hover {\n color: #e0e0e0;\n}\n\n.playthrough-chevron {\n display: inline-block;\n font-size: 0.7em;\n transition: transform 0.2s;\n}\n\n.playthrough-chevron.open {\n transform: rotate(90deg);\n}\n\n.playthrough-label {\n font-weight: 600;\n}\n\n.playthrough-date {\n opacity: 0.6;\n font-size: 0.9em;\n}\n\n.playthrough-saves {\n display: flex;\n flex-direction: column;\n gap: 0.4em;\n padding-left: 0.25em;\n}\n\n.save-slot {\n display: flex;\n align-items: center;\n gap: 0.75em;\n padding: 0.5em 0.6em;\n background: rgba(255, 255, 255, 0.03);\n border: 1px solid rgba(255, 255, 255, 0.06);\n border-radius: 6px;\n transition: background 0.15s;\n}\n\n.save-slot:hover {\n background: rgba(255, 255, 255, 0.06);\n}\n\n.save-slot-info {\n flex: 1;\n min-width: 0;\n}\n\n.save-slot-title {\n font-weight: 500;\n font-size: 0.9em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.save-slot-meta {\n font-size: 0.75em;\n color: #9e9e9e;\n display: flex;\n gap: 0.75em;\n}\n\n.save-slot-actions {\n display: flex;\n gap: 0.3em;\n flex-shrink: 0;\n}\n\n.save-slot-action {\n background: transparent;\n color: #9e9e9e;\n border: 1px solid transparent;\n border-radius: 3px;\n padding: 0.2em 0.5em;\n font: inherit;\n font-size: 0.75em;\n cursor: pointer;\n transition:\n color 0.2s,\n background 0.2s;\n white-space: nowrap;\n}\n\n.save-slot-action:hover {\n color: #e0e0e0;\n background: rgba(255, 255, 255, 0.08);\n}\n\n.save-slot-action.primary {\n color: #64b5f6;\n border-color: rgba(100, 181, 246, 0.3);\n}\n\n.save-slot-action.primary:hover {\n background: rgba(100, 181, 246, 0.15);\n}\n\n.save-slot-action.danger:hover {\n color: #ef5350;\n background: rgba(239, 83, 80, 0.1);\n}\n\n.save-slot-new {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0.5em;\n margin-top: 0.25em;\n border: 1px dashed rgba(255, 255, 255, 0.12);\n border-radius: 6px;\n color: #9e9e9e;\n font: inherit;\n font-size: 0.8em;\n background: transparent;\n cursor: pointer;\n width: 100%;\n transition:\n color 0.2s,\n border-color 0.2s,\n background 0.2s;\n}\n\n.save-slot-new:hover {\n color: #64b5f6;\n border-color: rgba(100, 181, 246, 0.3);\n background: rgba(100, 181, 246, 0.05);\n}\n\n.saves-notice {\n padding: 0.5em 1.25em;\n font-size: 0.8em;\n color: #ffb74d;\n border-bottom: 1px solid rgba(255, 183, 77, 0.3);\n background: rgba(255, 183, 77, 0.08);\n flex-shrink: 0;\n}\n\n.saves-status {\n padding: 0.5em 1.25em;\n font-size: 0.8em;\n color: #81c784;\n border-top: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n text-align: center;\n}\n\n.saves-status.error {\n color: #ef5350;\n border: none;\n border-radius: 0;\n padding: 0.5em 1.25em;\n font-family: inherit;\n background: transparent;\n}\n\n.save-rename-input {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 3px;\n padding: 0.15em 0.4em;\n font: inherit;\n font-size: 0.9em;\n width: 100%;\n}\n\n.save-rename-input:focus {\n outline: none;\n border-color: #64b5f6;\n}\n\n/* Macro: link */\n\n.macro-link {\n color: #64b5f6;\n text-decoration: none;\n border-bottom: 1px solid rgba(100, 181, 246, 0.3);\n transition:\n color 0.2s,\n border-color 0.2s;\n cursor: pointer;\n}\n\n.macro-link:hover {\n color: #90caf9;\n border-bottom-color: #90caf9;\n}\n\n.macro-link:active {\n color: #42a5f5;\n}\n\n/* Macro: form inputs */\n\n.macro-textbox,\n.macro-numberbox,\n.macro-textarea {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n.macro-textbox:focus,\n.macro-numberbox:focus,\n.macro-textarea:focus {\n outline: none;\n border-color: #64b5f6;\n}\n\n.macro-textarea {\n min-height: 3em;\n resize: vertical;\n}\n\n.macro-checkbox,\n.macro-radiobutton {\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 0.3em;\n}\n\n.macro-checkbox input,\n.macro-radiobutton input {\n accent-color: #64b5f6;\n}\n\n/* Macro: listbox */\n\n.macro-listbox {\n background: #1a1a2e;\n color: #e0e0e0;\n border: 1px solid rgba(255, 255, 255, 0.15);\n border-radius: 4px;\n padding: 0.3em 0.5em;\n font: inherit;\n}\n\n/* Macro: cycle */\n\n.macro-cycle {\n background: rgba(100, 181, 246, 0.15);\n color: #64b5f6;\n border: 1px solid rgba(100, 181, 246, 0.4);\n border-radius: 4px;\n padding: 0.25em 0.75em;\n font: inherit;\n cursor: pointer;\n transition:\n background 0.2s,\n border-color 0.2s;\n}\n\n.macro-cycle:hover {\n background: rgba(100, 181, 246, 0.25);\n border-color: #90caf9;\n}\n\n/* Macro: meter */\n\n.macro-meter {\n position: relative;\n width: 100%;\n height: 1.4em;\n background: #2a2a3e;\n border-radius: 0.3em;\n overflow: hidden;\n border: 1px solid #444;\n}\n\n.macro-meter-fill {\n height: 100%;\n background: #64b5f6;\n transition: width 0.3s ease;\n}\n\n.macro-meter-label {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 0.85em;\n color: #e0e0e0;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);\n pointer-events: none;\n}\n\n/* Markdown wrapper — invisible to layout */\n\n.md {\n display: contents;\n}\n\n/* Markdown block elements inside passages */\n\n.passage p {\n margin: 0.6em 0;\n}\n\n.passage p:first-child {\n margin-top: 0;\n}\n\n.passage p:last-child {\n margin-bottom: 0;\n}\n\n.passage h1,\n.passage h2,\n.passage h3,\n.passage h4,\n.passage h5,\n.passage h6 {\n margin: 1em 0 0.4em;\n line-height: 1.3;\n color: #f0f0f0;\n}\n\n.passage h1 {\n font-size: 1.8em;\n}\n.passage h2 {\n font-size: 1.5em;\n}\n.passage h3 {\n font-size: 1.25em;\n}\n.passage h4 {\n font-size: 1.1em;\n}\n.passage h5 {\n font-size: 1em;\n}\n.passage h6 {\n font-size: 0.9em;\n opacity: 0.8;\n}\n\n.passage code {\n font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;\n font-size: 0.9em;\n background: rgba(255, 255, 255, 0.08);\n padding: 0.15em 0.35em;\n border-radius: 3px;\n}\n\n.passage pre {\n background: rgba(0, 0, 0, 0.3);\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 6px;\n padding: 1em;\n overflow-x: auto;\n margin: 0.8em 0;\n}\n\n.passage pre code {\n background: none;\n padding: 0;\n border-radius: 0;\n font-size: 0.85em;\n}\n\n.passage blockquote {\n border-left: 3px solid rgba(100, 181, 246, 0.5);\n margin: 0.8em 0;\n padding: 0.4em 1em;\n color: #b0b0b0;\n}\n\n.passage blockquote p {\n margin: 0.3em 0;\n}\n\n.passage ul,\n.passage ol {\n margin: 0.6em 0;\n padding-left: 1.8em;\n}\n\n.passage li {\n margin: 0.2em 0;\n}\n\n.passage hr {\n border: none;\n border-top: 1px solid rgba(255, 255, 255, 0.12);\n margin: 1.2em 0;\n}\n\n.passage table {\n border-collapse: collapse;\n width: 100%;\n margin: 0.8em 0;\n}\n\n.passage th,\n.passage td {\n border: 1px solid rgba(255, 255, 255, 0.12);\n padding: 0.5em 0.75em;\n text-align: left;\n}\n\n.passage th {\n background: rgba(255, 255, 255, 0.06);\n font-weight: 600;\n}\n\n.passage tr:nth-child(even) {\n background: rgba(255, 255, 255, 0.02);\n}\n\n.passage del {\n opacity: 0.5;\n}\n\n.passage strong {\n color: #f0f0f0;\n}\n\n/* Macro: type (typewriter) */\n\n.macro-type-cursor::after {\n content: '\\2588';\n animation: type-blink 0.7s step-end infinite;\n color: #64b5f6;\n}\n\n.macro-type-done .macro-type-cursor::after {\n display: none;\n}\n\n@keyframes type-blink {\n 50% {\n opacity: 0;\n }\n}\n";
21006
21274
  //#endregion
21007
21275
  //#region src/index.tsx
21008
21276
  function renderErrors(root, errors) {