securemark 0.257.1 → 0.258.0

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +21 -8
  3. package/dist/index.js +1224 -611
  4. package/markdown.d.ts +1 -28
  5. package/package.json +9 -9
  6. package/src/combinator/control/manipulation/convert.ts +8 -4
  7. package/src/combinator/control/manipulation/scope.ts +10 -2
  8. package/src/combinator/data/parser/context/delimiter.ts +70 -0
  9. package/src/combinator/data/parser/context/memo.ts +30 -0
  10. package/src/combinator/{control/manipulation → data/parser}/context.test.ts +9 -9
  11. package/src/combinator/data/parser/context.ts +161 -0
  12. package/src/combinator/data/parser/inits.ts +1 -1
  13. package/src/combinator/data/parser/sequence.test.ts +1 -1
  14. package/src/combinator/data/parser/sequence.ts +1 -1
  15. package/src/combinator/data/parser/some.test.ts +1 -1
  16. package/src/combinator/data/parser/some.ts +14 -37
  17. package/src/combinator/data/parser/subsequence.test.ts +1 -1
  18. package/src/combinator/data/parser/union.test.ts +1 -1
  19. package/src/combinator/data/parser.ts +7 -47
  20. package/src/combinator.ts +1 -2
  21. package/src/parser/api/bind.ts +5 -5
  22. package/src/parser/api/parse.ts +3 -1
  23. package/src/parser/block/blockquote.ts +1 -1
  24. package/src/parser/block/dlist.ts +4 -10
  25. package/src/parser/block/extension/figure.ts +4 -3
  26. package/src/parser/block/extension/table.ts +2 -2
  27. package/src/parser/block/heading.ts +5 -13
  28. package/src/parser/block/ilist.ts +3 -2
  29. package/src/parser/block/olist.ts +10 -7
  30. package/src/parser/block/paragraph.ts +1 -1
  31. package/src/parser/block/reply/cite.ts +1 -1
  32. package/src/parser/block/reply/quote.ts +1 -1
  33. package/src/parser/block/reply.ts +1 -1
  34. package/src/parser/block/sidefence.ts +1 -1
  35. package/src/parser/block/table.test.ts +5 -0
  36. package/src/parser/block/table.ts +14 -13
  37. package/src/parser/block/ulist.ts +4 -3
  38. package/src/parser/block.ts +1 -1
  39. package/src/parser/context.ts +32 -0
  40. package/src/parser/header.ts +1 -1
  41. package/src/parser/inline/annotation.ts +9 -17
  42. package/src/parser/inline/autolink/email.ts +1 -1
  43. package/src/parser/inline/autolink/url.ts +2 -2
  44. package/src/parser/inline/autolink.ts +5 -3
  45. package/src/parser/inline/bracket.test.ts +2 -0
  46. package/src/parser/inline/bracket.ts +16 -15
  47. package/src/parser/inline/code.ts +1 -1
  48. package/src/parser/inline/comment.test.ts +1 -0
  49. package/src/parser/inline/comment.ts +4 -3
  50. package/src/parser/inline/deletion.ts +5 -4
  51. package/src/parser/inline/emphasis.ts +5 -4
  52. package/src/parser/inline/emstrong.ts +5 -4
  53. package/src/parser/inline/extension/index.ts +8 -15
  54. package/src/parser/inline/extension/indexee.ts +8 -10
  55. package/src/parser/inline/extension/indexer.ts +4 -3
  56. package/src/parser/inline/extension/label.ts +3 -2
  57. package/src/parser/inline/extension/placeholder.ts +6 -5
  58. package/src/parser/inline/html.ts +5 -4
  59. package/src/parser/inline/htmlentity.ts +1 -1
  60. package/src/parser/inline/insertion.ts +5 -4
  61. package/src/parser/inline/link.ts +12 -21
  62. package/src/parser/inline/mark.ts +5 -4
  63. package/src/parser/inline/math.ts +8 -9
  64. package/src/parser/inline/media.ts +8 -7
  65. package/src/parser/inline/reference.ts +12 -18
  66. package/src/parser/inline/ruby.ts +4 -3
  67. package/src/parser/inline/shortmedia.ts +3 -2
  68. package/src/parser/inline/strong.ts +5 -4
  69. package/src/parser/inline/template.test.ts +1 -1
  70. package/src/parser/inline/template.ts +9 -6
  71. package/src/parser/inline.test.ts +2 -0
  72. package/src/parser/locale.ts +6 -7
  73. package/src/parser/processor/footnote.ts +5 -3
  74. package/src/parser/source/text.ts +1 -1
  75. package/src/parser/util.ts +0 -220
  76. package/src/parser/visibility.ts +205 -0
  77. package/src/util/info.ts +4 -2
  78. package/src/util/quote.ts +12 -15
  79. package/src/util/toc.ts +14 -17
  80. package/webpack.config.js +1 -0
  81. package/src/combinator/control/manipulation/context.ts +0 -70
  82. package/src/combinator/control/manipulation/resource.ts +0 -54
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.257.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.258.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -882,6 +882,157 @@ exports.MultiMap = MultiMap;
882
882
 
883
883
  /***/ }),
884
884
 
885
+ /***/ 8099:
886
+ /***/ ((__unused_webpack_module, exports) => {
887
+
888
+ "use strict";
889
+
890
+
891
+ Object.defineProperty(exports, "__esModule", ({
892
+ value: true
893
+ }));
894
+ exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0;
895
+
896
+ function duff(count, proc) {
897
+ if (count > 0) {
898
+ let i = 0,
899
+ m = count % 8,
900
+ d = (count - m) / 8;
901
+
902
+ while (m--) {
903
+ proc(i++);
904
+ }
905
+
906
+ while (d--) {
907
+ proc(i++);
908
+ proc(i++);
909
+ proc(i++);
910
+ proc(i++);
911
+ proc(i++);
912
+ proc(i++);
913
+ proc(i++);
914
+ proc(i++);
915
+ }
916
+ } else {
917
+ let i = -count,
918
+ m = i % 8,
919
+ d = (i - m) / 8;
920
+
921
+ while (m--) {
922
+ proc(--i);
923
+ }
924
+
925
+ while (d--) {
926
+ proc(--i);
927
+ proc(--i);
928
+ proc(--i);
929
+ proc(--i);
930
+ proc(--i);
931
+ proc(--i);
932
+ proc(--i);
933
+ proc(--i);
934
+ }
935
+ }
936
+ }
937
+
938
+ exports.duff = duff;
939
+
940
+ function duffbk(count, proc) {
941
+ if (count > 0) {
942
+ let i = 0,
943
+ m = count % 8,
944
+ d = (count - m) / 8;
945
+
946
+ while (m--) {
947
+ if (proc(i++) === false) return;
948
+ }
949
+
950
+ while (d--) {
951
+ if (proc(i++) === false) return;
952
+ if (proc(i++) === false) return;
953
+ if (proc(i++) === false) return;
954
+ if (proc(i++) === false) return;
955
+ if (proc(i++) === false) return;
956
+ if (proc(i++) === false) return;
957
+ if (proc(i++) === false) return;
958
+ if (proc(i++) === false) return;
959
+ }
960
+ } else {
961
+ let i = -count,
962
+ m = i % 8,
963
+ d = (i - m) / 8;
964
+
965
+ while (m--) {
966
+ if (proc(--i) === false) return;
967
+ }
968
+
969
+ while (d--) {
970
+ if (proc(--i) === false) return;
971
+ if (proc(--i) === false) return;
972
+ if (proc(--i) === false) return;
973
+ if (proc(--i) === false) return;
974
+ if (proc(--i) === false) return;
975
+ if (proc(--i) === false) return;
976
+ if (proc(--i) === false) return;
977
+ if (proc(--i) === false) return;
978
+ }
979
+ }
980
+ }
981
+
982
+ exports.duffbk = duffbk;
983
+
984
+ function duffEach(array, proc) {
985
+ let count = array.length;
986
+ let i = 0,
987
+ m = count % 8,
988
+ d = (count - m) / 8;
989
+
990
+ while (m--) {
991
+ proc(array[i], i++, array);
992
+ }
993
+
994
+ while (d--) {
995
+ proc(array[i], i++, array);
996
+ proc(array[i], i++, array);
997
+ proc(array[i], i++, array);
998
+ proc(array[i], i++, array);
999
+ proc(array[i], i++, array);
1000
+ proc(array[i], i++, array);
1001
+ proc(array[i], i++, array);
1002
+ proc(array[i], i++, array);
1003
+ }
1004
+ }
1005
+
1006
+ exports.duffEach = duffEach;
1007
+
1008
+ function duffReduce(array, proc, initial) {
1009
+ let count = array.length;
1010
+ let i = 0,
1011
+ m = count % 8,
1012
+ d = (count - m) / 8;
1013
+
1014
+ while (m--) {
1015
+ initial = proc(initial, array[i], i++, array);
1016
+ }
1017
+
1018
+ while (d--) {
1019
+ initial = proc(initial, array[i], i++, array);
1020
+ initial = proc(initial, array[i], i++, array);
1021
+ initial = proc(initial, array[i], i++, array);
1022
+ initial = proc(initial, array[i], i++, array);
1023
+ initial = proc(initial, array[i], i++, array);
1024
+ initial = proc(initial, array[i], i++, array);
1025
+ initial = proc(initial, array[i], i++, array);
1026
+ initial = proc(initial, array[i], i++, array);
1027
+ }
1028
+
1029
+ return initial;
1030
+ }
1031
+
1032
+ exports.duffReduce = duffReduce;
1033
+
1034
+ /***/ }),
1035
+
885
1036
  /***/ 7822:
886
1037
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
887
1038
 
@@ -1920,6 +2071,8 @@ __exportStar(__webpack_require__(7005), exports);
1920
2071
 
1921
2072
  __exportStar(__webpack_require__(5418), exports);
1922
2073
 
2074
+ __exportStar(__webpack_require__(5684), exports);
2075
+
1923
2076
  __exportStar(__webpack_require__(2804), exports);
1924
2077
 
1925
2078
  __exportStar(__webpack_require__(9315), exports);
@@ -1932,10 +2085,6 @@ __exportStar(__webpack_require__(9758), exports);
1932
2085
 
1933
2086
  __exportStar(__webpack_require__(1411), exports);
1934
2087
 
1935
- __exportStar(__webpack_require__(8059), exports);
1936
-
1937
- __exportStar(__webpack_require__(1325), exports);
1938
-
1939
2088
  __exportStar(__webpack_require__(7130), exports);
1940
2089
 
1941
2090
  __exportStar(__webpack_require__(8927), exports);
@@ -2090,7 +2239,7 @@ exports.isEmpty = isEmpty;
2090
2239
 
2091
2240
  /***/ }),
2092
2241
 
2093
- /***/ 8059:
2242
+ /***/ 7957:
2094
2243
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2095
2244
 
2096
2245
  "use strict";
@@ -2099,92 +2248,20 @@ exports.isEmpty = isEmpty;
2099
2248
  Object.defineProperty(exports, "__esModule", ({
2100
2249
  value: true
2101
2250
  }));
2102
- exports.precedence = exports.context = exports.reset = exports.guard = void 0;
2251
+ exports.convert = void 0;
2103
2252
 
2104
2253
  const global_1 = __webpack_require__(4128);
2105
2254
 
2106
- const alias_1 = __webpack_require__(5406);
2107
-
2108
- const assign_1 = __webpack_require__(4401);
2109
-
2110
- const type_1 = __webpack_require__(5177);
2111
-
2112
- const memoize_1 = __webpack_require__(1808);
2113
-
2114
- function guard(f, parser) {
2115
- return (source, context) => f(context) ? parser(source, context) : global_1.undefined;
2116
- }
2117
-
2118
- exports.guard = guard;
2119
-
2120
- function reset(base, parser) {
2121
- return (source, context) => parser(source, inherit((0, alias_1.ObjectCreate)(context), base));
2122
- }
2123
-
2124
- exports.reset = reset;
2125
-
2126
- function context(base, parser) {
2127
- const override = (0, memoize_1.memoize)(context => inherit((0, alias_1.ObjectCreate)(context), base), new global_1.WeakMap());
2128
- return (source, context) => parser(source, override(context));
2129
- }
2130
-
2131
- exports.context = context;
2132
- const inherit = (0, assign_1.template)((prop, target, source) => {
2133
- //assert(Object.freeze(source));
2134
- if (target[prop] === source[prop]) return;
2135
-
2136
- switch (prop) {
2137
- case 'resources':
2138
- if (prop in target && !(0, alias_1.hasOwnProperty)(target, prop)) return;
2139
- return target[prop] = (0, alias_1.ObjectCreate)(source[prop]);
2140
- }
2141
-
2142
- switch ((0, type_1.type)(source[prop])) {
2143
- case 'Object':
2144
- //assert(Object.freeze(source[prop]));
2145
- switch ((0, type_1.type)(target[prop])) {
2146
- case 'Object':
2147
- return target[prop] = inherit((0, alias_1.ObjectCreate)(target[prop]), source[prop]);
2148
-
2149
- default:
2150
- return target[prop] = source[prop];
2151
- }
2152
-
2153
- default:
2154
- return target[prop] = source[prop];
2155
- }
2156
- });
2157
-
2158
- function precedence(precedence, parser) {
2159
- return (source, context) => {
2160
- const p = context.precedence;
2161
- context.precedence = precedence;
2162
- const result = parser(source, context);
2163
- context.precedence = p;
2164
- return result;
2165
- };
2166
- }
2167
-
2168
- exports.precedence = precedence;
2169
-
2170
- /***/ }),
2171
-
2172
- /***/ 7957:
2173
- /***/ ((__unused_webpack_module, exports) => {
2174
-
2175
- "use strict";
2176
-
2177
-
2178
- Object.defineProperty(exports, "__esModule", ({
2179
- value: true
2180
- }));
2181
- exports.convert = void 0;
2182
-
2183
2255
  function convert(conv, parser) {
2184
- return (source, context) => {
2256
+ return (source, context = {}) => {
2185
2257
  if (source === '') return;
2186
2258
  source = conv(source);
2187
- return source === '' ? [[], ''] : parser(source, context);
2259
+ if (source === '') return [[], ''];
2260
+ const memo = context.memo;
2261
+ context.memo = global_1.undefined;
2262
+ const result = parser(source, context);
2263
+ context.memo = memo;
2264
+ return result;
2188
2265
  };
2189
2266
  }
2190
2267
 
@@ -2423,87 +2500,6 @@ exports.recover = recover;
2423
2500
 
2424
2501
  /***/ }),
2425
2502
 
2426
- /***/ 1325:
2427
- /***/ ((__unused_webpack_module, exports) => {
2428
-
2429
- "use strict";
2430
-
2431
-
2432
- Object.defineProperty(exports, "__esModule", ({
2433
- value: true
2434
- }));
2435
- exports.recursion = exports.uncreator = exports.creator = void 0;
2436
-
2437
- function creator(cost, parser) {
2438
- if (typeof cost === 'function') return creator(1, cost);
2439
- return (source, context) => {
2440
- const {
2441
- resources = {
2442
- budget: 1,
2443
- recursion: 1
2444
- }
2445
- } = context;
2446
- if (resources.budget <= 0) throw new Error('Too many creations');
2447
- if (resources.recursion <= 0) throw new Error('Too much recursion');
2448
- --resources.recursion;
2449
- const result = parser(source, context);
2450
- ++resources.recursion;
2451
-
2452
- if (result) {
2453
- resources.budget -= cost;
2454
- }
2455
-
2456
- return result;
2457
- };
2458
- }
2459
-
2460
- exports.creator = creator;
2461
-
2462
- function uncreator(cost, parser) {
2463
- if (typeof cost === 'function') return uncreator(1, cost);
2464
- return (source, context) => {
2465
- const {
2466
- resources = {
2467
- budget: 1,
2468
- recursion: 1
2469
- }
2470
- } = context;
2471
- if (resources.budget <= 0) throw new Error('Too many creations');
2472
- if (resources.recursion <= 0) throw new Error('Too much recursion');
2473
- ++resources.recursion;
2474
- const result = parser(source, context);
2475
- --resources.recursion;
2476
-
2477
- if (result) {
2478
- resources.budget += cost;
2479
- }
2480
-
2481
- return result;
2482
- };
2483
- }
2484
-
2485
- exports.uncreator = uncreator;
2486
-
2487
- function recursion(cost, parser) {
2488
- if (typeof cost === 'function') return recursion(1, cost);
2489
- return (source, context) => {
2490
- const {
2491
- resources = {
2492
- recursion: 1
2493
- }
2494
- } = context;
2495
- if (resources.recursion <= 0) throw new Error('Too much recursion');
2496
- --resources.recursion;
2497
- const result = parser(source, context);
2498
- ++resources.recursion;
2499
- return result;
2500
- };
2501
- }
2502
-
2503
- exports.recursion = recursion;
2504
-
2505
- /***/ }),
2506
-
2507
2503
  /***/ 1109:
2508
2504
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2509
2505
 
@@ -2542,11 +2538,14 @@ const parser_1 = __webpack_require__(6728);
2542
2538
 
2543
2539
  function focus(scope, parser) {
2544
2540
  const match = typeof scope === 'string' ? source => source.slice(0, scope.length) === scope ? scope : '' : source => source.match(scope)?.[0] ?? '';
2545
- return (source, context) => {
2541
+ return (source, context = {}) => {
2546
2542
  if (source === '') return;
2547
2543
  const src = match(source);
2548
2544
  if (src === '') return;
2545
+ const memo = context.memo;
2546
+ context.memo = global_1.undefined;
2549
2547
  const result = parser(src, context);
2548
+ context.memo = memo;
2550
2549
  if (!result) return;
2551
2550
  return (0, parser_1.exec)(result).length < src.length ? [(0, parser_1.eval)(result), (0, parser_1.exec)(result) + source.slice(src.length)] : global_1.undefined;
2552
2551
  };
@@ -2555,12 +2554,17 @@ function focus(scope, parser) {
2555
2554
  exports.focus = focus;
2556
2555
 
2557
2556
  function rewrite(scope, parser) {
2558
- return (source, context) => {
2557
+ return (source, context = {}) => {
2559
2558
  if (source === '') return;
2559
+ const memo = context.memo;
2560
+ context.memo = global_1.undefined;
2560
2561
  const res1 = scope(source, context);
2562
+ context.memo = memo;
2561
2563
  if (!res1 || (0, parser_1.exec)(res1).length >= source.length) return;
2562
2564
  const src = source.slice(0, source.length - (0, parser_1.exec)(res1).length);
2565
+ context.memo = global_1.undefined;
2563
2566
  const res2 = parser(src, context);
2567
+ context.memo = memo;
2564
2568
  if (!res2) return;
2565
2569
  return (0, parser_1.exec)(res2).length < src.length ? [(0, parser_1.eval)(res2), (0, parser_1.exec)(res2) + (0, parser_1.exec)(res1)] : global_1.undefined;
2566
2570
  };
@@ -2748,63 +2752,7 @@ exports.fmap = fmap;
2748
2752
  Object.defineProperty(exports, "__esModule", ({
2749
2753
  value: true
2750
2754
  }));
2751
- exports.check = exports.exec = exports.eval = exports.Delimiters = void 0;
2752
-
2753
- class Delimiters {
2754
- constructor() {
2755
- this.matchers = [];
2756
- this.registry = {};
2757
- this.length = 0;
2758
- }
2759
-
2760
- push(...delimiters) {
2761
- for (let i = 0; i < delimiters.length; ++i) {
2762
- const delimiter = delimiters[i];
2763
- const {
2764
- signature,
2765
- matcher,
2766
- precedence = 1
2767
- } = delimiter;
2768
-
2769
- if (!this.registry[signature]) {
2770
- this.matchers.unshift([this.length, signature, precedence, matcher]);
2771
- this.registry[signature] = true;
2772
- }
2773
-
2774
- ++this.length;
2775
- }
2776
- }
2777
-
2778
- pop(count = 1) {
2779
- for (let i = 0; i < count; ++i) {
2780
- if (--this.length === this.matchers[0][0]) {
2781
- this.registry[this.matchers.shift()[1]] = false;
2782
- }
2783
- }
2784
- }
2785
-
2786
- match(source, precedence = 1) {
2787
- const {
2788
- matchers
2789
- } = this;
2790
-
2791
- for (let i = 0; i < matchers.length; ++i) {
2792
- switch (matchers[i][3](source)) {
2793
- case true:
2794
- if (precedence < matchers[i][2]) return true;
2795
- continue;
2796
-
2797
- case false:
2798
- return false;
2799
- }
2800
- }
2801
-
2802
- return false;
2803
- }
2804
-
2805
- }
2806
-
2807
- exports.Delimiters = Delimiters;
2755
+ exports.check = exports.exec = exports.eval = void 0;
2808
2756
 
2809
2757
  function eval_(result, default_) {
2810
2758
  return result ? result[0] : default_;
@@ -2826,7 +2774,329 @@ exports.check = check;
2826
2774
 
2827
2775
  /***/ }),
2828
2776
 
2829
- /***/ 2491:
2777
+ /***/ 5684:
2778
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2779
+
2780
+ "use strict";
2781
+
2782
+
2783
+ Object.defineProperty(exports, "__esModule", ({
2784
+ value: true
2785
+ }));
2786
+ exports.state = exports.guard = exports.precedence = exports.creator = exports.syntax = exports.context = exports.reset = void 0;
2787
+
2788
+ const global_1 = __webpack_require__(4128);
2789
+
2790
+ const alias_1 = __webpack_require__(5406);
2791
+
2792
+ const parser_1 = __webpack_require__(6728);
2793
+
2794
+ const memo_1 = __webpack_require__(1090);
2795
+
2796
+ function reset(base, parser) {
2797
+ const changes = global_1.Object.entries(base);
2798
+ const values = (0, global_1.Array)(changes.length);
2799
+ return (source, context) => apply(parser, source, (0, alias_1.ObjectCreate)(context), changes, values);
2800
+ }
2801
+
2802
+ exports.reset = reset;
2803
+
2804
+ function context(base, parser) {
2805
+ const changes = global_1.Object.entries(base);
2806
+ const values = (0, global_1.Array)(changes.length);
2807
+ return (source, context) => apply(parser, source, context, changes, values);
2808
+ }
2809
+
2810
+ exports.context = context;
2811
+
2812
+ function apply(parser, source, context, changes, values) {
2813
+ if (context) for (let i = 0; i < changes.length; ++i) {
2814
+ const change = changes[i];
2815
+ const prop = change[0];
2816
+
2817
+ switch (prop) {
2818
+ case 'resources':
2819
+ if (prop in context && !(0, alias_1.hasOwnProperty)(context, prop)) break; // @ts-expect-error
2820
+
2821
+ context[prop] = (0, alias_1.ObjectCreate)(change[1]);
2822
+ break;
2823
+
2824
+ default:
2825
+ values[i] = context[prop];
2826
+ context[prop] = change[1];
2827
+ }
2828
+ }
2829
+ const result = parser(source, context);
2830
+ if (context) for (let i = 0; i < changes.length; ++i) {
2831
+ const change = changes[i];
2832
+ const prop = change[0];
2833
+
2834
+ switch (prop) {
2835
+ case 'resources':
2836
+ break;
2837
+
2838
+ default:
2839
+ context[prop] = values[i];
2840
+ values[i] = global_1.undefined;
2841
+ }
2842
+ }
2843
+ return result;
2844
+ }
2845
+
2846
+ function syntax(syntax, precedence, cost, parser) {
2847
+ if (typeof cost === 'function') {
2848
+ parser = cost;
2849
+ cost = 1;
2850
+ }
2851
+
2852
+ return (source, context) => {
2853
+ if (source === '') return;
2854
+ const r = context.rule ?? 0;
2855
+ context.rule = r | syntax;
2856
+ context.backtrackable ??= ~0;
2857
+ context.state ??= 0;
2858
+ const p = context.precedence;
2859
+ context.precedence = precedence;
2860
+ const {
2861
+ resources = {
2862
+ budget: 1,
2863
+ recursion: 1
2864
+ }
2865
+ } = context;
2866
+ if (resources.budget <= 0) throw new Error('Too many creations');
2867
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2868
+ --resources.recursion;
2869
+ const pos = source.length;
2870
+ const cache = context.memo?.get(pos, context.rule, syntax, context.state);
2871
+ const result = cache ? [cache[0], source.slice(cache[1])] : parser(source, context);
2872
+ ++resources.recursion;
2873
+
2874
+ if (result) {
2875
+ if (!cache) {
2876
+ resources.budget -= cost;
2877
+ }
2878
+
2879
+ if (syntax) {
2880
+ if (r & context.backtrackable) {
2881
+ context.memo ??= new memo_1.Memo();
2882
+ cache ?? context.memo.set(pos, context.rule, syntax, context.state, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result).length);
2883
+ } else if (context.memo?.length >= pos) {
2884
+ context.memo.clear(pos);
2885
+ }
2886
+ }
2887
+ }
2888
+
2889
+ context.precedence = p;
2890
+ context.rule = r;
2891
+ return result;
2892
+ };
2893
+ }
2894
+
2895
+ exports.syntax = syntax;
2896
+
2897
+ function creator(cost, parser) {
2898
+ if (typeof cost === 'function') return creator(1, cost);
2899
+ return (source, context) => {
2900
+ const {
2901
+ resources = {
2902
+ budget: 1,
2903
+ recursion: 1
2904
+ }
2905
+ } = context;
2906
+ if (resources.budget <= 0) throw new Error('Too many creations');
2907
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2908
+ --resources.recursion;
2909
+ const result = parser(source, context);
2910
+ ++resources.recursion;
2911
+
2912
+ if (result) {
2913
+ resources.budget -= cost;
2914
+ }
2915
+
2916
+ return result;
2917
+ };
2918
+ }
2919
+
2920
+ exports.creator = creator;
2921
+
2922
+ function precedence(precedence, parser) {
2923
+ return (source, context) => {
2924
+ const p = context.precedence;
2925
+ context.precedence = precedence;
2926
+ const result = parser(source, context);
2927
+ context.precedence = p;
2928
+ return result;
2929
+ };
2930
+ }
2931
+
2932
+ exports.precedence = precedence;
2933
+
2934
+ function guard(f, parser) {
2935
+ return (source, context) => f(context) ? parser(source, context) : global_1.undefined;
2936
+ }
2937
+
2938
+ exports.guard = guard;
2939
+
2940
+ function state(state, positive, parser) {
2941
+ if (typeof positive === 'function') {
2942
+ parser = positive;
2943
+ positive = true;
2944
+ }
2945
+
2946
+ return (source, context) => {
2947
+ const s = context.state ?? 0;
2948
+ context.state = positive ? s | state : s & ~state;
2949
+ const result = parser(source, context);
2950
+ context.state = s;
2951
+ return result;
2952
+ };
2953
+ }
2954
+
2955
+ exports.state = state;
2956
+
2957
+ /***/ }),
2958
+
2959
+ /***/ 1435:
2960
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2961
+
2962
+ "use strict";
2963
+
2964
+
2965
+ var _a;
2966
+
2967
+ Object.defineProperty(exports, "__esModule", ({
2968
+ value: true
2969
+ }));
2970
+ exports.Delimiters = void 0;
2971
+
2972
+ const memoize_1 = __webpack_require__(1808);
2973
+
2974
+ class Delimiters {
2975
+ constructor() {
2976
+ this.matchers = [];
2977
+ this.registry = {};
2978
+ this.length = 0;
2979
+ }
2980
+
2981
+ static signature(pattern) {
2982
+ switch (typeof pattern) {
2983
+ case 'undefined':
2984
+ return `undefined`;
2985
+
2986
+ case 'string':
2987
+ return `s:${pattern}`;
2988
+
2989
+ case 'object':
2990
+ return `r/${pattern.source}/${pattern.flags}`;
2991
+ }
2992
+ }
2993
+
2994
+ push(...delimiters) {
2995
+ for (let i = 0; i < delimiters.length; ++i) {
2996
+ const delimiter = delimiters[i];
2997
+ const {
2998
+ signature,
2999
+ matcher,
3000
+ precedence = 1
3001
+ } = delimiter;
3002
+
3003
+ if (!this.registry[signature]) {
3004
+ this.matchers.unshift([this.length, signature, precedence, matcher]);
3005
+ this.registry[signature] = true;
3006
+ }
3007
+
3008
+ ++this.length;
3009
+ }
3010
+ }
3011
+
3012
+ pop(count = 1) {
3013
+ for (let i = 0; i < count; ++i) {
3014
+ if (--this.length === this.matchers[0][0]) {
3015
+ this.registry[this.matchers.shift()[1]] = false;
3016
+ }
3017
+ }
3018
+ }
3019
+
3020
+ match(source, precedence = 1) {
3021
+ const {
3022
+ matchers
3023
+ } = this;
3024
+
3025
+ for (let i = 0; i < matchers.length; ++i) {
3026
+ switch (matchers[i][3](source)) {
3027
+ case true:
3028
+ if (precedence < matchers[i][2]) return true;
3029
+ continue;
3030
+
3031
+ case false:
3032
+ return false;
3033
+ }
3034
+ }
3035
+
3036
+ return false;
3037
+ }
3038
+
3039
+ }
3040
+
3041
+ exports.Delimiters = Delimiters;
3042
+ _a = Delimiters;
3043
+ Delimiters.matcher = (0, memoize_1.memoize)(pattern => {
3044
+ switch (typeof pattern) {
3045
+ case 'undefined':
3046
+ return () => undefined;
3047
+
3048
+ case 'string':
3049
+ return source => source.slice(0, pattern.length) === pattern || undefined;
3050
+
3051
+ case 'object':
3052
+ return (0, memoize_1.reduce)(source => pattern.test(source) || undefined);
3053
+ }
3054
+ }, _a.signature);
3055
+
3056
+ /***/ }),
3057
+
3058
+ /***/ 1090:
3059
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3060
+
3061
+ "use strict";
3062
+
3063
+
3064
+ Object.defineProperty(exports, "__esModule", ({
3065
+ value: true
3066
+ }));
3067
+ exports.Memo = void 0;
3068
+
3069
+ const array_1 = __webpack_require__(8112);
3070
+
3071
+ class Memo {
3072
+ constructor() {
3073
+ this.memory = [];
3074
+ }
3075
+
3076
+ get length() {
3077
+ return this.memory.length;
3078
+ }
3079
+
3080
+ get(position, rule, syntax, state) {
3081
+ return this.memory[position - 1]?.[`${rule}:${syntax}:${state}`];
3082
+ }
3083
+
3084
+ set(position, rule, syntax, state, nodes, offset) {
3085
+ const record = this.memory[position - 1] ??= {};
3086
+ record[`${rule}:${syntax}:${state}`] = [nodes, offset];
3087
+ }
3088
+
3089
+ clear(position) {
3090
+ (0, array_1.splice)(this.memory, position, this.memory.length - position);
3091
+ }
3092
+
3093
+ }
3094
+
3095
+ exports.Memo = Memo;
3096
+
3097
+ /***/ }),
3098
+
3099
+ /***/ 2491:
2830
3100
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2831
3101
 
2832
3102
  "use strict";
@@ -2851,6 +3121,7 @@ function inits(parsers) {
2851
3121
 
2852
3122
  for (let i = 0, len = parsers.length; i < len; ++i) {
2853
3123
  if (rest === '') break;
3124
+ if (context.delimiters?.match(rest, context.precedence)) break;
2854
3125
  const result = parsers[i](rest, context);
2855
3126
  if (!result) break;
2856
3127
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -2890,6 +3161,7 @@ function sequence(parsers) {
2890
3161
 
2891
3162
  for (let i = 0, len = parsers.length; i < len; ++i) {
2892
3163
  if (rest === '') return;
3164
+ if (context.delimiters?.match(rest, context.precedence)) return;
2893
3165
  const result = parsers[i](rest, context);
2894
3166
  if (!result) return;
2895
3167
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -2919,42 +3191,16 @@ const global_1 = __webpack_require__(4128);
2919
3191
 
2920
3192
  const parser_1 = __webpack_require__(6728);
2921
3193
 
2922
- const memoize_1 = __webpack_require__(1808);
3194
+ const delimiter_1 = __webpack_require__(1435);
2923
3195
 
2924
3196
  const array_1 = __webpack_require__(8112);
2925
3197
 
2926
- const signature = pattern => {
2927
- switch (typeof pattern) {
2928
- case 'undefined':
2929
- return signature('');
2930
-
2931
- case 'string':
2932
- return `s:${pattern}`;
2933
-
2934
- case 'object':
2935
- return `r/${pattern.source}/${pattern.flags}`;
2936
- }
2937
- };
2938
-
2939
- const matcher = (0, memoize_1.memoize)(pattern => {
2940
- switch (typeof pattern) {
2941
- case 'undefined':
2942
- return () => global_1.undefined;
2943
-
2944
- case 'string':
2945
- return source => source.slice(0, pattern.length) === pattern || global_1.undefined;
2946
-
2947
- case 'object':
2948
- return (0, memoize_1.reduce)(source => pattern.test(source) || global_1.undefined);
2949
- }
2950
- }, signature);
2951
-
2952
- function some(parser, until, deeps = [], limit = -1) {
2953
- if (typeof until === 'number') return some(parser, global_1.undefined, deeps, until);
2954
- const match = matcher(until);
2955
- const delimiters = deeps.map(([delimiter, precedence]) => ({
2956
- signature: signature(delimiter),
2957
- matcher: matcher(delimiter),
3198
+ function some(parser, end, delimiters = [], limit = -1) {
3199
+ if (typeof end === 'number') return some(parser, global_1.undefined, delimiters, end);
3200
+ const match = delimiter_1.Delimiters.matcher(end);
3201
+ const delims = delimiters.map(([delimiter, precedence]) => ({
3202
+ signature: delimiter_1.Delimiters.signature(delimiter),
3203
+ matcher: delimiter_1.Delimiters.matcher(delimiter),
2958
3204
  precedence
2959
3205
  }));
2960
3206
  return (source, context) => {
@@ -2962,9 +3208,9 @@ function some(parser, until, deeps = [], limit = -1) {
2962
3208
  let rest = source;
2963
3209
  let nodes;
2964
3210
 
2965
- if (delimiters.length > 0) {
2966
- context.delimiters ??= new parser_1.Delimiters();
2967
- context.delimiters.push(...delimiters);
3211
+ if (delims.length > 0) {
3212
+ context.delimiters ??= new delimiter_1.Delimiters();
3213
+ context.delimiters.push(...delims);
2968
3214
  }
2969
3215
 
2970
3216
  while (true) {
@@ -2978,8 +3224,8 @@ function some(parser, until, deeps = [], limit = -1) {
2978
3224
  if (limit >= 0 && source.length - rest.length > limit) break;
2979
3225
  }
2980
3226
 
2981
- if (delimiters.length > 0) {
2982
- context.delimiters.pop(delimiters.length);
3227
+ if (delims.length > 0) {
3228
+ context.delimiters.pop(delims.length);
2983
3229
  }
2984
3230
 
2985
3231
  return nodes && rest.length < source.length ? [nodes, rest] : global_1.undefined;
@@ -3191,11 +3437,13 @@ const global_1 = __webpack_require__(4128);
3191
3437
 
3192
3438
  const parser_1 = __webpack_require__(6728);
3193
3439
 
3440
+ const segment_1 = __webpack_require__(9002);
3441
+
3194
3442
  const header_1 = __webpack_require__(5702);
3195
3443
 
3196
3444
  const block_1 = __webpack_require__(4032);
3197
3445
 
3198
- const segment_1 = __webpack_require__(9002);
3446
+ const context_1 = __webpack_require__(6484);
3199
3447
 
3200
3448
  const normalize_1 = __webpack_require__(185);
3201
3449
 
@@ -3211,7 +3459,8 @@ const array_1 = __webpack_require__(8112);
3211
3459
 
3212
3460
  function bind(target, settings) {
3213
3461
  let context = { ...settings,
3214
- host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin)
3462
+ host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3463
+ backtrackable: context_1.backtrackable
3215
3464
  };
3216
3465
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3217
3466
  const blocks = [];
@@ -3353,9 +3602,8 @@ function bind(target, settings) {
3353
3602
 
3354
3603
  function nearest(index) {
3355
3604
  let el;
3356
- let len = 0;
3357
3605
 
3358
- for (let i = 0; i < blocks.length; ++i) {
3606
+ for (let i = 0, len = 0; i < blocks.length; ++i) {
3359
3607
  const block = blocks[i];
3360
3608
  len += block[0].length;
3361
3609
  el = block[1][0] ?? el;
@@ -3366,9 +3614,7 @@ function bind(target, settings) {
3366
3614
  }
3367
3615
 
3368
3616
  function index(source) {
3369
- let len = 0;
3370
-
3371
- for (let i = 0; i < blocks.length; ++i) {
3617
+ for (let i = 0, len = 0; i < blocks.length; ++i) {
3372
3618
  const block = blocks[i];
3373
3619
  if (block[1].includes(source)) return len;
3374
3620
  len += block[0].length;
@@ -3542,11 +3788,13 @@ const global_1 = __webpack_require__(4128);
3542
3788
 
3543
3789
  const parser_1 = __webpack_require__(6728);
3544
3790
 
3791
+ const segment_1 = __webpack_require__(9002);
3792
+
3545
3793
  const header_1 = __webpack_require__(5702);
3546
3794
 
3547
3795
  const block_1 = __webpack_require__(4032);
3548
3796
 
3549
- const segment_1 = __webpack_require__(9002);
3797
+ const context_1 = __webpack_require__(6484);
3550
3798
 
3551
3799
  const normalize_1 = __webpack_require__(185);
3552
3800
 
@@ -3571,7 +3819,8 @@ function parse(source, opts = {}, context) {
3571
3819
  caches: context?.caches,
3572
3820
  ...(context?.resources && {
3573
3821
  resources: context.resources
3574
- })
3822
+ }),
3823
+ backtrackable: context_1.backtrackable
3575
3824
  };
3576
3825
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3577
3826
  const node = (0, dom_1.frag)();
@@ -3669,7 +3918,7 @@ const random_1 = __webpack_require__(7325);
3669
3918
  exports.block = (0, combinator_1.creator)(error((0, combinator_1.reset)({
3670
3919
  resources: {
3671
3920
  budget: 50 * 1000,
3672
- recursion: 20 + 1
3921
+ recursion: 20
3673
3922
  }
3674
3923
  }, (0, combinator_1.union)([source_1.emptyline, horizontalrule_1.horizontalrule, heading_1.heading, ulist_1.ulist, olist_1.olist, ilist_1.ilist, dlist_1.dlist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, extension_1.extension, sidefence_1.sidefence, blockquote_1.blockquote, reply_1.reply, paragraph_1.paragraph]))));
3675
3924
 
@@ -3824,26 +4073,27 @@ const source_1 = __webpack_require__(6743);
3824
4073
 
3825
4074
  const locale_1 = __webpack_require__(5485);
3826
4075
 
3827
- const util_1 = __webpack_require__(9437);
4076
+ const visibility_1 = __webpack_require__(7618);
3828
4077
 
3829
4078
  const dom_1 = __webpack_require__(3252);
3830
4079
 
3831
4080
  const array_1 = __webpack_require__(8112);
3832
4081
 
3833
- exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.context)({
3834
- syntax: {
3835
- inline: {
3836
- annotation: false,
3837
- reference: false,
3838
- index: false,
3839
- label: false,
3840
- link: false,
3841
- media: false
3842
- }
3843
- }
3844
- }, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))]))));
3845
- const term = (0, combinator_1.creator)((0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', (0, dom_1.defrag)(ns))]))));
3846
- const desc = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, util_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('dd', (0, dom_1.defrag)(ns))]), false));
4082
+ exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(64
4083
+ /* State.annotation */
4084
+ | 32
4085
+ /* State.reference */
4086
+ | 16
4087
+ /* State.index */
4088
+ | 8
4089
+ /* State.label */
4090
+ | 4
4091
+ /* State.link */
4092
+ | 2
4093
+ /* State.media */
4094
+ , (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))]))));
4095
+ const term = (0, combinator_1.creator)((0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', (0, dom_1.defrag)(ns))]))));
4096
+ const desc = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, visibility_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('dd', (0, dom_1.defrag)(ns))]), false));
3847
4097
 
3848
4098
  function fillTrailingDescription(es) {
3849
4099
  return es.length > 0 && es[es.length - 1].tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
@@ -4120,7 +4370,7 @@ const inline_1 = __webpack_require__(1160);
4120
4370
 
4121
4371
  const locale_1 = __webpack_require__(5485);
4122
4372
 
4123
- const util_1 = __webpack_require__(9437);
4373
+ const visibility_1 = __webpack_require__(7618);
4124
4374
 
4125
4375
  const dom_1 = __webpack_require__(3252);
4126
4376
 
@@ -4128,13 +4378,9 @@ const memoize_1 = __webpack_require__(1808);
4128
4378
 
4129
4379
  exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n])?(?=\[?\$)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([// All parsers which can include closing terms.
4130
4380
  (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, [])));
4131
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.context)({
4132
- syntax: {
4133
- inline: {
4134
- media: false
4135
- }
4136
- }
4137
- }, (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.trimEnd)((0, combinator_1.some)(inline_1.inline)))))))])])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4381
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.state)(2
4382
+ /* State.media */
4383
+ , (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.trimEnd)((0, combinator_1.some)(inline_1.inline)))))))])])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4138
4384
  class: 'figindex'
4139
4385
  }), (0, dom_1.html)('span', {
4140
4386
  class: 'figtext'
@@ -4380,7 +4626,7 @@ const source_1 = __webpack_require__(6743);
4380
4626
 
4381
4627
  const locale_1 = __webpack_require__(5485);
4382
4628
 
4383
- const util_1 = __webpack_require__(9437);
4629
+ const visibility_1 = __webpack_require__(7618);
4384
4630
 
4385
4631
  const dom_1 = __webpack_require__(3252);
4386
4632
 
@@ -4421,8 +4667,8 @@ const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.
4421
4667
  const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
4422
4668
  const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([s]) => s.split('/').map(s => s.split(''))));
4423
4669
  const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/;
4424
- const head = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4425
- const data = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4670
+ const head = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4671
+ const data = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4426
4672
  const dataline = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/^!+\s/, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)]))));
4427
4673
 
4428
4674
  function attributes(source) {
@@ -4653,29 +4899,26 @@ const inline_1 = __webpack_require__(1160);
4653
4899
 
4654
4900
  const source_1 = __webpack_require__(6743);
4655
4901
 
4656
- const util_1 = __webpack_require__(9437);
4902
+ const visibility_1 = __webpack_require__(7618);
4657
4903
 
4658
4904
  const dom_1 = __webpack_require__(3252);
4659
4905
 
4660
4906
  exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(source => [[source], ''])))));
4661
- exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.context)({
4662
- syntax: {
4663
- inline: {
4664
- annotation: false,
4665
- reference: false,
4666
- index: false,
4667
- label: false,
4668
- link: false,
4669
- media: false
4670
- }
4671
- }
4672
- }, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.context)({
4673
- syntax: {
4674
- inline: {
4675
- autolink: false
4676
- }
4677
- }
4678
- }, (0, util_1.visualize)((0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
4907
+ exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.state)(64
4908
+ /* State.annotation */
4909
+ | 32
4910
+ /* State.reference */
4911
+ | 16
4912
+ /* State.index */
4913
+ | 8
4914
+ /* State.label */
4915
+ | 4
4916
+ /* State.link */
4917
+ | 2
4918
+ /* State.media */
4919
+ , (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(1
4920
+ /* State.autolink */
4921
+ , (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
4679
4922
  class: 'invalid',
4680
4923
  'data-invalid-syntax': 'heading',
4681
4924
  'data-invalid-type': 'syntax',
@@ -4724,13 +4967,9 @@ const inline_1 = __webpack_require__(1160);
4724
4967
 
4725
4968
  const dom_1 = __webpack_require__(3252);
4726
4969
 
4727
- exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({
4728
- syntax: {
4729
- inline: {
4730
- media: false
4731
- }
4732
- }
4733
- }, exports.ilist_))));
4970
+ exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(2
4971
+ /* State.media */
4972
+ , exports.ilist_))));
4734
4973
  exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^[-+*](?:$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^[-+*](?:$|\s)/, (0, combinator_1.some)(inline_1.inline), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, dom_1.html)('ul', {
4735
4974
  class: 'invalid',
4736
4975
  'data-invalid-syntax': 'list',
@@ -4801,12 +5040,14 @@ const inline_1 = __webpack_require__(1160);
4801
5040
 
4802
5041
  const source_1 = __webpack_require__(6743);
4803
5042
 
4804
- const util_1 = __webpack_require__(9437);
5043
+ const visibility_1 = __webpack_require__(7618);
4805
5044
 
4806
5045
  const dom_1 = __webpack_require__(3252);
4807
5046
 
4808
5047
  const memoize_1 = __webpack_require__(1808);
4809
5048
 
5049
+ const duff_1 = __webpack_require__(8099);
5050
+
4810
5051
  const array_1 = __webpack_require__(8112);
4811
5052
 
4812
5053
  const tuple_1 = __webpack_require__(5341);
@@ -4815,16 +5056,12 @@ const openers = {
4815
5056
  '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
4816
5057
  '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
4817
5058
  };
4818
- exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/.source, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/.source].join('|')), (0, combinator_1.context)({
4819
- syntax: {
4820
- inline: {
4821
- media: false
4822
- }
4823
- }
4824
- }, exports.olist_))));
5059
+ exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/.source, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/.source].join('|')), (0, combinator_1.state)(2
5060
+ /* State.media */
5061
+ , exports.olist_))));
4825
5062
  exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
4826
5063
 
4827
- const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), exports.invalid), ns => [(0, dom_1.html)('li', {
5064
+ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), exports.invalid), ns => [(0, dom_1.html)('li', {
4828
5065
  'data-marker': ns[0] || global_1.undefined
4829
5066
  }, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))]), true)]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
4830
5067
 
@@ -4907,20 +5144,19 @@ function format(el, type, form) {
4907
5144
  'data-type': style(type) || global_1.undefined
4908
5145
  });
4909
5146
  const marker = el.firstElementChild?.getAttribute('data-marker').match(initial(type))?.[0] ?? '';
4910
-
4911
- for (let es = el.children, len = es.length, i = 0; i < len; ++i) {
5147
+ const es = el.children;
5148
+ (0, duff_1.duffbk)(es.length, i => {
4912
5149
  const el = es[i];
4913
5150
 
4914
5151
  switch (el.getAttribute('data-marker')) {
4915
5152
  case '':
4916
5153
  case marker:
4917
5154
  el.removeAttribute('data-marker');
4918
- continue;
5155
+ return;
4919
5156
  }
4920
5157
 
4921
- break;
4922
- }
4923
-
5158
+ return false;
5159
+ });
4924
5160
  return el;
4925
5161
  }
4926
5162
 
@@ -4943,11 +5179,11 @@ const inline_1 = __webpack_require__(1160);
4943
5179
 
4944
5180
  const locale_1 = __webpack_require__(5485);
4945
5181
 
4946
- const util_1 = __webpack_require__(9437);
5182
+ const visibility_1 = __webpack_require__(7618);
4947
5183
 
4948
5184
  const dom_1 = __webpack_require__(3252);
4949
5185
 
4950
- exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, util_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)(ns))])));
5186
+ exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)(ns))])));
4951
5187
 
4952
5188
  /***/ }),
4953
5189
 
@@ -4974,7 +5210,7 @@ const source_1 = __webpack_require__(6743);
4974
5210
 
4975
5211
  const locale_1 = __webpack_require__(5485);
4976
5212
 
4977
- const util_1 = __webpack_require__(9437);
5213
+ const visibility_1 = __webpack_require__(7618);
4978
5214
 
4979
5215
  const dom_1 = __webpack_require__(3252);
4980
5216
 
@@ -4987,7 +5223,7 @@ const array_1 = __webpack_require__(8112);
4987
5223
  */
4988
5224
 
4989
5225
 
4990
- exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, util_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, dom_1.html)('br')]))]))]), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
5226
+ exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, visibility_1.visualize)((0, combinator_1.trimEnd)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, dom_1.html)('br')]))]))]), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
4991
5227
 
4992
5228
  /***/ }),
4993
5229
 
@@ -5146,13 +5382,17 @@ const inline_1 = __webpack_require__(1160);
5146
5382
 
5147
5383
  const source_1 = __webpack_require__(6743);
5148
5384
 
5385
+ const visibility_1 = __webpack_require__(7618);
5386
+
5149
5387
  const dom_1 = __webpack_require__(3252);
5150
5388
 
5389
+ const duff_1 = __webpack_require__(8099);
5390
+
5151
5391
  const array_1 = __webpack_require__(8112);
5152
5392
 
5153
5393
  exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^\|[^\n]*(?:\n\|[^\n]*){2}/, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
5154
5394
 
5155
- const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^\|?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('tr', {
5395
+ const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('tr', {
5156
5396
  class: 'invalid',
5157
5397
  'data-invalid-syntax': 'table-row',
5158
5398
  'data-invalid-type': 'syntax',
@@ -5160,24 +5400,22 @@ const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fal
5160
5400
  }, [(0, dom_1.html)('td', source.replace('\n', ''))])], ''])));
5161
5401
 
5162
5402
  const align = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/^:-+:/, () => [['center'], '']), (0, combinator_1.focus)(/^:-+/, () => [['start'], '']), (0, combinator_1.focus)(/^-+:/, () => [['end'], '']), (0, combinator_1.focus)(/^-+/, () => [[''], ''])])), ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]));
5163
- const cell = (0, combinator_1.surround)(/^\|(?:\\?\s)*(?=\S)/, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /^(?:\\?\s)*(?=\||\\?$)/), /^[^|]*/, true);
5164
- const head = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]));
5165
- const data = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]));
5403
+ const cell = (0, combinator_1.surround)(/^\|\s*(?=\S)/, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /^\|/, [[/^[|\\]?\s*$/, 9]]), /^[^|]*/, true);
5404
+ const head = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))]));
5405
+ const data = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))]));
5166
5406
 
5167
5407
  function format(rows) {
5168
- const aligns = rows[0].classList.contains('invalid') ? [] : (0, array_1.push)([], rows.shift().children).map(el => el.textContent);
5408
+ const aligns = rows[0].classList.contains('invalid') ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5169
5409
 
5170
- for (let i = 0, len = rows.length; i < len; ++i) {
5171
- const cols = rows[i].children;
5172
-
5173
- for (let i = 0, len = cols.length; i < len; ++i) {
5410
+ for (let i = 0; i < rows.length; ++i) {
5411
+ (0, duff_1.duffEach)(rows[i].children, (col, i) => {
5174
5412
  if (i > 0 && !aligns[i]) {
5175
5413
  aligns[i] = aligns[i - 1];
5176
5414
  }
5177
5415
 
5178
- if (!aligns[i]) continue;
5179
- cols[i].setAttribute('align', aligns[i]);
5180
- }
5416
+ if (!aligns[i]) return;
5417
+ col.setAttribute('align', aligns[i]);
5418
+ });
5181
5419
  }
5182
5420
 
5183
5421
  return rows;
@@ -5204,20 +5442,16 @@ const ilist_1 = __webpack_require__(238);
5204
5442
 
5205
5443
  const inline_1 = __webpack_require__(1160);
5206
5444
 
5207
- const util_1 = __webpack_require__(9437);
5445
+ const visibility_1 = __webpack_require__(7618);
5208
5446
 
5209
5447
  const dom_1 = __webpack_require__(3252);
5210
5448
 
5211
5449
  const array_1 = __webpack_require__(8112);
5212
5450
 
5213
- exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({
5214
- syntax: {
5215
- inline: {
5216
- media: false
5217
- }
5218
- }
5219
- }, exports.ulist_))));
5220
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.subsequence)([exports.checkbox, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
5451
+ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(2
5452
+ /* State.media */
5453
+ , exports.ulist_))));
5454
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
5221
5455
  exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
5222
5456
  class: 'checkbox'
5223
5457
  }, source[1].trimStart() ? '☑' : '☐')], '']);
@@ -5238,6 +5472,30 @@ function format(el) {
5238
5472
 
5239
5473
  /***/ }),
5240
5474
 
5475
+ /***/ 6484:
5476
+ /***/ ((__unused_webpack_module, exports) => {
5477
+
5478
+ "use strict";
5479
+
5480
+
5481
+ Object.defineProperty(exports, "__esModule", ({
5482
+ value: true
5483
+ }));
5484
+ exports.backtrackable = void 0;
5485
+ exports.backtrackable = 0 | 32
5486
+ /* Rule.annotation */
5487
+ | 4096
5488
+ /* Rule.reference */
5489
+ | 1024
5490
+ /* Rule.index */
5491
+ | 256
5492
+ /* Rule.link */
5493
+ | 64
5494
+ /* Rule.media */
5495
+ ;
5496
+
5497
+ /***/ }),
5498
+
5241
5499
  /***/ 5702:
5242
5500
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5243
5501
 
@@ -5404,28 +5662,23 @@ const inline_1 = __webpack_require__(1160);
5404
5662
 
5405
5663
  const link_1 = __webpack_require__(9628);
5406
5664
 
5407
- const util_1 = __webpack_require__(9437);
5665
+ const visibility_1 = __webpack_require__(7618);
5408
5666
 
5409
5667
  const dom_1 = __webpack_require__(3252);
5410
5668
 
5411
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.validate)('((', (0, combinator_1.surround)('((', (0, combinator_1.guard)(context => context.syntax?.inline?.annotation ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
5412
- syntax: {
5413
- inline: {
5414
- annotation: false,
5415
- // Redundant
5416
- //reference: true,
5417
- media: false // Redundant
5418
- //index: true,
5419
- //label: true,
5420
- //link: true,
5421
- //autolink: true,
5422
-
5423
- }
5424
- },
5669
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('((', (0, combinator_1.syntax)(32
5670
+ /* Rule.annotation */
5671
+ , 6, (0, combinator_1.surround)('((', (0, combinator_1.guard)(context => ~context.state & 64
5672
+ /* State.annotation */
5673
+ , (0, combinator_1.state)(64
5674
+ /* State.annotation */
5675
+ | 2
5676
+ /* State.media */
5677
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
5425
5678
  delimiters: global_1.undefined
5426
- }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 3], ['))', 6]])), ')')), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5679
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5427
5680
  class: 'annotation'
5428
- }, [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest)))))));
5681
+ }, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest)))));
5429
5682
 
5430
5683
  /***/ }),
5431
5684
 
@@ -5460,11 +5713,15 @@ const source_1 = __webpack_require__(6743);
5460
5713
 
5461
5714
  const util_1 = __webpack_require__(9437);
5462
5715
 
5463
- exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S#)/, (0, combinator_1.guard)(context => context.syntax?.inline?.autolink ?? true, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5716
+ exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S#)/, (0, combinator_1.guard)(context => ~context.state & 1
5717
+ /* State.autolink */
5718
+ , (0, combinator_1.syntax)(2
5719
+ /* Rule.autolink */
5720
+ , 1, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5464
5721
  (0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)+/), channel_1.channel, account_1.account, // Escape unmatched account-like strings.
5465
5722
  (0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
5466
5723
  (0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
5467
- (0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])*/u.source.replace('emoji', hashtag_1.emoji), 'u')), anchor_1.anchor])))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
5724
+ (0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])*/u.source.replace('emoji', hashtag_1.emoji), 'u')), anchor_1.anchor]))))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
5468
5725
 
5469
5726
  /***/ }),
5470
5727
 
@@ -5658,7 +5915,7 @@ const source_1 = __webpack_require__(6743);
5658
5915
 
5659
5916
  const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5660
5917
  exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.textlink])))));
5661
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5918
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5662
5919
 
5663
5920
  /***/ }),
5664
5921
 
@@ -5686,12 +5943,26 @@ const dom_1 = __webpack_require__(3252);
5686
5943
  const array_1 = __webpack_require__(8112);
5687
5944
 
5688
5945
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5689
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5946
+ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.syntax)(0
5947
+ /* Rule.none */
5948
+ , 2, (0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(index), (0, source_1.str)(')'))), (0, combinator_1.syntax)(128
5949
+ /* Rule.bracket */
5950
+ , 2, (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]]), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5690
5951
  class: 'paren'
5691
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5952
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest])), (0, combinator_1.syntax)(0
5953
+ /* Rule.none */
5954
+ , 2, (0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0)))), (0, source_1.str)(')'))), (0, combinator_1.syntax)(128
5955
+ /* Rule.bracket */
5956
+ , 2, (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]]), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5692
5957
  class: 'paren'
5693
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ']', [[']', 3]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, '}', [['}', 3]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5694
- (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])])));
5958
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])), (0, combinator_1.syntax)(128
5959
+ /* Rule.bracket */
5960
+ , 2, (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]]), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest])), (0, combinator_1.syntax)(128
5961
+ /* Rule.bracket */
5962
+ , 2, (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]]), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5963
+ (0, combinator_1.syntax)(1
5964
+ /* Rule.quote */
5965
+ , 8, (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]]), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]))]));
5695
5966
 
5696
5967
  /***/ }),
5697
5968
 
@@ -5743,11 +6014,13 @@ const memoize_1 = __webpack_require__(1808);
5743
6014
 
5744
6015
  const array_1 = __webpack_require__(8112);
5745
6016
 
5746
- exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.creator)((0, combinator_1.precedence)(4, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
6017
+ exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0
6018
+ /* Rule.none */
6019
+ , 4, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5747
6020
  class: 'comment'
5748
6021
  }, [(0, dom_1.html)('input', {
5749
6022
  type: 'checkbox'
5750
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, []))))));
6023
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, [])))));
5751
6024
 
5752
6025
  /***/ }),
5753
6026
 
@@ -5768,13 +6041,15 @@ const inline_1 = __webpack_require__(1160);
5768
6041
 
5769
6042
  const source_1 = __webpack_require__(6743);
5770
6043
 
5771
- const util_1 = __webpack_require__(9437);
6044
+ const visibility_1 = __webpack_require__(7618);
5772
6045
 
5773
6046
  const dom_1 = __webpack_require__(3252);
5774
6047
 
5775
6048
  const array_1 = __webpack_require__(8112);
5776
6049
 
5777
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6050
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.syntax)(0
6051
+ /* Rule.none */
6052
+ , 1, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5778
6053
 
5779
6054
  /***/ }),
5780
6055
 
@@ -5799,13 +6074,15 @@ const strong_1 = __webpack_require__(8072);
5799
6074
 
5800
6075
  const source_1 = __webpack_require__(6743);
5801
6076
 
5802
- const util_1 = __webpack_require__(9437);
6077
+ const visibility_1 = __webpack_require__(7618);
5803
6078
 
5804
6079
  const dom_1 = __webpack_require__(3252);
5805
6080
 
5806
6081
  const array_1 = __webpack_require__(8112);
5807
6082
 
5808
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6083
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.syntax)(0
6084
+ /* Rule.none */
6085
+ , 1, (0, combinator_1.surround)((0, source_1.str)('*'), (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5809
6086
 
5810
6087
  /***/ }),
5811
6088
 
@@ -5830,15 +6107,17 @@ const emphasis_1 = __webpack_require__(3867);
5830
6107
 
5831
6108
  const source_1 = __webpack_require__(6743);
5832
6109
 
5833
- const util_1 = __webpack_require__(9437);
6110
+ const visibility_1 = __webpack_require__(7618);
5834
6111
 
5835
6112
  const dom_1 = __webpack_require__(3252);
5836
6113
 
5837
6114
  const array_1 = __webpack_require__(8112);
5838
6115
 
5839
- const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong]))])));
5840
- const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
5841
- exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
6116
+ const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong]))])));
6117
+ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
6118
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.syntax)(0
6119
+ /* Rule.none */
6120
+ , 1, (0, combinator_1.surround)((0, source_1.str)('***'), (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
5842
6121
  switch (cs[0]) {
5843
6122
  case '***':
5844
6123
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
@@ -5849,7 +6128,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, co
5849
6128
  case '*':
5850
6129
  return (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' ? [[(0, dom_1.html)('strong', (0, array_1.unshift)([(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(2)] : [(0, array_1.unshift)(['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], ds), rest])(rest, context) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
5851
6130
  }
5852
- }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6131
+ }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5853
6132
 
5854
6133
  /***/ }),
5855
6134
 
@@ -5935,28 +6214,34 @@ const indexee_1 = __webpack_require__(1269);
5935
6214
 
5936
6215
  const source_1 = __webpack_require__(6743);
5937
6216
 
5938
- const util_1 = __webpack_require__(9437);
6217
+ const visibility_1 = __webpack_require__(7618);
5939
6218
 
5940
6219
  const dom_1 = __webpack_require__(3252);
5941
6220
 
5942
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5943
- syntax: {
5944
- inline: {
5945
- annotation: false,
5946
- reference: false,
5947
- index: false,
5948
- label: false,
5949
- link: false,
5950
- media: false,
5951
- autolink: false
5952
- }
5953
- }
5954
- }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
6221
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.syntax)(1024
6222
+ /* Rule.index */
6223
+ , 2, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => ~context.state & 16
6224
+ /* State.index */
6225
+ , (0, combinator_1.state)(64
6226
+ /* State.annotation */
6227
+ | 32
6228
+ /* State.reference */
6229
+ | 16
6230
+ /* State.index */
6231
+ | 8
6232
+ /* State.label */
6233
+ | 4
6234
+ /* State.link */
6235
+ | 2
6236
+ /* State.media */
6237
+ | 1
6238
+ /* State.autolink */
6239
+ , (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
5955
6240
  id: el.id ? null : global_1.undefined,
5956
6241
  class: 'index',
5957
6242
  href: el.id ? `#${el.id}` : global_1.undefined
5958
- }, el.childNodes)])))));
5959
- const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)('|#', (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'))), ns => [(0, dom_1.html)('span', {
6243
+ }, el.childNodes)]))));
6244
+ const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)('|#', (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'))), ns => [(0, dom_1.html)('span', {
5960
6245
  class: 'indexer',
5961
6246
  'data-index': (0, indexee_1.identity)(ns.join('')).slice(6)
5962
6247
  })])));
@@ -5981,6 +6266,8 @@ const combinator_1 = __webpack_require__(2087);
5981
6266
 
5982
6267
  const dom_1 = __webpack_require__(3252);
5983
6268
 
6269
+ const duff_1 = __webpack_require__(8099);
6270
+
5984
6271
  function indexee(parser, optional) {
5985
6272
  return (0, combinator_1.fmap)(parser, ([el], _, {
5986
6273
  id
@@ -6004,41 +6291,37 @@ function text(source, optional = false) {
6004
6291
  const index = indexer?.getAttribute('data-index');
6005
6292
  if (index) return index;
6006
6293
  const target = source.cloneNode(true);
6007
-
6008
- for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), i = 0, len = es.length; i < len; ++i) {
6009
- const el = es[i];
6010
-
6294
+ (0, duff_1.duffEach)(target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), el => {
6011
6295
  switch (el.tagName) {
6012
6296
  case 'CODE':
6013
6297
  (0, dom_1.define)(el, el.getAttribute('data-src'));
6014
- continue;
6298
+ return;
6015
6299
 
6016
6300
  case 'RT':
6017
6301
  case 'RP':
6018
6302
  case 'UL':
6019
6303
  case 'OL':
6020
6304
  el.remove();
6021
- continue;
6305
+ return;
6022
6306
  }
6023
6307
 
6024
6308
  switch (el.className) {
6025
6309
  case 'math':
6026
6310
  (0, dom_1.define)(el, el.getAttribute('data-src'));
6027
- continue;
6311
+ return;
6028
6312
 
6029
6313
  case 'comment':
6030
6314
  case 'checkbox':
6031
6315
  el.remove();
6032
- continue;
6316
+ return;
6033
6317
 
6034
6318
  case 'reference':
6035
6319
  el.firstChild.remove();
6036
- continue;
6320
+ return;
6037
6321
  }
6038
- } // Better:
6322
+ }); // Better:
6039
6323
  //return target.innerText;
6040
6324
 
6041
-
6042
6325
  return target.textContent;
6043
6326
  }
6044
6327
 
@@ -6061,11 +6344,11 @@ const combinator_1 = __webpack_require__(2087);
6061
6344
 
6062
6345
  const index_1 = __webpack_require__(4479);
6063
6346
 
6064
- const util_1 = __webpack_require__(9437);
6065
-
6066
6347
  const dom_1 = __webpack_require__(3252);
6067
6348
 
6068
- exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, util_1.clean)((0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6349
+ exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, combinator_1.state)(16
6350
+ /* State.index */
6351
+ , false, (0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6069
6352
  href: '#'
6070
6353
  })], '']), index_1.index])), /^\s*$/), // Indexer is invisible but invalids must be visible.
6071
6354
  ([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, dom_1.html)('span', {
@@ -6096,7 +6379,9 @@ const dom_1 = __webpack_require__(3252);
6096
6379
 
6097
6380
  const body = (0, source_1.str)(/^\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/);
6098
6381
  exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
6099
- exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.guard)(context => context.syntax?.inline?.label ?? true, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6382
+ exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.guard)(context => ~context.state & 8
6383
+ /* State.label */
6384
+ , (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6100
6385
  class: 'label',
6101
6386
  'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6102
6387
  }, text)])));
@@ -6144,7 +6429,7 @@ const inline_1 = __webpack_require__(1160);
6144
6429
 
6145
6430
  const source_1 = __webpack_require__(6743);
6146
6431
 
6147
- const util_1 = __webpack_require__(9437);
6432
+ const visibility_1 = __webpack_require__(7618);
6148
6433
 
6149
6434
  const dom_1 = __webpack_require__(3252);
6150
6435
 
@@ -6152,12 +6437,14 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6152
6437
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6153
6438
 
6154
6439
 
6155
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6440
+ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.syntax)(0
6441
+ /* Rule.none */
6442
+ , 2, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6156
6443
  class: 'invalid',
6157
6444
  'data-invalid-syntax': 'extension',
6158
6445
  'data-invalid-type': 'syntax',
6159
6446
  'data-invalid-message': `Reserved start symbol "${as[0][1]}" cannot be used in "[]"`
6160
- }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])))));
6447
+ }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6161
6448
 
6162
6449
  /***/ }),
6163
6450
 
@@ -6180,7 +6467,7 @@ const inline_1 = __webpack_require__(1160);
6180
6467
 
6181
6468
  const source_1 = __webpack_require__(6743);
6182
6469
 
6183
- const util_1 = __webpack_require__(9437);
6470
+ const visibility_1 = __webpack_require__(7618);
6184
6471
 
6185
6472
  const dom_1 = __webpack_require__(3252);
6186
6473
 
@@ -6198,8 +6485,10 @@ const attrspecs = {
6198
6485
  };
6199
6486
  global_1.Object.setPrototypeOf(attrspecs, null);
6200
6487
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6201
- exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.creator)((0, combinator_1.precedence)(5, (0, combinator_1.union)([(0, combinator_1.focus)('<wbr>', () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.focus)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6202
- /^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/, source => [[source], '']), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`), [[(0, util_1.blankWith)('\n', `</${tag}>`), 5]]), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 5]])]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))]))))));
6488
+ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.syntax)(0
6489
+ /* Rule.none */
6490
+ , 5, (0, combinator_1.union)([(0, combinator_1.focus)('<wbr>', () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.focus)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6491
+ /^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/, source => [[source], '']), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 5]]), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 5]])]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6203
6492
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6204
6493
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
6205
6494
 
@@ -6209,7 +6498,7 @@ function elem(tag, as, bs, cs) {
6209
6498
  if (!tags.includes(tag)) return invalid('tag', `Invalid HTML tag name "${tag}"`, as, bs, cs);
6210
6499
  if (cs.length === 0) return invalid('tag', `Missing the closing HTML tag "</${tag}>"`, as, bs, cs);
6211
6500
  if (bs.length === 0) return invalid('content', `Missing the content`, as, bs, cs);
6212
- if (!(0, util_1.isStartLooseNodes)(bs)) return invalid('content', `Missing the visible content in the same line`, as, bs, cs);
6501
+ if (!(0, visibility_1.isStartLooseNodes)(bs)) return invalid('content', `Missing the visible content in the same line`, as, bs, cs);
6213
6502
  const attrs = attributes('html', [], attrspecs[tag], as.slice(1, -1));
6214
6503
  return 'data-invalid-syntax' in attrs ? invalid('attribute', 'Invalid HTML attribute', as, bs, cs) : (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
6215
6504
  }
@@ -6307,13 +6596,15 @@ const inline_1 = __webpack_require__(1160);
6307
6596
 
6308
6597
  const source_1 = __webpack_require__(6743);
6309
6598
 
6310
- const util_1 = __webpack_require__(9437);
6599
+ const visibility_1 = __webpack_require__(7618);
6311
6600
 
6312
6601
  const dom_1 = __webpack_require__(3252);
6313
6602
 
6314
6603
  const array_1 = __webpack_require__(8112);
6315
6604
 
6316
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6605
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.syntax)(0
6606
+ /* Rule.none */
6607
+ , 1, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6317
6608
 
6318
6609
  /***/ }),
6319
6610
 
@@ -6342,6 +6633,8 @@ const autolink_1 = __webpack_require__(6578);
6342
6633
 
6343
6634
  const source_1 = __webpack_require__(6743);
6344
6635
 
6636
+ const visibility_1 = __webpack_require__(7618);
6637
+
6345
6638
  const util_1 = __webpack_require__(9437);
6346
6639
 
6347
6640
  const dom_1 = __webpack_require__(3252);
@@ -6352,43 +6645,44 @@ const optspec = {
6352
6645
  rel: ['nofollow']
6353
6646
  };
6354
6647
  Object.setPrototypeOf(optspec, null);
6355
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.context)({
6356
- syntax: {
6357
- inline: {
6358
- link: false
6359
- }
6360
- }
6361
- }, (0, combinator_1.dup)((0, combinator_1.union)([(0, combinator_1.surround)('[', inline_1.media, ']'), (0, combinator_1.surround)('[', inline_1.shortmedia, ']'), (0, combinator_1.surround)('[', (0, combinator_1.context)({
6362
- syntax: {
6363
- inline: {
6364
- annotation: false,
6365
- reference: false,
6366
- index: false,
6367
- label: false,
6368
- // Redundant
6369
- //link: false,
6370
- media: false,
6371
- autolink: false
6372
- }
6373
- }
6374
- }, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6648
+ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.syntax)(256
6649
+ /* Rule.link */
6650
+ , 2, 10, (0, combinator_1.bind)((0, combinator_1.guard)(context => ~context.state & 4
6651
+ /* State.link */
6652
+ , (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.state)(4
6653
+ /* State.link */
6654
+ , (0, combinator_1.dup)((0, combinator_1.union)([(0, combinator_1.surround)('[', inline_1.media, ']'), (0, combinator_1.surround)('[', inline_1.shortmedia, ']'), (0, combinator_1.surround)('[', (0, combinator_1.state)(64
6655
+ /* State.annotation */
6656
+ | 32
6657
+ /* State.reference */
6658
+ | 16
6659
+ /* State.index */
6660
+ | 8
6661
+ /* State.label */
6662
+ | 2
6663
+ /* State.media */
6664
+ | 1
6665
+ /* State.autolink */
6666
+ , (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6375
6667
  (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []])), ([content, params], rest, context) => {
6376
6668
  if (params.length === 0) return;
6377
6669
  if (content[0] === '') return [content, rest];
6378
- if (content.length !== 0 && (0, util_1.trimNode)(content).length === 0) return;
6670
+ if (content.length !== 0 && (0, visibility_1.trimNode)(content).length === 0) return;
6379
6671
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))?.some(node => typeof node === 'object')) return;
6380
6672
  const INSECURE_URI = params.shift();
6381
6673
  const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6382
6674
  if (el.classList.contains('invalid')) return [[el], rest];
6383
6675
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6384
- })))));
6385
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6676
+ }))));
6677
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.syntax)(256
6678
+ /* Rule.link */
6679
+ , 2, 10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6386
6680
  params.shift();
6387
- (0, util_1.trimNode)(content);
6681
+ (0, visibility_1.trimNode)(content);
6388
6682
  const INSECURE_URI = params.shift();
6389
6683
  const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6390
6684
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6391
- })))));
6685
+ }))));
6392
6686
  exports.uri = (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]), ([uri]) => ['\r', uri]);
6393
6687
  exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
6394
6688
 
@@ -6498,13 +6792,15 @@ const inline_1 = __webpack_require__(1160);
6498
6792
 
6499
6793
  const source_1 = __webpack_require__(6743);
6500
6794
 
6501
- const util_1 = __webpack_require__(9437);
6795
+ const visibility_1 = __webpack_require__(7618);
6502
6796
 
6503
6797
  const dom_1 = __webpack_require__(3252);
6504
6798
 
6505
6799
  const array_1 = __webpack_require__(8112);
6506
6800
 
6507
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6801
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.syntax)(0
6802
+ /* Rule.none */
6803
+ , 1, (0, combinator_1.surround)((0, source_1.str)('=='), (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6508
6804
 
6509
6805
  /***/ }),
6510
6806
 
@@ -6525,9 +6821,8 @@ const source_1 = __webpack_require__(6743);
6525
6821
 
6526
6822
  const dom_1 = __webpack_require__(3252);
6527
6823
 
6528
- const syntax = /^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6529
6824
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6530
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.precedence)(7, (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', bracket, '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, source_1.str)(syntax)])), /^\$(?![0-9A-Za-z])/)]), (source, {
6825
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', (0, combinator_1.precedence)(6, bracket), '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.precedence)(3, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.focus)(/^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/, (0, combinator_1.some)(source_1.unescsource))]))), /^\$(?![0-9A-Za-z])/)]), (source, {
6531
6826
  caches: {
6532
6827
  math: cache
6533
6828
  } = {}
@@ -6541,7 +6836,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0,
6541
6836
  'data-invalid-syntax': 'math',
6542
6837
  'data-invalid-type': 'content',
6543
6838
  'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
6544
- }, source)], ''])))));
6839
+ }, source)], '']))));
6545
6840
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^(?:[{}$]|\\?\n)/)])), '}', true)));
6546
6841
 
6547
6842
  /***/ }),
@@ -6582,7 +6877,11 @@ const optspec = {
6582
6877
  rel: global_1.undefined
6583
6878
  };
6584
6879
  Object.setPrototypeOf(optspec, null);
6585
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6880
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.syntax)(64
6881
+ /* Rule.media */
6882
+ , 2, 10, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => ~context.state & 2
6883
+ /* State.media */
6884
+ , (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6586
6885
  const INSECURE_URI = params.shift();
6587
6886
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href);
6588
6887
  let cache;
@@ -6600,12 +6899,14 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6600
6899
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
6601
6900
  }
6602
6901
 
6603
- if (context.syntax?.inline?.link === false || cache && cache.tagName !== 'IMG') return [[el], rest];
6902
+ if (context.state & 4
6903
+ /* State.link */
6904
+ || cache && cache.tagName !== 'IMG') return [[el], rest];
6604
6905
  return (0, combinator_1.fmap)(link_1.textlink, ([link]) => [(0, dom_1.define)(link, {
6605
6906
  target: '_blank'
6606
6907
  }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
6607
- })))));
6608
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)]));
6908
+ }))));
6909
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)])));
6609
6910
  const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
6610
6911
 
6611
6912
  function sanitize(target, uri, alt) {
@@ -6671,26 +6972,26 @@ const link_1 = __webpack_require__(9628);
6671
6972
 
6672
6973
  const source_1 = __webpack_require__(6743);
6673
6974
 
6975
+ const visibility_1 = __webpack_require__(7618);
6976
+
6674
6977
  const util_1 = __webpack_require__(9437);
6675
6978
 
6676
6979
  const dom_1 = __webpack_require__(3252);
6677
6980
 
6678
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[[', (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
6679
- syntax: {
6680
- inline: {
6681
- annotation: false,
6682
- reference: false,
6683
- media: false // Redundant
6684
- //index: true,
6685
- //label: true,
6686
- //link: true,
6687
- //autolink: true,
6688
-
6689
- }
6690
- },
6981
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[[', (0, combinator_1.syntax)(4096
6982
+ /* Rule.reference */
6983
+ , 6, (0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => ~context.state & 32
6984
+ /* State.reference */
6985
+ , (0, combinator_1.state)(64
6986
+ /* State.annotation */
6987
+ | 32
6988
+ /* State.reference */
6989
+ | 2
6990
+ /* State.media */
6991
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
6691
6992
  delimiters: global_1.undefined
6692
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])])), ']')), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))))));
6693
- const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(util_1.regBlankStart, '')]));
6993
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']'))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))));
6994
+ const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(visibility_1.regBlankStart, '')]));
6694
6995
 
6695
6996
  function attributes(ns) {
6696
6997
  return typeof ns[0] === 'object' && ns[0].tagName === 'ABBR' ? {
@@ -6729,13 +7030,15 @@ const htmlentity_1 = __webpack_require__(1562);
6729
7030
 
6730
7031
  const source_1 = __webpack_require__(6743);
6731
7032
 
6732
- const util_1 = __webpack_require__(9437);
7033
+ const visibility_1 = __webpack_require__(7618);
6733
7034
 
6734
7035
  const dom_1 = __webpack_require__(3252);
6735
7036
 
6736
7037
  const array_1 = __webpack_require__(8112);
6737
7038
 
6738
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
7039
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.syntax)(0
7040
+ /* Rule.none */
7041
+ , 2, (0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
6739
7042
  texts[texts.length - 1] === '' && texts.pop();
6740
7043
 
6741
7044
  switch (true) {
@@ -6824,7 +7127,9 @@ const url_1 = __webpack_require__(4318);
6824
7127
 
6825
7128
  const media_1 = __webpack_require__(1303);
6826
7129
 
6827
- exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.open)('!', url_1.url)), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media])));
7130
+ exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.guard)(context => ~context.state & 2
7131
+ /* State.media */
7132
+ , (0, combinator_1.open)('!', url_1.url)), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media])));
6828
7133
 
6829
7134
  /***/ }),
6830
7135
 
@@ -6847,13 +7152,15 @@ const emstrong_1 = __webpack_require__(6132);
6847
7152
 
6848
7153
  const source_1 = __webpack_require__(6743);
6849
7154
 
6850
- const util_1 = __webpack_require__(9437);
7155
+ const visibility_1 = __webpack_require__(7618);
6851
7156
 
6852
7157
  const dom_1 = __webpack_require__(3252);
6853
7158
 
6854
7159
  const array_1 = __webpack_require__(8112);
6855
7160
 
6856
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
7161
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.syntax)(0
7162
+ /* Rule.none */
7163
+ , 1, (0, combinator_1.surround)((0, source_1.str)('**'), (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6857
7164
 
6858
7165
  /***/ }),
6859
7166
 
@@ -6872,16 +7179,20 @@ const global_1 = __webpack_require__(4128);
6872
7179
 
6873
7180
  const combinator_1 = __webpack_require__(2087);
6874
7181
 
7182
+ const link_1 = __webpack_require__(9628);
7183
+
6875
7184
  const source_1 = __webpack_require__(6743);
6876
7185
 
6877
7186
  const dom_1 = __webpack_require__(3252);
6878
7187
 
6879
7188
  const array_1 = __webpack_require__(8112);
6880
7189
 
6881
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
7190
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.syntax)(0
7191
+ /* Rule.none */
7192
+ , 2, (0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
6882
7193
  class: 'template'
6883
- }, source.replace(/\x1B/g, ''))], '']))));
6884
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)]));
7194
+ }, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest], ([, ns = [], rest], next) => next[0] === '}' ? global_1.undefined : (0, link_1.optimize)('{{', ns, rest))));
7195
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)])));
6885
7196
 
6886
7197
  /***/ }),
6887
7198
 
@@ -6902,18 +7213,16 @@ const ja_1 = __webpack_require__(1499);
6902
7213
 
6903
7214
  const dom_1 = __webpack_require__(3252);
6904
7215
 
7216
+ const duff_1 = __webpack_require__(8099);
7217
+
6905
7218
  function localize(parser) {
6906
7219
  return (0, combinator_1.fmap)(parser, ns => {
6907
7220
  if (ns.length === 0) return ns;
6908
7221
  const el = ns.length === 1 && typeof ns[0] === 'object' ? ns[0] : (0, dom_1.html)('div', ns);
6909
- const es = el.querySelectorAll('.linebreak:not(:empty)');
6910
-
6911
- for (let i = 0, len = es.length; i < len; ++i) {
6912
- const sb = es[i];
6913
- if (!check(sb)) continue;
6914
- sb.firstChild.remove();
6915
- }
6916
-
7222
+ (0, duff_1.duffEach)(el.querySelectorAll('.linebreak:not(:empty)'), el => {
7223
+ if (!check(el)) return;
7224
+ el.firstChild.remove();
7225
+ });
6917
7226
  return ns;
6918
7227
  });
6919
7228
  }
@@ -7207,12 +7516,14 @@ const dom_1 = __webpack_require__(3252);
7207
7516
 
7208
7517
  const multimap_1 = __webpack_require__(940);
7209
7518
 
7519
+ const duff_1 = __webpack_require__(8099);
7520
+
7210
7521
  const array_1 = __webpack_require__(8112);
7211
7522
 
7212
7523
  function* footnote(target, footnotes, opts = {}, bottom = null) {
7213
7524
  // Bug: Firefox
7214
7525
  //target.querySelectorAll(`:scope > .annotations`).forEach(el => el.remove());
7215
- target.querySelectorAll(`.annotations`).forEach(el => el.parentNode === target && el.remove());
7526
+ (0, duff_1.duffEach)(target.querySelectorAll(`.annotations`), el => el.parentNode === target && el.remove());
7216
7527
  yield* (0, exports.reference)(target, footnotes?.references, opts, bottom);
7217
7528
  yield* (0, exports.annotation)(target, footnotes?.annotations, opts, bottom);
7218
7529
  return;
@@ -7231,7 +7542,7 @@ function build(syntax, marker, splitter) {
7231
7542
  const titles = new global_1.Map(); // Bug: Firefox
7232
7543
  //const splitters = push([], target.querySelectorAll(`:scope > :is(${splitter ?? '_'})`));
7233
7544
 
7234
- const splitters = (0, array_1.push)([], target.querySelectorAll(splitter ?? '_')).filter(el => el.parentNode === target);
7545
+ const splitters = (0, duff_1.duffReduce)(target.querySelectorAll(splitter ?? '_'), (acc, el) => el.parentNode === target ? (0, array_1.push)(acc, [el]) : acc, []);
7235
7546
  let count = 0;
7236
7547
  let total = 0;
7237
7548
  let style;
@@ -7772,6 +8083,38 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7772
8083
  /***/ }),
7773
8084
 
7774
8085
  /***/ 9437:
8086
+ /***/ ((__unused_webpack_module, exports) => {
8087
+
8088
+ "use strict";
8089
+
8090
+
8091
+ Object.defineProperty(exports, "__esModule", ({
8092
+ value: true
8093
+ }));
8094
+ exports.stringify = void 0;
8095
+
8096
+ function stringify(nodes) {
8097
+ let acc = '';
8098
+
8099
+ for (let i = 0; i < nodes.length; ++i) {
8100
+ const node = nodes[i];
8101
+
8102
+ if (typeof node === 'string') {
8103
+ acc += node;
8104
+ } else {
8105
+ // NOTE: Doesn't reflect line breaks.
8106
+ acc += node.innerText;
8107
+ }
8108
+ }
8109
+
8110
+ return acc;
8111
+ }
8112
+
8113
+ exports.stringify = stringify;
8114
+
8115
+ /***/ }),
8116
+
8117
+ /***/ 7618:
7775
8118
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
7776
8119
 
7777
8120
  "use strict";
@@ -7780,7 +8123,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7780
8123
  Object.defineProperty(exports, "__esModule", ({
7781
8124
  value: true
7782
8125
  }));
7783
- exports.stringify = exports.trimNode = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = exports.clean = void 0;
8126
+ exports.trimNode = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.blankWith = exports.regBlankStart = exports.visualize = void 0;
7784
8127
 
7785
8128
  const global_1 = __webpack_require__(4128);
7786
8129
 
@@ -7798,30 +8141,6 @@ const memoize_1 = __webpack_require__(1808);
7798
8141
 
7799
8142
  const array_1 = __webpack_require__(8112);
7800
8143
 
7801
- function clean(parser) {
7802
- const clean = (0, memoize_1.memoize)(context => ({
7803
- resources: context.resources,
7804
- precedence: context.precedence,
7805
- delimiters: context.delimiters,
7806
- host: context.host,
7807
- url: context.url,
7808
- id: context.id,
7809
- header: context.header,
7810
- cache: context.caches
7811
- }), new WeakMap());
7812
- return (source, context) => parser(source, context.syntax ? clean(context) : context);
7813
- }
7814
-
7815
- exports.clean = clean;
7816
- exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
7817
-
7818
- function blankWith(starting, delimiter) {
7819
- if (delimiter === global_1.undefined) return blankWith('', starting);
7820
- return new RegExp(String.raw`^(?:(?=${starting})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr>)${starting && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`);
7821
- }
7822
-
7823
- exports.blankWith = blankWith;
7824
-
7825
8144
  function visualize(parser) {
7826
8145
  const blankline = new RegExp(/^(?:\\$|\\?[^\S\n]|&IHN;|<wbr>)+$/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
7827
8146
  return (0, combinator_1.union)([(0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))), (0, combinator_1.some)((0, combinator_1.union)([source_1.linebreak, source_1.unescsource]))]);
@@ -7830,11 +8149,7 @@ function visualize(parser) {
7830
8149
  exports.visualize = visualize;
7831
8150
 
7832
8151
  function hasVisible(nodes, {
7833
- syntax: {
7834
- inline: {
7835
- media = true
7836
- } = {}
7837
- } = {}
8152
+ state = 0
7838
8153
  } = {}) {
7839
8154
  for (let i = 0; i < nodes.length; ++i) {
7840
8155
  const node = nodes[i];
@@ -7843,13 +8158,26 @@ function hasVisible(nodes, {
7843
8158
  if (node && node.trimStart()) return true;
7844
8159
  } else {
7845
8160
  if (node.innerText.trimStart()) return true;
7846
- if (media && (node.classList.contains('media') || node.getElementsByClassName('media')[0])) return true;
8161
+ if (state & 2
8162
+ /* State.media */
8163
+ ^ 2
8164
+ /* State.media */
8165
+ && (node.classList.contains('media') || node.getElementsByClassName('media')[0])) return true;
7847
8166
  }
7848
8167
  }
7849
8168
 
7850
8169
  return false;
7851
8170
  }
7852
8171
 
8172
+ exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
8173
+
8174
+ function blankWith(starting, delimiter) {
8175
+ if (delimiter === global_1.undefined) return blankWith('', starting);
8176
+ return new RegExp(String.raw`^(?:(?=${starting})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr>)${starting && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`);
8177
+ }
8178
+
8179
+ exports.blankWith = blankWith;
8180
+
7853
8181
  function startLoose(parser, except) {
7854
8182
  return (source, context) => isStartLoose(source, context, except) ? parser(source, context) : global_1.undefined;
7855
8183
  }
@@ -7991,7 +8319,7 @@ function trimNodeStart(nodes) {
7991
8319
  const pos = node.trimStart().length;
7992
8320
 
7993
8321
  if (pos > 0) {
7994
- nodes[0] = node.slice(pos);
8322
+ nodes[0] = node.slice(-pos);
7995
8323
  break;
7996
8324
  }
7997
8325
  }
@@ -8007,39 +8335,20 @@ function trimNodeEnd(nodes) {
8007
8335
 
8008
8336
  for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[nodes.length - 1], -1);) {
8009
8337
  if (typeof node === 'string') {
8010
- const pos = node.trimEnd().length;
8011
-
8012
- if (pos > 0) {
8013
- nodes[nodes.length - 1] = node.slice(0, pos);
8014
- break;
8015
- }
8016
- }
8017
-
8018
- nodes.pop();
8019
- }
8020
-
8021
- return (0, array_1.push)(nodes, skip);
8022
- }
8023
-
8024
- function stringify(nodes) {
8025
- let acc = '';
8026
-
8027
- for (let i = 0; i < nodes.length; ++i) {
8028
- const node = nodes[i];
8029
-
8030
- if (typeof node === 'string') {
8031
- acc += node;
8032
- } else {
8033
- // NOTE: Doesn't reflect line breaks.
8034
- acc += node.innerText;
8338
+ const pos = node.trimEnd().length;
8339
+
8340
+ if (pos > 0) {
8341
+ nodes[nodes.length - 1] = node.slice(0, pos);
8342
+ break;
8343
+ }
8035
8344
  }
8345
+
8346
+ nodes.pop();
8036
8347
  }
8037
8348
 
8038
- return acc;
8349
+ return (0, array_1.push)(nodes, skip);
8039
8350
  }
8040
8351
 
8041
- exports.stringify = stringify;
8042
-
8043
8352
  /***/ }),
8044
8353
 
8045
8354
  /***/ 256:
@@ -8550,6 +8859,8 @@ exports.info = void 0;
8550
8859
 
8551
8860
  const scope_1 = __webpack_require__(5202);
8552
8861
 
8862
+ const duff_1 = __webpack_require__(8099);
8863
+
8553
8864
  const array_1 = __webpack_require__(8112);
8554
8865
 
8555
8866
  function info(source) {
@@ -8568,7 +8879,7 @@ function info(source) {
8568
8879
  };
8569
8880
 
8570
8881
  function find(selector) {
8571
- return (0, array_1.push)([], source.querySelectorAll(selector)).filter(match);
8882
+ return (0, duff_1.duffReduce)(source.querySelectorAll(selector), (acc, el) => match(el) ? (0, array_1.push)(acc, [el]) : acc, []);
8572
8883
  }
8573
8884
  }
8574
8885
 
@@ -8595,30 +8906,29 @@ const cite_1 = __webpack_require__(6315);
8595
8906
 
8596
8907
  const dom_1 = __webpack_require__(3252);
8597
8908
 
8909
+ const duff_1 = __webpack_require__(8099);
8910
+
8598
8911
  function quote(anchor, range) {
8599
8912
  if ((0, parser_1.exec)((0, cite_1.cite)(`>>${anchor}`, {})) !== '') throw new Error(`Invalid anchor: ${anchor}`);
8600
8913
  fit(range);
8601
8914
  const node = trim(range.cloneContents());
8602
8915
  if (!node.firstChild) return '';
8603
-
8604
- for (let es = node.querySelectorAll('code[data-src], .math[data-src], .media[data-src], rt, rp'), i = 0, len = es.length; i < len; ++i) {
8605
- const el = es[i];
8606
-
8916
+ (0, duff_1.duffEach)(node.querySelectorAll('code[data-src], .math[data-src], .media[data-src], rt, rp'), el => {
8607
8917
  switch (true) {
8608
8918
  case el.matches('code'):
8609
8919
  case el.matches('.math'):
8610
8920
  (0, dom_1.define)(el, el.getAttribute('data-src'));
8611
- continue;
8921
+ return;
8612
8922
 
8613
8923
  case el.matches('.media'):
8614
8924
  el.replaceWith(/[\s{}]/.test(el.getAttribute('data-src')) ? `!{ ${el.getAttribute('data-src')} }` : `!{${el.getAttribute('data-src')}}`);
8615
- continue;
8925
+ return;
8616
8926
 
8617
8927
  case el.matches('rt, rp'):
8618
8928
  el.remove();
8619
- continue;
8929
+ return;
8620
8930
  }
8621
- }
8931
+ });
8622
8932
 
8623
8933
  if (range.startOffset === 0 && range.startContainer.parentElement?.matches('.cite, .quote') && (!range.startContainer.previousSibling || range.startContainer.previousSibling.nodeName === 'BR')) {
8624
8934
  node.prepend(`>${range.startContainer.parentElement.matches('.quote.invalid') ? ' ' : ''}`);
@@ -8627,29 +8937,26 @@ function quote(anchor, range) {
8627
8937
  anchor = '';
8628
8938
  }
8629
8939
 
8630
- for (let es = node.querySelectorAll('br'), i = 0, len = es.length; i < len; ++i) {
8631
- const el = es[i];
8632
-
8940
+ (0, duff_1.duffEach)(node.querySelectorAll('br'), el => {
8633
8941
  if (anchor && el.nextSibling instanceof global_1.Element && el.nextSibling.matches('.cite, .quote')) {
8634
8942
  el.replaceWith(`\n>${el.nextSibling.matches('.quote.invalid') ? ' ' : ''}`);
8635
- continue;
8943
+ return;
8636
8944
  }
8637
8945
 
8638
8946
  if (anchor && el.parentElement?.closest('.cite, .quote')) {
8639
8947
  el.replaceWith(`\n>${el.parentElement.closest('.quote.invalid') ? ' ' : ''}`);
8640
- continue;
8948
+ return;
8641
8949
  }
8642
8950
 
8643
8951
  if (anchor) {
8644
8952
  el.replaceWith(`\n>>${anchor}\n> `);
8645
8953
  anchor = '';
8646
- continue;
8954
+ return;
8647
8955
  } else {
8648
8956
  el.replaceWith(`\n> `);
8649
- continue;
8957
+ return;
8650
8958
  }
8651
- }
8652
-
8959
+ });
8653
8960
  anchor && node.append(`\n>>${anchor}`);
8654
8961
  return node.textContent;
8655
8962
  }
@@ -8737,6 +9044,8 @@ const global_1 = __webpack_require__(4128);
8737
9044
 
8738
9045
  const dom_1 = __webpack_require__(3252);
8739
9046
 
9047
+ const duff_1 = __webpack_require__(8099);
9048
+
8740
9049
  const array_1 = __webpack_require__(8112); // Bug: Firefox
8741
9050
  //const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `:scope > ${s}[id]`).join();
8742
9051
 
@@ -8744,18 +9053,18 @@ const array_1 = __webpack_require__(8112); // Bug: Firefox
8744
9053
  const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]';
8745
9054
 
8746
9055
  function toc(source) {
8747
- const hs = (0, array_1.push)([], source.querySelectorAll(selector)).map(el => {
9056
+ const hs = (0, duff_1.duffReduce)(source.querySelectorAll(selector), (acc, el) => {
8748
9057
  switch (el.tagName) {
8749
9058
  case 'ASIDE':
8750
- return (0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
9059
+ return (0, array_1.push)(acc, [(0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
8751
9060
  id: el.id,
8752
9061
  class: 'aside'
8753
- }, el.firstElementChild.cloneNode(true).childNodes);
9062
+ }, el.firstElementChild.cloneNode(true).childNodes)]);
8754
9063
 
8755
9064
  default:
8756
- return el;
9065
+ return (0, array_1.push)(acc, [el]);
8757
9066
  }
8758
- });
9067
+ }, []);
8759
9068
  return parse(cons(hs));
8760
9069
  }
8761
9070
 
@@ -8769,7 +9078,7 @@ function parse(node, index = '') {
8769
9078
  return (0, dom_1.html)('li', (0, array_1.push)([(0, dom_1.html)('a', {
8770
9079
  href: `#${el.id}`,
8771
9080
  'data-index': isHeading ? idx : global_1.undefined
8772
- }, fix(el))], cs.length > 0 ? [parse(cs, idx)] : []));
9081
+ }, unlink(el.cloneNode(true)))], cs.length > 0 ? [parse(cs, idx)] : []));
8773
9082
  }));
8774
9083
  }
8775
9084
 
@@ -8784,14 +9093,8 @@ function level(h) {
8784
9093
  return +h.tagName[1];
8785
9094
  }
8786
9095
 
8787
- function fix(h) {
8788
- h = h.cloneNode(true);
8789
-
8790
- for (let es = h.getElementsByTagName('a'), i = 0, len = es.length; i < len; ++i) {
8791
- const el = es[i];
8792
- el.replaceWith(...el.childNodes);
8793
- }
8794
-
9096
+ function unlink(h) {
9097
+ (0, duff_1.duffEach)(h.getElementsByTagName('a'), el => void el.replaceWith(...el.childNodes));
8795
9098
  return h.childNodes;
8796
9099
  }
8797
9100
 
@@ -8800,7 +9103,7 @@ function fix(h) {
8800
9103
  /***/ 3252:
8801
9104
  /***/ (function(module) {
8802
9105
 
8803
- /*! typed-dom v0.0.299 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9106
+ /*! typed-dom v0.0.301 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8804
9107
  (function webpackUniversalModuleDefinition(root, factory) {
8805
9108
  if(true)
8806
9109
  module.exports = factory();
@@ -9234,7 +9537,7 @@ exports.defrag = defrag;
9234
9537
  /***/ 6120:
9235
9538
  /***/ (function(module) {
9236
9539
 
9237
- /*! typed-dom v0.0.299 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9540
+ /*! typed-dom v0.0.301 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9238
9541
  (function webpackUniversalModuleDefinition(root, factory) {
9239
9542
  if(true)
9240
9543
  module.exports = factory();
@@ -9242,8 +9545,320 @@ exports.defrag = defrag;
9242
9545
  })(this, () => {
9243
9546
  return /******/ (() => { // webpackBootstrap
9244
9547
  /******/ "use strict";
9548
+ /******/ var __webpack_modules__ = ({
9549
+
9550
+ /***/ 112:
9551
+ /***/ ((__unused_webpack_module, exports, __nested_webpack_require_645__) => {
9552
+
9553
+
9554
+
9555
+ Object.defineProperty(exports, "__esModule", ({
9556
+ value: true
9557
+ }));
9558
+ exports.splice = exports.pop = exports.push = exports.shift = exports.unshift = exports.indexOf = void 0;
9559
+
9560
+ const global_1 = __nested_webpack_require_645__(128);
9561
+
9562
+ function indexOf(as, a) {
9563
+ if (as.length === 0) return -1;
9564
+ return a === a ? as.indexOf(a) : as.findIndex(a => a !== a);
9565
+ }
9566
+
9567
+ exports.indexOf = indexOf;
9568
+
9569
+ function unshift(as, bs) {
9570
+ if ('length' in as) {
9571
+ for (let i = as.length - 1; i >= 0; --i) {
9572
+ bs.unshift(as[i]);
9573
+ }
9574
+ } else {
9575
+ bs.unshift(...as);
9576
+ }
9577
+
9578
+ return bs;
9579
+ }
9580
+
9581
+ exports.unshift = unshift;
9582
+
9583
+ function shift(as, count) {
9584
+ if (count < 0) throw new Error('Unexpected negative number');
9585
+ return count === void 0 ? [as.shift(), as] : [splice(as, 0, count), as];
9586
+ }
9587
+
9588
+ exports.shift = shift;
9589
+
9590
+ function push(as, bs) {
9591
+ if ('length' in bs) {
9592
+ for (let i = 0, len = bs.length; i < len; ++i) {
9593
+ as.push(bs[i]);
9594
+ }
9595
+ } else {
9596
+ for (const b of bs) {
9597
+ as.push(b);
9598
+ }
9599
+ }
9600
+
9601
+ return as;
9602
+ }
9603
+
9604
+ exports.push = push;
9605
+
9606
+ function pop(as, count) {
9607
+ if (count < 0) throw new Error('Unexpected negative number');
9608
+ return count === void 0 ? [as, as.pop()] : [as, splice(as, as.length - count, count)];
9609
+ }
9610
+
9611
+ exports.pop = pop;
9612
+
9613
+ function splice(as, index, count, ...inserts) {
9614
+ if (count === 0 && inserts.length === 0) return [];
9615
+ count = count > as.length ? as.length : count;
9616
+
9617
+ switch (index) {
9618
+ case 0:
9619
+ switch (count) {
9620
+ case 0:
9621
+ return [[], unshift(inserts, as)][0];
9622
+
9623
+ case 1:
9624
+ return as.length === 0 ? [[], unshift(inserts, as)][0] : [[as.shift()], unshift(inserts, as)][0];
9625
+
9626
+ case void 0:
9627
+ if (as.length > 1 || arguments.length > 2) break;
9628
+ return as.length === 0 ? [] : splice(as, index, 1);
9629
+ }
9630
+
9631
+ break;
9632
+
9633
+ case -1:
9634
+ case as.length - 1:
9635
+ switch (count) {
9636
+ case 1:
9637
+ return as.length === 0 ? [[], push(as, inserts)][0] : [[as.pop()], push(as, inserts)][0];
9638
+
9639
+ case void 0:
9640
+ if (as.length > 1 || arguments.length > 2) break;
9641
+ return as.length === 0 ? [] : splice(as, index, 1);
9642
+ }
9643
+
9644
+ break;
9645
+
9646
+ case as.length:
9647
+ case global_1.Infinity:
9648
+ return [[], push(as, inserts)][0];
9649
+ }
9650
+
9651
+ return arguments.length > 2 ? as.splice(index, count, ...inserts) : as.splice(index);
9652
+ }
9653
+
9654
+ exports.splice = splice;
9655
+
9656
+ /***/ }),
9657
+
9658
+ /***/ 99:
9659
+ /***/ ((__unused_webpack_module, exports) => {
9660
+
9661
+
9662
+
9663
+ Object.defineProperty(exports, "__esModule", ({
9664
+ value: true
9665
+ }));
9666
+ exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0;
9667
+
9668
+ function duff(count, proc) {
9669
+ if (count > 0) {
9670
+ let i = 0,
9671
+ m = count % 8,
9672
+ d = (count - m) / 8;
9673
+
9674
+ while (m--) {
9675
+ proc(i++);
9676
+ }
9677
+
9678
+ while (d--) {
9679
+ proc(i++);
9680
+ proc(i++);
9681
+ proc(i++);
9682
+ proc(i++);
9683
+ proc(i++);
9684
+ proc(i++);
9685
+ proc(i++);
9686
+ proc(i++);
9687
+ }
9688
+ } else {
9689
+ let i = -count,
9690
+ m = i % 8,
9691
+ d = (i - m) / 8;
9692
+
9693
+ while (m--) {
9694
+ proc(--i);
9695
+ }
9696
+
9697
+ while (d--) {
9698
+ proc(--i);
9699
+ proc(--i);
9700
+ proc(--i);
9701
+ proc(--i);
9702
+ proc(--i);
9703
+ proc(--i);
9704
+ proc(--i);
9705
+ proc(--i);
9706
+ }
9707
+ }
9708
+ }
9709
+
9710
+ exports.duff = duff;
9711
+
9712
+ function duffbk(count, proc) {
9713
+ if (count > 0) {
9714
+ let i = 0,
9715
+ m = count % 8,
9716
+ d = (count - m) / 8;
9717
+
9718
+ while (m--) {
9719
+ if (proc(i++) === false) return;
9720
+ }
9721
+
9722
+ while (d--) {
9723
+ if (proc(i++) === false) return;
9724
+ if (proc(i++) === false) return;
9725
+ if (proc(i++) === false) return;
9726
+ if (proc(i++) === false) return;
9727
+ if (proc(i++) === false) return;
9728
+ if (proc(i++) === false) return;
9729
+ if (proc(i++) === false) return;
9730
+ if (proc(i++) === false) return;
9731
+ }
9732
+ } else {
9733
+ let i = -count,
9734
+ m = i % 8,
9735
+ d = (i - m) / 8;
9736
+
9737
+ while (m--) {
9738
+ if (proc(--i) === false) return;
9739
+ }
9740
+
9741
+ while (d--) {
9742
+ if (proc(--i) === false) return;
9743
+ if (proc(--i) === false) return;
9744
+ if (proc(--i) === false) return;
9745
+ if (proc(--i) === false) return;
9746
+ if (proc(--i) === false) return;
9747
+ if (proc(--i) === false) return;
9748
+ if (proc(--i) === false) return;
9749
+ if (proc(--i) === false) return;
9750
+ }
9751
+ }
9752
+ }
9753
+
9754
+ exports.duffbk = duffbk;
9755
+
9756
+ function duffEach(array, proc) {
9757
+ let count = array.length;
9758
+ let i = 0,
9759
+ m = count % 8,
9760
+ d = (count - m) / 8;
9761
+
9762
+ while (m--) {
9763
+ proc(array[i], i++, array);
9764
+ }
9765
+
9766
+ while (d--) {
9767
+ proc(array[i], i++, array);
9768
+ proc(array[i], i++, array);
9769
+ proc(array[i], i++, array);
9770
+ proc(array[i], i++, array);
9771
+ proc(array[i], i++, array);
9772
+ proc(array[i], i++, array);
9773
+ proc(array[i], i++, array);
9774
+ proc(array[i], i++, array);
9775
+ }
9776
+ }
9777
+
9778
+ exports.duffEach = duffEach;
9779
+
9780
+ function duffReduce(array, proc, initial) {
9781
+ let count = array.length;
9782
+ let i = 0,
9783
+ m = count % 8,
9784
+ d = (count - m) / 8;
9785
+
9786
+ while (m--) {
9787
+ initial = proc(initial, array[i], i++, array);
9788
+ }
9789
+
9790
+ while (d--) {
9791
+ initial = proc(initial, array[i], i++, array);
9792
+ initial = proc(initial, array[i], i++, array);
9793
+ initial = proc(initial, array[i], i++, array);
9794
+ initial = proc(initial, array[i], i++, array);
9795
+ initial = proc(initial, array[i], i++, array);
9796
+ initial = proc(initial, array[i], i++, array);
9797
+ initial = proc(initial, array[i], i++, array);
9798
+ initial = proc(initial, array[i], i++, array);
9799
+ }
9800
+
9801
+ return initial;
9802
+ }
9803
+
9804
+ exports.duffReduce = duffReduce;
9805
+
9806
+ /***/ }),
9807
+
9808
+ /***/ 128:
9809
+ /***/ ((module, __unused_webpack_exports, __nested_webpack_require_6113__) => {
9810
+
9811
+
9812
+
9813
+ __nested_webpack_require_6113__(921);
9814
+
9815
+ const global = void 0 || typeof globalThis !== 'undefined' && globalThis // @ts-ignore
9816
+ || typeof self !== 'undefined' && self || Function('return this')();
9817
+ global.global = global;
9818
+ module.exports = global;
9819
+
9820
+ /***/ }),
9821
+
9822
+ /***/ 921:
9823
+ /***/ (() => {
9824
+
9825
+ // @ts-ignore
9826
+
9827
+ var globalThis; // @ts-ignore
9828
+
9829
+ var global = (/* unused pure expression or super */ null && (0));
9830
+
9831
+ /***/ })
9832
+
9833
+ /******/ });
9834
+ /************************************************************************/
9835
+ /******/ // The module cache
9836
+ /******/ var __webpack_module_cache__ = {};
9837
+ /******/
9838
+ /******/ // The require function
9839
+ /******/ function __nested_webpack_require_6765__(moduleId) {
9840
+ /******/ // Check if module is in cache
9841
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
9842
+ /******/ if (cachedModule !== undefined) {
9843
+ /******/ return cachedModule.exports;
9844
+ /******/ }
9845
+ /******/ // Create a new module (and put it into the cache)
9846
+ /******/ var module = __webpack_module_cache__[moduleId] = {
9847
+ /******/ // no module.id needed
9848
+ /******/ // no module.loaded needed
9849
+ /******/ exports: {}
9850
+ /******/ };
9851
+ /******/
9852
+ /******/ // Execute the module function
9853
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_6765__);
9854
+ /******/
9855
+ /******/ // Return the exports of the module
9856
+ /******/ return module.exports;
9857
+ /******/ }
9858
+ /******/
9859
+ /************************************************************************/
9245
9860
  var __webpack_exports__ = {};
9246
- // This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
9861
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
9247
9862
  (() => {
9248
9863
  var exports = __webpack_exports__;
9249
9864
 
@@ -9253,6 +9868,10 @@ Object.defineProperty(exports, "__esModule", ({
9253
9868
  }));
9254
9869
  exports.querySelectorAll = exports.querySelector = void 0;
9255
9870
 
9871
+ const duff_1 = __nested_webpack_require_6765__(99);
9872
+
9873
+ const array_1 = __nested_webpack_require_6765__(112);
9874
+
9256
9875
  function querySelector(node, selector) {
9257
9876
  return 'matches' in node && node.matches(selector) ? node : node.querySelector(selector);
9258
9877
  }
@@ -9266,13 +9885,7 @@ function querySelectorAll(node, selector) {
9266
9885
  acc.push(node);
9267
9886
  }
9268
9887
 
9269
- const nodes = node.querySelectorAll(selector);
9270
-
9271
- for (let i = 0, len = nodes.length; i < len; ++i) {
9272
- acc.push(nodes[i]);
9273
- }
9274
-
9275
- return acc;
9888
+ return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc, node) => (0, array_1.push)(acc, [node]), acc);
9276
9889
  }
9277
9890
 
9278
9891
  exports.querySelectorAll = querySelectorAll;