securemark 0.298.6 → 0.299.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 (58) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/index.js +316 -553
  3. package/package.json +1 -1
  4. package/src/combinator/control/constraint/block.ts +8 -5
  5. package/src/combinator/control/constraint/line.ts +13 -7
  6. package/src/combinator/control/manipulation/convert.ts +8 -11
  7. package/src/combinator/control/manipulation/match.ts +8 -4
  8. package/src/combinator/control/manipulation/scope.ts +6 -4
  9. package/src/combinator/control/monad/bind.ts +14 -6
  10. package/src/combinator/data/parser/context.ts +1 -74
  11. package/src/combinator/data/parser.ts +10 -8
  12. package/src/parser/api/normalize.ts +2 -0
  13. package/src/parser/api/parse.test.ts +3 -21
  14. package/src/parser/block/blockquote.ts +7 -7
  15. package/src/parser/block/extension/aside.ts +1 -1
  16. package/src/parser/block/extension/example.ts +1 -1
  17. package/src/parser/block/extension/fig.ts +4 -4
  18. package/src/parser/block/extension/figbase.ts +1 -1
  19. package/src/parser/block/extension/figure.ts +3 -3
  20. package/src/parser/block/extension/message.ts +1 -1
  21. package/src/parser/block/extension/table.ts +8 -8
  22. package/src/parser/block/heading.ts +1 -1
  23. package/src/parser/block/ilist.ts +3 -3
  24. package/src/parser/block/mediablock.ts +1 -1
  25. package/src/parser/block/olist.ts +2 -2
  26. package/src/parser/block/pagebreak.ts +1 -1
  27. package/src/parser/block/reply/cite.ts +1 -1
  28. package/src/parser/block/sidefence.ts +6 -6
  29. package/src/parser/block/table.ts +2 -2
  30. package/src/parser/block/ulist.ts +3 -3
  31. package/src/parser/context.ts +0 -2
  32. package/src/parser/header.ts +2 -3
  33. package/src/parser/inline/annotation.test.ts +6 -10
  34. package/src/parser/inline/annotation.ts +31 -113
  35. package/src/parser/inline/autolink/url.ts +1 -1
  36. package/src/parser/inline/code.ts +1 -1
  37. package/src/parser/inline/deletion.ts +5 -4
  38. package/src/parser/inline/emstrong.ts +11 -4
  39. package/src/parser/inline/extension/indexer.ts +1 -1
  40. package/src/parser/inline/extension/placeholder.ts +1 -1
  41. package/src/parser/inline/html.ts +1 -1
  42. package/src/parser/inline/insertion.ts +5 -4
  43. package/src/parser/inline/italic.ts +5 -4
  44. package/src/parser/inline/link.ts +1 -1
  45. package/src/parser/inline/mark.ts +7 -6
  46. package/src/parser/inline/math.ts +2 -2
  47. package/src/parser/inline/remark.ts +2 -2
  48. package/src/parser/inline/ruby.ts +1 -1
  49. package/src/parser/inline/shortmedia.ts +1 -1
  50. package/src/parser/inline.test.ts +2 -2
  51. package/src/parser/repeat.ts +136 -0
  52. package/src/parser/segment.ts +1 -2
  53. package/src/parser/source/escapable.ts +1 -1
  54. package/src/parser/source/text.test.ts +4 -0
  55. package/src/parser/source/text.ts +2 -0
  56. package/src/parser/util.ts +1 -70
  57. package/src/parser/visibility.ts +17 -13
  58. package/src/combinator/data/parser/context.test.ts +0 -62
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.298.6 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.299.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("Prism"), require("DOMPurify"));
@@ -167,129 +167,6 @@ exports.splice = splice;
167
167
 
168
168
  /***/ },
169
169
 
170
- /***/ 9888
171
- (__unused_webpack_module, exports, __webpack_require__) {
172
-
173
- "use strict";
174
-
175
-
176
- Object.defineProperty(exports, "__esModule", ({
177
- value: true
178
- }));
179
- exports.template = exports.inherit = exports.merge = exports.extend = exports.overwrite = exports.clone = exports.assign = void 0;
180
- const alias_1 = __webpack_require__(5413);
181
- const type_1 = __webpack_require__(113);
182
- const array_1 = __webpack_require__(6876);
183
- exports.assign = template((prop, target, source) => target[prop] = source[prop]);
184
- exports.clone = template((prop, target, source) => {
185
- switch ((0, type_1.type)(source[prop])) {
186
- case 'Array':
187
- return target[prop] = source[prop].slice();
188
- case 'Object':
189
- switch ((0, type_1.type)(target[prop])) {
190
- case 'Object':
191
- return target[prop] = (0, exports.clone)(empty(source[prop]), source[prop]);
192
- default:
193
- return target[prop] = source[prop];
194
- }
195
- default:
196
- return target[prop] = source[prop];
197
- }
198
- });
199
- exports.overwrite = template((prop, target, source) => {
200
- switch ((0, type_1.type)(source[prop])) {
201
- case 'Array':
202
- return target[prop] = source[prop];
203
- case 'Object':
204
- switch ((0, type_1.type)(target[prop])) {
205
- case 'Object':
206
- return (0, exports.overwrite)(target[prop], source[prop]);
207
- default:
208
- return target[prop] = (0, exports.overwrite)(empty(source[prop]), source[prop]);
209
- }
210
- default:
211
- return target[prop] = source[prop];
212
- }
213
- });
214
- exports.extend = template((prop, target, source) => {
215
- switch ((0, type_1.type)(source[prop])) {
216
- case 'undefined':
217
- return;
218
- case 'Array':
219
- return target[prop] = source[prop];
220
- case 'Object':
221
- switch ((0, type_1.type)(target[prop])) {
222
- case 'Object':
223
- return (0, exports.extend)(target[prop], source[prop]);
224
- default:
225
- return target[prop] = (0, exports.extend)(empty(source[prop]), source[prop]);
226
- }
227
- default:
228
- return target[prop] = source[prop];
229
- }
230
- });
231
- exports.merge = template((prop, target, source) => {
232
- switch ((0, type_1.type)(source[prop])) {
233
- case 'undefined':
234
- return;
235
- case 'Array':
236
- switch ((0, type_1.type)(target[prop])) {
237
- case 'Array':
238
- return target[prop] = (0, array_1.push)(target[prop], source[prop]);
239
- default:
240
- return target[prop] = source[prop].slice();
241
- }
242
- case 'Object':
243
- switch ((0, type_1.type)(target[prop])) {
244
- case 'Object':
245
- return (0, exports.merge)(target[prop], source[prop]);
246
- default:
247
- return target[prop] = (0, exports.merge)(empty(source[prop]), source[prop]);
248
- }
249
- default:
250
- return target[prop] = source[prop];
251
- }
252
- });
253
- exports.inherit = template((prop, target, source) => {
254
- switch ((0, type_1.type)(source[prop])) {
255
- case 'undefined':
256
- return;
257
- case 'Array':
258
- return target[prop] = source[prop].slice();
259
- case 'Object':
260
- switch ((0, type_1.type)(target[prop])) {
261
- case 'Object':
262
- return (0, exports.inherit)(target[prop], source[prop]);
263
- default:
264
- return target[prop] = (0, alias_1.ObjectCreate)(source[prop]);
265
- }
266
- default:
267
- return target[prop] = source[prop];
268
- }
269
- });
270
- function template(strategy) {
271
- return walk;
272
- function walk(target, ...sources) {
273
- if ((0, type_1.isPrimitive)(target)) return target;
274
- for (let i = 0; i < sources.length; ++i) {
275
- const source = sources[i];
276
- if (source === target) continue;
277
- if ((0, type_1.isPrimitive)(source)) continue;
278
- const keys = Object.keys(source);
279
- for (let i = 0; i < keys.length; ++i) {
280
- strategy(keys[i], target, source);
281
- }
282
- }
283
- return target;
284
- }
285
- }
286
- exports.template = template;
287
- function empty(source) {
288
- return source instanceof Object ? {} : (0, alias_1.ObjectCreate)(null);
289
- }
290
-
291
- /***/ },
292
-
293
170
  /***/ 6212
294
171
  (__unused_webpack_module, exports, __webpack_require__) {
295
172
 
@@ -2193,68 +2070,6 @@ True LRUにおけるLRUからの大幅な改善はすべてのアルゴリズム
2193
2070
 
2194
2071
  /***/ },
2195
2072
 
2196
- /***/ 113
2197
- (__unused_webpack_module, exports, __webpack_require__) {
2198
-
2199
- "use strict";
2200
-
2201
-
2202
- Object.defineProperty(exports, "__esModule", ({
2203
- value: true
2204
- }));
2205
- exports.isPrimitive = exports.is = exports.type = void 0;
2206
- const alias_1 = __webpack_require__(5413);
2207
- const ObjectPrototype = Object.prototype;
2208
- const ArrayPrototype = Array.prototype;
2209
- function type(value) {
2210
- const type = typeof value;
2211
- switch (type) {
2212
- case 'function':
2213
- return 'Function';
2214
- case 'object':
2215
- if (value === null) return 'null';
2216
- const tag = value[Symbol.toStringTag];
2217
- if (tag) return tag;
2218
- switch ((0, alias_1.ObjectGetPrototypeOf)(value)) {
2219
- case ArrayPrototype:
2220
- return 'Array';
2221
- case ObjectPrototype:
2222
- return 'Object';
2223
- default:
2224
- return value?.constructor?.name || (0, alias_1.toString)(value).slice(8, -1);
2225
- }
2226
- default:
2227
- return type;
2228
- }
2229
- }
2230
- exports.type = type;
2231
- function is(type, value) {
2232
- switch (type) {
2233
- case 'null':
2234
- return value === null;
2235
- case 'array':
2236
- return (0, alias_1.isArray)(value);
2237
- case 'object':
2238
- return value !== null && typeof value === type;
2239
- default:
2240
- return typeof value === type;
2241
- }
2242
- }
2243
- exports.is = is;
2244
- function isPrimitive(value) {
2245
- switch (typeof value) {
2246
- case 'function':
2247
- return false;
2248
- case 'object':
2249
- return value === null;
2250
- default:
2251
- return true;
2252
- }
2253
- }
2254
- exports.isPrimitive = isPrimitive;
2255
-
2256
- /***/ },
2257
-
2258
2073
  /***/ 1904
2259
2074
  (__unused_webpack_module, exports, __webpack_require__) {
2260
2075
 
@@ -2574,7 +2389,7 @@ exports.block = void 0;
2574
2389
  const parser_1 = __webpack_require__(605);
2575
2390
  const line_1 = __webpack_require__(8287);
2576
2391
  function block(parser, separation = true, segment = 0) {
2577
- return (0, parser_1.failsafe)(input => {
2392
+ return input => {
2578
2393
  const context = input;
2579
2394
  const {
2580
2395
  source,
@@ -2587,13 +2402,15 @@ function block(parser, separation = true, segment = 0) {
2587
2402
  return new parser_1.List();
2588
2403
  }
2589
2404
  const result = parser(input);
2590
- if (result === undefined) return;
2591
- if (separation && !(0, line_1.isEmptyline)(source, context.position)) return;
2405
+ if (result === undefined || separation && !(0, line_1.isEmptyline)(source, context.position)) {
2406
+ context.position = position;
2407
+ return;
2408
+ }
2592
2409
  if (segment !== 0 && context.segment & 1 /* Segment.write */ ^ 1 /* Segment.write */) {
2593
2410
  context.segment = segment;
2594
2411
  }
2595
2412
  return result;
2596
- });
2413
+ };
2597
2414
  }
2598
2415
  exports.block = block;
2599
2416
 
@@ -2639,7 +2456,7 @@ Object.defineProperty(exports, "__esModule", ({
2639
2456
  exports.isEmptyline = exports.firstline = exports.line = void 0;
2640
2457
  const parser_1 = __webpack_require__(605);
2641
2458
  function line(parser) {
2642
- return (0, parser_1.failsafe)(context => {
2459
+ return context => {
2643
2460
  const {
2644
2461
  source,
2645
2462
  position
@@ -2648,15 +2465,16 @@ function line(parser) {
2648
2465
  const line = firstline(source, position);
2649
2466
  context.offset += position;
2650
2467
  const result = parser((0, parser_1.input)(line, context));
2651
- context.position += position;
2652
- context.position += result && context.position === position ? line.length : 0;
2653
2468
  context.source = source;
2469
+ context.position = result ? context.position === 0 ? position + line.length : position + context.position : position;
2654
2470
  context.offset -= position;
2655
- if (result === undefined) return;
2656
- if (context.position < position + line.length && !isEmptyline(source, context.position)) return;
2471
+ if (result === undefined || context.position < position + line.length && !isEmptyline(source, context.position)) {
2472
+ context.position = position;
2473
+ return;
2474
+ }
2657
2475
  context.position = position + line.length;
2658
2476
  return result;
2659
- });
2477
+ };
2660
2478
  }
2661
2479
  exports.line = line;
2662
2480
  function firstline(source, position) {
@@ -2702,28 +2520,24 @@ Object.defineProperty(exports, "__esModule", ({
2702
2520
  }));
2703
2521
  exports.convert = void 0;
2704
2522
  const parser_1 = __webpack_require__(605);
2705
- function convert(conv, parser, empty = false) {
2706
- return (0, parser_1.failsafe)(input => {
2523
+ function convert(conv, parser) {
2524
+ return input => {
2707
2525
  const context = input;
2708
2526
  const {
2709
2527
  source,
2710
- position
2528
+ position,
2529
+ offset
2711
2530
  } = context;
2712
2531
  if (position === source.length) return;
2713
2532
  const src = conv(source.slice(position), context);
2714
2533
  if (src === '') {
2715
- if (!empty) return;
2716
2534
  context.position = source.length;
2717
2535
  return new parser_1.List();
2718
2536
  }
2719
- const {
2720
- offset,
2721
- backtracks
2722
- } = context;
2723
2537
  const result = parser((0, parser_1.subinput)(src, context));
2724
- context.position = context.source.length;
2538
+ context.position = result ? context.source.length : position;
2725
2539
  return result;
2726
- });
2540
+ };
2727
2541
  }
2728
2542
  exports.convert = convert;
2729
2543
 
@@ -2900,11 +2714,10 @@ Object.defineProperty(exports, "__esModule", ({
2900
2714
  value: true
2901
2715
  }));
2902
2716
  exports.match = void 0;
2903
- const parser_1 = __webpack_require__(605);
2904
2717
  const combinator_1 = __webpack_require__(3484);
2905
2718
  function match(pattern, f) {
2906
2719
  const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
2907
- return (0, parser_1.failsafe)(input => {
2720
+ return input => {
2908
2721
  const context = input;
2909
2722
  const {
2910
2723
  source,
@@ -2916,9 +2729,9 @@ function match(pattern, f) {
2916
2729
  if (!params) return;
2917
2730
  count && (0, combinator_1.consume)(params[0].length, context);
2918
2731
  const result = f(params)(input);
2919
- context.position += result && context.position === position ? params[0].length : 0;
2732
+ context.position += result ? context.position === position ? params[0].length : 0 : context.position - position;
2920
2733
  return result;
2921
- });
2734
+ };
2922
2735
  }
2923
2736
  exports.match = match;
2924
2737
 
@@ -2989,6 +2802,7 @@ function focus(scope, parser, slice = true) {
2989
2802
  const match = (0, delimiter_1.matcher)(scope, false);
2990
2803
  return (0, parser_1.failsafe)(context => {
2991
2804
  const {
2805
+ SID,
2992
2806
  source,
2993
2807
  position
2994
2808
  } = context;
@@ -3003,9 +2817,10 @@ function focus(scope, parser, slice = true) {
3003
2817
  }
3004
2818
  context.offset += position;
3005
2819
  const result = parser((0, parser_1.input)(src, context));
2820
+ context.source = source;
2821
+ context.SID = SID;
3006
2822
  context.position += position;
3007
2823
  context.position += result && context.position === position ? src.length : 0;
3008
- context.source = source;
3009
2824
  context.offset -= position;
3010
2825
  return result;
3011
2826
  });
@@ -3014,6 +2829,7 @@ exports.focus = focus;
3014
2829
  function rewrite(scope, parser, slice = true) {
3015
2830
  return (0, parser_1.failsafe)(context => {
3016
2831
  const {
2832
+ SID,
3017
2833
  source,
3018
2834
  position
3019
2835
  } = context;
@@ -3030,9 +2846,10 @@ function rewrite(scope, parser, slice = true) {
3030
2846
  const src = source.slice(position, context.position);
3031
2847
  context.offset += position;
3032
2848
  const res2 = parser((0, parser_1.input)(src, context));
2849
+ context.SID = SID;
2850
+ context.source = source;
3033
2851
  context.position += position;
3034
2852
  context.position += res2 && context.position === position ? src.length : 0;
3035
- context.source = source;
3036
2853
  context.offset -= position;
3037
2854
  return res2;
3038
2855
  });
@@ -3171,7 +2988,7 @@ function revert(context, linebreak) {
3171
2988
  /***/ },
3172
2989
 
3173
2990
  /***/ 994
3174
- (__unused_webpack_module, exports, __webpack_require__) {
2991
+ (__unused_webpack_module, exports) {
3175
2992
 
3176
2993
  "use strict";
3177
2994
 
@@ -3180,20 +2997,27 @@ Object.defineProperty(exports, "__esModule", ({
3180
2997
  value: true
3181
2998
  }));
3182
2999
  exports.bind = void 0;
3183
- const parser_1 = __webpack_require__(605);
3184
3000
  function bind(parser, f) {
3185
- return (0, parser_1.failsafe)(input => {
3001
+ return input => {
3186
3002
  const context = input;
3187
3003
  const {
3188
3004
  source,
3189
3005
  position
3190
3006
  } = context;
3191
3007
  if (position === source.length) return;
3192
- const result = parser(input);
3193
- if (result === undefined) return;
3008
+ const res1 = parser(input);
3009
+ if (res1 === undefined) {
3010
+ context.position = position;
3011
+ return;
3012
+ }
3194
3013
  context.range = context.position - position;
3195
- return f(result, context);
3196
- });
3014
+ const res2 = f(res1, context);
3015
+ if (res2 === undefined) {
3016
+ context.position = position;
3017
+ return;
3018
+ }
3019
+ return res2;
3020
+ };
3197
3021
  }
3198
3022
  exports.bind = bind;
3199
3023
 
@@ -3682,6 +3506,10 @@ class Context {
3682
3506
  this.offset = offset ?? 0;
3683
3507
  this.backtracks = backtracks ?? {};
3684
3508
  }
3509
+ clone() {
3510
+ // @ts-ignore
3511
+ return new this.constructor(this);
3512
+ }
3685
3513
  }
3686
3514
  exports.Context = Context;
3687
3515
  function input(source, context) {
@@ -3692,14 +3520,12 @@ function input(source, context) {
3692
3520
  }
3693
3521
  exports.input = input;
3694
3522
  function subinput(source, context) {
3695
- return {
3696
- ...context,
3697
- SID: sid(),
3698
- source,
3699
- position: 0,
3700
- offset: 0,
3701
- backtracks: {}
3702
- };
3523
+ const c = context.clone();
3524
+ c.source = source;
3525
+ c.position = 0;
3526
+ c.offset = 0;
3527
+ c.backtracks = {};
3528
+ return c;
3703
3529
  }
3704
3530
  exports.subinput = subinput;
3705
3531
  function failsafe(parser) {
@@ -3721,69 +3547,8 @@ exports.failsafe = failsafe;
3721
3547
  Object.defineProperty(exports, "__esModule", ({
3722
3548
  value: true
3723
3549
  }));
3724
- exports.constraint = exports.state = exports.precedence = exports.recursions = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
3550
+ exports.constraint = exports.state = exports.precedence = exports.recursions = exports.recursion = exports.consume = exports.creation = void 0;
3725
3551
  const alias_1 = __webpack_require__(5413);
3726
- const assign_1 = __webpack_require__(9888);
3727
- function reset(base, parser) {
3728
- const clock = base.resources?.clock;
3729
- const recursions = base.resources?.recursions;
3730
- return input => {
3731
- const context = input;
3732
- // @ts-expect-error
3733
- context.resources ??= {
3734
- clock,
3735
- recursions: recursions?.slice()
3736
- };
3737
- context.backtracks = {};
3738
- return parser(input);
3739
- };
3740
- // removed by dead control flow
3741
-
3742
- // removed by dead control flow
3743
-
3744
- // removed by dead control flow
3745
-
3746
- }
3747
- exports.reset = reset;
3748
- function context(base, parser) {
3749
- const changes = Object.entries(base);
3750
- const values = Array(changes.length);
3751
- return context => apply(parser, context, changes, values);
3752
- }
3753
- exports.context = context;
3754
- function apply(parser, context, changes, values, reset = false) {
3755
- for (let i = 0; i < changes.length; ++i) {
3756
- const change = changes[i];
3757
- const prop = change[0];
3758
- switch (prop) {
3759
- case 'source':
3760
- case 'position':
3761
- continue;
3762
- case 'resources':
3763
- values[i] = context[prop];
3764
- context[prop] ??= (0, assign_1.clone)({}, change[1]);
3765
- continue;
3766
- case 'backtracks':
3767
- change[1] = {};
3768
- }
3769
- values[i] = context[prop];
3770
- context[prop] = change[1];
3771
- }
3772
- const result = parser(context);
3773
- for (let i = 0; i < changes.length; ++i) {
3774
- const change = changes[i];
3775
- const prop = change[0];
3776
- switch (prop) {
3777
- case 'source':
3778
- case 'position':
3779
- continue;
3780
- case 'resources':
3781
- }
3782
- context[prop] = values[i];
3783
- values[i] = undefined;
3784
- }
3785
- return result;
3786
- }
3787
3552
  function creation(cost, parser) {
3788
3553
  return input => {
3789
3554
  const context = input;
@@ -4459,7 +4224,7 @@ function parse(source) {
4459
4224
  Object.defineProperty(exports, "__esModule", ({
4460
4225
  value: true
4461
4226
  }));
4462
- exports.escape = exports.invisibleGraphHTMLEntityNames = exports.invisibleBlankHTMLEntityNames = exports.normalize = void 0;
4227
+ exports.escape = exports.invisibleGraphHTMLEntityNames = exports.invisibleBlankCharacters = exports.invisibleBlankHTMLEntityNames = exports.normalize = void 0;
4463
4228
  const dom_1 = __webpack_require__(394);
4464
4229
  const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
4465
4230
  function normalize(source) {
@@ -4486,6 +4251,7 @@ const parser = (el => entity => {
4486
4251
  return el.textContent;
4487
4252
  })((0, dom_1.html)('span'));
4488
4253
  exports.invisibleBlankHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() === '');
4254
+ exports.invisibleBlankCharacters = exports.invisibleBlankHTMLEntityNames.map(name => parser(`&${name};`));
4489
4255
  exports.invisibleGraphHTMLEntityNames = invisibleHTMLEntityNames.filter(name => parser(`&${name};`).trimStart() !== '');
4490
4256
  const unreadableEscapeHTMLEntityNames = invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
4491
4257
  const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => parser(`&${name};`));
@@ -4732,11 +4498,11 @@ const parse_1 = __webpack_require__(3662);
4732
4498
  const dom_1 = __webpack_require__(394);
4733
4499
  exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+ /y, (0, combinator_1.some)(source_1.contentline))]));
4734
4500
  exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.union)([(0, combinator_1.open)(/(?=>)/y, source), (0, combinator_1.open)(/!(?=>)/y, markdown)]))));
4735
- const opener = /(?=>>+(?:$|[ \n]))/y;
4736
- const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y));
4737
- const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
4738
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4739
- const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, context => {
4501
+ const opener = /(?=>>+(?:$|[ \r\n]))/y;
4502
+ const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \r\n])/y));
4503
+ const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \r\n])))|\r?\n$/g, '');
4504
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4505
+ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, context => {
4740
4506
  (0, combinator_1.consume)(10, context);
4741
4507
  const {
4742
4508
  source
@@ -4753,7 +4519,7 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4753
4519
  }, context);
4754
4520
  context.position = source.length;
4755
4521
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4756
- }, true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4522
+ }))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4757
4523
 
4758
4524
  /***/ },
4759
4525
 
@@ -4887,7 +4653,7 @@ const indexee_1 = __webpack_require__(7610);
4887
4653
  const util_1 = __webpack_require__(4992);
4888
4654
  const parse_1 = __webpack_require__(3662);
4889
4655
  const dom_1 = __webpack_require__(394);
4890
- exports.aside = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/y, 300),
4656
+ exports.aside = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})aside(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
4891
4657
  // Bug: Type mismatch between outer and inner.
4892
4658
  (nodes, context) => {
4893
4659
  const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
@@ -4936,7 +4702,7 @@ const mathblock_1 = __webpack_require__(4903);
4936
4702
  const util_1 = __webpack_require__(4992);
4937
4703
  const parse_1 = __webpack_require__(3662);
4938
4704
  const dom_1 = __webpack_require__(394);
4939
- exports.example = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y, 300),
4705
+ exports.example = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:example\/(\S+))?(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
4940
4706
  // Bug: Type mismatch between outer and inner.
4941
4707
  (nodes, context) => {
4942
4708
  const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
@@ -5003,21 +4769,21 @@ const table_1 = __webpack_require__(3646);
5003
4769
  const blockquote_1 = __webpack_require__(5885);
5004
4770
  const placeholder_1 = __webpack_require__(4091);
5005
4771
  const inline_1 = __webpack_require__(7973);
5006
- exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\r?\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
4772
+ exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S)[^\r\n]*\r?\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
5007
4773
  exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
5008
4774
  // Bug: TypeScript
5009
- const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/gm) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
4775
+ const fence = (/^[^\r\n]*\r?\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\r\n]*$)/gm) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
5010
4776
  const {
5011
4777
  position
5012
4778
  } = context;
5013
4779
  const result = parser(context);
5014
4780
  context.position = position;
5015
4781
  context.segment = 10 /* Segment.figure */ | 1 /* Segment.write */;
5016
- return result ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4782
+ return result ? `${fence}figure ${source.replace(/^([^\r\n]+\r?\n[^\r\n]+\r?\n)(.+?)\r?\n?$/s, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
5017
4783
  }, (0, combinator_1.union)([figure_1.figure])), ([{
5018
4784
  value: el
5019
4785
  }]) => el.tagName === 'FIGURE')));
5020
- const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
4786
+ const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S)[^\r\n]*\r?\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
5021
4787
 
5022
4788
  /***/ },
5023
4789
 
@@ -5035,7 +4801,7 @@ const parser_1 = __webpack_require__(605);
5035
4801
  const combinator_1 = __webpack_require__(3484);
5036
4802
  const label_1 = __webpack_require__(2178);
5037
4803
  const dom_1 = __webpack_require__(394);
5038
- exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?:$|\n)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
4804
+ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\r\n]*(?:$|\r?\n)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
5039
4805
  value: el
5040
4806
  }]) => {
5041
4807
  const label = el.getAttribute('data-label');
@@ -5080,16 +4846,16 @@ const dom_1 = __webpack_require__(394);
5080
4846
  exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\r\n]*(?:$|\r?\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
5081
4847
  // All parsers which can include closing terms.
5082
4848
  (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length - 1, [], 2 ** 4 - 1)), true, 10 /* Segment.figure */);
5083
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?!\S).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])])), nodes => {
4849
+ 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)[^\r\n]*\r?\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])])), nodes => {
5084
4850
  const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
5085
4851
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
5086
4852
  class: 'figindex'
5087
4853
  }), (0, dom_1.html)('span', {
5088
4854
  class: 'figtext'
5089
4855
  }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])]))]);
5090
- })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \n])|\[?\$)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
4856
+ })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \r\n])|\[?\$)[^\r\n]*(?:$|\r?\n)/y, 300), (nodes, context) => {
5091
4857
  const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
5092
- const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure )?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4858
+ const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure )?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\r\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
5093
4859
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5094
4860
  class: 'invalid',
5095
4861
  translate: 'no',
@@ -5163,7 +4929,7 @@ const paragraph_1 = __webpack_require__(4330);
5163
4929
  const util_1 = __webpack_require__(4992);
5164
4930
  const array_1 = __webpack_require__(6876);
5165
4931
  const dom_1 = __webpack_require__(394);
5166
- exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)(?!\S)([^\n]*)(?:$|\n)/y, 300),
4932
+ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
5167
4933
  // Bug: Type mismatch between outer and inner.
5168
4934
  (nodes, context) => {
5169
4935
  const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
@@ -5281,13 +5047,13 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
5281
5047
  }));
5282
5048
  const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', format([...(0, util_1.unwrap)(rows)])))]))));
5283
5049
  const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.union)([align]), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => Array.isArray(ns.head?.value) ? ns : ns.unshift(new parser_1.Node([[]])) && ns)));
5284
- const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
5050
+ const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\r\n]*\r?\n)/y;
5285
5051
  const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
5286
5052
  value
5287
5053
  }]) => new parser_1.List([new parser_1.Node(value.split('/').map(s => s.split('')))])));
5288
- const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
5289
- const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5290
- const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5054
+ const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\r\n]*\r?\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \r\n])/y;
5055
+ const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \r\n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\r\n]*(?:$|\r?\n)/y)), (0, combinator_1.open)(/(?:[^\S\r\n]*\r?\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5056
+ const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \r\n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\r\n]*(?:$|\r?\n)/y)), (0, combinator_1.open)(/(?:[^\S\r\n]*\r?\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5291
5057
  const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+ /y, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)])));
5292
5058
  function attributes(source) {
5293
5059
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
@@ -5508,7 +5274,7 @@ const source_1 = __webpack_require__(8745);
5508
5274
  const visibility_1 = __webpack_require__(6364);
5509
5275
  const util_1 = __webpack_require__(4992);
5510
5276
  const dom_1 = __webpack_require__(394);
5511
- exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\r\n]*(?:\r?\n#+(?=$| |\r?\n)[^\r\n]*)*(?:$|\r?\n)/y, input => {
5277
+ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\r\n]*(?:\r?\n#+(?=$|[ \r\n])[^\r\n]*)*(?:$|\r?\n)/y, input => {
5512
5278
  const context = input;
5513
5279
  const {
5514
5280
  source,
@@ -5556,7 +5322,7 @@ const visibility_1 = __webpack_require__(6364);
5556
5322
  const util_1 = __webpack_require__(4992);
5557
5323
  const dom_1 = __webpack_require__(394);
5558
5324
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
5559
- exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('ul', {
5325
+ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \r\n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \r\n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('ul', {
5560
5326
  class: 'invalid',
5561
5327
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5562
5328
  }, (0, util_1.unwrap)(ns)))]))));
@@ -5567,7 +5333,7 @@ exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.
5567
5333
  }) => new parser_1.List([new parser_1.Node(''), new parser_1.Node((0, dom_1.html)('span', {
5568
5334
  class: 'invalid',
5569
5335
  ...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
5570
- }, source.replace('\n', '')))]));
5336
+ }, source.replace(/\r?\n/, '')))]));
5571
5337
 
5572
5338
  /***/ },
5573
5339
 
@@ -5628,7 +5394,7 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
5628
5394
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
5629
5395
  class: 'invalid',
5630
5396
  ...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
5631
- }, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5397
+ }, source.replace(/\r?\n/, '')))]))))]), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5632
5398
 
5633
5399
  /***/ },
5634
5400
 
@@ -5652,8 +5418,8 @@ const visibility_1 = __webpack_require__(6364);
5652
5418
  const memoize_1 = __webpack_require__(6925);
5653
5419
  const dom_1 = __webpack_require__(394);
5654
5420
  const openers = {
5655
- '.': /([0-9]+|[a-z]+|[A-Z]+)(?:-(?=$|[0-9\n])[0-9]*)*(?:\.?(?:$|[\n])|\. )/y,
5656
- '(': /\((?=$|[0-9a-z\n])([0-9]*|[a-z]*)(?=$|[)\n])\)?(?:-(?=$|[0-9\n])[0-9]*)*(?:$|[ \n])/y
5421
+ '.': /([0-9]+|[a-z]+|[A-Z]+)(?:-(?=$|[0-9\r\n])[0-9]*)*(?:\.?(?:$|[\r\n])|\. )/y,
5422
+ '(': /\((?=$|[0-9a-z\r\n])([0-9]*|[a-z]*)(?=$|[)\r\n])\)?(?:-(?=$|[0-9\r\n])[0-9]*)*(?:$|[ \r\n])/y
5657
5423
  };
5658
5424
  exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
5659
5425
  exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
@@ -5772,7 +5538,7 @@ exports.pagebreak = void 0;
5772
5538
  const parser_1 = __webpack_require__(605);
5773
5539
  const combinator_1 = __webpack_require__(3484);
5774
5540
  const dom_1 = __webpack_require__(394);
5775
- exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('hr'))]))));
5541
+ exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\r\n]*(?:$|\r?\n)/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('hr'))]))));
5776
5542
 
5777
5543
  /***/ },
5778
5544
 
@@ -5839,7 +5605,7 @@ const anchor_1 = __webpack_require__(8535);
5839
5605
  const source_1 = __webpack_require__(8745);
5840
5606
  const util_1 = __webpack_require__(4992);
5841
5607
  const dom_1 = __webpack_require__(394);
5842
- exports.syntax = />*(?=>>[^>\s]\S*[^\S\n]*(?:$|\n))/y;
5608
+ exports.syntax = />*(?=>>[^>\s]\S*[^\S\r\n]*(?:$|\r?\n))/y;
5843
5609
  exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(exports.syntax), (0, combinator_1.union)([(0, combinator_1.line)(anchor_1.anchor),
5844
5610
  // Subject page representation.
5845
5611
  // リンクの実装は後で検討
@@ -5915,16 +5681,16 @@ const autolink_1 = __webpack_require__(1671);
5915
5681
  const source_1 = __webpack_require__(8745);
5916
5682
  const util_1 = __webpack_require__(4992);
5917
5683
  const dom_1 = __webpack_require__(394);
5918
- exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\n]*(?:\n\|+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.union)([source])), ([{
5684
+ exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\r\n]*(?:\r?\n\|+(?=$|[ \r\n])[^\r\n]*)*(?:$|\r?\n)/y, (0, combinator_1.union)([source])), ([{
5919
5685
  value
5920
5686
  }]) => new parser_1.List([new parser_1.Node((0, dom_1.define)(value, {
5921
5687
  class: 'invalid',
5922
5688
  ...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
5923
5689
  }))]))));
5924
- const opener = /(?=\|\|+(?:$|[ \n]))/y;
5925
- const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, /\|(?:$|[ \n])/y));
5926
- const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
5927
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5690
+ const opener = /(?=\|\|+(?:$|[ \r\n]))/y;
5691
+ const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, /\|(?:$|[ \r\n])/y));
5692
+ const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \r\n])))|\r?\n$/g, '');
5693
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5928
5694
 
5929
5695
  /***/ },
5930
5696
 
@@ -5947,13 +5713,13 @@ const util_1 = __webpack_require__(4992);
5947
5713
  const duff_1 = __webpack_require__(9202);
5948
5714
  const array_1 = __webpack_require__(6876);
5949
5715
  const dom_1 = __webpack_require__(394);
5950
- exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*\n\|[-:][^\n]*\n\|/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5716
+ exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\r\n]*\r?\n\|[-:][^\r\n]*\r?\n\|/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5951
5717
  const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /\|?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
5952
5718
  source
5953
5719
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', {
5954
5720
  class: 'invalid',
5955
5721
  ...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
5956
- }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
5722
+ }, [(0, dom_1.html)('td', source.replace(/\r?\n/, ''))]))])));
5957
5723
  const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/:-+:?/y, ({
5958
5724
  source,
5959
5725
  position,
@@ -6003,10 +5769,10 @@ const visibility_1 = __webpack_require__(6364);
6003
5769
  const util_1 = __webpack_require__(4992);
6004
5770
  const dom_1 = __webpack_require__(394);
6005
5771
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)('- ', exports.ulist_)));
6006
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
5772
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \r\n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \r\n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
6007
5773
  'data-index': (0, inline_1.dataindex)(ns)
6008
5774
  }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
6009
- exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
5775
+ exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \r\n])/y, ({
6010
5776
  source,
6011
5777
  position
6012
5778
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
@@ -6063,7 +5829,7 @@ class Context extends parser_1.Context {
6063
5829
  this.resources ??= {
6064
5830
  // バックトラックのせいで文字数制限を受けないようにする。
6065
5831
  clock: exports.MAX_SEGMENT_SIZE * (6 + 1),
6066
- recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.annotation */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
5832
+ recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
6067
5833
  };
6068
5834
  this.segment = segment ?? 0 /* Segment.unknown */;
6069
5835
  this.local = local ?? false;
@@ -6115,9 +5881,8 @@ const parser_1 = __webpack_require__(605);
6115
5881
  const combinator_1 = __webpack_require__(3484);
6116
5882
  const source_1 = __webpack_require__(8745);
6117
5883
  const util_1 = __webpack_require__(4992);
6118
- const normalize_1 = __webpack_require__(4490);
6119
5884
  const dom_1 = __webpack_require__(394);
6120
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
5885
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.convert)(source => source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
6121
5886
  class: 'header'
6122
5887
  }, [(0, dom_1.html)('details', {
6123
5888
  open: ''
@@ -6131,7 +5896,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
6131
5896
  class: 'invalid',
6132
5897
  translate: 'no',
6133
5898
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
6134
- }, (0, normalize_1.normalize)(source.slice(position))))]);
5899
+ }, source.slice(position)))]);
6135
5900
  }])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\r\n]*\r?\n/y))])));
6136
5901
  const field = (0, combinator_1.line)(({
6137
5902
  source,
@@ -6312,6 +6077,7 @@ const parser_1 = __webpack_require__(605);
6312
6077
  const combinator_1 = __webpack_require__(3484);
6313
6078
  const inline_1 = __webpack_require__(7973);
6314
6079
  const bracket_1 = __webpack_require__(4526);
6080
+ const repeat_1 = __webpack_require__(8019);
6315
6081
  const visibility_1 = __webpack_require__(6364);
6316
6082
  const util_1 = __webpack_require__(4992);
6317
6083
  const dom_1 = __webpack_require__(394);
@@ -6330,121 +6096,38 @@ const dom_1 = __webpack_require__(394);
6330
6096
  // 修正する必要があるためほぼ完全な二重処理が必要になり三重以上の注釈という不適切な使用のために
6331
6097
  // 常に非常に非効率な処理を行い常時低速化するより三重以上の注釈を禁止して効率性を維持するのが妥当である。
6332
6098
  const MAX_DEPTH = 20;
6333
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)((0, combinator_1.open)('((', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursions)([4 /* Recursion.annotation */, 3 /* Recursion.inline */, 5 /* Recursion.bracket */, 5 /* Recursion.bracket */], (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]))), '))', false, [], ([, ns], context) => {
6099
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, repeat_1.repeat)('(', visibility_1.beforeNonblank, ')', [4 /* Recursion.bracket */], (0, combinator_1.precedence)(1, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]), ')', false, [], ([, bs], {
6100
+ buffer
6101
+ }) => buffer.import(bs), ([, bs], {
6102
+ buffer
6103
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), (nodes, context, lead, follow) => {
6334
6104
  const {
6335
6105
  linebreak,
6336
6106
  recursion,
6337
6107
  resources
6338
6108
  } = context;
6339
- if (linebreak !== 0) {
6340
- ns.unshift(new parser_1.Node('('));
6341
- ns.push(new parser_1.Node(')'));
6109
+ if (linebreak !== 0 || nodes.length === 0 || lead === 0 || follow % 2 === 0) {
6110
+ nodes.unshift(new parser_1.Node('('));
6111
+ nodes.push(new parser_1.Node(')'));
6342
6112
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6343
6113
  class: (0, bracket_1.bracketname)(context, 1, 1)
6344
- }, ['(', (0, dom_1.html)('span', {
6345
- class: (0, bracket_1.bracketname)(context, 2, 2)
6346
- }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))), ')']))]);
6114
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6347
6115
  }
6348
- const depth = MAX_DEPTH - (resources?.recursions[4 /* Recursion.annotation */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH);
6349
- recursion.add(depth);
6116
+ recursion.add(MAX_DEPTH - (resources?.recursions[4 /* Recursion.bracket */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH));
6117
+ context.position += 1;
6350
6118
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', {
6351
6119
  class: 'annotation'
6352
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
6353
- }, ([, bs], context) => {
6354
- const {
6355
- source,
6356
- position,
6357
- linebreak,
6358
- recursion,
6359
- resources
6360
- } = context;
6361
- const depth = MAX_DEPTH - (resources?.recursions[4 /* Recursion.annotation */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH);
6362
- if (linebreak === 0 && bs && bs.length === 1 && source[position] === ')' && typeof bs.head?.value === 'object') {
6363
- const {
6364
- className
6365
- } = bs.head.value;
6366
- if (className === 'paren' || className === 'bracket') {
6367
- const {
6368
- firstChild,
6369
- lastChild
6370
- } = bs.head.value;
6371
- if (firstChild.nodeValue.length === 1) {
6372
- firstChild.remove();
6373
- } else {
6374
- firstChild.nodeValue = firstChild.nodeValue.slice(1);
6375
- }
6376
- if (lastChild.nodeValue.length === 1) {
6377
- lastChild.remove();
6378
- } else {
6379
- lastChild.nodeValue = lastChild.nodeValue.slice(0, -1);
6380
- }
6381
- context.position += 1;
6382
- recursion.add(depth);
6383
- return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6384
- class: 'paren'
6385
- }, ['(', (0, dom_1.html)('sup', {
6386
- class: 'annotation'
6387
- }, [(0, dom_1.html)('span', bs.head.value.childNodes)])]))]);
6388
- }
6389
- if (className === 'annotation' && deepunwrap(bs)) {
6390
- context.position += 1;
6391
- recursion.add(depth);
6392
- return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6393
- class: 'paren'
6394
- }, ['(', (0, dom_1.html)('sup', {
6395
- class: 'annotation'
6396
- }, [(0, dom_1.html)('span', [bs.head.value])])]))]);
6397
- }
6398
- }
6399
- bs ??= new parser_1.List();
6400
- bs.unshift(new parser_1.Node('('));
6401
- if (source[context.position] === ')') {
6402
- bs.push(new parser_1.Node(')'));
6403
- context.position += 1;
6404
- context.range += 1;
6405
- }
6406
- bs = new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6407
- class: (0, bracket_1.bracketname)(context, 2, context.position - position)
6408
- }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
6409
- bs.unshift(new parser_1.Node('('));
6410
- const cs = parser(context);
6411
- if (source[context.position] === ')') {
6412
- cs && bs.import(cs);
6413
- bs.push(new parser_1.Node(')'));
6414
- context.position += 1;
6120
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(nodes))))]))]);
6121
+ }, (nodes, context, prefix, postfix) => {
6122
+ for (let i = 0; i < prefix; ++i) {
6123
+ nodes.unshift(new parser_1.Node('('));
6124
+ nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6125
+ class: (0, bracket_1.bracketname)(context, 0, 0)
6126
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6415
6127
  context.range += 1;
6416
6128
  }
6417
- return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6418
- class: (0, bracket_1.bracketname)(context, 1, context.position - position)
6419
- }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
6129
+ return nodes;
6420
6130
  })));
6421
- const parser = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]])));
6422
- function deepunwrap(list) {
6423
- let bottom = list.head.value;
6424
- for (; bottom;) {
6425
- const el = bottom.firstChild.firstChild;
6426
- if (el !== el?.parentNode?.lastChild) break;
6427
- if (el instanceof HTMLElement === false) break;
6428
- if (el?.className !== 'annotation') break;
6429
- bottom = el;
6430
- }
6431
- const el = bottom.firstChild.firstChild;
6432
- if (el instanceof Element === false) return false;
6433
- if (el === el?.parentNode?.lastChild) {
6434
- const {
6435
- className,
6436
- firstChild,
6437
- lastChild
6438
- } = el;
6439
- if (className === 'paren' || className === 'bracket') {
6440
- firstChild.nodeValue.length === 1 ? firstChild.remove() : firstChild.nodeValue = firstChild.nodeValue.slice(1);
6441
- lastChild.nodeValue.length === 1 ? lastChild.remove() : lastChild.nodeValue = lastChild.nodeValue.slice(0, -1);
6442
- el.replaceWith(...el.childNodes);
6443
- return true;
6444
- }
6445
- }
6446
- return false;
6447
- }
6448
6131
 
6449
6132
  /***/ },
6450
6133
 
@@ -6681,7 +6364,7 @@ const inline_1 = __webpack_require__(7973);
6681
6364
  const link_1 = __webpack_require__(3628);
6682
6365
  const source_1 = __webpack_require__(8745);
6683
6366
  exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, bracket)]), [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6684
- exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => {
6367
+ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\r\n]*(?=$|\r?\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => {
6685
6368
  const {
6686
6369
  source,
6687
6370
  position
@@ -6689,7 +6372,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
6689
6372
  context.position -= source[0] === '!' ? 1 : 0;
6690
6373
  return new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(source.slice(position))]), context))]);
6691
6374
  })), (0, source_1.str)(/[^:]+/y)])])));
6692
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.unescapable */])]));
6375
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.unescapable */])]));
6693
6376
 
6694
6377
  /***/ },
6695
6378
 
@@ -6740,17 +6423,17 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6740
6423
  return d1(input);
6741
6424
  }
6742
6425
  }]));
6743
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6426
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6744
6427
  class: bracketname(context, 1, 1)
6745
6428
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6746
6429
  class: bracketname(context, 1, 0)
6747
6430
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
6748
- const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6431
+ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6749
6432
  class: bracketname(context, 1, 1)
6750
6433
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6751
6434
  class: bracketname(context, 1, 0)
6752
6435
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
6753
- const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 4 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
6436
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 4 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
6754
6437
  const {
6755
6438
  source,
6756
6439
  position,
@@ -6776,12 +6459,12 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6776
6459
  }
6777
6460
  return as.import(bs).import(cs);
6778
6461
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6779
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6780
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6781
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6462
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6463
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6464
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6782
6465
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6783
6466
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6784
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6467
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6785
6468
 
6786
6469
  /***/ },
6787
6470
 
@@ -6799,7 +6482,7 @@ const parser_1 = __webpack_require__(605);
6799
6482
  const combinator_1 = __webpack_require__(3484);
6800
6483
  const util_1 = __webpack_require__(4992);
6801
6484
  const dom_1 = __webpack_require__(394);
6802
- exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6485
+ exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\r\n]*?)(?:((?<!`)\1(?!`))|(?=$|\r?\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6803
6486
  'data-src': whole
6804
6487
  }, format(body)))]) : body ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6805
6488
  class: 'invalid',
@@ -6824,14 +6507,15 @@ exports.deletion = void 0;
6824
6507
  const parser_1 = __webpack_require__(605);
6825
6508
  const combinator_1 = __webpack_require__(3484);
6826
6509
  const inline_1 = __webpack_require__(7973);
6510
+ const repeat_1 = __webpack_require__(8019);
6827
6511
  const visibility_1 = __webpack_require__(6364);
6828
6512
  const util_1 = __webpack_require__(4992);
6829
6513
  const dom_1 = __webpack_require__(394);
6830
- exports.deletion = (0, combinator_1.lazy)(() => (0, util_1.repeat)('~~', '', (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
6514
+ exports.deletion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('~~', '', '~~', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
6831
6515
  buffer
6832
6516
  }) => buffer.import(bs), ([, bs], {
6833
6517
  buffer
6834
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer))), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
6518
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
6835
6519
 
6836
6520
  /***/ },
6837
6521
 
@@ -6873,6 +6557,7 @@ const inline_1 = __webpack_require__(7973);
6873
6557
  const strong_1 = __webpack_require__(6591);
6874
6558
  const emphasis_1 = __webpack_require__(1354);
6875
6559
  const source_1 = __webpack_require__(8745);
6560
+ const repeat_1 = __webpack_require__(8019);
6876
6561
  const visibility_1 = __webpack_require__(6364);
6877
6562
  const util_1 = __webpack_require__(4992);
6878
6563
  const dom_1 = __webpack_require__(394);
@@ -6881,7 +6566,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6881
6566
  // 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
6882
6567
  // 可能な限り早く閉じるよう解析しなければならない。
6883
6568
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6884
- exports.emstrong = (0, combinator_1.lazy)(() => (0, util_1.repeat)('***', visibility_1.beforeNonblank, (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)])), (0, source_1.strs)('*', 1, 3), false, [], ([, bs, cs], context) => {
6569
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('***', visibility_1.beforeNonblank, '***', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)])), (0, source_1.strs)('*', 1, 3), false, [], ([, bs, cs], context) => {
6885
6570
  const {
6886
6571
  buffer
6887
6572
  } = context;
@@ -6925,10 +6610,11 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, util_1.repeat)('***', visibi
6925
6610
  }
6926
6611
  }, ([, bs], {
6927
6612
  buffer
6928
- }) => bs && buffer.import(bs) && buffer.push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer))),
6613
+ }) => bs && buffer.import(bs) && buffer.push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)),
6929
6614
  // 3以上の`*`に対してemの適用を保証する
6930
6615
  nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)))]))]), (nodes, context, prefix, postfix, state) => {
6931
6616
  context.position += postfix;
6617
+ context.range += postfix;
6932
6618
  if (state) {
6933
6619
  switch (postfix) {
6934
6620
  case 0:
@@ -6943,6 +6629,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
6943
6629
  }
6944
6630
  prefix -= postfix;
6945
6631
  postfix -= postfix;
6632
+ context.range += postfix;
6946
6633
  switch (prefix) {
6947
6634
  case 0:
6948
6635
  break;
@@ -6959,6 +6646,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
6959
6646
  }
6960
6647
  })(context) ?? prepend('*', nodes);
6961
6648
  prefix -= 1;
6649
+ context.range += 1;
6962
6650
  break;
6963
6651
  case 2:
6964
6652
  nodes = (0, combinator_1.bind)(substrong, ds => {
@@ -6973,11 +6661,14 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
6973
6661
  }
6974
6662
  })(context) ?? prepend('**', nodes);
6975
6663
  prefix -= 2;
6664
+ context.range += 2;
6976
6665
  break;
6977
6666
  }
6978
6667
  }
6979
6668
  if (prefix > postfix) {
6980
6669
  nodes = prepend('*'.repeat(prefix - postfix), nodes);
6670
+ prefix = 0;
6671
+ context.range += prefix - postfix;
6981
6672
  }
6982
6673
  return nodes;
6983
6674
  }));
@@ -7238,7 +6929,7 @@ const dom_1 = __webpack_require__(394);
7238
6929
  exports.indexer = (0, combinator_1.validate)(' [|', (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7239
6930
  class: 'indexer',
7240
6931
  'data-index': ''
7241
- }))]))]), /\][^\S\n]*(?:$|\n)/y));
6932
+ }))]))]), /\][^\S\r\n]*(?:$|\r?\n)/y));
7242
6933
 
7243
6934
  /***/ },
7244
6935
 
@@ -7305,7 +6996,7 @@ const dom_1 = __webpack_require__(394);
7305
6996
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7306
6997
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7307
6998
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
7308
- (0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]]))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6999
+ (0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]]))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7309
7000
  class: 'invalid',
7310
7001
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7311
7002
  }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
@@ -7349,7 +7040,7 @@ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combina
7349
7040
  (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag2index(tag), Array(exports.TAGS.length))), (0, combinator_1.surround)(
7350
7041
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
7351
7042
  (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))]));
7352
- exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
7043
+ exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\r\n]|[^\\\r\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
7353
7044
  function elem(tag, content, as, bs, cs, context) {
7354
7045
  if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
7355
7046
  if (content) {
@@ -7450,14 +7141,15 @@ exports.insertion = void 0;
7450
7141
  const parser_1 = __webpack_require__(605);
7451
7142
  const combinator_1 = __webpack_require__(3484);
7452
7143
  const inline_1 = __webpack_require__(7973);
7144
+ const repeat_1 = __webpack_require__(8019);
7453
7145
  const visibility_1 = __webpack_require__(6364);
7454
7146
  const util_1 = __webpack_require__(4992);
7455
7147
  const dom_1 = __webpack_require__(394);
7456
- exports.insertion = (0, combinator_1.lazy)(() => (0, util_1.repeat)('++', '', (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
7148
+ exports.insertion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('++', '', '++', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
7457
7149
  buffer
7458
7150
  }) => buffer.import(bs), ([, bs], {
7459
7151
  buffer
7460
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer))), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
7152
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
7461
7153
 
7462
7154
  /***/ },
7463
7155
 
@@ -7474,17 +7166,18 @@ exports.italic = void 0;
7474
7166
  const parser_1 = __webpack_require__(605);
7475
7167
  const combinator_1 = __webpack_require__(3484);
7476
7168
  const inline_1 = __webpack_require__(7973);
7169
+ const repeat_1 = __webpack_require__(8019);
7477
7170
  const visibility_1 = __webpack_require__(6364);
7478
7171
  const util_1 = __webpack_require__(4992);
7479
7172
  const dom_1 = __webpack_require__(394);
7480
7173
  // 可読性のため実際にはオブリーク体を指定する。
7481
7174
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
7482
7175
  // ある程度の長さのある文に使うのが望ましい。
7483
- exports.italic = (0, combinator_1.lazy)(() => (0, util_1.repeat)('///', visibility_1.beforeNonblank, (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
7176
+ exports.italic = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('///', visibility_1.beforeNonblank, '///', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
7484
7177
  buffer
7485
7178
  }) => buffer.import(bs), ([, bs], {
7486
7179
  buffer
7487
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer))), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
7180
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
7488
7181
 
7489
7182
  /***/ },
7490
7183
 
@@ -7552,7 +7245,7 @@ exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8
7552
7245
  value: params
7553
7246
  }], context) => new parser_1.List([new parser_1.Node(parse(content, params, context))])))));
7554
7247
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(' ', (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
7555
- exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Node(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7248
+ exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Node(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\r\n]|[^\\\r\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7556
7249
  function parse(content, params, context) {
7557
7250
  const INSECURE_URI = params.shift().value;
7558
7251
  (0, combinator_1.consume)(10, context);
@@ -7658,19 +7351,20 @@ const parser_1 = __webpack_require__(605);
7658
7351
  const combinator_1 = __webpack_require__(3484);
7659
7352
  const inline_1 = __webpack_require__(7973);
7660
7353
  const indexee_1 = __webpack_require__(7610);
7354
+ const repeat_1 = __webpack_require__(8019);
7661
7355
  const visibility_1 = __webpack_require__(6364);
7662
7356
  const util_1 = __webpack_require__(4992);
7663
7357
  const dom_1 = __webpack_require__(394);
7664
- exports.mark = (0, combinator_1.lazy)(() => (0, util_1.repeat)('==', visibility_1.beforeNonblank, (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.surround)('', (0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank)), '==', false, [], ([, bs], {
7358
+ exports.mark = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('==', visibility_1.beforeNonblank, '==', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank)), '==', false, [], ([, bs], {
7665
7359
  buffer
7666
7360
  }) => buffer.import(bs), ([, bs], {
7667
7361
  buffer
7668
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer))), (nodes, {
7362
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), (nodes, {
7669
7363
  id,
7670
7364
  state
7671
- }, nest) => {
7365
+ }, lead) => {
7672
7366
  const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
7673
- if (state & 251 /* State.linkers */ || nest) return new parser_1.List([new parser_1.Node(el)]);
7367
+ if (state & 251 /* State.linkers */ || lead >= 2) return new parser_1.List([new parser_1.Node(el)]);
7674
7368
  (0, dom_1.define)(el, {
7675
7369
  id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el.cloneNode(true)))
7676
7370
  });
@@ -7697,7 +7391,7 @@ const source_1 = __webpack_require__(8745);
7697
7391
  const util_1 = __webpack_require__(4992);
7698
7392
  const dom_1 = __webpack_require__(394);
7699
7393
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7700
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 16 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /(?<!\s)\$(?![-0-9A-Za-z])/y, false, [3 | 16 /* Backtrack.escapable */])]), ({
7394
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 16 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\$|[`"{}\r\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /(?<!\s)\$(?![-0-9A-Za-z])/y, false, [3 | 16 /* Backtrack.escapable */])]), ({
7701
7395
  source,
7702
7396
  caches: {
7703
7397
  math: cache
@@ -7711,7 +7405,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7711
7405
  translate: 'no',
7712
7406
  ...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
7713
7407
  }, source))])));
7714
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\n]/y)]))), (0, source_1.str)('}'), true));
7408
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\r\n]/y)]))), (0, source_1.str)('}'), true));
7715
7409
 
7716
7410
  /***/ },
7717
7411
 
@@ -7798,7 +7492,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7798
7492
  target: '_blank'
7799
7493
  }, [el]))]);
7800
7494
  }))));
7801
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')')), (0, source_1.str)(')'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), (0, source_1.str)(']'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}')), (0, source_1.str)('}'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"'))), (0, source_1.str)('"'), true, [], undefined, () => new parser_1.List())]));
7495
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')')), (0, source_1.str)(')'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), (0, source_1.str)(']'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}')), (0, source_1.str)('}'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"'))), (0, source_1.str)('"'), true, [], undefined, () => new parser_1.List())]));
7802
7496
  const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, [], ([[{
7803
7497
  value: a
7804
7498
  }], [{
@@ -7940,11 +7634,11 @@ const inline_1 = __webpack_require__(7973);
7940
7634
  const source_1 = __webpack_require__(8745);
7941
7635
  const util_1 = __webpack_require__(4992);
7942
7636
  const dom_1 = __webpack_require__(394);
7943
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)('%]')), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7637
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \r\n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)('%]')), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7944
7638
  class: 'remark'
7945
7639
  }, [(0, dom_1.html)('input', {
7946
7640
  type: 'checkbox'
7947
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=[ \n])/y, ({
7641
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=[ \r\n])/y, ({
7948
7642
  source
7949
7643
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7950
7644
  class: 'invalid',
@@ -8003,7 +7697,7 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
8003
7697
  }) => acc ? acc + ' ' + value : value, '').trim())), new parser_1.Node((0, dom_1.html)('rp', ')'))])))))]);
8004
7698
  }
8005
7699
  }));
8006
- const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
7700
+ const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\r?\n/y;
8007
7701
  const text = input => {
8008
7702
  const context = input;
8009
7703
  const {
@@ -8069,7 +7763,7 @@ const combinator_1 = __webpack_require__(3484);
8069
7763
  const url_1 = __webpack_require__(2129);
8070
7764
  const media_1 = __webpack_require__(7478);
8071
7765
  exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.rewrite)((0, combinator_1.open)('!', url_1.url), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
8072
- exports.lineshortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
7766
+ exports.lineshortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\r\n]*(?:$|\r?\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
8073
7767
 
8074
7768
  /***/ },
8075
7769
 
@@ -8116,7 +7810,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
8116
7810
  class: 'invalid',
8117
7811
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
8118
7812
  }, context.source.slice(context.position - context.range, context.position)))])));
8119
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs]) => bs && as.import(bs))]));
7813
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs]) => bs && as.import(bs))]));
8120
7814
 
8121
7815
  /***/ },
8122
7816
 
@@ -8443,6 +8137,146 @@ function* proc(note, defs) {
8443
8137
 
8444
8138
  /***/ },
8445
8139
 
8140
+ /***/ 8019
8141
+ (__unused_webpack_module, exports, __webpack_require__) {
8142
+
8143
+ "use strict";
8144
+
8145
+
8146
+ Object.defineProperty(exports, "__esModule", ({
8147
+ value: true
8148
+ }));
8149
+ exports.repeat = void 0;
8150
+ const parser_1 = __webpack_require__(605);
8151
+ const delimiter_1 = __webpack_require__(385);
8152
+ const alias_1 = __webpack_require__(5413);
8153
+ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, context, prefix, postfix) => {
8154
+ const acc = new parser_1.List();
8155
+ if (prefix > 0) {
8156
+ acc.push(new parser_1.Node(opener[0].repeat(prefix)));
8157
+ context.range += prefix;
8158
+ }
8159
+ acc.import(nodes);
8160
+ if (postfix > 0) {
8161
+ const {
8162
+ source,
8163
+ position
8164
+ } = context;
8165
+ acc.push(new parser_1.Node(source.slice(position, position + postfix)));
8166
+ context.position += postfix;
8167
+ context.range += postfix;
8168
+ }
8169
+ return acc;
8170
+ }) {
8171
+ const test = (0, delimiter_1.tester)(after, false);
8172
+ return input => {
8173
+ const context = input;
8174
+ const {
8175
+ source,
8176
+ position,
8177
+ resources: {
8178
+ recursions
8179
+ } = {}
8180
+ } = context;
8181
+ if (!source.startsWith(opener, context.position)) return;
8182
+ let nodes = new parser_1.List();
8183
+ let i = opener.length;
8184
+ for (; source[context.position + i] === source[context.position];) ++i;
8185
+ context.position += i;
8186
+ if (test(input) === undefined) {
8187
+ context.position = position;
8188
+ return;
8189
+ }
8190
+ let depth = i / opener.length + 1 | 0;
8191
+ if (recursions) for (const recursion of rs) {
8192
+ const rec = (0, alias_1.min)(recursion, recursions.length - 1);
8193
+ if (rec === -1) continue;
8194
+ if (recursions[rec] < depth - 1) throw new Error('Too much recursion');
8195
+ recursions[rec] -= depth;
8196
+ }
8197
+ let state = false;
8198
+ let follow = 0;
8199
+ for (; i >= opener.length; i -= opener.length, follow -= closer.length) {
8200
+ if (recursions) for (const recursion of rs) {
8201
+ const rec = (0, alias_1.min)(recursion, recursions.length - 1);
8202
+ if (rec === -1) continue;
8203
+ recursions[rec] += 1;
8204
+ }
8205
+ depth -= 1;
8206
+ const lead = i - opener.length;
8207
+ if (source.startsWith(closer, context.position)) {
8208
+ context.position += closer.length;
8209
+ const pos = context.position;
8210
+ follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
8211
+ nodes = cons(nodes, context, lead, follow);
8212
+ if (context.position > pos) {
8213
+ const advance = opener.length * (context.position - pos) / closer.length | 0;
8214
+ i -= advance;
8215
+ follow -= advance;
8216
+ depth -= advance;
8217
+ }
8218
+ continue;
8219
+ }
8220
+ const buf = context.buffer;
8221
+ context.buffer = nodes;
8222
+ const result = parser(input);
8223
+ context.buffer = buf;
8224
+ context.range = context.position - position - i + opener.length;
8225
+ if (result === undefined) break;
8226
+ const pos = context.position;
8227
+ nodes = result;
8228
+ switch (nodes.last?.value) {
8229
+ case "\u0018" /* Command.Cancel */:
8230
+ nodes.pop();
8231
+ state = false;
8232
+ break;
8233
+ case "\u001F" /* Command.Separator */:
8234
+ follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
8235
+ nodes.pop();
8236
+ state = true;
8237
+ continue;
8238
+ default:
8239
+ follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
8240
+ nodes = cons(nodes, context, lead, follow);
8241
+ state = true;
8242
+ if (context.position > pos) {
8243
+ const advance = opener.length * (context.position - pos) / closer.length | 0;
8244
+ i -= advance;
8245
+ follow -= advance;
8246
+ depth -= advance;
8247
+ }
8248
+ continue;
8249
+ }
8250
+ break;
8251
+ }
8252
+ if (recursions) for (let i = 0; i < depth; ++i) for (const recursion of rs) {
8253
+ const rec = (0, alias_1.min)(recursion, recursions.length - 1);
8254
+ if (rec === -1) continue;
8255
+ recursions[rec] += depth;
8256
+ }
8257
+ depth = 0;
8258
+ const prefix = i;
8259
+ i = 0;
8260
+ for (let len = (0, alias_1.min)(prefix, source.length - context.position); i < len && source[context.position + i] === closer[0];) {
8261
+ ++i;
8262
+ }
8263
+ const postfix = i;
8264
+ context.range = context.position - position - prefix;
8265
+ return termination(nodes, context, prefix, postfix, state);
8266
+ };
8267
+ }
8268
+ exports.repeat = repeat;
8269
+ function countFollows(source, position, closer, limit) {
8270
+ if (closer.length === 0) return 0;
8271
+ let pos = position;
8272
+ for (let i = 0; i < limit && pos < source.length; ++i, pos += closer.length) {
8273
+ if (!source.startsWith(closer, pos)) break;
8274
+ }
8275
+ return pos - position;
8276
+ }
8277
+
8278
+ /***/ },
8279
+
8446
8280
  /***/ 3967
8447
8281
  (__unused_webpack_module, exports, __webpack_require__) {
8448
8282
 
@@ -8460,7 +8294,6 @@ const codeblock_1 = __webpack_require__(9194);
8460
8294
  const mathblock_1 = __webpack_require__(4903);
8461
8295
  const extension_1 = __webpack_require__(6193);
8462
8296
  const source_1 = __webpack_require__(8745);
8463
- const api_1 = __webpack_require__(5886);
8464
8297
  const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptysegment, context_1.MAX_SEGMENT_SIZE + 1), input => {
8465
8298
  const {
8466
8299
  source,
@@ -8498,7 +8331,7 @@ function* segment(source, initial = true) {
8498
8331
  position = context.position;
8499
8332
  for (let i = 0; i < segs.length; ++i) {
8500
8333
  const seg = segs[i];
8501
- initial && !validate(seg, context_1.MAX_SEGMENT_SIZE) ? yield [`${"\u0007" /* Command.Error */}Too large segment over ${context_1.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`, 0 /* Segment.unknown */] : yield [initial ? (0, api_1.normalize)(seg) : seg, context.segment];
8334
+ initial && !validate(seg, context_1.MAX_SEGMENT_SIZE) ? yield [`${"\u0007" /* Command.Error */}Too large segment over ${context_1.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`, 0 /* Segment.unknown */] : yield [seg, context.segment];
8502
8335
  }
8503
8336
  }
8504
8337
  }
@@ -8620,7 +8453,7 @@ const escsource = context => {
8620
8453
  case '\\':
8621
8454
  switch (source[position + 1]) {
8622
8455
  case undefined:
8623
- return new parser_1.List([new parser_1.Node(char)]);
8456
+ case '\r':
8624
8457
  case '\n':
8625
8458
  return new parser_1.List([new parser_1.Node(char)]);
8626
8459
  default:
@@ -8794,6 +8627,7 @@ const text = input => {
8794
8627
  switch (source[position + 1]) {
8795
8628
  case undefined:
8796
8629
  return new parser_1.List();
8630
+ case '\r':
8797
8631
  case '\n':
8798
8632
  return new parser_1.List();
8799
8633
  default:
@@ -8811,7 +8645,7 @@ const text = input => {
8811
8645
  exports.nonWhitespace.lastIndex = position + 1;
8812
8646
  const s = canSkip(source, position);
8813
8647
  let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position, state);
8814
- const lineend = false || s && i === source.length || s && source[i] === '\n';
8648
+ const lineend = false || s && i === source.length || s && source[i] === '\r' || s && source[i] === '\n';
8815
8649
  i -= position;
8816
8650
  i = lineend ? i : i - +s || 1;
8817
8651
  (0, combinator_1.consume)(i - 1, context);
@@ -9057,10 +8891,7 @@ exports.unescsource = unescsource;
9057
8891
  Object.defineProperty(exports, "__esModule", ({
9058
8892
  value: true
9059
8893
  }));
9060
- exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
9061
- const parser_1 = __webpack_require__(605);
9062
- const delimiter_1 = __webpack_require__(385);
9063
- const alias_1 = __webpack_require__(5413);
8894
+ exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.unwrap = void 0;
9064
8895
  const random_1 = __webpack_require__(3158);
9065
8896
  const dom_1 = __webpack_require__(394);
9066
8897
  function* unwrap(nodes) {
@@ -9070,75 +8901,6 @@ function* unwrap(nodes) {
9070
8901
  }
9071
8902
  }
9072
8903
  exports.unwrap = unwrap;
9073
- function repeat(symbol, after, parser, cons, termination = (nodes, context, prefix, postfix) => {
9074
- const acc = new parser_1.List();
9075
- if (prefix > 0) {
9076
- acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
9077
- }
9078
- acc.import(nodes);
9079
- if (postfix > 0) {
9080
- const {
9081
- source,
9082
- position
9083
- } = context;
9084
- acc.push(new parser_1.Node(source.slice(position, position + postfix)));
9085
- context.position += postfix;
9086
- }
9087
- return acc;
9088
- }) {
9089
- const test = (0, delimiter_1.tester)(after, false);
9090
- return (0, parser_1.failsafe)(input => {
9091
- const context = input;
9092
- const {
9093
- source,
9094
- position
9095
- } = context;
9096
- if (!source.startsWith(symbol, context.position)) return;
9097
- let nodes = new parser_1.List();
9098
- let i = symbol.length;
9099
- for (; source[context.position + i] === source[context.position];) ++i;
9100
- context.position += i;
9101
- if (test(input) === undefined) return;
9102
- let state = false;
9103
- for (; i >= symbol.length; i -= symbol.length) {
9104
- if (nodes.length > 0 && source.startsWith(symbol, context.position)) {
9105
- nodes = cons(nodes, context, i > symbol.length);
9106
- context.position += symbol.length;
9107
- continue;
9108
- }
9109
- const buf = context.buffer;
9110
- context.buffer = nodes;
9111
- const result = parser(input);
9112
- context.buffer = buf;
9113
- if (result === undefined) break;
9114
- nodes = result;
9115
- switch (nodes.last?.value) {
9116
- case "\u0018" /* Command.Cancel */:
9117
- nodes.pop();
9118
- state = false;
9119
- break;
9120
- case "\u001F" /* Command.Separator */:
9121
- nodes.pop();
9122
- state = true;
9123
- continue;
9124
- default:
9125
- nodes = cons(nodes, context, i > symbol.length);
9126
- state = true;
9127
- continue;
9128
- }
9129
- break;
9130
- }
9131
- const prefix = i;
9132
- i = 0;
9133
- for (let len = (0, alias_1.min)(prefix, source.length - context.position); i < len && source[context.position + i] === symbol[0];) {
9134
- ++i;
9135
- }
9136
- const postfix = i;
9137
- context.range = context.position - position;
9138
- return termination(nodes, context, prefix, postfix, state);
9139
- });
9140
- }
9141
- exports.repeat = repeat;
9142
8904
  function invalid(syntax, type, message) {
9143
8905
  return {
9144
8906
  'data-invalid-syntax': syntax,
@@ -9200,9 +8962,9 @@ const combinator_1 = __webpack_require__(3484);
9200
8962
  const normalize_1 = __webpack_require__(4490);
9201
8963
  var blank;
9202
8964
  (function (blank) {
9203
- blank.line = new RegExp(/((?:^|\n)[^\S\n]*(?=\S))((?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+(?=$|\n))/g.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'g');
9204
- blank.start = new RegExp(/(?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
9205
- blank.unit = new RegExp(/(?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
8965
+ blank.line = new RegExp(/((?:^|\n)[^\S\r\n]*(?=\S))((?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|[IBC]|<wbr ?>)+(?=$|\r?\n))/g.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`).replace('IBC', `${normalize_1.invisibleBlankCharacters.join('')}`), 'g');
8966
+ blank.start = new RegExp(/(?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|[IBC]|<wbr ?>)+/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`).replace('IBC', `${normalize_1.invisibleBlankCharacters.join('')}`), 'y');
8967
+ blank.unit = new RegExp(/(?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|[IBC]|<wbr ?>)/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`).replace('IBC', `${normalize_1.invisibleBlankCharacters.join('')}`), 'y');
9206
8968
  })(blank || (blank = {}));
9207
8969
  function visualize(parser) {
9208
8970
  return (0, combinator_1.convert)(source => source.replace(blank.line, `$1${"\u001B" /* Command.Escape */}$2`), parser);
@@ -9214,15 +8976,15 @@ function blankWith(starts, delimiter) {
9214
8976
  return new RegExp([
9215
8977
  // 空行除去
9216
8978
  // 完全な空行はエスケープ済みなので再帰的バックトラックにはならない。
9217
- String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)*)?`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
8979
+ String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|[${normalize_1.invisibleBlankCharacters.join('')}]|<wbr ?>)*)?`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
9218
8980
  }
9219
8981
  exports.blankWith = blankWith;
9220
8982
  function beforeNonblankWith(delimiter) {
9221
- return new RegExp([typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source, String.raw`(?!\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`].join(''), 'y');
8983
+ return new RegExp([typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source, String.raw`(?!\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|[${normalize_1.invisibleBlankCharacters.join('')}]|<wbr ?>)`].join(''), 'y');
9222
8984
  }
9223
8985
  exports.beforeNonblankWith = beforeNonblankWith;
9224
8986
  function afterNonblankWith(delimiter) {
9225
- return new RegExp([String.raw`(?<!\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
8987
+ return new RegExp([String.raw`(?<!\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|[${normalize_1.invisibleBlankCharacters.join('')}]|<wbr ?>)`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
9226
8988
  }
9227
8989
  function isNonblankFirstLine(nodes) {
9228
8990
  if (nodes.length === 0) return true;
@@ -9249,6 +9011,7 @@ function isNonblank({
9249
9011
  case '':
9250
9012
  case ' ':
9251
9013
  case '\t':
9014
+ case '\r':
9252
9015
  case '\n':
9253
9016
  return false;
9254
9017
  default:
@@ -9260,7 +9023,7 @@ function trimBlank(parser) {
9260
9023
  }
9261
9024
  exports.trimBlank = trimBlank;
9262
9025
  function trimBlankStart(parser) {
9263
- return (0, parser_1.failsafe)(input => {
9026
+ return input => {
9264
9027
  const context = input;
9265
9028
  const {
9266
9029
  source,
@@ -9272,7 +9035,7 @@ function trimBlankStart(parser) {
9272
9035
  reg.test(source);
9273
9036
  context.position = reg.lastIndex || position;
9274
9037
  return context.position === source.length ? new parser_1.List() : parser(input);
9275
- });
9038
+ };
9276
9039
  }
9277
9040
  function trimBlankEnd(parser) {
9278
9041
  return (0, combinator_1.fmap)(parser, trimBlankNodeEnd);