securemark 0.293.5 → 0.294.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 (105) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.js +845 -534
  3. package/markdown.d.ts +13 -13
  4. package/package.json +3 -3
  5. package/src/combinator/control/constraint/block.test.ts +6 -6
  6. package/src/combinator/control/constraint/contract.ts +3 -3
  7. package/src/combinator/control/constraint/line.test.ts +7 -7
  8. package/src/combinator/control/constraint/line.ts +1 -1
  9. package/src/combinator/control/manipulation/clear.ts +2 -3
  10. package/src/combinator/control/manipulation/convert.ts +2 -2
  11. package/src/combinator/control/manipulation/duplicate.ts +4 -5
  12. package/src/combinator/control/manipulation/fence.ts +2 -2
  13. package/src/combinator/control/manipulation/indent.test.ts +2 -2
  14. package/src/combinator/control/manipulation/indent.ts +4 -4
  15. package/src/combinator/control/manipulation/reverse.ts +2 -2
  16. package/src/combinator/control/manipulation/scope.ts +3 -4
  17. package/src/combinator/control/manipulation/surround.ts +12 -13
  18. package/src/combinator/control/monad/bind.ts +6 -6
  19. package/src/combinator/control/monad/fmap.ts +7 -7
  20. package/src/combinator/data/data.ts +135 -0
  21. package/src/combinator/data/parser/context.test.ts +8 -8
  22. package/src/combinator/data/parser/context.ts +3 -3
  23. package/src/combinator/data/parser/inits.ts +6 -7
  24. package/src/combinator/data/parser/sequence.test.ts +3 -3
  25. package/src/combinator/data/parser/sequence.ts +6 -7
  26. package/src/combinator/data/parser/some.test.ts +3 -3
  27. package/src/combinator/data/parser/some.ts +4 -4
  28. package/src/combinator/data/parser/subsequence.test.ts +4 -4
  29. package/src/combinator/data/parser/subsequence.ts +3 -3
  30. package/src/combinator/data/parser/tails.ts +3 -3
  31. package/src/combinator/data/parser/union.test.ts +3 -3
  32. package/src/combinator/data/parser.ts +16 -7
  33. package/src/debug.test.ts +6 -5
  34. package/src/parser/api/bind.ts +4 -6
  35. package/src/parser/api/header.ts +1 -1
  36. package/src/parser/api/normalize.ts +1 -1
  37. package/src/parser/api/parse.ts +3 -1
  38. package/src/parser/block/blockquote.ts +6 -4
  39. package/src/parser/block/codeblock.ts +8 -7
  40. package/src/parser/block/dlist.ts +9 -8
  41. package/src/parser/block/extension/aside.ts +27 -21
  42. package/src/parser/block/extension/example.ts +29 -26
  43. package/src/parser/block/extension/fig.ts +1 -1
  44. package/src/parser/block/extension/figbase.ts +6 -5
  45. package/src/parser/block/extension/figure.ts +23 -19
  46. package/src/parser/block/extension/message.ts +35 -24
  47. package/src/parser/block/extension/placeholder.ts +17 -13
  48. package/src/parser/block/extension/table.ts +47 -40
  49. package/src/parser/block/heading.test.ts +3 -12
  50. package/src/parser/block/heading.ts +12 -8
  51. package/src/parser/block/ilist.ts +13 -12
  52. package/src/parser/block/mathblock.ts +21 -17
  53. package/src/parser/block/mediablock.ts +7 -5
  54. package/src/parser/block/olist.ts +15 -5
  55. package/src/parser/block/pagebreak.ts +2 -1
  56. package/src/parser/block/paragraph.ts +3 -1
  57. package/src/parser/block/reply/cite.ts +20 -15
  58. package/src/parser/block/reply/quote.ts +6 -4
  59. package/src/parser/block/reply.ts +6 -3
  60. package/src/parser/block/sidefence.ts +8 -7
  61. package/src/parser/block/table.ts +23 -22
  62. package/src/parser/block/ulist.ts +16 -12
  63. package/src/parser/block.ts +7 -6
  64. package/src/parser/header.ts +18 -18
  65. package/src/parser/inline/annotation.ts +3 -1
  66. package/src/parser/inline/autolink/account.ts +3 -2
  67. package/src/parser/inline/autolink/anchor.ts +3 -2
  68. package/src/parser/inline/autolink/channel.ts +5 -4
  69. package/src/parser/inline/autolink/email.ts +4 -3
  70. package/src/parser/inline/autolink/hashnum.ts +3 -2
  71. package/src/parser/inline/autolink/hashtag.ts +4 -3
  72. package/src/parser/inline/autolink/url.ts +7 -6
  73. package/src/parser/inline/bracket.ts +16 -15
  74. package/src/parser/inline/code.ts +5 -4
  75. package/src/parser/inline/deletion.ts +5 -5
  76. package/src/parser/inline/emphasis.ts +4 -3
  77. package/src/parser/inline/emstrong.test.ts +18 -18
  78. package/src/parser/inline/emstrong.ts +39 -30
  79. package/src/parser/inline/extension/index.ts +22 -19
  80. package/src/parser/inline/extension/indexee.ts +2 -2
  81. package/src/parser/inline/extension/indexer.ts +2 -1
  82. package/src/parser/inline/extension/label.ts +7 -3
  83. package/src/parser/inline/extension/placeholder.ts +6 -6
  84. package/src/parser/inline/html.ts +27 -28
  85. package/src/parser/inline/htmlentity.ts +9 -8
  86. package/src/parser/inline/insertion.ts +5 -5
  87. package/src/parser/inline/italic.ts +5 -5
  88. package/src/parser/inline/link.ts +36 -38
  89. package/src/parser/inline/mark.ts +7 -7
  90. package/src/parser/inline/math.ts +5 -4
  91. package/src/parser/inline/media.ts +33 -32
  92. package/src/parser/inline/reference.ts +19 -20
  93. package/src/parser/inline/remark.ts +11 -11
  94. package/src/parser/inline/ruby.ts +50 -53
  95. package/src/parser/inline/strong.ts +4 -3
  96. package/src/parser/inline/template.ts +16 -15
  97. package/src/parser/inline.test.ts +3 -3
  98. package/src/parser/segment.ts +3 -1
  99. package/src/parser/source/escapable.ts +9 -8
  100. package/src/parser/source/line.ts +4 -3
  101. package/src/parser/source/str.ts +2 -2
  102. package/src/parser/source/text.ts +9 -8
  103. package/src/parser/source/unescapable.ts +6 -5
  104. package/src/parser/util.ts +18 -13
  105. package/src/parser/visibility.ts +19 -20
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.293.5 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.294.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("Prism"), require("DOMPurify"));
@@ -1346,15 +1346,15 @@ exports.rnd32 = cons(32);
1346
1346
  exports.rnd36 = cons(36);
1347
1347
  exports.rnd62 = cons(62);
1348
1348
  exports.rnd64 = cons(64);
1349
- exports.rnd09 = conv(exports.rnd10, table0_);
1350
- exports.rnd0f = conv(exports.rnd16, table0_);
1351
- exports.rnd0v = conv(exports.rnd32, table0_);
1352
- exports.rnd0z = conv(exports.rnd36, table0_);
1353
- exports.rnd0Z = conv(exports.rnd62, table0_);
1354
- exports.rnd0S = conv(exports.rnd64, table0S);
1355
- exports.rnd0_ = conv(exports.rnd64, table0_);
1356
- exports.rndAP = conv(exports.rnd16, tableAz);
1357
- exports.rndAf = conv(exports.rnd32, tableAz);
1349
+ exports.rnd09 = conv(exports.rnd10, table0_, 10);
1350
+ exports.rnd0f = conv(exports.rnd16, table0_, 16);
1351
+ exports.rnd0v = conv(exports.rnd32, table0_, 32);
1352
+ exports.rnd0z = conv(exports.rnd36, table0_, 36);
1353
+ exports.rnd0Z = conv(exports.rnd62, table0_, 62);
1354
+ exports.rnd0S = conv(exports.rnd64, table0S, 64);
1355
+ exports.rnd0_ = conv(exports.rnd64, table0_, 64);
1356
+ exports.rndAP = conv(exports.rnd16, tableAz, 16);
1357
+ exports.rndAf = conv(exports.rnd32, tableAz, 32);
1358
1358
  function unique(rng, len = 1, mem) {
1359
1359
  const independence = !mem;
1360
1360
  mem ??= new Set();
@@ -1398,11 +1398,13 @@ function cons(size) {
1398
1398
  return r < size ? r : rng();
1399
1399
  };
1400
1400
  }
1401
- function conv($rng, table) {
1401
+ function conv($rng, table, size) {
1402
1402
  return (len = 1, rng = $rng) => {
1403
1403
  let acc = '';
1404
1404
  while (len--) {
1405
- acc += table[rng()];
1405
+ const i = rng();
1406
+ if (i >= size) throw new Error(`Spica: Random: Invalid rng`);
1407
+ acc += table[i];
1406
1408
  }
1407
1409
  return acc;
1408
1410
  };
@@ -2564,7 +2566,7 @@ function line(parser) {
2564
2566
  if (result === undefined) return;
2565
2567
  if (!isBlank(source.slice(context.position, position + line.length))) return;
2566
2568
  context.position = position + line.length;
2567
- return [(0, parser_1.eval)(result)];
2569
+ return (0, parser_1.eval)(result);
2568
2570
  });
2569
2571
  }
2570
2572
  exports.line = line;
@@ -2581,7 +2583,7 @@ exports.isBlank = isBlank;
2581
2583
  /***/ },
2582
2584
 
2583
2585
  /***/ 8606
2584
- (__unused_webpack_module, exports) {
2586
+ (__unused_webpack_module, exports, __webpack_require__) {
2585
2587
 
2586
2588
  "use strict";
2587
2589
 
@@ -2590,8 +2592,9 @@ Object.defineProperty(exports, "__esModule", ({
2590
2592
  value: true
2591
2593
  }));
2592
2594
  exports.clear = void 0;
2595
+ const parser_1 = __webpack_require__(605);
2593
2596
  function clear(parser) {
2594
- return input => parser(input) && [[]];
2597
+ return input => parser(input) && new parser_1.List();
2595
2598
  }
2596
2599
  exports.clear = clear;
2597
2600
 
@@ -2622,7 +2625,7 @@ function convert(conv, parser, continuous, empty = false) {
2622
2625
  if (src === '') {
2623
2626
  if (!empty) return;
2624
2627
  context.position = source.length;
2625
- return [[]];
2628
+ return new parser_1.List();
2626
2629
  }
2627
2630
  if (continuous) {
2628
2631
  context.position += source.length - position - src.length;
@@ -2654,9 +2657,10 @@ Object.defineProperty(exports, "__esModule", ({
2654
2657
  value: true
2655
2658
  }));
2656
2659
  exports.dup = void 0;
2660
+ const parser_1 = __webpack_require__(605);
2657
2661
  const fmap_1 = __webpack_require__(2705);
2658
2662
  function dup(parser) {
2659
- return (0, fmap_1.fmap)(parser, nodes => [nodes]);
2663
+ return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.Data(nodes)]));
2660
2664
  }
2661
2665
  exports.dup = dup;
2662
2666
 
@@ -2739,7 +2743,7 @@ function fence(opener, limit, separation = true) {
2739
2743
  }
2740
2744
  context.position += line.length;
2741
2745
  }
2742
- return [(0, array_1.push)([block, overflow, closer], matches)];
2746
+ return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Data(str)));
2743
2747
  });
2744
2748
  }
2745
2749
  exports.fence = fence;
@@ -2778,10 +2782,10 @@ function indent(opener, parser = false, separation = false) {
2778
2782
  position
2779
2783
  } = context;
2780
2784
  context.position = source.length;
2781
- return [[source.slice(position)]];
2785
+ return new parser_1.List([new parser_1.Data(source.slice(position))]);
2782
2786
  }))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), {})), separation), (lines, context) => {
2783
- const result = parser((0, parser_1.subinput)(trimBlockEnd(lines.join('')), context));
2784
- return result ? [(0, parser_1.eval)(result)] : undefined;
2787
+ const result = parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context));
2788
+ return result ? (0, parser_1.eval)(result) : undefined;
2785
2789
  }));
2786
2790
  }
2787
2791
  exports.indent = indent;
@@ -2886,9 +2890,10 @@ Object.defineProperty(exports, "__esModule", ({
2886
2890
  value: true
2887
2891
  }));
2888
2892
  exports.reverse = void 0;
2893
+ const parser_1 = __webpack_require__(605);
2889
2894
  const fmap_1 = __webpack_require__(2705);
2890
2895
  function reverse(parser) {
2891
- return (0, fmap_1.fmap)(parser, nodes => nodes.reverse());
2896
+ return (0, fmap_1.fmap)(parser, nodes => nodes.foldr((node, acc) => acc.push(nodes.delete(node)) && acc, new parser_1.List()));
2892
2897
  }
2893
2898
  exports.reverse = reverse;
2894
2899
 
@@ -2918,7 +2923,7 @@ function focus(scope, parser) {
2918
2923
  if (position === source.length) return;
2919
2924
  const src = (0, parser_1.eval)(match({
2920
2925
  context
2921
- }))?.[0] ?? '';
2926
+ }))?.head?.value ?? '';
2922
2927
  if (src === '') return;
2923
2928
  context.range = src.length;
2924
2929
  context.offset ??= 0;
@@ -2929,7 +2934,7 @@ function focus(scope, parser) {
2929
2934
  context.source = source;
2930
2935
  context.offset -= position;
2931
2936
  if (result === undefined) return;
2932
- return [(0, parser_1.eval)(result)];
2937
+ return (0, parser_1.eval)(result);
2933
2938
  });
2934
2939
  }
2935
2940
  exports.focus = focus;
@@ -2955,7 +2960,7 @@ function rewrite(scope, parser) {
2955
2960
  context.source = source;
2956
2961
  context.offset -= position;
2957
2962
  if (res2 === undefined) return;
2958
- return [(0, parser_1.eval)(res2)];
2963
+ return (0, parser_1.eval)(res2);
2959
2964
  });
2960
2965
  }
2961
2966
  exports.rewrite = rewrite;
@@ -2974,7 +2979,6 @@ Object.defineProperty(exports, "__esModule", ({
2974
2979
  exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
2975
2980
  const parser_1 = __webpack_require__(605);
2976
2981
  const combinator_1 = __webpack_require__(3484);
2977
- const array_1 = __webpack_require__(6876);
2978
2982
  function surround(opener, parser, closer, optional = false, f, g, backtracks = []) {
2979
2983
  switch (typeof opener) {
2980
2984
  case 'string':
@@ -3029,7 +3033,7 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3029
3033
  return void revert(context, linebreak);
3030
3034
  }
3031
3035
  context.range = context.position - position;
3032
- const result = f ? f([nodesO, nodesM, nodesC], context) : [(0, array_1.push)(nodesM ? (0, array_1.unshift)(nodesO, nodesM) : nodesO, nodesC)];
3036
+ const result = f ? f([nodesO, nodesM, nodesC], context) : nodesO.import(nodesM ?? new parser_1.List()).import(nodesC);
3033
3037
  if (result) {
3034
3038
  context.linebreak ||= linebreak;
3035
3039
  } else {
@@ -3155,22 +3159,183 @@ Object.defineProperty(exports, "__esModule", ({
3155
3159
  exports.fmap = void 0;
3156
3160
  const bind_1 = __webpack_require__(994);
3157
3161
  function fmap(parser, f) {
3158
- return (0, bind_1.bind)(parser, (nodes, context) => [f(nodes, context)]);
3162
+ return (0, bind_1.bind)(parser, (nodes, context) => f(nodes, context));
3159
3163
  }
3160
3164
  exports.fmap = fmap;
3161
3165
 
3162
3166
  /***/ },
3163
3167
 
3164
- /***/ 605
3168
+ /***/ 3602
3165
3169
  (__unused_webpack_module, exports) {
3166
3170
 
3167
3171
  "use strict";
3168
3172
 
3169
3173
 
3174
+ // Memory-efficient flexible list.
3175
+ Object.defineProperty(exports, "__esModule", ({
3176
+ value: true
3177
+ }));
3178
+ exports.List = void 0;
3179
+ class List {
3180
+ constructor(nodes) {
3181
+ this.length = 0;
3182
+ this.head = undefined;
3183
+ if (nodes === undefined) return;
3184
+ for (let i = 0; i < nodes.length; ++i) {
3185
+ this.push(nodes[i]);
3186
+ }
3187
+ }
3188
+ get tail() {
3189
+ return this.head?.next;
3190
+ }
3191
+ get last() {
3192
+ return this.head?.prev;
3193
+ }
3194
+ insert(node, before) {
3195
+ if (++this.length === 1) {
3196
+ return this.head = node.next = node.prev = node;
3197
+ }
3198
+ const next = node.next = before ?? this.head;
3199
+ const prev = node.prev = next.prev;
3200
+ return next.prev = prev.next = node;
3201
+ }
3202
+ delete(node) {
3203
+ if (--this.length === 0) {
3204
+ this.head = undefined;
3205
+ } else {
3206
+ const {
3207
+ next,
3208
+ prev
3209
+ } = node;
3210
+ if (node === this.head) {
3211
+ this.head = next;
3212
+ }
3213
+ // Error if not used.
3214
+ prev.next = next;
3215
+ next.prev = prev;
3216
+ }
3217
+ node.next = node.prev = undefined;
3218
+ return node;
3219
+ }
3220
+ unshift(node) {
3221
+ return this.head = this.insert(node, this.head);
3222
+ }
3223
+ push(node) {
3224
+ return this.insert(node, this.head);
3225
+ }
3226
+ shift() {
3227
+ if (this.length === 0) return;
3228
+ return this.delete(this.head);
3229
+ }
3230
+ pop() {
3231
+ if (this.length === 0) return;
3232
+ return this.delete(this.head.prev);
3233
+ }
3234
+ import(list, before) {
3235
+ if (list.length === 0) return this;
3236
+ if (this.length === 0) {
3237
+ this.head = list.head;
3238
+ this.length += list.length;
3239
+ list.clear();
3240
+ return this;
3241
+ }
3242
+ const head = list.head;
3243
+ const last = list.last;
3244
+ const next = last.next = before ?? this.head;
3245
+ const prev = head.prev = next.prev;
3246
+ next.prev = last;
3247
+ prev.next = head;
3248
+ this.length += list.length;
3249
+ list.clear();
3250
+ return this;
3251
+ }
3252
+ clear() {
3253
+ this.length = 0;
3254
+ this.head = undefined;
3255
+ }
3256
+ *[Symbol.iterator]() {
3257
+ for (let node = this.head; node && this.head;) {
3258
+ const next = node.next;
3259
+ yield node;
3260
+ node = next;
3261
+ if (node === this.head) break;
3262
+ }
3263
+ }
3264
+ flatMap(f) {
3265
+ const acc = new List();
3266
+ for (let node = this.head; node && this.head;) {
3267
+ const next = node.next;
3268
+ acc.import(f(node));
3269
+ node = next;
3270
+ if (node === this.head) break;
3271
+ }
3272
+ return acc;
3273
+ }
3274
+ foldl(f, acc) {
3275
+ for (let node = this.head; node && this.head;) {
3276
+ const next = node.next;
3277
+ acc = f(acc, node);
3278
+ node = next;
3279
+ if (node === this.head) break;
3280
+ }
3281
+ return acc;
3282
+ }
3283
+ foldr(f, acc) {
3284
+ for (let node = this.head?.prev; node && this.head;) {
3285
+ const prev = node.prev;
3286
+ acc = f(node, acc);
3287
+ if (node === this.head) break;
3288
+ node = prev;
3289
+ }
3290
+ return acc;
3291
+ }
3292
+ find(f) {
3293
+ for (let node = this.head; node && this.head;) {
3294
+ const next = node.next;
3295
+ if (f(node)) return node;
3296
+ node = next;
3297
+ if (node === this.head) break;
3298
+ }
3299
+ }
3300
+ }
3301
+ exports.List = List;
3302
+ (function (List) {
3303
+ class Node {
3304
+ constructor() {
3305
+ this.next = undefined;
3306
+ this.prev = undefined;
3307
+ }
3308
+ }
3309
+ List.Node = Node;
3310
+ })(List || (exports.List = List = {}));
3311
+
3312
+ /***/ },
3313
+
3314
+ /***/ 605
3315
+ (__unused_webpack_module, exports, __webpack_require__) {
3316
+
3317
+ "use strict";
3318
+
3319
+
3170
3320
  Object.defineProperty(exports, "__esModule", ({
3171
3321
  value: true
3172
3322
  }));
3173
- exports.failsafe = exports.eval = exports.clean = exports.subinput = exports.input = void 0;
3323
+ exports.failsafe = exports.eval = exports.clean = exports.subinput = exports.input = exports.Data = exports.List = void 0;
3324
+ const data_1 = __webpack_require__(3602);
3325
+ Object.defineProperty(exports, "List", ({
3326
+ enumerable: true,
3327
+ get: function () {
3328
+ return data_1.List;
3329
+ }
3330
+ }));
3331
+ class Data {
3332
+ constructor(value) {
3333
+ this.value = value;
3334
+ this.next = undefined;
3335
+ this.prev = undefined;
3336
+ }
3337
+ }
3338
+ exports.Data = Data;
3174
3339
  function input(source, context) {
3175
3340
  // @ts-expect-error
3176
3341
  context.source = source;
@@ -3208,7 +3373,7 @@ function clean(context) {
3208
3373
  }
3209
3374
  exports.clean = clean;
3210
3375
  function eval_(result, default_) {
3211
- return result ? result[0] : default_;
3376
+ return result ? result : default_;
3212
3377
  }
3213
3378
  exports.eval = eval_;
3214
3379
  function failsafe(parser) {
@@ -3243,6 +3408,7 @@ Object.defineProperty(exports, "__esModule", ({
3243
3408
  }));
3244
3409
  exports.matcher = exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
3245
3410
  const alias_1 = __webpack_require__(5413);
3411
+ const parser_1 = __webpack_require__(605);
3246
3412
  const assign_1 = __webpack_require__(9888);
3247
3413
  function reset(base, parser) {
3248
3414
  const changes = Object.entries(base);
@@ -3415,7 +3581,7 @@ function matcher(pattern, advance) {
3415
3581
  if (advance) {
3416
3582
  context.position += pattern.length;
3417
3583
  }
3418
- return [[pattern]];
3584
+ return new parser_1.List([new parser_1.Data(pattern)]);
3419
3585
  };
3420
3586
  case 'object':
3421
3587
  return ({
@@ -3432,7 +3598,7 @@ function matcher(pattern, advance) {
3432
3598
  if (advance) {
3433
3599
  context.position += src.length;
3434
3600
  }
3435
- return [[src]];
3601
+ return new parser_1.List([new parser_1.Data(src)]);
3436
3602
  };
3437
3603
  }
3438
3604
  }
@@ -3607,7 +3773,6 @@ Object.defineProperty(exports, "__esModule", ({
3607
3773
  }));
3608
3774
  exports.inits = void 0;
3609
3775
  const parser_1 = __webpack_require__(605);
3610
- const array_1 = __webpack_require__(6876);
3611
3776
  function inits(parsers, resume) {
3612
3777
  if (parsers.length === 1) return parsers[0];
3613
3778
  return input => {
@@ -3624,10 +3789,10 @@ function inits(parsers, resume) {
3624
3789
  if (context.delimiters?.match(input)) break;
3625
3790
  const result = parsers[i](input);
3626
3791
  if (result === undefined) break;
3627
- nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3792
+ nodes = nodes ? nodes.import((0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3628
3793
  if (resume?.((0, parser_1.eval)(result)) === false) break;
3629
3794
  }
3630
- return nodes && context.position > position ? [nodes] : undefined;
3795
+ return nodes && context.position > position ? nodes : undefined;
3631
3796
  };
3632
3797
  }
3633
3798
  exports.inits = inits;
@@ -3645,7 +3810,6 @@ Object.defineProperty(exports, "__esModule", ({
3645
3810
  }));
3646
3811
  exports.sequence = void 0;
3647
3812
  const parser_1 = __webpack_require__(605);
3648
- const array_1 = __webpack_require__(6876);
3649
3813
  function sequence(parsers, resume) {
3650
3814
  if (parsers.length === 1) return parsers[0];
3651
3815
  return input => {
@@ -3662,10 +3826,10 @@ function sequence(parsers, resume) {
3662
3826
  if (context.delimiters?.match(input)) return;
3663
3827
  const result = parsers[i](input);
3664
3828
  if (result === undefined) return;
3665
- nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3829
+ nodes = nodes ? nodes.import((0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3666
3830
  if (resume?.((0, parser_1.eval)(result)) === false) return;
3667
3831
  }
3668
- return nodes && context.position > position ? [nodes] : undefined;
3832
+ return nodes && context.position > position ? nodes : undefined;
3669
3833
  };
3670
3834
  }
3671
3835
  exports.sequence = sequence;
@@ -3712,13 +3876,13 @@ function some(parser, end, delimiters = [], limit = -1) {
3712
3876
  if (context.delimiters?.match(input)) break;
3713
3877
  const result = parser(input);
3714
3878
  if (result === undefined) break;
3715
- nodes = nodes ? (nodes.push(...(0, parser_1.eval)(result)), nodes) : (0, parser_1.eval)(result);
3879
+ nodes = nodes ? nodes.import((0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3716
3880
  if (limit >= 0 && context.position - position > limit) break;
3717
3881
  }
3718
3882
  if (delims.length > 0) {
3719
3883
  context.delimiters.pop(delims.length);
3720
3884
  }
3721
- return nodes && context.position > position ? [nodes] : undefined;
3885
+ return nodes && context.position > position ? nodes : undefined;
3722
3886
  };
3723
3887
  }
3724
3888
  exports.some = some;
@@ -3921,11 +4085,8 @@ function bind(target, settings) {
3921
4085
  if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
3922
4086
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
3923
4087
  source = (0, normalize_1.normalize)(source);
3924
- // Change the object identity.
3925
- context = {
3926
- ...context,
3927
- url: url ? new url_1.ReadonlyURL(url) : undefined
3928
- };
4088
+ // @ts-expect-error
4089
+ context.url = url ? new url_1.ReadonlyURL(url) : undefined;
3929
4090
  const rev = revision = Symbol();
3930
4091
  const sourceSegments = [];
3931
4092
  for (const seg of (0, segment_1.segment)(source)) {
@@ -3953,7 +4114,9 @@ function bind(target, settings) {
3953
4114
  const seg = sourceSegments[index];
3954
4115
  const es = (0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
3955
4116
  header: index === 0
3956
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)), []);
4117
+ })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4118
+ value
4119
+ }) => void acc.push(value) || acc, []) ?? [];
3957
4120
  blocks.splice(index, 0, [seg, es, url]);
3958
4121
  if (es.length === 0) continue;
3959
4122
  // All deletion processes always run after all addition processes have done.
@@ -4134,7 +4297,7 @@ exports.headers = headers;
4134
4297
  function parse(source) {
4135
4298
  const i = (0, parser_1.input)(source, {});
4136
4299
  const result = (0, header_1.header)(i);
4137
- const [el] = (0, parser_1.eval)(result, []);
4300
+ const el = (0, parser_1.eval)(result)?.head?.value;
4138
4301
  return el?.tagName === 'ASIDE' ? [el, i.context.position] : [];
4139
4302
  }
4140
4303
 
@@ -4167,7 +4330,7 @@ function sanitize(source) {
4167
4330
  // https://en.wikipedia.org/wiki/Whitespace_character
4168
4331
  exports.invisibleHTMLEntityNames = ['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'shy', 'ensp', 'emsp', 'emsp13', 'emsp14', 'numsp', 'puncsp', 'ThinSpace', 'thinsp', 'VeryThinSpace', 'hairsp', 'ZeroWidthSpace', 'NegativeVeryThinSpace', 'NegativeThinSpace', 'NegativeMediumSpace', 'NegativeThickSpace', 'zwj', 'zwnj', 'lrm', 'rlm', 'MediumSpace', 'NoBreak', 'ApplyFunction', 'af', 'InvisibleTimes', 'it', 'InvisibleComma', 'ic'];
4169
4332
  const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
4170
- const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {})))[0]);
4333
+ const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {}))).head.value);
4171
4334
  const unreadableEscapableCharacter = new RegExp(`[${unreadableEscapableCharacters.join('')}]`, 'g');
4172
4335
  // https://www.pandanoir.info/entry/2018/03/11/193000
4173
4336
  // http://anti.rosx.net/etc/memo/002_space.html
@@ -4244,9 +4407,11 @@ function parse(source, opts = {}, context) {
4244
4407
  const node = (0, dom_1.frag)();
4245
4408
  let index = 0;
4246
4409
  for (const seg of (0, segment_1.segment)(source)) {
4247
- node.append(...(0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
4410
+ node.append(...((0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
4248
4411
  header: index++ === 0
4249
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)), []));
4412
+ })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4413
+ value
4414
+ }) => void acc.push(value) || acc, []) ?? []));
4250
4415
  }
4251
4416
  if (opts.test) return node;
4252
4417
  for (const _ of (0, figure_1.figure)(node, opts.notes, context));
@@ -4284,6 +4449,7 @@ Object.defineProperty(exports, "__esModule", ({
4284
4449
  value: true
4285
4450
  }));
4286
4451
  exports.block = void 0;
4452
+ const parser_1 = __webpack_require__(605);
4287
4453
  const combinator_1 = __webpack_require__(3484);
4288
4454
  const segment_1 = __webpack_require__(3967);
4289
4455
  const source_1 = __webpack_require__(8745);
@@ -4380,13 +4546,13 @@ function error(parser) {
4380
4546
  position,
4381
4547
  id
4382
4548
  }
4383
- }, reason) => [[(0, dom_1.html)('h1', {
4549
+ }, reason) => new parser_1.List([new parser_1.Data((0, dom_1.html)('h1', {
4384
4550
  id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
4385
4551
  class: 'error'
4386
- }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`), (0, dom_1.html)('pre', {
4552
+ }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`)), new parser_1.Data((0, dom_1.html)('pre', {
4387
4553
  class: 'error',
4388
4554
  translate: 'no'
4389
- }, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined)]]);
4555
+ }, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined))]));
4390
4556
  }
4391
4557
 
4392
4558
  /***/ },
@@ -4401,9 +4567,11 @@ Object.defineProperty(exports, "__esModule", ({
4401
4567
  value: true
4402
4568
  }));
4403
4569
  exports.blockquote = exports.segment = void 0;
4570
+ const parser_1 = __webpack_require__(605);
4404
4571
  const combinator_1 = __webpack_require__(3484);
4405
4572
  const autolink_1 = __webpack_require__(1671);
4406
4573
  const source_1 = __webpack_require__(8745);
4574
+ const util_1 = __webpack_require__(4992);
4407
4575
  const parse_1 = __webpack_require__(3662);
4408
4576
  const dom_1 = __webpack_require__(394);
4409
4577
  exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+(?=[^\S\n]|\n[^\S\n]*\S)/y, (0, combinator_1.some)(source_1.contentline))]));
@@ -4411,7 +4579,7 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
4411
4579
  const opener = /(?=>>+(?:$|\s))/y;
4412
4580
  const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|\s)/y)), false);
4413
4581
  const unindent = source => source.replace(/(?<=^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '');
4414
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))]), false, true))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4582
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4415
4583
  const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, false, true)), (0, combinator_1.creation)(10, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
4416
4584
  context
4417
4585
  }) => {
@@ -4428,8 +4596,8 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4428
4596
  }
4429
4597
  }, context);
4430
4598
  context.position = source.length;
4431
- return [[(0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]];
4432
- }, false, true)))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4599
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4600
+ }, false, true)))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4433
4601
 
4434
4602
  /***/ },
4435
4603
 
@@ -4454,7 +4622,8 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
4454
4622
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
4455
4623
  exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
4456
4624
  // Bug: Type mismatch between outer and inner.
4457
- ([body, overflow, closer, opener, delim, param], context) => {
4625
+ (nodes, context) => {
4626
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
4458
4627
  const params = param.match(/(?:\\.?|\S)+/g)?.reduce((params, value, i) => {
4459
4628
  let name;
4460
4629
  switch (true) {
@@ -4475,21 +4644,19 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
4475
4644
  name in params ? params.invalid = `Duplicate ${name} attribute` : params[name] = value;
4476
4645
  return params;
4477
4646
  }, {}) ?? {};
4478
- if (!closer || overflow || params.invalid) return [(0, dom_1.html)('pre', {
4647
+ if (!closer || overflow || params.invalid) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4479
4648
  class: 'invalid',
4480
4649
  translate: 'no',
4481
4650
  ...(0, util_1.invalid)('codeblock', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : params.invalid)
4482
- }, `${opener}${body}${overflow || closer}`)];
4651
+ }, `${opener}${body}${overflow || closer}`))]);
4483
4652
  const el = (0, dom_1.html)('pre', {
4484
4653
  class: params.lang ? `code language-${params.lang}` : 'text',
4485
4654
  translate: params.lang ? 'no' : undefined,
4486
4655
  'data-lang': params.lang || undefined,
4487
4656
  'data-line': params.line || undefined,
4488
4657
  'data-path': params.path || undefined
4489
- }, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || undefined : (0, dom_1.defrag)((0, parser_1.eval)((0, autolink_1.autolink)((0, parser_1.input)(body.slice(0, -1), {
4490
- ...context
4491
- })), [])));
4492
- return [el];
4658
+ }, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || undefined : (0, dom_1.defrag)((0, util_1.unwrap)((0, parser_1.eval)((0, autolink_1.autolink)((0, parser_1.subinput)(body.slice(0, -1), context)), new parser_1.List()))));
4659
+ return new parser_1.List([new parser_1.Data(el)]);
4493
4660
  }));
4494
4661
 
4495
4662
  /***/ },
@@ -4504,19 +4671,20 @@ Object.defineProperty(exports, "__esModule", ({
4504
4671
  value: true
4505
4672
  }));
4506
4673
  exports.dlist = void 0;
4674
+ const parser_1 = __webpack_require__(605);
4507
4675
  const combinator_1 = __webpack_require__(3484);
4508
4676
  const inline_1 = __webpack_require__(7973);
4509
4677
  const source_1 = __webpack_require__(8745);
4510
4678
  const visibility_1 = __webpack_require__(6364);
4511
- const array_1 = __webpack_require__(6876);
4679
+ const util_1 = __webpack_require__(4992);
4512
4680
  const dom_1 = __webpack_require__(394);
4513
- exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~[^\S\n]+(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))])));
4514
- const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~[^\S\n]+(?=\S)/y, (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', {
4681
+ exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~[^\S\n]+(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dl', (0, util_1.unwrap)(fillTrailingDescription(ns))))]))));
4682
+ const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~[^\S\n]+(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dt', {
4515
4683
  'data-index': (0, inline_1.dataindex)(ns)
4516
- }, (0, dom_1.defrag)(ns))])));
4517
- const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/:[^\S\n]+(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:][^\S\n]+\S/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('dd', (0, dom_1.defrag)(ns))]), false);
4518
- function fillTrailingDescription(es) {
4519
- return es.length > 0 && es.at(-1).tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
4684
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
4685
+ const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/:[^\S\n]+(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:][^\S\n]+\S/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dd', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
4686
+ function fillTrailingDescription(nodes) {
4687
+ return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Data((0, dom_1.html)('dd'))) && nodes : nodes;
4520
4688
  }
4521
4689
 
4522
4690
  /***/ },
@@ -4555,6 +4723,7 @@ Object.defineProperty(exports, "__esModule", ({
4555
4723
  value: true
4556
4724
  }));
4557
4725
  exports.aside = void 0;
4726
+ const parser_1 = __webpack_require__(605);
4558
4727
  const combinator_1 = __webpack_require__(3484);
4559
4728
  const indexee_1 = __webpack_require__(7610);
4560
4729
  const util_1 = __webpack_require__(4992);
@@ -4562,12 +4731,13 @@ const parse_1 = __webpack_require__(3662);
4562
4731
  const dom_1 = __webpack_require__(394);
4563
4732
  exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/y, 300),
4564
4733
  // Bug: Type mismatch between outer and inner.
4565
- ([body, overflow, closer, opener, delim, param], context) => {
4566
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
4734
+ (nodes, context) => {
4735
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
4736
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4567
4737
  class: 'invalid',
4568
4738
  translate: 'no',
4569
4739
  ...(0, util_1.invalid)('aside', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4570
- }, `${opener}${body}${overflow || closer}`)];
4740
+ }, `${opener}${body}${overflow || closer}`))]);
4571
4741
  const references = (0, dom_1.html)('ol', {
4572
4742
  class: 'references'
4573
4743
  });
@@ -4578,15 +4748,15 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
4578
4748
  }
4579
4749
  }, context);
4580
4750
  const heading = 'H1 H2 H3 H4 H5 H6'.split(' ').includes(document.firstElementChild?.tagName) && document.firstElementChild;
4581
- if (!heading) return [(0, dom_1.html)('pre', {
4751
+ if (!heading) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4582
4752
  class: 'invalid',
4583
4753
  translate: 'no',
4584
4754
  ...(0, util_1.invalid)('aside', 'content', 'Missing the title at the first line')
4585
- }, `${opener}${body}${closer}`)];
4586
- return [(0, dom_1.html)('aside', {
4755
+ }, `${opener}${body}${closer}`))]);
4756
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4587
4757
  id: (0, indexee_1.identity)('index', context.id, heading),
4588
4758
  class: 'aside'
4589
- }, [document, (0, dom_1.html)('h2', 'References'), references])];
4759
+ }, [document, (0, dom_1.html)('h2', 'References'), references]))]);
4590
4760
  })));
4591
4761
 
4592
4762
  /***/ },
@@ -4610,12 +4780,13 @@ const dom_1 = __webpack_require__(394);
4610
4780
  const opener = /(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
4611
4781
  exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
4612
4782
  // Bug: Type mismatch between outer and inner.
4613
- ([body, overflow, closer, opener, delim, type = 'markdown', param], context) => {
4614
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
4783
+ (nodes, context) => {
4784
+ const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
4785
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4615
4786
  class: 'invalid',
4616
4787
  translate: 'no',
4617
4788
  ...(0, util_1.invalid)('example', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4618
- }, `${opener}${body}${overflow || closer}`)];
4789
+ }, `${opener}${body}${overflow || closer}`))]);
4619
4790
  switch (type) {
4620
4791
  case 'markdown':
4621
4792
  {
@@ -4628,28 +4799,26 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
4628
4799
  references
4629
4800
  }
4630
4801
  }, context);
4631
- return [(0, dom_1.html)('aside', {
4802
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4632
4803
  class: 'example',
4633
4804
  'data-type': 'markdown'
4634
4805
  }, [(0, dom_1.html)('pre', {
4635
4806
  translate: 'no'
4636
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])])];
4807
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]))]);
4637
4808
  }
4638
4809
  case 'math':
4639
- return [(0, dom_1.html)('aside', {
4810
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4640
4811
  class: 'example',
4641
4812
  'data-type': 'math'
4642
4813
  }, [(0, dom_1.html)('pre', {
4643
4814
  translate: 'no'
4644
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)((0, parser_1.input)(`$$\n${body}$$`, {
4645
- ...context
4646
- })), [])[0]])];
4815
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)((0, parser_1.subinput)(`$$\n${body}$$`, context))).head.value]))]);
4647
4816
  default:
4648
- return [(0, dom_1.html)('pre', {
4817
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4649
4818
  class: 'invalid',
4650
4819
  translate: 'no',
4651
4820
  ...(0, util_1.invalid)('example', 'type', 'Invalid example type')
4652
- }, `${opener}${body}${closer}`)];
4821
+ }, `${opener}${body}${closer}`))]);
4653
4822
  }
4654
4823
  })));
4655
4824
 
@@ -4682,7 +4851,9 @@ exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
4682
4851
  return parser({
4683
4852
  context
4684
4853
  }) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4685
- }, (0, combinator_1.union)([figure_1.figure]), false), ([el]) => el.tagName === 'FIGURE')));
4854
+ }, (0, combinator_1.union)([figure_1.figure]), false), ([{
4855
+ value: el
4856
+ }]) => el.tagName === 'FIGURE')));
4686
4857
  const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?=\s).*\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
4687
4858
 
4688
4859
  /***/ },
@@ -4697,17 +4868,20 @@ Object.defineProperty(exports, "__esModule", ({
4697
4868
  value: true
4698
4869
  }));
4699
4870
  exports.figbase = void 0;
4871
+ const parser_1 = __webpack_require__(605);
4700
4872
  const combinator_1 = __webpack_require__(3484);
4701
4873
  const label_1 = __webpack_require__(2178);
4702
4874
  const dom_1 = __webpack_require__(394);
4703
- exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?!\S|\n[^\S\n]*\S)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([el]) => {
4875
+ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?!\S|\n[^\S\n]*\S)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
4876
+ value: el
4877
+ }]) => {
4704
4878
  const label = el.getAttribute('data-label');
4705
4879
  const group = label.split('-', 1)[0];
4706
- return [(0, dom_1.html)('figure', {
4880
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', {
4707
4881
  'data-label': label,
4708
4882
  'data-group': group,
4709
4883
  hidden: ''
4710
- })];
4884
+ }))]);
4711
4885
  }));
4712
4886
 
4713
4887
  /***/ },
@@ -4743,19 +4917,21 @@ const dom_1 = __webpack_require__(394);
4743
4917
  exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure[^\S\n])?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\n]*(?:$|\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
4744
4918
  // All parsers which can include closing terms.
4745
4919
  (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, {})));
4746
- 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/y)])), (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.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])]), false), ([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', {
4747
- class: 'figindex'
4748
- }), (0, dom_1.html)('span', {
4749
- class: 'figtext'
4750
- }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/y, 300), ([body, overflow, closer, opener, delim], context) => {
4751
- const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.input)(opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '', {
4752
- ...context
4753
- })) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4754
- return [(0, dom_1.html)('pre', {
4920
+ 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/y)])), (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.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])]), false), nodes => {
4921
+ const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
4922
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4923
+ class: 'figindex'
4924
+ }), (0, dom_1.html)('span', {
4925
+ class: 'figtext'
4926
+ }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])]))]);
4927
+ })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
4928
+ const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
4929
+ const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4930
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4755
4931
  class: 'invalid',
4756
4932
  translate: 'no',
4757
4933
  ...(0, util_1.invalid)('figure', violation[0], violation[1])
4758
- }, `${opener}${body}${overflow || closer}`)];
4934
+ }, `${opener}${body}${overflow || closer}`))]);
4759
4935
  })));
4760
4936
  function attributes(label, param, content, caption) {
4761
4937
  const group = label.split('-', 1)[0];
@@ -4826,30 +5002,29 @@ const array_1 = __webpack_require__(6876);
4826
5002
  const dom_1 = __webpack_require__(394);
4827
5003
  exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/y, 300),
4828
5004
  // Bug: Type mismatch between outer and inner.
4829
- ([body, overflow, closer, opener, delim, type, param], context) => {
4830
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
5005
+ (nodes, context) => {
5006
+ const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5007
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4831
5008
  class: 'invalid',
4832
5009
  translate: 'no',
4833
5010
  ...(0, util_1.invalid)('message', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4834
- }, `${opener}${body}${overflow || closer}`)];
5011
+ }, `${opener}${body}${overflow || closer}`))]);
4835
5012
  switch (type) {
4836
5013
  case 'note':
4837
5014
  case 'caution':
4838
5015
  case 'warning':
4839
5016
  break;
4840
5017
  default:
4841
- return [(0, dom_1.html)('pre', {
5018
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4842
5019
  class: 'invalid',
4843
5020
  translate: 'no',
4844
5021
  ...(0, util_1.invalid)('message', 'type', 'Invalid message type')
4845
- }, `${opener}${body}${closer}`)];
5022
+ }, `${opener}${body}${closer}`))]);
4846
5023
  }
4847
- return [(0, dom_1.html)('section', {
5024
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', {
4848
5025
  class: `message`,
4849
5026
  'data-type': type
4850
- }, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content((0, parser_1.input)(seg, {
4851
- ...context
4852
- })), [])), [])))];
5027
+ }, [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, util_1.unwrap)((0, parser_1.eval)(content((0, parser_1.subinput)(seg, context))))), [(0, dom_1.html)('h1', title(type))])))]);
4853
5028
  }));
4854
5029
  function title(type) {
4855
5030
  switch (type) {
@@ -4876,17 +5051,21 @@ Object.defineProperty(exports, "__esModule", ({
4876
5051
  value: true
4877
5052
  }));
4878
5053
  exports.placeholder = exports.segment_ = exports.segment = void 0;
5054
+ const parser_1 = __webpack_require__(605);
4879
5055
  const combinator_1 = __webpack_require__(3484);
4880
5056
  const util_1 = __webpack_require__(4992);
4881
5057
  const dom_1 = __webpack_require__(394);
4882
5058
  const opener = /(~{3,})(?!~)[^\n]*(?:$|\n)/y;
4883
5059
  exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
4884
5060
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
4885
- exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), ([body, overflow, closer, opener, delim]) => [(0, dom_1.html)('pre', {
4886
- class: 'invalid',
4887
- translate: 'no',
4888
- ...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4889
- }, `${opener}${body}${overflow || closer}`)]));
5061
+ exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
5062
+ const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
5063
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5064
+ class: 'invalid',
5065
+ translate: 'no',
5066
+ ...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
5067
+ }, `${opener}${body}${overflow || closer}`))]);
5068
+ }));
4890
5069
 
4891
5070
  /***/ },
4892
5071
 
@@ -4914,35 +5093,38 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
4914
5093
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false)), false);
4915
5094
  exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000),
4916
5095
  // Bug: Type mismatch between outer and inner.
4917
- ([body, overflow, closer, opener, delim, type, param], context) => {
4918
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
5096
+ (nodes, context) => {
5097
+ const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5098
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4919
5099
  class: 'invalid',
4920
5100
  translate: 'no',
4921
5101
  ...(0, util_1.invalid)('table', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4922
- }, `${opener}${body}${overflow || closer}`)];
5102
+ }, `${opener}${body}${overflow || closer}`))]);
4923
5103
  switch (type) {
4924
5104
  case 'grid':
4925
5105
  case undefined:
4926
- return ((0, parser_1.eval)(parser((0, parser_1.input)(body, {
4927
- ...context
4928
- }))) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
5106
+ return ((0, parser_1.eval)(parser((0, parser_1.subinput)(body, context))) ?? new parser_1.List([new parser_1.Data((0, dom_1.html)('table'))])).foldl((acc, {
5107
+ value
5108
+ }) => acc.push(new parser_1.Data((0, dom_1.define)(value, {
4929
5109
  'data-type': type
4930
- }));
5110
+ }))) && acc, new parser_1.List());
4931
5111
  default:
4932
- return [(0, dom_1.html)('pre', {
5112
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4933
5113
  class: 'invalid',
4934
5114
  translate: 'no',
4935
5115
  ...(0, util_1.invalid)('table', 'argument', 'Invalid table type')
4936
- }, `${opener}${body}${closer}`)];
5116
+ }, `${opener}${body}${closer}`))]);
4937
5117
  }
4938
5118
  }));
4939
- const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => [(0, dom_1.html)('table', format(rows))])));
4940
- const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.union)([align])), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => !(0, alias_1.isArray)(ns[0]) ? (0, array_1.unshift)([[[]]], ns) : ns)));
5119
+ const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => new parser_1.List([new parser_1.Data((0, dom_1.html)('table', format([...(0, util_1.unwrap)(rows)])))]))));
5120
+ const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.union)([align]), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => Array.isArray(ns.head?.value) ? ns : ns.unshift(new parser_1.Data([[]])) && ns)));
4941
5121
  const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
4942
- 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(''))));
5122
+ const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
5123
+ value
5124
+ }]) => new parser_1.List([new parser_1.Data(value.split('/').map(s => s.split('')))])));
4943
5125
  const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y;
4944
- const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /\s*$/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
4945
- const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /\s*$/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
5126
+ const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5127
+ const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
4946
5128
  const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+\s/y, (0, combinator_1.convert)(source => `:${source}`, data, false)), (0, combinator_1.convert)(source => `: ${source}`, data, false)])));
4947
5129
  function attributes(source) {
4948
5130
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
@@ -4975,9 +5157,12 @@ function format(rows) {
4975
5157
  let ranges = {};
4976
5158
  let verticalHighlightExtensions = 0n;
4977
5159
  let verticalHighlightLevels = [];
4978
- ROW: for (let i = 0; i < rows.length; ++i) {
5160
+ let cnt = 0;
5161
+ for (const list of rows) ROW: for (let i = cnt++; i < cnt; ++i) {
4979
5162
  // Copy to make them retryable.
4980
- const [[[...as], [...vs] = []], ...cells] = rows[i];
5163
+ const [{
5164
+ value: [[...as], [...vs] = []]
5165
+ }, ...cells] = list;
4981
5166
  let isBody = target === tfoot ? false : undefined;
4982
5167
  as.length === 0 && as.push('-');
4983
5168
  ALIGN_H: for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {
@@ -5040,7 +5225,7 @@ function format(rows) {
5040
5225
  for (let j = 0; j < cells.length; ++j) {
5041
5226
  const jn = BigInt(j);
5042
5227
  const isVirtual = !!ranges[i]?.[j];
5043
- const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j];
5228
+ const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j].value;
5044
5229
  const isHeadCell = cell.tagName === 'TH';
5045
5230
  heads |= isHeadCell ? 1n << jn : 0n;
5046
5231
  highlights |= cell.className === 'highlight' ? 1n << jn : 0n;
@@ -5114,7 +5299,7 @@ function format(rows) {
5114
5299
  const lHighlight = ~lHeadCellIndex && horizontalHighlights & 1n << lHeadCellIndex;
5115
5300
  const rHighlight = ~rHeadCellIndex && horizontalHighlights & 1n << rHeadCellIndex;
5116
5301
  for (let i = 0, m = 1n; i < cells.length; ++i, m <<= 1n) {
5117
- const cell = cells[i];
5302
+ const cell = cells[i]?.value;
5118
5303
  if (!cell) continue;
5119
5304
  if (heads & m) continue;
5120
5305
  switch (m) {
@@ -5153,6 +5338,7 @@ Object.defineProperty(exports, "__esModule", ({
5153
5338
  value: true
5154
5339
  }));
5155
5340
  exports.heading = exports.segment = void 0;
5341
+ const parser_1 = __webpack_require__(605);
5156
5342
  const combinator_1 = __webpack_require__(3484);
5157
5343
  const inline_1 = __webpack_require__(7973);
5158
5344
  const source_1 = __webpack_require__(8745);
@@ -5163,15 +5349,18 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, co
5163
5349
  context: {
5164
5350
  source
5165
5351
  }
5166
- }) => [[source]])))));
5352
+ }) => new parser_1.List([new parser_1.Data(source)]))))));
5167
5353
  exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
5168
5354
  // その他の表示制御は各所のCSSで行う。
5169
- (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (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)(251 /* State.linkers */, (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], context) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, {
5170
- 'data-index': (0, inline_1.dataindex)(ns)
5171
- }, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
5172
- class: 'invalid',
5173
- ...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
5174
- }, context.source.slice(context.position - context.range, context.position))]))))));
5355
+ (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (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)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), (nodes, context) => {
5356
+ const [h, ...ns] = (0, util_1.unwrap)(nodes);
5357
+ return new parser_1.List([h.length <= 6 ? new parser_1.Data((0, dom_1.html)(`h${h.length}`, {
5358
+ 'data-index': (0, inline_1.dataindex)(nodes)
5359
+ }, (0, dom_1.defrag)(ns))) : new parser_1.Data((0, dom_1.html)(`h6`, {
5360
+ class: 'invalid',
5361
+ ...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
5362
+ }, context.source.slice(context.position - context.range, context.position)))]);
5363
+ }))))));
5175
5364
 
5176
5365
  /***/ },
5177
5366
 
@@ -5185,6 +5374,7 @@ Object.defineProperty(exports, "__esModule", ({
5185
5374
  value: true
5186
5375
  }));
5187
5376
  exports.ilistitem = exports.ilist_ = exports.ilist = void 0;
5377
+ const parser_1 = __webpack_require__(605);
5188
5378
  const combinator_1 = __webpack_require__(3484);
5189
5379
  const ulist_1 = __webpack_require__(7595);
5190
5380
  const olist_1 = __webpack_require__(7697);
@@ -5194,22 +5384,22 @@ const visibility_1 = __webpack_require__(6364);
5194
5384
  const util_1 = __webpack_require__(4992);
5195
5385
  const dom_1 = __webpack_require__(394);
5196
5386
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
5197
- exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, dom_1.html)('ul', {
5387
+ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('ul', {
5198
5388
  class: 'invalid',
5199
5389
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5200
- }, es)])));
5390
+ }, (0, util_1.unwrap)(ns)))]))));
5201
5391
  exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(({
5202
5392
  context: {
5203
5393
  source
5204
5394
  }
5205
- }) => [[source]])]), ({
5395
+ }) => new parser_1.List([new parser_1.Data(source)]))]), ({
5206
5396
  context: {
5207
5397
  source
5208
5398
  }
5209
- }) => [['', (0, dom_1.html)('span', {
5399
+ }) => new parser_1.List([new parser_1.Data(''), new parser_1.Data((0, dom_1.html)('span', {
5210
5400
  class: 'invalid',
5211
5401
  ...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
5212
- }, source.replace('\n', ''))]]);
5402
+ }, source.replace('\n', '')))]));
5213
5403
 
5214
5404
  /***/ },
5215
5405
 
@@ -5223,6 +5413,7 @@ Object.defineProperty(exports, "__esModule", ({
5223
5413
  value: true
5224
5414
  }));
5225
5415
  exports.mathblock = exports.segment_ = exports.segment = void 0;
5416
+ const parser_1 = __webpack_require__(605);
5226
5417
  const combinator_1 = __webpack_require__(3484);
5227
5418
  const util_1 = __webpack_require__(4992);
5228
5419
  const dom_1 = __webpack_require__(394);
@@ -5231,18 +5422,21 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
5231
5422
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
5232
5423
  exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
5233
5424
  // Bug: Type mismatch between outer and inner.
5234
- ([body, overflow, closer, opener, delim, param], {
5425
+ (nodes, {
5235
5426
  caches: {
5236
5427
  math: cache = undefined
5237
5428
  } = {}
5238
- }) => [delim.length === 2 && closer && !overflow && param.trimStart() === '' ? cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
5239
- class: 'math',
5240
- translate: 'no'
5241
- }, `${delim}\n${body}${delim}`) : (0, dom_1.html)('pre', {
5242
- class: 'invalid',
5243
- translate: 'no',
5244
- ...(0, util_1.invalid)('mathblock', delim.length > 2 ? 'syntax' : !closer || overflow ? 'fence' : 'argument', delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
5245
- }, `${opener}${body}${overflow || closer}`)]));
5429
+ }) => {
5430
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
5431
+ return new parser_1.List([delim.length === 2 && closer && !overflow && param.trimStart() === '' ? new parser_1.Data(cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
5432
+ class: 'math',
5433
+ translate: 'no'
5434
+ }, `${delim}\n${body}${delim}`)) : new parser_1.Data((0, dom_1.html)('pre', {
5435
+ class: 'invalid',
5436
+ translate: 'no',
5437
+ ...(0, util_1.invalid)('mathblock', delim.length > 2 ? 'syntax' : !closer || overflow ? 'fence' : 'argument', delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
5438
+ }, `${opener}${body}${overflow || closer}`))]);
5439
+ }));
5246
5440
 
5247
5441
  /***/ },
5248
5442
 
@@ -5256,6 +5450,7 @@ Object.defineProperty(exports, "__esModule", ({
5256
5450
  value: true
5257
5451
  }));
5258
5452
  exports.mediablock = void 0;
5453
+ const parser_1 = __webpack_require__(605);
5259
5454
  const combinator_1 = __webpack_require__(3484);
5260
5455
  const inline_1 = __webpack_require__(7973);
5261
5456
  const util_1 = __webpack_require__(4992);
@@ -5264,10 +5459,10 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
5264
5459
  context: {
5265
5460
  source
5266
5461
  }
5267
- }) => [[(0, dom_1.html)('span', {
5462
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5268
5463
  class: 'invalid',
5269
5464
  ...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
5270
- }, source.replace('\n', ''))]])))]), ns => [(0, dom_1.html)('div', ns)]));
5465
+ }, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5271
5466
 
5272
5467
  /***/ },
5273
5468
 
@@ -5281,6 +5476,7 @@ Object.defineProperty(exports, "__esModule", ({
5281
5476
  value: true
5282
5477
  }));
5283
5478
  exports.olist_ = exports.olist = void 0;
5479
+ const parser_1 = __webpack_require__(605);
5284
5480
  const combinator_1 = __webpack_require__(3484);
5285
5481
  const ulist_1 = __webpack_require__(7595);
5286
5482
  const ilist_1 = __webpack_require__(4223);
@@ -5295,21 +5491,21 @@ const openers = {
5295
5491
  };
5296
5492
  exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
5297
5493
  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 => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
5298
- const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (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.visualize)((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_]))]), ilist_1.ilistitem), ns => [(0, dom_1.html)('li', {
5494
+ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (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.visualize)((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_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('li', {
5299
5495
  'data-index': (0, inline_1.dataindex)(ns),
5300
- 'data-marker': ns.shift() || undefined
5301
- }, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))]))]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
5496
+ 'data-marker': ns.shift()?.value || undefined
5497
+ }, (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))])))]))), ns => new parser_1.List([new parser_1.Data(format((0, dom_1.html)('ol', (0, util_1.unwrap)(ns)), type, form))]));
5302
5498
  const heads = {
5303
5499
  '.': (0, combinator_1.focus)(openers['.'], ({
5304
5500
  context: {
5305
5501
  source
5306
5502
  }
5307
- }) => [[source.trimEnd().split('.', 1)[0] + '.']]),
5503
+ }) => new parser_1.List([new parser_1.Data(source.trimEnd().split('.', 1)[0] + '.')])),
5308
5504
  '(': (0, combinator_1.focus)(openers['('], ({
5309
5505
  context: {
5310
5506
  source
5311
5507
  }
5312
- }) => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')]])
5508
+ }) => new parser_1.List([new parser_1.Data(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
5313
5509
  };
5314
5510
  function idx(value) {
5315
5511
  switch (value) {
@@ -5411,9 +5607,10 @@ Object.defineProperty(exports, "__esModule", ({
5411
5607
  value: true
5412
5608
  }));
5413
5609
  exports.pagebreak = void 0;
5610
+ const parser_1 = __webpack_require__(605);
5414
5611
  const combinator_1 = __webpack_require__(3484);
5415
5612
  const dom_1 = __webpack_require__(394);
5416
- exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => [[(0, dom_1.html)('hr')]])));
5613
+ exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('hr'))]))));
5417
5614
 
5418
5615
  /***/ },
5419
5616
 
@@ -5427,11 +5624,13 @@ Object.defineProperty(exports, "__esModule", ({
5427
5624
  value: true
5428
5625
  }));
5429
5626
  exports.paragraph = void 0;
5627
+ const parser_1 = __webpack_require__(605);
5430
5628
  const combinator_1 = __webpack_require__(3484);
5431
5629
  const inline_1 = __webpack_require__(7973);
5432
5630
  const visibility_1 = __webpack_require__(6364);
5631
+ const util_1 = __webpack_require__(4992);
5433
5632
  const dom_1 = __webpack_require__(394);
5434
- exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)(ns))]));
5633
+ exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])));
5435
5634
 
5436
5635
  /***/ },
5437
5636
 
@@ -5445,19 +5644,20 @@ Object.defineProperty(exports, "__esModule", ({
5445
5644
  value: true
5446
5645
  }));
5447
5646
  exports.reply = void 0;
5647
+ const parser_1 = __webpack_require__(605);
5448
5648
  const combinator_1 = __webpack_require__(3484);
5449
5649
  const cite_1 = __webpack_require__(1200);
5450
5650
  const quote_1 = __webpack_require__(4847);
5451
5651
  const inline_1 = __webpack_require__(7973);
5452
5652
  const source_1 = __webpack_require__(8745);
5453
5653
  const visibility_1 = __webpack_require__(6364);
5454
- const array_1 = __webpack_require__(6876);
5654
+ const util_1 = __webpack_require__(4992);
5455
5655
  const dom_1 = __webpack_require__(394);
5456
5656
  const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`, 'y');
5457
5657
  exports.reply = (0, combinator_1.block)((0, combinator_1.validate)(cite_1.syntax, (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([cite_1.cite, quote_1.quote, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, delimiter), (0, visibility_1.visualize)((0, combinator_1.fmap)((0, combinator_1.some)(inline_1.inline), (ns, {
5458
5658
  source,
5459
5659
  position
5460
- }) => source[position - 1] === '\n' ? ns : (0, array_1.push)(ns, [(0, dom_1.html)('br')]))))])), ns => [(0, dom_1.html)('p', (0, visibility_1.trimBlankNodeEnd)((0, dom_1.defrag)(ns)))])));
5660
+ }) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Data((0, dom_1.html)('br'))) && ns)))])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns)))))]))));
5461
5661
 
5462
5662
  /***/ },
5463
5663
 
@@ -5471,6 +5671,7 @@ Object.defineProperty(exports, "__esModule", ({
5471
5671
  value: true
5472
5672
  }));
5473
5673
  exports.cite = exports.syntax = void 0;
5674
+ const parser_1 = __webpack_require__(605);
5474
5675
  const combinator_1 = __webpack_require__(3484);
5475
5676
  const anchor_1 = __webpack_require__(8535);
5476
5677
  const source_1 = __webpack_require__(8745);
@@ -5484,28 +5685,32 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
5484
5685
  context: {
5485
5686
  source
5486
5687
  }
5487
- }) => [[(0, dom_1.html)('a', {
5688
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5488
5689
  class: 'anchor'
5489
- }, source)]]), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5690
+ }, source))])), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5490
5691
  context: {
5491
5692
  source
5492
5693
  }
5493
- }) => [[(0, dom_1.html)('a', {
5694
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5494
5695
  class: 'anchor',
5495
5696
  href: source.slice(2).trimEnd(),
5496
5697
  target: '_blank'
5497
- }, source)]]), (0, combinator_1.focus)(/>>.+(?=\s*$)/y, ({
5698
+ }, source))])), (0, combinator_1.focus)(/>>.+(?=\s*$)/y, ({
5498
5699
  context: {
5499
5700
  source
5500
5701
  }
5501
- }) => [[source]])])), ([quotes, node]) => [(0, dom_1.html)('span', typeof node === 'object' ? {
5502
- class: 'cite'
5503
- } : {
5504
- class: 'cite invalid',
5505
- ...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
5506
- }, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
5507
- 'data-depth': `${quotes.length + 1}`
5508
- }, node.innerText.slice(1)) : node.slice(1)])), (0, dom_1.html)('br')]));
5702
+ }) => new parser_1.List([new parser_1.Data(source)]))])), nodes => {
5703
+ const quotes = nodes.head.value;
5704
+ const node = nodes.last.value;
5705
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', typeof node === 'object' ? {
5706
+ class: 'cite'
5707
+ } : {
5708
+ class: 'cite invalid',
5709
+ ...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
5710
+ }, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
5711
+ 'data-depth': `${quotes.length + 1}`
5712
+ }, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Data((0, dom_1.html)('br'))]);
5713
+ }));
5509
5714
 
5510
5715
  /***/ },
5511
5716
 
@@ -5519,10 +5724,12 @@ Object.defineProperty(exports, "__esModule", ({
5519
5724
  value: true
5520
5725
  }));
5521
5726
  exports.quote = exports.syntax = void 0;
5727
+ const parser_1 = __webpack_require__(605);
5522
5728
  const combinator_1 = __webpack_require__(3484);
5523
5729
  const math_1 = __webpack_require__(2962);
5524
5730
  const autolink_1 = __webpack_require__(8072);
5525
5731
  const source_1 = __webpack_require__(8745);
5732
+ const util_1 = __webpack_require__(4992);
5526
5733
  const dom_1 = __webpack_require__(394);
5527
5734
  exports.syntax = />+[^\S\n]/y;
5528
5735
  exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)((0, combinator_1.validate)(exports.syntax, source_1.anyline)), (0, combinator_1.convert)(
@@ -5532,9 +5739,9 @@ source => source.replace(/(?<=^>+[^\S\n])/mg, '\r'), (0, combinator_1.some)((0,
5532
5739
  math_1.math, autolink_1.autolink, source_1.linebreak, source_1.unescsource])), false)), (ns, {
5533
5740
  source,
5534
5741
  position
5535
- }) => [source[position - 1] === '\n' ? ns.pop() : (0, dom_1.html)('br'), (0, dom_1.html)('span', {
5742
+ }) => new parser_1.List([new parser_1.Data(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br')), new parser_1.Data((0, dom_1.html)('span', {
5536
5743
  class: 'quote'
5537
- }, (0, dom_1.defrag)(ns))].reverse()), false));
5744
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false));
5538
5745
 
5539
5746
  /***/ },
5540
5747
 
@@ -5548,18 +5755,21 @@ Object.defineProperty(exports, "__esModule", ({
5548
5755
  value: true
5549
5756
  }));
5550
5757
  exports.sidefence = void 0;
5758
+ const parser_1 = __webpack_require__(605);
5551
5759
  const combinator_1 = __webpack_require__(3484);
5552
5760
  const autolink_1 = __webpack_require__(1671);
5553
5761
  const source_1 = __webpack_require__(8745);
5554
5762
  const util_1 = __webpack_require__(4992);
5555
5763
  const dom_1 = __webpack_require__(394);
5556
- exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/(?=\|+(?:[^\S\n]|\n\|))(?:\|+(?:[^\S\n][^\n]*)?(?:$|\n))+$/y, (0, combinator_1.union)([source])), ([el]) => [(0, dom_1.define)(el, {
5764
+ exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/(?=\|+(?:[^\S\n]|\n\|))(?:\|+(?:[^\S\n][^\n]*)?(?:$|\n))+$/y, (0, combinator_1.union)([source])), ([{
5765
+ value
5766
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5557
5767
  class: 'invalid',
5558
5768
  ...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
5559
- })])));
5769
+ }))]))));
5560
5770
  const opener = /(?=\|\|+(?:$|\s))/y;
5561
5771
  const unindent = source => source.replace(/(?<=^|\n)\|(?:[^\S\n]|(?=\|*(?:$|\s)))|\n$/g, '');
5562
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?:[^\S\n][^\n]*)?(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))]), false, true))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
5772
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?:[^\S\n][^\n]*)?(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5563
5773
 
5564
5774
  /***/ },
5565
5775
 
@@ -5573,6 +5783,7 @@ Object.defineProperty(exports, "__esModule", ({
5573
5783
  value: true
5574
5784
  }));
5575
5785
  exports.table = void 0;
5786
+ const parser_1 = __webpack_require__(605);
5576
5787
  const combinator_1 = __webpack_require__(3484);
5577
5788
  const inline_1 = __webpack_require__(7973);
5578
5789
  const source_1 = __webpack_require__(8745);
@@ -5581,31 +5792,33 @@ const util_1 = __webpack_require__(4992);
5581
5792
  const duff_1 = __webpack_require__(9202);
5582
5793
  const array_1 = __webpack_require__(6876);
5583
5794
  const dom_1 = __webpack_require__(394);
5584
- exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (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))])])));
5585
- const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /[|\\]?\s*$/y, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, ({
5795
+ exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (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 => new parser_1.List([new parser_1.Data((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5796
+ const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /[|\\]?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
5586
5797
  context: {
5587
5798
  source
5588
5799
  }
5589
- }) => [[(0, dom_1.html)('tr', {
5800
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', {
5590
5801
  class: 'invalid',
5591
5802
  ...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
5592
- }, [(0, dom_1.html)('td', source.replace('\n', ''))])]]));
5803
+ }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
5593
5804
  const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/:-+:?/y, ({
5594
5805
  context: {
5595
5806
  source
5596
5807
  }
5597
- }) => [[source.at(-1) === ':' ? 'center' : 'start']]), (0, combinator_1.focus)(/-+:?/y, ({
5808
+ }) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'center' : 'start')])), (0, combinator_1.focus)(/-+:?/y, ({
5598
5809
  context: {
5599
5810
  source
5600
5811
  }
5601
- }) => [[source.at(-1) === ':' ? 'end' : '']])])), ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
5812
+ }) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'end' : '')]))])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5602
5813
  const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/[|\\]?\s*$/y, 9]]))]), /[^|]*/y, true);
5603
- const head = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]);
5604
- const data = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
5814
+ const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5815
+ const data = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5605
5816
  function format(rows) {
5606
- const aligns = rows[0].className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5607
- for (let i = 0; i < rows.length; ++i) {
5608
- for (let cols = rows[i].children, len = cols.length, j = 0; j < len; ++j) {
5817
+ const aligns = rows.head.value.className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().value.children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5818
+ for (const {
5819
+ value: row
5820
+ } of rows) {
5821
+ for (let cols = row.children, len = cols.length, j = 0; j < len; ++j) {
5609
5822
  if (j > 0 && !aligns[j]) {
5610
5823
  aligns[j] = aligns[j - 1];
5611
5824
  }
@@ -5628,26 +5841,34 @@ Object.defineProperty(exports, "__esModule", ({
5628
5841
  value: true
5629
5842
  }));
5630
5843
  exports.fillFirstLine = exports.checkbox = exports.ulist_ = exports.ulist = void 0;
5844
+ const parser_1 = __webpack_require__(605);
5631
5845
  const combinator_1 = __webpack_require__(3484);
5632
5846
  const olist_1 = __webpack_require__(7697);
5633
5847
  const ilist_1 = __webpack_require__(4223);
5634
5848
  const inline_1 = __webpack_require__(7973);
5635
5849
  const visibility_1 = __webpack_require__(6364);
5636
- const array_1 = __webpack_require__(6876);
5850
+ const util_1 = __webpack_require__(4992);
5637
5851
  const dom_1 = __webpack_require__(394);
5638
5852
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/- /y, exports.ulist_)));
5639
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (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)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (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.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => [(0, dom_1.html)('li', {
5853
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (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)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (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.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('li', {
5640
5854
  'data-index': (0, inline_1.dataindex)(ns)
5641
- }, (0, dom_1.defrag)(fillFirstLine(ns)))]))])))), es => [format((0, dom_1.html)('ul', es))])));
5855
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Data(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
5642
5856
  exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
5643
5857
  context: {
5644
5858
  source
5645
5859
  }
5646
- }) => [[(0, dom_1.html)('span', {
5860
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5647
5861
  class: 'checkbox'
5648
- }, source[1].trimStart() ? '☑' : '☐')]]);
5649
- function fillFirstLine(ns) {
5650
- return ns.length === 1 && typeof ns[0] === 'object' && ['UL', 'OL'].includes(ns[0].tagName) ? (0, array_1.unshift)([(0, dom_1.html)('br')], ns) : ns;
5862
+ }, source[1].trimStart() ? '☑' : '☐'))]));
5863
+ function fillFirstLine(nodes) {
5864
+ const node = nodes.head?.value;
5865
+ if (typeof node !== 'object') return nodes;
5866
+ switch (node.tagName) {
5867
+ case 'UL':
5868
+ case 'OL':
5869
+ nodes.unshift(new parser_1.Data((0, dom_1.html)('br')));
5870
+ }
5871
+ return nodes;
5651
5872
  }
5652
5873
  exports.fillFirstLine = fillFirstLine;
5653
5874
  function format(list) {
@@ -5669,6 +5890,7 @@ Object.defineProperty(exports, "__esModule", ({
5669
5890
  value: true
5670
5891
  }));
5671
5892
  exports.header = void 0;
5893
+ const parser_1 = __webpack_require__(605);
5672
5894
  const combinator_1 = __webpack_require__(3484);
5673
5895
  const segment_1 = __webpack_require__(3967);
5674
5896
  const source_1 = __webpack_require__(8745);
@@ -5686,14 +5908,14 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5686
5908
  } else {
5687
5909
  context.position = source.length;
5688
5910
  }
5689
- return [[]];
5911
+ return new parser_1.List();
5690
5912
  }, (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5691
5913
  context
5692
- }) => context.header ?? true, (0, combinator_1.focus)(/(---+)[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}\1[^\S\v\f\r\n]*(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), es => [(0, dom_1.html)('aside', {
5914
+ }) => context.header ?? true, (0, combinator_1.focus)(/(---+)[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}\1[^\S\v\f\r\n]*(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
5693
5915
  class: 'header'
5694
5916
  }, [(0, dom_1.html)('details', {
5695
5917
  open: ''
5696
- }, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])]), false))), ({
5918
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Data((0, dom_1.html)('summary', 'Header'))) && ns)))]))])), false))), ({
5697
5919
  context
5698
5920
  }) => {
5699
5921
  const {
@@ -5701,11 +5923,11 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5701
5923
  position
5702
5924
  } = context;
5703
5925
  context.position += source.length;
5704
- return [[(0, dom_1.html)('pre', {
5926
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5705
5927
  class: 'invalid',
5706
5928
  translate: 'no',
5707
5929
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
5708
- }, (0, normalize_1.normalize)(source.slice(position)))]];
5930
+ }, (0, normalize_1.normalize)(source.slice(position))))]);
5709
5931
  }]))), (0, combinator_1.clear)((0, source_1.str)(/[^\S\v\f\r\n]*\r?\n/y))])));
5710
5932
  const field = (0, combinator_1.line)(({
5711
5933
  context: {
@@ -5715,7 +5937,7 @@ const field = (0, combinator_1.line)(({
5715
5937
  }) => {
5716
5938
  const name = source.slice(position, source.indexOf(':', position));
5717
5939
  const value = source.slice(position + name.length + 1).trim();
5718
- return [[(0, dom_1.html)('span', {
5940
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5719
5941
  class: 'field',
5720
5942
  'data-name': name.toLowerCase(),
5721
5943
  'data-value': value
@@ -5723,7 +5945,7 @@ const field = (0, combinator_1.line)(({
5723
5945
  class: 'field-name'
5724
5946
  }, name), ': ', (0, dom_1.html)('span', {
5725
5947
  class: 'field-value'
5726
- }, value), '\n'])]];
5948
+ }, value), '\n']))]);
5727
5949
  });
5728
5950
 
5729
5951
  /***/ },
@@ -5881,13 +6103,15 @@ Object.defineProperty(exports, "__esModule", ({
5881
6103
  value: true
5882
6104
  }));
5883
6105
  exports.annotation = void 0;
6106
+ const parser_1 = __webpack_require__(605);
5884
6107
  const combinator_1 = __webpack_require__(3484);
5885
6108
  const inline_1 = __webpack_require__(7973);
5886
6109
  const visibility_1 = __webpack_require__(6364);
6110
+ const util_1 = __webpack_require__(4992);
5887
6111
  const dom_1 = __webpack_require__(394);
5888
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, ([, ns], context) => context.linebreak === 0 ? [[(0, dom_1.html)('sup', {
6112
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
5889
6113
  class: 'annotation'
5890
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]] : undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
6114
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
5891
6115
 
5892
6116
  /***/ },
5893
6117
 
@@ -5930,18 +6154,21 @@ Object.defineProperty(exports, "__esModule", ({
5930
6154
  value: true
5931
6155
  }));
5932
6156
  exports.account = void 0;
6157
+ const parser_1 = __webpack_require__(605);
5933
6158
  const combinator_1 = __webpack_require__(3484);
5934
6159
  const link_1 = __webpack_require__(3628);
5935
6160
  const source_1 = __webpack_require__(8745);
5936
6161
  const dom_1 = __webpack_require__(394);
5937
6162
  // https://example/@user must be a user page or a redirect page going there.
5938
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6163
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, link_1.unsafelink, false), ([{
6164
+ value
6165
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5939
6166
  class: 'account'
5940
- })]))), ({
6167
+ }))])))), ({
5941
6168
  context: {
5942
6169
  source
5943
6170
  }
5944
- }) => [[source]]])));
6171
+ }) => new parser_1.List([new parser_1.Data(source)])])));
5945
6172
 
5946
6173
  /***/ },
5947
6174
 
@@ -5955,6 +6182,7 @@ Object.defineProperty(exports, "__esModule", ({
5955
6182
  value: true
5956
6183
  }));
5957
6184
  exports.anchor = void 0;
6185
+ const parser_1 = __webpack_require__(605);
5958
6186
  const combinator_1 = __webpack_require__(3484);
5959
6187
  const link_1 = __webpack_require__(3628);
5960
6188
  const source_1 = __webpack_require__(8745);
@@ -5966,13 +6194,15 @@ const dom_1 = __webpack_require__(394);
5966
6194
  // cid: YYYY-MMDD-HHMM-SSmmm
5967
6195
  // 内部表現はUnixTimeに統一する(時系列順)
5968
6196
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5969
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*\/)?[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline?at=')}` : `?at=${source.slice(2)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6197
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*\/)?[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline?at=')}` : `?at=${source.slice(2)}`} }`, link_1.unsafelink, false), ([{
6198
+ value
6199
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5970
6200
  class: 'anchor'
5971
- })]))), ({
6201
+ }))])))), ({
5972
6202
  context: {
5973
6203
  source
5974
6204
  }
5975
- }) => [[source]]])));
6205
+ }) => new parser_1.List([new parser_1.Data(source)])])));
5976
6206
 
5977
6207
  /***/ },
5978
6208
 
@@ -5986,28 +6216,33 @@ Object.defineProperty(exports, "__esModule", ({
5986
6216
  value: true
5987
6217
  }));
5988
6218
  exports.channel = void 0;
6219
+ const parser_1 = __webpack_require__(605);
5989
6220
  const combinator_1 = __webpack_require__(3484);
5990
6221
  const link_1 = __webpack_require__(3628);
5991
6222
  const hashtag_1 = __webpack_require__(5764);
5992
6223
  const source_1 = __webpack_require__(8745);
5993
6224
  const dom_1 = __webpack_require__(394);
5994
6225
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
5995
- exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.open)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), ([source]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(source)), false, [3 | 0 /* Backtrack.autolink */]))]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, link_1.unsafelink, false), ([el], {
6226
+ exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.open)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), ([{
6227
+ value
6228
+ }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), false, [3 | 0 /* Backtrack.autolink */]))]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, link_1.unsafelink, false), ([{
6229
+ value: el
6230
+ }], {
5996
6231
  source,
5997
6232
  position,
5998
6233
  range = 0
5999
6234
  }) => {
6000
6235
  const src = source.slice(position - range, position);
6001
6236
  const url = `${el.getAttribute('href')}?ch=${src.slice(src.indexOf('#') + 1).replace(/#/g, '+')}`;
6002
- return [(0, dom_1.define)(el, {
6237
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
6003
6238
  class: 'channel',
6004
6239
  href: url
6005
- }, src)];
6240
+ }, src))]);
6006
6241
  }))), ({
6007
6242
  context: {
6008
6243
  source
6009
6244
  }
6010
- }) => [[source]]])));
6245
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6011
6246
 
6012
6247
  /***/ },
6013
6248
 
@@ -6021,22 +6256,25 @@ Object.defineProperty(exports, "__esModule", ({
6021
6256
  value: true
6022
6257
  }));
6023
6258
  exports.email = void 0;
6259
+ const parser_1 = __webpack_require__(605);
6024
6260
  const combinator_1 = __webpack_require__(3484);
6025
6261
  const source_1 = __webpack_require__(8745);
6026
6262
  const dom_1 = __webpack_require__(394);
6027
6263
  // https://html.spec.whatwg.org/multipage/input.html
6028
- exports.email = (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z][_.+-]?)(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z@#]|>>|:\S)/yi), ([source]) => source.length <= 255), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6264
+ exports.email = (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z][_.+-]?)(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z@#]|>>|:\S)/yi), ([{
6265
+ value
6266
+ }]) => value.length <= 255), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6029
6267
  context: {
6030
6268
  source
6031
6269
  }
6032
- }) => [[(0, dom_1.html)('a', {
6270
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6033
6271
  class: 'email',
6034
6272
  href: `mailto:${source}`
6035
- }, source)]])), ({
6273
+ }, source))]))), ({
6036
6274
  context: {
6037
6275
  source
6038
6276
  }
6039
- }) => [[source]]]));
6277
+ }) => new parser_1.List([new parser_1.Data(source)])]));
6040
6278
 
6041
6279
  /***/ },
6042
6280
 
@@ -6050,19 +6288,22 @@ Object.defineProperty(exports, "__esModule", ({
6050
6288
  value: true
6051
6289
  }));
6052
6290
  exports.hashnum = void 0;
6291
+ const parser_1 = __webpack_require__(605);
6053
6292
  const combinator_1 = __webpack_require__(3484);
6054
6293
  const link_1 = __webpack_require__(3628);
6055
6294
  const hashtag_1 = __webpack_require__(5764);
6056
6295
  const source_1 = __webpack_require__(8745);
6057
6296
  const dom_1 = __webpack_require__(394);
6058
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), false, [1 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6297
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), false, [1 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, link_1.unsafelink, false), ([{
6298
+ value
6299
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6059
6300
  class: 'hashnum',
6060
6301
  href: null
6061
- })]))), ({
6302
+ }))])))), ({
6062
6303
  context: {
6063
6304
  source
6064
6305
  }
6065
- }) => [[source]]])));
6306
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6066
6307
 
6067
6308
  /***/ },
6068
6309
 
@@ -6076,6 +6317,7 @@ Object.defineProperty(exports, "__esModule", ({
6076
6317
  value: true
6077
6318
  }));
6078
6319
  exports.hashtag = exports.emoji = void 0;
6320
+ const parser_1 = __webpack_require__(605);
6079
6321
  const combinator_1 = __webpack_require__(3484);
6080
6322
  const link_1 = __webpack_require__(3628);
6081
6323
  const source_1 = __webpack_require__(8745);
@@ -6083,13 +6325,17 @@ const dom_1 = __webpack_require__(394);
6083
6325
  // https://example/hashtags/a must be a hashtag page or a redirect page going there.
6084
6326
  // https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
6085
6327
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
6086
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji), 'yu')), ([source]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(source)), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6328
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji), 'yu')), ([{
6329
+ value
6330
+ }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink, false), ([{
6331
+ value
6332
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6087
6333
  class: 'hashtag'
6088
- })]))), ({
6334
+ }))])))), ({
6089
6335
  context: {
6090
6336
  source
6091
6337
  }
6092
- }) => [[source]]])));
6338
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6093
6339
 
6094
6340
  /***/ },
6095
6341
 
@@ -6103,6 +6349,7 @@ Object.defineProperty(exports, "__esModule", ({
6103
6349
  value: true
6104
6350
  }));
6105
6351
  exports.lineurl = exports.url = void 0;
6352
+ const parser_1 = __webpack_require__(605);
6106
6353
  const combinator_1 = __webpack_require__(3484);
6107
6354
  const link_1 = __webpack_require__(3628);
6108
6355
  const source_1 = __webpack_require__(8745);
@@ -6110,13 +6357,13 @@ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combina
6110
6357
  context: {
6111
6358
  source
6112
6359
  }
6113
- }) => [[source]]])));
6360
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6114
6361
  exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), ({
6115
6362
  context: {
6116
6363
  source
6117
6364
  }
6118
- }) => [[source]]])])));
6119
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */])]));
6365
+ }) => new parser_1.List([new parser_1.Data(source)])])])));
6366
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */])]));
6120
6367
 
6121
6368
  /***/ },
6122
6369
 
@@ -6130,11 +6377,12 @@ Object.defineProperty(exports, "__esModule", ({
6130
6377
  value: true
6131
6378
  }));
6132
6379
  exports.bracket = void 0;
6380
+ const parser_1 = __webpack_require__(605);
6133
6381
  const combinator_1 = __webpack_require__(3484);
6134
6382
  const inline_1 = __webpack_require__(7973);
6135
6383
  const link_1 = __webpack_require__(3628);
6136
6384
  const source_1 = __webpack_require__(8745);
6137
- const array_1 = __webpack_require__(6876);
6385
+ const util_1 = __webpack_require__(4992);
6138
6386
  const dom_1 = __webpack_require__(394);
6139
6387
  const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
6140
6388
  const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
@@ -6162,27 +6410,27 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6162
6410
  return d1(input);
6163
6411
  }
6164
6412
  }]));
6165
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
6413
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = new parser_1.List(), cs], {
6166
6414
  source,
6167
6415
  position,
6168
6416
  range = 0
6169
6417
  }) => {
6170
6418
  const str = source.slice(position - range + 1, position - 1);
6171
- return indexA.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6419
+ return indexA.test(str) ? new parser_1.List([new parser_1.Data(as.head.value), new parser_1.Data(str), new parser_1.Data(cs.head.value)]) : new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6172
6420
  class: 'paren'
6173
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
6174
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6421
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6422
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6175
6423
  const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
6176
6424
  source,
6177
6425
  position,
6178
6426
  range = 0
6179
6427
  }) => {
6180
6428
  const str = source.slice(position - range + 1, position - 1);
6181
- return indexF.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6429
+ return indexF.test(str) ? new parser_1.List([new parser_1.Data(as.head.value), new parser_1.Data(str), new parser_1.Data(cs.head.value)]) : new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6182
6430
  class: 'paren'
6183
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
6184
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6185
- const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = [], cs], context) => {
6431
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6432
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6433
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = new parser_1.List(), cs], context) => {
6186
6434
  if (context.state & 8 /* State.link */) {
6187
6435
  const {
6188
6436
  source,
@@ -6205,14 +6453,14 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6205
6453
  context.range = range;
6206
6454
  }
6207
6455
  }
6208
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)];
6209
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6210
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6211
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6212
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6456
+ return as.import(bs).import(cs);
6457
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6458
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6459
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6460
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6213
6461
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6214
6462
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6215
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6463
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6216
6464
 
6217
6465
  /***/ },
6218
6466
 
@@ -6226,15 +6474,16 @@ Object.defineProperty(exports, "__esModule", ({
6226
6474
  value: true
6227
6475
  }));
6228
6476
  exports.code = void 0;
6477
+ const parser_1 = __webpack_require__(605);
6229
6478
  const combinator_1 = __webpack_require__(3484);
6230
6479
  const util_1 = __webpack_require__(4992);
6231
6480
  const dom_1 = __webpack_require__(394);
6232
- exports.code = (0, combinator_1.open)(/(?=`)/y, (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? [[(0, dom_1.html)('code', {
6481
+ exports.code = (0, combinator_1.open)(/(?=`)/y, (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6233
6482
  'data-src': whole
6234
- }, format(body))]] : body ? [[(0, dom_1.html)('code', {
6483
+ }, format(body)))]) : body ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6235
6484
  class: 'invalid',
6236
6485
  ...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
6237
- }, whole)]] : [[opener]], true), false, [3 | 64 /* Backtrack.bracket */]);
6486
+ }, whole))]) : new parser_1.List([new parser_1.Data(opener)]), true), false, [3 | 64 /* Backtrack.bracket */]);
6238
6487
  function format(text) {
6239
6488
  return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
6240
6489
  }
@@ -6251,17 +6500,17 @@ Object.defineProperty(exports, "__esModule", ({
6251
6500
  value: true
6252
6501
  }));
6253
6502
  exports.deletion = void 0;
6503
+ const parser_1 = __webpack_require__(605);
6254
6504
  const combinator_1 = __webpack_require__(3484);
6255
6505
  const inline_1 = __webpack_require__(7973);
6256
6506
  const visibility_1 = __webpack_require__(6364);
6257
6507
  const util_1 = __webpack_require__(4992);
6258
- const array_1 = __webpack_require__(6876);
6259
6508
  const dom_1 = __webpack_require__(394);
6260
6509
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('~~', (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (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)]))), '~~', false, ([, bs], {
6261
6510
  buffer
6262
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
6511
+ }) => buffer.import(bs), ([, bs], {
6263
6512
  buffer
6264
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('del', (0, dom_1.defrag)(nodes))]))));
6513
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6265
6514
 
6266
6515
  /***/ },
6267
6516
 
@@ -6275,14 +6524,15 @@ Object.defineProperty(exports, "__esModule", ({
6275
6524
  value: true
6276
6525
  }));
6277
6526
  exports.emphasis = void 0;
6527
+ const parser_1 = __webpack_require__(605);
6278
6528
  const combinator_1 = __webpack_require__(3484);
6279
6529
  const inline_1 = __webpack_require__(7973);
6280
6530
  const strong_1 = __webpack_require__(6591);
6281
6531
  const source_1 = __webpack_require__(8745);
6282
6532
  const visibility_1 = __webpack_require__(6364);
6283
- const array_1 = __webpack_require__(6876);
6533
+ const util_1 = __webpack_require__(4992);
6284
6534
  const dom_1 = __webpack_require__(394);
6285
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((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, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, ([, bs]) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]));
6535
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((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, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
6286
6536
 
6287
6537
  /***/ },
6288
6538
 
@@ -6296,6 +6546,7 @@ Object.defineProperty(exports, "__esModule", ({
6296
6546
  value: true
6297
6547
  }));
6298
6548
  exports.emstrong = void 0;
6549
+ const parser_1 = __webpack_require__(605);
6299
6550
  const combinator_1 = __webpack_require__(3484);
6300
6551
  const inline_1 = __webpack_require__(7973);
6301
6552
  const strong_1 = __webpack_require__(6591);
@@ -6303,7 +6554,6 @@ const emphasis_1 = __webpack_require__(1354);
6303
6554
  const source_1 = __webpack_require__(8745);
6304
6555
  const visibility_1 = __webpack_require__(6364);
6305
6556
  const util_1 = __webpack_require__(4992);
6306
- const array_1 = __webpack_require__(6876);
6307
6557
  const dom_1 = __webpack_require__(394);
6308
6558
  const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (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)])));
6309
6559
  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, '*'), inline_1.inline)])));
@@ -6312,11 +6562,11 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6312
6562
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6313
6563
  exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***', (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((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}/y), false, ([, bs, cs], context) => {
6314
6564
  const {
6315
- buffer
6565
+ buffer = new parser_1.List()
6316
6566
  } = context;
6317
- switch (cs[0]) {
6567
+ switch (cs.head.value) {
6318
6568
  case '***':
6319
- return [bs];
6569
+ return bs;
6320
6570
  case '**':
6321
6571
  return (0, combinator_1.bind)(subemphasis, ds => {
6322
6572
  const {
@@ -6324,13 +6574,18 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***'
6324
6574
  } = context;
6325
6575
  if (source.startsWith('*', context.position)) {
6326
6576
  context.position += 1;
6327
- return [[(0, dom_1.html)('em', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */]];
6577
+ buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6578
+ buffer.import(ds);
6579
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Data("\u001F" /* Command.Separator */)]);
6328
6580
  } else {
6329
- return [prepend('*', (0, array_1.push)((0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds)), ["\u001F" /* Command.Separator */]))];
6581
+ buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6582
+ buffer.import(ds);
6583
+ buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6584
+ return prepend('*', buffer);
6330
6585
  }
6331
6586
  })({
6332
6587
  context
6333
- }) ?? [prepend('*', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
6588
+ }) ?? prepend('*', buffer.import(new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Data("\u001F" /* Command.Separator */)])));
6334
6589
  case '*':
6335
6590
  return (0, combinator_1.bind)(substrong, ds => {
6336
6591
  const {
@@ -6338,29 +6593,34 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***'
6338
6593
  } = context;
6339
6594
  if (source.startsWith('**', context.position)) {
6340
6595
  context.position += 2;
6341
- return [[(0, dom_1.html)('strong', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */]];
6596
+ buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6597
+ buffer.import(ds);
6598
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Data("\u001F" /* Command.Separator */)]);
6342
6599
  } else {
6343
- return [prepend('**', (0, array_1.push)((0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds)), ["\u001F" /* Command.Separator */]))];
6600
+ buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6601
+ buffer.import(ds);
6602
+ buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6603
+ return prepend('**', buffer);
6344
6604
  }
6345
6605
  })({
6346
6606
  context
6347
- }) ?? [prepend('**', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
6607
+ }) ?? prepend('**', buffer.import(new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Data("\u001F" /* Command.Separator */)])));
6348
6608
  }
6349
6609
  }, ([, bs], {
6350
6610
  buffer
6351
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]),
6611
+ }) => bs && buffer.import(bs) && buffer.push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer),
6352
6612
  // 3以上の`*`に対してemの適用を保証する
6353
- nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))])], (nodes, context, prefix, postfix, state) => {
6613
+ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)))]))]), (nodes, context, prefix, postfix, state) => {
6354
6614
  context.position += postfix;
6355
6615
  if (state) {
6356
6616
  switch (postfix) {
6357
6617
  case 0:
6358
6618
  break;
6359
6619
  case 1:
6360
- nodes = [(0, dom_1.html)('em', (0, dom_1.defrag)(nodes))];
6620
+ nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6361
6621
  break;
6362
6622
  case 2:
6363
- nodes = [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))];
6623
+ nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6364
6624
  break;
6365
6625
  default:
6366
6626
  }
@@ -6370,49 +6630,49 @@ nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nod
6370
6630
  case 0:
6371
6631
  break;
6372
6632
  case 1:
6373
- nodes = (0, combinator_1.bind)(subemphasis, ds => {
6633
+ nodes = (0, parser_1.eval)((0, combinator_1.bind)(subemphasis, ds => {
6374
6634
  const {
6375
6635
  source
6376
6636
  } = context;
6377
6637
  if (source.startsWith('*', context.position)) {
6378
6638
  context.position += 1;
6379
- return [[(0, dom_1.html)('em', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
6639
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
6380
6640
  } else {
6381
- return [prepend('*', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
6641
+ return prepend('*', nodes.import(ds));
6382
6642
  }
6383
6643
  })({
6384
6644
  context
6385
- })?.[0] ?? prepend('*', nodes);
6645
+ })) ?? prepend('*', nodes);
6386
6646
  prefix -= 1;
6387
6647
  break;
6388
6648
  case 2:
6389
- nodes = (0, combinator_1.bind)(substrong, ds => {
6649
+ nodes = (0, parser_1.eval)((0, combinator_1.bind)(substrong, ds => {
6390
6650
  const {
6391
6651
  source
6392
6652
  } = context;
6393
6653
  if (source.startsWith('**', context.position)) {
6394
6654
  context.position += 2;
6395
- return [[(0, dom_1.html)('strong', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
6655
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
6396
6656
  } else {
6397
- return [prepend('**', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
6657
+ return prepend('**', nodes.import(ds));
6398
6658
  }
6399
6659
  })({
6400
6660
  context
6401
- })?.[0] ?? prepend('**', nodes);
6661
+ })) ?? prepend('**', nodes);
6402
6662
  prefix -= 2;
6403
6663
  break;
6404
6664
  }
6405
6665
  }
6406
6666
  if (prefix > postfix) {
6407
- nodes = (0, array_1.push)(['*'.repeat(prefix - postfix)], nodes);
6667
+ nodes = prepend('*'.repeat(prefix - postfix), nodes);
6408
6668
  }
6409
- return [nodes];
6669
+ return nodes;
6410
6670
  }))));
6411
6671
  function prepend(prefix, nodes) {
6412
- if (typeof nodes[0] === 'string') {
6413
- nodes[0] = prefix + nodes[0];
6672
+ if (typeof nodes.head?.value === 'string') {
6673
+ nodes.head.value = prefix + nodes.head.value;
6414
6674
  } else {
6415
- (0, array_1.unshift)([prefix], nodes);
6675
+ nodes.unshift(new parser_1.Data(prefix));
6416
6676
  }
6417
6677
  return nodes;
6418
6678
  }
@@ -6447,45 +6707,50 @@ Object.defineProperty(exports, "__esModule", ({
6447
6707
  value: true
6448
6708
  }));
6449
6709
  exports.dataindex = exports.signature = exports.index = void 0;
6710
+ const parser_1 = __webpack_require__(605);
6450
6711
  const combinator_1 = __webpack_require__(3484);
6451
6712
  const inline_1 = __webpack_require__(7973);
6452
6713
  const indexee_1 = __webpack_require__(7610);
6453
6714
  const htmlentity_1 = __webpack_require__(470);
6454
6715
  const source_1 = __webpack_require__(8745);
6455
6716
  const visibility_1 = __webpack_require__(6364);
6456
- const array_1 = __webpack_require__(6876);
6717
+ const util_1 = __webpack_require__(4992);
6457
6718
  const dom_1 = __webpack_require__(394);
6458
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? [[(0, dom_1.html)('a', {
6719
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6459
6720
  'data-index': dataindex(bs)
6460
- }, (0, dom_1.defrag)(bs))]] : undefined, undefined, [3 | 64 /* Backtrack.bracket */])), ns => {
6721
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined, [3 | 64 /* Backtrack.bracket */])), ns => {
6461
6722
  if (ns.length === 1) {
6462
- const el = ns[0];
6463
- return [(0, dom_1.define)(el, {
6723
+ const el = ns.head.value;
6724
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
6464
6725
  id: el.id ? null : undefined,
6465
6726
  class: 'index',
6466
6727
  href: el.id ? `#${el.id}` : undefined
6467
- })];
6728
+ }))]);
6468
6729
  } else {
6469
6730
  ns.pop();
6470
6731
  return ns;
6471
6732
  }
6472
6733
  })));
6473
6734
  exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}])/y)]), ']'), /(?=])/y, false, ([, ns], context) => {
6474
- const index = (0, indexee_1.identity)('index', undefined, ns.join(''))?.slice(7);
6475
- return index && context.linebreak === 0 ? [[(0, dom_1.html)('span', {
6735
+ const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6736
+ value
6737
+ }) => acc + value, ''))?.slice(7);
6738
+ return index && context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6476
6739
  class: 'indexer',
6477
6740
  'data-index': index
6478
- })]] : undefined;
6479
- }, ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 64 /* Backtrack.bracket */])));
6480
- function dataindex(ns) {
6481
- if (ns.length === 0) return;
6482
- for (let i = ns.length; i--;) {
6483
- const node = ns[i];
6484
- if (typeof node === 'string') return;
6485
- if (i === ns.length - 1 && ['UL', 'OL'].includes(node.tagName)) continue;
6486
- if (!node.classList.contains('indexer')) return;
6487
- return node.getAttribute('data-index') ?? undefined;
6741
+ }))]) : undefined;
6742
+ }, ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */])));
6743
+ function dataindex(nodes) {
6744
+ let node = nodes.last;
6745
+ if (typeof node?.value !== 'object') return;
6746
+ switch (node.value.tagName) {
6747
+ case 'UL':
6748
+ case 'OL':
6749
+ node = node.prev;
6750
+ if (typeof node?.value !== 'object') return;
6488
6751
  }
6752
+ if (!node.value.classList.contains('indexer')) return;
6753
+ return node.value.getAttribute('data-index') ?? undefined;
6489
6754
  }
6490
6755
  exports.dataindex = dataindex;
6491
6756
 
@@ -6501,15 +6766,16 @@ Object.defineProperty(exports, "__esModule", ({
6501
6766
  value: true
6502
6767
  }));
6503
6768
  exports.text = exports.signature = exports.identity = exports.indexee = void 0;
6769
+ const parser_1 = __webpack_require__(605);
6504
6770
  const combinator_1 = __webpack_require__(3484);
6505
6771
  const dom_1 = __webpack_require__(394);
6506
6772
  function indexee(parser) {
6507
6773
  return (0, combinator_1.fmap)(parser, (ns, {
6508
6774
  id
6509
- }) => ns.length === 1 ? [(0, dom_1.define)(ns[0], {
6510
- id: identity('index', id, ns[0]),
6775
+ }) => ns.length === 1 ? new parser_1.List([new parser_1.Data((0, dom_1.define)(ns.head.value, {
6776
+ id: identity('index', id, ns.head.value),
6511
6777
  'data-index': null
6512
- })] : ns);
6778
+ }))]) : ns);
6513
6779
  }
6514
6780
  exports.indexee = indexee;
6515
6781
  const MAX = 60;
@@ -6638,6 +6904,7 @@ Object.defineProperty(exports, "__esModule", ({
6638
6904
  value: true
6639
6905
  }));
6640
6906
  exports.indexer = void 0;
6907
+ const parser_1 = __webpack_require__(605);
6641
6908
  const combinator_1 = __webpack_require__(3484);
6642
6909
  const index_1 = __webpack_require__(4688);
6643
6910
  const dom_1 = __webpack_require__(394);
@@ -6646,10 +6913,10 @@ const dom_1 = __webpack_require__(394);
6646
6913
  // 複合生成インデクスを手動で同期させるより最初から重複のない
6647
6914
  // テキストまたはインデクスを付けて同期が必要な機会を減らすのが
6648
6915
  // 継続的編集において最も簡便となる。
6649
- exports.indexer = (0, combinator_1.surround)(/\s\[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => [[(0, dom_1.html)('span', {
6916
+ exports.indexer = (0, combinator_1.surround)(/\s\[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6650
6917
  class: 'indexer',
6651
6918
  'data-index': ''
6652
- })]])]), /\]\s*$/y);
6919
+ }))]))]), /\]\s*$/y);
6653
6920
 
6654
6921
  /***/ },
6655
6922
 
@@ -6663,15 +6930,18 @@ Object.defineProperty(exports, "__esModule", ({
6663
6930
  value: true
6664
6931
  }));
6665
6932
  exports.isFixed = exports.number = exports.label = exports.segment = void 0;
6933
+ const parser_1 = __webpack_require__(605);
6666
6934
  const combinator_1 = __webpack_require__(3484);
6667
6935
  const source_1 = __webpack_require__(8745);
6668
6936
  const dom_1 = __webpack_require__(394);
6669
6937
  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]))/y);
6670
6938
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
6671
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([text]) => [(0, dom_1.html)('a', {
6939
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([{
6940
+ value
6941
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6672
6942
  class: 'label',
6673
- 'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6674
- }, text)]));
6943
+ 'data-label': value.slice(value[1] === '-' ? 0 : 1).toLowerCase()
6944
+ }, value))])));
6675
6945
  function number(label, base) {
6676
6946
  return isFixed(label) ? label.slice(label.lastIndexOf('-') + 1) : increment(base, base.split('.').length);
6677
6947
  }
@@ -6702,21 +6972,21 @@ Object.defineProperty(exports, "__esModule", ({
6702
6972
  value: true
6703
6973
  }));
6704
6974
  exports.placeholder = void 0;
6975
+ const parser_1 = __webpack_require__(605);
6705
6976
  const combinator_1 = __webpack_require__(3484);
6706
6977
  const inline_1 = __webpack_require__(7973);
6707
6978
  const source_1 = __webpack_require__(8745);
6708
6979
  const visibility_1 = __webpack_require__(6364);
6709
6980
  const util_1 = __webpack_require__(4992);
6710
- const array_1 = __webpack_require__(6876);
6711
6981
  const dom_1 = __webpack_require__(394);
6712
6982
  // Don't use the symbols already used: !#$%@&*+~=|
6713
6983
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6714
6984
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
6715
6985
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
6716
- (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, (_, context) => [[(0, dom_1.html)('span', {
6986
+ (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6717
6987
  class: 'invalid',
6718
6988
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
6719
- }, context.source.slice(context.position - context.range, context.position))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 64 /* Backtrack.bracket */]));
6989
+ }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */]));
6720
6990
 
6721
6991
  /***/ },
6722
6992
 
@@ -6730,13 +7000,13 @@ Object.defineProperty(exports, "__esModule", ({
6730
7000
  value: true
6731
7001
  }));
6732
7002
  exports.attributes = exports.attribute = exports.html = void 0;
7003
+ const parser_1 = __webpack_require__(605);
6733
7004
  const combinator_1 = __webpack_require__(3484);
6734
7005
  const inline_1 = __webpack_require__(7973);
6735
7006
  const source_1 = __webpack_require__(8745);
6736
7007
  const visibility_1 = __webpack_require__(6364);
6737
7008
  const util_1 = __webpack_require__(4992);
6738
7009
  const memoize_1 = __webpack_require__(6925);
6739
- const array_1 = __webpack_require__(6876);
6740
7010
  const dom_1 = __webpack_require__(394);
6741
7011
  const tags = ['wbr', 'bdo', 'bdi'];
6742
7012
  const attrspecs = {
@@ -6749,14 +7019,14 @@ Object.setPrototypeOf(attrspecs, null);
6749
7019
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
6750
7020
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
6751
7021
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6752
- (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (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, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
7022
+ (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (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, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
6753
7023
  // 不可視のHTML構造が可視構造を変化させるべきでない。
6754
7024
  // 可視のHTMLは優先度変更を検討する。
6755
7025
  // このため<>は将来的に共通構造を変化させる可能性があり
6756
7026
  // 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
6757
- (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], context) => [[elem(tag, true, as, bs, cs, context)]], ([as, bs = []], context) => [[elem(tag, true, as, bs, [], context)]]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
7027
+ (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
6758
7028
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6759
- (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]])])));
7029
+ (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))])));
6760
7030
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
6761
7031
  function elem(tag, content, as, bs, cs, context) {
6762
7032
  if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
@@ -6768,7 +7038,7 @@ function elem(tag, content, as, bs, cs, context) {
6768
7038
  const [attrs] = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
6769
7039
  if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
6770
7040
  if (as.at(-1) !== '>') return ielem('tag', `Missing the closing symbol ">"`, context);
6771
- return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
7041
+ return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)((0, util_1.unwrap)(bs)));
6772
7042
  }
6773
7043
  function ielem(type, message, context) {
6774
7044
  return (0, dom_1.html)('span', {
@@ -6781,15 +7051,15 @@ function attributes(syntax, spec, params) {
6781
7051
  const remains = [];
6782
7052
  let invalidation = false;
6783
7053
  const attrs = {};
6784
- for (let i = 0; i < params.length; ++i) {
6785
- const param = params[i].trimStart();
6786
- if (param === '') continue;
6787
- const name = param.split('=', 1)[0];
6788
- const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
7054
+ for (const param of params) {
7055
+ const attr = param.trimStart();
7056
+ if (attr === '') continue;
7057
+ const name = attr.split('=', 1)[0];
7058
+ const value = attr !== name ? attr.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
6789
7059
  invalidation ||= name === '' || !spec || name in attrs;
6790
7060
  if (name === '') continue;
6791
7061
  if (spec && name in spec && !spec[name]) {
6792
- remains.push(params[i]);
7062
+ remains.push(param);
6793
7063
  continue;
6794
7064
  }
6795
7065
  if (spec?.[name]?.includes(value) || spec?.[name]?.length === 0 && value !== undefined) {
@@ -6822,6 +7092,7 @@ Object.defineProperty(exports, "__esModule", ({
6822
7092
  value: true
6823
7093
  }));
6824
7094
  exports.htmlentity = exports.unsafehtmlentity = void 0;
7095
+ const parser_1 = __webpack_require__(605);
6825
7096
  const combinator_1 = __webpack_require__(3484);
6826
7097
  const util_1 = __webpack_require__(4992);
6827
7098
  const dom_1 = __webpack_require__(394);
@@ -6834,12 +7105,14 @@ exports.unsafehtmlentity = (0, combinator_1.focus)(/&(?:[0-9A-Za-z]+;?)?/y,
6834
7105
  source
6835
7106
  } = context;
6836
7107
  context.position += source.length;
6837
- return source.length > 1 && source.at(-1) === ';' ? [[parser(source) ?? source]] : [[source]];
7108
+ return source.length > 1 && source.at(-1) === ';' ? new parser_1.List([new parser_1.Data(parser(source) ?? source)]) : new parser_1.List([new parser_1.Data(source)]);
6838
7109
  });
6839
- exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([text]) => [length === 1 || text.at(-1) !== ';' ? text : (0, dom_1.html)('span', {
7110
+ exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7111
+ value
7112
+ }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
6840
7113
  class: 'invalid',
6841
7114
  ...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
6842
- }, text)]);
7115
+ }, value))]));
6843
7116
  const parser = (el => entity => {
6844
7117
  if (entity === '&NewLine;') return ' ';
6845
7118
  el.innerHTML = entity;
@@ -6859,17 +7132,17 @@ Object.defineProperty(exports, "__esModule", ({
6859
7132
  value: true
6860
7133
  }));
6861
7134
  exports.insertion = void 0;
7135
+ const parser_1 = __webpack_require__(605);
6862
7136
  const combinator_1 = __webpack_require__(3484);
6863
7137
  const inline_1 = __webpack_require__(7973);
6864
7138
  const visibility_1 = __webpack_require__(6364);
6865
7139
  const util_1 = __webpack_require__(4992);
6866
- const array_1 = __webpack_require__(6876);
6867
7140
  const dom_1 = __webpack_require__(394);
6868
7141
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('++', (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (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)]))), '++', false, ([, bs], {
6869
7142
  buffer
6870
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7143
+ }) => buffer.import(bs), ([, bs], {
6871
7144
  buffer
6872
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('ins', (0, dom_1.defrag)(nodes))]))));
7145
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6873
7146
 
6874
7147
  /***/ },
6875
7148
 
@@ -6883,20 +7156,20 @@ Object.defineProperty(exports, "__esModule", ({
6883
7156
  value: true
6884
7157
  }));
6885
7158
  exports.italic = void 0;
7159
+ const parser_1 = __webpack_require__(605);
6886
7160
  const combinator_1 = __webpack_require__(3484);
6887
7161
  const inline_1 = __webpack_require__(7973);
6888
7162
  const visibility_1 = __webpack_require__(6364);
6889
7163
  const util_1 = __webpack_require__(4992);
6890
- const array_1 = __webpack_require__(6876);
6891
7164
  const dom_1 = __webpack_require__(394);
6892
7165
  // 可読性のため実際にはオブリーク体を指定する。
6893
7166
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
6894
7167
  // ある程度の長さのある文に使うのが望ましい。
6895
7168
  exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('///', (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((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)])))), '///', false, ([, bs], {
6896
7169
  buffer
6897
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7170
+ }) => buffer.import(bs), ([, bs], {
6898
7171
  buffer
6899
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('i', (0, dom_1.defrag)(nodes))]))));
7172
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6900
7173
 
6901
7174
  /***/ },
6902
7175
 
@@ -6910,6 +7183,7 @@ Object.defineProperty(exports, "__esModule", ({
6910
7183
  value: true
6911
7184
  }));
6912
7185
  exports.decode = exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.medialink = exports.textlink = void 0;
7186
+ const parser_1 = __webpack_require__(605);
6913
7187
  const combinator_1 = __webpack_require__(3484);
6914
7188
  const inline_1 = __webpack_require__(7973);
6915
7189
  const html_1 = __webpack_require__(5013);
@@ -6917,22 +7191,25 @@ const source_1 = __webpack_require__(8745);
6917
7191
  const visibility_1 = __webpack_require__(6364);
6918
7192
  const util_1 = __webpack_require__(4992);
6919
7193
  const url_1 = __webpack_require__(1904);
6920
- const array_1 = __webpack_require__(6876);
6921
7194
  const dom_1 = __webpack_require__(394);
6922
7195
  const optspec = {
6923
7196
  rel: ['nofollow']
6924
7197
  };
6925
7198
  Object.setPrototypeOf(optspec, null);
6926
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [(0, array_1.push)(ns, ["\u001F" /* Command.Separator */])] : undefined, undefined, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */])),
7199
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns : undefined, undefined, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */])),
6927
7200
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
6928
7201
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
6929
7202
  (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, undefined, ([as, bs], context) => {
6930
7203
  if (!bs) return;
6931
7204
  const head = context.position - context.range;
6932
7205
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
6933
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
6934
- }, [3 | 16 /* Backtrack.link */]))]), ([content, params], context) => {
6935
- if (content.at(-1) === "\u001F" /* Command.Separator */) {
7206
+ return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7207
+ }, [3 | 16 /* Backtrack.link */]))]), ([{
7208
+ value: content
7209
+ }, {
7210
+ value: params = undefined
7211
+ } = {}], context) => {
7212
+ if (content.last.value === "\u001F" /* Command.Separator */) {
6936
7213
  content.pop();
6937
7214
  if (params === undefined) {
6938
7215
  const head = context.position - context.range;
@@ -6940,30 +7217,38 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
6940
7217
  }
6941
7218
  } else {
6942
7219
  params = content;
6943
- content = [];
7220
+ content = new parser_1.List();
6944
7221
  }
6945
- if (params.at(-1) === "\u0018" /* Command.Cancel */) {
7222
+ if (params.last.value === "\u0018" /* Command.Cancel */) {
6946
7223
  params.pop();
6947
- return [[(0, dom_1.html)('span', {
7224
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6948
7225
  class: 'invalid',
6949
7226
  ...(0, util_1.invalid)('link', 'syntax', 'Missing the closing symbol "}"')
6950
- }, context.source.slice(context.position - context.range, context.position))]];
7227
+ }, context.source.slice(context.position - context.range, context.position)))]);
6951
7228
  }
6952
7229
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
6953
- return [[parse((0, dom_1.defrag)(content), params, context)]];
7230
+ return new parser_1.List([new parser_1.Data(parse(content, params, context))]);
6954
7231
  }))))));
6955
- exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(/[[{]/y, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]]))))));
6956
- exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(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)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]])));
7232
+ exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(/[[{]/y, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
7233
+ value: content
7234
+ }, {
7235
+ value: params
7236
+ }], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))])))))));
7237
+ exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(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)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([{
7238
+ value: params
7239
+ }, {
7240
+ value: content
7241
+ } = new parser_1.Data(new parser_1.List())], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))));
6957
7242
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
6958
- exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => [` rel="nofollow"`]), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7243
+ exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Data(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
6959
7244
  function parse(content, params, context) {
6960
- const INSECURE_URI = params.shift();
7245
+ const INSECURE_URI = params.shift().value;
6961
7246
  let uri;
6962
7247
  try {
6963
7248
  uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6964
7249
  } catch {}
6965
7250
  const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
6966
- return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params)[0]);
7251
+ return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, (0, util_1.unwrap)(params))[0]);
6967
7252
  }
6968
7253
  function elem(INSECURE_URI, content, uri, origin) {
6969
7254
  let type;
@@ -6976,7 +7261,7 @@ function elem(INSECURE_URI, content, uri, origin) {
6976
7261
  case 'http:':
6977
7262
  case 'https:':
6978
7263
  switch (true) {
6979
- case /[0-9a-z]:\S/i.test((0, util_1.stringify)(content)):
7264
+ case /[0-9a-z]:\S/i.test((0, util_1.stringify)((0, util_1.unwrap)(content))):
6980
7265
  type = 'content';
6981
7266
  message = 'URI must not be contained';
6982
7267
  break;
@@ -6988,19 +7273,19 @@ function elem(INSECURE_URI, content, uri, origin) {
6988
7273
  return (0, dom_1.html)('a', {
6989
7274
  class: content.length === 0 ? 'url' : 'link',
6990
7275
  href: uri.source,
6991
- target: false || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : undefined
6992
- }, content.length === 0 ? decode(INSECURE_URI) : content);
7276
+ target: false || uri.origin !== origin || typeof content.head?.value === 'object' && content.head.value.classList.contains('media') ? '_blank' : undefined
7277
+ }, content.length === 0 ? decode(INSECURE_URI) : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
6993
7278
  }
6994
7279
  break;
6995
7280
  case 'tel:':
6996
- const tel = content.length === 0 ? INSECURE_URI : content[0];
7281
+ const tel = content.length === 0 ? INSECURE_URI : (0, util_1.stringify)((0, util_1.unwrap)(content));
6997
7282
  const pattern = /^(?:tel:)?(?:\+(?!0))?\d+(?:-\d+)*$/i;
6998
7283
  switch (true) {
6999
7284
  case content.length <= 1 && pattern.test(INSECURE_URI) && typeof tel === 'string' && pattern.test(tel) && tel.replace(/[^+\d]/g, '') === INSECURE_URI.replace(/[^+\d]/g, ''):
7000
7285
  return (0, dom_1.html)('a', {
7001
7286
  class: 'tel',
7002
7287
  href: uri.source
7003
- }, content.length === 0 ? [INSECURE_URI] : content);
7288
+ }, content.length === 0 ? INSECURE_URI : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
7004
7289
  default:
7005
7290
  type = 'content';
7006
7291
  message = 'Invalid content';
@@ -7013,7 +7298,7 @@ function elem(INSECURE_URI, content, uri, origin) {
7013
7298
  return (0, dom_1.html)('a', {
7014
7299
  class: 'invalid',
7015
7300
  ...(0, util_1.invalid)('link', type, message)
7016
- }, content.length === 0 ? INSECURE_URI : content);
7301
+ }, content.length === 0 ? INSECURE_URI : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
7017
7302
  }
7018
7303
  function resolve(uri, host, source) {
7019
7304
  switch (true) {
@@ -7055,27 +7340,27 @@ Object.defineProperty(exports, "__esModule", ({
7055
7340
  value: true
7056
7341
  }));
7057
7342
  exports.mark = void 0;
7343
+ const parser_1 = __webpack_require__(605);
7058
7344
  const combinator_1 = __webpack_require__(3484);
7059
7345
  const inline_1 = __webpack_require__(7973);
7060
7346
  const indexee_1 = __webpack_require__(7610);
7061
7347
  const visibility_1 = __webpack_require__(6364);
7062
7348
  const util_1 = __webpack_require__(4992);
7063
- const array_1 = __webpack_require__(6876);
7064
7349
  const dom_1 = __webpack_require__(394);
7065
7350
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.validate)('==', (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((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)])))), '==', false, ([, bs], {
7066
7351
  buffer
7067
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7352
+ }) => buffer.import(bs), ([, bs], {
7068
7353
  buffer
7069
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), (nodes, {
7354
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
7070
7355
  id
7071
7356
  }) => {
7072
- const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
7357
+ const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
7073
7358
  (0, dom_1.define)(el, {
7074
7359
  id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
7075
7360
  });
7076
- return el.id ? [el, (0, dom_1.html)('a', {
7361
+ return el.id ? new parser_1.List([new parser_1.Data(el), new parser_1.Data((0, dom_1.html)('a', {
7077
7362
  href: `#${el.id}`
7078
- })] : [el];
7363
+ }))]) : new parser_1.List([new parser_1.Data(el)]);
7079
7364
  }))))));
7080
7365
 
7081
7366
  /***/ },
@@ -7090,6 +7375,7 @@ Object.defineProperty(exports, "__esModule", ({
7090
7375
  value: true
7091
7376
  }));
7092
7377
  exports.math = void 0;
7378
+ const parser_1 = __webpack_require__(605);
7093
7379
  const combinator_1 = __webpack_require__(3484);
7094
7380
  const source_1 = __webpack_require__(8745);
7095
7381
  const util_1 = __webpack_require__(4992);
@@ -7102,7 +7388,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7102
7388
  math: cache
7103
7389
  } = {}
7104
7390
  }
7105
- }) => [[cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7391
+ }) => new parser_1.List([new parser_1.Data(cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7106
7392
  class: 'math',
7107
7393
  translate: 'no',
7108
7394
  'data-src': source
@@ -7110,7 +7396,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7110
7396
  class: 'invalid',
7111
7397
  translate: 'no',
7112
7398
  ...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
7113
- }, source)]]));
7399
+ }, source))])));
7114
7400
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\n]/y)]))), (0, source_1.str)('}'), true));
7115
7401
 
7116
7402
  /***/ },
@@ -7133,7 +7419,6 @@ const htmlentity_1 = __webpack_require__(470);
7133
7419
  const source_1 = __webpack_require__(8745);
7134
7420
  const util_1 = __webpack_require__(4992);
7135
7421
  const url_1 = __webpack_require__(1904);
7136
- const array_1 = __webpack_require__(6876);
7137
7422
  const dom_1 = __webpack_require__(394);
7138
7423
  const optspec = {
7139
7424
  'width': [],
@@ -7142,20 +7427,30 @@ const optspec = {
7142
7427
  rel: undefined
7143
7428
  };
7144
7429
  Object.setPrototypeOf(optspec, null);
7145
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [ns] : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, undefined, ([as, bs], context) => {
7430
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, undefined, ([as, bs], context) => {
7146
7431
  if (!bs) return;
7147
7432
  const head = context.position - context.range;
7148
7433
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7149
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
7150
- }, [3 | 16 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], context) => {
7151
- if (params.at(-1) === "\u0018" /* Command.Cancel */) {
7434
+ return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7435
+ }, [3 | 16 /* Backtrack.link */]))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7436
+ value
7437
+ }) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
7438
+ value: [{
7439
+ value: text
7440
+ }]
7441
+ }, {
7442
+ value: params
7443
+ }], context) => {
7444
+ if (text && text.trimStart() === '') return;
7445
+ text = text.trim();
7446
+ if (params.last.value === "\u0018" /* Command.Cancel */) {
7152
7447
  params.pop();
7153
- return [[(0, dom_1.html)('span', {
7448
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7154
7449
  class: 'invalid',
7155
7450
  ...(0, util_1.invalid)('media', 'syntax', 'Missing the closing symbol "}"')
7156
- }, '!' + context.source.slice(context.position - context.range, context.position))]];
7451
+ }, '!' + context.source.slice(context.position - context.range, context.position)))]);
7157
7452
  }
7158
- const INSECURE_URI = params.shift();
7453
+ const INSECURE_URI = params.shift().value;
7159
7454
  // altが空だとエラーが見えないため埋める。
7160
7455
  text ||= (0, link_1.decode)(INSECURE_URI);
7161
7456
  let uri;
@@ -7168,30 +7463,38 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7168
7463
  'data-src': uri?.source
7169
7464
  });
7170
7465
  el.setAttribute('alt', text);
7171
- if (!sanitize(el, uri)) return [[el]];
7172
- const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, params);
7466
+ if (!sanitize(el, uri)) return new parser_1.List([new parser_1.Data(el)]);
7467
+ const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, (0, util_1.unwrap)(params));
7173
7468
  (0, dom_1.define)(el, attrs);
7174
7469
  // Awaiting the generic support for attr().
7175
7470
  if (el.hasAttribute('aspect-ratio')) {
7176
7471
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
7177
7472
  }
7178
- if (context.state & 8 /* State.link */) return [[el]];
7179
- if (cache && cache.tagName !== 'IMG') return [[el]];
7473
+ if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Data(el)]);
7474
+ if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.Data(el)]);
7180
7475
  const {
7181
7476
  source,
7182
7477
  position
7183
7478
  } = context;
7184
- return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => {
7479
+ return (0, combinator_1.fmap)(link_1.unsafelink, ([{
7480
+ value
7481
+ }]) => {
7185
7482
  context.source = source;
7186
7483
  context.position = position;
7187
- return [(0, dom_1.define)(link, {
7484
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
7188
7485
  class: null,
7189
7486
  target: '_blank'
7190
- }, [el])];
7487
+ }, [el]))]);
7191
7488
  })((0, parser_1.subinput)(`{ ${INSECURE_URI}${linkparams.join('')} }`, context));
7192
7489
  })))));
7193
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (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, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (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, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (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, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */])])));
7194
- const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, ([[a], [b], [c]]) => [b === 'x' ? [`width="${a}"`, `height="${c}"`] : [`aspect-ratio="${a}/${c}"`]]), link_1.option]));
7490
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (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, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (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, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (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, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */])])));
7491
+ const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, ([[{
7492
+ value: a
7493
+ }], [{
7494
+ value: b
7495
+ }], [{
7496
+ value: c
7497
+ }]]) => b === 'x' ? new parser_1.List([new parser_1.Data(`width="${a}"`), new parser_1.Data(`height="${c}"`)]) : new parser_1.List([new parser_1.Data(`aspect-ratio="${a}/${c}"`)])), link_1.option]));
7195
7498
  function sanitize(target, uri) {
7196
7499
  let type;
7197
7500
  let message;
@@ -7241,9 +7544,8 @@ const inline_1 = __webpack_require__(7973);
7241
7544
  const link_1 = __webpack_require__(3628);
7242
7545
  const source_1 = __webpack_require__(8745);
7243
7546
  const visibility_1 = __webpack_require__(6364);
7244
- const dom_1 = __webpack_require__(394);
7245
- const array_1 = __webpack_require__(6876);
7246
7547
  const util_1 = __webpack_require__(4992);
7548
+ const dom_1 = __webpack_require__(394);
7247
7549
  exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, ([, ns], context) => {
7248
7550
  const {
7249
7551
  position,
@@ -7251,7 +7553,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7251
7553
  linebreak = 0
7252
7554
  } = context;
7253
7555
  if (linebreak === 0) {
7254
- return [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]];
7556
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
7255
7557
  } else {
7256
7558
  const head = position - range;
7257
7559
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
@@ -7272,13 +7574,13 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7272
7574
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
7273
7575
  } else {
7274
7576
  if (state & 128 /* State.annotation */) {
7275
- (0, array_1.push)(bs, [source[position]]);
7577
+ bs.push(new parser_1.Data(source[position]));
7276
7578
  }
7277
7579
  context.position += 1;
7278
7580
  let result;
7279
7581
  if (source[context.position] !== '{') {
7280
7582
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7281
- result = [[]];
7583
+ result = new parser_1.List();
7282
7584
  } else {
7283
7585
  result = !(0, combinator_1.isBacktrack)(context, [1 | 16 /* Backtrack.link */]) ? (0, link_1.textlink)({
7284
7586
  context
@@ -7286,25 +7588,25 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7286
7588
  context.range = range;
7287
7589
  if (!result) {
7288
7590
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7289
- result = [[]];
7591
+ result = new parser_1.List();
7290
7592
  }
7291
7593
  }
7292
7594
  if (context.position === source.length) {
7293
7595
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7294
7596
  } else {
7295
- const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = [], ds]) => [(0, array_1.push)(cs, ds)], ([, cs = []]) => {
7597
+ const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
7296
7598
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7297
- return [cs];
7599
+ return cs;
7298
7600
  })({
7299
7601
  context
7300
7602
  });
7301
7603
  if (state & 128 /* State.annotation */ && next) {
7302
- return [(0, array_1.push)((0, array_1.push)((0, array_1.unshift)(as, bs), (0, parser_1.eval)(result)), (0, parser_1.eval)(next))];
7604
+ return as.import(bs).import((0, parser_1.eval)(result)).import((0, parser_1.eval)(next));
7303
7605
  }
7304
7606
  }
7305
7607
  context.position = position;
7306
7608
  }
7307
- return state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs)] : undefined;
7609
+ return state & 128 /* State.annotation */ ? as.import(bs) : undefined;
7308
7610
  }, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
7309
7611
  // Chicago-Style
7310
7612
  const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1.union)([(0, source_1.str)(/(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/y)]), /\|?(?=]])|\|/y, true, ([, ns], context) => {
@@ -7313,23 +7615,23 @@ const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1
7313
7615
  position,
7314
7616
  range = 0
7315
7617
  } = context;
7316
- if (!ns) return [['', source.slice(position - range, source[position - 1] === '|' ? position - 1 : position)]];
7618
+ if (!ns) return new parser_1.List([new parser_1.Data(''), new parser_1.Data(source.slice(position - range, source[position - 1] === '|' ? position - 1 : position))]);
7317
7619
  context.position += source[position] === ' ' ? 1 : 0;
7318
- return [["\u001F" /* Command.Separator */, ns[0].trimEnd()]];
7620
+ return new parser_1.List([new parser_1.Data("\u001F" /* Command.Separator */), new parser_1.Data(ns.head.value.trimEnd())]);
7319
7621
  }, (_, context) => {
7320
7622
  context.position -= context.range;
7321
- return [['']];
7623
+ return new parser_1.List([new parser_1.Data('')]);
7322
7624
  });
7323
7625
  function attributes(ns) {
7324
- switch (ns[0]) {
7626
+ switch (ns.head.value) {
7325
7627
  case '':
7326
7628
  return {
7327
7629
  class: 'invalid',
7328
7630
  ...(0, util_1.invalid)('reference', 'syntax', 'Invalid abbreviation')
7329
7631
  };
7330
7632
  case "\u001F" /* Command.Separator */:
7331
- const abbr = ns[1];
7332
- ns[0] = ns[1] = '';
7633
+ const abbr = ns.head.next.value;
7634
+ ns.head.value = ns.head.next.value = '';
7333
7635
  return {
7334
7636
  class: 'reference',
7335
7637
  'data-abbr': abbr
@@ -7353,24 +7655,24 @@ Object.defineProperty(exports, "__esModule", ({
7353
7655
  value: true
7354
7656
  }));
7355
7657
  exports.remark = void 0;
7658
+ const parser_1 = __webpack_require__(605);
7356
7659
  const combinator_1 = __webpack_require__(3484);
7357
7660
  const inline_1 = __webpack_require__(7973);
7358
7661
  const source_1 = __webpack_require__(8745);
7359
7662
  const util_1 = __webpack_require__(4992);
7360
- const array_1 = __webpack_require__(6876);
7361
7663
  const dom_1 = __webpack_require__(394);
7362
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
7664
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7363
7665
  class: 'remark'
7364
7666
  }, [(0, dom_1.html)('input', {
7365
7667
  type: 'checkbox'
7366
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]), (0, combinator_1.focus)(/\[%+(?=\s)/y, ({
7668
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=\s)/y, ({
7367
7669
  context: {
7368
7670
  source
7369
7671
  }
7370
- }) => [[(0, dom_1.html)('span', {
7672
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7371
7673
  class: 'invalid',
7372
7674
  ...(0, util_1.invalid)('remark', 'syntax', 'Invalid start symbol')
7373
- }, source)]])));
7675
+ }, source))]))));
7374
7676
 
7375
7677
  /***/ },
7376
7678
 
@@ -7389,23 +7691,39 @@ const combinator_1 = __webpack_require__(3484);
7389
7691
  const htmlentity_1 = __webpack_require__(470);
7390
7692
  const source_1 = __webpack_require__(8745);
7391
7693
  const visibility_1 = __webpack_require__(6364);
7392
- const array_1 = __webpack_require__(6876);
7694
+ const util_1 = __webpack_require__(4992);
7393
7695
  const dom_1 = __webpack_require__(394);
7394
7696
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, ([, ns]) => {
7395
- ns && ns.at(-1) === '' && ns.pop();
7396
- return (0, visibility_1.isTightNodeStart)(ns) ? [ns] : undefined;
7397
- }, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([texts, rubies], context) => {
7697
+ ns && ns.last?.value === '' && ns.pop();
7698
+ return (0, visibility_1.isTightNodeStart)(ns) ? ns : undefined;
7699
+ }, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([{
7700
+ value: texts
7701
+ }, {
7702
+ value: rubies = undefined
7703
+ } = {}], context) => {
7398
7704
  if (rubies === undefined) {
7399
7705
  const head = context.position - context.range;
7400
7706
  return void (0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.ruby */], head);
7401
7707
  }
7402
7708
  switch (true) {
7403
- case rubies.length <= texts.length:
7404
- return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]];
7405
- case texts.length === 1 && [...texts[0]].length >= rubies.length:
7406
- return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]];
7709
+ case texts.length >= rubies.length:
7710
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)([...zip(texts, rubies)].reduce((acc, [{
7711
+ value: text = ''
7712
+ } = {}, {
7713
+ value: ruby = ''
7714
+ } = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rp', '(')), new parser_1.Data((0, dom_1.html)('rt', ruby)), new parser_1.Data((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
7715
+ case texts.length === 1 && [...texts.head.value].length >= rubies.length:
7716
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)([...zip(new parser_1.List([...texts.head.value].map(char => new parser_1.Data(char))), rubies)].reduce((acc, [{
7717
+ value: text = ''
7718
+ } = {}, {
7719
+ value: ruby = ''
7720
+ } = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rp', '(')), new parser_1.Data((0, dom_1.html)('rt', ruby)), new parser_1.Data((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
7407
7721
  default:
7408
- return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))]];
7722
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)(new parser_1.List([new parser_1.Data(texts.foldr(({
7723
+ value
7724
+ }, acc) => value + ' ' + acc, '').slice(0, -1)), new parser_1.Data((0, dom_1.html)('rp', '(')), new parser_1.Data((0, dom_1.html)('rt', rubies.foldr(({
7725
+ value
7726
+ }, acc) => value + ' ' + acc, '').trim())), new parser_1.Data((0, dom_1.html)('rp', ')'))])))))]);
7409
7727
  }
7410
7728
  }));
7411
7729
  const text = input => {
@@ -7415,7 +7733,7 @@ const text = input => {
7415
7733
  const {
7416
7734
  source
7417
7735
  } = context;
7418
- const acc = [''];
7736
+ const acc = new parser_1.List([new parser_1.Data('')]);
7419
7737
  let state = false;
7420
7738
  context.sequential = true;
7421
7739
  for (let {
@@ -7426,41 +7744,37 @@ const text = input => {
7426
7744
  case '&':
7427
7745
  {
7428
7746
  const result = (0, htmlentity_1.unsafehtmlentity)(input) ?? (0, source_1.txt)(input);
7429
- acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
7747
+ acc.last.value += (0, parser_1.eval)(result).head.value;
7430
7748
  continue;
7431
7749
  }
7432
7750
  default:
7433
7751
  {
7434
7752
  if (source[position].trimStart() === '') {
7435
- state ||= acc.at(-1).trimStart() !== '';
7436
- acc.push('');
7753
+ state ||= acc.last.value.trimStart() !== '';
7754
+ acc.push(new parser_1.Data(''));
7437
7755
  context.position += 1;
7438
7756
  continue;
7439
7757
  }
7440
7758
  const result = (0, source_1.txt)(input);
7441
- acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(position, context.position);
7759
+ acc.last.value += (0, parser_1.eval)(result).head?.value ?? '';
7442
7760
  continue;
7443
7761
  }
7444
7762
  }
7445
7763
  }
7446
7764
  context.sequential = false;
7447
- state ||= acc.at(-1).trimStart() !== '';
7448
- return state ? [acc] : undefined;
7765
+ state ||= acc.last.value.trimStart() !== '';
7766
+ return state ? acc : undefined;
7449
7767
  };
7450
- //function attributes(texts: string[], rubies: string[]): Record<string, string> {
7451
- // let attrs: Record<string, string> | undefined;
7452
- // for (const ss of [texts, rubies]) {
7453
- // for (let i = 0; i < ss.length; ++i) {
7454
- // if (!ss[i].includes(Command.Error)) continue;
7455
- // ss[i] = ss[i].replace(CmdRegExp.Error, '');
7456
- // attrs ??= {
7457
- // class: 'invalid',
7458
- // ...invalid('ruby', ss === texts ? 'content' : 'argument', 'Invalid HTML entity'),
7459
- // };
7460
- // }
7461
- // }
7462
- // return attrs ?? {};
7463
- //}
7768
+ function* zip(a, b) {
7769
+ const ia = a[Symbol.iterator]();
7770
+ const ib = b[Symbol.iterator]();
7771
+ while (true) {
7772
+ const ra = ia.next();
7773
+ const rb = ib.next();
7774
+ if (ra.done) break;
7775
+ yield [ra.value, rb.value];
7776
+ }
7777
+ }
7464
7778
 
7465
7779
  /***/ },
7466
7780
 
@@ -7492,14 +7806,15 @@ Object.defineProperty(exports, "__esModule", ({
7492
7806
  value: true
7493
7807
  }));
7494
7808
  exports.strong = void 0;
7809
+ const parser_1 = __webpack_require__(605);
7495
7810
  const combinator_1 = __webpack_require__(3484);
7496
7811
  const inline_1 = __webpack_require__(7973);
7497
7812
  const emphasis_1 = __webpack_require__(1354);
7498
7813
  const source_1 = __webpack_require__(8745);
7499
7814
  const visibility_1 = __webpack_require__(6364);
7500
- const array_1 = __webpack_require__(6876);
7815
+ const util_1 = __webpack_require__(4992);
7501
7816
  const dom_1 = __webpack_require__(394);
7502
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (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)('**'), false, ([, bs]) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]));
7817
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (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)('**'), false, ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
7503
7818
 
7504
7819
  /***/ },
7505
7820
 
@@ -7513,18 +7828,18 @@ Object.defineProperty(exports, "__esModule", ({
7513
7828
  value: true
7514
7829
  }));
7515
7830
  exports.template = void 0;
7831
+ const parser_1 = __webpack_require__(605);
7516
7832
  const combinator_1 = __webpack_require__(3484);
7517
7833
  const source_1 = __webpack_require__(8745);
7518
7834
  const util_1 = __webpack_require__(4992);
7519
- const array_1 = __webpack_require__(6876);
7520
7835
  const dom_1 = __webpack_require__(394);
7521
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
7836
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7522
7837
  class: 'template'
7523
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]], ([, bs], context) => bs && [[(0, dom_1.html)('span', {
7838
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7524
7839
  class: 'invalid',
7525
7840
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7526
- }, context.source.slice(context.position - context.range, context.position))]], [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7527
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 4 /* Backtrack.escbracket */])]));
7841
+ }, context.source.slice(context.position - context.range, context.position)))]), [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7842
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = new parser_1.List(), cs], context) => context.linebreak === 0 ? as.import(bs).import(cs) : (context.position -= 1, as.import(bs)), ([as, bs]) => bs && as.import(bs), [3 | 4 /* Backtrack.escbracket */])]));
7528
7843
 
7529
7844
  /***/ },
7530
7845
 
@@ -7895,7 +8210,9 @@ function* segment(source) {
7895
8210
  position
7896
8211
  } = context;
7897
8212
  const result = parser(input);
7898
- const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(position, context.position)];
8213
+ const segs = (0, parser_1.eval)(result).length > 0 ? (0, parser_1.eval)(result).foldl((acc, {
8214
+ value
8215
+ }) => void acc.push(value) || acc, []) : [source.slice(position, context.position)];
7899
8216
  for (let i = 0; i < segs.length; ++i) {
7900
8217
  const seg = segs[i];
7901
8218
  validate(seg, exports.MAX_SEGMENT_SIZE) ? yield seg : yield `${"\u0007" /* Command.Error */}Too large segment over ${exports.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`;
@@ -7999,6 +8316,7 @@ Object.defineProperty(exports, "__esModule", ({
7999
8316
  value: true
8000
8317
  }));
8001
8318
  exports.escsource = void 0;
8319
+ const parser_1 = __webpack_require__(605);
8002
8320
  const combinator_1 = __webpack_require__(3484);
8003
8321
  const text_1 = __webpack_require__(5655);
8004
8322
  const dom_1 = __webpack_require__(394);
@@ -8017,32 +8335,32 @@ const escsource = ({
8017
8335
  switch (char) {
8018
8336
  case '\r':
8019
8337
  (0, combinator_1.consume)(-1, context);
8020
- return [[]];
8338
+ return new parser_1.List();
8021
8339
  case "\u001B" /* Command.Escape */:
8022
8340
  (0, combinator_1.consume)(1, context);
8023
8341
  context.position += 1;
8024
- return [[source.slice(position + 1, position + 2)]];
8342
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8025
8343
  case '\\':
8026
8344
  switch (source[position + 1]) {
8027
8345
  case undefined:
8028
- return [[char]];
8346
+ return new parser_1.List([new parser_1.Data(char)]);
8029
8347
  case '\n':
8030
- return [[char]];
8348
+ return new parser_1.List([new parser_1.Data(char)]);
8031
8349
  default:
8032
8350
  (0, combinator_1.consume)(1, context);
8033
8351
  context.position += 1;
8034
- return [[source.slice(position, position + 2)]];
8352
+ return new parser_1.List([new parser_1.Data(source.slice(position, position + 2))]);
8035
8353
  }
8036
8354
  case '\n':
8037
8355
  context.linebreak ||= source.length - position;
8038
- return [[(0, dom_1.html)('br')]];
8356
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8039
8357
  default:
8040
- if (context.sequential) return [[char]];
8358
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8041
8359
  let i = (0, text_1.next)(source, position, delimiter);
8042
8360
  i -= position;
8043
8361
  (0, combinator_1.consume)(i - 1, context);
8044
8362
  context.position += i - 1;
8045
- return [[source.slice(position, context.position)]];
8363
+ return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8046
8364
  }
8047
8365
  };
8048
8366
  exports.escsource = escsource;
@@ -8050,7 +8368,7 @@ exports.escsource = escsource;
8050
8368
  /***/ },
8051
8369
 
8052
8370
  /***/ 702
8053
- (__unused_webpack_module, exports) {
8371
+ (__unused_webpack_module, exports, __webpack_require__) {
8054
8372
 
8055
8373
  "use strict";
8056
8374
 
@@ -8059,6 +8377,7 @@ Object.defineProperty(exports, "__esModule", ({
8059
8377
  value: true
8060
8378
  }));
8061
8379
  exports.contentline = exports.emptyline = exports.anyline = void 0;
8380
+ const parser_1 = __webpack_require__(605);
8062
8381
  const anyline = input => {
8063
8382
  const {
8064
8383
  context
@@ -8068,7 +8387,7 @@ const anyline = input => {
8068
8387
  position
8069
8388
  } = context;
8070
8389
  context.position = source.indexOf('\n', position) + 1 || source.length;
8071
- return [[]];
8390
+ return new parser_1.List();
8072
8391
  };
8073
8392
  exports.anyline = anyline;
8074
8393
  const regEmptyline = /[^\S\n]*(?:$|\n)/y;
@@ -8085,7 +8404,7 @@ const emptyline = input => {
8085
8404
  const i = regEmptyline.lastIndex;
8086
8405
  if (i === 0) return;
8087
8406
  context.position = i;
8088
- return [[]];
8407
+ return new parser_1.List();
8089
8408
  };
8090
8409
  exports.emptyline = emptyline;
8091
8410
  const regContentline = /[^\S\n]*\S[^\n]*(?:$|\n)/y;
@@ -8102,7 +8421,7 @@ const contentline = input => {
8102
8421
  const i = regContentline.lastIndex;
8103
8422
  if (i === 0) return;
8104
8423
  context.position = i;
8105
- return [[]];
8424
+ return new parser_1.List();
8106
8425
  };
8107
8426
  exports.contentline = contentline;
8108
8427
 
@@ -8118,6 +8437,7 @@ Object.defineProperty(exports, "__esModule", ({
8118
8437
  value: true
8119
8438
  }));
8120
8439
  exports.strs = exports.str = void 0;
8440
+ const parser_1 = __webpack_require__(605);
8121
8441
  const combinator_1 = __webpack_require__(3484);
8122
8442
  function str(pattern) {
8123
8443
  return (0, combinator_1.matcher)(pattern, true);
@@ -8135,7 +8455,7 @@ function strs(pattern) {
8135
8455
  acc += pattern;
8136
8456
  context.position += pattern.length;
8137
8457
  }
8138
- return [[acc]];
8458
+ return new parser_1.List([new parser_1.Data(acc)]);
8139
8459
  };
8140
8460
  }
8141
8461
  exports.strs = strs;
@@ -8152,6 +8472,7 @@ Object.defineProperty(exports, "__esModule", ({
8152
8472
  value: true
8153
8473
  }));
8154
8474
  exports.backToEmailHead = exports.backToUrlHead = exports.backToWhitespace = exports.next = exports.canSkip = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = void 0;
8475
+ const parser_1 = __webpack_require__(605);
8155
8476
  const combinator_1 = __webpack_require__(3484);
8156
8477
  const dom_1 = __webpack_require__(394);
8157
8478
  //const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
@@ -8171,24 +8492,24 @@ const text = input => {
8171
8492
  switch (char) {
8172
8493
  case '\r':
8173
8494
  (0, combinator_1.consume)(-1, context);
8174
- return [[]];
8495
+ return new parser_1.List();
8175
8496
  case "\u001B" /* Command.Escape */:
8176
8497
  case '\\':
8177
8498
  switch (source[position + 1]) {
8178
8499
  case undefined:
8179
- return [[]];
8500
+ return new parser_1.List();
8180
8501
  case '\n':
8181
- return [[]];
8502
+ return new parser_1.List();
8182
8503
  default:
8183
8504
  (0, combinator_1.consume)(1, context);
8184
8505
  context.position += 1;
8185
- return [[source.slice(position + 1, context.position)]];
8506
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, context.position))]);
8186
8507
  }
8187
8508
  case '\n':
8188
8509
  context.linebreak ||= source.length - position;
8189
- return [[(0, dom_1.html)('br')]];
8510
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8190
8511
  default:
8191
- if (context.sequential) return [[char]];
8512
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8192
8513
  exports.nonWhitespace.lastIndex = position + 1;
8193
8514
  const s = canSkip(source, position);
8194
8515
  let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
@@ -8198,7 +8519,7 @@ const text = input => {
8198
8519
  (0, combinator_1.consume)(i - 1, context);
8199
8520
  context.position += i - 1;
8200
8521
  const linestart = position === 0 || source[position - 1] === '\n';
8201
- return position === context.position || s && !linestart || lineend ? [[]] : [[source.slice(position, context.position)]];
8522
+ return position === context.position || s && !linestart || lineend ? new parser_1.List() : new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8202
8523
  }
8203
8524
  };
8204
8525
  exports.text = text;
@@ -8433,6 +8754,7 @@ Object.defineProperty(exports, "__esModule", ({
8433
8754
  value: true
8434
8755
  }));
8435
8756
  exports.unescsource = exports.delimiter = void 0;
8757
+ const parser_1 = __webpack_require__(605);
8436
8758
  const combinator_1 = __webpack_require__(3484);
8437
8759
  const text_1 = __webpack_require__(5655);
8438
8760
  const dom_1 = __webpack_require__(394);
@@ -8451,22 +8773,22 @@ const unescsource = ({
8451
8773
  switch (char) {
8452
8774
  case '\r':
8453
8775
  (0, combinator_1.consume)(-1, context);
8454
- return [[]];
8776
+ return new parser_1.List();
8455
8777
  case "\u001B" /* Command.Escape */:
8456
8778
  (0, combinator_1.consume)(1, context);
8457
8779
  context.position += 1;
8458
- return [[source.slice(position + 1, position + 2)]];
8780
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8459
8781
  case '\n':
8460
8782
  context.linebreak ||= source.length - position;
8461
- return [[(0, dom_1.html)('br')]];
8783
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8462
8784
  default:
8463
- if (context.sequential) return [[char]];
8785
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8464
8786
  text_1.nonWhitespace.lastIndex = position + 1;
8465
8787
  let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
8466
8788
  i -= position;
8467
8789
  (0, combinator_1.consume)(i - 1, context);
8468
8790
  context.position += i - 1;
8469
- return [[source.slice(position, context.position)]];
8791
+ return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8470
8792
  }
8471
8793
  };
8472
8794
  exports.unescsource = unescsource;
@@ -8482,25 +8804,31 @@ exports.unescsource = unescsource;
8482
8804
  Object.defineProperty(exports, "__esModule", ({
8483
8805
  value: true
8484
8806
  }));
8485
- exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = void 0;
8807
+ exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
8486
8808
  const alias_1 = __webpack_require__(5413);
8487
8809
  const parser_1 = __webpack_require__(605);
8488
8810
  const dom_1 = __webpack_require__(394);
8811
+ function* unwrap(nodes) {
8812
+ for (const node of nodes) {
8813
+ yield node.value;
8814
+ }
8815
+ }
8816
+ exports.unwrap = unwrap;
8489
8817
  function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
8490
- const acc = [];
8818
+ const acc = new parser_1.List();
8491
8819
  if (prefix > 0) {
8492
- acc.push(symbol[0].repeat(prefix));
8820
+ acc.push(new parser_1.Data(symbol[0].repeat(prefix)));
8493
8821
  }
8494
- acc.push(...nodes);
8822
+ acc.import(nodes);
8495
8823
  if (postfix > 0) {
8496
8824
  const {
8497
8825
  source,
8498
8826
  position
8499
8827
  } = context;
8500
- acc.push(source.slice(position, position + postfix));
8828
+ acc.push(new parser_1.Data(source.slice(position, position + postfix)));
8501
8829
  context.position += postfix;
8502
8830
  }
8503
- return [acc];
8831
+ return acc;
8504
8832
  }) {
8505
8833
  return (0, parser_1.failsafe)(input => {
8506
8834
  const {
@@ -8510,7 +8838,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8510
8838
  source,
8511
8839
  position
8512
8840
  } = context;
8513
- let nodes = [];
8841
+ let nodes = new parser_1.List();
8514
8842
  let i = symbol.length;
8515
8843
  while (source[context.position + i] === source[context.position]) ++i;
8516
8844
  context.position += i;
@@ -8527,7 +8855,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8527
8855
  context.buffer = buf;
8528
8856
  if (result === undefined) break;
8529
8857
  nodes = (0, parser_1.eval)(result);
8530
- switch (nodes.at(-1)) {
8858
+ switch (nodes.last?.value) {
8531
8859
  case "\u0018" /* Command.Cancel */:
8532
8860
  nodes.pop();
8533
8861
  state = false;
@@ -8583,8 +8911,7 @@ function unmarkInvalid(el) {
8583
8911
  exports.unmarkInvalid = unmarkInvalid;
8584
8912
  function stringify(nodes) {
8585
8913
  let acc = '';
8586
- for (let i = 0; i < nodes.length; ++i) {
8587
- const node = nodes[i];
8914
+ for (const node of nodes) {
8588
8915
  if (typeof node === 'string') {
8589
8916
  acc += node;
8590
8917
  } else {
@@ -8612,7 +8939,6 @@ const parser_1 = __webpack_require__(605);
8612
8939
  const combinator_1 = __webpack_require__(3484);
8613
8940
  const htmlentity_1 = __webpack_require__(470);
8614
8941
  const normalize_1 = __webpack_require__(4490);
8615
- const array_1 = __webpack_require__(6876);
8616
8942
  var blank;
8617
8943
  (function (blank) {
8618
8944
  blank.line = new RegExp(
@@ -8657,7 +8983,7 @@ function isTightStart(input, except) {
8657
8983
  return source[position + 1]?.trimStart() !== '';
8658
8984
  case '&':
8659
8985
  switch (true) {
8660
- case source.length - position > 2 && source[position + 1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(input))?.[0]?.trimStart() === '':
8986
+ case source.length - position > 2 && source[position + 1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(input))?.head?.value.trimStart() === '':
8661
8987
  context.position = position;
8662
8988
  return false;
8663
8989
  }
@@ -8676,8 +9002,9 @@ function isTightStart(input, except) {
8676
9002
  }
8677
9003
  function isLooseNodeStart(nodes) {
8678
9004
  if (nodes.length === 0) return true;
8679
- for (let i = 0; i < nodes.length; ++i) {
8680
- const node = nodes[i];
9005
+ for (const {
9006
+ value: node
9007
+ } of nodes) {
8681
9008
  if (isVisible(node)) return true;
8682
9009
  if (typeof node === 'object' && node.tagName === 'BR') break;
8683
9010
  }
@@ -8686,7 +9013,7 @@ function isLooseNodeStart(nodes) {
8686
9013
  exports.isLooseNodeStart = isLooseNodeStart;
8687
9014
  function isTightNodeStart(nodes) {
8688
9015
  if (nodes.length === 0) return true;
8689
- return isVisible(nodes[0], 0);
9016
+ return isVisible(nodes.head.value, 0);
8690
9017
  }
8691
9018
  exports.isTightNodeStart = isTightNodeStart;
8692
9019
  //export function isTightNodeEnd(nodes: readonly (HTMLElement | string)[]): boolean {
@@ -8734,7 +9061,7 @@ function trimBlankStart(parser) {
8734
9061
  reg.lastIndex = position;
8735
9062
  reg.test(source);
8736
9063
  context.position = reg.lastIndex || position;
8737
- return context.position === source.length ? [[]] : parser(input);
9064
+ return context.position === source.length ? new parser_1.List() : parser(input);
8738
9065
  });
8739
9066
  }
8740
9067
  exports.trimBlankStart = trimBlankStart;
@@ -8762,18 +9089,19 @@ exports.trimBlankEnd = trimBlankEnd;
8762
9089
  // return nodes;
8763
9090
  //}
8764
9091
  function trimBlankNodeEnd(nodes) {
8765
- const skip = nodes.length > 0 && typeof nodes.at(-1) === 'object' && nodes.at(-1)['className'] === 'indexer' ? [nodes.pop()] : [];
8766
- for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes.at(-1), -1);) {
8767
- if (typeof node === 'string') {
8768
- const str = node.trimEnd();
9092
+ const skip = nodes.length > 0 && typeof nodes.last?.value === 'object' && nodes.last.value.className === 'indexer' ? nodes.pop() : undefined;
9093
+ for (let node = nodes.last; nodes.length > 0 && !isVisible((node = nodes.last).value, -1);) {
9094
+ if (typeof node.value === 'string') {
9095
+ const str = node.value.trimEnd();
8769
9096
  if (str.length > 0) {
8770
- nodes[nodes.length - 1] = str;
9097
+ node.value = str;
8771
9098
  break;
8772
9099
  }
8773
9100
  }
8774
9101
  nodes.pop();
8775
9102
  }
8776
- return (0, array_1.push)(nodes, skip);
9103
+ skip && nodes.push(skip);
9104
+ return nodes;
8777
9105
  }
8778
9106
  exports.trimBlankNodeEnd = trimBlankNodeEnd;
8779
9107
 
@@ -9415,7 +9743,7 @@ function unlink(h) {
9415
9743
  /***/ 394
9416
9744
  (module) {
9417
9745
 
9418
- /*! typed-dom v0.0.349 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9746
+ /*! typed-dom v0.0.351 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9419
9747
  (function webpackUniversalModuleDefinition(root, factory) {
9420
9748
  if(true)
9421
9749
  module.exports = factory();
@@ -9426,8 +9754,8 @@ return /******/ (() => { // webpackBootstrap
9426
9754
  /******/ "use strict";
9427
9755
  /******/ var __webpack_modules__ = ({
9428
9756
 
9429
- /***/ 5413:
9430
- /***/ ((__unused_webpack_module, exports) => {
9757
+ /***/ 413
9758
+ (__unused_webpack_module, exports) {
9431
9759
 
9432
9760
 
9433
9761
 
@@ -9447,10 +9775,10 @@ exports.ObjectCreate = Object.create;
9447
9775
  exports.ObjectGetPrototypeOf = Object.getPrototypeOf;
9448
9776
  exports.ObjectSetPrototypeOf = Object.setPrototypeOf;
9449
9777
 
9450
- /***/ }),
9778
+ /***/ },
9451
9779
 
9452
- /***/ 1934:
9453
- /***/ ((__unused_webpack_module, exports) => {
9780
+ /***/ 934
9781
+ (__unused_webpack_module, exports) {
9454
9782
 
9455
9783
 
9456
9784
 
@@ -9463,10 +9791,10 @@ function equal(a, b) {
9463
9791
  }
9464
9792
  exports.equal = equal;
9465
9793
 
9466
- /***/ }),
9794
+ /***/ },
9467
9795
 
9468
- /***/ 6925:
9469
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9796
+ /***/ 925
9797
+ (__unused_webpack_module, exports, __nested_webpack_require_3115__) {
9470
9798
 
9471
9799
 
9472
9800
 
@@ -9474,8 +9802,8 @@ Object.defineProperty(exports, "__esModule", ({
9474
9802
  value: true
9475
9803
  }));
9476
9804
  exports.reduce = exports.memoize = void 0;
9477
- const alias_1 = __webpack_require__(5413);
9478
- const compare_1 = __webpack_require__(1934);
9805
+ const alias_1 = __nested_webpack_require_3115__(413);
9806
+ const compare_1 = __nested_webpack_require_3115__(934);
9479
9807
  function memoize(f, identify, memory) {
9480
9808
  if (typeof identify === 'object') {
9481
9809
  memory = identify;
@@ -9540,10 +9868,10 @@ function reduce(f, identify = (...as) => as[0]) {
9540
9868
  }
9541
9869
  exports.reduce = reduce;
9542
9870
 
9543
- /***/ }),
9871
+ /***/ },
9544
9872
 
9545
- /***/ 5761:
9546
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9873
+ /***/ 761
9874
+ (__unused_webpack_module, exports, __nested_webpack_require_4963__) {
9547
9875
 
9548
9876
 
9549
9877
 
@@ -9551,8 +9879,8 @@ Object.defineProperty(exports, "__esModule", ({
9551
9879
  value: true
9552
9880
  }));
9553
9881
  exports.defrag = exports.prepend = exports.append = exports.isChildren = exports.define = exports.element = exports.text = exports.math = exports.svg = exports.html = exports.frag = exports.shadow = void 0;
9554
- const alias_1 = __webpack_require__(5413);
9555
- const memoize_1 = __webpack_require__(6925);
9882
+ const alias_1 = __nested_webpack_require_4963__(413);
9883
+ const memoize_1 = __nested_webpack_require_4963__(925);
9556
9884
  var caches;
9557
9885
  (function (caches) {
9558
9886
  // Closed only.
@@ -9674,11 +10002,6 @@ function defineChildren(node, children) {
9674
10002
  if (children === undefined) return node;
9675
10003
  if (typeof children === 'string') {
9676
10004
  node.textContent = children;
9677
- } else if (((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) && !node.firstChild) {
9678
- for (let i = 0; i < children.length; ++i) {
9679
- const child = children[i];
9680
- typeof child === 'object' ? node.appendChild(child) : node.append(child);
9681
- }
9682
10005
  } else {
9683
10006
  node.replaceChildren(...children);
9684
10007
  }
@@ -9692,11 +10015,6 @@ function append(node, children) {
9692
10015
  if (children === undefined) return node;
9693
10016
  if (typeof children === 'string') {
9694
10017
  node.append(children);
9695
- } else if ((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) {
9696
- for (let i = 0; i < children.length; ++i) {
9697
- const child = children[i];
9698
- typeof child === 'object' ? node.appendChild(child) : node.append(child);
9699
- }
9700
10018
  } else {
9701
10019
  for (const child of children) {
9702
10020
  typeof child === 'object' ? node.appendChild(child) : node.append(child);
@@ -9709,11 +10027,6 @@ function prepend(node, children) {
9709
10027
  if (children === undefined) return node;
9710
10028
  if (typeof children === 'string') {
9711
10029
  node.prepend(children);
9712
- } else if ((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) {
9713
- for (let i = 0; i < children.length; ++i) {
9714
- const child = children[i];
9715
- typeof child === 'object' ? node.insertBefore(child, null) : node.prepend(child);
9716
- }
9717
10030
  } else {
9718
10031
  for (const child of children) {
9719
10032
  typeof child === 'object' ? node.insertBefore(child, null) : node.prepend(child);
@@ -9722,24 +10035,22 @@ function prepend(node, children) {
9722
10035
  return node;
9723
10036
  }
9724
10037
  exports.prepend = prepend;
9725
- function defrag(nodes) {
9726
- const acc = [];
9727
- let appendable = false;
9728
- for (let i = 0, len = nodes.length; i < len; ++i) {
9729
- const node = nodes[i];
9730
- if (typeof node === 'object') {
9731
- acc.push(node);
9732
- appendable = false;
9733
- } else if (node !== '') {
9734
- appendable ? acc[acc.length - 1] += node : acc.push(node);
9735
- appendable = true;
10038
+ function* defrag(nodes) {
10039
+ let acc = '';
10040
+ for (const node of nodes) {
10041
+ if (typeof node === 'string') {
10042
+ acc += node;
10043
+ } else {
10044
+ if (acc) yield acc;
10045
+ acc = '';
10046
+ yield node;
9736
10047
  }
9737
10048
  }
9738
- return acc;
10049
+ if (acc) yield acc;
9739
10050
  }
9740
10051
  exports.defrag = defrag;
9741
10052
 
9742
- /***/ })
10053
+ /***/ }
9743
10054
 
9744
10055
  /******/ });
9745
10056
  /************************************************************************/
@@ -9747,7 +10058,7 @@ exports.defrag = defrag;
9747
10058
  /******/ var __webpack_module_cache__ = {};
9748
10059
  /******/
9749
10060
  /******/ // The require function
9750
- /******/ function __nested_webpack_require_12534__(moduleId) {
10061
+ /******/ function __nested_webpack_require_11558__(moduleId) {
9751
10062
  /******/ // Check if module is in cache
9752
10063
  /******/ var cachedModule = __webpack_module_cache__[moduleId];
9753
10064
  /******/ if (cachedModule !== undefined) {
@@ -9761,7 +10072,7 @@ exports.defrag = defrag;
9761
10072
  /******/ };
9762
10073
  /******/
9763
10074
  /******/ // Execute the module function
9764
- /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_12534__);
10075
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11558__);
9765
10076
  /******/
9766
10077
  /******/ // Return the exports of the module
9767
10078
  /******/ return module.exports;
@@ -9772,7 +10083,7 @@ exports.defrag = defrag;
9772
10083
  /******/ // startup
9773
10084
  /******/ // Load entry module and return exports
9774
10085
  /******/ // This entry module is referenced by other modules so it can't be inlined
9775
- /******/ var __nested_webpack_exports__ = __nested_webpack_require_12534__(5761);
10086
+ /******/ var __nested_webpack_exports__ = __nested_webpack_require_11558__(761);
9776
10087
  /******/
9777
10088
  /******/ return __nested_webpack_exports__;
9778
10089
  /******/ })()
@@ -9784,7 +10095,7 @@ exports.defrag = defrag;
9784
10095
  /***/ 2282
9785
10096
  (module) {
9786
10097
 
9787
- /*! typed-dom v0.0.349 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
10098
+ /*! typed-dom v0.0.351 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9788
10099
  (function webpackUniversalModuleDefinition(root, factory) {
9789
10100
  if(true)
9790
10101
  module.exports = factory();
@@ -9794,7 +10105,7 @@ exports.defrag = defrag;
9794
10105
  return /******/ (() => { // webpackBootstrap
9795
10106
  /******/ "use strict";
9796
10107
  var __nested_webpack_exports__ = {};
9797
- // This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
10108
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
9798
10109
  (() => {
9799
10110
  var exports = __nested_webpack_exports__;
9800
10111