securemark 0.261.2 → 0.262.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.js +153 -114
  3. package/package.json +1 -1
  4. package/src/combinator/data/parser/context/memo.ts +1 -1
  5. package/src/combinator/data/parser/inits.ts +1 -1
  6. package/src/combinator/data/parser/sequence.ts +1 -1
  7. package/src/parser/api/bind.ts +2 -2
  8. package/src/parser/api/parse.test.ts +1 -1
  9. package/src/parser/api/parse.ts +1 -1
  10. package/src/parser/block/blockquote.test.ts +31 -31
  11. package/src/parser/block/blockquote.ts +1 -1
  12. package/src/parser/block/dlist.ts +1 -1
  13. package/src/parser/block/extension/aside.test.ts +3 -3
  14. package/src/parser/block/extension/aside.ts +1 -0
  15. package/src/parser/block/extension/example.test.ts +11 -11
  16. package/src/parser/block/extension/example.ts +1 -1
  17. package/src/parser/block/extension/fig.test.ts +5 -5
  18. package/src/parser/block/extension/figure.test.ts +2 -2
  19. package/src/parser/block/extension/figure.ts +1 -1
  20. package/src/parser/block/extension/message.ts +1 -1
  21. package/src/parser/block/extension/table.ts +1 -1
  22. package/src/parser/block/olist.ts +1 -1
  23. package/src/parser/block/reply.ts +1 -1
  24. package/src/parser/block/table.ts +8 -8
  25. package/src/parser/block/ulist.ts +1 -1
  26. package/src/parser/block.ts +1 -1
  27. package/src/parser/inline/bracket.ts +1 -1
  28. package/src/parser/inline/comment.ts +1 -1
  29. package/src/parser/inline/deletion.ts +1 -1
  30. package/src/parser/inline/emphasis.ts +1 -1
  31. package/src/parser/inline/extension/indexee.ts +9 -8
  32. package/src/parser/inline/extension/placeholder.ts +1 -1
  33. package/src/parser/inline/html.ts +1 -1
  34. package/src/parser/inline/insertion.ts +1 -1
  35. package/src/parser/inline/link.ts +1 -1
  36. package/src/parser/inline/mark.ts +1 -1
  37. package/src/parser/inline/media.ts +1 -1
  38. package/src/parser/inline/ruby.ts +1 -1
  39. package/src/parser/inline/strong.ts +1 -1
  40. package/src/parser/inline/template.ts +1 -1
  41. package/src/parser/locale.test.ts +1 -1
  42. package/src/parser/locale.ts +5 -4
  43. package/src/parser/processor/figure.test.ts +3 -3
  44. package/src/parser/processor/figure.ts +8 -7
  45. package/src/parser/processor/footnote.test.ts +2 -2
  46. package/src/parser/processor/footnote.ts +15 -11
  47. package/src/renderer/render.ts +1 -1
  48. package/src/util/info.ts +7 -5
  49. package/src/util/quote.ts +14 -12
  50. package/src/util/toc.ts +14 -8
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.261.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.262.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -3873,7 +3873,7 @@ class Memo {
3873
3873
  clear(position) {
3874
3874
  const memory = this.memory;
3875
3875
 
3876
- for (let i = position, len = memory.length; i < len; ++i) {
3876
+ for (let len = memory.length, i = position; i < len; ++i) {
3877
3877
  memory.pop();
3878
3878
  } //console.log('clear', position + 1);
3879
3879
 
@@ -3911,7 +3911,7 @@ function inits(parsers, resume) {
3911
3911
  let rest = source;
3912
3912
  let nodes;
3913
3913
 
3914
- for (let i = 0, len = parsers.length; i < len; ++i) {
3914
+ for (let len = parsers.length, i = 0; i < len; ++i) {
3915
3915
  if (rest === '') break;
3916
3916
  if (context.delimiters?.match(rest, context.precedence)) break;
3917
3917
  const result = parsers[i]({
@@ -3958,7 +3958,7 @@ function sequence(parsers, resume) {
3958
3958
  let rest = source;
3959
3959
  let nodes;
3960
3960
 
3961
- for (let i = 0, len = parsers.length; i < len; ++i) {
3961
+ for (let len = parsers.length, i = 0; i < len; ++i) {
3962
3962
  if (rest === '') return;
3963
3963
  if (context.delimiters?.match(rest, context.precedence)) return;
3964
3964
  const result = parsers[i]({
@@ -4422,7 +4422,7 @@ function bind(target, settings) {
4422
4422
  function nearest(index) {
4423
4423
  let el;
4424
4424
 
4425
- for (let i = 0, len = 0; i < blocks.length; ++i) {
4425
+ for (let len = 0, i = 0; i < blocks.length; ++i) {
4426
4426
  const block = blocks[i];
4427
4427
  len += block[0].length;
4428
4428
  el = block[1][0] ?? el;
@@ -4433,7 +4433,7 @@ function bind(target, settings) {
4433
4433
  }
4434
4434
 
4435
4435
  function index(source) {
4436
- for (let i = 0, len = 0; i < blocks.length; ++i) {
4436
+ for (let len = 0, i = 0; i < blocks.length; ++i) {
4437
4437
  const block = blocks[i];
4438
4438
  if (block[1].includes(source)) return len;
4439
4439
  len += block[0].length;
@@ -4629,10 +4629,10 @@ const figure_1 = __webpack_require__(9123);
4629
4629
 
4630
4630
  const footnote_1 = __webpack_require__(7529);
4631
4631
 
4632
- const dom_1 = __webpack_require__(3252);
4633
-
4634
4632
  const url_1 = __webpack_require__(2261);
4635
4633
 
4634
+ const dom_1 = __webpack_require__(3252);
4635
+
4636
4636
  function parse(source, opts = {}, context) {
4637
4637
  if (!(0, segment_1.validate)(source, segment_1.MAX_SEGMENT_SIZE)) throw new Error(`Too large input over ${segment_1.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.`);
4638
4638
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
@@ -4771,10 +4771,10 @@ const reply_1 = __webpack_require__(9978);
4771
4771
 
4772
4772
  const paragraph_1 = __webpack_require__(6457);
4773
4773
 
4774
- const dom_1 = __webpack_require__(3252);
4775
-
4776
4774
  const random_1 = __webpack_require__(7325);
4777
4775
 
4776
+ const dom_1 = __webpack_require__(3252);
4777
+
4778
4778
  exports.block = (0, combinator_1.creation)(1, false, error((0, combinator_1.reset)({
4779
4779
  resources: {
4780
4780
  clock: 50 * 1000,
@@ -4845,7 +4845,7 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4845
4845
  references
4846
4846
  }
4847
4847
  }, context);
4848
- return [[(0, dom_1.html)('section', [document, references])], ''];
4848
+ return [[(0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])], ''];
4849
4849
  })))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4850
4850
 
4851
4851
  /***/ }),
@@ -4946,10 +4946,10 @@ const locale_1 = __webpack_require__(5485);
4946
4946
 
4947
4947
  const visibility_1 = __webpack_require__(7618);
4948
4948
 
4949
- const dom_1 = __webpack_require__(3252);
4950
-
4951
4949
  const array_1 = __webpack_require__(8112);
4952
4950
 
4951
+ const dom_1 = __webpack_require__(3252);
4952
+
4953
4953
  exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128
4954
4954
  /* State.annotation */
4955
4955
  | 64
@@ -5056,7 +5056,7 @@ exports.aside = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
5056
5056
  return [(0, dom_1.html)('aside', {
5057
5057
  id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
5058
5058
  class: 'aside'
5059
- }, [document, references])];
5059
+ }, [document, (0, dom_1.html)('h2', 'References'), references])];
5060
5060
  })));
5061
5061
 
5062
5062
  /***/ }),
@@ -5110,7 +5110,7 @@ exports.example = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
5110
5110
  'data-type': 'markdown'
5111
5111
  }, [(0, dom_1.html)('pre', {
5112
5112
  translate: 'no'
5113
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, references])])];
5113
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])])];
5114
5114
  }
5115
5115
 
5116
5116
  case 'math':
@@ -5246,10 +5246,10 @@ const locale_1 = __webpack_require__(5485);
5246
5246
 
5247
5247
  const visibility_1 = __webpack_require__(7618);
5248
5248
 
5249
- const dom_1 = __webpack_require__(3252);
5250
-
5251
5249
  const memoize_1 = __webpack_require__(1808);
5252
5250
 
5251
+ const dom_1 = __webpack_require__(3252);
5252
+
5253
5253
  exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n])?(?=\[?\$)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([// All parsers which can include closing terms.
5254
5254
  (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, [])));
5255
5255
  exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.state)(4
@@ -5398,10 +5398,10 @@ const blockquote_1 = __webpack_require__(7859);
5398
5398
 
5399
5399
  const paragraph_1 = __webpack_require__(6457);
5400
5400
 
5401
- const dom_1 = __webpack_require__(3252);
5402
-
5403
5401
  const array_1 = __webpack_require__(8112);
5404
5402
 
5403
+ const dom_1 = __webpack_require__(3252);
5404
+
5405
5405
  exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/, 300), // Bug: Type mismatch between outer and inner.
5406
5406
  ([body, overflow, closer, opener, delim, type, param], _, context) => {
5407
5407
  if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
@@ -5508,10 +5508,10 @@ const locale_1 = __webpack_require__(5485);
5508
5508
 
5509
5509
  const visibility_1 = __webpack_require__(7618);
5510
5510
 
5511
- const dom_1 = __webpack_require__(3252);
5512
-
5513
5511
  const array_1 = __webpack_require__(8112);
5514
5512
 
5513
+ const dom_1 = __webpack_require__(3252);
5514
+
5515
5515
  const opener = /^(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
5516
5516
  exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000))));
5517
5517
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false))), false);
@@ -5927,12 +5927,12 @@ const source_1 = __webpack_require__(6743);
5927
5927
 
5928
5928
  const visibility_1 = __webpack_require__(7618);
5929
5929
 
5930
- const dom_1 = __webpack_require__(3252);
5931
-
5932
5930
  const memoize_1 = __webpack_require__(1808);
5933
5931
 
5934
5932
  const array_1 = __webpack_require__(8112);
5935
5933
 
5934
+ const dom_1 = __webpack_require__(3252);
5935
+
5936
5936
  const openers = {
5937
5937
  '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
5938
5938
  '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
@@ -6102,9 +6102,9 @@ const locale_1 = __webpack_require__(5485);
6102
6102
 
6103
6103
  const visibility_1 = __webpack_require__(7618);
6104
6104
 
6105
- const dom_1 = __webpack_require__(3252);
6106
-
6107
6105
  const array_1 = __webpack_require__(8112);
6106
+
6107
+ const dom_1 = __webpack_require__(3252);
6108
6108
  /*
6109
6109
  必ず対象指定から始まる
6110
6110
  対象がページである場合>>.を表現方法とする
@@ -6289,12 +6289,12 @@ const source_1 = __webpack_require__(6743);
6289
6289
 
6290
6290
  const visibility_1 = __webpack_require__(7618);
6291
6291
 
6292
- const dom_1 = __webpack_require__(3252);
6293
-
6294
6292
  const duff_1 = __webpack_require__(8099);
6295
6293
 
6296
6294
  const array_1 = __webpack_require__(8112);
6297
6295
 
6296
+ const dom_1 = __webpack_require__(3252);
6297
+
6298
6298
  exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^\|[^\n]*(?:\n\|[^\n]*){2}/, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
6299
6299
 
6300
6300
  const row = (parser, optional) => (0, combinator_1.creation)(1, false, (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, ({
@@ -6315,14 +6315,14 @@ function format(rows) {
6315
6315
  const aligns = rows[0].className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
6316
6316
 
6317
6317
  for (let i = 0; i < rows.length; ++i) {
6318
- (0, duff_1.duffEach)(rows[i].children, (col, i) => {
6319
- if (i > 0 && !aligns[i]) {
6320
- aligns[i] = aligns[i - 1];
6318
+ for (let cols = rows[i].children, len = cols.length, j = 0; j < len; ++j) {
6319
+ if (j > 0 && !aligns[j]) {
6320
+ aligns[j] = aligns[j - 1];
6321
6321
  }
6322
6322
 
6323
- if (!aligns[i]) return;
6324
- col.setAttribute('align', aligns[i]);
6325
- });
6323
+ if (!aligns[j]) continue;
6324
+ cols[j].setAttribute('align', aligns[j]);
6325
+ }
6326
6326
  }
6327
6327
 
6328
6328
  return rows;
@@ -6351,10 +6351,10 @@ const inline_1 = __webpack_require__(1160);
6351
6351
 
6352
6352
  const visibility_1 = __webpack_require__(7618);
6353
6353
 
6354
- const dom_1 = __webpack_require__(3252);
6355
-
6356
6354
  const array_1 = __webpack_require__(8112);
6357
6355
 
6356
+ const dom_1 = __webpack_require__(3252);
6357
+
6358
6358
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(4
6359
6359
  /* State.media */
6360
6360
  , exports.ulist_))));
@@ -6844,10 +6844,10 @@ const inline_1 = __webpack_require__(1160);
6844
6844
 
6845
6845
  const source_1 = __webpack_require__(6743);
6846
6846
 
6847
- const dom_1 = __webpack_require__(3252);
6848
-
6849
6847
  const array_1 = __webpack_require__(8112);
6850
6848
 
6849
+ const dom_1 = __webpack_require__(3252);
6850
+
6851
6851
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
6852
6852
  exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
6853
6853
  /* Syntax.none */
@@ -6930,12 +6930,12 @@ const inline_1 = __webpack_require__(1160);
6930
6930
 
6931
6931
  const source_1 = __webpack_require__(6743);
6932
6932
 
6933
- const dom_1 = __webpack_require__(3252);
6934
-
6935
6933
  const memoize_1 = __webpack_require__(1808);
6936
6934
 
6937
6935
  const array_1 = __webpack_require__(8112);
6938
6936
 
6937
+ const dom_1 = __webpack_require__(3252);
6938
+
6939
6939
  exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0
6940
6940
  /* Syntax.none */
6941
6941
  , 4, 1, 0
@@ -6967,10 +6967,10 @@ const source_1 = __webpack_require__(6743);
6967
6967
 
6968
6968
  const visibility_1 = __webpack_require__(7618);
6969
6969
 
6970
- const dom_1 = __webpack_require__(3252);
6971
-
6972
6970
  const array_1 = __webpack_require__(8112);
6973
6971
 
6972
+ const dom_1 = __webpack_require__(3252);
6973
+
6974
6974
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~', '~'), (0, combinator_1.syntax)(0
6975
6975
  /* Syntax.none */
6976
6976
  , 1, 1, 0
@@ -6998,10 +6998,10 @@ const source_1 = __webpack_require__(6743);
6998
6998
 
6999
6999
  const visibility_1 = __webpack_require__(7618);
7000
7000
 
7001
- const dom_1 = __webpack_require__(3252);
7002
-
7003
7001
  const array_1 = __webpack_require__(8112);
7004
7002
 
7003
+ const dom_1 = __webpack_require__(3252);
7004
+
7005
7005
  exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('_', '_'), (0, combinator_1.syntax)(0
7006
7006
  /* Syntax.none */
7007
7007
  , 1, 1, 0
@@ -7096,7 +7096,7 @@ const combinator_1 = __webpack_require__(2087);
7096
7096
 
7097
7097
  const dom_1 = __webpack_require__(3252);
7098
7098
 
7099
- const duff_1 = __webpack_require__(8099);
7099
+ const query_1 = __webpack_require__(6120);
7100
7100
 
7101
7101
  function indexee(parser, optional) {
7102
7102
  return (0, combinator_1.fmap)(parser, ([el], _, {
@@ -7121,37 +7121,41 @@ function text(source, optional = false) {
7121
7121
  const index = indexer?.getAttribute('data-index');
7122
7122
  if (index) return index;
7123
7123
  const target = source.cloneNode(true);
7124
- (0, duff_1.duffEach)(target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), el => {
7124
+
7125
+ for (let es = (0, query_1.querySelectorAll)(target, 'code[data-src], .math[data-src], .comment, rt, rp, .reference, .checkbox, ul, ol'), i = 0; i < es.length; ++i) {
7126
+ const el = es[i];
7127
+
7125
7128
  switch (el.tagName) {
7126
7129
  case 'CODE':
7127
7130
  (0, dom_1.define)(el, el.getAttribute('data-src'));
7128
- return;
7131
+ continue;
7129
7132
 
7130
7133
  case 'RT':
7131
7134
  case 'RP':
7132
7135
  case 'UL':
7133
7136
  case 'OL':
7134
7137
  el.remove();
7135
- return;
7138
+ continue;
7136
7139
  }
7137
7140
 
7138
7141
  switch (el.className) {
7139
7142
  case 'math':
7140
7143
  (0, dom_1.define)(el, el.getAttribute('data-src'));
7141
- return;
7144
+ continue;
7142
7145
 
7143
7146
  case 'comment':
7144
7147
  case 'checkbox':
7145
7148
  el.remove();
7146
- return;
7149
+ continue;
7147
7150
 
7148
7151
  case 'reference':
7149
7152
  el.firstChild.remove();
7150
- return;
7153
+ continue;
7151
7154
  }
7152
- }); // Better:
7155
+ } // Better:
7153
7156
  //return target.innerText;
7154
7157
 
7158
+
7155
7159
  return target.textContent;
7156
7160
  }
7157
7161
 
@@ -7261,9 +7265,9 @@ const source_1 = __webpack_require__(6743);
7261
7265
 
7262
7266
  const visibility_1 = __webpack_require__(7618);
7263
7267
 
7264
- const dom_1 = __webpack_require__(3252);
7268
+ const array_1 = __webpack_require__(8112);
7265
7269
 
7266
- const array_1 = __webpack_require__(8112); // Don't use the symbols already used: !#$%@&*+~=
7270
+ const dom_1 = __webpack_require__(3252); // Don't use the symbols already used: !#$%@&*+~=
7267
7271
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7268
7272
 
7269
7273
 
@@ -7301,14 +7305,14 @@ const source_1 = __webpack_require__(6743);
7301
7305
 
7302
7306
  const visibility_1 = __webpack_require__(7618);
7303
7307
 
7304
- const dom_1 = __webpack_require__(3252);
7305
-
7306
7308
  const memoize_1 = __webpack_require__(1808);
7307
7309
 
7308
7310
  const cache_1 = __webpack_require__(9210);
7309
7311
 
7310
7312
  const array_1 = __webpack_require__(8112);
7311
7313
 
7314
+ const dom_1 = __webpack_require__(3252);
7315
+
7312
7316
  const tags = global_1.Object.freeze(['bdo', 'bdi']);
7313
7317
  const attrspecs = {
7314
7318
  bdo: {
@@ -7434,10 +7438,10 @@ const source_1 = __webpack_require__(6743);
7434
7438
 
7435
7439
  const visibility_1 = __webpack_require__(7618);
7436
7440
 
7437
- const dom_1 = __webpack_require__(3252);
7438
-
7439
7441
  const array_1 = __webpack_require__(8112);
7440
7442
 
7443
+ const dom_1 = __webpack_require__(3252);
7444
+
7441
7445
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++', '+'), (0, combinator_1.syntax)(0
7442
7446
  /* Syntax.none */
7443
7447
  , 1, 1, 0
@@ -7475,10 +7479,10 @@ const visibility_1 = __webpack_require__(7618);
7475
7479
 
7476
7480
  const util_1 = __webpack_require__(9437);
7477
7481
 
7478
- const dom_1 = __webpack_require__(3252);
7479
-
7480
7482
  const url_1 = __webpack_require__(2261);
7481
7483
 
7484
+ const dom_1 = __webpack_require__(3252);
7485
+
7482
7486
  const optspec = {
7483
7487
  rel: ['nofollow']
7484
7488
  };
@@ -7640,10 +7644,10 @@ const source_1 = __webpack_require__(6743);
7640
7644
 
7641
7645
  const visibility_1 = __webpack_require__(7618);
7642
7646
 
7643
- const dom_1 = __webpack_require__(3252);
7644
-
7645
7647
  const array_1 = __webpack_require__(8112);
7646
7648
 
7649
+ const dom_1 = __webpack_require__(3252);
7650
+
7647
7651
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('==', '='), (0, combinator_1.syntax)(0
7648
7652
  /* Syntax.none */
7649
7653
  , 1, 1, 0
@@ -7715,12 +7719,12 @@ const htmlentity_1 = __webpack_require__(1562);
7715
7719
 
7716
7720
  const source_1 = __webpack_require__(6743);
7717
7721
 
7718
- const dom_1 = __webpack_require__(3252);
7719
-
7720
7722
  const url_1 = __webpack_require__(2261);
7721
7723
 
7722
7724
  const array_1 = __webpack_require__(8112);
7723
7725
 
7726
+ const dom_1 = __webpack_require__(3252);
7727
+
7724
7728
  const optspec = {
7725
7729
  'width': [],
7726
7730
  'height': [],
@@ -7891,10 +7895,10 @@ const source_1 = __webpack_require__(6743);
7891
7895
 
7892
7896
  const visibility_1 = __webpack_require__(7618);
7893
7897
 
7894
- const dom_1 = __webpack_require__(3252);
7895
-
7896
7898
  const array_1 = __webpack_require__(8112);
7897
7899
 
7900
+ const dom_1 = __webpack_require__(3252);
7901
+
7898
7902
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.syntax)(512
7899
7903
  /* Syntax.ruby */
7900
7904
  , 2, 1, -1
@@ -8028,10 +8032,10 @@ const source_1 = __webpack_require__(6743);
8028
8032
 
8029
8033
  const visibility_1 = __webpack_require__(7618);
8030
8034
 
8031
- const dom_1 = __webpack_require__(3252);
8032
-
8033
8035
  const array_1 = __webpack_require__(8112);
8034
8036
 
8037
+ const dom_1 = __webpack_require__(3252);
8038
+
8035
8039
  exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', '*'), (0, combinator_1.syntax)(0
8036
8040
  /* Syntax.none */
8037
8041
  , 1, 1, 0
@@ -8057,10 +8061,10 @@ const combinator_1 = __webpack_require__(2087);
8057
8061
 
8058
8062
  const source_1 = __webpack_require__(6743);
8059
8063
 
8060
- const dom_1 = __webpack_require__(3252);
8061
-
8062
8064
  const array_1 = __webpack_require__(8112);
8063
8065
 
8066
+ const dom_1 = __webpack_require__(3252);
8067
+
8064
8068
  exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.syntax)(0
8065
8069
  /* Syntax.none */
8066
8070
  , 2, 1, -1
@@ -8089,16 +8093,19 @@ const ja_1 = __webpack_require__(1499);
8089
8093
 
8090
8094
  const dom_1 = __webpack_require__(3252);
8091
8095
 
8092
- const duff_1 = __webpack_require__(8099);
8096
+ const query_1 = __webpack_require__(6120);
8093
8097
 
8094
8098
  function localize(parser) {
8095
8099
  return (0, combinator_1.fmap)(parser, ns => {
8096
8100
  if (ns.length === 0) return ns;
8097
8101
  const el = ns.length === 1 && typeof ns[0] === 'object' ? ns[0] : (0, dom_1.html)('div', ns);
8098
- (0, duff_1.duffEach)(el.querySelectorAll('.linebreak:not(:empty)'), el => {
8099
- if (!check(el)) return;
8102
+
8103
+ for (let es = (0, query_1.querySelectorAll)(el, '.linebreak:not(:empty)'), i = 0; i < es.length; ++i) {
8104
+ const el = es[i];
8105
+ if (!check(el)) continue;
8100
8106
  el.firstChild.remove();
8101
- });
8107
+ }
8108
+
8102
8109
  return ns;
8103
8110
  });
8104
8111
  }
@@ -8184,22 +8191,24 @@ const global_1 = __webpack_require__(4128);
8184
8191
 
8185
8192
  const label_1 = __webpack_require__(466);
8186
8193
 
8187
- const dom_1 = __webpack_require__(3252);
8188
-
8189
8194
  const multimap_1 = __webpack_require__(940);
8190
8195
 
8191
8196
  const array_1 = __webpack_require__(8112);
8192
8197
 
8198
+ const dom_1 = __webpack_require__(3252);
8199
+
8200
+ const query_1 = __webpack_require__(6120);
8201
+
8193
8202
  function* figure(target, footnotes, opts = {}) {
8194
- const refs = new multimap_1.MultiMap((0, array_1.push)((0, array_1.push)([], target.querySelectorAll('a.label:not(.disabled)[data-label]')), footnotes?.references.querySelectorAll('a.label:not(.disabled)') ?? []).map(el => [el.getAttribute('data-label'), el]));
8203
+ const refs = new multimap_1.MultiMap((0, array_1.push)((0, query_1.querySelectorAll)(target, 'a.label:not(.disabled)[data-label]'), footnotes && (0, query_1.querySelectorAll)(footnotes.references, 'a.label:not(.disabled)') || []).map(el => [el.getAttribute('data-label'), el]));
8195
8204
  const labels = new global_1.Set();
8196
8205
  const numbers = new global_1.Map();
8197
8206
  let base = '0';
8198
8207
  let bases = base.split('.');
8199
8208
  let index = bases; // Bug: Firefox
8200
- //for (let defs = target.querySelectorAll(':scope > figure[data-label], :scope > h1, :scope > h2'), i = 0, len = defs.length; i < len; ++i) {
8209
+ //for (let defs = querySelectorAll(target, ':scope > figure[data-label], :scope > h1, :scope > h2'), len = defs.length, i = 0; i < len; ++i) {
8201
8210
 
8202
- for (let defs = target.querySelectorAll('figure[data-label], h1, h2'), i = 0, len = defs.length; i < len; ++i) {
8211
+ for (let defs = (0, query_1.querySelectorAll)(target, 'figure[data-label], h1, h2'), len = defs.length, i = 0; i < len; ++i) {
8203
8212
  yield;
8204
8213
  const def = defs[i];
8205
8214
  if (def.parentNode !== target) continue;
@@ -8381,18 +8390,20 @@ const global_1 = __webpack_require__(4128);
8381
8390
 
8382
8391
  const indexee_1 = __webpack_require__(1269);
8383
8392
 
8384
- const dom_1 = __webpack_require__(3252);
8385
-
8386
8393
  const multimap_1 = __webpack_require__(940);
8387
8394
 
8388
- const duff_1 = __webpack_require__(8099);
8395
+ const dom_1 = __webpack_require__(3252);
8389
8396
 
8390
- const array_1 = __webpack_require__(8112);
8397
+ const query_1 = __webpack_require__(6120);
8391
8398
 
8392
8399
  function* footnote(target, footnotes, opts = {}, bottom = null) {
8393
8400
  // Bug: Firefox
8394
- //target.querySelectorAll(`:scope > .annotations`).forEach(el => el.remove());
8395
- (0, duff_1.duffEach)(target.querySelectorAll(`.annotations`), el => el.parentNode === target && el.remove());
8401
+ //querySelectorAll(target, `:scope > .annotations`).forEach(el => el.remove());
8402
+ for (let es = (0, query_1.querySelectorAll)(target, `.annotations`), i = 0; i < es.length; ++i) {
8403
+ const el = es[i];
8404
+ el.parentNode === target && el.remove();
8405
+ }
8406
+
8396
8407
  yield* (0, exports.reference)(target, footnotes?.references, opts, bottom);
8397
8408
  yield* (0, exports.annotation)(target, footnotes?.annotations, opts, bottom);
8398
8409
  return;
@@ -8409,14 +8420,20 @@ function build(syntax, marker, splitter) {
8409
8420
  const defs = new global_1.Map();
8410
8421
  const buffer = new multimap_1.MultiMap();
8411
8422
  const titles = new global_1.Map(); // Bug: Firefox
8412
- //const splitters = push([], target.querySelectorAll(`:scope > :is(${splitter ?? '_'})`));
8423
+ //const splitters = push([], querySelectorAll(target, `:scope > :is(${splitter ?? '_'})`));
8424
+
8425
+ const splitters = [];
8426
+
8427
+ for (let es = (0, query_1.querySelectorAll)(target, splitter ?? '_'), i = 0; i < es.length; ++i) {
8428
+ const el = es[i];
8429
+ el.parentNode === target && splitters.push(el);
8430
+ }
8413
8431
 
8414
- const splitters = (0, duff_1.duffReduce)(target.querySelectorAll(splitter ?? '_'), (acc, el) => el.parentNode === target ? (0, array_1.push)(acc, [el]) : acc, []);
8415
8432
  let count = 0;
8416
8433
  let total = 0;
8417
8434
  let style;
8418
8435
 
8419
- for (let refs = target.querySelectorAll(`sup.${syntax}:not(.disabled)`), i = 0, len = refs.length; i < len; ++i) {
8436
+ for (let refs = (0, query_1.querySelectorAll)(target, `sup.${syntax}:not(.disabled)`), len = refs.length, i = 0; i < len; ++i) {
8420
8437
  yield;
8421
8438
  const ref = refs[i];
8422
8439
 
@@ -9296,10 +9313,10 @@ const math_1 = __webpack_require__(611);
9296
9313
 
9297
9314
  const media_1 = __webpack_require__(2233);
9298
9315
 
9299
- const query_1 = __webpack_require__(6120);
9300
-
9301
9316
  const memoize_1 = __webpack_require__(1808);
9302
9317
 
9318
+ const query_1 = __webpack_require__(6120);
9319
+
9303
9320
  const selector = 'img.media:not(.invalid):not([src])[data-src], a > :not(img).media:not(.invalid), pre.code:not(.invalid), .math:not(.invalid)';
9304
9321
  const extend = (0, memoize_1.reduce)(opts => ({
9305
9322
  code: code_1.code,
@@ -9767,9 +9784,7 @@ exports.info = void 0;
9767
9784
 
9768
9785
  const scope_1 = __webpack_require__(5202);
9769
9786
 
9770
- const duff_1 = __webpack_require__(8099);
9771
-
9772
- const array_1 = __webpack_require__(8112);
9787
+ const query_1 = __webpack_require__(6120);
9773
9788
 
9774
9789
  function info(source) {
9775
9790
  const match = (0, scope_1.scope)(source, '.invalid');
@@ -9787,7 +9802,14 @@ function info(source) {
9787
9802
  };
9788
9803
 
9789
9804
  function find(selector) {
9790
- return (0, duff_1.duffReduce)(source.querySelectorAll(selector), (acc, el) => match(el) ? (0, array_1.push)(acc, [el]) : acc, []);
9805
+ const acc = [];
9806
+
9807
+ for (let es = (0, query_1.querySelectorAll)(source, selector), i = 0; i < es.length; ++i) {
9808
+ const el = es[i];
9809
+ match(el) && acc.push(el);
9810
+ }
9811
+
9812
+ return acc;
9791
9813
  }
9792
9814
  }
9793
9815
 
@@ -9814,7 +9836,7 @@ const cite_1 = __webpack_require__(6315);
9814
9836
 
9815
9837
  const dom_1 = __webpack_require__(3252);
9816
9838
 
9817
- const duff_1 = __webpack_require__(8099);
9839
+ const query_1 = __webpack_require__(6120);
9818
9840
 
9819
9841
  function quote(anchor, range) {
9820
9842
  if ((0, parser_1.exec)((0, cite_1.cite)({
@@ -9824,22 +9846,25 @@ function quote(anchor, range) {
9824
9846
  fit(range);
9825
9847
  const node = trim(range.cloneContents());
9826
9848
  if (!node.firstChild) return '';
9827
- (0, duff_1.duffEach)(node.querySelectorAll('code[data-src], .math[data-src], .media[data-src], rt, rp'), el => {
9849
+
9850
+ for (let es = (0, query_1.querySelectorAll)(node, 'code[data-src], .math[data-src], .media[data-src], rt, rp'), i = 0; i < es.length; ++i) {
9851
+ const el = es[i];
9852
+
9828
9853
  switch (true) {
9829
9854
  case el.matches('code'):
9830
9855
  case el.matches('.math'):
9831
9856
  (0, dom_1.define)(el, el.getAttribute('data-src'));
9832
- return;
9857
+ continue;
9833
9858
 
9834
9859
  case el.matches('.media'):
9835
9860
  el.replaceWith(/[\s{}]/.test(el.getAttribute('data-src')) ? `!{ ${el.getAttribute('data-src')} }` : `!{${el.getAttribute('data-src')}}`);
9836
- return;
9861
+ continue;
9837
9862
 
9838
9863
  case el.matches('rt, rp'):
9839
9864
  el.remove();
9840
- return;
9865
+ continue;
9841
9866
  }
9842
- });
9867
+ }
9843
9868
 
9844
9869
  if (range.startOffset === 0 && range.startContainer.parentElement?.matches('.cite, .quote') && (!range.startContainer.previousSibling || range.startContainer.previousSibling.nodeName === 'BR')) {
9845
9870
  node.prepend(`>${range.startContainer.parentElement.matches('.quote.invalid') ? ' ' : ''}`);
@@ -9848,26 +9873,29 @@ function quote(anchor, range) {
9848
9873
  anchor = '';
9849
9874
  }
9850
9875
 
9851
- (0, duff_1.duffEach)(node.querySelectorAll('br'), el => {
9876
+ for (let es = (0, query_1.querySelectorAll)(node, 'br'), i = 0; i < es.length; ++i) {
9877
+ const el = es[i];
9878
+
9852
9879
  if (anchor && el.nextSibling instanceof global_1.Element && el.nextSibling.matches('.cite, .quote')) {
9853
9880
  el.replaceWith(`\n>${el.nextSibling.matches('.quote.invalid') ? ' ' : ''}`);
9854
- return;
9881
+ continue;
9855
9882
  }
9856
9883
 
9857
9884
  if (anchor && el.parentElement?.closest('.cite, .quote')) {
9858
9885
  el.replaceWith(`\n>${el.parentElement.closest('.quote.invalid') ? ' ' : ''}`);
9859
- return;
9886
+ continue;
9860
9887
  }
9861
9888
 
9862
9889
  if (anchor) {
9863
9890
  el.replaceWith(`\n>>${anchor}\n> `);
9864
9891
  anchor = '';
9865
- return;
9892
+ continue;
9866
9893
  } else {
9867
9894
  el.replaceWith(`\n> `);
9868
- return;
9895
+ continue;
9869
9896
  }
9870
- });
9897
+ }
9898
+
9871
9899
  anchor && node.append(`\n>>${anchor}`);
9872
9900
  return node.textContent;
9873
9901
  }
@@ -9953,29 +9981,36 @@ exports.toc = void 0;
9953
9981
 
9954
9982
  const global_1 = __webpack_require__(4128);
9955
9983
 
9956
- const dom_1 = __webpack_require__(3252);
9984
+ const array_1 = __webpack_require__(8112);
9957
9985
 
9958
- const duff_1 = __webpack_require__(8099);
9986
+ const dom_1 = __webpack_require__(3252);
9959
9987
 
9960
- const array_1 = __webpack_require__(8112); // Bug: Firefox
9988
+ const query_1 = __webpack_require__(6120); // Bug: Firefox
9961
9989
  //const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `:scope > ${s}[id]`).join();
9962
9990
 
9963
9991
 
9964
9992
  const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]';
9965
9993
 
9966
9994
  function toc(source) {
9967
- const hs = (0, duff_1.duffReduce)(source.querySelectorAll(selector), (acc, el) => {
9995
+ const hs = [];
9996
+
9997
+ for (let es = (0, query_1.querySelectorAll)(source, selector), i = 0; i < es.length; ++i) {
9998
+ const el = es[i];
9999
+
9968
10000
  switch (el.tagName) {
9969
10001
  case 'ASIDE':
9970
- return (0, array_1.push)(acc, [(0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
10002
+ hs.push((0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
9971
10003
  id: el.id,
9972
10004
  class: 'aside'
9973
- }, el.firstElementChild.cloneNode(true).childNodes)]);
10005
+ }, el.firstElementChild.cloneNode(true).childNodes));
10006
+ continue;
9974
10007
 
9975
10008
  default:
9976
- return (0, array_1.push)(acc, [el]);
10009
+ hs.push(el);
10010
+ continue;
9977
10011
  }
9978
- }, []);
10012
+ }
10013
+
9979
10014
  return parse(cons(hs));
9980
10015
  }
9981
10016
 
@@ -10005,7 +10040,11 @@ function level(h) {
10005
10040
  }
10006
10041
 
10007
10042
  function unlink(h) {
10008
- (0, duff_1.duffEach)(h.getElementsByTagName('a'), el => void el.replaceWith(...el.childNodes));
10043
+ for (let es = h.getElementsByTagName('a'), len = es.length, i = 0; i < len; ++i) {
10044
+ const el = es[i];
10045
+ el.replaceWith(...el.childNodes);
10046
+ }
10047
+
10009
10048
  return h.childNodes;
10010
10049
  }
10011
10050