securemark 0.255.1 → 0.257.1

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 (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.js +243 -208
  3. package/markdown.d.ts +39 -17
  4. package/package.json +1 -1
  5. package/src/combinator/control/constraint/contract.ts +3 -13
  6. package/src/combinator/control/manipulation/context.ts +13 -2
  7. package/src/combinator/control/manipulation/resource.ts +37 -3
  8. package/src/combinator/control/manipulation/surround.ts +6 -6
  9. package/src/combinator/data/parser/inits.ts +1 -1
  10. package/src/combinator/data/parser/sequence.ts +1 -1
  11. package/src/combinator/data/parser/some.ts +16 -38
  12. package/src/combinator/data/parser.ts +34 -18
  13. package/src/debug.test.ts +2 -2
  14. package/src/parser/api/bind.ts +9 -11
  15. package/src/parser/api/parse.test.ts +51 -9
  16. package/src/parser/block.ts +1 -1
  17. package/src/parser/inline/annotation.test.ts +7 -5
  18. package/src/parser/inline/annotation.ts +10 -6
  19. package/src/parser/inline/autolink/account.ts +3 -7
  20. package/src/parser/inline/autolink/anchor.ts +3 -7
  21. package/src/parser/inline/autolink/hashnum.ts +3 -7
  22. package/src/parser/inline/autolink/hashtag.ts +3 -7
  23. package/src/parser/inline/autolink/url.test.ts +1 -0
  24. package/src/parser/inline/autolink/url.ts +7 -8
  25. package/src/parser/inline/bracket.test.ts +11 -7
  26. package/src/parser/inline/bracket.ts +11 -11
  27. package/src/parser/inline/comment.test.ts +4 -3
  28. package/src/parser/inline/comment.ts +4 -4
  29. package/src/parser/inline/deletion.ts +3 -3
  30. package/src/parser/inline/emphasis.ts +3 -3
  31. package/src/parser/inline/emstrong.ts +4 -5
  32. package/src/parser/inline/extension/index.test.ts +1 -0
  33. package/src/parser/inline/extension/index.ts +8 -7
  34. package/src/parser/inline/extension/indexer.ts +3 -5
  35. package/src/parser/inline/extension/label.ts +1 -1
  36. package/src/parser/inline/extension/placeholder.test.ts +8 -7
  37. package/src/parser/inline/extension/placeholder.ts +4 -4
  38. package/src/parser/inline/html.test.ts +2 -0
  39. package/src/parser/inline/html.ts +5 -5
  40. package/src/parser/inline/insertion.ts +3 -3
  41. package/src/parser/inline/link.test.ts +1 -0
  42. package/src/parser/inline/link.ts +58 -16
  43. package/src/parser/inline/mark.ts +3 -3
  44. package/src/parser/inline/math.test.ts +21 -14
  45. package/src/parser/inline/math.ts +4 -15
  46. package/src/parser/inline/media.test.ts +0 -2
  47. package/src/parser/inline/media.ts +10 -10
  48. package/src/parser/inline/reference.test.ts +10 -9
  49. package/src/parser/inline/reference.ts +12 -8
  50. package/src/parser/inline/ruby.ts +29 -27
  51. package/src/parser/inline/strong.ts +3 -3
  52. package/src/parser/inline/template.ts +4 -4
  53. package/src/parser/inline.test.ts +13 -10
  54. package/src/parser/inline.ts +1 -0
  55. package/src/parser/util.ts +34 -18
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.255.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.257.1 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"));
@@ -2009,22 +2009,13 @@ const alias_1 = __webpack_require__(5406);
2009
2009
 
2010
2010
  const parser_1 = __webpack_require__(6728);
2011
2011
 
2012
- function validate(patterns, has, end, parser) {
2013
- if (typeof has === 'function') return validate(patterns, '', '', has);
2014
- if (typeof end === 'function') return validate(patterns, has, '', end);
2015
- if (!(0, alias_1.isArray)(patterns)) return validate([patterns], has, end, parser);
2012
+ function validate(patterns, has, parser) {
2013
+ if (typeof has === 'function') return validate(patterns, '', has);
2014
+ if (!(0, alias_1.isArray)(patterns)) return validate([patterns], has, parser);
2016
2015
  const match = (0, global_1.Function)(['"use strict";', 'return source =>', '0', ...patterns.map(pattern => typeof pattern === 'string' ? `|| source.slice(0, ${pattern.length}) === '${pattern}'` : `|| /${pattern.source}/${pattern.flags}.test(source)`)].join(''))();
2017
-
2018
- const match2 = source => {
2019
- if (!has) return true;
2020
- const i = end ? source.indexOf(end, 1) : -1;
2021
- return i !== -1 ? source.slice(0, i).indexOf(has, 1) !== -1 : source.indexOf(has, 1) !== -1;
2022
- };
2023
-
2024
2016
  return (source, context) => {
2025
2017
  if (source === '') return;
2026
2018
  if (!match(source)) return;
2027
- if (!match2(source)) return;
2028
2019
  const result = parser(source, context);
2029
2020
  if (!result) return;
2030
2021
  return (0, parser_1.exec)(result).length < source.length ? result : global_1.undefined;
@@ -2108,7 +2099,7 @@ exports.isEmpty = isEmpty;
2108
2099
  Object.defineProperty(exports, "__esModule", ({
2109
2100
  value: true
2110
2101
  }));
2111
- exports.context = exports.reset = exports.guard = void 0;
2102
+ exports.precedence = exports.context = exports.reset = exports.guard = void 0;
2112
2103
 
2113
2104
  const global_1 = __webpack_require__(4128);
2114
2105
 
@@ -2164,6 +2155,18 @@ const inherit = (0, assign_1.template)((prop, target, source) => {
2164
2155
  }
2165
2156
  });
2166
2157
 
2158
+ function precedence(precedence, parser) {
2159
+ return (source, context) => {
2160
+ const p = context.precedence;
2161
+ context.precedence = precedence;
2162
+ const result = parser(source, context);
2163
+ context.precedence = p;
2164
+ return result;
2165
+ };
2166
+ }
2167
+
2168
+ exports.precedence = precedence;
2169
+
2167
2170
  /***/ }),
2168
2171
 
2169
2172
  /***/ 7957:
@@ -2429,7 +2432,7 @@ exports.recover = recover;
2429
2432
  Object.defineProperty(exports, "__esModule", ({
2430
2433
  value: true
2431
2434
  }));
2432
- exports.creator = void 0;
2435
+ exports.recursion = exports.uncreator = exports.creator = void 0;
2433
2436
 
2434
2437
  function creator(cost, parser) {
2435
2438
  if (typeof cost === 'function') return creator(1, cost);
@@ -2440,8 +2443,8 @@ function creator(cost, parser) {
2440
2443
  recursion: 1
2441
2444
  }
2442
2445
  } = context;
2443
- if (resources.budget <= 0) throw new Error('Too many creations.');
2444
- if (resources.recursion <= 0) throw new Error('Too much recursion.');
2446
+ if (resources.budget <= 0) throw new Error('Too many creations');
2447
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2445
2448
  --resources.recursion;
2446
2449
  const result = parser(source, context);
2447
2450
  ++resources.recursion;
@@ -2456,6 +2459,49 @@ function creator(cost, parser) {
2456
2459
 
2457
2460
  exports.creator = creator;
2458
2461
 
2462
+ function uncreator(cost, parser) {
2463
+ if (typeof cost === 'function') return uncreator(1, cost);
2464
+ return (source, context) => {
2465
+ const {
2466
+ resources = {
2467
+ budget: 1,
2468
+ recursion: 1
2469
+ }
2470
+ } = context;
2471
+ if (resources.budget <= 0) throw new Error('Too many creations');
2472
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2473
+ ++resources.recursion;
2474
+ const result = parser(source, context);
2475
+ --resources.recursion;
2476
+
2477
+ if (result) {
2478
+ resources.budget += cost;
2479
+ }
2480
+
2481
+ return result;
2482
+ };
2483
+ }
2484
+
2485
+ exports.uncreator = uncreator;
2486
+
2487
+ function recursion(cost, parser) {
2488
+ if (typeof cost === 'function') return recursion(1, cost);
2489
+ return (source, context) => {
2490
+ const {
2491
+ resources = {
2492
+ recursion: 1
2493
+ }
2494
+ } = context;
2495
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2496
+ --resources.recursion;
2497
+ const result = parser(source, context);
2498
+ ++resources.recursion;
2499
+ return result;
2500
+ };
2501
+ }
2502
+
2503
+ exports.recursion = recursion;
2504
+
2459
2505
  /***/ }),
2460
2506
 
2461
2507
  /***/ 1109:
@@ -2570,7 +2616,7 @@ function surround(opener, parser, closer, optional = false, f, g) {
2570
2616
  const rr = (0, parser_1.eval)(res3);
2571
2617
  const rest = (0, parser_1.exec)(res3, r_);
2572
2618
  if (rest.length === lmr_.length) return;
2573
- return rr ? f ? f([rl, rm, rr], rest, context) : [(0, array_1.push)((0, array_1.unshift)(rl, rm ?? []), rr), rest] : g ? g([rl, rm], rest, context) : global_1.undefined;
2619
+ return rr ? f ? f([rl, rm, rr], rest, context) : [(0, array_1.push)((0, array_1.unshift)(rl, rm ?? []), rr), rest] : g ? g([rl, rm, mr_], rest, context) : global_1.undefined;
2574
2620
  };
2575
2621
  }
2576
2622
 
@@ -2694,7 +2740,7 @@ exports.fmap = fmap;
2694
2740
  /***/ }),
2695
2741
 
2696
2742
  /***/ 6728:
2697
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2743
+ /***/ ((__unused_webpack_module, exports) => {
2698
2744
 
2699
2745
  "use strict";
2700
2746
 
@@ -2704,42 +2750,49 @@ Object.defineProperty(exports, "__esModule", ({
2704
2750
  }));
2705
2751
  exports.check = exports.exec = exports.eval = exports.Delimiters = void 0;
2706
2752
 
2707
- const global_1 = __webpack_require__(4128);
2708
-
2709
2753
  class Delimiters {
2710
2754
  constructor() {
2711
2755
  this.matchers = [];
2712
- this.record = {};
2713
- }
2714
-
2715
- push(delimiter) {
2716
- const {
2717
- signature,
2718
- matcher,
2719
- escape
2720
- } = delimiter;
2756
+ this.registry = {};
2757
+ this.length = 0;
2758
+ }
2759
+
2760
+ push(...delimiters) {
2761
+ for (let i = 0; i < delimiters.length; ++i) {
2762
+ const delimiter = delimiters[i];
2763
+ const {
2764
+ signature,
2765
+ matcher,
2766
+ precedence = 1
2767
+ } = delimiter;
2768
+
2769
+ if (!this.registry[signature]) {
2770
+ this.matchers.unshift([this.length, signature, precedence, matcher]);
2771
+ this.registry[signature] = true;
2772
+ }
2721
2773
 
2722
- if (this.record[signature] === !escape) {
2723
- this.matchers.unshift(() => global_1.undefined);
2724
- } else {
2725
- this.matchers.unshift(matcher);
2726
- this.record[signature] = !escape;
2774
+ ++this.length;
2727
2775
  }
2728
2776
  }
2729
2777
 
2730
- pop() {
2731
- this.matchers.shift();
2778
+ pop(count = 1) {
2779
+ for (let i = 0; i < count; ++i) {
2780
+ if (--this.length === this.matchers[0][0]) {
2781
+ this.registry[this.matchers.shift()[1]] = false;
2782
+ }
2783
+ }
2732
2784
  }
2733
2785
 
2734
- match(source) {
2786
+ match(source, precedence = 1) {
2735
2787
  const {
2736
2788
  matchers
2737
2789
  } = this;
2738
2790
 
2739
2791
  for (let i = 0; i < matchers.length; ++i) {
2740
- switch (matchers[i](source)) {
2792
+ switch (matchers[i][3](source)) {
2741
2793
  case true:
2742
- return true;
2794
+ if (precedence < matchers[i][2]) return true;
2795
+ continue;
2743
2796
 
2744
2797
  case false:
2745
2798
  return false;
@@ -2860,7 +2913,7 @@ exports.sequence = sequence;
2860
2913
  Object.defineProperty(exports, "__esModule", ({
2861
2914
  value: true
2862
2915
  }));
2863
- exports.escape = exports.some = void 0;
2916
+ exports.some = void 0;
2864
2917
 
2865
2918
  const global_1 = __webpack_require__(4128);
2866
2919
 
@@ -2896,29 +2949,28 @@ const matcher = (0, memoize_1.memoize)(pattern => {
2896
2949
  }
2897
2950
  }, signature);
2898
2951
 
2899
- function some(parser, until, deep, limit = -1) {
2900
- if (typeof until === 'number') return some(parser, global_1.undefined, deep, until);
2952
+ function some(parser, until, deeps = [], limit = -1) {
2953
+ if (typeof until === 'number') return some(parser, global_1.undefined, deeps, until);
2901
2954
  const match = matcher(until);
2902
- const delimiter = {
2903
- signature: signature(deep),
2904
- matcher: matcher(deep)
2905
- };
2955
+ const delimiters = deeps.map(([delimiter, precedence]) => ({
2956
+ signature: signature(delimiter),
2957
+ matcher: matcher(delimiter),
2958
+ precedence
2959
+ }));
2906
2960
  return (source, context) => {
2907
2961
  if (source === '') return;
2908
2962
  let rest = source;
2909
2963
  let nodes;
2910
2964
 
2911
- if (deep && context) {
2912
- // bracket > link > media | bracket
2913
- // bracket > index > bracket
2965
+ if (delimiters.length > 0) {
2914
2966
  context.delimiters ??= new parser_1.Delimiters();
2915
- context.delimiters.push(delimiter);
2967
+ context.delimiters.push(...delimiters);
2916
2968
  }
2917
2969
 
2918
2970
  while (true) {
2919
2971
  if (rest === '') break;
2920
2972
  if (match(rest)) break;
2921
- if (context.delimiters?.match(rest)) break;
2973
+ if (context.delimiters?.match(rest, context.precedence)) break;
2922
2974
  const result = parser(rest, context);
2923
2975
  if (!result) break;
2924
2976
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -2926,8 +2978,8 @@ function some(parser, until, deep, limit = -1) {
2926
2978
  if (limit >= 0 && source.length - rest.length > limit) break;
2927
2979
  }
2928
2980
 
2929
- if (deep && context.delimiters) {
2930
- context.delimiters.pop();
2981
+ if (delimiters.length > 0) {
2982
+ context.delimiters.pop(delimiters.length);
2931
2983
  }
2932
2984
 
2933
2985
  return nodes && rest.length < source.length ? [nodes, rest] : global_1.undefined;
@@ -2936,32 +2988,6 @@ function some(parser, until, deep, limit = -1) {
2936
2988
 
2937
2989
  exports.some = some;
2938
2990
 
2939
- function escape(parser, delim) {
2940
- const delimiter = {
2941
- signature: signature(delim),
2942
- matcher: source => source.slice(0, delim.length) !== delim && global_1.undefined,
2943
- escape: true
2944
- };
2945
- return (source, context) => {
2946
- if (source === '') return;
2947
-
2948
- if (context) {
2949
- context.delimiters ??= new parser_1.Delimiters();
2950
- context.delimiters.push(delimiter);
2951
- }
2952
-
2953
- const result = parser(source, context);
2954
-
2955
- if (context.delimiters) {
2956
- context.delimiters.pop();
2957
- }
2958
-
2959
- return result;
2960
- };
2961
- }
2962
-
2963
- exports.escape = escape;
2964
-
2965
2991
  /***/ }),
2966
2992
 
2967
2993
  /***/ 7005:
@@ -3163,8 +3189,6 @@ exports.bind = void 0;
3163
3189
 
3164
3190
  const global_1 = __webpack_require__(4128);
3165
3191
 
3166
- const alias_1 = __webpack_require__(5406);
3167
-
3168
3192
  const parser_1 = __webpack_require__(6728);
3169
3193
 
3170
3194
  const header_1 = __webpack_require__(5702);
@@ -3186,11 +3210,9 @@ const url_1 = __webpack_require__(2261);
3186
3210
  const array_1 = __webpack_require__(8112);
3187
3211
 
3188
3212
  function bind(target, settings) {
3189
- const context = (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(settings), {
3190
- host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3191
- footnotes: global_1.undefined,
3192
- chunk: global_1.undefined
3193
- });
3213
+ let context = { ...settings,
3214
+ host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin)
3215
+ };
3194
3216
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3195
3217
  const blocks = [];
3196
3218
  const adds = [];
@@ -3204,12 +3226,13 @@ function bind(target, settings) {
3204
3226
  };
3205
3227
 
3206
3228
  function* parse(source) {
3207
- if (settings.chunk && revision) throw new Error('Chunks cannot be updated.');
3229
+ if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
3208
3230
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
3209
- source = (0, normalize_1.normalize)((0, segment_1.validate)(source, segment_1.MAX_INPUT_SIZE) ? source : source.slice(0, segment_1.MAX_INPUT_SIZE + 1));
3210
- (0, alias_1.ObjectAssign)(context, {
3231
+ source = (0, normalize_1.normalize)((0, segment_1.validate)(source, segment_1.MAX_INPUT_SIZE) ? source : source.slice(0, segment_1.MAX_INPUT_SIZE + 1)); // Change the object identity.
3232
+
3233
+ context = { ...context,
3211
3234
  url: url ? new url_1.ReadonlyURL(url) : global_1.undefined
3212
- });
3235
+ };
3213
3236
  const rev = revision = Symbol();
3214
3237
  const sourceSegments = [];
3215
3238
 
@@ -3645,8 +3668,8 @@ const random_1 = __webpack_require__(7325);
3645
3668
 
3646
3669
  exports.block = (0, combinator_1.creator)(error((0, combinator_1.reset)({
3647
3670
  resources: {
3648
- budget: 100 * 1000,
3649
- recursion: 200
3671
+ budget: 50 * 1000,
3672
+ recursion: 20 + 1
3650
3673
  }
3651
3674
  }, (0, combinator_1.union)([source_1.emptyline, horizontalrule_1.horizontalrule, heading_1.heading, ulist_1.ulist, olist_1.olist, ilist_1.ilist, dlist_1.dlist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, extension_1.extension, sidefence_1.sidefence, blockquote_1.blockquote, reply_1.reply, paragraph_1.paragraph]))));
3652
3675
 
@@ -5379,11 +5402,13 @@ const combinator_1 = __webpack_require__(2087);
5379
5402
 
5380
5403
  const inline_1 = __webpack_require__(1160);
5381
5404
 
5405
+ const link_1 = __webpack_require__(9628);
5406
+
5382
5407
  const util_1 = __webpack_require__(9437);
5383
5408
 
5384
5409
  const dom_1 = __webpack_require__(3252);
5385
5410
 
5386
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('((', '))', '\n', (0, combinator_1.fmap)((0, combinator_1.surround)('((', (0, combinator_1.guard)(context => context.syntax?.inline?.annotation ?? true, (0, combinator_1.context)({
5411
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.validate)('((', (0, combinator_1.surround)('((', (0, combinator_1.guard)(context => context.syntax?.inline?.annotation ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
5387
5412
  syntax: {
5388
5413
  inline: {
5389
5414
  annotation: false,
@@ -5398,9 +5423,9 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
5398
5423
  }
5399
5424
  },
5400
5425
  delimiters: global_1.undefined
5401
- }, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', /^\\?\n/)))), '))'), ns => [(0, dom_1.html)('sup', {
5426
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 3], ['))', 6]])), ')')), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5402
5427
  class: 'annotation'
5403
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
5428
+ }, [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest)))))));
5404
5429
 
5405
5430
  /***/ }),
5406
5431
 
@@ -5463,14 +5488,7 @@ const source_1 = __webpack_require__(6743);
5463
5488
  const dom_1 = __webpack_require__(3252); // https://example/@user must be a user page or a redirect page going there.
5464
5489
 
5465
5490
 
5466
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.context)({
5467
- syntax: {
5468
- inline: {
5469
- link: true,
5470
- autolink: false
5471
- }
5472
- }
5473
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5491
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5474
5492
  class: 'account'
5475
5493
  })]));
5476
5494
 
@@ -5499,14 +5517,7 @@ const dom_1 = __webpack_require__(3252); // Timeline(pseudonym): user/tid
5499
5517
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5500
5518
 
5501
5519
 
5502
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.context)({
5503
- syntax: {
5504
- inline: {
5505
- link: true,
5506
- autolink: false
5507
- }
5508
- }
5509
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5520
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5510
5521
  class: 'anchor'
5511
5522
  })])));
5512
5523
 
@@ -5593,14 +5604,7 @@ const source_1 = __webpack_require__(6743);
5593
5604
 
5594
5605
  const dom_1 = __webpack_require__(3252);
5595
5606
 
5596
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.context)({
5597
- syntax: {
5598
- inline: {
5599
- link: true,
5600
- autolink: false
5601
- }
5602
- }
5603
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5607
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5604
5608
  class: 'hashnum',
5605
5609
  href: null
5606
5610
  })]));
@@ -5629,14 +5633,7 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
5629
5633
 
5630
5634
 
5631
5635
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
5632
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.context)({
5633
- syntax: {
5634
- inline: {
5635
- link: true,
5636
- autolink: false
5637
- }
5638
- }
5639
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5636
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5640
5637
  class: 'hashtag'
5641
5638
  }, el.innerText)]));
5642
5639
 
@@ -5659,15 +5656,9 @@ const link_1 = __webpack_require__(9628);
5659
5656
 
5660
5657
  const source_1 = __webpack_require__(6743);
5661
5658
 
5662
- const closer = /^[-+*=~^,.;:!?]*(?=["`|\[\](){}<>]|\\?$)/;
5663
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.context)({
5664
- syntax: {
5665
- inline: {
5666
- link: true
5667
- }
5668
- }
5669
- }, (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.link]))))));
5670
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.some)(source_1.unescsource, '"'), '"', true)])));
5659
+ const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5660
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.textlink])))));
5661
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5671
5662
 
5672
5663
  /***/ }),
5673
5664
 
@@ -5695,12 +5686,12 @@ const dom_1 = __webpack_require__(3252);
5695
5686
  const array_1 = __webpack_require__(8112);
5696
5687
 
5697
5688
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5698
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(index), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)(inline_1.inline, ')'), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5689
+ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5699
5690
  class: 'paren'
5700
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0)))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)(inline_1.inline, ')'), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5691
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5701
5692
  class: 'paren'
5702
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)(inline_1.inline, ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)(inline_1.inline, '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5703
- (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)(inline_1.inline, '"', '"'), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])])));
5693
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ']', [[']', 3]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, '}', [['}', 3]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5694
+ (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])])));
5704
5695
 
5705
5696
  /***/ }),
5706
5697
 
@@ -5752,11 +5743,11 @@ const memoize_1 = __webpack_require__(1808);
5752
5743
 
5753
5744
  const array_1 = __webpack_require__(8112);
5754
5745
 
5755
- exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[%', (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`)), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5746
+ exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.creator)((0, combinator_1.precedence)(4, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5756
5747
  class: 'comment'
5757
5748
  }, [(0, dom_1.html)('input', {
5758
5749
  type: 'checkbox'
5759
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, [])))));
5750
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, []))))));
5760
5751
 
5761
5752
  /***/ }),
5762
5753
 
@@ -5783,7 +5774,7 @@ const dom_1 = __webpack_require__(3252);
5783
5774
 
5784
5775
  const array_1 = __webpack_require__(8112);
5785
5776
 
5786
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5777
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5787
5778
 
5788
5779
  /***/ }),
5789
5780
 
@@ -5814,7 +5805,7 @@ const dom_1 = __webpack_require__(3252);
5814
5805
 
5815
5806
  const array_1 = __webpack_require__(8112);
5816
5807
 
5817
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5808
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5818
5809
 
5819
5810
  /***/ }),
5820
5811
 
@@ -5847,7 +5838,7 @@ const array_1 = __webpack_require__(8112);
5847
5838
 
5848
5839
  const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong]))])));
5849
5840
  const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
5850
- exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
5841
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
5851
5842
  switch (cs[0]) {
5852
5843
  case '***':
5853
5844
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
@@ -5858,7 +5849,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, co
5858
5849
  case '*':
5859
5850
  return (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' ? [[(0, dom_1.html)('strong', (0, array_1.unshift)([(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(2)] : [(0, array_1.unshift)(['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], ds), rest])(rest, context) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
5860
5851
  }
5861
- }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5852
+ }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5862
5853
 
5863
5854
  /***/ }),
5864
5855
 
@@ -5948,7 +5939,7 @@ const util_1 = __webpack_require__(9437);
5948
5939
 
5949
5940
  const dom_1 = __webpack_require__(3252);
5950
5941
 
5951
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', ']', '\n', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.fmap)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5942
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5952
5943
  syntax: {
5953
5944
  inline: {
5954
5945
  annotation: false,
@@ -5960,16 +5951,16 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combi
5960
5951
  autolink: false
5961
5952
  }
5962
5953
  }
5963
- }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', /^\\?\n/)), true)))), ']'), ns => [(0, dom_1.html)('a', (0, dom_1.defrag)(ns))])), ([el]) => [(0, dom_1.define)(el, {
5954
+ }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
5964
5955
  id: el.id ? null : global_1.undefined,
5965
5956
  class: 'index',
5966
5957
  href: el.id ? `#${el.id}` : global_1.undefined
5967
- }, el.childNodes)]))));
5958
+ }, el.childNodes)])))));
5968
5959
  const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)('|#', (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'))), ns => [(0, dom_1.html)('span', {
5969
5960
  class: 'indexer',
5970
5961
  'data-index': (0, indexee_1.identity)(ns.join('')).slice(6)
5971
5962
  })])));
5972
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)(source_1.txt, '"'), (0, source_1.str)('"'), true)])));
5963
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.txt, '"')), (0, source_1.str)('"'), true)])));
5973
5964
 
5974
5965
  /***/ }),
5975
5966
 
@@ -6070,15 +6061,11 @@ const combinator_1 = __webpack_require__(2087);
6070
6061
 
6071
6062
  const index_1 = __webpack_require__(4479);
6072
6063
 
6064
+ const util_1 = __webpack_require__(9437);
6065
+
6073
6066
  const dom_1 = __webpack_require__(3252);
6074
6067
 
6075
- exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, combinator_1.context)({
6076
- syntax: {
6077
- inline: {
6078
- index: true
6079
- }
6080
- }
6081
- }, (0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6068
+ exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, util_1.clean)((0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6082
6069
  href: '#'
6083
6070
  })], '']), index_1.index])), /^\s*$/), // Indexer is invisible but invalids must be visible.
6084
6071
  ([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, dom_1.html)('span', {
@@ -6109,7 +6096,7 @@ const dom_1 = __webpack_require__(3252);
6109
6096
 
6110
6097
  const body = (0, source_1.str)(/^\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/);
6111
6098
  exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
6112
- exports.label = (0, combinator_1.creator)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.fmap)((0, combinator_1.guard)(context => context.syntax?.inline?.label ?? true, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6099
+ exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.guard)(context => context.syntax?.inline?.label ?? true, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6113
6100
  class: 'label',
6114
6101
  'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6115
6102
  }, text)])));
@@ -6165,12 +6152,12 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6165
6152
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6166
6153
 
6167
6154
 
6168
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)(['[:', '[^'], ']', '\n', (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']')), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6155
+ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6169
6156
  class: 'invalid',
6170
6157
  'data-invalid-syntax': 'extension',
6171
6158
  'data-invalid-type': 'syntax',
6172
6159
  'data-invalid-message': `Reserved start symbol "${as[0][1]}" cannot be used in "[]"`
6173
- }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6160
+ }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])))));
6174
6161
 
6175
6162
  /***/ }),
6176
6163
 
@@ -6211,8 +6198,8 @@ const attrspecs = {
6211
6198
  };
6212
6199
  global_1.Object.setPrototypeOf(attrspecs, null);
6213
6200
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6214
- exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.focus)('<wbr>', () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.focus)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6215
- /^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/, source => [[source], '']), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`)]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6201
+ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.creator)((0, combinator_1.precedence)(5, (0, combinator_1.union)([(0, combinator_1.focus)('<wbr>', () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.focus)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6202
+ /^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/, source => [[source], '']), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`), [[(0, util_1.blankWith)('\n', `</${tag}>`), 5]]), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 5]])]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))]))))));
6216
6203
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6217
6204
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
6218
6205
 
@@ -6326,7 +6313,7 @@ const dom_1 = __webpack_require__(3252);
6326
6313
 
6327
6314
  const array_1 = __webpack_require__(8112);
6328
6315
 
6329
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6316
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6330
6317
 
6331
6318
  /***/ }),
6332
6319
 
@@ -6339,7 +6326,7 @@ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6339
6326
  Object.defineProperty(exports, "__esModule", ({
6340
6327
  value: true
6341
6328
  }));
6342
- exports.resolve = exports.option = exports.uri = exports.link = void 0;
6329
+ exports.optimize = exports.resolve = exports.option = exports.uri = exports.textlink = exports.link = void 0;
6343
6330
 
6344
6331
  const global_1 = __webpack_require__(4128);
6345
6332
 
@@ -6365,7 +6352,7 @@ const optspec = {
6365
6352
  rel: ['nofollow']
6366
6353
  };
6367
6354
  Object.setPrototypeOf(optspec, null);
6368
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)(['[', '{'], '}', '\n', (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.context)({
6355
+ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.context)({
6369
6356
  syntax: {
6370
6357
  inline: {
6371
6358
  link: false
@@ -6384,14 +6371,25 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, co
6384
6371
  autolink: false
6385
6372
  }
6386
6373
  }
6387
- }, (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))), ']', true)]))), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]))), ([params, content = []], rest, context) => {
6374
+ }, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6375
+ (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []])), ([content, params], rest, context) => {
6376
+ if (params.length === 0) return;
6377
+ if (content[0] === '') return [content, rest];
6378
+ if (content.length !== 0 && (0, util_1.trimNode)(content).length === 0) return;
6388
6379
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))?.some(node => typeof node === 'object')) return;
6389
6380
  const INSECURE_URI = params.shift();
6390
6381
  const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6391
6382
  if (el.classList.contains('invalid')) return [[el], rest];
6392
6383
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6393
- }))));
6394
- exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6384
+ })))));
6385
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6386
+ params.shift();
6387
+ (0, util_1.trimNode)(content);
6388
+ const INSECURE_URI = params.shift();
6389
+ const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6390
+ return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6391
+ })))));
6392
+ exports.uri = (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]), ([uri]) => ['\r', uri]);
6395
6393
  exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
6396
6394
 
6397
6395
  function resolve(uri, host, source) {
@@ -6468,6 +6466,19 @@ function decode(uri) {
6468
6466
  }
6469
6467
  }
6470
6468
 
6469
+ function optimize(opener, ns, rest) {
6470
+ let count = 0;
6471
+
6472
+ for (let i = 0; i < ns.length - 1; i += 2) {
6473
+ if (ns[i] !== '' || ns[i + 1] !== opener[0]) break;
6474
+ ++count;
6475
+ }
6476
+
6477
+ return [['', opener[0].repeat(opener.length + count)], rest.slice(count)];
6478
+ }
6479
+
6480
+ exports.optimize = optimize;
6481
+
6471
6482
  /***/ }),
6472
6483
 
6473
6484
  /***/ 2480:
@@ -6493,7 +6504,7 @@ const dom_1 = __webpack_require__(3252);
6493
6504
 
6494
6505
  const array_1 = __webpack_require__(8112);
6495
6506
 
6496
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6507
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6497
6508
 
6498
6509
  /***/ }),
6499
6510
 
@@ -6514,9 +6525,9 @@ const source_1 = __webpack_require__(6743);
6514
6525
 
6515
6526
  const dom_1 = __webpack_require__(3252);
6516
6527
 
6517
- const syntax = /^(?:[ "([](?!\$)|\\{(?!\$)|\\[\\}$]?|^`|`(?!`)|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6528
+ const syntax = /^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6518
6529
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6519
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('$', (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', bracket, '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.some)((0, combinator_1.union)([bracket, quote, (0, source_1.str)(syntax)])), /^\$(?![0-9A-Za-z])/)]), (source, {
6530
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.precedence)(7, (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', bracket, '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, source_1.str)(syntax)])), /^\$(?![0-9A-Za-z])/)]), (source, {
6520
6531
  caches: {
6521
6532
  math: cache
6522
6533
  } = {}
@@ -6530,9 +6541,8 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combin
6530
6541
  'data-invalid-syntax': 'math',
6531
6542
  'data-invalid-type': 'content',
6532
6543
  'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
6533
- }, source)], '']))));
6544
+ }, source)], ''])))));
6534
6545
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^(?:[{}$]|\\?\n)/)])), '}', true)));
6535
- const quote = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('``', (0, combinator_1.some)((0, combinator_1.union)([quote, bracket, (0, combinator_1.focus)(/^(?:\\[\\{}$]|`(?!`)|[^`{}"$\n\P{ASCII}])*/u, (0, source_1.str)(syntax))])), /^"?/, true)));
6536
6546
 
6537
6547
  /***/ }),
6538
6548
 
@@ -6572,7 +6582,7 @@ const optspec = {
6572
6582
  rel: global_1.undefined
6573
6583
  };
6574
6584
  Object.setPrototypeOf(optspec, null);
6575
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)(['![', '!{'], '}', '\n', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)(/^\[(?!\s*\\\s)/, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', /^\\?\n/), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6585
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6576
6586
  const INSECURE_URI = params.shift();
6577
6587
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href);
6578
6588
  let cache;
@@ -6591,11 +6601,11 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, c
6591
6601
  }
6592
6602
 
6593
6603
  if (context.syntax?.inline?.link === false || cache && cache.tagName !== 'IMG') return [[el], rest];
6594
- return (0, combinator_1.fmap)(link_1.link, ([link]) => [(0, dom_1.define)(link, {
6604
+ return (0, combinator_1.fmap)(link_1.textlink, ([link]) => [(0, dom_1.define)(link, {
6595
6605
  target: '_blank'
6596
6606
  }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
6597
- }))));
6598
- const bracket = (0, combinator_1.lazy)(() => (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"'), (0, source_1.str)('"'), true)]));
6607
+ })))));
6608
+ const bracket = (0, combinator_1.lazy)(() => (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)]));
6599
6609
  const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
6600
6610
 
6601
6611
  function sanitize(target, uri, alt) {
@@ -6657,13 +6667,15 @@ const combinator_1 = __webpack_require__(2087);
6657
6667
 
6658
6668
  const inline_1 = __webpack_require__(1160);
6659
6669
 
6670
+ const link_1 = __webpack_require__(9628);
6671
+
6660
6672
  const source_1 = __webpack_require__(6743);
6661
6673
 
6662
6674
  const util_1 = __webpack_require__(9437);
6663
6675
 
6664
6676
  const dom_1 = __webpack_require__(3252);
6665
6677
 
6666
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[[', ']]', '\n', (0, combinator_1.fmap)((0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, combinator_1.context)({
6678
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[[', (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
6667
6679
  syntax: {
6668
6680
  inline: {
6669
6681
  annotation: false,
@@ -6677,7 +6689,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6677
6689
  }
6678
6690
  },
6679
6691
  delimiters: global_1.undefined
6680
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)), (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
6692
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])])), ']')), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))))));
6681
6693
  const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(util_1.regBlankStart, '')]));
6682
6694
 
6683
6695
  function attributes(ns) {
@@ -6723,19 +6735,18 @@ const dom_1 = __webpack_require__(3252);
6723
6735
 
6724
6736
  const array_1 = __webpack_require__(8112);
6725
6737
 
6726
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[', ')', '\n', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\[\]\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\(\)\n])+(?=\))/, text), ')')]), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies], rest) => {
6727
- const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
6728
- tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
6738
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
6739
+ texts[texts.length - 1] === '' && texts.pop();
6729
6740
 
6730
6741
  switch (true) {
6731
6742
  case rubies.length <= texts.length:
6732
- return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.push)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), []), tail)))], rest];
6743
+ return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))];
6733
6744
 
6734
6745
  case texts.length === 1 && [...texts[0]].length >= rubies.length:
6735
- return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.push)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), []), tail)))], rest];
6746
+ return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))];
6736
6747
 
6737
6748
  default:
6738
- return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')]), tail)))], rest];
6749
+ return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))];
6739
6750
  }
6740
6751
  }))));
6741
6752
  const text = (0, combinator_1.creator)((source, context) => {
@@ -6842,7 +6853,7 @@ const dom_1 = __webpack_require__(3252);
6842
6853
 
6843
6854
  const array_1 = __webpack_require__(8112);
6844
6855
 
6845
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6856
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6846
6857
 
6847
6858
  /***/ }),
6848
6859
 
@@ -6867,10 +6878,10 @@ const dom_1 = __webpack_require__(3252);
6867
6878
 
6868
6879
  const array_1 = __webpack_require__(8112);
6869
6880
 
6870
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6881
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6871
6882
  class: 'template'
6872
- }, source.replace(/\x1B/g, ''))], ''])));
6873
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/), (0, source_1.str)('"'), true)]));
6883
+ }, source.replace(/\x1B/g, ''))], '']))));
6884
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)]));
6874
6885
 
6875
6886
  /***/ }),
6876
6887
 
@@ -7769,7 +7780,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7769
7780
  Object.defineProperty(exports, "__esModule", ({
7770
7781
  value: true
7771
7782
  }));
7772
- exports.stringify = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = void 0;
7783
+ exports.stringify = exports.trimNode = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = exports.clean = void 0;
7773
7784
 
7774
7785
  const global_1 = __webpack_require__(4128);
7775
7786
 
@@ -7787,6 +7798,21 @@ const memoize_1 = __webpack_require__(1808);
7787
7798
 
7788
7799
  const array_1 = __webpack_require__(8112);
7789
7800
 
7801
+ function clean(parser) {
7802
+ const clean = (0, memoize_1.memoize)(context => ({
7803
+ resources: context.resources,
7804
+ precedence: context.precedence,
7805
+ delimiters: context.delimiters,
7806
+ host: context.host,
7807
+ url: context.url,
7808
+ id: context.id,
7809
+ header: context.header,
7810
+ cache: context.caches
7811
+ }), new WeakMap());
7812
+ return (source, context) => parser(source, context.syntax ? clean(context) : context);
7813
+ }
7814
+
7815
+ exports.clean = clean;
7790
7816
  exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
7791
7817
 
7792
7818
  function blankWith(starting, delimiter) {
@@ -7949,23 +7975,32 @@ function trimBlankEnd(parser) {
7949
7975
  return (0, combinator_1.fmap)(parser, trimNodeEnd);
7950
7976
  }
7951
7977
 
7952
- exports.trimBlankEnd = trimBlankEnd; //export function trimNode(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7953
- // return trimNodeStart(trimNodeEnd(nodes));
7954
- //}
7955
- //function trimNodeStart(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7956
- // for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
7957
- // if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer') break;
7958
- // if (typeof node === 'string') {
7959
- // const pos = node.length - node.trimStart().length;
7960
- // if (pos > 0) {
7961
- // nodes[0] = node.slice(pos);
7962
- // break;
7963
- // }
7964
- // }
7965
- // nodes.shift();
7966
- // }
7967
- // return nodes;
7968
- //}
7978
+ exports.trimBlankEnd = trimBlankEnd;
7979
+
7980
+ function trimNode(nodes) {
7981
+ return trimNodeStart(trimNodeEnd(nodes));
7982
+ }
7983
+
7984
+ exports.trimNode = trimNode;
7985
+
7986
+ function trimNodeStart(nodes) {
7987
+ for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
7988
+ if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer') break;
7989
+
7990
+ if (typeof node === 'string') {
7991
+ const pos = node.trimStart().length;
7992
+
7993
+ if (pos > 0) {
7994
+ nodes[0] = node.slice(pos);
7995
+ break;
7996
+ }
7997
+ }
7998
+
7999
+ nodes.shift();
8000
+ }
8001
+
8002
+ return nodes;
8003
+ }
7969
8004
 
7970
8005
  function trimNodeEnd(nodes) {
7971
8006
  const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];