securemark 0.298.6 → 0.298.7

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.298.7
4
+
5
+ - Fix annotation parser.
6
+
3
7
  ## 0.298.6
4
8
 
5
9
  - Refactoring.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.298.6 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.298.7 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"));
@@ -6063,7 +6063,7 @@ class Context extends parser_1.Context {
6063
6063
  this.resources ??= {
6064
6064
  // バックトラックのせいで文字数制限を受けないようにする。
6065
6065
  clock: exports.MAX_SEGMENT_SIZE * (6 + 1),
6066
- recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.annotation */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
6066
+ recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
6067
6067
  };
6068
6068
  this.segment = segment ?? 0 /* Segment.unknown */;
6069
6069
  this.local = local ?? false;
@@ -6312,6 +6312,7 @@ const parser_1 = __webpack_require__(605);
6312
6312
  const combinator_1 = __webpack_require__(3484);
6313
6313
  const inline_1 = __webpack_require__(7973);
6314
6314
  const bracket_1 = __webpack_require__(4526);
6315
+ const repeat_1 = __webpack_require__(8019);
6315
6316
  const visibility_1 = __webpack_require__(6364);
6316
6317
  const util_1 = __webpack_require__(4992);
6317
6318
  const dom_1 = __webpack_require__(394);
@@ -6330,121 +6331,38 @@ const dom_1 = __webpack_require__(394);
6330
6331
  // 修正する必要があるためほぼ完全な二重処理が必要になり三重以上の注釈という不適切な使用のために
6331
6332
  // 常に非常に非効率な処理を行い常時低速化するより三重以上の注釈を禁止して効率性を維持するのが妥当である。
6332
6333
  const MAX_DEPTH = 20;
6333
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)((0, combinator_1.open)('((', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursions)([4 /* Recursion.annotation */, 3 /* Recursion.inline */, 5 /* Recursion.bracket */, 5 /* Recursion.bracket */], (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]))), '))', false, [], ([, ns], context) => {
6334
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, repeat_1.repeat)('(', visibility_1.beforeNonblank, ')', [4 /* Recursion.bracket */], (0, combinator_1.precedence)(1, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]), ')', false, [], ([, bs], {
6335
+ buffer
6336
+ }) => buffer.import(bs), ([, bs], {
6337
+ buffer
6338
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), (nodes, context, lead, follow) => {
6334
6339
  const {
6335
6340
  linebreak,
6336
6341
  recursion,
6337
6342
  resources
6338
6343
  } = context;
6339
- if (linebreak !== 0) {
6340
- ns.unshift(new parser_1.Node('('));
6341
- ns.push(new parser_1.Node(')'));
6344
+ if (linebreak !== 0 || nodes.length === 0 || lead === 0 || follow % 2 === 0) {
6345
+ nodes.unshift(new parser_1.Node('('));
6346
+ nodes.push(new parser_1.Node(')'));
6342
6347
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6343
6348
  class: (0, bracket_1.bracketname)(context, 1, 1)
6344
- }, ['(', (0, dom_1.html)('span', {
6345
- class: (0, bracket_1.bracketname)(context, 2, 2)
6346
- }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))), ')']))]);
6349
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6347
6350
  }
6348
- const depth = MAX_DEPTH - (resources?.recursions[4 /* Recursion.annotation */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH);
6349
- recursion.add(depth);
6351
+ recursion.add(MAX_DEPTH - (resources?.recursions[4 /* Recursion.bracket */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH));
6352
+ context.position += 1;
6350
6353
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', {
6351
6354
  class: 'annotation'
6352
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
6353
- }, ([, bs], context) => {
6354
- const {
6355
- source,
6356
- position,
6357
- linebreak,
6358
- recursion,
6359
- resources
6360
- } = context;
6361
- const depth = MAX_DEPTH - (resources?.recursions[4 /* Recursion.annotation */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH);
6362
- if (linebreak === 0 && bs && bs.length === 1 && source[position] === ')' && typeof bs.head?.value === 'object') {
6363
- const {
6364
- className
6365
- } = bs.head.value;
6366
- if (className === 'paren' || className === 'bracket') {
6367
- const {
6368
- firstChild,
6369
- lastChild
6370
- } = bs.head.value;
6371
- if (firstChild.nodeValue.length === 1) {
6372
- firstChild.remove();
6373
- } else {
6374
- firstChild.nodeValue = firstChild.nodeValue.slice(1);
6375
- }
6376
- if (lastChild.nodeValue.length === 1) {
6377
- lastChild.remove();
6378
- } else {
6379
- lastChild.nodeValue = lastChild.nodeValue.slice(0, -1);
6380
- }
6381
- context.position += 1;
6382
- recursion.add(depth);
6383
- return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6384
- class: 'paren'
6385
- }, ['(', (0, dom_1.html)('sup', {
6386
- class: 'annotation'
6387
- }, [(0, dom_1.html)('span', bs.head.value.childNodes)])]))]);
6388
- }
6389
- if (className === 'annotation' && deepunwrap(bs)) {
6390
- context.position += 1;
6391
- recursion.add(depth);
6392
- return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6393
- class: 'paren'
6394
- }, ['(', (0, dom_1.html)('sup', {
6395
- class: 'annotation'
6396
- }, [(0, dom_1.html)('span', [bs.head.value])])]))]);
6397
- }
6398
- }
6399
- bs ??= new parser_1.List();
6400
- bs.unshift(new parser_1.Node('('));
6401
- if (source[context.position] === ')') {
6402
- bs.push(new parser_1.Node(')'));
6403
- context.position += 1;
6355
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(nodes))))]))]);
6356
+ }, (nodes, context, prefix, postfix) => {
6357
+ for (let i = 0; i < prefix; ++i) {
6358
+ nodes.unshift(new parser_1.Node('('));
6359
+ nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6360
+ class: (0, bracket_1.bracketname)(context, 1, 0)
6361
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6404
6362
  context.range += 1;
6405
6363
  }
6406
- bs = new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6407
- class: (0, bracket_1.bracketname)(context, 2, context.position - position)
6408
- }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
6409
- bs.unshift(new parser_1.Node('('));
6410
- const cs = parser(context);
6411
- if (source[context.position] === ')') {
6412
- cs && bs.import(cs);
6413
- bs.push(new parser_1.Node(')'));
6414
- context.position += 1;
6415
- context.range += 1;
6416
- }
6417
- return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6418
- class: (0, bracket_1.bracketname)(context, 1, context.position - position)
6419
- }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
6364
+ return nodes;
6420
6365
  })));
6421
- const parser = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]])));
6422
- function deepunwrap(list) {
6423
- let bottom = list.head.value;
6424
- for (; bottom;) {
6425
- const el = bottom.firstChild.firstChild;
6426
- if (el !== el?.parentNode?.lastChild) break;
6427
- if (el instanceof HTMLElement === false) break;
6428
- if (el?.className !== 'annotation') break;
6429
- bottom = el;
6430
- }
6431
- const el = bottom.firstChild.firstChild;
6432
- if (el instanceof Element === false) return false;
6433
- if (el === el?.parentNode?.lastChild) {
6434
- const {
6435
- className,
6436
- firstChild,
6437
- lastChild
6438
- } = el;
6439
- if (className === 'paren' || className === 'bracket') {
6440
- firstChild.nodeValue.length === 1 ? firstChild.remove() : firstChild.nodeValue = firstChild.nodeValue.slice(1);
6441
- lastChild.nodeValue.length === 1 ? lastChild.remove() : lastChild.nodeValue = lastChild.nodeValue.slice(0, -1);
6442
- el.replaceWith(...el.childNodes);
6443
- return true;
6444
- }
6445
- }
6446
- return false;
6447
- }
6448
6366
 
6449
6367
  /***/ },
6450
6368
 
@@ -6689,7 +6607,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
6689
6607
  context.position -= source[0] === '!' ? 1 : 0;
6690
6608
  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))]);
6691
6609
  })), (0, source_1.str)(/[^:]+/y)])])));
6692
- 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 */]), (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 */]), (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 */]), (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 */])]));
6610
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.unescapable */])]));
6693
6611
 
6694
6612
  /***/ },
6695
6613
 
@@ -6740,17 +6658,17 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6740
6658
  return d1(input);
6741
6659
  }
6742
6660
  }]));
6743
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6661
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6744
6662
  class: bracketname(context, 1, 1)
6745
6663
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6746
6664
  class: bracketname(context, 1, 0)
6747
6665
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
6748
- 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 = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6666
+ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6749
6667
  class: bracketname(context, 1, 1)
6750
6668
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6751
6669
  class: bracketname(context, 1, 0)
6752
6670
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
6753
- 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) => {
6671
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* 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) => {
6754
6672
  const {
6755
6673
  source,
6756
6674
  position,
@@ -6776,12 +6694,12 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6776
6694
  }
6777
6695
  return as.import(bs).import(cs);
6778
6696
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6779
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6780
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6781
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6697
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6698
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6699
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6782
6700
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6783
6701
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6784
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6702
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6785
6703
 
6786
6704
  /***/ },
6787
6705
 
@@ -6824,14 +6742,15 @@ exports.deletion = void 0;
6824
6742
  const parser_1 = __webpack_require__(605);
6825
6743
  const combinator_1 = __webpack_require__(3484);
6826
6744
  const inline_1 = __webpack_require__(7973);
6745
+ const repeat_1 = __webpack_require__(8019);
6827
6746
  const visibility_1 = __webpack_require__(6364);
6828
6747
  const util_1 = __webpack_require__(4992);
6829
6748
  const dom_1 = __webpack_require__(394);
6830
- exports.deletion = (0, combinator_1.lazy)(() => (0, util_1.repeat)('~~', '', (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
6749
+ exports.deletion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('~~', '', '~~', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
6831
6750
  buffer
6832
6751
  }) => buffer.import(bs), ([, bs], {
6833
6752
  buffer
6834
- }) => 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))))])));
6753
+ }) => 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))))])));
6835
6754
 
6836
6755
  /***/ },
6837
6756
 
@@ -6873,6 +6792,7 @@ const inline_1 = __webpack_require__(7973);
6873
6792
  const strong_1 = __webpack_require__(6591);
6874
6793
  const emphasis_1 = __webpack_require__(1354);
6875
6794
  const source_1 = __webpack_require__(8745);
6795
+ const repeat_1 = __webpack_require__(8019);
6876
6796
  const visibility_1 = __webpack_require__(6364);
6877
6797
  const util_1 = __webpack_require__(4992);
6878
6798
  const dom_1 = __webpack_require__(394);
@@ -6881,7 +6801,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6881
6801
  // 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
6882
6802
  // 可能な限り早く閉じるよう解析しなければならない。
6883
6803
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6884
- exports.emstrong = (0, combinator_1.lazy)(() => (0, util_1.repeat)('***', visibility_1.beforeNonblank, (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)])), (0, source_1.strs)('*', 1, 3), false, [], ([, bs, cs], context) => {
6804
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('***', visibility_1.beforeNonblank, '***', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)])), (0, source_1.strs)('*', 1, 3), false, [], ([, bs, cs], context) => {
6885
6805
  const {
6886
6806
  buffer
6887
6807
  } = context;
@@ -6925,10 +6845,11 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, util_1.repeat)('***', visibi
6925
6845
  }
6926
6846
  }, ([, bs], {
6927
6847
  buffer
6928
- }) => bs && buffer.import(bs) && buffer.push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer))),
6848
+ }) => bs && buffer.import(bs) && buffer.push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)),
6929
6849
  // 3以上の`*`に対してemの適用を保証する
6930
6850
  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) => {
6931
6851
  context.position += postfix;
6852
+ context.range += postfix;
6932
6853
  if (state) {
6933
6854
  switch (postfix) {
6934
6855
  case 0:
@@ -6943,6 +6864,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
6943
6864
  }
6944
6865
  prefix -= postfix;
6945
6866
  postfix -= postfix;
6867
+ context.range += postfix;
6946
6868
  switch (prefix) {
6947
6869
  case 0:
6948
6870
  break;
@@ -6959,6 +6881,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
6959
6881
  }
6960
6882
  })(context) ?? prepend('*', nodes);
6961
6883
  prefix -= 1;
6884
+ context.range += 1;
6962
6885
  break;
6963
6886
  case 2:
6964
6887
  nodes = (0, combinator_1.bind)(substrong, ds => {
@@ -6973,11 +6896,14 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
6973
6896
  }
6974
6897
  })(context) ?? prepend('**', nodes);
6975
6898
  prefix -= 2;
6899
+ context.range += 2;
6976
6900
  break;
6977
6901
  }
6978
6902
  }
6979
6903
  if (prefix > postfix) {
6980
6904
  nodes = prepend('*'.repeat(prefix - postfix), nodes);
6905
+ prefix = 0;
6906
+ context.range += prefix - postfix;
6981
6907
  }
6982
6908
  return nodes;
6983
6909
  }));
@@ -7305,7 +7231,7 @@ const dom_1 = __webpack_require__(394);
7305
7231
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7306
7232
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7307
7233
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
7308
- (0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(3 /* Recursion.inline */, (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', {
7234
+ (0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (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', {
7309
7235
  class: 'invalid',
7310
7236
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7311
7237
  }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
@@ -7450,14 +7376,15 @@ exports.insertion = void 0;
7450
7376
  const parser_1 = __webpack_require__(605);
7451
7377
  const combinator_1 = __webpack_require__(3484);
7452
7378
  const inline_1 = __webpack_require__(7973);
7379
+ const repeat_1 = __webpack_require__(8019);
7453
7380
  const visibility_1 = __webpack_require__(6364);
7454
7381
  const util_1 = __webpack_require__(4992);
7455
7382
  const dom_1 = __webpack_require__(394);
7456
- exports.insertion = (0, combinator_1.lazy)(() => (0, util_1.repeat)('++', '', (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
7383
+ exports.insertion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('++', '', '++', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
7457
7384
  buffer
7458
7385
  }) => buffer.import(bs), ([, bs], {
7459
7386
  buffer
7460
- }) => 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))))])));
7387
+ }) => 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))))])));
7461
7388
 
7462
7389
  /***/ },
7463
7390
 
@@ -7474,17 +7401,18 @@ exports.italic = void 0;
7474
7401
  const parser_1 = __webpack_require__(605);
7475
7402
  const combinator_1 = __webpack_require__(3484);
7476
7403
  const inline_1 = __webpack_require__(7973);
7404
+ const repeat_1 = __webpack_require__(8019);
7477
7405
  const visibility_1 = __webpack_require__(6364);
7478
7406
  const util_1 = __webpack_require__(4992);
7479
7407
  const dom_1 = __webpack_require__(394);
7480
7408
  // 可読性のため実際にはオブリーク体を指定する。
7481
7409
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
7482
7410
  // ある程度の長さのある文に使うのが望ましい。
7483
- exports.italic = (0, combinator_1.lazy)(() => (0, util_1.repeat)('///', visibility_1.beforeNonblank, (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
7411
+ exports.italic = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('///', visibility_1.beforeNonblank, '///', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
7484
7412
  buffer
7485
7413
  }) => buffer.import(bs), ([, bs], {
7486
7414
  buffer
7487
- }) => 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))))])));
7415
+ }) => 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))))])));
7488
7416
 
7489
7417
  /***/ },
7490
7418
 
@@ -7658,19 +7586,20 @@ const parser_1 = __webpack_require__(605);
7658
7586
  const combinator_1 = __webpack_require__(3484);
7659
7587
  const inline_1 = __webpack_require__(7973);
7660
7588
  const indexee_1 = __webpack_require__(7610);
7589
+ const repeat_1 = __webpack_require__(8019);
7661
7590
  const visibility_1 = __webpack_require__(6364);
7662
7591
  const util_1 = __webpack_require__(4992);
7663
7592
  const dom_1 = __webpack_require__(394);
7664
- exports.mark = (0, combinator_1.lazy)(() => (0, util_1.repeat)('==', visibility_1.beforeNonblank, (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank)), '==', false, [], ([, bs], {
7593
+ exports.mark = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('==', visibility_1.beforeNonblank, '==', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank)), '==', false, [], ([, bs], {
7665
7594
  buffer
7666
7595
  }) => buffer.import(bs), ([, bs], {
7667
7596
  buffer
7668
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer))), (nodes, {
7597
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), (nodes, {
7669
7598
  id,
7670
7599
  state
7671
- }, nest) => {
7600
+ }, lead) => {
7672
7601
  const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
7673
- if (state & 251 /* State.linkers */ || nest) return new parser_1.List([new parser_1.Node(el)]);
7602
+ if (state & 251 /* State.linkers */ || lead >= 2) return new parser_1.List([new parser_1.Node(el)]);
7674
7603
  (0, dom_1.define)(el, {
7675
7604
  id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el.cloneNode(true)))
7676
7605
  });
@@ -7711,7 +7640,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7711
7640
  translate: 'no',
7712
7641
  ...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
7713
7642
  }, source))])));
7714
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\n]/y)]))), (0, source_1.str)('}'), true));
7643
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\n]/y)]))), (0, source_1.str)('}'), true));
7715
7644
 
7716
7645
  /***/ },
7717
7646
 
@@ -7798,7 +7727,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7798
7727
  target: '_blank'
7799
7728
  }, [el]))]);
7800
7729
  }))));
7801
- 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)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')')), (0, source_1.str)(')'), true, [], 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)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), (0, source_1.str)(']'), true, [], 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)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}')), (0, source_1.str)('}'), true, [], 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)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"'))), (0, source_1.str)('"'), true, [], undefined, () => new parser_1.List())]));
7730
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')')), (0, source_1.str)(')'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), (0, source_1.str)(']'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}')), (0, source_1.str)('}'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"'))), (0, source_1.str)('"'), true, [], undefined, () => new parser_1.List())]));
7802
7731
  const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, [], ([[{
7803
7732
  value: a
7804
7733
  }], [{
@@ -8116,7 +8045,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
8116
8045
  class: 'invalid',
8117
8046
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
8118
8047
  }, context.source.slice(context.position - context.range, context.position)))])));
8119
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs]) => bs && as.import(bs))]));
8048
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs]) => bs && as.import(bs))]));
8120
8049
 
8121
8050
  /***/ },
8122
8051
 
@@ -8443,6 +8372,143 @@ function* proc(note, defs) {
8443
8372
 
8444
8373
  /***/ },
8445
8374
 
8375
+ /***/ 8019
8376
+ (__unused_webpack_module, exports, __webpack_require__) {
8377
+
8378
+ "use strict";
8379
+
8380
+
8381
+ Object.defineProperty(exports, "__esModule", ({
8382
+ value: true
8383
+ }));
8384
+ exports.repeat = void 0;
8385
+ const parser_1 = __webpack_require__(605);
8386
+ const delimiter_1 = __webpack_require__(385);
8387
+ const alias_1 = __webpack_require__(5413);
8388
+ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, context, prefix, postfix) => {
8389
+ const acc = new parser_1.List();
8390
+ if (prefix > 0) {
8391
+ acc.push(new parser_1.Node(opener[0].repeat(prefix)));
8392
+ context.range += prefix;
8393
+ }
8394
+ acc.import(nodes);
8395
+ if (postfix > 0) {
8396
+ const {
8397
+ source,
8398
+ position
8399
+ } = context;
8400
+ acc.push(new parser_1.Node(source.slice(position, position + postfix)));
8401
+ context.position += postfix;
8402
+ context.range += postfix;
8403
+ }
8404
+ return acc;
8405
+ }) {
8406
+ const test = (0, delimiter_1.tester)(after, false);
8407
+ return (0, parser_1.failsafe)(input => {
8408
+ const context = input;
8409
+ const {
8410
+ source,
8411
+ position,
8412
+ resources: {
8413
+ recursions
8414
+ } = {}
8415
+ } = context;
8416
+ if (!source.startsWith(opener, context.position)) return;
8417
+ let nodes = new parser_1.List();
8418
+ let i = opener.length;
8419
+ for (; source[context.position + i] === source[context.position];) ++i;
8420
+ context.position += i;
8421
+ if (test(input) === undefined) return;
8422
+ let depth = i / opener.length + 1 | 0;
8423
+ if (recursions) for (const recursion of rs) {
8424
+ const rec = (0, alias_1.min)(recursion, recursions.length - 1);
8425
+ if (rec === -1) continue;
8426
+ if (recursions[rec] < depth - 1) throw new Error('Too much recursion');
8427
+ recursions[rec] -= depth;
8428
+ }
8429
+ let state = false;
8430
+ let follow = 0;
8431
+ for (; i >= opener.length; i -= opener.length, follow -= closer.length) {
8432
+ if (recursions) for (const recursion of rs) {
8433
+ const rec = (0, alias_1.min)(recursion, recursions.length - 1);
8434
+ if (rec === -1) continue;
8435
+ recursions[rec] += 1;
8436
+ }
8437
+ depth -= 1;
8438
+ const lead = i - opener.length;
8439
+ if (source.startsWith(closer, context.position)) {
8440
+ context.position += closer.length;
8441
+ const pos = context.position;
8442
+ follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
8443
+ nodes = cons(nodes, context, lead, follow);
8444
+ if (context.position > pos) {
8445
+ const advance = opener.length * (context.position - pos) / closer.length | 0;
8446
+ i -= advance;
8447
+ follow -= advance;
8448
+ depth -= advance;
8449
+ }
8450
+ continue;
8451
+ }
8452
+ const buf = context.buffer;
8453
+ context.buffer = nodes;
8454
+ const result = parser(input);
8455
+ context.buffer = buf;
8456
+ context.range = context.position - position - i + opener.length;
8457
+ if (result === undefined) break;
8458
+ const pos = context.position;
8459
+ nodes = result;
8460
+ switch (nodes.last?.value) {
8461
+ case "\u0018" /* Command.Cancel */:
8462
+ nodes.pop();
8463
+ state = false;
8464
+ break;
8465
+ case "\u001F" /* Command.Separator */:
8466
+ follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
8467
+ nodes.pop();
8468
+ state = true;
8469
+ continue;
8470
+ default:
8471
+ follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
8472
+ nodes = cons(nodes, context, lead, follow);
8473
+ state = true;
8474
+ if (context.position > pos) {
8475
+ const advance = opener.length * (context.position - pos) / closer.length | 0;
8476
+ i -= advance;
8477
+ follow -= advance;
8478
+ depth -= advance;
8479
+ }
8480
+ continue;
8481
+ }
8482
+ break;
8483
+ }
8484
+ if (recursions) for (let i = 0; i < depth; ++i) for (const recursion of rs) {
8485
+ const rec = (0, alias_1.min)(recursion, recursions.length - 1);
8486
+ if (rec === -1) continue;
8487
+ recursions[rec] += depth;
8488
+ }
8489
+ depth = 0;
8490
+ const prefix = i;
8491
+ i = 0;
8492
+ for (let len = (0, alias_1.min)(prefix, source.length - context.position); i < len && source[context.position + i] === closer[0];) {
8493
+ ++i;
8494
+ }
8495
+ const postfix = i;
8496
+ context.range = context.position - position - prefix - postfix;
8497
+ return termination(nodes, context, prefix, postfix, state);
8498
+ });
8499
+ }
8500
+ exports.repeat = repeat;
8501
+ function countFollows(source, position, closer, limit) {
8502
+ if (closer.length === 0) return 0;
8503
+ let pos = position;
8504
+ for (let i = 0; i < limit && pos < source.length; ++i, pos += closer.length) {
8505
+ if (!source.startsWith(closer, pos)) break;
8506
+ }
8507
+ return pos - position;
8508
+ }
8509
+
8510
+ /***/ },
8511
+
8446
8512
  /***/ 3967
8447
8513
  (__unused_webpack_module, exports, __webpack_require__) {
8448
8514
 
@@ -9057,10 +9123,7 @@ exports.unescsource = unescsource;
9057
9123
  Object.defineProperty(exports, "__esModule", ({
9058
9124
  value: true
9059
9125
  }));
9060
- exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
9061
- const parser_1 = __webpack_require__(605);
9062
- const delimiter_1 = __webpack_require__(385);
9063
- const alias_1 = __webpack_require__(5413);
9126
+ exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.unwrap = void 0;
9064
9127
  const random_1 = __webpack_require__(3158);
9065
9128
  const dom_1 = __webpack_require__(394);
9066
9129
  function* unwrap(nodes) {
@@ -9070,75 +9133,6 @@ function* unwrap(nodes) {
9070
9133
  }
9071
9134
  }
9072
9135
  exports.unwrap = unwrap;
9073
- function repeat(symbol, after, parser, cons, termination = (nodes, context, prefix, postfix) => {
9074
- const acc = new parser_1.List();
9075
- if (prefix > 0) {
9076
- acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
9077
- }
9078
- acc.import(nodes);
9079
- if (postfix > 0) {
9080
- const {
9081
- source,
9082
- position
9083
- } = context;
9084
- acc.push(new parser_1.Node(source.slice(position, position + postfix)));
9085
- context.position += postfix;
9086
- }
9087
- return acc;
9088
- }) {
9089
- const test = (0, delimiter_1.tester)(after, false);
9090
- return (0, parser_1.failsafe)(input => {
9091
- const context = input;
9092
- const {
9093
- source,
9094
- position
9095
- } = context;
9096
- if (!source.startsWith(symbol, context.position)) return;
9097
- let nodes = new parser_1.List();
9098
- let i = symbol.length;
9099
- for (; source[context.position + i] === source[context.position];) ++i;
9100
- context.position += i;
9101
- if (test(input) === undefined) return;
9102
- let state = false;
9103
- for (; i >= symbol.length; i -= symbol.length) {
9104
- if (nodes.length > 0 && source.startsWith(symbol, context.position)) {
9105
- nodes = cons(nodes, context, i > symbol.length);
9106
- context.position += symbol.length;
9107
- continue;
9108
- }
9109
- const buf = context.buffer;
9110
- context.buffer = nodes;
9111
- const result = parser(input);
9112
- context.buffer = buf;
9113
- if (result === undefined) break;
9114
- nodes = result;
9115
- switch (nodes.last?.value) {
9116
- case "\u0018" /* Command.Cancel */:
9117
- nodes.pop();
9118
- state = false;
9119
- break;
9120
- case "\u001F" /* Command.Separator */:
9121
- nodes.pop();
9122
- state = true;
9123
- continue;
9124
- default:
9125
- nodes = cons(nodes, context, i > symbol.length);
9126
- state = true;
9127
- continue;
9128
- }
9129
- break;
9130
- }
9131
- const prefix = i;
9132
- i = 0;
9133
- for (let len = (0, alias_1.min)(prefix, source.length - context.position); i < len && source[context.position + i] === symbol[0];) {
9134
- ++i;
9135
- }
9136
- const postfix = i;
9137
- context.range = context.position - position;
9138
- return termination(nodes, context, prefix, postfix, state);
9139
- });
9140
- }
9141
- exports.repeat = repeat;
9142
9136
  function invalid(syntax, type, message) {
9143
9137
  return {
9144
9138
  'data-invalid-syntax': syntax,