securemark 0.293.2 → 0.293.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.293.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.293.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"));
@@ -2768,7 +2768,7 @@ function indent(opener, parser = false, separation = false) {
2768
2768
  if (typeof opener === 'function') {
2769
2769
  separation = parser;
2770
2770
  parser = opener;
2771
- opener = /([ \t])\1*/y;
2771
+ opener = / {1,4}|\t{1,2}/y;
2772
2772
  }
2773
2773
  return (0, parser_1.failsafe)((0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, ({
2774
2774
  context
@@ -3074,8 +3074,10 @@ function isBacktrack(context, backtracks, position = context.position, length =
3074
3074
  exports.isBacktrack = isBacktrack;
3075
3075
  function setBacktrack(context, backtracks, position, length = 1) {
3076
3076
  const {
3077
- source
3077
+ source,
3078
+ state = 0
3078
3079
  } = context;
3080
+ if (state === 0) return;
3079
3081
  if (position === source.length) return;
3080
3082
  if (length === 0) return;
3081
3083
  for (const backtrack of backtracks) {
@@ -3455,19 +3457,18 @@ class Delimiters {
3455
3457
  this.states = [];
3456
3458
  }
3457
3459
  // 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
3458
- static signature(pattern, linebreakable) {
3460
+ static signature(pattern) {
3459
3461
  switch (typeof pattern) {
3460
3462
  case 'undefined':
3461
- return +linebreakable;
3463
+ return 1 << 7;
3462
3464
  case 'string':
3463
3465
  if (pattern.length === 1) {
3464
3466
  const code = pattern.charCodeAt(0);
3465
- // 使用中のパターンの8ビット目が空いてるのでひとまずこうしとく
3466
- if ((code & 1 << 7) === 0) return code | +linebreakable << 7;
3467
+ return code;
3467
3468
  }
3468
- return `s:${pattern}:${+linebreakable}`;
3469
+ return `s:${pattern}`;
3469
3470
  case 'object':
3470
- return `r/${pattern.source}/${+linebreakable}`;
3471
+ return `r/${pattern.source}`;
3471
3472
  }
3472
3473
  }
3473
3474
  static matcher(pattern) {
@@ -3502,8 +3503,7 @@ class Delimiters {
3502
3503
  const {
3503
3504
  signature,
3504
3505
  matcher,
3505
- precedence,
3506
- linebreakable
3506
+ precedence
3507
3507
  } = delims[i];
3508
3508
  const memory = this.registry(signature);
3509
3509
  const index = memory[0]?.index ?? delimiters.length;
@@ -3514,7 +3514,6 @@ class Delimiters {
3514
3514
  signature,
3515
3515
  matcher,
3516
3516
  precedence,
3517
- linebreakable,
3518
3517
  state: true
3519
3518
  };
3520
3519
  delimiters[index] = delimiter;
@@ -3570,8 +3569,7 @@ class Delimiters {
3570
3569
  }
3571
3570
  match(input) {
3572
3571
  const {
3573
- precedence = 0,
3574
- linebreak = 0
3572
+ precedence = 0
3575
3573
  } = input.context;
3576
3574
  const {
3577
3575
  delimiters
@@ -3581,7 +3579,6 @@ class Delimiters {
3581
3579
  if (delimiter.precedence <= precedence || !delimiter.state) continue;
3582
3580
  switch (delimiter.matcher(input)) {
3583
3581
  case true:
3584
- if (!delimiter.linebreakable && linebreak > 0) return false;
3585
3582
  return true;
3586
3583
  case false:
3587
3584
  return false;
@@ -3684,15 +3681,13 @@ Object.defineProperty(exports, "__esModule", ({
3684
3681
  exports.some = void 0;
3685
3682
  const parser_1 = __webpack_require__(605);
3686
3683
  const delimiter_1 = __webpack_require__(5691);
3687
- const array_1 = __webpack_require__(6876);
3688
3684
  function some(parser, end, delimiters = [], limit = -1) {
3689
3685
  if (typeof end === 'number') return some(parser, undefined, delimiters, end);
3690
3686
  const match = delimiter_1.Delimiters.matcher(end);
3691
- const delims = delimiters.map(([delimiter, precedence, linebreakable = true]) => ({
3692
- signature: delimiter_1.Delimiters.signature(delimiter, linebreakable),
3687
+ const delims = delimiters.map(([delimiter, precedence]) => ({
3688
+ signature: delimiter_1.Delimiters.signature(delimiter),
3693
3689
  matcher: delimiter_1.Delimiters.matcher(delimiter),
3694
- precedence,
3695
- linebreakable
3690
+ precedence
3696
3691
  }));
3697
3692
  return input => {
3698
3693
  const {
@@ -3714,7 +3709,7 @@ function some(parser, end, delimiters = [], limit = -1) {
3714
3709
  if (context.delimiters?.match(input)) break;
3715
3710
  const result = parser(input);
3716
3711
  if (result === undefined) break;
3717
- nodes = nodes ? nodes.length < (0, parser_1.eval)(result).length / 8 ? (0, array_1.unshift)(nodes, (0, parser_1.eval)(result)) : (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3712
+ nodes = nodes ? (nodes.push(...(0, parser_1.eval)(result)), nodes) : (0, parser_1.eval)(result);
3718
3713
  if (limit >= 0 && context.position - position > limit) break;
3719
3714
  }
3720
3715
  if (delims.length > 0) {
@@ -4321,46 +4316,52 @@ exports.block = (0, combinator_1.reset)({
4321
4316
  }
4322
4317
  } = input;
4323
4318
  if (position === source.length) return;
4324
- switch (source.slice(position, position + 3)) {
4325
- case '===':
4326
- return (0, pagebreak_1.pagebreak)(input);
4327
- case '~~~':
4328
- return (0, extension_1.extension)(input);
4329
- case '```':
4330
- return (0, codeblock_1.codeblock)(input);
4331
- }
4332
- switch (source.slice(position, position + 2)) {
4333
- case '$$':
4334
- return (0, mathblock_1.mathblock)(input);
4335
- case '[$':
4336
- return (0, extension_1.extension)(input);
4337
- case '[!':
4319
+ const fst = source[position];
4320
+ switch (fst) {
4321
+ case '=':
4322
+ if (source.startsWith('===', position)) return (0, pagebreak_1.pagebreak)(input);
4323
+ break;
4324
+ case '`':
4325
+ if (source.startsWith('```', position)) return (0, codeblock_1.codeblock)(input);
4326
+ break;
4327
+ case '~':
4328
+ if (source.startsWith('~~~', position)) return (0, extension_1.extension)(input);
4329
+ if (source[position + 1] === ' ') return (0, dlist_1.dlist)(input);
4330
+ break;
4331
+ case '-':
4332
+ if (source[position + 1] === ' ') return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
4333
+ break;
4334
+ case '+':
4335
+ case '*':
4336
+ if (source[position + 1] === ' ') return (0, ilist_1.ilist)(input);
4337
+ break;
4338
+ case '[':
4339
+ switch (source[position + 1]) {
4340
+ case '$':
4341
+ return (0, extension_1.extension)(input);
4342
+ case '!':
4343
+ return (0, mediablock_1.mediablock)(input);
4344
+ }
4345
+ break;
4346
+ case '!':
4347
+ if (source[position + 1] === '>') return (0, blockquote_1.blockquote)(input);
4338
4348
  return (0, mediablock_1.mediablock)(input);
4339
- case '!>':
4349
+ case '>':
4350
+ if (source[position + 1] === '>') return (0, blockquote_1.blockquote)(input) || (0, reply_1.reply)(input);
4340
4351
  return (0, blockquote_1.blockquote)(input);
4341
- case '>>':
4342
- return (0, blockquote_1.blockquote)(input) || (0, reply_1.reply)(input);
4343
- case '- ':
4344
- return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
4345
- case '+ ':
4346
- case '* ':
4347
- return (0, ilist_1.ilist)(input);
4348
- case '~ ':
4349
- return (0, dlist_1.dlist)(input);
4350
- }
4351
- switch (source[position]) {
4352
4352
  case '#':
4353
4353
  return (0, heading_1.heading)(input);
4354
- case '|':
4355
- return (0, table_1.table)(input) || (0, sidefence_1.sidefence)(input);
4356
4354
  case '$':
4355
+ if (source[position + 1] === '$') return (0, mathblock_1.mathblock)(input);
4357
4356
  return (0, extension_1.extension)(input);
4358
- case '>':
4359
- return (0, blockquote_1.blockquote)(input);
4360
- case '!':
4361
- return (0, mediablock_1.mediablock)(input);
4357
+ case '|':
4358
+ return (0, table_1.table)(input) || (0, sidefence_1.sidefence)(input);
4359
+ case '(':
4360
+ return (0, olist_1.olist)(input);
4361
+ default:
4362
+ if ('0' <= fst && fst <= '9') return (0, olist_1.olist)(input);
4362
4363
  }
4363
- }, source_1.emptyline, olist_1.olist, paragraph_1.paragraph])));
4364
+ }, source_1.emptyline, paragraph_1.paragraph])));
4364
4365
  function error(parser) {
4365
4366
  const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}.*\n`);
4366
4367
  return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)("\u0007" /* Command.Error */, ({
@@ -5289,7 +5290,7 @@ const openers = {
5289
5290
  '.': /([0-9]+|[a-z]+|[A-Z]+)(?:-(?=$|[0-9\n])[0-9]*)*(?:\.?(?:$|[\n])|\. )/y,
5290
5291
  '(': /\((?=$|[0-9a-z\n])([0-9]*|[a-z]*)(?=$|[)\n])\)?(?:-(?=$|[0-9\n])[0-9]*)*(?:$|[ \n])/y
5291
5292
  };
5292
- exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\. /y.source, /\(([0-9]+|[a-z]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
5293
+ 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_)));
5293
5294
  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]), []))])));
5294
5295
  const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => [(0, dom_1.html)('li', {
5295
5296
  'data-index': (0, inline_1.dataindex)(ns),
@@ -5758,55 +5759,55 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
5758
5759
  }
5759
5760
  } = input;
5760
5761
  if (position === source.length) return;
5761
- switch (source.slice(position, position + 2)) {
5762
- case '((':
5763
- return (0, annotation_1.annotation)(input) || (0, bracket_1.bracket)(input);
5764
- case '[[':
5765
- return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
5766
- case '{{':
5767
- return (0, template_1.template)(input) || (0, bracket_1.bracket)(input);
5768
- case '[%':
5769
- return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
5770
- case '[#':
5771
- case '[$':
5772
- case '[:':
5773
- case '[^':
5774
- case '[|':
5775
- return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
5776
- case '${':
5777
- return (0, math_1.math)(input);
5778
- case '++':
5779
- return (0, insertion_1.insertion)(input);
5780
- case '~~':
5781
- return (0, deletion_1.deletion)(input);
5782
- case '==':
5783
- return (0, mark_1.mark)(input);
5784
- case '//':
5785
- return (0, italic_1.italic)(input);
5786
- case '**':
5787
- return (0, emstrong_1.emstrong)(input) || (0, strong_1.strong)(input) || stars(input);
5788
- }
5789
5762
  switch (source[position]) {
5763
+ case '(':
5764
+ if (source[position + 1] === '(') return (0, annotation_1.annotation)(input) || (0, bracket_1.bracket)(input);
5765
+ return (0, bracket_1.bracket)(input);
5790
5766
  case '[':
5767
+ switch (source[position + 1]) {
5768
+ case '[':
5769
+ return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
5770
+ case '%':
5771
+ return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
5772
+ case '#':
5773
+ case '$':
5774
+ case ':':
5775
+ case '^':
5776
+ case '|':
5777
+ return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
5778
+ }
5791
5779
  return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
5792
5780
  case '{':
5781
+ if (source[position + 1] === '{') return (0, template_1.template)(input) || (0, bracket_1.bracket)(input);
5793
5782
  return (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
5783
+ case '"':
5784
+ case '(':
5785
+ case '[':
5786
+ case '{':
5787
+ return (0, bracket_1.bracket)(input);
5794
5788
  case '<':
5795
5789
  return (0, html_1.html)(input);
5796
5790
  case '$':
5791
+ if (source[position + 1] === '{') return (0, math_1.math)(input);
5797
5792
  return (0, extension_1.extension)(input) || (0, math_1.math)(input);
5793
+ case '+':
5794
+ if (source[position + 1] === '+') return (0, insertion_1.insertion)(input);
5795
+ break;
5796
+ case '~':
5797
+ if (source[position + 1] === '~') return (0, deletion_1.deletion)(input);
5798
+ break;
5799
+ case '=':
5800
+ if (source[position + 1] === '=') return (0, mark_1.mark)(input);
5801
+ break;
5802
+ case '/':
5803
+ if (source[position + 1] === '/' && source[position + 2] === '/') return (0, italic_1.italic)(input);
5804
+ break;
5805
+ case '*':
5806
+ return source[position + 1] === '*' ? source[position + 2] === '*' ? (0, emstrong_1.emstrong)(input) || stars(input) : (0, strong_1.strong)(input) || stars(input) : (0, emphasis_1.emphasis)(input);
5798
5807
  case '`':
5799
5808
  return (0, code_1.code)(input);
5800
- case '*':
5801
- return (0, emphasis_1.emphasis)(input) || stars(input);
5802
5809
  case '&':
5803
5810
  return (0, htmlentity_1.htmlentity)(input);
5804
- case '(':
5805
- case '(':
5806
- case '[':
5807
- case '{':
5808
- case '"':
5809
- return (0, bracket_1.bracket)(input);
5810
5811
  }
5811
5812
  }, autolink_1.autolink, source_1.text]));
5812
5813
  var indexee_1 = __webpack_require__(7610);
@@ -6127,7 +6128,31 @@ const array_1 = __webpack_require__(6876);
6127
6128
  const dom_1 = __webpack_require__(394);
6128
6129
  const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
6129
6130
  const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
6130
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{([{"]/y, (0, combinator_1.union)([(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], {
6131
+ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
6132
+ const {
6133
+ context: {
6134
+ source,
6135
+ position
6136
+ }
6137
+ } = input;
6138
+ switch (source[position]) {
6139
+ case '(':
6140
+ return p1(input);
6141
+ case '(':
6142
+ return p2(input);
6143
+ case '[':
6144
+ return s1(input);
6145
+ case '[':
6146
+ return s2(input);
6147
+ case '{':
6148
+ return c1(input);
6149
+ case '{':
6150
+ return c2(input);
6151
+ case '"':
6152
+ return d1(input);
6153
+ }
6154
+ }]));
6155
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
6131
6156
  source,
6132
6157
  position,
6133
6158
  range = 0
@@ -6136,7 +6161,8 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
6136
6161
  return indexA.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6137
6162
  class: 'paren'
6138
6163
  }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
6139
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]), (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], {
6164
+ }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6165
+ 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], {
6140
6166
  source,
6141
6167
  position,
6142
6168
  range = 0
@@ -6145,7 +6171,8 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
6145
6171
  return indexF.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6146
6172
  class: 'paren'
6147
6173
  }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
6148
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = [], cs], context) => {
6174
+ }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6175
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = [], cs], context) => {
6149
6176
  if (context.state & 8 /* State.link */) {
6150
6177
  const {
6151
6178
  source,
@@ -6169,9 +6196,13 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
6169
6196
  }
6170
6197
  }
6171
6198
  return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)];
6172
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
6173
- // 同一行内でしか閉じない以外括弧と同じ挙動
6174
- (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */])])));
6199
+ }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6200
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6201
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6202
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6203
+ const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6204
+ // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6205
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6175
6206
 
6176
6207
  /***/ },
6177
6208
 
@@ -6708,7 +6739,12 @@ Object.setPrototypeOf(attrspecs, null);
6708
6739
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
6709
6740
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[^\S\n]|>)/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
6710
6741
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6711
- (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]), (0, combinator_1.precedence)(3, (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, visibility_1.blankWith)('\n', `</${tag}>`), 3]]), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 3]]), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], context) => [[elem(tag, true, as, bs, cs, context)]], ([as, bs = []], context) => [[elem(tag, true, as, bs, [], context)]]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
6742
+ (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
6743
+ // 不可視のHTML構造が可視構造を変化させるべきでない。
6744
+ // 可視のHTMLは優先度変更を検討する。
6745
+ // このため<>は将来的に共通構造を変化させる可能性があり
6746
+ // 共通構造を変更させない非構造文字列としては依然としてエスケープを要する。
6747
+ (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], context) => [[elem(tag, true, as, bs, cs, context)]], ([as, bs = []], context) => [[elem(tag, true, as, bs, [], context)]]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
6712
6748
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6713
6749
  (0, source_1.str)(/<[a-z]+(?=[^\S\n]|>)/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]])])));
6714
6750
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/yi), (0, source_1.str)(/[^\S\n]+[^\s<>]+/y)]);
@@ -6719,7 +6755,7 @@ function elem(tag, content, as, bs, cs, context) {
6719
6755
  if (bs.length === 0) return ielem('content', `Missing the content`, context);
6720
6756
  if (!(0, visibility_1.isLooseNodeStart)(bs)) return ielem('content', `Missing the visible content in the same line`, context);
6721
6757
  }
6722
- const attrs = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
6758
+ const [attrs] = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
6723
6759
  if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
6724
6760
  if (as.at(-1) !== '>') return ielem('tag', `Missing the closing symbol ">"`, context);
6725
6761
  return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
@@ -6732,6 +6768,7 @@ function ielem(type, message, context) {
6732
6768
  }
6733
6769
  const requiredAttributes = (0, memoize_1.memoize)(spec => Object.entries(spec).flatMap(([k, v]) => v && Object.isFrozen(v) ? [k] : []), new WeakMap());
6734
6770
  function attributes(syntax, spec, params) {
6771
+ const remains = [];
6735
6772
  let invalidation = false;
6736
6773
  const attrs = {};
6737
6774
  for (let i = 0; i < params.length; ++i) {
@@ -6740,16 +6777,23 @@ function attributes(syntax, spec, params) {
6740
6777
  const name = param.split('=', 1)[0];
6741
6778
  const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
6742
6779
  invalidation ||= name === '' || !spec || name in attrs;
6743
- if (name === '' || spec && name in spec && !spec[name]) continue;
6744
- spec?.[name]?.includes(value) || spec?.[name]?.length === 0 && value !== undefined ? attrs[name] = value ?? '' : invalidation ||= !!spec;
6745
- (0, array_1.splice)(params, i--, 1);
6780
+ if (name === '') continue;
6781
+ if (spec && name in spec && !spec[name]) {
6782
+ remains.push(params[i]);
6783
+ continue;
6784
+ }
6785
+ if (spec?.[name]?.includes(value) || spec?.[name]?.length === 0 && value !== undefined) {
6786
+ attrs[name] = value ?? '';
6787
+ } else {
6788
+ invalidation ||= !!spec;
6789
+ }
6746
6790
  }
6747
6791
  invalidation ||= !!spec && !requiredAttributes(spec).every(name => name in attrs);
6748
6792
  if (invalidation) {
6749
6793
  attrs['class'] = 'invalid';
6750
6794
  Object.assign(attrs, (0, util_1.invalid)(syntax, 'argument', 'Invalid argument'));
6751
6795
  }
6752
- return attrs;
6796
+ return [attrs, remains];
6753
6797
  }
6754
6798
  exports.attributes = attributes;
6755
6799
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
@@ -6909,7 +6953,7 @@ function parse(content, params, context) {
6909
6953
  uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6910
6954
  } catch {}
6911
6955
  const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
6912
- return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params));
6956
+ return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params)[0]);
6913
6957
  }
6914
6958
  function elem(INSECURE_URI, content, uri, origin) {
6915
6959
  let type;
@@ -7043,7 +7087,7 @@ const source_1 = __webpack_require__(8745);
7043
7087
  const util_1 = __webpack_require__(4992);
7044
7088
  const dom_1 = __webpack_require__(394);
7045
7089
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7046
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(5, bracket), '$', false, undefined, undefined, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(5, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, undefined, undefined, [3 | 64 /* Backtrack.bracket */])]), ({
7090
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, undefined, undefined, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, undefined, undefined, [3 | 64 /* Backtrack.bracket */])]), ({
7047
7091
  context: {
7048
7092
  source,
7049
7093
  caches: {
@@ -7117,7 +7161,8 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7117
7161
  });
7118
7162
  el.setAttribute('alt', text);
7119
7163
  if (!sanitize(el, uri)) return [[el]];
7120
- (0, dom_1.define)(el, (0, html_1.attributes)('media', optspec, params));
7164
+ const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, params);
7165
+ (0, dom_1.define)(el, attrs);
7121
7166
  // Awaiting the generic support for attr().
7122
7167
  if (el.hasAttribute('aspect-ratio')) {
7123
7168
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
@@ -7135,7 +7180,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7135
7180
  class: null,
7136
7181
  target: '_blank'
7137
7182
  }, [el])];
7138
- })((0, parser_1.subinput)(`{ ${INSECURE_URI}${params.join('')} }`, context));
7183
+ })((0, parser_1.subinput)(`{ ${INSECURE_URI}${linkparams.join('')} }`, context));
7139
7184
  })))));
7140
7185
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */])])));
7141
7186
  const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/[^\S\n]+/y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[^\S\n]|})/y), false, ([[a], [b], [c]]) => [b === 'x' ? [`width="${a}"`, `height="${c}"`] : [`aspect-ratio="${a}/${c}"`]]), link_1.option]));
@@ -7306,7 +7351,7 @@ const source_1 = __webpack_require__(8745);
7306
7351
  const util_1 = __webpack_require__(4992);
7307
7352
  const array_1 = __webpack_require__(6876);
7308
7353
  const dom_1 = __webpack_require__(394);
7309
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(4, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 4]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
7354
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
7310
7355
  class: 'remark'
7311
7356
  }, [(0, dom_1.html)('input', {
7312
7357
  type: 'checkbox'
@@ -7471,7 +7516,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
7471
7516
  class: 'invalid',
7472
7517
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7473
7518
  }, context.source.slice(context.position - context.range, context.position))]], [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7474
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 4 /* Backtrack.escbracket */])]));
7519
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 4 /* Backtrack.escbracket */])]));
7475
7520
 
7476
7521
  /***/ },
7477
7522
 
@@ -7809,19 +7854,19 @@ const parser = (0, combinator_1.union)([input => {
7809
7854
  }
7810
7855
  } = input;
7811
7856
  if (position === source.length) return;
7812
- switch (source.slice(position, position + 3)) {
7813
- case '~~~':
7814
- return (0, extension_1.segment)(input);
7815
- case '```':
7816
- return (0, codeblock_1.segment)(input);
7817
- }
7818
- switch (source.slice(position, position + 2)) {
7819
- case '$$':
7820
- return (0, mathblock_1.segment)(input);
7821
- case '[$':
7822
- return (0, extension_1.segment)(input);
7823
- }
7824
7857
  switch (source[position]) {
7858
+ case '`':
7859
+ if (source.startsWith('```', position)) return (0, codeblock_1.segment)(input);
7860
+ break;
7861
+ case '~':
7862
+ if (source.startsWith('~~~', position)) return (0, extension_1.segment)(input);
7863
+ break;
7864
+ case '$':
7865
+ if (source[position + 1] === '$') return (0, mathblock_1.segment)(input);
7866
+ break;
7867
+ case '[':
7868
+ if (source[position + 1] === '$') return (0, extension_1.segment)(input);
7869
+ break;
7825
7870
  case '#':
7826
7871
  return (0, heading_1.segment)(input);
7827
7872
  case '$':
@@ -7987,7 +8032,7 @@ const escsource = ({
7987
8032
  if (context.sequential) return [[char]];
7988
8033
  text_1.nonWhitespace.lastIndex = position + 1;
7989
8034
  const b = (0, text_1.isBlank)(source, position);
7990
- let i = b ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, delimiter);
8035
+ let i = b ? source[position + 1] === '\n' ? position + 1 : text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, delimiter);
7991
8036
  i -= position;
7992
8037
  (0, combinator_1.consume)(i - 1, context);
7993
8038
  context.position += i - 1;
@@ -8100,10 +8145,10 @@ exports.strs = strs;
8100
8145
  Object.defineProperty(exports, "__esModule", ({
8101
8146
  value: true
8102
8147
  }));
8103
- exports.isBlank = exports.backToEmailHead = exports.backToUrlHead = exports.next = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = exports.delimiter = void 0;
8148
+ exports.isWhitespace = exports.isBlank = exports.backToEmailHead = exports.backToUrlHead = exports.next = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = void 0;
8104
8149
  const combinator_1 = __webpack_require__(3484);
8105
8150
  const dom_1 = __webpack_require__(394);
8106
- exports.delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
8151
+ //const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
8107
8152
  exports.nonWhitespace = /[\S\r\n]/g;
8108
8153
  const text = input => {
8109
8154
  const {
@@ -8140,7 +8185,7 @@ const text = input => {
8140
8185
  if (context.sequential) return [[char]];
8141
8186
  exports.nonWhitespace.lastIndex = position + 1;
8142
8187
  const b = isBlank(source, position);
8143
- let i = b ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position, exports.delimiter);
8188
+ let i = b ? source[position + 1] === '\n' ? position + 1 : exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
8144
8189
  const lineend = false || b && i === source.length || b && source[i] === '\n' || b && source[i] === '\\' && source[i + 1] === '\n';
8145
8190
  i -= position;
8146
8191
  i = lineend ? i : i - +b || 1;
@@ -8156,9 +8201,14 @@ exports.text = text;
8156
8201
  exports.txt = (0, combinator_1.union)([exports.text]);
8157
8202
  exports.linebreak = (0, combinator_1.focus)(/[\r\n]/y, (0, combinator_1.union)([exports.text]));
8158
8203
  function next(source, position, delimiter) {
8159
- delimiter.lastIndex = position + 1;
8160
- delimiter.test(source);
8161
- let index = delimiter.lastIndex;
8204
+ let index;
8205
+ if (delimiter) {
8206
+ delimiter.lastIndex = position + 1;
8207
+ delimiter.test(source);
8208
+ index = delimiter.lastIndex;
8209
+ } else {
8210
+ index = seek(source, position);
8211
+ }
8162
8212
  if (index === 0) return source.length;
8163
8213
  const char = source[index];
8164
8214
  switch (char) {
@@ -8229,16 +8279,157 @@ function backToEmailHead(source, position, index) {
8229
8279
  return index + offset;
8230
8280
  }
8231
8281
  exports.backToEmailHead = backToEmailHead;
8282
+ function isAlphanumeric(char) {
8283
+ if (char < '0' || '\x7F' < char) return false;
8284
+ return '0' <= char && char <= '9' || 'a' <= char && char <= 'z' || 'A' <= char && char <= 'Z';
8285
+ }
8286
+ //const dict = new class {
8287
+ // constructor() {
8288
+ // [
8289
+ // '\\',
8290
+ // '!',
8291
+ // '@',
8292
+ // '#',
8293
+ // '$',
8294
+ // '&',
8295
+ // '"',
8296
+ // '`',
8297
+ // '[',
8298
+ // ']',
8299
+ // '(',
8300
+ // ')',
8301
+ // '{',
8302
+ // '}',
8303
+ // '<',
8304
+ // '>',
8305
+ // '(',
8306
+ // ')',
8307
+ // '[',
8308
+ // ']',
8309
+ // '{',
8310
+ // '}',
8311
+ // '*',
8312
+ // '%',
8313
+ // '|',
8314
+ // '\r',
8315
+ // '\n',
8316
+ // ].forEach(c =>
8317
+ // this[c.charCodeAt(0)] = undefined);
8318
+ // }
8319
+ //};
8320
+ const delimiter = /\s(?:\\?(?:$|\s)|[$%])/y;
8321
+ function seek(source, position) {
8322
+ for (let i = position + 1; i < source.length; ++i) {
8323
+ const fst = source[i];
8324
+ //if (fst.charCodeAt(0) in dict) return i;
8325
+ switch (fst) {
8326
+ case '\\':
8327
+ case '!':
8328
+ case '@':
8329
+ case '#':
8330
+ case '$':
8331
+ case '&':
8332
+ case '"':
8333
+ case '`':
8334
+ case '[':
8335
+ case ']':
8336
+ case '(':
8337
+ case ')':
8338
+ case '{':
8339
+ case '}':
8340
+ case '<':
8341
+ case '>':
8342
+ case '(':
8343
+ case ')':
8344
+ case '[':
8345
+ case ']':
8346
+ case '{':
8347
+ case '}':
8348
+ case '*':
8349
+ case '%':
8350
+ case '|':
8351
+ case '\r':
8352
+ case '\n':
8353
+ return i;
8354
+ case '+':
8355
+ case '~':
8356
+ case '=':
8357
+ if (source[i + 1] === fst) return i;
8358
+ continue;
8359
+ case '/':
8360
+ if (source[i + 1] === fst && source[i + 2] === fst) return i;
8361
+ continue;
8362
+ case ':':
8363
+ if (source[i + 1] === '/' && source[i + 2] === '/') return i;
8364
+ continue;
8365
+ //case ' ':
8366
+ //case '\t':
8367
+ //case ' ':
8368
+ // if (i + 1 === source.length) return i;
8369
+ // switch (source[i + 1]) {
8370
+ // case ' ':
8371
+ // case '\t':
8372
+ // case '\r':
8373
+ // case '\n':
8374
+ // case ' ':
8375
+ // case '$':
8376
+ // case '%':
8377
+ // return i;
8378
+ // case '\\':
8379
+ // if (i + 2 === source.length) return i;
8380
+ // switch (source[i + 2]) {
8381
+ // case ' ':
8382
+ // case '\t':
8383
+ // case '\r':
8384
+ // case '\n':
8385
+ // case ' ':
8386
+ // return i;
8387
+ // }
8388
+ // }
8389
+ // continue;
8390
+ default:
8391
+ delimiter.lastIndex = i;
8392
+ if (delimiter.test(source)) return i;
8393
+ continue;
8394
+ }
8395
+ }
8396
+ return source.length;
8397
+ }
8232
8398
  const blank = /\s(?:$|\s|\\\n)/y;
8233
8399
  function isBlank(source, position) {
8234
8400
  blank.lastIndex = position;
8235
8401
  return blank.test(source);
8402
+ // removed by dead control flow
8403
+
8404
+ // removed by dead control flow
8405
+
8406
+ // removed by dead control flow
8407
+
8408
+ // removed by dead control flow
8409
+
8410
+ // removed by dead control flow
8411
+
8412
+ // removed by dead control flow
8413
+
8414
+ // removed by dead control flow
8415
+
8236
8416
  }
8237
8417
  exports.isBlank = isBlank;
8238
- function isAlphanumeric(char) {
8239
- if (char < '0' || '\x7F' < char) return false;
8240
- return '0' <= char && char <= '9' || 'a' <= char && char <= 'z' || 'A' <= char && char <= 'Z';
8418
+ const whitespace = /\s/;
8419
+ function isWhitespace(char) {
8420
+ whitespace;
8421
+ switch (char) {
8422
+ case ' ':
8423
+ case '\t':
8424
+ case '\r':
8425
+ case '\n':
8426
+ case ' ':
8427
+ return true;
8428
+ default:
8429
+ return false;
8430
+ }
8241
8431
  }
8432
+ exports.isWhitespace = isWhitespace;
8242
8433
 
8243
8434
  /***/ },
8244
8435
 
@@ -8282,7 +8473,7 @@ const unescsource = ({
8282
8473
  if (context.sequential) return [[char]];
8283
8474
  text_1.nonWhitespace.lastIndex = position + 1;
8284
8475
  const b = (0, text_1.isBlank)(source, position);
8285
- let i = b ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
8476
+ let i = b ? source[position + 1] === '\n' ? position + 1 : text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
8286
8477
  i -= position;
8287
8478
  (0, combinator_1.consume)(i - 1, context);
8288
8479
  context.position += i - 1;