securemark 0.257.3 → 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 (76) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.js +1216 -606
  3. package/markdown.d.ts +1 -12
  4. package/package.json +9 -9
  5. package/src/combinator/control/manipulation/convert.ts +8 -4
  6. package/src/combinator/control/manipulation/scope.ts +10 -2
  7. package/src/combinator/data/parser/context/delimiter.ts +70 -0
  8. package/src/combinator/data/parser/context/memo.ts +30 -0
  9. package/src/combinator/{control/manipulation → data/parser}/context.test.ts +9 -9
  10. package/src/combinator/data/parser/context.ts +161 -0
  11. package/src/combinator/data/parser/sequence.test.ts +1 -1
  12. package/src/combinator/data/parser/sequence.ts +1 -1
  13. package/src/combinator/data/parser/some.test.ts +1 -1
  14. package/src/combinator/data/parser/some.ts +14 -37
  15. package/src/combinator/data/parser/subsequence.test.ts +1 -1
  16. package/src/combinator/data/parser/union.test.ts +1 -1
  17. package/src/combinator/data/parser.ts +7 -47
  18. package/src/combinator.ts +1 -2
  19. package/src/parser/api/bind.ts +5 -5
  20. package/src/parser/api/parse.ts +3 -1
  21. package/src/parser/block/blockquote.ts +1 -1
  22. package/src/parser/block/dlist.ts +4 -10
  23. package/src/parser/block/extension/figure.ts +4 -3
  24. package/src/parser/block/extension/table.ts +2 -2
  25. package/src/parser/block/heading.ts +5 -13
  26. package/src/parser/block/ilist.ts +3 -2
  27. package/src/parser/block/olist.ts +10 -7
  28. package/src/parser/block/paragraph.ts +1 -1
  29. package/src/parser/block/reply/cite.ts +1 -1
  30. package/src/parser/block/reply/quote.ts +1 -1
  31. package/src/parser/block/reply.ts +1 -1
  32. package/src/parser/block/sidefence.ts +1 -1
  33. package/src/parser/block/table.ts +9 -9
  34. package/src/parser/block/ulist.ts +4 -3
  35. package/src/parser/block.ts +1 -1
  36. package/src/parser/context.ts +32 -0
  37. package/src/parser/header.ts +1 -1
  38. package/src/parser/inline/annotation.ts +9 -17
  39. package/src/parser/inline/autolink/email.ts +1 -1
  40. package/src/parser/inline/autolink/url.ts +1 -1
  41. package/src/parser/inline/autolink.ts +5 -3
  42. package/src/parser/inline/bracket.ts +16 -15
  43. package/src/parser/inline/code.ts +1 -1
  44. package/src/parser/inline/comment.ts +4 -3
  45. package/src/parser/inline/deletion.ts +5 -4
  46. package/src/parser/inline/emphasis.ts +5 -4
  47. package/src/parser/inline/emstrong.ts +5 -4
  48. package/src/parser/inline/extension/index.ts +7 -14
  49. package/src/parser/inline/extension/indexee.ts +8 -10
  50. package/src/parser/inline/extension/indexer.ts +4 -3
  51. package/src/parser/inline/extension/label.ts +3 -2
  52. package/src/parser/inline/extension/placeholder.ts +5 -4
  53. package/src/parser/inline/html.ts +5 -4
  54. package/src/parser/inline/htmlentity.ts +1 -1
  55. package/src/parser/inline/insertion.ts +5 -4
  56. package/src/parser/inline/link.ts +11 -20
  57. package/src/parser/inline/mark.ts +5 -4
  58. package/src/parser/inline/math.ts +1 -1
  59. package/src/parser/inline/media.ts +8 -7
  60. package/src/parser/inline/reference.ts +10 -16
  61. package/src/parser/inline/ruby.ts +4 -3
  62. package/src/parser/inline/shortmedia.ts +3 -2
  63. package/src/parser/inline/strong.ts +5 -4
  64. package/src/parser/inline/template.test.ts +1 -1
  65. package/src/parser/inline/template.ts +9 -6
  66. package/src/parser/locale.ts +6 -7
  67. package/src/parser/processor/footnote.ts +5 -3
  68. package/src/parser/source/text.ts +1 -1
  69. package/src/parser/util.ts +0 -220
  70. package/src/parser/visibility.ts +205 -0
  71. package/src/util/info.ts +4 -2
  72. package/src/util/quote.ts +12 -15
  73. package/src/util/toc.ts +14 -17
  74. package/webpack.config.js +1 -0
  75. package/src/combinator/control/manipulation/context.ts +0 -70
  76. package/src/combinator/control/manipulation/resource.ts +0 -54
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.257.3 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";
@@ -2891,7 +3161,7 @@ function sequence(parsers) {
2891
3161
 
2892
3162
  for (let i = 0, len = parsers.length; i < len; ++i) {
2893
3163
  if (rest === '') return;
2894
- if (context.delimiters?.match(rest, context.precedence)) break;
3164
+ if (context.delimiters?.match(rest, context.precedence)) return;
2895
3165
  const result = parsers[i](rest, context);
2896
3166
  if (!result) return;
2897
3167
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -2921,42 +3191,16 @@ const global_1 = __webpack_require__(4128);
2921
3191
 
2922
3192
  const parser_1 = __webpack_require__(6728);
2923
3193
 
2924
- const memoize_1 = __webpack_require__(1808);
3194
+ const delimiter_1 = __webpack_require__(1435);
2925
3195
 
2926
3196
  const array_1 = __webpack_require__(8112);
2927
3197
 
2928
- const signature = pattern => {
2929
- switch (typeof pattern) {
2930
- case 'undefined':
2931
- return signature('');
2932
-
2933
- case 'string':
2934
- return `s:${pattern}`;
2935
-
2936
- case 'object':
2937
- return `r/${pattern.source}/${pattern.flags}`;
2938
- }
2939
- };
2940
-
2941
- const matcher = (0, memoize_1.memoize)(pattern => {
2942
- switch (typeof pattern) {
2943
- case 'undefined':
2944
- return () => global_1.undefined;
2945
-
2946
- case 'string':
2947
- return source => source.slice(0, pattern.length) === pattern || global_1.undefined;
2948
-
2949
- case 'object':
2950
- return (0, memoize_1.reduce)(source => pattern.test(source) || global_1.undefined);
2951
- }
2952
- }, signature);
2953
-
2954
- function some(parser, until, deeps = [], limit = -1) {
2955
- if (typeof until === 'number') return some(parser, global_1.undefined, deeps, until);
2956
- const match = matcher(until);
2957
- const delimiters = deeps.map(([delimiter, precedence]) => ({
2958
- signature: signature(delimiter),
2959
- 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),
2960
3204
  precedence
2961
3205
  }));
2962
3206
  return (source, context) => {
@@ -2964,9 +3208,9 @@ function some(parser, until, deeps = [], limit = -1) {
2964
3208
  let rest = source;
2965
3209
  let nodes;
2966
3210
 
2967
- if (delimiters.length > 0) {
2968
- context.delimiters ??= new parser_1.Delimiters();
2969
- context.delimiters.push(...delimiters);
3211
+ if (delims.length > 0) {
3212
+ context.delimiters ??= new delimiter_1.Delimiters();
3213
+ context.delimiters.push(...delims);
2970
3214
  }
2971
3215
 
2972
3216
  while (true) {
@@ -2980,8 +3224,8 @@ function some(parser, until, deeps = [], limit = -1) {
2980
3224
  if (limit >= 0 && source.length - rest.length > limit) break;
2981
3225
  }
2982
3226
 
2983
- if (delimiters.length > 0) {
2984
- context.delimiters.pop(delimiters.length);
3227
+ if (delims.length > 0) {
3228
+ context.delimiters.pop(delims.length);
2985
3229
  }
2986
3230
 
2987
3231
  return nodes && rest.length < source.length ? [nodes, rest] : global_1.undefined;
@@ -3193,11 +3437,13 @@ const global_1 = __webpack_require__(4128);
3193
3437
 
3194
3438
  const parser_1 = __webpack_require__(6728);
3195
3439
 
3440
+ const segment_1 = __webpack_require__(9002);
3441
+
3196
3442
  const header_1 = __webpack_require__(5702);
3197
3443
 
3198
3444
  const block_1 = __webpack_require__(4032);
3199
3445
 
3200
- const segment_1 = __webpack_require__(9002);
3446
+ const context_1 = __webpack_require__(6484);
3201
3447
 
3202
3448
  const normalize_1 = __webpack_require__(185);
3203
3449
 
@@ -3213,7 +3459,8 @@ const array_1 = __webpack_require__(8112);
3213
3459
 
3214
3460
  function bind(target, settings) {
3215
3461
  let context = { ...settings,
3216
- 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
3217
3464
  };
3218
3465
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3219
3466
  const blocks = [];
@@ -3355,9 +3602,8 @@ function bind(target, settings) {
3355
3602
 
3356
3603
  function nearest(index) {
3357
3604
  let el;
3358
- let len = 0;
3359
3605
 
3360
- for (let i = 0; i < blocks.length; ++i) {
3606
+ for (let i = 0, len = 0; i < blocks.length; ++i) {
3361
3607
  const block = blocks[i];
3362
3608
  len += block[0].length;
3363
3609
  el = block[1][0] ?? el;
@@ -3368,9 +3614,7 @@ function bind(target, settings) {
3368
3614
  }
3369
3615
 
3370
3616
  function index(source) {
3371
- let len = 0;
3372
-
3373
- for (let i = 0; i < blocks.length; ++i) {
3617
+ for (let i = 0, len = 0; i < blocks.length; ++i) {
3374
3618
  const block = blocks[i];
3375
3619
  if (block[1].includes(source)) return len;
3376
3620
  len += block[0].length;
@@ -3544,11 +3788,13 @@ const global_1 = __webpack_require__(4128);
3544
3788
 
3545
3789
  const parser_1 = __webpack_require__(6728);
3546
3790
 
3791
+ const segment_1 = __webpack_require__(9002);
3792
+
3547
3793
  const header_1 = __webpack_require__(5702);
3548
3794
 
3549
3795
  const block_1 = __webpack_require__(4032);
3550
3796
 
3551
- const segment_1 = __webpack_require__(9002);
3797
+ const context_1 = __webpack_require__(6484);
3552
3798
 
3553
3799
  const normalize_1 = __webpack_require__(185);
3554
3800
 
@@ -3573,7 +3819,8 @@ function parse(source, opts = {}, context) {
3573
3819
  caches: context?.caches,
3574
3820
  ...(context?.resources && {
3575
3821
  resources: context.resources
3576
- })
3822
+ }),
3823
+ backtrackable: context_1.backtrackable
3577
3824
  };
3578
3825
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3579
3826
  const node = (0, dom_1.frag)();
@@ -3671,7 +3918,7 @@ const random_1 = __webpack_require__(7325);
3671
3918
  exports.block = (0, combinator_1.creator)(error((0, combinator_1.reset)({
3672
3919
  resources: {
3673
3920
  budget: 50 * 1000,
3674
- recursion: 20 + 1
3921
+ recursion: 20
3675
3922
  }
3676
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]))));
3677
3924
 
@@ -3826,26 +4073,27 @@ const source_1 = __webpack_require__(6743);
3826
4073
 
3827
4074
  const locale_1 = __webpack_require__(5485);
3828
4075
 
3829
- const util_1 = __webpack_require__(9437);
4076
+ const visibility_1 = __webpack_require__(7618);
3830
4077
 
3831
4078
  const dom_1 = __webpack_require__(3252);
3832
4079
 
3833
4080
  const array_1 = __webpack_require__(8112);
3834
4081
 
3835
- 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)({
3836
- syntax: {
3837
- inline: {
3838
- annotation: false,
3839
- reference: false,
3840
- index: false,
3841
- label: false,
3842
- link: false,
3843
- media: false
3844
- }
3845
- }
3846
- }, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))]))));
3847
- 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))]))));
3848
- 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));
3849
4097
 
3850
4098
  function fillTrailingDescription(es) {
3851
4099
  return es.length > 0 && es[es.length - 1].tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
@@ -4122,7 +4370,7 @@ const inline_1 = __webpack_require__(1160);
4122
4370
 
4123
4371
  const locale_1 = __webpack_require__(5485);
4124
4372
 
4125
- const util_1 = __webpack_require__(9437);
4373
+ const visibility_1 = __webpack_require__(7618);
4126
4374
 
4127
4375
  const dom_1 = __webpack_require__(3252);
4128
4376
 
@@ -4130,13 +4378,9 @@ const memoize_1 = __webpack_require__(1808);
4130
4378
 
4131
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.
4132
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, [])));
4133
- 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)({
4134
- syntax: {
4135
- inline: {
4136
- media: false
4137
- }
4138
- }
4139
- }, (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', {
4140
4384
  class: 'figindex'
4141
4385
  }), (0, dom_1.html)('span', {
4142
4386
  class: 'figtext'
@@ -4382,7 +4626,7 @@ const source_1 = __webpack_require__(6743);
4382
4626
 
4383
4627
  const locale_1 = __webpack_require__(5485);
4384
4628
 
4385
- const util_1 = __webpack_require__(9437);
4629
+ const visibility_1 = __webpack_require__(7618);
4386
4630
 
4387
4631
  const dom_1 = __webpack_require__(3252);
4388
4632
 
@@ -4423,8 +4667,8 @@ const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.
4423
4667
  const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
4424
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(''))));
4425
4669
  const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/;
4426
- 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));
4427
- 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));
4428
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)]))));
4429
4673
 
4430
4674
  function attributes(source) {
@@ -4655,29 +4899,26 @@ const inline_1 = __webpack_require__(1160);
4655
4899
 
4656
4900
  const source_1 = __webpack_require__(6743);
4657
4901
 
4658
- const util_1 = __webpack_require__(9437);
4902
+ const visibility_1 = __webpack_require__(7618);
4659
4903
 
4660
4904
  const dom_1 = __webpack_require__(3252);
4661
4905
 
4662
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], ''])))));
4663
- exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.context)({
4664
- syntax: {
4665
- inline: {
4666
- annotation: false,
4667
- reference: false,
4668
- index: false,
4669
- label: false,
4670
- link: false,
4671
- media: false
4672
- }
4673
- }
4674
- }, (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)({
4675
- syntax: {
4676
- inline: {
4677
- autolink: false
4678
- }
4679
- }
4680
- }, (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`, {
4681
4922
  class: 'invalid',
4682
4923
  'data-invalid-syntax': 'heading',
4683
4924
  'data-invalid-type': 'syntax',
@@ -4726,13 +4967,9 @@ const inline_1 = __webpack_require__(1160);
4726
4967
 
4727
4968
  const dom_1 = __webpack_require__(3252);
4728
4969
 
4729
- exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({
4730
- syntax: {
4731
- inline: {
4732
- media: false
4733
- }
4734
- }
4735
- }, 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_))));
4736
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', {
4737
4974
  class: 'invalid',
4738
4975
  'data-invalid-syntax': 'list',
@@ -4803,12 +5040,14 @@ const inline_1 = __webpack_require__(1160);
4803
5040
 
4804
5041
  const source_1 = __webpack_require__(6743);
4805
5042
 
4806
- const util_1 = __webpack_require__(9437);
5043
+ const visibility_1 = __webpack_require__(7618);
4807
5044
 
4808
5045
  const dom_1 = __webpack_require__(3252);
4809
5046
 
4810
5047
  const memoize_1 = __webpack_require__(1808);
4811
5048
 
5049
+ const duff_1 = __webpack_require__(8099);
5050
+
4812
5051
  const array_1 = __webpack_require__(8112);
4813
5052
 
4814
5053
  const tuple_1 = __webpack_require__(5341);
@@ -4817,16 +5056,12 @@ const openers = {
4817
5056
  '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
4818
5057
  '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
4819
5058
  };
4820
- 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)({
4821
- syntax: {
4822
- inline: {
4823
- media: false
4824
- }
4825
- }
4826
- }, 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_))));
4827
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, []))])));
4828
5063
 
4829
- 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', {
4830
5065
  'data-marker': ns[0] || global_1.undefined
4831
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)]);
4832
5067
 
@@ -4909,20 +5144,19 @@ function format(el, type, form) {
4909
5144
  'data-type': style(type) || global_1.undefined
4910
5145
  });
4911
5146
  const marker = el.firstElementChild?.getAttribute('data-marker').match(initial(type))?.[0] ?? '';
4912
-
4913
- 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 => {
4914
5149
  const el = es[i];
4915
5150
 
4916
5151
  switch (el.getAttribute('data-marker')) {
4917
5152
  case '':
4918
5153
  case marker:
4919
5154
  el.removeAttribute('data-marker');
4920
- continue;
5155
+ return;
4921
5156
  }
4922
5157
 
4923
- break;
4924
- }
4925
-
5158
+ return false;
5159
+ });
4926
5160
  return el;
4927
5161
  }
4928
5162
 
@@ -4945,11 +5179,11 @@ const inline_1 = __webpack_require__(1160);
4945
5179
 
4946
5180
  const locale_1 = __webpack_require__(5485);
4947
5181
 
4948
- const util_1 = __webpack_require__(9437);
5182
+ const visibility_1 = __webpack_require__(7618);
4949
5183
 
4950
5184
  const dom_1 = __webpack_require__(3252);
4951
5185
 
4952
- 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))])));
4953
5187
 
4954
5188
  /***/ }),
4955
5189
 
@@ -4976,7 +5210,7 @@ const source_1 = __webpack_require__(6743);
4976
5210
 
4977
5211
  const locale_1 = __webpack_require__(5485);
4978
5212
 
4979
- const util_1 = __webpack_require__(9437);
5213
+ const visibility_1 = __webpack_require__(7618);
4980
5214
 
4981
5215
  const dom_1 = __webpack_require__(3252);
4982
5216
 
@@ -4989,7 +5223,7 @@ const array_1 = __webpack_require__(8112);
4989
5223
  */
4990
5224
 
4991
5225
 
4992
- 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]))]))));
4993
5227
 
4994
5228
  /***/ }),
4995
5229
 
@@ -5148,10 +5382,12 @@ const inline_1 = __webpack_require__(1160);
5148
5382
 
5149
5383
  const source_1 = __webpack_require__(6743);
5150
5384
 
5151
- const util_1 = __webpack_require__(9437);
5385
+ const visibility_1 = __webpack_require__(7618);
5152
5386
 
5153
5387
  const dom_1 = __webpack_require__(3252);
5154
5388
 
5389
+ const duff_1 = __webpack_require__(8099);
5390
+
5155
5391
  const array_1 = __webpack_require__(8112);
5156
5392
 
5157
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))])])));
@@ -5165,23 +5401,21 @@ const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fal
5165
5401
 
5166
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))]));
5167
5403
  const cell = (0, combinator_1.surround)(/^\|\s*(?=\S)/, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /^\|/, [[/^[|\\]?\s*$/, 9]]), /^[^|]*/, true);
5168
- const head = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))]));
5169
- const data = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))]));
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)))]));
5170
5406
 
5171
5407
  function format(rows) {
5172
- 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]), []);
5173
5409
 
5174
- for (let i = 0, len = rows.length; i < len; ++i) {
5175
- const cols = rows[i].children;
5176
-
5177
- 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) => {
5178
5412
  if (i > 0 && !aligns[i]) {
5179
5413
  aligns[i] = aligns[i - 1];
5180
5414
  }
5181
5415
 
5182
- if (!aligns[i]) continue;
5183
- cols[i].setAttribute('align', aligns[i]);
5184
- }
5416
+ if (!aligns[i]) return;
5417
+ col.setAttribute('align', aligns[i]);
5418
+ });
5185
5419
  }
5186
5420
 
5187
5421
  return rows;
@@ -5208,20 +5442,16 @@ const ilist_1 = __webpack_require__(238);
5208
5442
 
5209
5443
  const inline_1 = __webpack_require__(1160);
5210
5444
 
5211
- const util_1 = __webpack_require__(9437);
5445
+ const visibility_1 = __webpack_require__(7618);
5212
5446
 
5213
5447
  const dom_1 = __webpack_require__(3252);
5214
5448
 
5215
5449
  const array_1 = __webpack_require__(8112);
5216
5450
 
5217
- exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({
5218
- syntax: {
5219
- inline: {
5220
- media: false
5221
- }
5222
- }
5223
- }, exports.ulist_))));
5224
- 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))])));
5225
5455
  exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
5226
5456
  class: 'checkbox'
5227
5457
  }, source[1].trimStart() ? '☑' : '☐')], '']);
@@ -5242,6 +5472,30 @@ function format(el) {
5242
5472
 
5243
5473
  /***/ }),
5244
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
+
5245
5499
  /***/ 5702:
5246
5500
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5247
5501
 
@@ -5408,28 +5662,23 @@ const inline_1 = __webpack_require__(1160);
5408
5662
 
5409
5663
  const link_1 = __webpack_require__(9628);
5410
5664
 
5411
- const util_1 = __webpack_require__(9437);
5665
+ const visibility_1 = __webpack_require__(7618);
5412
5666
 
5413
5667
  const dom_1 = __webpack_require__(3252);
5414
5668
 
5415
- 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)({
5416
- syntax: {
5417
- inline: {
5418
- annotation: false,
5419
- // Redundant
5420
- //reference: true,
5421
- media: false // Redundant
5422
- //index: true,
5423
- //label: true,
5424
- //link: true,
5425
- //autolink: true,
5426
-
5427
- }
5428
- },
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)({
5429
5678
  delimiters: global_1.undefined
5430
- }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 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', {
5431
5680
  class: 'annotation'
5432
- }, [(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)))));
5433
5682
 
5434
5683
  /***/ }),
5435
5684
 
@@ -5464,11 +5713,15 @@ const source_1 = __webpack_require__(6743);
5464
5713
 
5465
5714
  const util_1 = __webpack_require__(9437);
5466
5715
 
5467
- 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.
5468
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.
5469
5722
  (0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
5470
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.
5471
- (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)]);
5472
5725
 
5473
5726
  /***/ }),
5474
5727
 
@@ -5690,12 +5943,26 @@ const dom_1 = __webpack_require__(3252);
5690
5943
  const array_1 = __webpack_require__(8112);
5691
5944
 
5692
5945
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5693
- 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)(2, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (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', {
5694
5951
  class: 'paren'
5695
- }, (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)(2, (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)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (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', {
5696
5957
  class: 'paren'
5697
- }, (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)(2, (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.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(2, (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.
5698
- (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]))]));
5699
5966
 
5700
5967
  /***/ }),
5701
5968
 
@@ -5747,11 +6014,13 @@ const memoize_1 = __webpack_require__(1808);
5747
6014
 
5748
6015
  const array_1 = __webpack_require__(8112);
5749
6016
 
5750
- 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', {
5751
6020
  class: 'comment'
5752
6021
  }, [(0, dom_1.html)('input', {
5753
6022
  type: 'checkbox'
5754
- }), (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, [])))));
5755
6024
 
5756
6025
  /***/ }),
5757
6026
 
@@ -5772,13 +6041,15 @@ const inline_1 = __webpack_require__(1160);
5772
6041
 
5773
6042
  const source_1 = __webpack_require__(6743);
5774
6043
 
5775
- const util_1 = __webpack_require__(9437);
6044
+ const visibility_1 = __webpack_require__(7618);
5776
6045
 
5777
6046
  const dom_1 = __webpack_require__(3252);
5778
6047
 
5779
6048
  const array_1 = __webpack_require__(8112);
5780
6049
 
5781
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(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, 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])));
5782
6053
 
5783
6054
  /***/ }),
5784
6055
 
@@ -5803,13 +6074,15 @@ const strong_1 = __webpack_require__(8072);
5803
6074
 
5804
6075
  const source_1 = __webpack_require__(6743);
5805
6076
 
5806
- const util_1 = __webpack_require__(9437);
6077
+ const visibility_1 = __webpack_require__(7618);
5807
6078
 
5808
6079
  const dom_1 = __webpack_require__(3252);
5809
6080
 
5810
6081
  const array_1 = __webpack_require__(8112);
5811
6082
 
5812
- 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])));
5813
6086
 
5814
6087
  /***/ }),
5815
6088
 
@@ -5834,15 +6107,17 @@ const emphasis_1 = __webpack_require__(3867);
5834
6107
 
5835
6108
  const source_1 = __webpack_require__(6743);
5836
6109
 
5837
- const util_1 = __webpack_require__(9437);
6110
+ const visibility_1 = __webpack_require__(7618);
5838
6111
 
5839
6112
  const dom_1 = __webpack_require__(3252);
5840
6113
 
5841
6114
  const array_1 = __webpack_require__(8112);
5842
6115
 
5843
- 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]))])));
5844
- 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]))])));
5845
- 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) => {
5846
6121
  switch (cs[0]) {
5847
6122
  case '***':
5848
6123
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
@@ -5853,7 +6128,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, co
5853
6128
  case '*':
5854
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];
5855
6130
  }
5856
- }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6131
+ }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5857
6132
 
5858
6133
  /***/ }),
5859
6134
 
@@ -5939,28 +6214,34 @@ const indexee_1 = __webpack_require__(1269);
5939
6214
 
5940
6215
  const source_1 = __webpack_require__(6743);
5941
6216
 
5942
- const util_1 = __webpack_require__(9437);
6217
+ const visibility_1 = __webpack_require__(7618);
5943
6218
 
5944
6219
  const dom_1 = __webpack_require__(3252);
5945
6220
 
5946
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(2, (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)({
5947
- syntax: {
5948
- inline: {
5949
- annotation: false,
5950
- reference: false,
5951
- index: false,
5952
- label: false,
5953
- link: false,
5954
- media: false,
5955
- autolink: false
5956
- }
5957
- }
5958
- }, (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], [']', 2]])), 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, {
5959
6240
  id: el.id ? null : global_1.undefined,
5960
6241
  class: 'index',
5961
6242
  href: el.id ? `#${el.id}` : global_1.undefined
5962
- }, el.childNodes)])))));
5963
- 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', {
5964
6245
  class: 'indexer',
5965
6246
  'data-index': (0, indexee_1.identity)(ns.join('')).slice(6)
5966
6247
  })])));
@@ -5985,6 +6266,8 @@ const combinator_1 = __webpack_require__(2087);
5985
6266
 
5986
6267
  const dom_1 = __webpack_require__(3252);
5987
6268
 
6269
+ const duff_1 = __webpack_require__(8099);
6270
+
5988
6271
  function indexee(parser, optional) {
5989
6272
  return (0, combinator_1.fmap)(parser, ([el], _, {
5990
6273
  id
@@ -6008,41 +6291,37 @@ function text(source, optional = false) {
6008
6291
  const index = indexer?.getAttribute('data-index');
6009
6292
  if (index) return index;
6010
6293
  const target = source.cloneNode(true);
6011
-
6012
- 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) {
6013
- const el = es[i];
6014
-
6294
+ (0, duff_1.duffEach)(target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), el => {
6015
6295
  switch (el.tagName) {
6016
6296
  case 'CODE':
6017
6297
  (0, dom_1.define)(el, el.getAttribute('data-src'));
6018
- continue;
6298
+ return;
6019
6299
 
6020
6300
  case 'RT':
6021
6301
  case 'RP':
6022
6302
  case 'UL':
6023
6303
  case 'OL':
6024
6304
  el.remove();
6025
- continue;
6305
+ return;
6026
6306
  }
6027
6307
 
6028
6308
  switch (el.className) {
6029
6309
  case 'math':
6030
6310
  (0, dom_1.define)(el, el.getAttribute('data-src'));
6031
- continue;
6311
+ return;
6032
6312
 
6033
6313
  case 'comment':
6034
6314
  case 'checkbox':
6035
6315
  el.remove();
6036
- continue;
6316
+ return;
6037
6317
 
6038
6318
  case 'reference':
6039
6319
  el.firstChild.remove();
6040
- continue;
6320
+ return;
6041
6321
  }
6042
- } // Better:
6322
+ }); // Better:
6043
6323
  //return target.innerText;
6044
6324
 
6045
-
6046
6325
  return target.textContent;
6047
6326
  }
6048
6327
 
@@ -6065,11 +6344,11 @@ const combinator_1 = __webpack_require__(2087);
6065
6344
 
6066
6345
  const index_1 = __webpack_require__(4479);
6067
6346
 
6068
- const util_1 = __webpack_require__(9437);
6069
-
6070
6347
  const dom_1 = __webpack_require__(3252);
6071
6348
 
6072
- 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', {
6073
6352
  href: '#'
6074
6353
  })], '']), index_1.index])), /^\s*$/), // Indexer is invisible but invalids must be visible.
6075
6354
  ([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, dom_1.html)('span', {
@@ -6100,7 +6379,9 @@ const dom_1 = __webpack_require__(3252);
6100
6379
 
6101
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]))/);
6102
6381
  exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
6103
- 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', {
6104
6385
  class: 'label',
6105
6386
  'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6106
6387
  }, text)])));
@@ -6148,7 +6429,7 @@ const inline_1 = __webpack_require__(1160);
6148
6429
 
6149
6430
  const source_1 = __webpack_require__(6743);
6150
6431
 
6151
- const util_1 = __webpack_require__(9437);
6432
+ const visibility_1 = __webpack_require__(7618);
6152
6433
 
6153
6434
  const dom_1 = __webpack_require__(3252);
6154
6435
 
@@ -6156,12 +6437,14 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6156
6437
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6157
6438
 
6158
6439
 
6159
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (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)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), (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', {
6160
6443
  class: 'invalid',
6161
6444
  'data-invalid-syntax': 'extension',
6162
6445
  'data-invalid-type': 'syntax',
6163
6446
  'data-invalid-message': `Reserved start symbol "${as[0][1]}" cannot be used in "[]"`
6164
- }, (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]))));
6165
6448
 
6166
6449
  /***/ }),
6167
6450
 
@@ -6184,7 +6467,7 @@ const inline_1 = __webpack_require__(1160);
6184
6467
 
6185
6468
  const source_1 = __webpack_require__(6743);
6186
6469
 
6187
- const util_1 = __webpack_require__(9437);
6470
+ const visibility_1 = __webpack_require__(7618);
6188
6471
 
6189
6472
  const dom_1 = __webpack_require__(3252);
6190
6473
 
@@ -6202,8 +6485,10 @@ const attrspecs = {
6202
6485
  };
6203
6486
  global_1.Object.setPrototypeOf(attrspecs, null);
6204
6487
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6205
- 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
6206
- /^<(?: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)))])))));
6207
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
6208
6493
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
6209
6494
 
@@ -6213,7 +6498,7 @@ function elem(tag, as, bs, cs) {
6213
6498
  if (!tags.includes(tag)) return invalid('tag', `Invalid HTML tag name "${tag}"`, as, bs, cs);
6214
6499
  if (cs.length === 0) return invalid('tag', `Missing the closing HTML tag "</${tag}>"`, as, bs, cs);
6215
6500
  if (bs.length === 0) return invalid('content', `Missing the content`, as, bs, cs);
6216
- 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);
6217
6502
  const attrs = attributes('html', [], attrspecs[tag], as.slice(1, -1));
6218
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));
6219
6504
  }
@@ -6311,13 +6596,15 @@ const inline_1 = __webpack_require__(1160);
6311
6596
 
6312
6597
  const source_1 = __webpack_require__(6743);
6313
6598
 
6314
- const util_1 = __webpack_require__(9437);
6599
+ const visibility_1 = __webpack_require__(7618);
6315
6600
 
6316
6601
  const dom_1 = __webpack_require__(3252);
6317
6602
 
6318
6603
  const array_1 = __webpack_require__(8112);
6319
6604
 
6320
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(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, 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])));
6321
6608
 
6322
6609
  /***/ }),
6323
6610
 
@@ -6346,6 +6633,8 @@ const autolink_1 = __webpack_require__(6578);
6346
6633
 
6347
6634
  const source_1 = __webpack_require__(6743);
6348
6635
 
6636
+ const visibility_1 = __webpack_require__(7618);
6637
+
6349
6638
  const util_1 = __webpack_require__(9437);
6350
6639
 
6351
6640
  const dom_1 = __webpack_require__(3252);
@@ -6356,43 +6645,44 @@ const optspec = {
6356
6645
  rel: ['nofollow']
6357
6646
  };
6358
6647
  Object.setPrototypeOf(optspec, null);
6359
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (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)({
6360
- syntax: {
6361
- inline: {
6362
- link: false
6363
- }
6364
- }
6365
- }, (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)({
6366
- syntax: {
6367
- inline: {
6368
- annotation: false,
6369
- reference: false,
6370
- index: false,
6371
- label: false,
6372
- // Redundant
6373
- //link: false,
6374
- media: false,
6375
- autolink: false
6376
- }
6377
- }
6378
- }, (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))]))), // 全体の失敗が確定した時も解析し予算を浪費している
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))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6379
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) => {
6380
6668
  if (params.length === 0) return;
6381
6669
  if (content[0] === '') return [content, rest];
6382
- 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;
6383
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;
6384
6672
  const INSECURE_URI = params.shift();
6385
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);
6386
6674
  if (el.classList.contains('invalid')) return [[el], rest];
6387
6675
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6388
- })))));
6389
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (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) => {
6390
6680
  params.shift();
6391
- (0, util_1.trimNode)(content);
6681
+ (0, visibility_1.trimNode)(content);
6392
6682
  const INSECURE_URI = params.shift();
6393
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);
6394
6684
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6395
- })))));
6685
+ }))));
6396
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]);
6397
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)}`])]);
6398
6688
 
@@ -6502,13 +6792,15 @@ const inline_1 = __webpack_require__(1160);
6502
6792
 
6503
6793
  const source_1 = __webpack_require__(6743);
6504
6794
 
6505
- const util_1 = __webpack_require__(9437);
6795
+ const visibility_1 = __webpack_require__(7618);
6506
6796
 
6507
6797
  const dom_1 = __webpack_require__(3252);
6508
6798
 
6509
6799
  const array_1 = __webpack_require__(8112);
6510
6800
 
6511
- exports.mark = (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, '='), 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])));
6512
6804
 
6513
6805
  /***/ }),
6514
6806
 
@@ -6585,7 +6877,11 @@ const optspec = {
6585
6877
  rel: global_1.undefined
6586
6878
  };
6587
6879
  Object.setPrototypeOf(optspec, null);
6588
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (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) => {
6589
6885
  const INSECURE_URI = params.shift();
6590
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);
6591
6887
  let cache;
@@ -6603,12 +6899,14 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6603
6899
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
6604
6900
  }
6605
6901
 
6606
- 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];
6607
6905
  return (0, combinator_1.fmap)(link_1.textlink, ([link]) => [(0, dom_1.define)(link, {
6608
6906
  target: '_blank'
6609
6907
  }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
6610
- })))));
6611
- 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)])));
6612
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]);
6613
6911
 
6614
6912
  function sanitize(target, uri, alt) {
@@ -6674,26 +6972,26 @@ const link_1 = __webpack_require__(9628);
6674
6972
 
6675
6973
  const source_1 = __webpack_require__(6743);
6676
6974
 
6975
+ const visibility_1 = __webpack_require__(7618);
6976
+
6677
6977
  const util_1 = __webpack_require__(9437);
6678
6978
 
6679
6979
  const dom_1 = __webpack_require__(3252);
6680
6980
 
6681
- 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)({
6682
- syntax: {
6683
- inline: {
6684
- annotation: false,
6685
- reference: false,
6686
- media: false // Redundant
6687
- //index: true,
6688
- //label: true,
6689
- //link: true,
6690
- //autolink: true,
6691
-
6692
- }
6693
- },
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)({
6694
6992
  delimiters: global_1.undefined
6695
- }, (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, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))))));
6696
- 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, '')]));
6697
6995
 
6698
6996
  function attributes(ns) {
6699
6997
  return typeof ns[0] === 'object' && ns[0].tagName === 'ABBR' ? {
@@ -6732,13 +7030,15 @@ const htmlentity_1 = __webpack_require__(1562);
6732
7030
 
6733
7031
  const source_1 = __webpack_require__(6743);
6734
7032
 
6735
- const util_1 = __webpack_require__(9437);
7033
+ const visibility_1 = __webpack_require__(7618);
6736
7034
 
6737
7035
  const dom_1 = __webpack_require__(3252);
6738
7036
 
6739
7037
  const array_1 = __webpack_require__(8112);
6740
7038
 
6741
- 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]) => {
6742
7042
  texts[texts.length - 1] === '' && texts.pop();
6743
7043
 
6744
7044
  switch (true) {
@@ -6827,7 +7127,9 @@ const url_1 = __webpack_require__(4318);
6827
7127
 
6828
7128
  const media_1 = __webpack_require__(1303);
6829
7129
 
6830
- 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])));
6831
7133
 
6832
7134
  /***/ }),
6833
7135
 
@@ -6850,13 +7152,15 @@ const emstrong_1 = __webpack_require__(6132);
6850
7152
 
6851
7153
  const source_1 = __webpack_require__(6743);
6852
7154
 
6853
- const util_1 = __webpack_require__(9437);
7155
+ const visibility_1 = __webpack_require__(7618);
6854
7156
 
6855
7157
  const dom_1 = __webpack_require__(3252);
6856
7158
 
6857
7159
  const array_1 = __webpack_require__(8112);
6858
7160
 
6859
- 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])));
6860
7164
 
6861
7165
  /***/ }),
6862
7166
 
@@ -6875,16 +7179,20 @@ const global_1 = __webpack_require__(4128);
6875
7179
 
6876
7180
  const combinator_1 = __webpack_require__(2087);
6877
7181
 
7182
+ const link_1 = __webpack_require__(9628);
7183
+
6878
7184
  const source_1 = __webpack_require__(6743);
6879
7185
 
6880
7186
  const dom_1 = __webpack_require__(3252);
6881
7187
 
6882
7188
  const array_1 = __webpack_require__(8112);
6883
7189
 
6884
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (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', {
6885
7193
  class: 'template'
6886
- }, source.replace(/\x1B/g, ''))], '']))));
6887
- 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)])));
6888
7196
 
6889
7197
  /***/ }),
6890
7198
 
@@ -6905,18 +7213,16 @@ const ja_1 = __webpack_require__(1499);
6905
7213
 
6906
7214
  const dom_1 = __webpack_require__(3252);
6907
7215
 
7216
+ const duff_1 = __webpack_require__(8099);
7217
+
6908
7218
  function localize(parser) {
6909
7219
  return (0, combinator_1.fmap)(parser, ns => {
6910
7220
  if (ns.length === 0) return ns;
6911
7221
  const el = ns.length === 1 && typeof ns[0] === 'object' ? ns[0] : (0, dom_1.html)('div', ns);
6912
- const es = el.querySelectorAll('.linebreak:not(:empty)');
6913
-
6914
- for (let i = 0, len = es.length; i < len; ++i) {
6915
- const sb = es[i];
6916
- if (!check(sb)) continue;
6917
- sb.firstChild.remove();
6918
- }
6919
-
7222
+ (0, duff_1.duffEach)(el.querySelectorAll('.linebreak:not(:empty)'), el => {
7223
+ if (!check(el)) return;
7224
+ el.firstChild.remove();
7225
+ });
6920
7226
  return ns;
6921
7227
  });
6922
7228
  }
@@ -7210,12 +7516,14 @@ const dom_1 = __webpack_require__(3252);
7210
7516
 
7211
7517
  const multimap_1 = __webpack_require__(940);
7212
7518
 
7519
+ const duff_1 = __webpack_require__(8099);
7520
+
7213
7521
  const array_1 = __webpack_require__(8112);
7214
7522
 
7215
7523
  function* footnote(target, footnotes, opts = {}, bottom = null) {
7216
7524
  // Bug: Firefox
7217
7525
  //target.querySelectorAll(`:scope > .annotations`).forEach(el => el.remove());
7218
- target.querySelectorAll(`.annotations`).forEach(el => el.parentNode === target && el.remove());
7526
+ (0, duff_1.duffEach)(target.querySelectorAll(`.annotations`), el => el.parentNode === target && el.remove());
7219
7527
  yield* (0, exports.reference)(target, footnotes?.references, opts, bottom);
7220
7528
  yield* (0, exports.annotation)(target, footnotes?.annotations, opts, bottom);
7221
7529
  return;
@@ -7234,7 +7542,7 @@ function build(syntax, marker, splitter) {
7234
7542
  const titles = new global_1.Map(); // Bug: Firefox
7235
7543
  //const splitters = push([], target.querySelectorAll(`:scope > :is(${splitter ?? '_'})`));
7236
7544
 
7237
- 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, []);
7238
7546
  let count = 0;
7239
7547
  let total = 0;
7240
7548
  let style;
@@ -7775,6 +8083,38 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7775
8083
  /***/ }),
7776
8084
 
7777
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:
7778
8118
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
7779
8119
 
7780
8120
  "use strict";
@@ -7783,7 +8123,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7783
8123
  Object.defineProperty(exports, "__esModule", ({
7784
8124
  value: true
7785
8125
  }));
7786
- 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;
7787
8127
 
7788
8128
  const global_1 = __webpack_require__(4128);
7789
8129
 
@@ -7801,30 +8141,6 @@ const memoize_1 = __webpack_require__(1808);
7801
8141
 
7802
8142
  const array_1 = __webpack_require__(8112);
7803
8143
 
7804
- function clean(parser) {
7805
- const clean = (0, memoize_1.memoize)(context => ({
7806
- resources: context.resources,
7807
- precedence: context.precedence,
7808
- delimiters: context.delimiters,
7809
- host: context.host,
7810
- url: context.url,
7811
- id: context.id,
7812
- header: context.header,
7813
- cache: context.caches
7814
- }), new WeakMap());
7815
- return (source, context) => parser(source, context.syntax ? clean(context) : context);
7816
- }
7817
-
7818
- exports.clean = clean;
7819
- exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
7820
-
7821
- function blankWith(starting, delimiter) {
7822
- if (delimiter === global_1.undefined) return blankWith('', starting);
7823
- return new RegExp(String.raw`^(?:(?=${starting})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr>)${starting && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`);
7824
- }
7825
-
7826
- exports.blankWith = blankWith;
7827
-
7828
8144
  function visualize(parser) {
7829
8145
  const blankline = new RegExp(/^(?:\\$|\\?[^\S\n]|&IHN;|<wbr>)+$/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
7830
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]))]);
@@ -7833,11 +8149,7 @@ function visualize(parser) {
7833
8149
  exports.visualize = visualize;
7834
8150
 
7835
8151
  function hasVisible(nodes, {
7836
- syntax: {
7837
- inline: {
7838
- media = true
7839
- } = {}
7840
- } = {}
8152
+ state = 0
7841
8153
  } = {}) {
7842
8154
  for (let i = 0; i < nodes.length; ++i) {
7843
8155
  const node = nodes[i];
@@ -7846,13 +8158,26 @@ function hasVisible(nodes, {
7846
8158
  if (node && node.trimStart()) return true;
7847
8159
  } else {
7848
8160
  if (node.innerText.trimStart()) return true;
7849
- 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;
7850
8166
  }
7851
8167
  }
7852
8168
 
7853
8169
  return false;
7854
8170
  }
7855
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
+
7856
8181
  function startLoose(parser, except) {
7857
8182
  return (source, context) => isStartLoose(source, context, except) ? parser(source, context) : global_1.undefined;
7858
8183
  }
@@ -8010,39 +8335,20 @@ function trimNodeEnd(nodes) {
8010
8335
 
8011
8336
  for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[nodes.length - 1], -1);) {
8012
8337
  if (typeof node === 'string') {
8013
- const pos = node.trimEnd().length;
8014
-
8015
- if (pos > 0) {
8016
- nodes[nodes.length - 1] = node.slice(0, pos);
8017
- break;
8018
- }
8019
- }
8020
-
8021
- nodes.pop();
8022
- }
8023
-
8024
- return (0, array_1.push)(nodes, skip);
8025
- }
8026
-
8027
- function stringify(nodes) {
8028
- let acc = '';
8029
-
8030
- for (let i = 0; i < nodes.length; ++i) {
8031
- const node = nodes[i];
8032
-
8033
- if (typeof node === 'string') {
8034
- acc += node;
8035
- } else {
8036
- // NOTE: Doesn't reflect line breaks.
8037
- 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
+ }
8038
8344
  }
8345
+
8346
+ nodes.pop();
8039
8347
  }
8040
8348
 
8041
- return acc;
8349
+ return (0, array_1.push)(nodes, skip);
8042
8350
  }
8043
8351
 
8044
- exports.stringify = stringify;
8045
-
8046
8352
  /***/ }),
8047
8353
 
8048
8354
  /***/ 256:
@@ -8553,6 +8859,8 @@ exports.info = void 0;
8553
8859
 
8554
8860
  const scope_1 = __webpack_require__(5202);
8555
8861
 
8862
+ const duff_1 = __webpack_require__(8099);
8863
+
8556
8864
  const array_1 = __webpack_require__(8112);
8557
8865
 
8558
8866
  function info(source) {
@@ -8571,7 +8879,7 @@ function info(source) {
8571
8879
  };
8572
8880
 
8573
8881
  function find(selector) {
8574
- 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, []);
8575
8883
  }
8576
8884
  }
8577
8885
 
@@ -8598,30 +8906,29 @@ const cite_1 = __webpack_require__(6315);
8598
8906
 
8599
8907
  const dom_1 = __webpack_require__(3252);
8600
8908
 
8909
+ const duff_1 = __webpack_require__(8099);
8910
+
8601
8911
  function quote(anchor, range) {
8602
8912
  if ((0, parser_1.exec)((0, cite_1.cite)(`>>${anchor}`, {})) !== '') throw new Error(`Invalid anchor: ${anchor}`);
8603
8913
  fit(range);
8604
8914
  const node = trim(range.cloneContents());
8605
8915
  if (!node.firstChild) return '';
8606
-
8607
- for (let es = node.querySelectorAll('code[data-src], .math[data-src], .media[data-src], rt, rp'), i = 0, len = es.length; i < len; ++i) {
8608
- const el = es[i];
8609
-
8916
+ (0, duff_1.duffEach)(node.querySelectorAll('code[data-src], .math[data-src], .media[data-src], rt, rp'), el => {
8610
8917
  switch (true) {
8611
8918
  case el.matches('code'):
8612
8919
  case el.matches('.math'):
8613
8920
  (0, dom_1.define)(el, el.getAttribute('data-src'));
8614
- continue;
8921
+ return;
8615
8922
 
8616
8923
  case el.matches('.media'):
8617
8924
  el.replaceWith(/[\s{}]/.test(el.getAttribute('data-src')) ? `!{ ${el.getAttribute('data-src')} }` : `!{${el.getAttribute('data-src')}}`);
8618
- continue;
8925
+ return;
8619
8926
 
8620
8927
  case el.matches('rt, rp'):
8621
8928
  el.remove();
8622
- continue;
8929
+ return;
8623
8930
  }
8624
- }
8931
+ });
8625
8932
 
8626
8933
  if (range.startOffset === 0 && range.startContainer.parentElement?.matches('.cite, .quote') && (!range.startContainer.previousSibling || range.startContainer.previousSibling.nodeName === 'BR')) {
8627
8934
  node.prepend(`>${range.startContainer.parentElement.matches('.quote.invalid') ? ' ' : ''}`);
@@ -8630,29 +8937,26 @@ function quote(anchor, range) {
8630
8937
  anchor = '';
8631
8938
  }
8632
8939
 
8633
- for (let es = node.querySelectorAll('br'), i = 0, len = es.length; i < len; ++i) {
8634
- const el = es[i];
8635
-
8940
+ (0, duff_1.duffEach)(node.querySelectorAll('br'), el => {
8636
8941
  if (anchor && el.nextSibling instanceof global_1.Element && el.nextSibling.matches('.cite, .quote')) {
8637
8942
  el.replaceWith(`\n>${el.nextSibling.matches('.quote.invalid') ? ' ' : ''}`);
8638
- continue;
8943
+ return;
8639
8944
  }
8640
8945
 
8641
8946
  if (anchor && el.parentElement?.closest('.cite, .quote')) {
8642
8947
  el.replaceWith(`\n>${el.parentElement.closest('.quote.invalid') ? ' ' : ''}`);
8643
- continue;
8948
+ return;
8644
8949
  }
8645
8950
 
8646
8951
  if (anchor) {
8647
8952
  el.replaceWith(`\n>>${anchor}\n> `);
8648
8953
  anchor = '';
8649
- continue;
8954
+ return;
8650
8955
  } else {
8651
8956
  el.replaceWith(`\n> `);
8652
- continue;
8957
+ return;
8653
8958
  }
8654
- }
8655
-
8959
+ });
8656
8960
  anchor && node.append(`\n>>${anchor}`);
8657
8961
  return node.textContent;
8658
8962
  }
@@ -8740,6 +9044,8 @@ const global_1 = __webpack_require__(4128);
8740
9044
 
8741
9045
  const dom_1 = __webpack_require__(3252);
8742
9046
 
9047
+ const duff_1 = __webpack_require__(8099);
9048
+
8743
9049
  const array_1 = __webpack_require__(8112); // Bug: Firefox
8744
9050
  //const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `:scope > ${s}[id]`).join();
8745
9051
 
@@ -8747,18 +9053,18 @@ const array_1 = __webpack_require__(8112); // Bug: Firefox
8747
9053
  const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]';
8748
9054
 
8749
9055
  function toc(source) {
8750
- const hs = (0, array_1.push)([], source.querySelectorAll(selector)).map(el => {
9056
+ const hs = (0, duff_1.duffReduce)(source.querySelectorAll(selector), (acc, el) => {
8751
9057
  switch (el.tagName) {
8752
9058
  case 'ASIDE':
8753
- return (0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
9059
+ return (0, array_1.push)(acc, [(0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
8754
9060
  id: el.id,
8755
9061
  class: 'aside'
8756
- }, el.firstElementChild.cloneNode(true).childNodes);
9062
+ }, el.firstElementChild.cloneNode(true).childNodes)]);
8757
9063
 
8758
9064
  default:
8759
- return el;
9065
+ return (0, array_1.push)(acc, [el]);
8760
9066
  }
8761
- });
9067
+ }, []);
8762
9068
  return parse(cons(hs));
8763
9069
  }
8764
9070
 
@@ -8772,7 +9078,7 @@ function parse(node, index = '') {
8772
9078
  return (0, dom_1.html)('li', (0, array_1.push)([(0, dom_1.html)('a', {
8773
9079
  href: `#${el.id}`,
8774
9080
  'data-index': isHeading ? idx : global_1.undefined
8775
- }, fix(el))], cs.length > 0 ? [parse(cs, idx)] : []));
9081
+ }, unlink(el.cloneNode(true)))], cs.length > 0 ? [parse(cs, idx)] : []));
8776
9082
  }));
8777
9083
  }
8778
9084
 
@@ -8787,14 +9093,8 @@ function level(h) {
8787
9093
  return +h.tagName[1];
8788
9094
  }
8789
9095
 
8790
- function fix(h) {
8791
- h = h.cloneNode(true);
8792
-
8793
- for (let es = h.getElementsByTagName('a'), i = 0, len = es.length; i < len; ++i) {
8794
- const el = es[i];
8795
- el.replaceWith(...el.childNodes);
8796
- }
8797
-
9096
+ function unlink(h) {
9097
+ (0, duff_1.duffEach)(h.getElementsByTagName('a'), el => void el.replaceWith(...el.childNodes));
8798
9098
  return h.childNodes;
8799
9099
  }
8800
9100
 
@@ -8803,7 +9103,7 @@ function fix(h) {
8803
9103
  /***/ 3252:
8804
9104
  /***/ (function(module) {
8805
9105
 
8806
- /*! 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 */
8807
9107
  (function webpackUniversalModuleDefinition(root, factory) {
8808
9108
  if(true)
8809
9109
  module.exports = factory();
@@ -9237,7 +9537,7 @@ exports.defrag = defrag;
9237
9537
  /***/ 6120:
9238
9538
  /***/ (function(module) {
9239
9539
 
9240
- /*! 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 */
9241
9541
  (function webpackUniversalModuleDefinition(root, factory) {
9242
9542
  if(true)
9243
9543
  module.exports = factory();
@@ -9245,8 +9545,320 @@ exports.defrag = defrag;
9245
9545
  })(this, () => {
9246
9546
  return /******/ (() => { // webpackBootstrap
9247
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
+ /************************************************************************/
9248
9860
  var __webpack_exports__ = {};
9249
- // 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.
9250
9862
  (() => {
9251
9863
  var exports = __webpack_exports__;
9252
9864
 
@@ -9256,6 +9868,10 @@ Object.defineProperty(exports, "__esModule", ({
9256
9868
  }));
9257
9869
  exports.querySelectorAll = exports.querySelector = void 0;
9258
9870
 
9871
+ const duff_1 = __nested_webpack_require_6765__(99);
9872
+
9873
+ const array_1 = __nested_webpack_require_6765__(112);
9874
+
9259
9875
  function querySelector(node, selector) {
9260
9876
  return 'matches' in node && node.matches(selector) ? node : node.querySelector(selector);
9261
9877
  }
@@ -9269,13 +9885,7 @@ function querySelectorAll(node, selector) {
9269
9885
  acc.push(node);
9270
9886
  }
9271
9887
 
9272
- const nodes = node.querySelectorAll(selector);
9273
-
9274
- for (let i = 0, len = nodes.length; i < len; ++i) {
9275
- acc.push(nodes[i]);
9276
- }
9277
-
9278
- return acc;
9888
+ return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc, node) => (0, array_1.push)(acc, [node]), acc);
9279
9889
  }
9280
9890
 
9281
9891
  exports.querySelectorAll = querySelectorAll;