securemark 0.295.1 → 0.295.3

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 (171) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/design.md +4 -3
  3. package/dist/index.js +537 -462
  4. package/markdown.d.ts +13 -28
  5. package/package.json +1 -1
  6. package/src/combinator/control/constraint/block.test.ts +6 -8
  7. package/src/combinator/control/constraint/contract.ts +7 -7
  8. package/src/combinator/control/constraint/line.test.ts +7 -9
  9. package/src/combinator/control/constraint/line.ts +0 -1
  10. package/src/combinator/control/manipulation/clear.ts +2 -2
  11. package/src/combinator/control/manipulation/convert.ts +3 -3
  12. package/src/combinator/control/manipulation/duplicate.ts +4 -4
  13. package/src/combinator/control/manipulation/fallback.ts +2 -2
  14. package/src/combinator/control/manipulation/fence.ts +3 -3
  15. package/src/combinator/control/manipulation/indent.test.ts +20 -22
  16. package/src/combinator/control/manipulation/indent.ts +2 -2
  17. package/src/combinator/control/manipulation/recovery.ts +3 -3
  18. package/src/combinator/control/manipulation/reverse.ts +2 -2
  19. package/src/combinator/control/manipulation/scope.ts +2 -4
  20. package/src/combinator/control/manipulation/surround.ts +32 -32
  21. package/src/combinator/control/monad/bind.ts +6 -6
  22. package/src/combinator/control/monad/fmap.ts +6 -6
  23. package/src/combinator/data/data.ts +2 -2
  24. package/src/combinator/data/{parser/context/delimiter.ts → delimiter.ts} +4 -4
  25. package/src/combinator/data/parser/context.test.ts +12 -11
  26. package/src/combinator/data/parser/context.ts +13 -14
  27. package/src/combinator/data/parser/inits.ts +5 -5
  28. package/src/combinator/data/parser/sequence.test.ts +12 -13
  29. package/src/combinator/data/parser/sequence.ts +5 -5
  30. package/src/combinator/data/parser/some.test.ts +15 -16
  31. package/src/combinator/data/parser/some.ts +5 -6
  32. package/src/combinator/data/parser/subsequence.test.ts +16 -17
  33. package/src/combinator/data/parser/subsequence.ts +3 -3
  34. package/src/combinator/data/parser/tails.ts +3 -3
  35. package/src/combinator/data/parser/union.test.ts +12 -13
  36. package/src/combinator/data/parser/union.ts +3 -3
  37. package/src/combinator/data/parser.ts +55 -32
  38. package/src/debug.test.ts +5 -3
  39. package/src/parser/api/bind.ts +8 -6
  40. package/src/parser/api/body.test.ts +0 -1
  41. package/src/parser/api/header.test.ts +0 -4
  42. package/src/parser/api/header.ts +4 -4
  43. package/src/parser/api/normalize.ts +2 -1
  44. package/src/parser/api/parse.test.ts +8 -7
  45. package/src/parser/api/parse.ts +9 -8
  46. package/src/parser/autolink.test.ts +18 -18
  47. package/src/parser/block/blockquote.test.ts +79 -79
  48. package/src/parser/block/blockquote.ts +5 -5
  49. package/src/parser/block/codeblock.test.ts +57 -57
  50. package/src/parser/block/codeblock.ts +3 -3
  51. package/src/parser/block/dlist.test.ts +57 -57
  52. package/src/parser/block/dlist.ts +6 -6
  53. package/src/parser/block/extension/aside.test.ts +9 -9
  54. package/src/parser/block/extension/aside.ts +5 -5
  55. package/src/parser/block/extension/example.test.ts +19 -19
  56. package/src/parser/block/extension/example.ts +6 -6
  57. package/src/parser/block/extension/fig.test.ts +36 -36
  58. package/src/parser/block/extension/figbase.test.ts +16 -16
  59. package/src/parser/block/extension/figbase.ts +2 -2
  60. package/src/parser/block/extension/figure.test.ts +63 -63
  61. package/src/parser/block/extension/figure.ts +3 -3
  62. package/src/parser/block/extension/message.test.ts +14 -14
  63. package/src/parser/block/extension/message.ts +5 -5
  64. package/src/parser/block/extension/placeholder.test.ts +13 -13
  65. package/src/parser/block/extension/placeholder.ts +2 -2
  66. package/src/parser/block/extension/table.test.ts +76 -76
  67. package/src/parser/block/extension/table.ts +14 -14
  68. package/src/parser/block/extension.test.ts +24 -24
  69. package/src/parser/block/heading.test.ts +59 -59
  70. package/src/parser/block/heading.ts +7 -7
  71. package/src/parser/block/ilist.test.ts +8 -12
  72. package/src/parser/block/ilist.ts +6 -6
  73. package/src/parser/block/mathblock.test.ts +32 -32
  74. package/src/parser/block/mathblock.ts +3 -3
  75. package/src/parser/block/mediablock.ts +3 -3
  76. package/src/parser/block/olist.test.ts +103 -103
  77. package/src/parser/block/olist.ts +5 -5
  78. package/src/parser/block/pagebreak.test.ts +16 -16
  79. package/src/parser/block/pagebreak.ts +2 -2
  80. package/src/parser/block/paragraph.test.ts +58 -58
  81. package/src/parser/block/paragraph.ts +2 -2
  82. package/src/parser/block/reply/cite.test.ts +40 -40
  83. package/src/parser/block/reply/cite.ts +6 -6
  84. package/src/parser/block/reply/quote.test.ts +51 -51
  85. package/src/parser/block/reply/quote.ts +3 -3
  86. package/src/parser/block/reply.test.ts +20 -20
  87. package/src/parser/block/reply.ts +3 -3
  88. package/src/parser/block/sidefence.test.ts +48 -48
  89. package/src/parser/block/sidefence.ts +4 -4
  90. package/src/parser/block/table.test.ts +50 -50
  91. package/src/parser/block/table.ts +12 -12
  92. package/src/parser/block/ulist.test.ts +53 -53
  93. package/src/parser/block/ulist.ts +6 -6
  94. package/src/parser/block.ts +6 -4
  95. package/src/parser/context.ts +39 -0
  96. package/src/parser/header.test.ts +19 -23
  97. package/src/parser/header.ts +9 -9
  98. package/src/parser/inline/annotation.test.ts +43 -43
  99. package/src/parser/inline/annotation.ts +14 -4
  100. package/src/parser/inline/autolink/account.test.ts +33 -33
  101. package/src/parser/inline/autolink/account.ts +11 -11
  102. package/src/parser/inline/autolink/anchor.test.ts +22 -22
  103. package/src/parser/inline/autolink/anchor.ts +5 -5
  104. package/src/parser/inline/autolink/channel.test.ts +15 -15
  105. package/src/parser/inline/autolink/email.test.ts +37 -37
  106. package/src/parser/inline/autolink/email.ts +3 -3
  107. package/src/parser/inline/autolink/hashnum.test.ts +33 -33
  108. package/src/parser/inline/autolink/hashnum.ts +7 -6
  109. package/src/parser/inline/autolink/hashtag.test.ts +60 -60
  110. package/src/parser/inline/autolink/hashtag.ts +5 -5
  111. package/src/parser/inline/autolink/url.test.ts +75 -75
  112. package/src/parser/inline/autolink/url.ts +4 -4
  113. package/src/parser/inline/bracket.test.ts +70 -70
  114. package/src/parser/inline/bracket.ts +45 -30
  115. package/src/parser/inline/code.test.ts +31 -31
  116. package/src/parser/inline/code.ts +4 -4
  117. package/src/parser/inline/deletion.test.ts +28 -28
  118. package/src/parser/inline/deletion.ts +4 -4
  119. package/src/parser/inline/emphasis.test.ts +40 -40
  120. package/src/parser/inline/emphasis.ts +3 -3
  121. package/src/parser/inline/emstrong.test.ts +101 -101
  122. package/src/parser/inline/emstrong.ts +23 -23
  123. package/src/parser/inline/extension/index.test.ts +92 -92
  124. package/src/parser/inline/extension/index.ts +5 -5
  125. package/src/parser/inline/extension/indexee.ts +5 -5
  126. package/src/parser/inline/extension/indexer.test.ts +24 -24
  127. package/src/parser/inline/extension/indexer.ts +2 -2
  128. package/src/parser/inline/extension/label.test.ts +33 -33
  129. package/src/parser/inline/extension/label.ts +2 -2
  130. package/src/parser/inline/extension/placeholder.test.ts +43 -43
  131. package/src/parser/inline/extension/placeholder.ts +4 -4
  132. package/src/parser/inline/html.test.ts +108 -108
  133. package/src/parser/inline/html.ts +10 -10
  134. package/src/parser/inline/htmlentity.test.ts +38 -38
  135. package/src/parser/inline/htmlentity.ts +5 -5
  136. package/src/parser/inline/insertion.test.ts +28 -28
  137. package/src/parser/inline/insertion.ts +4 -4
  138. package/src/parser/inline/italic.test.ts +55 -55
  139. package/src/parser/inline/italic.ts +4 -4
  140. package/src/parser/inline/link.test.ts +186 -187
  141. package/src/parser/inline/link.ts +16 -17
  142. package/src/parser/inline/mark.test.ts +31 -31
  143. package/src/parser/inline/mark.ts +5 -5
  144. package/src/parser/inline/math.test.ts +132 -132
  145. package/src/parser/inline/math.ts +2 -2
  146. package/src/parser/inline/media.test.ts +91 -91
  147. package/src/parser/inline/media.ts +15 -15
  148. package/src/parser/inline/reference.test.ts +109 -109
  149. package/src/parser/inline/reference.ts +15 -54
  150. package/src/parser/inline/remark.test.ts +50 -50
  151. package/src/parser/inline/remark.ts +5 -5
  152. package/src/parser/inline/ruby.test.ts +45 -45
  153. package/src/parser/inline/ruby.ts +17 -17
  154. package/src/parser/inline/shortmedia.test.ts +10 -10
  155. package/src/parser/inline/strong.test.ts +37 -37
  156. package/src/parser/inline/strong.ts +3 -3
  157. package/src/parser/inline/template.test.ts +23 -23
  158. package/src/parser/inline/template.ts +5 -5
  159. package/src/parser/inline.test.ts +224 -223
  160. package/src/parser/segment.ts +2 -2
  161. package/src/parser/source/escapable.test.ts +24 -24
  162. package/src/parser/source/escapable.ts +8 -8
  163. package/src/parser/source/line.test.ts +18 -18
  164. package/src/parser/source/str.ts +2 -2
  165. package/src/parser/source/text.test.ts +85 -85
  166. package/src/parser/source/text.ts +6 -6
  167. package/src/parser/source/unescapable.test.ts +24 -24
  168. package/src/parser/source/unescapable.ts +5 -5
  169. package/src/parser/util.ts +10 -11
  170. package/src/parser/visibility.ts +8 -9
  171. package/src/util/quote.ts +2 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.295.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.295.3 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"));
@@ -2665,7 +2665,6 @@ function line(parser) {
2665
2665
  } = context;
2666
2666
  if (position === source.length) return;
2667
2667
  const line = firstline(source, position);
2668
- context.offset ??= 0;
2669
2668
  context.offset += position;
2670
2669
  const result = parser((0, parser_1.input)(line, context));
2671
2670
  context.position += position;
@@ -2764,7 +2763,7 @@ exports.dup = void 0;
2764
2763
  const parser_1 = __webpack_require__(605);
2765
2764
  const fmap_1 = __webpack_require__(2705);
2766
2765
  function dup(parser) {
2767
- return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.Data(nodes)]));
2766
+ return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.Node(nodes)]));
2768
2767
  }
2769
2768
  exports.dup = dup;
2770
2769
 
@@ -2849,7 +2848,7 @@ function fence(opener, limit, separation = true) {
2849
2848
  }
2850
2849
  context.position += line.length;
2851
2850
  }
2852
- return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Data(str)));
2851
+ return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Node(str)));
2853
2852
  });
2854
2853
  }
2855
2854
  exports.fence = fence;
@@ -2888,7 +2887,7 @@ function indent(opener, parser = false, separation = false) {
2888
2887
  position
2889
2888
  } = context;
2890
2889
  context.position = source.length;
2891
- return new parser_1.List([new parser_1.Data(source.slice(position))]);
2890
+ return new parser_1.List([new parser_1.Node(source.slice(position))]);
2892
2891
  }))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context))));
2893
2892
  }
2894
2893
  exports.indent = indent;
@@ -3036,7 +3035,6 @@ function focus(scope, parser, slice = true) {
3036
3035
  context.position += result && context.position === position ? range : 0;
3037
3036
  return result;
3038
3037
  }
3039
- context.offset ??= 0;
3040
3038
  context.offset += position;
3041
3039
  const result = parser((0, parser_1.input)(src, context));
3042
3040
  context.position += position;
@@ -3069,7 +3067,6 @@ function rewrite(scope, parser, slice = true) {
3069
3067
  return res2;
3070
3068
  }
3071
3069
  const src = source.slice(position, context.position);
3072
- context.offset ??= 0;
3073
3070
  context.offset += position;
3074
3071
  const res2 = parser((0, parser_1.input)(src, context));
3075
3072
  context.position += position;
@@ -3169,8 +3166,8 @@ exports.close = close;
3169
3166
  const commandsize = 2;
3170
3167
  function isBacktrack(context, backtrack, position = context.position, length = 1) {
3171
3168
  const {
3172
- backtracks = {},
3173
- offset = 0
3169
+ backtracks,
3170
+ offset
3174
3171
  } = context;
3175
3172
  for (let i = 0; i < length; ++i) {
3176
3173
  if (backtracks[position + i + offset] & backtrack >>> commandsize) return true;
@@ -3182,8 +3179,8 @@ function setBacktrack(context, backtrack, position, length = 1) {
3182
3179
  // バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
3183
3180
 
3184
3181
  const {
3185
- backtracks = {},
3186
- offset = 0
3182
+ backtracks,
3183
+ offset
3187
3184
  } = context;
3188
3185
  for (let i = 0; i < length; ++i) {
3189
3186
  backtracks[position + i + offset] |= backtrack >>> commandsize;
@@ -3408,6 +3405,162 @@ exports.List = List;
3408
3405
 
3409
3406
  /***/ },
3410
3407
 
3408
+ /***/ 385
3409
+ (__unused_webpack_module, exports, __webpack_require__) {
3410
+
3411
+ "use strict";
3412
+
3413
+
3414
+ Object.defineProperty(exports, "__esModule", ({
3415
+ value: true
3416
+ }));
3417
+ exports.Delimiters = void 0;
3418
+ const combinator_1 = __webpack_require__(3484);
3419
+ class Delimiters {
3420
+ constructor() {
3421
+ this.tree = {};
3422
+ this.map = new Map();
3423
+ this.delimiters = [];
3424
+ this.stack = [];
3425
+ this.states = [];
3426
+ }
3427
+ // 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
3428
+ static signature(pattern) {
3429
+ switch (typeof pattern) {
3430
+ case 'undefined':
3431
+ return 1 << 7;
3432
+ case 'string':
3433
+ if (pattern.length === 1) {
3434
+ const code = pattern.charCodeAt(0);
3435
+ return code;
3436
+ }
3437
+ return `s:${pattern}`;
3438
+ case 'object':
3439
+ return `r/${pattern.source}`;
3440
+ }
3441
+ }
3442
+ static matcher(pattern) {
3443
+ switch (typeof pattern) {
3444
+ case 'undefined':
3445
+ return () => undefined;
3446
+ case 'string':
3447
+ case 'object':
3448
+ const match = (0, combinator_1.matcher)(pattern, false);
3449
+ return input => match(input) !== undefined || undefined;
3450
+ }
3451
+ }
3452
+ registry(signature) {
3453
+ if (typeof signature === 'number') {
3454
+ return this.tree[signature] ??= [];
3455
+ } else {
3456
+ const ds = this.map.get(signature);
3457
+ if (ds) return ds;
3458
+ const blank = [];
3459
+ this.map.set(signature, blank);
3460
+ return blank;
3461
+ }
3462
+ }
3463
+ push(delims) {
3464
+ const {
3465
+ delimiters,
3466
+ stack
3467
+ } = this;
3468
+ // シグネチャ数以下
3469
+
3470
+ for (let i = 0; i < delims.length; ++i) {
3471
+ const {
3472
+ signature,
3473
+ matcher,
3474
+ precedence
3475
+ } = delims[i];
3476
+ const memory = this.registry(signature);
3477
+ const index = memory[0]?.index ?? delimiters.length;
3478
+ if (memory.length === 0) {
3479
+ const delimiter = {
3480
+ memory,
3481
+ index,
3482
+ signature,
3483
+ matcher,
3484
+ precedence,
3485
+ state: true
3486
+ };
3487
+ delimiters[index] = delimiter;
3488
+ memory.push(delimiter);
3489
+ stack.push(index);
3490
+ } else {
3491
+ stack.push(-1);
3492
+ }
3493
+ // 現状各優先順位は固定
3494
+ }
3495
+ }
3496
+ pop(count) {
3497
+ const {
3498
+ delimiters,
3499
+ stack
3500
+ } = this;
3501
+ for (let i = 0; i < count; ++i) {
3502
+ const index = stack.pop();
3503
+ if (index === -1) continue;
3504
+ const {
3505
+ memory
3506
+ } = delimiters[index];
3507
+ if (memory.length === 1) {
3508
+ memory.pop();
3509
+ delimiters.pop();
3510
+ } else {
3511
+ memory.pop();
3512
+ delimiters[index] = memory.at(-1);
3513
+ }
3514
+ }
3515
+ }
3516
+ shift(precedence) {
3517
+ const {
3518
+ delimiters
3519
+ } = this;
3520
+ const indexes = [];
3521
+ for (let i = delimiters.length; i--;) {
3522
+ const delimiter = delimiters[i];
3523
+ if (delimiter.precedence >= precedence || !delimiter.state) continue;
3524
+ delimiter.state = false;
3525
+ indexes.push(i);
3526
+ }
3527
+ this.states.push(indexes);
3528
+ }
3529
+ unshift() {
3530
+ const {
3531
+ delimiters
3532
+ } = this;
3533
+ const indexes = this.states.pop();
3534
+ for (let i = indexes.length; i--;) {
3535
+ delimiters[indexes[i]].state = true;
3536
+ }
3537
+ }
3538
+ match(input) {
3539
+ const {
3540
+ precedence
3541
+ } = input.context;
3542
+ const {
3543
+ delimiters
3544
+ } = this;
3545
+ for (let i = delimiters.length; i--;) {
3546
+ const delimiter = delimiters[i];
3547
+ if (delimiter.precedence <= precedence || !delimiter.state) continue;
3548
+ switch (delimiter.matcher(input)) {
3549
+ case true:
3550
+ return true;
3551
+ case false:
3552
+ return false;
3553
+ default:
3554
+ continue;
3555
+ }
3556
+ }
3557
+ return false;
3558
+ }
3559
+ }
3560
+ exports.Delimiters = Delimiters;
3561
+
3562
+ /***/ },
3563
+
3411
3564
  /***/ 605
3412
3565
  (__unused_webpack_module, exports, __webpack_require__) {
3413
3566
 
@@ -3417,7 +3570,7 @@ exports.List = List;
3417
3570
  Object.defineProperty(exports, "__esModule", ({
3418
3571
  value: true
3419
3572
  }));
3420
- exports.failsafe = exports.subinput = exports.input = exports.Data = exports.List = void 0;
3573
+ exports.failsafe = exports.subinput = exports.input = exports.Context = exports.Node = exports.List = void 0;
3421
3574
  const data_1 = __webpack_require__(3602);
3422
3575
  Object.defineProperty(exports, "List", ({
3423
3576
  enumerable: true,
@@ -3425,21 +3578,45 @@ Object.defineProperty(exports, "List", ({
3425
3578
  return data_1.List;
3426
3579
  }
3427
3580
  }));
3428
- class Data {
3581
+ const delimiter_1 = __webpack_require__(385);
3582
+ class Node {
3429
3583
  constructor(value) {
3430
3584
  this.value = value;
3431
3585
  this.next = undefined;
3432
3586
  this.prev = undefined;
3433
3587
  }
3434
3588
  }
3435
- exports.Data = Data;
3589
+ exports.Node = Node;
3590
+ class Context {
3591
+ constructor({
3592
+ source,
3593
+ position,
3594
+ resources,
3595
+ delimiters,
3596
+ precedence,
3597
+ state,
3598
+ linebreak,
3599
+ range,
3600
+ offset,
3601
+ backtracks
3602
+ } = {}) {
3603
+ this.source = source ?? '';
3604
+ this.position = position ?? 0;
3605
+ this.resources = resources;
3606
+ this.precedence = precedence ?? 0;
3607
+ this.delimiters = delimiters ?? new delimiter_1.Delimiters();
3608
+ this.state = state ?? 0;
3609
+ this.linebreak = linebreak ?? 0;
3610
+ this.range = range ?? 0;
3611
+ this.offset = offset ?? 0;
3612
+ this.backtracks = backtracks ?? {};
3613
+ }
3614
+ }
3615
+ exports.Context = Context;
3436
3616
  function input(source, context) {
3437
- // @ts-expect-error
3438
3617
  context.source = source;
3439
- // @ts-expect-error
3440
3618
  context.position = 0;
3441
3619
  return {
3442
- // @ts-expect-error
3443
3620
  context
3444
3621
  };
3445
3622
  }
@@ -3450,7 +3627,7 @@ function subinput(source, context) {
3450
3627
  ...context,
3451
3628
  source,
3452
3629
  position: 0,
3453
- offset: undefined,
3630
+ offset: 0,
3454
3631
  backtracks: {}
3455
3632
  }
3456
3633
  };
@@ -3476,8 +3653,8 @@ Object.defineProperty(exports, "__esModule", ({
3476
3653
  value: true
3477
3654
  }));
3478
3655
  exports.matcher = exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
3479
- const alias_1 = __webpack_require__(5413);
3480
3656
  const parser_1 = __webpack_require__(605);
3657
+ const alias_1 = __webpack_require__(5413);
3481
3658
  const assign_1 = __webpack_require__(9888);
3482
3659
  function reset(base, parser) {
3483
3660
  const changes = Object.entries(base);
@@ -3590,7 +3767,7 @@ function precedence(precedence, parser) {
3590
3767
  } = input;
3591
3768
  const {
3592
3769
  delimiters,
3593
- precedence: p = 0
3770
+ precedence: p
3594
3771
  } = context;
3595
3772
  const shift = delimiters && precedence > p;
3596
3773
  context.precedence = precedence;
@@ -3650,7 +3827,7 @@ function matcher(pattern, advance) {
3650
3827
  if (advance) {
3651
3828
  context.position += pattern.length;
3652
3829
  }
3653
- return new parser_1.List([new parser_1.Data(pattern)]);
3830
+ return new parser_1.List([new parser_1.Node(pattern)]);
3654
3831
  };
3655
3832
  case 'object':
3656
3833
  return ({
@@ -3667,7 +3844,7 @@ function matcher(pattern, advance) {
3667
3844
  if (advance) {
3668
3845
  context.position += src.length;
3669
3846
  }
3670
- return new parser_1.List([new parser_1.Data(src)]);
3847
+ return new parser_1.List([new parser_1.Node(src)]);
3671
3848
  };
3672
3849
  }
3673
3850
  }
@@ -3675,162 +3852,6 @@ exports.matcher = matcher;
3675
3852
 
3676
3853
  /***/ },
3677
3854
 
3678
- /***/ 5691
3679
- (__unused_webpack_module, exports, __webpack_require__) {
3680
-
3681
- "use strict";
3682
-
3683
-
3684
- Object.defineProperty(exports, "__esModule", ({
3685
- value: true
3686
- }));
3687
- exports.Delimiters = void 0;
3688
- const combinator_1 = __webpack_require__(3484);
3689
- class Delimiters {
3690
- constructor() {
3691
- this.tree = {};
3692
- this.map = new Map();
3693
- this.delimiters = [];
3694
- this.stack = [];
3695
- this.states = [];
3696
- }
3697
- // 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
3698
- static signature(pattern) {
3699
- switch (typeof pattern) {
3700
- case 'undefined':
3701
- return 1 << 7;
3702
- case 'string':
3703
- if (pattern.length === 1) {
3704
- const code = pattern.charCodeAt(0);
3705
- return code;
3706
- }
3707
- return `s:${pattern}`;
3708
- case 'object':
3709
- return `r/${pattern.source}`;
3710
- }
3711
- }
3712
- static matcher(pattern) {
3713
- switch (typeof pattern) {
3714
- case 'undefined':
3715
- return () => undefined;
3716
- case 'string':
3717
- case 'object':
3718
- const match = (0, combinator_1.matcher)(pattern, false);
3719
- return input => match(input) !== undefined || undefined;
3720
- }
3721
- }
3722
- registry(signature) {
3723
- if (typeof signature === 'number') {
3724
- return this.tree[signature] ??= [];
3725
- } else {
3726
- const ds = this.map.get(signature);
3727
- if (ds) return ds;
3728
- const blank = [];
3729
- this.map.set(signature, blank);
3730
- return blank;
3731
- }
3732
- }
3733
- push(delims) {
3734
- const {
3735
- delimiters,
3736
- stack
3737
- } = this;
3738
- // シグネチャ数以下
3739
-
3740
- for (let i = 0; i < delims.length; ++i) {
3741
- const {
3742
- signature,
3743
- matcher,
3744
- precedence
3745
- } = delims[i];
3746
- const memory = this.registry(signature);
3747
- const index = memory[0]?.index ?? delimiters.length;
3748
- if (memory.length === 0) {
3749
- const delimiter = {
3750
- memory,
3751
- index,
3752
- signature,
3753
- matcher,
3754
- precedence,
3755
- state: true
3756
- };
3757
- delimiters[index] = delimiter;
3758
- memory.push(delimiter);
3759
- stack.push(index);
3760
- } else {
3761
- stack.push(-1);
3762
- }
3763
- // 現状各優先順位は固定
3764
- }
3765
- }
3766
- pop(count) {
3767
- const {
3768
- delimiters,
3769
- stack
3770
- } = this;
3771
- for (let i = 0; i < count; ++i) {
3772
- const index = stack.pop();
3773
- if (index === -1) continue;
3774
- const {
3775
- memory
3776
- } = delimiters[index];
3777
- if (memory.length === 1) {
3778
- memory.pop();
3779
- delimiters.pop();
3780
- } else {
3781
- memory.pop();
3782
- delimiters[index] = memory.at(-1);
3783
- }
3784
- }
3785
- }
3786
- shift(precedence) {
3787
- const {
3788
- delimiters
3789
- } = this;
3790
- const indexes = [];
3791
- for (let i = delimiters.length; i--;) {
3792
- const delimiter = delimiters[i];
3793
- if (delimiter.precedence >= precedence || !delimiter.state) continue;
3794
- delimiter.state = false;
3795
- indexes.push(i);
3796
- }
3797
- this.states.push(indexes);
3798
- }
3799
- unshift() {
3800
- const {
3801
- delimiters
3802
- } = this;
3803
- const indexes = this.states.pop();
3804
- for (let i = indexes.length; i--;) {
3805
- delimiters[indexes[i]].state = true;
3806
- }
3807
- }
3808
- match(input) {
3809
- const {
3810
- precedence = 0
3811
- } = input.context;
3812
- const {
3813
- delimiters
3814
- } = this;
3815
- for (let i = delimiters.length; i--;) {
3816
- const delimiter = delimiters[i];
3817
- if (delimiter.precedence <= precedence || !delimiter.state) continue;
3818
- switch (delimiter.matcher(input)) {
3819
- case true:
3820
- return true;
3821
- case false:
3822
- return false;
3823
- default:
3824
- continue;
3825
- }
3826
- }
3827
- return false;
3828
- }
3829
- }
3830
- exports.Delimiters = Delimiters;
3831
-
3832
- /***/ },
3833
-
3834
3855
  /***/ 2861
3835
3856
  (__unused_webpack_module, exports) {
3836
3857
 
@@ -3853,7 +3874,7 @@ function inits(parsers, resume) {
3853
3874
  let nodes;
3854
3875
  for (let len = parsers.length, i = 0; i < len; ++i) {
3855
3876
  if (context.position === source.length) break;
3856
- if (context.delimiters?.match(input)) break;
3877
+ if (context.delimiters.match(input)) break;
3857
3878
  const result = parsers[i](input);
3858
3879
  if (result === undefined) break;
3859
3880
  nodes = nodes?.import(result) ?? result;
@@ -3888,7 +3909,7 @@ function sequence(parsers, resume) {
3888
3909
  let nodes;
3889
3910
  for (let len = parsers.length, i = 0; i < len; ++i) {
3890
3911
  if (context.position === source.length) return;
3891
- if (context.delimiters?.match(input)) return;
3912
+ if (context.delimiters.match(input)) return;
3892
3913
  const result = parsers[i](input);
3893
3914
  if (result === undefined) return;
3894
3915
  nodes = nodes?.import(result) ?? result;
@@ -3911,7 +3932,7 @@ Object.defineProperty(exports, "__esModule", ({
3911
3932
  value: true
3912
3933
  }));
3913
3934
  exports.some = void 0;
3914
- const delimiter_1 = __webpack_require__(5691);
3935
+ const delimiter_1 = __webpack_require__(385);
3915
3936
  function some(parser, end, delimiters = [], limit = -1) {
3916
3937
  if (typeof end === 'number') return some(parser, undefined, delimiters, end);
3917
3938
  const match = delimiter_1.Delimiters.matcher(end);
@@ -3931,13 +3952,12 @@ function some(parser, end, delimiters = [], limit = -1) {
3931
3952
  //assert(context.backtracks ??= {});
3932
3953
  let nodes;
3933
3954
  if (delims.length > 0) {
3934
- context.delimiters ??= new delimiter_1.Delimiters();
3935
3955
  context.delimiters.push(delims);
3936
3956
  }
3937
3957
  // whileは数倍遅い
3938
3958
  for (const len = source.length; context.position < len;) {
3939
3959
  if (match(input)) break;
3940
- if (context.delimiters?.match(input)) break;
3960
+ if (context.delimiters.match(input)) break;
3941
3961
  const result = parser(input);
3942
3962
  if (result === undefined) break;
3943
3963
  nodes = nodes?.import(result) ?? result;
@@ -4118,21 +4138,21 @@ Object.defineProperty(exports, "__esModule", ({
4118
4138
  value: true
4119
4139
  }));
4120
4140
  exports.bind = void 0;
4141
+ const context_1 = __webpack_require__(8669);
4121
4142
  const parser_1 = __webpack_require__(605);
4122
4143
  const segment_1 = __webpack_require__(3967);
4123
- const header_1 = __webpack_require__(3009);
4124
4144
  const block_1 = __webpack_require__(7099);
4125
4145
  const normalize_1 = __webpack_require__(4490);
4126
- const header_2 = __webpack_require__(3652);
4146
+ const header_1 = __webpack_require__(3652);
4127
4147
  const figure_1 = __webpack_require__(1657);
4128
4148
  const note_1 = __webpack_require__(165);
4129
4149
  const url_1 = __webpack_require__(1904);
4130
4150
  const array_1 = __webpack_require__(6876);
4131
4151
  function bind(target, settings) {
4132
- const context = {
4152
+ const context = new context_1.Context({
4133
4153
  ...settings,
4134
4154
  host: settings.host ?? new url_1.ReadonlyURL(location.pathname, location.origin)
4135
- };
4155
+ });
4136
4156
  if (context.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
4137
4157
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
4138
4158
  const blocks = [];
@@ -4147,7 +4167,7 @@ function bind(target, settings) {
4147
4167
  };
4148
4168
  function* parse(source) {
4149
4169
  if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
4150
- const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
4170
+ const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
4151
4171
  source = (0, normalize_1.normalize)(source);
4152
4172
  // @ts-expect-error
4153
4173
  context.url = url ? new url_1.ReadonlyURL(url) : undefined;
@@ -4174,13 +4194,15 @@ function bind(target, settings) {
4174
4194
  }
4175
4195
  const base = next(head);
4176
4196
  let index = head;
4197
+ // @ts-expect-error
4198
+ context.header = true;
4177
4199
  for (; index < sourceSegments.length - last; ++index) {
4178
4200
  const seg = sourceSegments[index];
4179
- const es = ((0, header_1.header)((0, parser_1.input)(seg, {
4180
- header: index === 0
4181
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4201
+ const es = (0, block_1.block)((0, parser_1.input)(seg, context))?.foldl((acc, {
4182
4202
  value
4183
4203
  }) => void acc.push(value) || acc, []) ?? [];
4204
+ // @ts-expect-error
4205
+ context.header = false;
4184
4206
  blocks.splice(index, 0, [seg, es, url]);
4185
4207
  if (es.length === 0) continue;
4186
4208
  // All deletion processes always run after all addition processes have done.
@@ -4346,7 +4368,7 @@ Object.defineProperty(exports, "__esModule", ({
4346
4368
  value: true
4347
4369
  }));
4348
4370
  exports.headers = exports.header = void 0;
4349
- const parser_1 = __webpack_require__(605);
4371
+ const context_1 = __webpack_require__(8669);
4350
4372
  const header_1 = __webpack_require__(3009);
4351
4373
  function header(source) {
4352
4374
  const [, pos = 0] = parse(source);
@@ -4359,10 +4381,14 @@ function headers(source) {
4359
4381
  }
4360
4382
  exports.headers = headers;
4361
4383
  function parse(source) {
4362
- const i = (0, parser_1.input)(source, {});
4363
- const result = (0, header_1.header)(i);
4384
+ const context = new context_1.Context({
4385
+ source
4386
+ });
4387
+ const result = (0, header_1.header)({
4388
+ context
4389
+ });
4364
4390
  const el = result?.head?.value;
4365
- return el?.tagName === 'ASIDE' ? [el, i.context.position] : [];
4391
+ return el?.tagName === 'ASIDE' ? [el, context.position] : [];
4366
4392
  }
4367
4393
 
4368
4394
  /***/ },
@@ -4378,6 +4404,7 @@ Object.defineProperty(exports, "__esModule", ({
4378
4404
  }));
4379
4405
  exports.escape = exports.invisibleHTMLEntityNames = exports.normalize = void 0;
4380
4406
  const parser_1 = __webpack_require__(605);
4407
+ const context_1 = __webpack_require__(8669);
4381
4408
  const htmlentity_1 = __webpack_require__(470);
4382
4409
  const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
4383
4410
  function normalize(source) {
@@ -4399,7 +4426,7 @@ function sanitize(source) {
4399
4426
  // https://en.wikipedia.org/wiki/Whitespace_character
4400
4427
  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'];
4401
4428
  const unreadableEscapeHTMLEntityNames = exports.invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
4402
- const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => (0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {})).head.value);
4429
+ const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => (0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, new context_1.Context())).head.value);
4403
4430
  const unreadableEscapeCharacter = new RegExp(`[${unreadableEscapeCharacters.join('')}]`, 'g');
4404
4431
  // https://www.pandanoir.info/entry/2018/03/11/193000
4405
4432
  // http://anti.rosx.net/etc/memo/002_space.html
@@ -4452,35 +4479,36 @@ Object.defineProperty(exports, "__esModule", ({
4452
4479
  }));
4453
4480
  exports.parse = void 0;
4454
4481
  const parser_1 = __webpack_require__(605);
4482
+ const context_1 = __webpack_require__(8669);
4455
4483
  const segment_1 = __webpack_require__(3967);
4456
- const header_1 = __webpack_require__(3009);
4457
4484
  const block_1 = __webpack_require__(7099);
4458
4485
  const normalize_1 = __webpack_require__(4490);
4459
- const header_2 = __webpack_require__(3652);
4486
+ const header_1 = __webpack_require__(3652);
4460
4487
  const figure_1 = __webpack_require__(1657);
4461
4488
  const note_1 = __webpack_require__(165);
4462
4489
  const url_1 = __webpack_require__(1904);
4463
4490
  const dom_1 = __webpack_require__(394);
4464
4491
  function parse(source, options = {}, context) {
4465
- const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
4492
+ const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
4466
4493
  source = !context ? (0, normalize_1.normalize)(source) : source;
4467
- context = {
4494
+ context = new context_1.Context({
4468
4495
  host: options.host ?? context?.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
4469
4496
  url: url ? new url_1.ReadonlyURL(url) : context?.url,
4470
4497
  id: options.id ?? context?.id,
4471
4498
  caches: context?.caches,
4472
4499
  resources: context?.resources
4473
- };
4500
+ });
4474
4501
  if (context.id?.match(/[^0-9a-z/-]/i)) throw new Error('Invalid ID: ID must be alphanumeric');
4475
4502
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
4476
4503
  const node = (0, dom_1.frag)();
4477
- let index = 0;
4504
+ // @ts-expect-error
4505
+ context.header = true;
4478
4506
  for (const seg of (0, segment_1.segment)(source)) {
4479
- node.append(...(((0, header_1.header)((0, parser_1.input)(seg, {
4480
- header: index++ === 0
4481
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4507
+ node.append(...((0, block_1.block)((0, parser_1.input)(seg, context))?.foldl((acc, {
4482
4508
  value
4483
4509
  }) => void acc.push(value) || acc, []) ?? []));
4510
+ // @ts-expect-error
4511
+ context.header = false;
4484
4512
  }
4485
4513
  if (options.test) return node;
4486
4514
  for (const _ of (0, figure_1.figure)(node, options.notes, context));
@@ -4502,7 +4530,7 @@ Object.defineProperty(exports, "__esModule", ({
4502
4530
  }));
4503
4531
  exports.autolink = void 0;
4504
4532
  const combinator_1 = __webpack_require__(3484);
4505
- const autolink_1 = __webpack_require__(8072);
4533
+ const autolink_1 = __webpack_require__(5691);
4506
4534
  const source_1 = __webpack_require__(8745);
4507
4535
  exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([autolink_1.autolink, source_1.unescsource])));
4508
4536
 
@@ -4521,6 +4549,7 @@ exports.block = void 0;
4521
4549
  const parser_1 = __webpack_require__(605);
4522
4550
  const combinator_1 = __webpack_require__(3484);
4523
4551
  const segment_1 = __webpack_require__(3967);
4552
+ const header_1 = __webpack_require__(3009);
4524
4553
  const source_1 = __webpack_require__(8745);
4525
4554
  const pagebreak_1 = __webpack_require__(2946);
4526
4555
  const heading_1 = __webpack_require__(2778);
@@ -4542,7 +4571,7 @@ const dom_1 = __webpack_require__(394);
4542
4571
  exports.block = (0, combinator_1.reset)({
4543
4572
  resources: {
4544
4573
  // バックトラックのせいで文字数制限を受けないようにする。
4545
- clock: segment_1.MAX_SEGMENT_SIZE * 5 + 1,
4574
+ clock: segment_1.MAX_SEGMENT_SIZE * 6 + 1,
4546
4575
  recursions: [10 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
4547
4576
  },
4548
4577
  backtracks: {}
@@ -4567,6 +4596,7 @@ exports.block = (0, combinator_1.reset)({
4567
4596
  if (source[position + 1] === ' ') return (0, dlist_1.dlist)(input);
4568
4597
  break;
4569
4598
  case '-':
4599
+ if (source.startsWith('---', position)) return (0, header_1.header)(input);
4570
4600
  if (source[position + 1] === ' ') return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
4571
4601
  break;
4572
4602
  case '+':
@@ -4615,10 +4645,10 @@ function error(parser) {
4615
4645
  position,
4616
4646
  id
4617
4647
  }
4618
- }, reason) => new parser_1.List([new parser_1.Data((0, dom_1.html)('h1', {
4648
+ }, reason) => new parser_1.List([new parser_1.Node((0, dom_1.html)('h1', {
4619
4649
  id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
4620
4650
  class: 'error'
4621
- }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`)), new parser_1.Data((0, dom_1.html)('pre', {
4651
+ }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`)), new parser_1.Node((0, dom_1.html)('pre', {
4622
4652
  class: 'error',
4623
4653
  translate: 'no'
4624
4654
  }, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined))]));
@@ -4648,7 +4678,7 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
4648
4678
  const opener = /(?=>>+(?:$|[ \n]))/y;
4649
4679
  const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
4650
4680
  const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
4651
- 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, 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))))])), true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4681
+ 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, 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.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4652
4682
  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, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
4653
4683
  context
4654
4684
  }) => {
@@ -4666,8 +4696,8 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4666
4696
  }
4667
4697
  }, context);
4668
4698
  context.position = source.length;
4669
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4670
- }, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4699
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4700
+ }, true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4671
4701
 
4672
4702
  /***/ },
4673
4703
 
@@ -4714,7 +4744,7 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
4714
4744
  name in params ? params.invalid = `Duplicate ${name} attribute` : params[name] = value;
4715
4745
  return params;
4716
4746
  }, {}) ?? {};
4717
- if (!closer || overflow || params.invalid) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4747
+ if (!closer || overflow || params.invalid) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
4718
4748
  class: 'invalid',
4719
4749
  translate: 'no',
4720
4750
  ...(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)
@@ -4726,7 +4756,7 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
4726
4756
  'data-line': params.line || undefined,
4727
4757
  'data-path': params.path || undefined
4728
4758
  }, 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, autolink_1.autolink)((0, parser_1.subinput)(body.slice(0, -1), context)))));
4729
- return new parser_1.List([new parser_1.Data(el)]);
4759
+ return new parser_1.List([new parser_1.Node(el)]);
4730
4760
  }));
4731
4761
 
4732
4762
  /***/ },
@@ -4748,13 +4778,13 @@ const source_1 = __webpack_require__(8745);
4748
4778
  const visibility_1 = __webpack_require__(6364);
4749
4779
  const util_1 = __webpack_require__(4992);
4750
4780
  const dom_1 = __webpack_require__(394);
4751
- exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~ +(?=\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))))]))));
4752
- const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~ +(?=\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', {
4781
+ exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~ +(?=\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.Node((0, dom_1.html)('dl', (0, util_1.unwrap)(fillTrailingDescription(ns))))]))));
4782
+ const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~ +(?=\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.Node((0, dom_1.html)('dt', {
4753
4783
  'data-index': (0, inline_1.dataindex)(ns)
4754
4784
  }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
4755
- const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/: +(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:] +(?=\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);
4785
+ const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/: +(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:] +(?=\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.Node((0, dom_1.html)('dd', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
4756
4786
  function fillTrailingDescription(nodes) {
4757
- return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Data((0, dom_1.html)('dd'))) && nodes : nodes;
4787
+ return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Node((0, dom_1.html)('dd'))) && nodes : nodes;
4758
4788
  }
4759
4789
 
4760
4790
  /***/ },
@@ -4803,7 +4833,7 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
4803
4833
  // Bug: Type mismatch between outer and inner.
4804
4834
  (nodes, context) => {
4805
4835
  const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
4806
- if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4836
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
4807
4837
  class: 'invalid',
4808
4838
  translate: 'no',
4809
4839
  ...(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')
@@ -4818,12 +4848,12 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
4818
4848
  }
4819
4849
  }, context);
4820
4850
  const heading = 'H1 H2 H3 H4 H5 H6'.split(' ').includes(document.firstElementChild?.tagName) && document.firstElementChild;
4821
- if (!heading) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4851
+ if (!heading) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
4822
4852
  class: 'invalid',
4823
4853
  translate: 'no',
4824
4854
  ...(0, util_1.invalid)('aside', 'content', 'Missing the title at the first line')
4825
4855
  }, `${opener}${body}${closer}`))]);
4826
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4856
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
4827
4857
  id: (0, indexee_1.identity)('index', context.id, heading),
4828
4858
  class: 'aside'
4829
4859
  }, [document, (0, dom_1.html)('h2', 'References'), references]))]);
@@ -4851,7 +4881,7 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
4851
4881
  // Bug: Type mismatch between outer and inner.
4852
4882
  (nodes, context) => {
4853
4883
  const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
4854
- if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4884
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
4855
4885
  class: 'invalid',
4856
4886
  translate: 'no',
4857
4887
  ...(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')
@@ -4868,7 +4898,7 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
4868
4898
  references
4869
4899
  }
4870
4900
  }, context);
4871
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4901
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
4872
4902
  class: 'example',
4873
4903
  'data-type': 'markdown'
4874
4904
  }, [(0, dom_1.html)('pre', {
@@ -4876,14 +4906,14 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
4876
4906
  }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]))]);
4877
4907
  }
4878
4908
  case 'math':
4879
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4909
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
4880
4910
  class: 'example',
4881
4911
  'data-type': 'math'
4882
4912
  }, [(0, dom_1.html)('pre', {
4883
4913
  translate: 'no'
4884
4914
  }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, mathblock_1.mathblock)((0, parser_1.subinput)(`$$\n${body}$$`, context)).head.value]))]);
4885
4915
  default:
4886
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4916
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
4887
4917
  class: 'invalid',
4888
4918
  translate: 'no',
4889
4919
  ...(0, util_1.invalid)('example', 'type', 'Invalid example type')
@@ -4951,7 +4981,7 @@ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
4951
4981
  }]) => {
4952
4982
  const label = el.getAttribute('data-label');
4953
4983
  const group = label.split('-', 1)[0];
4954
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', {
4984
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('figure', {
4955
4985
  'data-label': label,
4956
4986
  'data-group': group,
4957
4987
  hidden: ''
@@ -4993,7 +5023,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:fig
4993
5023
  (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 - 1, [], 2 ** 4 - 1)));
4994
5024
  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))))])])), nodes => {
4995
5025
  const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
4996
- 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', {
5026
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4997
5027
  class: 'figindex'
4998
5028
  }), (0, dom_1.html)('span', {
4999
5029
  class: 'figtext'
@@ -5001,7 +5031,7 @@ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinat
5001
5031
  })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \n])|\[?\$)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
5002
5032
  const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
5003
5033
  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+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
5004
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5034
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5005
5035
  class: 'invalid',
5006
5036
  translate: 'no',
5007
5037
  ...(0, util_1.invalid)('figure', violation[0], violation[1])
@@ -5078,7 +5108,7 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
5078
5108
  // Bug: Type mismatch between outer and inner.
5079
5109
  (nodes, context) => {
5080
5110
  const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5081
- if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5111
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5082
5112
  class: 'invalid',
5083
5113
  translate: 'no',
5084
5114
  ...(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')
@@ -5089,13 +5119,13 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
5089
5119
  case 'warning':
5090
5120
  break;
5091
5121
  default:
5092
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5122
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5093
5123
  class: 'invalid',
5094
5124
  translate: 'no',
5095
5125
  ...(0, util_1.invalid)('message', 'type', 'Invalid message type')
5096
5126
  }, `${opener}${body}${closer}`))]);
5097
5127
  }
5098
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', {
5128
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', {
5099
5129
  class: `message`,
5100
5130
  'data-type': type
5101
5131
  }, [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, util_1.unwrap)(content((0, parser_1.subinput)(seg, context)))), [(0, dom_1.html)('h1', title(type))])))]);
@@ -5134,7 +5164,7 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
5134
5164
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
5135
5165
  exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
5136
5166
  const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
5137
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5167
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5138
5168
  class: 'invalid',
5139
5169
  translate: 'no',
5140
5170
  ...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
@@ -5153,13 +5183,13 @@ Object.defineProperty(exports, "__esModule", ({
5153
5183
  value: true
5154
5184
  }));
5155
5185
  exports.table = exports.segment_ = exports.segment = void 0;
5156
- const alias_1 = __webpack_require__(5413);
5157
5186
  const parser_1 = __webpack_require__(605);
5158
5187
  const combinator_1 = __webpack_require__(3484);
5159
5188
  const inline_1 = __webpack_require__(7973);
5160
5189
  const source_1 = __webpack_require__(8745);
5161
5190
  const util_1 = __webpack_require__(4992);
5162
5191
  const visibility_1 = __webpack_require__(6364);
5192
+ const alias_1 = __webpack_require__(5413);
5163
5193
  const array_1 = __webpack_require__(6876);
5164
5194
  const dom_1 = __webpack_require__(394);
5165
5195
  const opener = /(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
@@ -5169,7 +5199,7 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
5169
5199
  // Bug: Type mismatch between outer and inner.
5170
5200
  (nodes, context) => {
5171
5201
  const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5172
- if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5202
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5173
5203
  class: 'invalid',
5174
5204
  translate: 'no',
5175
5205
  ...(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')
@@ -5177,28 +5207,28 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
5177
5207
  switch (type) {
5178
5208
  case 'grid':
5179
5209
  case undefined:
5180
- return (parser((0, parser_1.subinput)(body, context)) ?? new parser_1.List([new parser_1.Data((0, dom_1.html)('table'))])).foldl((acc, {
5210
+ return (parser((0, parser_1.subinput)(body, context)) ?? new parser_1.List([new parser_1.Node((0, dom_1.html)('table'))])).foldl((acc, {
5181
5211
  value
5182
- }) => acc.push(new parser_1.Data((0, dom_1.define)(value, {
5212
+ }) => acc.push(new parser_1.Node((0, dom_1.define)(value, {
5183
5213
  'data-type': type
5184
5214
  }))) && acc, new parser_1.List());
5185
5215
  default:
5186
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5216
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5187
5217
  class: 'invalid',
5188
5218
  translate: 'no',
5189
5219
  ...(0, util_1.invalid)('table', 'argument', 'Invalid table type')
5190
5220
  }, `${opener}${body}${closer}`))]);
5191
5221
  }
5192
5222
  }));
5193
- 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)])))]))));
5194
- 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)));
5223
+ 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.Node((0, dom_1.html)('table', format([...(0, util_1.unwrap)(rows)])))]))));
5224
+ 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.Node([[]])) && ns)));
5195
5225
  const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
5196
5226
  const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
5197
5227
  value
5198
- }]) => new parser_1.List([new parser_1.Data(value.split('/').map(s => s.split('')))])));
5228
+ }]) => new parser_1.List([new parser_1.Node(value.split('/').map(s => s.split('')))])));
5199
5229
  const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
5200
- const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/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);
5201
- const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/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);
5230
+ const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/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.Node((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5231
+ const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/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.Node((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5202
5232
  const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+ /y, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)])));
5203
5233
  function attributes(source) {
5204
5234
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
@@ -5425,12 +5455,12 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(
5425
5455
  } = input;
5426
5456
  const {
5427
5457
  source,
5428
- range = 0
5458
+ range
5429
5459
  } = context;
5430
5460
  const acc = new parser_1.List();
5431
5461
  for (const len = context.position + range; context.position < len;) {
5432
5462
  const line = (0, combinator_1.firstline)(source, context.position);
5433
- acc.push(new parser_1.Data(line));
5463
+ acc.push(new parser_1.Node(line));
5434
5464
  context.position += line.length;
5435
5465
  }
5436
5466
  return acc;
@@ -5439,9 +5469,9 @@ exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segm
5439
5469
  // その他の表示制御は各所のCSSで行う。
5440
5470
  (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) => {
5441
5471
  const [h, ...ns] = (0, util_1.unwrap)(nodes);
5442
- return new parser_1.List([h.length <= 6 ? new parser_1.Data((0, dom_1.html)(`h${h.length}`, {
5472
+ return new parser_1.List([h.length <= 6 ? new parser_1.Node((0, dom_1.html)(`h${h.length}`, {
5443
5473
  'data-index': (0, inline_1.dataindex)(nodes)
5444
- }, (0, dom_1.defrag)(ns))) : new parser_1.Data((0, dom_1.html)(`h6`, {
5474
+ }, (0, dom_1.defrag)(ns))) : new parser_1.Node((0, dom_1.html)(`h6`, {
5445
5475
  class: 'invalid',
5446
5476
  ...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
5447
5477
  }, context.source.slice(context.position - context.range, context.position)))]);
@@ -5469,7 +5499,7 @@ const visibility_1 = __webpack_require__(6364);
5469
5499
  const util_1 = __webpack_require__(4992);
5470
5500
  const dom_1 = __webpack_require__(394);
5471
5501
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
5472
- 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', {
5502
+ 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.Node((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.Node((0, dom_1.html)('ul', {
5473
5503
  class: 'invalid',
5474
5504
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5475
5505
  }, (0, util_1.unwrap)(ns)))]))));
@@ -5477,11 +5507,11 @@ exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.
5477
5507
  context: {
5478
5508
  source
5479
5509
  }
5480
- }) => new parser_1.List([new parser_1.Data(source)]))]), ({
5510
+ }) => new parser_1.List([new parser_1.Node(source)]))]), ({
5481
5511
  context: {
5482
5512
  source
5483
5513
  }
5484
- }) => new parser_1.List([new parser_1.Data(''), new parser_1.Data((0, dom_1.html)('span', {
5514
+ }) => new parser_1.List([new parser_1.Node(''), new parser_1.Node((0, dom_1.html)('span', {
5485
5515
  class: 'invalid',
5486
5516
  ...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
5487
5517
  }, source.replace('\n', '')))]));
@@ -5513,10 +5543,10 @@ exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
5513
5543
  } = {}
5514
5544
  }) => {
5515
5545
  const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
5516
- 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', {
5546
+ return new parser_1.List([delim.length === 2 && closer && !overflow && param.trimStart() === '' ? new parser_1.Node(cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
5517
5547
  class: 'math',
5518
5548
  translate: 'no'
5519
- }, `${delim}\n${body}${delim}`)) : new parser_1.Data((0, dom_1.html)('pre', {
5549
+ }, `${delim}\n${body}${delim}`)) : new parser_1.Node((0, dom_1.html)('pre', {
5520
5550
  class: 'invalid',
5521
5551
  translate: 'no',
5522
5552
  ...(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')
@@ -5544,10 +5574,10 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
5544
5574
  context: {
5545
5575
  source
5546
5576
  }
5547
- }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5577
+ }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
5548
5578
  class: 'invalid',
5549
5579
  ...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
5550
- }, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5580
+ }, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5551
5581
 
5552
5582
  /***/ },
5553
5583
 
@@ -5576,21 +5606,21 @@ const openers = {
5576
5606
  };
5577
5607
  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_)));
5578
5608
  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]), []))])));
5579
- 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', {
5609
+ 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.Node((0, dom_1.html)('li', {
5580
5610
  'data-index': (0, inline_1.dataindex)(ns),
5581
5611
  'data-marker': ns.shift()?.value || undefined
5582
- }, (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))]));
5612
+ }, (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))])))]))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ol', (0, util_1.unwrap)(ns)), type, form))]));
5583
5613
  const heads = {
5584
5614
  '.': (0, combinator_1.focus)(openers['.'], ({
5585
5615
  context: {
5586
5616
  source
5587
5617
  }
5588
- }) => new parser_1.List([new parser_1.Data(source.trimEnd().split('.', 1)[0] + '.')])),
5618
+ }) => new parser_1.List([new parser_1.Node(source.trimEnd().split('.', 1)[0] + '.')])),
5589
5619
  '(': (0, combinator_1.focus)(openers['('], ({
5590
5620
  context: {
5591
5621
  source
5592
5622
  }
5593
- }) => new parser_1.List([new parser_1.Data(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
5623
+ }) => new parser_1.List([new parser_1.Node(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
5594
5624
  };
5595
5625
  function idx(value) {
5596
5626
  switch (value) {
@@ -5695,7 +5725,7 @@ exports.pagebreak = void 0;
5695
5725
  const parser_1 = __webpack_require__(605);
5696
5726
  const combinator_1 = __webpack_require__(3484);
5697
5727
  const dom_1 = __webpack_require__(394);
5698
- 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'))]))));
5728
+ 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.Node((0, dom_1.html)('hr'))]))));
5699
5729
 
5700
5730
  /***/ },
5701
5731
 
@@ -5715,7 +5745,7 @@ const inline_1 = __webpack_require__(7973);
5715
5745
  const visibility_1 = __webpack_require__(6364);
5716
5746
  const util_1 = __webpack_require__(4992);
5717
5747
  const dom_1 = __webpack_require__(394);
5718
- 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))))])));
5748
+ 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.Node((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])));
5719
5749
 
5720
5750
  /***/ },
5721
5751
 
@@ -5742,7 +5772,7 @@ const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`,
5742
5772
  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, {
5743
5773
  source,
5744
5774
  position
5745
- }) => 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)))))]))));
5775
+ }) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Node((0, dom_1.html)('br'))) && ns)))])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns)))))]))));
5746
5776
 
5747
5777
  /***/ },
5748
5778
 
@@ -5770,13 +5800,13 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
5770
5800
  context: {
5771
5801
  source
5772
5802
  }
5773
- }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5803
+ }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
5774
5804
  class: 'anchor'
5775
5805
  }, source))])), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5776
5806
  context: {
5777
5807
  source
5778
5808
  }
5779
- }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5809
+ }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
5780
5810
  class: 'anchor',
5781
5811
  href: source.slice(2).trimEnd(),
5782
5812
  target: '_blank'
@@ -5784,17 +5814,17 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
5784
5814
  context: {
5785
5815
  source
5786
5816
  }
5787
- }) => new parser_1.List([new parser_1.Data(source)]))])), nodes => {
5817
+ }) => new parser_1.List([new parser_1.Node(source)]))])), nodes => {
5788
5818
  const quotes = nodes.head.value;
5789
5819
  const node = nodes.last.value;
5790
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', typeof node === 'object' ? {
5820
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', typeof node === 'object' ? {
5791
5821
  class: 'cite'
5792
5822
  } : {
5793
5823
  class: 'cite invalid',
5794
5824
  ...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
5795
5825
  }, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
5796
5826
  'data-depth': `${quotes.length + 1}`
5797
- }, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Data((0, dom_1.html)('br'))]);
5827
+ }, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Node((0, dom_1.html)('br'))]);
5798
5828
  }));
5799
5829
 
5800
5830
  /***/ },
@@ -5812,7 +5842,7 @@ exports.quote = exports.syntax = void 0;
5812
5842
  const parser_1 = __webpack_require__(605);
5813
5843
  const combinator_1 = __webpack_require__(3484);
5814
5844
  const math_1 = __webpack_require__(2962);
5815
- const autolink_1 = __webpack_require__(8072);
5845
+ const autolink_1 = __webpack_require__(5691);
5816
5846
  const source_1 = __webpack_require__(8745);
5817
5847
  const util_1 = __webpack_require__(4992);
5818
5848
  const dom_1 = __webpack_require__(394);
@@ -5822,7 +5852,7 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
5822
5852
  math_1.math, autolink_1.autolink, source_1.unescsource])))), (ns, {
5823
5853
  source,
5824
5854
  position
5825
- }) => 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', {
5855
+ }) => new parser_1.List([new parser_1.Node(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br')), new parser_1.Node((0, dom_1.html)('span', {
5826
5856
  class: 'quote'
5827
5857
  }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false));
5828
5858
 
@@ -5846,13 +5876,13 @@ const util_1 = __webpack_require__(4992);
5846
5876
  const dom_1 = __webpack_require__(394);
5847
5877
  exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\n]*(?:\n\|+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.union)([source])), ([{
5848
5878
  value
5849
- }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5879
+ }]) => new parser_1.List([new parser_1.Node((0, dom_1.define)(value, {
5850
5880
  class: 'invalid',
5851
5881
  ...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
5852
5882
  }))]))));
5853
5883
  const opener = /(?=\|\|+(?:$|[ \n]))/y;
5854
5884
  const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
5855
- 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)(/(?:\|\|+(?=$|[ \n])[^\n]*(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, 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))))])), true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5885
+ 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)(/(?:\|\|+(?=$|[ \n])[^\n]*(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, 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.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5856
5886
 
5857
5887
  /***/ },
5858
5888
 
@@ -5875,12 +5905,12 @@ const util_1 = __webpack_require__(4992);
5875
5905
  const duff_1 = __webpack_require__(9202);
5876
5906
  const array_1 = __webpack_require__(6876);
5877
5907
  const dom_1 = __webpack_require__(394);
5878
- 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)))]))]))));
5879
- 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, ({
5908
+ 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.Node((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5909
+ 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.Node((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
5880
5910
  context: {
5881
5911
  source
5882
5912
  }
5883
- }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', {
5913
+ }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', {
5884
5914
  class: 'invalid',
5885
5915
  ...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
5886
5916
  }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
@@ -5888,18 +5918,18 @@ const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_
5888
5918
  context: {
5889
5919
  source,
5890
5920
  position,
5891
- range = 0
5921
+ range
5892
5922
  }
5893
- }) => new parser_1.List([new parser_1.Data(source[position + range - 1] === ':' ? 'center' : 'start')]), false), (0, combinator_1.focus)(/-+:?/y, ({
5923
+ }) => new parser_1.List([new parser_1.Node(source[position + range - 1] === ':' ? 'center' : 'start')]), false), (0, combinator_1.focus)(/-+:?/y, ({
5894
5924
  context: {
5895
5925
  source,
5896
5926
  position,
5897
- range = 0
5927
+ range
5898
5928
  }
5899
- }) => new parser_1.List([new parser_1.Data(source[position + range - 1] === ':' ? 'end' : '')]), false)])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5929
+ }) => new parser_1.List([new parser_1.Node(source[position + range - 1] === ':' ? 'end' : '')]), false)])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5900
5930
  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);
5901
- 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))))]));
5902
- 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))))]));
5931
+ const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5932
+ const data = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5903
5933
  function format(rows) {
5904
5934
  const aligns = rows.head.value.className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().value.children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5905
5935
  for (const {
@@ -5937,15 +5967,15 @@ const visibility_1 = __webpack_require__(6364);
5937
5967
  const util_1 = __webpack_require__(4992);
5938
5968
  const dom_1 = __webpack_require__(394);
5939
5969
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)('- ', exports.ulist_)));
5940
- 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', {
5970
+ 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.Node((0, dom_1.html)('li', {
5941
5971
  'data-index': (0, inline_1.dataindex)(ns)
5942
- }, (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))))]))));
5972
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
5943
5973
  exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
5944
5974
  context: {
5945
5975
  source,
5946
5976
  position
5947
5977
  }
5948
- }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5978
+ }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
5949
5979
  class: 'checkbox'
5950
5980
  }, source[position + 1].trimStart() ? '☑' : '☐'))]), false);
5951
5981
  function fillFirstLine(nodes) {
@@ -5954,7 +5984,7 @@ function fillFirstLine(nodes) {
5954
5984
  switch (node.tagName) {
5955
5985
  case 'UL':
5956
5986
  case 'OL':
5957
- nodes.unshift(new parser_1.Data((0, dom_1.html)('br')));
5987
+ nodes.unshift(new parser_1.Node((0, dom_1.html)('br')));
5958
5988
  }
5959
5989
  return nodes;
5960
5990
  }
@@ -5968,6 +5998,45 @@ function format(list) {
5968
5998
 
5969
5999
  /***/ },
5970
6000
 
6001
+ /***/ 8669
6002
+ (__unused_webpack_module, exports, __webpack_require__) {
6003
+
6004
+ "use strict";
6005
+
6006
+
6007
+ Object.defineProperty(exports, "__esModule", ({
6008
+ value: true
6009
+ }));
6010
+ exports.CmdRegExp = exports.Context = void 0;
6011
+ const parser_1 = __webpack_require__(605);
6012
+ class Context extends parser_1.Context {
6013
+ constructor(options = {}) {
6014
+ super(options);
6015
+ const {
6016
+ buffer,
6017
+ sequential,
6018
+ header,
6019
+ host,
6020
+ url,
6021
+ id,
6022
+ caches
6023
+ } = options;
6024
+ this.buffer = buffer ?? new parser_1.List();
6025
+ this.sequential = sequential ?? false;
6026
+ this.header = header ?? true;
6027
+ this.host = host;
6028
+ this.url = url;
6029
+ this.id = id;
6030
+ this.caches = caches;
6031
+ }
6032
+ }
6033
+ exports.Context = Context;
6034
+ exports.CmdRegExp = {
6035
+ Error: /\x07/g
6036
+ };
6037
+
6038
+ /***/ },
6039
+
5971
6040
  /***/ 3009
5972
6041
  (__unused_webpack_module, exports, __webpack_require__) {
5973
6042
 
@@ -5984,13 +6053,13 @@ const source_1 = __webpack_require__(8745);
5984
6053
  const util_1 = __webpack_require__(4992);
5985
6054
  const normalize_1 = __webpack_require__(4490);
5986
6055
  const dom_1 = __webpack_require__(394);
5987
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
6056
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\n]*\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5988
6057
  context
5989
- }) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1 *(?:$|\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (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', {
6058
+ }) => context.header, (0, combinator_1.focus)(/(---+)[^\S\n]*\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1[^\S\n]*(?:$|\n)/yi, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
5990
6059
  class: 'header'
5991
6060
  }, [(0, dom_1.html)('details', {
5992
6061
  open: ''
5993
- }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Data((0, dom_1.html)('summary', 'Header'))) && ns)))]))]))))), ({
6062
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Node((0, dom_1.html)('summary', 'Header'))) && ns)))]))]))))), ({
5994
6063
  context
5995
6064
  }) => {
5996
6065
  const {
@@ -5998,12 +6067,12 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *
5998
6067
  position
5999
6068
  } = context;
6000
6069
  context.position += source.length;
6001
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
6070
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
6002
6071
  class: 'invalid',
6003
6072
  translate: 'no',
6004
6073
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
6005
6074
  }, (0, normalize_1.normalize)(source.slice(position))))]);
6006
- }])), (0, combinator_1.clear)((0, source_1.str)(/ *\n/y))])));
6075
+ }])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\n]*\n/y))])));
6007
6076
  const field = (0, combinator_1.line)(({
6008
6077
  context: {
6009
6078
  source,
@@ -6012,7 +6081,7 @@ const field = (0, combinator_1.line)(({
6012
6081
  }) => {
6013
6082
  const name = source.slice(position, source.indexOf(':', position));
6014
6083
  const value = source.slice(position + name.length + 1).trim();
6015
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6084
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6016
6085
  class: 'field',
6017
6086
  'data-name': name.toLowerCase(),
6018
6087
  'data-value': value
@@ -6056,7 +6125,7 @@ const math_1 = __webpack_require__(2962);
6056
6125
  const code_1 = __webpack_require__(3481);
6057
6126
  const htmlentity_1 = __webpack_require__(470);
6058
6127
  const bracket_1 = __webpack_require__(4526);
6059
- const autolink_1 = __webpack_require__(8072);
6128
+ const autolink_1 = __webpack_require__(5691);
6060
6129
  const source_1 = __webpack_require__(8745);
6061
6130
  const stars = (0, source_1.strs)('*');
6062
6131
  exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
@@ -6185,13 +6254,26 @@ const inline_1 = __webpack_require__(7973);
6185
6254
  const visibility_1 = __webpack_require__(6364);
6186
6255
  const util_1 = __webpack_require__(4992);
6187
6256
  const dom_1 = __webpack_require__(394);
6188
- 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, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6257
+ 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, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', {
6189
6258
  class: 'annotation'
6190
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined)));
6259
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined, (_, context) => {
6260
+ const {
6261
+ source,
6262
+ position,
6263
+ range,
6264
+ linebreak
6265
+ } = context;
6266
+ const head = position - range;
6267
+ if (source[position] !== ')') {
6268
+ (0, combinator_1.setBacktrack)(context, 2 | 4 /* Backtrack.common */, head + 1);
6269
+ } else if (linebreak !== 0) {
6270
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head + 1);
6271
+ }
6272
+ })));
6191
6273
 
6192
6274
  /***/ },
6193
6275
 
6194
- /***/ 8072
6276
+ /***/ 5691
6195
6277
  (__unused_webpack_module, exports, __webpack_require__) {
6196
6278
 
6197
6279
  "use strict";
@@ -6268,9 +6350,9 @@ const source_1 = __webpack_require__(8745);
6268
6350
  const dom_1 = __webpack_require__(394);
6269
6351
  // https://example/@user must be a user page or a redirect page going there.
6270
6352
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
6271
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (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))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6353
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[.-][0-9a-z]+)*(?![_.-]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (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))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6272
6354
  value
6273
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 8 /* Backtrack.unescapable */])), '', false, [], ([[{
6355
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![_.-]?[0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 8 /* Backtrack.unescapable */])), '', false, [], ([[{
6274
6356
  value: host
6275
6357
  }, {
6276
6358
  value: account
@@ -6281,7 +6363,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
6281
6363
  const param = nodes.foldl((acc, {
6282
6364
  value
6283
6365
  }) => acc ? acc + '+' + value : value, '');
6284
- return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`@${host}${account}${hashes}`)]), new parser_1.List([new parser_1.Data(host ? `https://${host}@${account}?ch=${param}` : `/@${account}?ch=${param}`)]), context), {
6366
+ return new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`@${host}${account}${hashes}`)]), new parser_1.List([new parser_1.Node(host ? `https://${host}@${account}?ch=${param}` : `/@${account}?ch=${param}`)]), context), {
6285
6367
  class: 'channel'
6286
6368
  }))]);
6287
6369
  }, ([[{
@@ -6292,7 +6374,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
6292
6374
  if (context.source[context.position] === '#') {
6293
6375
  return void (0, combinator_1.setBacktrack)(context, 2 | 8 /* Backtrack.unescapable */, context.position - context.range);
6294
6376
  }
6295
- return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`@${host}${account}`)]), new parser_1.List([new parser_1.Data(host ? `https://${host}@${account}` : `/@${account}`)]), context), {
6377
+ return new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`@${host}${account}`)]), new parser_1.List([new parser_1.Node(host ? `https://${host}@${account}` : `/@${account}`)]), context), {
6296
6378
  class: 'account'
6297
6379
  }))]);
6298
6380
  }))));
@@ -6321,9 +6403,9 @@ const dom_1 = __webpack_require__(394);
6321
6403
  // cid: YYYY-MMDD-HHMM-SSmmm
6322
6404
  // 内部表現はUnixTimeに統一する(時系列順)
6323
6405
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
6324
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6406
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?![_.-]?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6325
6407
  value
6326
- }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`>>${value}`)]), new parser_1.List([new parser_1.Data(`?at=${value}`)]), context), {
6408
+ }]], context) => new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`>>${value}`)]), new parser_1.List([new parser_1.Node(`?at=${value}`)]), context), {
6327
6409
  class: 'anchor'
6328
6410
  }))])))));
6329
6411
 
@@ -6344,11 +6426,11 @@ const combinator_1 = __webpack_require__(3484);
6344
6426
  const source_1 = __webpack_require__(8745);
6345
6427
  const dom_1 = __webpack_require__(394);
6346
6428
  // https://html.spec.whatwg.org/multipage/input.html
6347
- exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![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,63}@[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}(?![.-]?[0-9a-z@#]|>>|:\S)/yi), ([{
6429
+ exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![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,63}@[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}(?![_.-]?[0-9a-z@#]|>>|:\S)/yi), ([{
6348
6430
  value
6349
6431
  }]) => value.length <= 254), '', false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6350
6432
  value
6351
- }]]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6433
+ }]]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
6352
6434
  class: 'email',
6353
6435
  href: `mailto:${value}`
6354
6436
  }, value))]))));
@@ -6371,9 +6453,11 @@ const link_1 = __webpack_require__(3628);
6371
6453
  const hashtag_1 = __webpack_require__(5764);
6372
6454
  const source_1 = __webpack_require__(8745);
6373
6455
  const dom_1 = __webpack_require__(394);
6374
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), '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.source), 'yu')), '', false, [1 | 8 /* Backtrack.unescapable */], ([, [{
6456
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), '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.source), 'yu')), '', false,
6457
+ // unescapableを使用するべきだがhashtagとの重複を回避するためescapableを使用する。
6458
+ [3 | 16 /* Backtrack.escapable */], ([, [{
6375
6459
  value
6376
- }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(value)]), context), {
6460
+ }]], context) => new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`#${value}`)]), new parser_1.List([new parser_1.Node(value)]), context), {
6377
6461
  class: 'hashnum',
6378
6462
  href: null
6379
6463
  }))])))));
@@ -6400,9 +6484,9 @@ const dom_1 = __webpack_require__(394);
6400
6484
  exports.emoji = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\u200D/u;
6401
6485
  exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, exports.emoji.source), '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))+/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu')), ([{
6402
6486
  value
6403
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6487
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![_.-]?[0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 8 /* Backtrack.unescapable */], ([, [{
6404
6488
  value
6405
- }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(`/hashtags/${value}`)]), context), {
6489
+ }]], context) => new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Node(`#${value}`)]), new parser_1.List([new parser_1.Node(`/hashtags/${value}`)]), context), {
6406
6490
  class: 'hashtag'
6407
6491
  }))])))));
6408
6492
 
@@ -6425,7 +6509,7 @@ const link_1 = __webpack_require__(3628);
6425
6509
  const source_1 = __webpack_require__(8745);
6426
6510
  exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6427
6511
  context
6428
- }) => new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6512
+ }) => new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6429
6513
  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 */, ({
6430
6514
  context
6431
6515
  }) => {
@@ -6434,7 +6518,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
6434
6518
  position
6435
6519
  } = context;
6436
6520
  context.position -= source[0] === '!' ? 1 : 0;
6437
- return new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(source.slice(position))]), context))]);
6521
+ return new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(source.slice(position))]), context))]);
6438
6522
  })), (0, source_1.str)(/[^:]+/y)])])));
6439
6523
  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, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (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, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (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, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (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, [3 | 8 /* Backtrack.unescapable */], undefined, () => new parser_1.List())]));
6440
6524
 
@@ -6487,51 +6571,68 @@ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6487
6571
  const {
6488
6572
  source,
6489
6573
  position,
6490
- range = 0
6574
+ range
6491
6575
  } = context;
6492
6576
  const head = position - range;
6493
- if (context.linebreak !== 0 || source[position - 2] !== ')' || source[head + 1] !== '(') {
6494
- (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6577
+ if (context.linebreak !== 0) {
6578
+ if (head > 0 && source[head - 1] === '(') {
6579
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
6580
+ }
6581
+ } else if (source[position] !== ')' && source[head - 1] === '(') {
6582
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
6495
6583
  }
6496
6584
  const str = source.slice(position - range + 1, position - 1);
6497
- 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', {
6585
+ return indexA.test(str) ? new parser_1.List([new parser_1.Node(as.head.value), new parser_1.Node(str), new parser_1.Node(cs.head.value)]) : new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6498
6586
  class: 'paren'
6499
6587
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6500
6588
  }, ([as, bs = new parser_1.List()], context) => {
6501
6589
  const {
6502
6590
  source,
6503
6591
  position,
6504
- range = 0
6592
+ range
6505
6593
  } = context;
6506
- const head = position - range;
6507
- if (context.linebreak !== 0 || source[head + 1] !== '(') {
6508
- (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6509
- }
6510
- return as.import(bs);
6594
+ const str = source.slice(position - range + 1, position);
6595
+ return indexA.test(str) ? new parser_1.List([new parser_1.Node(as.head.value), new parser_1.Node(str)]) : new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6596
+ class: 'paren'
6597
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))]);
6511
6598
  }));
6512
6599
  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], {
6513
6600
  source,
6514
6601
  position,
6515
- range = 0
6602
+ range
6516
6603
  }) => {
6517
6604
  const str = source.slice(position - range + 1, position - 1);
6518
- 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', {
6605
+ return indexF.test(str) ? new parser_1.List([new parser_1.Node(as.head.value), new parser_1.Node(str), new parser_1.Node(cs.head.value)]) : new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6519
6606
  class: 'paren'
6520
6607
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6521
- }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6608
+ }, ([as, bs = new parser_1.List()], context) => {
6609
+ const {
6610
+ source,
6611
+ position,
6612
+ range
6613
+ } = context;
6614
+ const str = source.slice(position - range + 1, position);
6615
+ return indexF.test(str) ? new parser_1.List([new parser_1.Node(as.head.value), new parser_1.Node(str)]) : new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6616
+ class: 'paren'
6617
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))]);
6618
+ }));
6522
6619
  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, [2 | 4 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
6523
- if (context.state & 8 /* State.link */) {
6524
- const {
6525
- source,
6526
- position,
6527
- range = 0
6528
- } = context;
6529
- const head = position - range;
6530
- if (context.linebreak !== 0 || source[position - 2] !== ']' || source[head + 1] !== '[') {
6531
- (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head);
6620
+ const {
6621
+ source,
6622
+ position,
6623
+ range
6624
+ } = context;
6625
+ const head = position - range;
6626
+ if (context.linebreak !== 0) {
6627
+ if (head > 0 && source[head - 1] === '[') {
6628
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
6532
6629
  }
6630
+ } else if (source[position] !== ']' && source[head - 1] === '[') {
6631
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */, head - 1);
6632
+ }
6633
+ if (context.state & 8 /* State.link */) {
6533
6634
  if (context.linebreak !== 0) {
6534
- (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */ | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
6635
+ (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
6535
6636
  } else if (source[position] !== '{') {
6536
6637
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6537
6638
  } else {
@@ -6572,12 +6673,12 @@ const parser_1 = __webpack_require__(605);
6572
6673
  const combinator_1 = __webpack_require__(3484);
6573
6674
  const util_1 = __webpack_require__(4992);
6574
6675
  const dom_1 = __webpack_require__(394);
6575
- exports.code = (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', {
6676
+ exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6576
6677
  'data-src': whole
6577
- }, format(body)))]) : body ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6678
+ }, format(body)))]) : body ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6578
6679
  class: 'invalid',
6579
6680
  ...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
6580
- }, whole))]) : new parser_1.List([new parser_1.Data(opener)]));
6681
+ }, whole))]) : new parser_1.List([new parser_1.Node(opener)]));
6581
6682
  function format(text) {
6582
6683
  return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
6583
6684
  }
@@ -6604,7 +6705,7 @@ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
6604
6705
  buffer
6605
6706
  }) => buffer.import(bs), ([, bs], {
6606
6707
  buffer
6607
- }) => 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))))]))));
6708
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
6608
6709
 
6609
6710
  /***/ },
6610
6711
 
@@ -6626,7 +6727,7 @@ const source_1 = __webpack_require__(8745);
6626
6727
  const visibility_1 = __webpack_require__(6364);
6627
6728
  const util_1 = __webpack_require__(4992);
6628
6729
  const dom_1 = __webpack_require__(394);
6629
- 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)));
6730
+ 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.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
6630
6731
 
6631
6732
  /***/ },
6632
6733
 
@@ -6656,7 +6757,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6656
6757
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6657
6758
  exports.emstrong = (0, combinator_1.lazy)(() => (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) => {
6658
6759
  const {
6659
- buffer = new parser_1.List()
6760
+ buffer
6660
6761
  } = context;
6661
6762
  switch (cs.head.value) {
6662
6763
  case '***':
@@ -6668,18 +6769,18 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
6668
6769
  } = context;
6669
6770
  if (source.startsWith('*', context.position)) {
6670
6771
  context.position += 1;
6671
- buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6772
+ buffer.push(new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6672
6773
  buffer.import(ds);
6673
- 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 */)]);
6774
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Node("\u001F" /* Command.Separator */)]);
6674
6775
  } else {
6675
- buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6776
+ buffer.push(new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6676
6777
  buffer.import(ds);
6677
- buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6778
+ buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
6678
6779
  return prepend('*', buffer);
6679
6780
  }
6680
6781
  })({
6681
6782
  context
6682
- }) ?? 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 */)])));
6783
+ }) ?? prepend('*', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
6683
6784
  case '*':
6684
6785
  return (0, combinator_1.bind)(substrong, ds => {
6685
6786
  const {
@@ -6687,34 +6788,34 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
6687
6788
  } = context;
6688
6789
  if (source.startsWith('**', context.position)) {
6689
6790
  context.position += 2;
6690
- buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6791
+ buffer.push(new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6691
6792
  buffer.import(ds);
6692
- 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 */)]);
6793
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Node("\u001F" /* Command.Separator */)]);
6693
6794
  } else {
6694
- buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6795
+ buffer.push(new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6695
6796
  buffer.import(ds);
6696
- buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6797
+ buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
6697
6798
  return prepend('**', buffer);
6698
6799
  }
6699
6800
  })({
6700
6801
  context
6701
- }) ?? 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 */)])));
6802
+ }) ?? prepend('**', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
6702
6803
  }
6703
6804
  }, ([, bs], {
6704
6805
  buffer
6705
- }) => bs && buffer.import(bs) && buffer.push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer),
6806
+ }) => bs && buffer.import(bs) && buffer.push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer),
6706
6807
  // 3以上の`*`に対してemの適用を保証する
6707
- 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) => {
6808
+ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)))]))]), (nodes, context, prefix, postfix, state) => {
6708
6809
  context.position += postfix;
6709
6810
  if (state) {
6710
6811
  switch (postfix) {
6711
6812
  case 0:
6712
6813
  break;
6713
6814
  case 1:
6714
- nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6815
+ nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6715
6816
  break;
6716
6817
  case 2:
6717
- nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6818
+ nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6718
6819
  break;
6719
6820
  default:
6720
6821
  }
@@ -6730,7 +6831,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
6730
6831
  } = context;
6731
6832
  if (source.startsWith('*', context.position)) {
6732
6833
  context.position += 1;
6733
- 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)))))]);
6834
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
6734
6835
  } else {
6735
6836
  return prepend('*', nodes.import(ds));
6736
6837
  }
@@ -6746,7 +6847,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
6746
6847
  } = context;
6747
6848
  if (source.startsWith('**', context.position)) {
6748
6849
  context.position += 2;
6749
- 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)))))]);
6850
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
6750
6851
  } else {
6751
6852
  return prepend('**', nodes.import(ds));
6752
6853
  }
@@ -6766,7 +6867,7 @@ function prepend(prefix, nodes) {
6766
6867
  if (typeof nodes.head?.value === 'string') {
6767
6868
  nodes.head.value = prefix + nodes.head.value;
6768
6869
  } else {
6769
- nodes.unshift(new parser_1.Data(prefix));
6870
+ nodes.unshift(new parser_1.Node(prefix));
6770
6871
  }
6771
6872
  return nodes;
6772
6873
  }
@@ -6810,12 +6911,12 @@ const source_1 = __webpack_require__(8745);
6810
6911
  const visibility_1 = __webpack_require__(6364);
6811
6912
  const util_1 = __webpack_require__(4992);
6812
6913
  const dom_1 = __webpack_require__(394);
6813
- 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, [3 | 4 /* Backtrack.common */], ([, 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', {
6914
+ 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, [3 | 4 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
6814
6915
  'data-index': dataindex(bs)
6815
6916
  }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
6816
6917
  if (ns.length === 1) {
6817
6918
  const el = ns.head.value;
6818
- return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
6919
+ return new parser_1.List([new parser_1.Node((0, dom_1.define)(el, {
6819
6920
  id: el.id ? null : undefined,
6820
6921
  class: 'index',
6821
6922
  href: el.id ? `#${el.id}` : undefined
@@ -6829,7 +6930,7 @@ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|',
6829
6930
  const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6830
6931
  value
6831
6932
  }) => acc + value, ''))?.slice(7);
6832
- return index && context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6933
+ return index && context.linebreak === 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6833
6934
  class: 'indexer',
6834
6935
  'data-index': index
6835
6936
  }))]) : undefined;
@@ -6866,7 +6967,7 @@ const dom_1 = __webpack_require__(394);
6866
6967
  function indexee(parser) {
6867
6968
  return (0, combinator_1.fmap)(parser, (ns, {
6868
6969
  id
6869
- }) => ns.length === 1 ? new parser_1.List([new parser_1.Data((0, dom_1.define)(ns.head.value, {
6970
+ }) => ns.length === 1 ? new parser_1.List([new parser_1.Node((0, dom_1.define)(ns.head.value, {
6870
6971
  id: identity('index', id, ns.head.value),
6871
6972
  'data-index': null
6872
6973
  }))]) : ns);
@@ -7007,7 +7108,7 @@ const dom_1 = __webpack_require__(394);
7007
7108
  // 複合生成インデクスを手動で同期させるより最初から重複のない
7008
7109
  // テキストまたはインデクスを付けて同期が必要な機会を減らすのが
7009
7110
  // 継続的編集において最も簡便となる。
7010
- exports.indexer = (0, combinator_1.surround)(/ \[(?=\|\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', {
7111
+ exports.indexer = (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7011
7112
  class: 'indexer',
7012
7113
  'data-index': ''
7013
7114
  }))]))]), /\][^\S\n]*(?:$|\n)/y);
@@ -7032,7 +7133,7 @@ const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:
7032
7133
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
7033
7134
  exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 4 /* Backtrack.common */]), body]), ([{
7034
7135
  value
7035
- }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
7136
+ }]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
7036
7137
  class: 'label',
7037
7138
  'data-label': value.slice(value[1] === '-' ? 0 : 1).toLowerCase()
7038
7139
  }, value))])));
@@ -7077,7 +7178,7 @@ const dom_1 = __webpack_require__(394);
7077
7178
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7078
7179
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7079
7180
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
7080
- (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, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7181
+ (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, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7081
7182
  class: 'invalid',
7082
7183
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7083
7184
  }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
@@ -7113,14 +7214,14 @@ Object.setPrototypeOf(attrspecs, null);
7113
7214
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
7114
7215
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
7115
7216
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
7116
- (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (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('|')})(?=[ >])`, '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)),
7217
+ (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (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.Node(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.Node(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('|')})(?=[ >])`, '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)),
7117
7218
  // 不可視のHTML構造が可視構造を変化させるべきでない。
7118
7219
  // 可視のHTMLは優先度変更を検討する。
7119
7220
  // このため<>は将来的に共通構造を変化させる可能性があり
7120
7221
  // 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
7121
- (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)(
7222
+ (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.Node(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.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
7122
7223
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
7123
- (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))]))])));
7224
+ (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.Node(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.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))])));
7124
7225
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
7125
7226
  function elem(tag, content, as, bs, cs, context) {
7126
7227
  if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
@@ -7191,10 +7292,10 @@ const combinator_1 = __webpack_require__(3484);
7191
7292
  const source_1 = __webpack_require__(8745);
7192
7293
  const util_1 = __webpack_require__(4992);
7193
7294
  const dom_1 = __webpack_require__(394);
7194
- exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 8 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7295
+ exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 8 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Node(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Node(as.head.value + (bs?.head?.value ?? ''))]));
7195
7296
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7196
7297
  value
7197
- }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
7298
+ }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Node(value) : new parser_1.Node((0, dom_1.html)('span', {
7198
7299
  class: 'invalid',
7199
7300
  ...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
7200
7301
  }, value))]));
@@ -7226,7 +7327,7 @@ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
7226
7327
  buffer
7227
7328
  }) => buffer.import(bs), ([, bs], {
7228
7329
  buffer
7229
- }) => 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))))]))));
7330
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
7230
7331
 
7231
7332
  /***/ },
7232
7333
 
@@ -7253,7 +7354,7 @@ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0
7253
7354
  buffer
7254
7355
  }) => buffer.import(bs), ([, bs], {
7255
7356
  buffer
7256
- }) => 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))))]))));
7357
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
7257
7358
 
7258
7359
  /***/ },
7259
7360
 
@@ -7285,11 +7386,11 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7285
7386
  const head = context.position - context.range;
7286
7387
  return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
7287
7388
  }
7288
- return ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns;
7389
+ return ns.push(new parser_1.Node("\u001F" /* Command.Separator */)) && ns;
7289
7390
  })),
7290
7391
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
7291
7392
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
7292
- (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]) => bs && as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as))]), ([{
7393
+ (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]) => bs && as.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && as))]), ([{
7293
7394
  value: content
7294
7395
  }, {
7295
7396
  value: params = undefined
@@ -7306,21 +7407,21 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7306
7407
  }
7307
7408
  if (params.last.value === "\u0018" /* Command.Cancel */) {
7308
7409
  params.pop();
7309
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7410
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7310
7411
  class: 'invalid',
7311
7412
  ...(0, util_1.invalid)('link', 'syntax', 'Missing the closing symbol "}"')
7312
7413
  }, context.source.slice(context.position - context.range, context.position)))]);
7313
7414
  }
7314
7415
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
7315
- return new parser_1.List([new parser_1.Data(parse(content, params, context))]);
7416
+ return new parser_1.List([new parser_1.Node(parse(content, params, context))]);
7316
7417
  })))));
7317
7418
  exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (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))]), ([{
7318
7419
  value: content
7319
7420
  }, {
7320
7421
  value: params
7321
- }], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))])))));
7422
+ }], context) => new parser_1.List([new parser_1.Node(parse(content, params, context))])))));
7322
7423
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
7323
- 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)]);
7424
+ exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Node(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7324
7425
  function parse(content, params, context) {
7325
7426
  const INSECURE_URI = params.shift().value;
7326
7427
  (0, combinator_1.consume)(10, context);
@@ -7433,16 +7534,16 @@ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /*
7433
7534
  buffer
7434
7535
  }) => buffer.import(bs), ([, bs], {
7435
7536
  buffer
7436
- }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
7537
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
7437
7538
  id
7438
7539
  }) => {
7439
7540
  const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
7440
7541
  (0, dom_1.define)(el, {
7441
7542
  id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
7442
7543
  });
7443
- return el.id ? new parser_1.List([new parser_1.Data(el), new parser_1.Data((0, dom_1.html)('a', {
7544
+ return el.id ? new parser_1.List([new parser_1.Node(el), new parser_1.Node((0, dom_1.html)('a', {
7444
7545
  href: `#${el.id}`
7445
- }))]) : new parser_1.List([new parser_1.Data(el)]);
7546
+ }))]) : new parser_1.List([new parser_1.Node(el)]);
7446
7547
  })))));
7447
7548
 
7448
7549
  /***/ },
@@ -7470,7 +7571,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7470
7571
  math: cache
7471
7572
  } = {}
7472
7573
  }
7473
- }) => new parser_1.List([new parser_1.Data(cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7574
+ }) => new parser_1.List([new parser_1.Node(cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7474
7575
  class: 'math',
7475
7576
  translate: 'no',
7476
7577
  'data-src': source
@@ -7515,7 +7616,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7515
7616
  return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
7516
7617
  }
7517
7618
  return ns;
7518
- })), (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]) => bs && as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as))]), 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, {
7619
+ })), (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]) => bs && as.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && as))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Node(new parser_1.List([new parser_1.Node(nodes.head.value.foldl((acc, {
7519
7620
  value
7520
7621
  }) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
7521
7622
  value: [{
@@ -7529,7 +7630,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7529
7630
  (0, combinator_1.consume)(100, context);
7530
7631
  if (params.last.value === "\u0018" /* Command.Cancel */) {
7531
7632
  params.pop();
7532
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7633
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7533
7634
  class: 'invalid',
7534
7635
  ...(0, util_1.invalid)('media', 'syntax', 'Missing the closing symbol "}"')
7535
7636
  }, '!' + context.source.slice(context.position - context.range, context.position)))]);
@@ -7547,16 +7648,16 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7547
7648
  'data-src': uri?.source
7548
7649
  });
7549
7650
  el.setAttribute('alt', text);
7550
- if (!sanitize(el, uri)) return new parser_1.List([new parser_1.Data(el)]);
7651
+ if (!sanitize(el, uri)) return new parser_1.List([new parser_1.Node(el)]);
7551
7652
  const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, (0, util_1.unwrap)(params));
7552
7653
  (0, dom_1.define)(el, attrs);
7553
7654
  // Awaiting the generic support for attr().
7554
7655
  if (el.hasAttribute('aspect-ratio')) {
7555
7656
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
7556
7657
  }
7557
- if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Data(el)]);
7558
- if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.Data(el)]);
7559
- return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List(), linkparams.reduce((acc, p) => acc.push(new parser_1.Data(p)) && acc, new parser_1.List([new parser_1.Data(INSECURE_URI)])), context), {
7658
+ if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Node(el)]);
7659
+ if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.Node(el)]);
7660
+ return new parser_1.List([new parser_1.Node((0, dom_1.define)((0, link_1.parse)(new parser_1.List(), linkparams.reduce((acc, p) => acc.push(new parser_1.Node(p)) && acc, new parser_1.List([new parser_1.Node(INSECURE_URI)])), context), {
7560
7661
  class: null,
7561
7662
  target: '_blank'
7562
7663
  }, [el]))]);
@@ -7568,7 +7669,7 @@ const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combina
7568
7669
  value: b
7569
7670
  }], [{
7570
7671
  value: c
7571
- }]]) => 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]));
7672
+ }]]) => b === 'x' ? new parser_1.List([new parser_1.Node(`width="${a}"`), new parser_1.Node(`height="${c}"`)]) : new parser_1.List([new parser_1.Node(`aspect-ratio="${a}/${c}"`)])), link_1.option]));
7572
7673
  function sanitize(target, uri) {
7573
7674
  let type;
7574
7675
  let message;
@@ -7618,78 +7719,50 @@ const dom_1 = __webpack_require__(394);
7618
7719
  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, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => {
7619
7720
  const {
7620
7721
  position,
7621
- range = 0,
7622
- linebreak = 0
7722
+ range,
7723
+ linebreak
7623
7724
  } = context;
7624
7725
  if (linebreak === 0) {
7625
- 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))))]))]);
7726
+ return new parser_1.List([new parser_1.Node((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))))]))]);
7626
7727
  } else {
7627
7728
  const head = position - range;
7628
7729
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head, 2);
7629
7730
  }
7630
- }, ([as, bs], context) => {
7631
- if (!bs) return;
7731
+ }, (_, context) => {
7632
7732
  const {
7633
7733
  source,
7634
7734
  position,
7635
- range = 0,
7636
- linebreak = 0,
7637
- state = 0
7735
+ range,
7736
+ linebreak
7638
7737
  } = context;
7639
7738
  const head = position - range;
7640
7739
  if (source[position] !== ']') {
7641
7740
  (0, combinator_1.setBacktrack)(context, 2 | 4 /* Backtrack.common */, head, 2);
7642
7741
  } else if (linebreak !== 0) {
7643
- (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head, 2);
7742
+ (0, combinator_1.setBacktrack)(context, 2 | 128 /* Backtrack.doublebracket */ | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head, 2);
7644
7743
  } else {
7645
- if (state & 128 /* State.annotation */) {
7646
- bs.push(new parser_1.Data(source[position]));
7647
- }
7648
7744
  context.position += 1;
7649
- let result;
7650
- if (source[context.position] !== '{') {
7745
+ if (source[context.position] !== '{' || (0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) || !(0, link_1.textlink)({
7746
+ context
7747
+ })) {
7651
7748
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
7652
- result = new parser_1.List();
7653
- } else {
7654
- result = !(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) ? (0, link_1.textlink)({
7655
- context
7656
- }) : undefined;
7657
- context.range = range;
7658
- if (!result) {
7659
- (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
7660
- result = new parser_1.List();
7661
- }
7662
- }
7663
- if (context.position === source.length) {
7664
- (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7665
- } else {
7666
- 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()]) => {
7667
- (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
7668
- return cs;
7669
- })({
7670
- context
7671
- });
7672
- if (state & 128 /* State.annotation */ && next) {
7673
- return as.import(bs).import(result).import(next);
7674
- }
7675
7749
  }
7676
7750
  context.position = position;
7677
7751
  }
7678
- return state & 128 /* State.annotation */ ? as.import(bs) : undefined;
7679
7752
  })));
7680
7753
  // Chicago-Style
7681
7754
  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) => {
7682
7755
  const {
7683
7756
  source,
7684
7757
  position,
7685
- range = 0
7758
+ range
7686
7759
  } = context;
7687
- 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))]);
7760
+ if (!ns) return new parser_1.List([new parser_1.Node(''), new parser_1.Node(source.slice(position - range, source[position - 1] === '|' ? position - 1 : position))]);
7688
7761
  context.position += source[position] === ' ' ? 1 : 0;
7689
- return new parser_1.List([new parser_1.Data("\u001F" /* Command.Separator */), new parser_1.Data(ns.head.value.trimEnd())]);
7762
+ return new parser_1.List([new parser_1.Node("\u001F" /* Command.Separator */), new parser_1.Node(ns.head.value.trimEnd())]);
7690
7763
  }, (_, context) => {
7691
7764
  context.position -= context.range;
7692
- return new parser_1.List([new parser_1.Data('')]);
7765
+ return new parser_1.List([new parser_1.Node('')]);
7693
7766
  });
7694
7767
  function attributes(ns) {
7695
7768
  switch (ns.head.value) {
@@ -7730,7 +7803,7 @@ const inline_1 = __webpack_require__(7973);
7730
7803
  const source_1 = __webpack_require__(8745);
7731
7804
  const util_1 = __webpack_require__(4992);
7732
7805
  const dom_1 = __webpack_require__(394);
7733
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/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', {
7806
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/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.Node((0, dom_1.html)('span', {
7734
7807
  class: 'remark'
7735
7808
  }, [(0, dom_1.html)('input', {
7736
7809
  type: 'checkbox'
@@ -7738,7 +7811,7 @@ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, com
7738
7811
  context: {
7739
7812
  source
7740
7813
  }
7741
- }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7814
+ }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7742
7815
  class: 'invalid',
7743
7816
  ...(0, util_1.invalid)('remark', 'syntax', 'Invalid start symbol')
7744
7817
  }, source))]))));
@@ -7776,23 +7849,23 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
7776
7849
  }
7777
7850
  switch (true) {
7778
7851
  case texts.length >= rubies.length:
7779
- 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, [{
7852
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)([...zip(texts, rubies)].reduce((acc, [{
7780
7853
  value: text = ''
7781
7854
  } = {}, {
7782
7855
  value: ruby = ''
7783
- } = {}]) => 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())))))]);
7856
+ } = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', ruby)), new parser_1.Node((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
7784
7857
  case texts.length === 1 && [...texts.head.value].length >= rubies.length:
7785
- 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, [{
7858
+ return new parser_1.List([new parser_1.Node((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.Node(char))), rubies)].reduce((acc, [{
7786
7859
  value: text = ''
7787
7860
  } = {}, {
7788
7861
  value: ruby = ''
7789
- } = {}]) => 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())))))]);
7862
+ } = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', ruby)), new parser_1.Node((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
7790
7863
  default:
7791
- 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(({
7864
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)(new parser_1.List([new parser_1.Node(texts.foldr(({
7792
7865
  value
7793
- }, 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(({
7866
+ }, acc) => value + ' ' + acc, '').slice(0, -1)), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', rubies.foldr(({
7794
7867
  value
7795
- }, acc) => value + ' ' + acc, '').trim())), new parser_1.Data((0, dom_1.html)('rp', ')'))])))))]);
7868
+ }, acc) => value + ' ' + acc, '').trim())), new parser_1.Node((0, dom_1.html)('rp', ')'))])))))]);
7796
7869
  }
7797
7870
  }));
7798
7871
  const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
@@ -7803,7 +7876,7 @@ const text = input => {
7803
7876
  const {
7804
7877
  source
7805
7878
  } = context;
7806
- const acc = new parser_1.List([new parser_1.Data('')]);
7879
+ const acc = new parser_1.List([new parser_1.Node('')]);
7807
7880
  let state = false;
7808
7881
  context.sequential = true;
7809
7882
  for (let {
@@ -7822,7 +7895,7 @@ const text = input => {
7822
7895
  {
7823
7896
  if (source[position].trimStart() === '') {
7824
7897
  state ||= acc.last.value.trimStart() !== '';
7825
- acc.push(new parser_1.Data(''));
7898
+ acc.push(new parser_1.Node(''));
7826
7899
  context.position += 1;
7827
7900
  continue;
7828
7901
  }
@@ -7885,7 +7958,7 @@ const source_1 = __webpack_require__(8745);
7885
7958
  const visibility_1 = __webpack_require__(6364);
7886
7959
  const util_1 = __webpack_require__(4992);
7887
7960
  const dom_1 = __webpack_require__(394);
7888
- 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)));
7961
+ 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.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
7889
7962
 
7890
7963
  /***/ },
7891
7964
 
@@ -7904,9 +7977,9 @@ const combinator_1 = __webpack_require__(3484);
7904
7977
  const source_1 = __webpack_require__(8745);
7905
7978
  const util_1 = __webpack_require__(4992);
7906
7979
  const dom_1 = __webpack_require__(394);
7907
- 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', {
7980
+ 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.Node((0, dom_1.html)('span', {
7908
7981
  class: 'template'
7909
- }, (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', {
7982
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7910
7983
  class: 'invalid',
7911
7984
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7912
7985
  }, context.source.slice(context.position - context.range, context.position)))])));
@@ -8231,6 +8304,7 @@ Object.defineProperty(exports, "__esModule", ({
8231
8304
  value: true
8232
8305
  }));
8233
8306
  exports.validate = exports.segment = exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE = void 0;
8307
+ const context_1 = __webpack_require__(8669);
8234
8308
  const combinator_1 = __webpack_require__(3484);
8235
8309
  const heading_1 = __webpack_require__(2778);
8236
8310
  const codeblock_1 = __webpack_require__(9194);
@@ -8269,10 +8343,10 @@ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptylin
8269
8343
  function* segment(source) {
8270
8344
  if (!validate(source, exports.MAX_INPUT_SIZE)) return yield `${"\u0007" /* Command.Error */}Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`;
8271
8345
  for (let position = 0; position < source.length;) {
8272
- const context = {
8346
+ const context = new context_1.Context({
8273
8347
  source,
8274
8348
  position
8275
- };
8349
+ });
8276
8350
  const result = parser({
8277
8351
  context
8278
8352
  });
@@ -8396,31 +8470,31 @@ const escsource = ({
8396
8470
  case "\u001B" /* Command.Escape */:
8397
8471
  (0, combinator_1.consume)(1, context);
8398
8472
  context.position += 1;
8399
- return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8473
+ return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
8400
8474
  case '\\':
8401
8475
  switch (source[position + 1]) {
8402
8476
  case undefined:
8403
- return new parser_1.List([new parser_1.Data(char)]);
8477
+ return new parser_1.List([new parser_1.Node(char)]);
8404
8478
  case '\n':
8405
- return new parser_1.List([new parser_1.Data(char)]);
8479
+ return new parser_1.List([new parser_1.Node(char)]);
8406
8480
  default:
8407
8481
  (0, combinator_1.consume)(1, context);
8408
8482
  context.position += 1;
8409
- return new parser_1.List([new parser_1.Data(source.slice(position, position + 2))]);
8483
+ return new parser_1.List([new parser_1.Node(source.slice(position, position + 2))]);
8410
8484
  }
8411
8485
  case '\r':
8412
8486
  (0, combinator_1.consume)(-1, context);
8413
8487
  return new parser_1.List();
8414
8488
  case '\n':
8415
8489
  context.linebreak ||= source.length - position;
8416
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8490
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
8417
8491
  default:
8418
- if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8492
+ if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
8419
8493
  let i = (0, text_1.next)(source, position, delimiter);
8420
8494
  i -= position;
8421
8495
  (0, combinator_1.consume)(i - 1, context);
8422
8496
  context.position += i - 1;
8423
- return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8497
+ return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
8424
8498
  }
8425
8499
  };
8426
8500
  exports.escsource = escsource;
@@ -8520,7 +8594,7 @@ function strs(pattern) {
8520
8594
  acc += pattern;
8521
8595
  context.position += pattern.length;
8522
8596
  }
8523
- return new parser_1.List([new parser_1.Data(acc)]);
8597
+ return new parser_1.List([new parser_1.Node(acc)]);
8524
8598
  };
8525
8599
  }
8526
8600
  exports.strs = strs;
@@ -8565,16 +8639,16 @@ const text = input => {
8565
8639
  default:
8566
8640
  (0, combinator_1.consume)(1, context);
8567
8641
  context.position += 1;
8568
- return new parser_1.List([new parser_1.Data(source.slice(position + 1, context.position))]);
8642
+ return new parser_1.List([new parser_1.Node(source.slice(position + 1, context.position))]);
8569
8643
  }
8570
8644
  case '\r':
8571
8645
  (0, combinator_1.consume)(-1, context);
8572
8646
  return new parser_1.List();
8573
8647
  case '\n':
8574
8648
  context.linebreak ||= source.length - position;
8575
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8649
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
8576
8650
  default:
8577
- if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8651
+ if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
8578
8652
  exports.nonWhitespace.lastIndex = position + 1;
8579
8653
  const s = canSkip(source, position);
8580
8654
  let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
@@ -8584,7 +8658,7 @@ const text = input => {
8584
8658
  (0, combinator_1.consume)(i - 1, context);
8585
8659
  context.position += i - 1;
8586
8660
  const linestart = position === 0 || source[position - 1] === '\n';
8587
- return position === context.position || s && !linestart || lineend ? new parser_1.List() : new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8661
+ return position === context.position || s && !linestart || lineend ? new parser_1.List() : new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
8588
8662
  }
8589
8663
  };
8590
8664
  exports.text = text;
@@ -8668,7 +8742,7 @@ function backToUrlHead(source, position, index) {
8668
8742
  }
8669
8743
  break;
8670
8744
  }
8671
- return index === position ? delim : index;
8745
+ return index === position || source[index] !== 'h' ? delim : index;
8672
8746
  }
8673
8747
  exports.backToUrlHead = backToUrlHead;
8674
8748
  function backToEmailHead(source, position, index) {
@@ -8843,20 +8917,20 @@ const unescsource = ({
8843
8917
  case "\u001B" /* Command.Escape */:
8844
8918
  (0, combinator_1.consume)(1, context);
8845
8919
  context.position += 1;
8846
- return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8920
+ return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
8847
8921
  case '\r':
8848
8922
  return new parser_1.List();
8849
8923
  case '\n':
8850
8924
  context.linebreak ||= source.length - position;
8851
- return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8925
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
8852
8926
  default:
8853
- if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8927
+ if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
8854
8928
  text_1.nonWhitespace.lastIndex = position + 1;
8855
8929
  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);
8856
8930
  i -= position;
8857
8931
  (0, combinator_1.consume)(i - 1, context);
8858
8932
  context.position += i - 1;
8859
- return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8933
+ return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
8860
8934
  }
8861
8935
  };
8862
8936
  exports.unescsource = unescsource;
@@ -8873,8 +8947,8 @@ Object.defineProperty(exports, "__esModule", ({
8873
8947
  value: true
8874
8948
  }));
8875
8949
  exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
8876
- const alias_1 = __webpack_require__(5413);
8877
8950
  const parser_1 = __webpack_require__(605);
8951
+ const alias_1 = __webpack_require__(5413);
8878
8952
  const dom_1 = __webpack_require__(394);
8879
8953
  function* unwrap(nodes) {
8880
8954
  if (nodes === undefined) return;
@@ -8886,7 +8960,7 @@ exports.unwrap = unwrap;
8886
8960
  function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
8887
8961
  const acc = new parser_1.List();
8888
8962
  if (prefix > 0) {
8889
- acc.push(new parser_1.Data(symbol[0].repeat(prefix)));
8963
+ acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
8890
8964
  }
8891
8965
  acc.import(nodes);
8892
8966
  if (postfix > 0) {
@@ -8894,7 +8968,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8894
8968
  source,
8895
8969
  position
8896
8970
  } = context;
8897
- acc.push(new parser_1.Data(source.slice(position, position + postfix)));
8971
+ acc.push(new parser_1.Node(source.slice(position, position + postfix)));
8898
8972
  context.position += postfix;
8899
8973
  }
8900
8974
  return acc;
@@ -9633,11 +9707,12 @@ Object.defineProperty(exports, "__esModule", ({
9633
9707
  }));
9634
9708
  exports.quote = void 0;
9635
9709
  const parser_1 = __webpack_require__(605);
9710
+ const context_1 = __webpack_require__(8669);
9636
9711
  const cite_1 = __webpack_require__(1200);
9637
9712
  function quote(anchor, range) {
9638
9713
  const {
9639
9714
  context
9640
- } = (0, parser_1.input)('', {});
9715
+ } = (0, parser_1.input)('', new context_1.Context());
9641
9716
  (0, cite_1.cite)((0, parser_1.input)(`>>${anchor}`, context));
9642
9717
  if (context.position !== context.source.length) throw new Error(`Invalid anchor: ${anchor}`);
9643
9718
  fit(range);