securemark 0.297.7 → 0.298.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 (60) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.js +108 -270
  3. package/package.json +1 -1
  4. package/src/combinator/control/constraint/block.test.ts +4 -4
  5. package/src/combinator/control/constraint/block.ts +1 -1
  6. package/src/combinator/control/constraint/line.test.ts +5 -5
  7. package/src/combinator/control/constraint/line.ts +1 -1
  8. package/src/combinator/control/manipulation/convert.ts +1 -1
  9. package/src/combinator/control/manipulation/fence.ts +1 -1
  10. package/src/combinator/control/manipulation/indent.test.ts +1 -1
  11. package/src/combinator/control/manipulation/indent.ts +1 -1
  12. package/src/combinator/control/manipulation/match.ts +1 -1
  13. package/src/combinator/control/manipulation/recovery.ts +1 -1
  14. package/src/combinator/control/manipulation/scope.ts +6 -8
  15. package/src/combinator/control/manipulation/surround.ts +1 -1
  16. package/src/combinator/control/monad/bind.ts +1 -1
  17. package/src/combinator/data/delimiter.ts +5 -5
  18. package/src/combinator/data/parser/context.test.ts +2 -2
  19. package/src/combinator/data/parser/context.ts +10 -10
  20. package/src/combinator/data/parser/inits.ts +1 -1
  21. package/src/combinator/data/parser/sequence.test.ts +2 -2
  22. package/src/combinator/data/parser/sequence.ts +1 -1
  23. package/src/combinator/data/parser/some.test.ts +2 -2
  24. package/src/combinator/data/parser/some.ts +1 -1
  25. package/src/combinator/data/parser/subsequence.test.ts +3 -3
  26. package/src/combinator/data/parser/union.test.ts +2 -2
  27. package/src/combinator/data/parser.ts +10 -16
  28. package/src/debug.test.ts +1 -1
  29. package/src/parser/api/header.ts +1 -1
  30. package/src/parser/block/blockquote.ts +1 -1
  31. package/src/parser/block/extension/fig.ts +1 -1
  32. package/src/parser/block/heading.ts +1 -1
  33. package/src/parser/block/ilist.ts +2 -2
  34. package/src/parser/block/mediablock.ts +1 -1
  35. package/src/parser/block/olist.ts +2 -2
  36. package/src/parser/block/reply/cite.ts +3 -3
  37. package/src/parser/block/table.ts +3 -3
  38. package/src/parser/block/ulist.ts +1 -1
  39. package/src/parser/block.ts +2 -2
  40. package/src/parser/header.ts +3 -3
  41. package/src/parser/inline/annotation.ts +1 -1
  42. package/src/parser/inline/autolink/url.test.ts +1 -1
  43. package/src/parser/inline/autolink/url.ts +2 -2
  44. package/src/parser/inline/autolink.ts +1 -1
  45. package/src/parser/inline/bracket.ts +2 -2
  46. package/src/parser/inline/emstrong.ts +4 -4
  47. package/src/parser/inline/math.ts +1 -1
  48. package/src/parser/inline/reference.ts +1 -1
  49. package/src/parser/inline/remark.ts +1 -1
  50. package/src/parser/inline/ruby.ts +1 -1
  51. package/src/parser/inline.ts +1 -1
  52. package/src/parser/segment.ts +2 -2
  53. package/src/parser/source/escapable.ts +1 -1
  54. package/src/parser/source/line.ts +4 -4
  55. package/src/parser/source/str.ts +1 -1
  56. package/src/parser/source/text.ts +1 -1
  57. package/src/parser/source/unescapable.ts +1 -1
  58. package/src/parser/util.ts +1 -1
  59. package/src/parser/visibility.ts +1 -1
  60. package/src/util/quote.ts +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.297.7 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.298.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"));
@@ -2575,9 +2575,7 @@ const parser_1 = __webpack_require__(605);
2575
2575
  const line_1 = __webpack_require__(8287);
2576
2576
  function block(parser, separation = true, segment = 0) {
2577
2577
  return (0, parser_1.failsafe)(input => {
2578
- const {
2579
- context
2580
- } = input;
2578
+ const context = input;
2581
2579
  const {
2582
2580
  source,
2583
2581
  position
@@ -2641,9 +2639,7 @@ Object.defineProperty(exports, "__esModule", ({
2641
2639
  exports.isEmptyline = exports.firstline = exports.line = void 0;
2642
2640
  const parser_1 = __webpack_require__(605);
2643
2641
  function line(parser) {
2644
- return (0, parser_1.failsafe)(({
2645
- context
2646
- }) => {
2642
+ return (0, parser_1.failsafe)(context => {
2647
2643
  const {
2648
2644
  source,
2649
2645
  position
@@ -2708,9 +2704,7 @@ exports.convert = void 0;
2708
2704
  const parser_1 = __webpack_require__(605);
2709
2705
  function convert(conv, parser, empty = false) {
2710
2706
  return (0, parser_1.failsafe)(input => {
2711
- const {
2712
- context
2713
- } = input;
2707
+ const context = input;
2714
2708
  const {
2715
2709
  source,
2716
2710
  position
@@ -2788,9 +2782,7 @@ const line_1 = __webpack_require__(8287);
2788
2782
  const array_1 = __webpack_require__(6876);
2789
2783
  function fence(opener, limit, separation = true) {
2790
2784
  return (0, parser_1.failsafe)(input => {
2791
- const {
2792
- context
2793
- } = input;
2785
+ const context = input;
2794
2786
  const {
2795
2787
  source,
2796
2788
  position
@@ -2864,9 +2856,7 @@ function indent(opener, parser = false, separation = false) {
2864
2856
  parser = opener;
2865
2857
  opener = / {1,4}|\t{1,2}/y;
2866
2858
  }
2867
- return (0, parser_1.failsafe)((0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, ({
2868
- context
2869
- }) => {
2859
+ return (0, parser_1.failsafe)((0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, context => {
2870
2860
  const {
2871
2861
  source,
2872
2862
  position
@@ -2915,9 +2905,7 @@ const combinator_1 = __webpack_require__(3484);
2915
2905
  function match(pattern, f) {
2916
2906
  const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
2917
2907
  return (0, parser_1.failsafe)(input => {
2918
- const {
2919
- context
2920
- } = input;
2908
+ const context = input;
2921
2909
  const {
2922
2910
  source,
2923
2911
  position
@@ -2948,9 +2936,7 @@ Object.defineProperty(exports, "__esModule", ({
2948
2936
  exports.recover = void 0;
2949
2937
  function recover(parser, catcher) {
2950
2938
  return input => {
2951
- const {
2952
- context
2953
- } = input;
2939
+ const context = input;
2954
2940
  const {
2955
2941
  source,
2956
2942
  position
@@ -3001,22 +2987,17 @@ const parser_1 = __webpack_require__(605);
3001
2987
  const delimiter_1 = __webpack_require__(385);
3002
2988
  function focus(scope, parser, slice = true) {
3003
2989
  const match = (0, delimiter_1.matcher)(scope, false);
3004
- return (0, parser_1.failsafe)(arg => {
3005
- const {
3006
- context
3007
- } = arg;
2990
+ return (0, parser_1.failsafe)(context => {
3008
2991
  const {
3009
2992
  source,
3010
2993
  position
3011
2994
  } = context;
3012
2995
  if (position === source.length) return;
3013
- const src = match({
3014
- context
3015
- })?.head?.value ?? '';
2996
+ const src = match(context)?.head?.value ?? '';
3016
2997
  if (src === '') return;
3017
2998
  const range = context.range = src.length;
3018
2999
  if (!slice) {
3019
- const result = parser(arg);
3000
+ const result = parser(context);
3020
3001
  context.position += result && context.position === position ? range : 0;
3021
3002
  return result;
3022
3003
  }
@@ -3031,23 +3012,18 @@ function focus(scope, parser, slice = true) {
3031
3012
  }
3032
3013
  exports.focus = focus;
3033
3014
  function rewrite(scope, parser, slice = true) {
3034
- return (0, parser_1.failsafe)(arg => {
3035
- const {
3036
- context
3037
- } = arg;
3015
+ return (0, parser_1.failsafe)(context => {
3038
3016
  const {
3039
3017
  source,
3040
3018
  position
3041
3019
  } = context;
3042
3020
  if (position === source.length) return;
3043
- const res1 = scope({
3044
- context
3045
- });
3021
+ const res1 = scope(context);
3046
3022
  if (res1 === undefined || context.position < position) return;
3047
3023
  const range = context.range = context.position - position;
3048
3024
  if (!slice) {
3049
3025
  context.position = position;
3050
- const res2 = parser(arg);
3026
+ const res2 = parser(context);
3051
3027
  context.position += res2 && context.position === position ? range : 0;
3052
3028
  return res2;
3053
3029
  }
@@ -3095,9 +3071,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
3095
3071
  }
3096
3072
  const [blen, rbs, wbs] = reduce(backtracks);
3097
3073
  return (0, parser_1.failsafe)(input => {
3098
- const {
3099
- context
3100
- } = input;
3074
+ const context = input;
3101
3075
  const {
3102
3076
  source,
3103
3077
  position
@@ -3209,9 +3183,7 @@ exports.bind = void 0;
3209
3183
  const parser_1 = __webpack_require__(605);
3210
3184
  function bind(parser, f) {
3211
3185
  return (0, parser_1.failsafe)(input => {
3212
- const {
3213
- context
3214
- } = input;
3186
+ const context = input;
3215
3187
  const {
3216
3188
  source,
3217
3189
  position
@@ -3380,7 +3352,7 @@ class Delimiters {
3380
3352
  match(input) {
3381
3353
  const {
3382
3354
  precedence
3383
- } = input.context;
3355
+ } = input;
3384
3356
  const {
3385
3357
  delimiters
3386
3358
  } = this;
@@ -3406,9 +3378,7 @@ function matcher(pattern, advance, after) {
3406
3378
  case 'string':
3407
3379
  if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
3408
3380
  return input => {
3409
- const {
3410
- context
3411
- } = input;
3381
+ const context = input;
3412
3382
  const {
3413
3383
  source,
3414
3384
  position
@@ -3422,9 +3392,7 @@ function matcher(pattern, advance, after) {
3422
3392
  };
3423
3393
  case 'object':
3424
3394
  return input => {
3425
- const {
3426
- context
3427
- } = input;
3395
+ const context = input;
3428
3396
  const {
3429
3397
  source,
3430
3398
  position
@@ -3448,9 +3416,7 @@ function tester(pattern, advance, after) {
3448
3416
  case 'string':
3449
3417
  if (pattern === '') return () => new parser_1.List();
3450
3418
  return input => {
3451
- const {
3452
- context
3453
- } = input;
3419
+ const context = input;
3454
3420
  const {
3455
3421
  source,
3456
3422
  position
@@ -3464,9 +3430,7 @@ function tester(pattern, advance, after) {
3464
3430
  };
3465
3431
  case 'object':
3466
3432
  return input => {
3467
- const {
3468
- context
3469
- } = input;
3433
+ const context = input;
3470
3434
  const {
3471
3435
  source,
3472
3436
  position
@@ -3690,27 +3654,23 @@ exports.Context = Context;
3690
3654
  function input(source, context) {
3691
3655
  context.source = source;
3692
3656
  context.position = 0;
3693
- return {
3694
- context
3695
- };
3657
+ return context;
3696
3658
  }
3697
3659
  exports.input = input;
3698
3660
  function subinput(source, context) {
3699
3661
  return {
3700
- context: {
3701
- ...context,
3702
- source,
3703
- position: 0,
3704
- offset: 0,
3705
- backtracks: {}
3706
- }
3662
+ ...context,
3663
+ source,
3664
+ position: 0,
3665
+ offset: 0,
3666
+ backtracks: {}
3707
3667
  };
3708
3668
  }
3709
3669
  exports.subinput = subinput;
3710
3670
  function failsafe(parser) {
3711
- return input => {
3712
- const position = input.context.position;
3713
- return parser(input) ?? (input.context.position = position, undefined);
3671
+ return context => {
3672
+ const position = context.position;
3673
+ return parser(context) ?? (context.position = position, undefined);
3714
3674
  };
3715
3675
  }
3716
3676
  exports.failsafe = failsafe;
@@ -3731,9 +3691,7 @@ const alias_1 = __webpack_require__(5413);
3731
3691
  const assign_1 = __webpack_require__(9888);
3732
3692
  function reset(base, parser) {
3733
3693
  return input => {
3734
- const {
3735
- context
3736
- } = input;
3694
+ const context = input;
3737
3695
  // @ts-expect-error
3738
3696
  context.resources ??= {
3739
3697
  clock: base.resources?.clock,
@@ -3753,9 +3711,7 @@ exports.reset = reset;
3753
3711
  function context(base, parser) {
3754
3712
  const changes = Object.entries(base);
3755
3713
  const values = Array(changes.length);
3756
- return ({
3757
- context
3758
- }) => apply(parser, context, changes, values);
3714
+ return context => apply(parser, context, changes, values);
3759
3715
  }
3760
3716
  exports.context = context;
3761
3717
  function apply(parser, context, changes, values, reset = false) {
@@ -3776,9 +3732,7 @@ function apply(parser, context, changes, values, reset = false) {
3776
3732
  values[i] = context[prop];
3777
3733
  context[prop] = change[1];
3778
3734
  }
3779
- const result = parser({
3780
- context
3781
- });
3735
+ const result = parser(context);
3782
3736
  for (let i = 0; i < changes.length; ++i) {
3783
3737
  const change = changes[i];
3784
3738
  const prop = change[0];
@@ -3795,9 +3749,7 @@ function apply(parser, context, changes, values, reset = false) {
3795
3749
  }
3796
3750
  function creation(cost, parser) {
3797
3751
  return input => {
3798
- const {
3799
- context
3800
- } = input;
3752
+ const context = input;
3801
3753
  const resources = context.resources ?? {
3802
3754
  clock: cost || 1,
3803
3755
  recursions: [1]
@@ -3823,9 +3775,7 @@ function consume(cost, context) {
3823
3775
  exports.consume = consume;
3824
3776
  function recursion(recursion, parser) {
3825
3777
  return input => {
3826
- const {
3827
- context
3828
- } = input;
3778
+ const context = input;
3829
3779
  const resources = context.resources ?? {
3830
3780
  clock: 1,
3831
3781
  recursions: [1]
@@ -3844,9 +3794,7 @@ function recursion(recursion, parser) {
3844
3794
  exports.recursion = recursion;
3845
3795
  function recursions(rs, parser) {
3846
3796
  return input => {
3847
- const {
3848
- context
3849
- } = input;
3797
+ const context = input;
3850
3798
  const resources = context.resources ?? {
3851
3799
  clock: 1,
3852
3800
  recursions: [4]
@@ -3870,9 +3818,7 @@ function recursions(rs, parser) {
3870
3818
  exports.recursions = recursions;
3871
3819
  function precedence(precedence, parser) {
3872
3820
  return input => {
3873
- const {
3874
- context
3875
- } = input;
3821
+ const context = input;
3876
3822
  const {
3877
3823
  delimiters,
3878
3824
  precedence: p
@@ -3894,9 +3840,7 @@ function state(state, positive, parser) {
3894
3840
  positive = true;
3895
3841
  }
3896
3842
  return input => {
3897
- const {
3898
- context
3899
- } = input;
3843
+ const context = input;
3900
3844
  const s = context.state ?? 0;
3901
3845
  context.state = positive ? s | state : s & ~state;
3902
3846
  const result = parser(input);
@@ -3912,9 +3856,7 @@ function constraint(state, positive, parser) {
3912
3856
  positive = false;
3913
3857
  }
3914
3858
  return input => {
3915
- const {
3916
- context
3917
- } = input;
3859
+ const context = input;
3918
3860
  const s = positive ? state & context.state : state & ~context.state;
3919
3861
  return s === state ? parser(input) : undefined;
3920
3862
  };
@@ -3936,9 +3878,7 @@ exports.inits = void 0;
3936
3878
  function inits(parsers) {
3937
3879
  if (parsers.length === 1) return parsers[0];
3938
3880
  return input => {
3939
- const {
3940
- context
3941
- } = input;
3881
+ const context = input;
3942
3882
  const {
3943
3883
  source
3944
3884
  } = context;
@@ -3971,9 +3911,7 @@ const parser_1 = __webpack_require__(605);
3971
3911
  function sequence(parsers) {
3972
3912
  if (parsers.length === 1) return parsers[0];
3973
3913
  return (0, parser_1.failsafe)(input => {
3974
- const {
3975
- context
3976
- } = input;
3914
+ const context = input;
3977
3915
  const {
3978
3916
  source
3979
3917
  } = context;
@@ -4021,9 +3959,7 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
4021
3959
  precedence
4022
3960
  }));
4023
3961
  return input => {
4024
- const {
4025
- context
4026
- } = input;
3962
+ const context = input;
4027
3963
  const {
4028
3964
  source,
4029
3965
  position
@@ -4468,9 +4404,7 @@ function parse(source) {
4468
4404
  const context = new context_1.Context({
4469
4405
  source
4470
4406
  });
4471
- const result = (0, header_1.header)({
4472
- context
4473
- });
4407
+ const result = (0, header_1.header)(context);
4474
4408
  const el = result?.head?.value;
4475
4409
  return el?.tagName === 'ASIDE' ? [el, context.position] : [];
4476
4410
  }
@@ -4670,11 +4604,9 @@ exports.block = (0, combinator_1.reset)({
4670
4604
  backtracks: {}
4671
4605
  }, error((0, combinator_1.union)([source_1.emptysegment, input => {
4672
4606
  const {
4673
- context: {
4674
- source,
4675
- position,
4676
- segment
4677
- }
4607
+ source,
4608
+ position,
4609
+ segment
4678
4610
  } = input;
4679
4611
  if (position === source.length) return;
4680
4612
  switch (segment ^ 1 /* Segment.write */) {
@@ -4735,11 +4667,9 @@ exports.block = (0, combinator_1.reset)({
4735
4667
  function error(parser) {
4736
4668
  const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}[^\n]*\n`);
4737
4669
  return (0, combinator_1.recover)(parser, ({
4738
- context: {
4739
- source,
4740
- position,
4741
- id
4742
- }
4670
+ source,
4671
+ position,
4672
+ id
4743
4673
  }, reason) => new parser_1.List([new parser_1.Node((0, dom_1.html)('h1', {
4744
4674
  id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
4745
4675
  class: 'error'
@@ -4774,9 +4704,7 @@ const opener = /(?=>>+(?:$|[ \n]))/y;
4774
4704
  const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y));
4775
4705
  const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
4776
4706
  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)))])));
4777
- 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, ({
4778
- context
4779
- }) => {
4707
+ 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 => {
4780
4708
  (0, combinator_1.consume)(10, context);
4781
4709
  const {
4782
4710
  source
@@ -5047,9 +4975,7 @@ exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
5047
4975
  const {
5048
4976
  position
5049
4977
  } = context;
5050
- const result = parser({
5051
- context
5052
- });
4978
+ const result = parser(context);
5053
4979
  context.position = position;
5054
4980
  context.segment = 10 /* Segment.figure */ | 1 /* Segment.write */;
5055
4981
  return result ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
@@ -5548,9 +5474,7 @@ const visibility_1 = __webpack_require__(6364);
5548
5474
  const util_1 = __webpack_require__(4992);
5549
5475
  const dom_1 = __webpack_require__(394);
5550
5476
  exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(?:\n#+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, input => {
5551
- const {
5552
- context
5553
- } = input;
5477
+ const context = input;
5554
5478
  const {
5555
5479
  source,
5556
5480
  range
@@ -5602,13 +5526,9 @@ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combin
5602
5526
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5603
5527
  }, (0, util_1.unwrap)(ns)))]))));
5604
5528
  exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(({
5605
- context: {
5606
- source
5607
- }
5529
+ source
5608
5530
  }) => new parser_1.List([new parser_1.Node(source)]))]), ({
5609
- context: {
5610
- source
5611
- }
5531
+ source
5612
5532
  }) => new parser_1.List([new parser_1.Node(''), new parser_1.Node((0, dom_1.html)('span', {
5613
5533
  class: 'invalid',
5614
5534
  ...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
@@ -5669,9 +5589,7 @@ const inline_1 = __webpack_require__(7973);
5669
5589
  const util_1 = __webpack_require__(4992);
5670
5590
  const dom_1 = __webpack_require__(394);
5671
5591
  exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)((0, combinator_1.line)((0, combinator_1.fallback)((0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), ({
5672
- context: {
5673
- source
5674
- }
5592
+ source
5675
5593
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
5676
5594
  class: 'invalid',
5677
5595
  ...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
@@ -5710,14 +5628,10 @@ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.recursion)(
5710
5628
  }, (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))])))]))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ol', (0, util_1.unwrap)(ns)), type, form))]));
5711
5629
  const heads = {
5712
5630
  '.': (0, combinator_1.focus)(openers['.'], ({
5713
- context: {
5714
- source
5715
- }
5631
+ source
5716
5632
  }) => new parser_1.List([new parser_1.Node(source.trimEnd().split('.', 1)[0] + '.')])),
5717
5633
  '(': (0, combinator_1.focus)(openers['('], ({
5718
- context: {
5719
- source
5720
- }
5634
+ source
5721
5635
  }) => new parser_1.List([new parser_1.Node(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
5722
5636
  };
5723
5637
  function idx(value) {
@@ -5895,23 +5809,17 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
5895
5809
  // Subject page representation.
5896
5810
  // リンクの実装は後で検討
5897
5811
  (0, combinator_1.focus)(/>>#\S*(?=\s*$)/y, ({
5898
- context: {
5899
- source
5900
- }
5812
+ source
5901
5813
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
5902
5814
  class: 'anchor'
5903
5815
  }, source))])), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5904
- context: {
5905
- source
5906
- }
5816
+ source
5907
5817
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
5908
5818
  class: 'anchor',
5909
5819
  href: source.slice(2).trimEnd(),
5910
5820
  target: '_blank'
5911
5821
  }, source))])), (0, combinator_1.focus)(/>>\S+(?=\s*$)/y, ({
5912
- context: {
5913
- source
5914
- }
5822
+ source
5915
5823
  }) => new parser_1.List([new parser_1.Node(source)]))])), nodes => {
5916
5824
  const quotes = nodes.head.value;
5917
5825
  const node = nodes.last.value;
@@ -6006,25 +5914,19 @@ const array_1 = __webpack_require__(6876);
6006
5914
  const dom_1 = __webpack_require__(394);
6007
5915
  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)))]))]))));
6008
5916
  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, ({
6009
- context: {
6010
- source
6011
- }
5917
+ source
6012
5918
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', {
6013
5919
  class: 'invalid',
6014
5920
  ...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
6015
5921
  }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
6016
5922
  const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/:-+:?/y, ({
6017
- context: {
6018
- source,
6019
- position,
6020
- range
6021
- }
5923
+ source,
5924
+ position,
5925
+ range
6022
5926
  }) => new parser_1.List([new parser_1.Node(source[position + range - 1] === ':' ? 'center' : 'start')]), false), (0, combinator_1.focus)(/-+:?/y, ({
6023
- context: {
6024
- source,
6025
- position,
6026
- range
6027
- }
5927
+ source,
5928
+ position,
5929
+ range
6028
5930
  }) => new parser_1.List([new parser_1.Node(source[position + range - 1] === ':' ? 'end' : '')]), false)])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
6029
5931
  const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/\|?\s*$/y, 9]]))]), /[^|]*/y, true);
6030
5932
  const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
@@ -6070,10 +5972,8 @@ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combin
6070
5972
  'data-index': (0, inline_1.dataindex)(ns)
6071
5973
  }, (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))))]))));
6072
5974
  exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
6073
- context: {
6074
- source,
6075
- position
6076
- }
5975
+ source,
5976
+ position
6077
5977
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6078
5978
  class: 'checkbox'
6079
5979
  }, source[position + 1].trimStart() ? '☑' : '☐'))]), false);
@@ -6173,15 +6073,11 @@ const source_1 = __webpack_require__(8745);
6173
6073
  const util_1 = __webpack_require__(4992);
6174
6074
  const normalize_1 = __webpack_require__(4490);
6175
6075
  const dom_1 = __webpack_require__(394);
6176
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\n]*\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
6177
- context
6178
- }) => context.header, (0, combinator_1.focus)(/(---+)[^\S\n]*\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1[^\S\n]*(?:$|\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', {
6076
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\n]*\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\n]*\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1[^\S\n]*(?:$|\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', {
6179
6077
  class: 'header'
6180
6078
  }, [(0, dom_1.html)('details', {
6181
6079
  open: ''
6182
- }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Node((0, dom_1.html)('summary', 'Header'))) && ns)))]))]))))), ({
6183
- context
6184
- }) => {
6080
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Node((0, dom_1.html)('summary', 'Header'))) && ns)))]))]))))), context => {
6185
6081
  const {
6186
6082
  source,
6187
6083
  position
@@ -6194,10 +6090,8 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
6194
6090
  }, (0, normalize_1.normalize)(source.slice(position))))]);
6195
6091
  }])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\n]*\n/y))])));
6196
6092
  const field = (0, combinator_1.line)(({
6197
- context: {
6198
- source,
6199
- position
6200
- }
6093
+ source,
6094
+ position
6201
6095
  }) => {
6202
6096
  const name = source.slice(position, source.indexOf(':', position));
6203
6097
  const value = source.slice(position + name.length + 1).trim();
@@ -6250,10 +6144,8 @@ const source_1 = __webpack_require__(8745);
6250
6144
  const stars = (0, source_1.strs)('*');
6251
6145
  exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
6252
6146
  const {
6253
- context: {
6254
- source,
6255
- position
6256
- }
6147
+ source,
6148
+ position
6257
6149
  } = input;
6258
6150
  if (position === source.length) return;
6259
6151
  switch (source[position]) {
@@ -6470,9 +6362,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
6470
6362
  class: 'bracket'
6471
6363
  }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
6472
6364
  bs.unshift(new parser_1.Node('('));
6473
- const cs = parser({
6474
- context
6475
- });
6365
+ const cs = parser(context);
6476
6366
  if (source[context.position] === ')') {
6477
6367
  cs && bs.import(cs);
6478
6368
  bs.push(new parser_1.Node(')'));
@@ -6532,10 +6422,8 @@ const anchor_1 = __webpack_require__(8535);
6532
6422
  const text_1 = __webpack_require__(5655);
6533
6423
  exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.state)(~1 /* State.autolink */, input => {
6534
6424
  const {
6535
- context: {
6536
- source,
6537
- position
6538
- }
6425
+ source,
6426
+ position
6539
6427
  } = input;
6540
6428
  if (position === source.length) return;
6541
6429
  const fst = source[position];
@@ -6746,12 +6634,8 @@ const combinator_1 = __webpack_require__(3484);
6746
6634
  const inline_1 = __webpack_require__(7973);
6747
6635
  const link_1 = __webpack_require__(3628);
6748
6636
  const source_1 = __webpack_require__(8745);
6749
- 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 */, ({
6750
- context
6751
- }) => 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))])));
6752
- 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 */, ({
6753
- context
6754
- }) => {
6637
+ 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))])));
6638
+ 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 => {
6755
6639
  const {
6756
6640
  source,
6757
6641
  position
@@ -6784,10 +6668,8 @@ exports.indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
6784
6668
  const indexF = new RegExp(exports.indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
6785
6669
  exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
6786
6670
  const {
6787
- context: {
6788
- source,
6789
- position
6790
- }
6671
+ source,
6672
+ position
6791
6673
  } = input;
6792
6674
  switch (source[position]) {
6793
6675
  case '(':
@@ -6875,9 +6757,7 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6875
6757
  } else if (source[position] !== '{') {
6876
6758
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6877
6759
  } else {
6878
- if (!(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) && !(0, link_1.textlink)({
6879
- context
6880
- })) {
6760
+ if (!(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) && !(0, link_1.textlink)(context)) {
6881
6761
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6882
6762
  }
6883
6763
  context.position = position;
@@ -7014,9 +6894,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
7014
6894
  buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
7015
6895
  return prepend('*', buffer);
7016
6896
  }
7017
- })({
7018
- context
7019
- }) ?? prepend('*', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
6897
+ })(context) ?? prepend('*', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
7020
6898
  case '*':
7021
6899
  return (0, combinator_1.bind)(substrong, ds => {
7022
6900
  const {
@@ -7033,9 +6911,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
7033
6911
  buffer.push(new parser_1.Node("\u001F" /* Command.Separator */));
7034
6912
  return prepend('**', buffer);
7035
6913
  }
7036
- })({
7037
- context
7038
- }) ?? prepend('**', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
6914
+ })(context) ?? prepend('**', buffer.import(new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Node("\u001F" /* Command.Separator */)])));
7039
6915
  }
7040
6916
  }, ([, bs], {
7041
6917
  buffer
@@ -7071,9 +6947,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
7071
6947
  } else {
7072
6948
  return prepend('*', nodes.import(ds));
7073
6949
  }
7074
- })({
7075
- context
7076
- }) ?? prepend('*', nodes);
6950
+ })(context) ?? prepend('*', nodes);
7077
6951
  prefix -= 1;
7078
6952
  break;
7079
6953
  case 2:
@@ -7087,9 +6961,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
7087
6961
  } else {
7088
6962
  return prepend('**', nodes.import(ds));
7089
6963
  }
7090
- })({
7091
- context
7092
- }) ?? prepend('**', nodes);
6964
+ })(context) ?? prepend('**', nodes);
7093
6965
  prefix -= 2;
7094
6966
  break;
7095
6967
  }
@@ -7811,12 +7683,10 @@ const util_1 = __webpack_require__(4992);
7811
7683
  const dom_1 = __webpack_require__(394);
7812
7684
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7813
7685
  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 */])]), ({
7814
- context: {
7815
- source,
7816
- caches: {
7817
- math: cache
7818
- } = {}
7819
- }
7686
+ source,
7687
+ caches: {
7688
+ math: cache
7689
+ } = {}
7820
7690
  }) => new parser_1.List([new parser_1.Node(cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7821
7691
  class: 'math',
7822
7692
  translate: 'no',
@@ -7995,9 +7865,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7995
7865
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
7996
7866
  } else {
7997
7867
  context.position += 1;
7998
- if (!(0, link_1.textlink)({
7999
- context
8000
- })) {
7868
+ if (!(0, link_1.textlink)(context)) {
8001
7869
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head + 1);
8002
7870
  }
8003
7871
  context.position = position;
@@ -8062,9 +7930,7 @@ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, com
8062
7930
  }, [(0, dom_1.html)('input', {
8063
7931
  type: 'checkbox'
8064
7932
  }), (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, ({
8065
- context: {
8066
- source
8067
- }
7933
+ source
8068
7934
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
8069
7935
  class: 'invalid',
8070
7936
  ...(0, util_1.invalid)('remark', 'syntax', 'Invalid start symbol')
@@ -8124,9 +7990,7 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
8124
7990
  }));
8125
7991
  const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
8126
7992
  const text = input => {
8127
- const {
8128
- context
8129
- } = input;
7993
+ const context = input;
8130
7994
  const {
8131
7995
  source
8132
7996
  } = context;
@@ -8587,10 +8451,8 @@ exports.MAX_SEGMENT_SIZE = 100_000; // 100,000 bytes (Max value size of FDB)
8587
8451
  exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
8588
8452
  const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptysegment, exports.MAX_SEGMENT_SIZE + 1), input => {
8589
8453
  const {
8590
- context: {
8591
- source,
8592
- position
8593
- }
8454
+ source,
8455
+ position
8594
8456
  } = input;
8595
8457
  if (position === source.length) return;
8596
8458
  switch (source[position]) {
@@ -8617,9 +8479,7 @@ function* segment(source) {
8617
8479
  source,
8618
8480
  position
8619
8481
  });
8620
- const result = parser({
8621
- context
8622
- });
8482
+ const result = parser(context);
8623
8483
  const segs = result.length > 0 ? result.foldl((acc, {
8624
8484
  value
8625
8485
  }) => void acc.push(value) || acc, []) : [source.slice(position, context.position)];
@@ -8731,9 +8591,7 @@ const combinator_1 = __webpack_require__(3484);
8731
8591
  const text_1 = __webpack_require__(5655);
8732
8592
  const dom_1 = __webpack_require__(394);
8733
8593
  const delimiter = /(?=[\\$"`\[\](){}\r\n]|\s\$|:\/\/)/g;
8734
- const escsource = ({
8735
- context
8736
- }) => {
8594
+ const escsource = context => {
8737
8595
  const {
8738
8596
  source,
8739
8597
  position,
@@ -8790,9 +8648,7 @@ Object.defineProperty(exports, "__esModule", ({
8790
8648
  exports.contentline = exports.emptysegment = exports.emptyline = exports.anyline = void 0;
8791
8649
  const parser_1 = __webpack_require__(605);
8792
8650
  const anyline = input => {
8793
- const {
8794
- context
8795
- } = input;
8651
+ const context = input;
8796
8652
  const {
8797
8653
  source,
8798
8654
  position
@@ -8804,9 +8660,7 @@ const anyline = input => {
8804
8660
  exports.anyline = anyline;
8805
8661
  const regEmptyline = /[^\S\n]*(?:$|\n)/y;
8806
8662
  const emptyline = input => {
8807
- const {
8808
- context
8809
- } = input;
8663
+ const context = input;
8810
8664
  const {
8811
8665
  source,
8812
8666
  position
@@ -8819,9 +8673,7 @@ const emptyline = input => {
8819
8673
  };
8820
8674
  exports.emptyline = emptyline;
8821
8675
  const emptysegment = input => {
8822
- const {
8823
- context
8824
- } = input;
8676
+ const context = input;
8825
8677
  const {
8826
8678
  source,
8827
8679
  position,
@@ -8848,9 +8700,7 @@ function eoel(source, position) {
8848
8700
  }
8849
8701
  const regContentline = /[^\S\n]*\S[^\n]*(?:$|\n)/y;
8850
8702
  const contentline = input => {
8851
- const {
8852
- context
8853
- } = input;
8703
+ const context = input;
8854
8704
  const {
8855
8705
  source,
8856
8706
  position
@@ -8885,9 +8735,7 @@ function str(pattern, after) {
8885
8735
  }
8886
8736
  exports.str = str;
8887
8737
  function strs(char, min = 1, max = -1) {
8888
- return ({
8889
- context
8890
- }) => {
8738
+ return context => {
8891
8739
  const {
8892
8740
  source,
8893
8741
  position
@@ -8918,9 +8766,7 @@ const combinator_1 = __webpack_require__(3484);
8918
8766
  const dom_1 = __webpack_require__(394);
8919
8767
  exports.nonWhitespace = /[^ \t ]/g;
8920
8768
  const text = input => {
8921
- const {
8922
- context
8923
- } = input;
8769
+ const context = input;
8924
8770
  const {
8925
8771
  source,
8926
8772
  position,
@@ -9157,9 +9003,7 @@ const combinator_1 = __webpack_require__(3484);
9157
9003
  const text_1 = __webpack_require__(5655);
9158
9004
  const dom_1 = __webpack_require__(394);
9159
9005
  exports.delimiter = /(?=(?=[\x00-\x7F])[^0-9A-Za-z]|(?<=[\x00-\x7F])[^\x00-\x7F])/g;
9160
- const unescsource = ({
9161
- context
9162
- }) => {
9006
+ const unescsource = context => {
9163
9007
  const {
9164
9008
  source,
9165
9009
  position,
@@ -9232,9 +9076,7 @@ function repeat(symbol, after, parser, cons, termination = (nodes, context, pref
9232
9076
  }) {
9233
9077
  const test = (0, delimiter_1.tester)(after, false);
9234
9078
  return (0, parser_1.failsafe)(input => {
9235
- const {
9236
- context
9237
- } = input;
9079
+ const context = input;
9238
9080
  const {
9239
9081
  source,
9240
9082
  position
@@ -9404,9 +9246,7 @@ function trimBlank(parser) {
9404
9246
  exports.trimBlank = trimBlank;
9405
9247
  function trimBlankStart(parser) {
9406
9248
  return (0, parser_1.failsafe)(input => {
9407
- const {
9408
- context
9409
- } = input;
9249
+ const context = input;
9410
9250
  const {
9411
9251
  source,
9412
9252
  position
@@ -9909,9 +9749,7 @@ const parser_1 = __webpack_require__(605);
9909
9749
  const context_1 = __webpack_require__(8669);
9910
9750
  const cite_1 = __webpack_require__(1200);
9911
9751
  function quote(anchor, range) {
9912
- const {
9913
- context
9914
- } = (0, parser_1.input)('', new context_1.Context());
9752
+ const context = (0, parser_1.input)('', new context_1.Context());
9915
9753
  (0, cite_1.cite)((0, parser_1.input)(`>>${anchor}`, context));
9916
9754
  if (context.position !== context.source.length) throw new Error(`Invalid anchor: ${anchor}`);
9917
9755
  fit(range);