@ng-doc/utils 17.6.8 → 17.6.9

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 (2) hide show
  1. package/index.esm.js +197 -107
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -14,6 +14,10 @@ import { headingRank } from 'hast-util-heading-rank';
14
14
  import { rehype } from 'rehype';
15
15
  import { filter } from 'unist-util-filter';
16
16
 
17
+ function getDefaultExportFromCjs (x) {
18
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
19
+ }
20
+
17
21
  var unicode$3 = {};
18
22
 
19
23
  const UNDEFINED_CODE_POINTS = [
@@ -200,7 +204,7 @@ const DEFAULT_BUFFER_WATERLINE = 1 << 16;
200
204
  //Preprocessor
201
205
  //NOTE: HTML input preprocessing
202
206
  //(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream)
203
- class Preprocessor$1 {
207
+ let Preprocessor$1 = class Preprocessor {
204
208
  constructor() {
205
209
  this.html = null;
206
210
 
@@ -342,7 +346,7 @@ class Preprocessor$1 {
342
346
 
343
347
  this.pos--;
344
348
  }
345
- }
349
+ };
346
350
 
347
351
  var preprocessor = Preprocessor$1;
348
352
 
@@ -561,7 +565,7 @@ function findNamedEntityTreeBranch(nodeIx, cp) {
561
565
  }
562
566
 
563
567
  //Tokenizer
564
- class Tokenizer$4 {
568
+ let Tokenizer$4 = class Tokenizer {
565
569
  constructor() {
566
570
  this.preprocessor = new Preprocessor();
567
571
 
@@ -628,7 +632,7 @@ class Tokenizer$4 {
628
632
  }
629
633
 
630
634
  this.active = false;
631
- this.tokenQueue.push({ type: Tokenizer$4.HIBERNATION_TOKEN });
635
+ this.tokenQueue.push({ type: Tokenizer.HIBERNATION_TOKEN });
632
636
 
633
637
  return true;
634
638
  }
@@ -706,7 +710,7 @@ class Tokenizer$4 {
706
710
  //Token creation
707
711
  _createStartTagToken() {
708
712
  this.currentToken = {
709
- type: Tokenizer$4.START_TAG_TOKEN,
713
+ type: Tokenizer.START_TAG_TOKEN,
710
714
  tagName: '',
711
715
  selfClosing: false,
712
716
  ackSelfClosing: false,
@@ -716,7 +720,7 @@ class Tokenizer$4 {
716
720
 
717
721
  _createEndTagToken() {
718
722
  this.currentToken = {
719
- type: Tokenizer$4.END_TAG_TOKEN,
723
+ type: Tokenizer.END_TAG_TOKEN,
720
724
  tagName: '',
721
725
  selfClosing: false,
722
726
  attrs: []
@@ -725,14 +729,14 @@ class Tokenizer$4 {
725
729
 
726
730
  _createCommentToken() {
727
731
  this.currentToken = {
728
- type: Tokenizer$4.COMMENT_TOKEN,
732
+ type: Tokenizer.COMMENT_TOKEN,
729
733
  data: ''
730
734
  };
731
735
  }
732
736
 
733
737
  _createDoctypeToken(initialName) {
734
738
  this.currentToken = {
735
- type: Tokenizer$4.DOCTYPE_TOKEN,
739
+ type: Tokenizer.DOCTYPE_TOKEN,
736
740
  name: initialName,
737
741
  forceQuirks: false,
738
742
  publicId: null,
@@ -748,7 +752,7 @@ class Tokenizer$4 {
748
752
  }
749
753
 
750
754
  _createEOFToken() {
751
- this.currentToken = { type: Tokenizer$4.EOF_TOKEN };
755
+ this.currentToken = { type: Tokenizer.EOF_TOKEN };
752
756
  }
753
757
 
754
758
  //Tag attributes
@@ -760,7 +764,7 @@ class Tokenizer$4 {
760
764
  }
761
765
 
762
766
  _leaveAttrName(toState) {
763
- if (Tokenizer$4.getTokenAttr(this.currentToken, this.currentAttr.name) === null) {
767
+ if (Tokenizer.getTokenAttr(this.currentToken, this.currentAttr.name) === null) {
764
768
  this.currentToken.attrs.push(this.currentAttr);
765
769
  } else {
766
770
  this._err(ERR$1.duplicateAttribute);
@@ -782,9 +786,9 @@ class Tokenizer$4 {
782
786
  this.currentToken = null;
783
787
 
784
788
  //NOTE: store emited start tag's tagName to determine is the following end tag token is appropriate.
785
- if (ct.type === Tokenizer$4.START_TAG_TOKEN) {
789
+ if (ct.type === Tokenizer.START_TAG_TOKEN) {
786
790
  this.lastStartTagName = ct.tagName;
787
- } else if (ct.type === Tokenizer$4.END_TAG_TOKEN) {
791
+ } else if (ct.type === Tokenizer.END_TAG_TOKEN) {
788
792
  if (ct.attrs.length > 0) {
789
793
  this._err(ERR$1.endTagWithAttributes);
790
794
  }
@@ -832,12 +836,12 @@ class Tokenizer$4 {
832
836
  }
833
837
 
834
838
  _emitCodePoint(cp) {
835
- let type = Tokenizer$4.CHARACTER_TOKEN;
839
+ let type = Tokenizer.CHARACTER_TOKEN;
836
840
 
837
841
  if (isWhitespace(cp)) {
838
- type = Tokenizer$4.WHITESPACE_CHARACTER_TOKEN;
842
+ type = Tokenizer.WHITESPACE_CHARACTER_TOKEN;
839
843
  } else if (cp === $$5.NULL) {
840
- type = Tokenizer$4.NULL_CHARACTER_TOKEN;
844
+ type = Tokenizer.NULL_CHARACTER_TOKEN;
841
845
  }
842
846
 
843
847
  this._appendCharToCurrentCharacterToken(type, toChar(cp));
@@ -852,7 +856,7 @@ class Tokenizer$4 {
852
856
  //NOTE: used then we emit character explicitly. This is always a non-whitespace and a non-null character.
853
857
  //So we can avoid additional checks here.
854
858
  _emitChars(ch) {
855
- this._appendCharToCurrentCharacterToken(Tokenizer$4.CHARACTER_TOKEN, ch);
859
+ this._appendCharToCurrentCharacterToken(Tokenizer.CHARACTER_TOKEN, ch);
856
860
  }
857
861
 
858
862
  // Character reference helpers
@@ -2510,7 +2514,7 @@ class Tokenizer$4 {
2510
2514
  this._flushCodePointsConsumedAsCharacterReference();
2511
2515
  this._reconsumeInState(this.returnState);
2512
2516
  }
2513
- }
2517
+ };
2514
2518
 
2515
2519
  //Token types
2516
2520
  Tokenizer$4.CHARACTER_TOKEN = 'CHARACTER_TOKEN';
@@ -2937,7 +2941,7 @@ function isScopingElement(tn, ns) {
2937
2941
  }
2938
2942
 
2939
2943
  //Stack of open elements
2940
- class OpenElementStack$1 {
2944
+ let OpenElementStack$1 = class OpenElementStack {
2941
2945
  constructor(document, treeAdapter) {
2942
2946
  this.stackTop = -1;
2943
2947
  this.items = [];
@@ -3295,7 +3299,7 @@ class OpenElementStack$1 {
3295
3299
  this.pop();
3296
3300
  }
3297
3301
  }
3298
- }
3302
+ };
3299
3303
 
3300
3304
  var openElementStack = OpenElementStack$1;
3301
3305
 
@@ -3303,7 +3307,7 @@ var openElementStack = OpenElementStack$1;
3303
3307
  const NOAH_ARK_CAPACITY = 3;
3304
3308
 
3305
3309
  //List of formatting elements
3306
- class FormattingElementList$1 {
3310
+ let FormattingElementList$1 = class FormattingElementList {
3307
3311
  constructor(treeAdapter) {
3308
3312
  this.length = 0;
3309
3313
  this.entries = [];
@@ -3325,7 +3329,7 @@ class FormattingElementList$1 {
3325
3329
  for (let i = this.length - 1; i >= 0; i--) {
3326
3330
  const entry = this.entries[i];
3327
3331
 
3328
- if (entry.type === FormattingElementList$1.MARKER_ENTRY) {
3332
+ if (entry.type === FormattingElementList.MARKER_ENTRY) {
3329
3333
  break;
3330
3334
  }
3331
3335
 
@@ -3387,7 +3391,7 @@ class FormattingElementList$1 {
3387
3391
 
3388
3392
  //Mutations
3389
3393
  insertMarker() {
3390
- this.entries.push({ type: FormattingElementList$1.MARKER_ENTRY });
3394
+ this.entries.push({ type: FormattingElementList.MARKER_ENTRY });
3391
3395
  this.length++;
3392
3396
  }
3393
3397
 
@@ -3395,7 +3399,7 @@ class FormattingElementList$1 {
3395
3399
  this._ensureNoahArkCondition(element);
3396
3400
 
3397
3401
  this.entries.push({
3398
- type: FormattingElementList$1.ELEMENT_ENTRY,
3402
+ type: FormattingElementList.ELEMENT_ENTRY,
3399
3403
  element: element,
3400
3404
  token: token
3401
3405
  });
@@ -3413,7 +3417,7 @@ class FormattingElementList$1 {
3413
3417
  }
3414
3418
 
3415
3419
  this.entries.splice(bookmarkIdx + 1, 0, {
3416
- type: FormattingElementList$1.ELEMENT_ENTRY,
3420
+ type: FormattingElementList.ELEMENT_ENTRY,
3417
3421
  element: element,
3418
3422
  token: token
3419
3423
  });
@@ -3437,7 +3441,7 @@ class FormattingElementList$1 {
3437
3441
 
3438
3442
  this.length--;
3439
3443
 
3440
- if (entry.type === FormattingElementList$1.MARKER_ENTRY) {
3444
+ if (entry.type === FormattingElementList.MARKER_ENTRY) {
3441
3445
  break;
3442
3446
  }
3443
3447
  }
@@ -3448,7 +3452,7 @@ class FormattingElementList$1 {
3448
3452
  for (let i = this.length - 1; i >= 0; i--) {
3449
3453
  const entry = this.entries[i];
3450
3454
 
3451
- if (entry.type === FormattingElementList$1.MARKER_ENTRY) {
3455
+ if (entry.type === FormattingElementList.MARKER_ENTRY) {
3452
3456
  return null;
3453
3457
  }
3454
3458
 
@@ -3464,14 +3468,14 @@ class FormattingElementList$1 {
3464
3468
  for (let i = this.length - 1; i >= 0; i--) {
3465
3469
  const entry = this.entries[i];
3466
3470
 
3467
- if (entry.type === FormattingElementList$1.ELEMENT_ENTRY && entry.element === element) {
3471
+ if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) {
3468
3472
  return entry;
3469
3473
  }
3470
3474
  }
3471
3475
 
3472
3476
  return null;
3473
3477
  }
3474
- }
3478
+ };
3475
3479
 
3476
3480
  //Entry types
3477
3481
  FormattingElementList$1.MARKER_ENTRY = 'MARKER_ENTRY';
@@ -3479,7 +3483,7 @@ FormattingElementList$1.ELEMENT_ENTRY = 'ELEMENT_ENTRY';
3479
3483
 
3480
3484
  var formattingElementList = FormattingElementList$1;
3481
3485
 
3482
- class Mixin$9 {
3486
+ let Mixin$9 = class Mixin {
3483
3487
  constructor(host) {
3484
3488
  const originalMethods = {};
3485
3489
  const overriddenMethods = this._getOverriddenMethods(this, originalMethods);
@@ -3495,7 +3499,7 @@ class Mixin$9 {
3495
3499
  _getOverriddenMethods() {
3496
3500
  throw new Error('Not implemented');
3497
3501
  }
3498
- }
3502
+ };
3499
3503
 
3500
3504
  Mixin$9.install = function(host, Ctor, opts) {
3501
3505
  if (!host.__mixins) {
@@ -3519,7 +3523,7 @@ var mixin = Mixin$9;
3519
3523
 
3520
3524
  const Mixin$8 = mixin;
3521
3525
 
3522
- class PositionTrackingPreprocessorMixin$2 extends Mixin$8 {
3526
+ let PositionTrackingPreprocessorMixin$2 = class PositionTrackingPreprocessorMixin extends Mixin$8 {
3523
3527
  constructor(preprocessor) {
3524
3528
  super(preprocessor);
3525
3529
 
@@ -3576,7 +3580,7 @@ class PositionTrackingPreprocessorMixin$2 extends Mixin$8 {
3576
3580
  }
3577
3581
  };
3578
3582
  }
3579
- }
3583
+ };
3580
3584
 
3581
3585
  var preprocessorMixin$1 = PositionTrackingPreprocessorMixin$2;
3582
3586
 
@@ -3584,7 +3588,7 @@ const Mixin$7 = mixin;
3584
3588
  const Tokenizer$3 = tokenizer;
3585
3589
  const PositionTrackingPreprocessorMixin$1 = preprocessorMixin$1;
3586
3590
 
3587
- class LocationInfoTokenizerMixin$2 extends Mixin$7 {
3591
+ let LocationInfoTokenizerMixin$2 = class LocationInfoTokenizerMixin extends Mixin$7 {
3588
3592
  constructor(tokenizer) {
3589
3593
  super(tokenizer);
3590
3594
 
@@ -3721,13 +3725,13 @@ class LocationInfoTokenizerMixin$2 extends Mixin$7 {
3721
3725
 
3722
3726
  return methods;
3723
3727
  }
3724
- }
3728
+ };
3725
3729
 
3726
3730
  var tokenizerMixin$1 = LocationInfoTokenizerMixin$2;
3727
3731
 
3728
3732
  const Mixin$6 = mixin;
3729
3733
 
3730
- class LocationInfoOpenElementStackMixin$1 extends Mixin$6 {
3734
+ let LocationInfoOpenElementStackMixin$1 = class LocationInfoOpenElementStackMixin extends Mixin$6 {
3731
3735
  constructor(stack, opts) {
3732
3736
  super(stack);
3733
3737
 
@@ -3755,7 +3759,7 @@ class LocationInfoOpenElementStackMixin$1 extends Mixin$6 {
3755
3759
  }
3756
3760
  };
3757
3761
  }
3758
- }
3762
+ };
3759
3763
 
3760
3764
  var openElementStackMixin = LocationInfoOpenElementStackMixin$1;
3761
3765
 
@@ -3768,7 +3772,7 @@ const HTML$2 = html$4;
3768
3772
  //Aliases
3769
3773
  const $$2 = HTML$2.TAG_NAMES;
3770
3774
 
3771
- class LocationInfoParserMixin$1 extends Mixin$5 {
3775
+ let LocationInfoParserMixin$1 = class LocationInfoParserMixin extends Mixin$5 {
3772
3776
  constructor(parser) {
3773
3777
  super(parser);
3774
3778
 
@@ -3977,13 +3981,13 @@ class LocationInfoParserMixin$1 extends Mixin$5 {
3977
3981
  }
3978
3982
  };
3979
3983
  }
3980
- }
3984
+ };
3981
3985
 
3982
3986
  var parserMixin$1 = LocationInfoParserMixin$1;
3983
3987
 
3984
3988
  const Mixin$4 = mixin;
3985
3989
 
3986
- class ErrorReportingMixinBase$3 extends Mixin$4 {
3990
+ let ErrorReportingMixinBase$3 = class ErrorReportingMixinBase extends Mixin$4 {
3987
3991
  constructor(host, opts) {
3988
3992
  super(host);
3989
3993
 
@@ -4019,7 +4023,7 @@ class ErrorReportingMixinBase$3 extends Mixin$4 {
4019
4023
  }
4020
4024
  };
4021
4025
  }
4022
- }
4026
+ };
4023
4027
 
4024
4028
  var mixinBase = ErrorReportingMixinBase$3;
4025
4029
 
@@ -4027,7 +4031,7 @@ const ErrorReportingMixinBase$2 = mixinBase;
4027
4031
  const PositionTrackingPreprocessorMixin = preprocessorMixin$1;
4028
4032
  const Mixin$3 = mixin;
4029
4033
 
4030
- class ErrorReportingPreprocessorMixin$1 extends ErrorReportingMixinBase$2 {
4034
+ let ErrorReportingPreprocessorMixin$1 = class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase$2 {
4031
4035
  constructor(preprocessor, opts) {
4032
4036
  super(preprocessor, opts);
4033
4037
 
@@ -4042,7 +4046,7 @@ class ErrorReportingPreprocessorMixin$1 extends ErrorReportingMixinBase$2 {
4042
4046
  super._reportError(code);
4043
4047
  }
4044
4048
  }
4045
- }
4049
+ };
4046
4050
 
4047
4051
  var preprocessorMixin = ErrorReportingPreprocessorMixin$1;
4048
4052
 
@@ -4050,7 +4054,7 @@ const ErrorReportingMixinBase$1 = mixinBase;
4050
4054
  const ErrorReportingPreprocessorMixin = preprocessorMixin;
4051
4055
  const Mixin$2 = mixin;
4052
4056
 
4053
- class ErrorReportingTokenizerMixin$1 extends ErrorReportingMixinBase$1 {
4057
+ let ErrorReportingTokenizerMixin$1 = class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase$1 {
4054
4058
  constructor(tokenizer, opts) {
4055
4059
  super(tokenizer, opts);
4056
4060
 
@@ -4058,7 +4062,7 @@ class ErrorReportingTokenizerMixin$1 extends ErrorReportingMixinBase$1 {
4058
4062
 
4059
4063
  this.posTracker = preprocessorMixin.posTracker;
4060
4064
  }
4061
- }
4065
+ };
4062
4066
 
4063
4067
  var tokenizerMixin = ErrorReportingTokenizerMixin$1;
4064
4068
 
@@ -4067,7 +4071,7 @@ const ErrorReportingTokenizerMixin = tokenizerMixin;
4067
4071
  const LocationInfoTokenizerMixin = tokenizerMixin$1;
4068
4072
  const Mixin$1 = mixin;
4069
4073
 
4070
- class ErrorReportingParserMixin$1 extends ErrorReportingMixinBase {
4074
+ let ErrorReportingParserMixin$1 = class ErrorReportingParserMixin extends ErrorReportingMixinBase {
4071
4075
  constructor(parser, opts) {
4072
4076
  super(parser, opts);
4073
4077
 
@@ -4109,7 +4113,7 @@ class ErrorReportingParserMixin$1 extends ErrorReportingMixinBase {
4109
4113
  }
4110
4114
  };
4111
4115
  }
4112
- }
4116
+ };
4113
4117
 
4114
4118
  var parserMixin = ErrorReportingParserMixin$1;
4115
4119
 
@@ -7731,7 +7735,7 @@ function endTagInForeignContent(p, token) {
7731
7735
  }
7732
7736
  }
7733
7737
 
7734
- var Parser5 = parser;
7738
+ var Parser5 = /*@__PURE__*/getDefaultExportFromCjs(parser);
7735
7739
 
7736
7740
  /**
7737
7741
  * @typedef {import('./info.js').Info} Info
@@ -7767,6 +7771,7 @@ Schema.prototype.space = null;
7767
7771
  * @typedef {import('./schema.js').Normal} Normal
7768
7772
  */
7769
7773
 
7774
+
7770
7775
  /**
7771
7776
  * @param {Schema[]} definitions
7772
7777
  * @param {string} [space]
@@ -7836,14 +7841,14 @@ function increment() {
7836
7841
  }
7837
7842
 
7838
7843
  var types = /*#__PURE__*/Object.freeze({
7839
- __proto__: null,
7840
- boolean: boolean,
7841
- booleanish: booleanish,
7842
- overloadedBoolean: overloadedBoolean,
7843
- number: number,
7844
- spaceSeparated: spaceSeparated,
7845
- commaSeparated: commaSeparated,
7846
- commaOrSpaceSeparated: commaOrSpaceSeparated
7844
+ __proto__: null,
7845
+ boolean: boolean,
7846
+ booleanish: booleanish,
7847
+ commaOrSpaceSeparated: commaOrSpaceSeparated,
7848
+ commaSeparated: commaSeparated,
7849
+ number: number,
7850
+ overloadedBoolean: overloadedBoolean,
7851
+ spaceSeparated: spaceSeparated
7847
7852
  });
7848
7853
 
7849
7854
  /** @type {Array<keyof types>} */
@@ -7902,6 +7907,7 @@ function mark(values, key, value) {
7902
7907
  * @property {Array<string>} [mustUseProperty]
7903
7908
  */
7904
7909
 
7910
+
7905
7911
  const own$6 = {}.hasOwnProperty;
7906
7912
 
7907
7913
  /**
@@ -8078,7 +8084,7 @@ const html$3 = create({
8078
8084
  autoFocus: boolean,
8079
8085
  autoPlay: boolean,
8080
8086
  blocking: spaceSeparated,
8081
- capture: boolean,
8087
+ capture: null,
8082
8088
  charSet: null,
8083
8089
  checked: boolean,
8084
8090
  cite: null,
@@ -8263,6 +8269,7 @@ const html$3 = create({
8263
8269
  scoped: boolean,
8264
8270
  seamless: boolean,
8265
8271
  selected: boolean,
8272
+ shadowRootClonable: boolean,
8266
8273
  shadowRootDelegatesFocus: boolean,
8267
8274
  shadowRootMode: null,
8268
8275
  shape: null,
@@ -8288,6 +8295,7 @@ const html$3 = create({
8288
8295
  value: booleanish,
8289
8296
  width: number,
8290
8297
  wrap: null,
8298
+ writingSuggestions: null,
8291
8299
 
8292
8300
  // Legacy.
8293
8301
  // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
@@ -8921,6 +8929,7 @@ const svg$1 = create({
8921
8929
  * @typedef {import('./util/schema.js').Schema} Schema
8922
8930
  */
8923
8931
 
8932
+
8924
8933
  const valid = /^data[-\w.:]+$/i;
8925
8934
  const dash = /-[a-z]/g;
8926
8935
  const cap = /[A-Z]/g;
@@ -8986,6 +8995,7 @@ function camelcase$1($0) {
8986
8995
  * @typedef {import('./lib/util/info.js').Info} Info
8987
8996
  * @typedef {import('./lib/util/schema.js').Schema} Schema
8988
8997
  */
8998
+
8989
8999
  const html$2 = merge([xml, xlink, xmlns, aria, html$3], 'html');
8990
9000
  const svg = merge([xml, xlink, xmlns, aria, svg$1], 'svg');
8991
9001
 
@@ -9167,6 +9177,7 @@ function stringify(values, options) {
9167
9177
  * @typedef {import('property-information').Schema} Schema
9168
9178
  */
9169
9179
 
9180
+
9170
9181
  const buttonTypes = new Set(['menu', 'submit', 'reset', 'button']);
9171
9182
 
9172
9183
  const own$5 = {}.hasOwnProperty;
@@ -9448,6 +9459,7 @@ function createAdjustMap(values) {
9448
9459
  * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute
9449
9460
  */
9450
9461
 
9462
+
9451
9463
  const h = core$1(html$2, 'div');
9452
9464
 
9453
9465
  const svgCaseSensitiveTagNames = [
@@ -9506,6 +9518,7 @@ const svgCaseSensitiveTagNames = [
9506
9518
  * @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute
9507
9519
  */
9508
9520
 
9521
+
9509
9522
  const s = core$1(svg, 'g', svgCaseSensitiveTagNames);
9510
9523
 
9511
9524
  /**
@@ -9650,6 +9663,7 @@ const webNamespaces = {
9650
9663
  * @typedef {import('parse5').Token.Location} P5Location
9651
9664
  */
9652
9665
 
9666
+
9653
9667
  const own$4 = {}.hasOwnProperty;
9654
9668
  /** @type {unknown} */
9655
9669
  // type-coverage:ignore-next-line
@@ -10281,6 +10295,7 @@ const errors = {
10281
10295
  * @typedef {FromParse5Options & ParseFields & ErrorFields} Options
10282
10296
  */
10283
10297
 
10298
+
10284
10299
  const base$1 = 'https://html.spec.whatwg.org/multipage/parsing.html#parse-error-';
10285
10300
 
10286
10301
  const fatalities = {2: true, 1: false, 0: null};
@@ -10526,7 +10541,7 @@ function zwitch(key, options) {
10526
10541
 
10527
10542
  /**
10528
10543
  * @typedef CoreOptions
10529
- * @property {Array<string>} [subset=[]]
10544
+ * @property {ReadonlyArray<string>} [subset=[]]
10530
10545
  * Whether to only escape the given subset of characters.
10531
10546
  * @property {boolean} [escapeOnly=false]
10532
10547
  * Whether to only escape possibly dangerous characters.
@@ -10539,6 +10554,16 @@ function zwitch(key, options) {
10539
10554
  * @typedef {CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions} CoreWithFormatOptions
10540
10555
  */
10541
10556
 
10557
+ const defaultSubsetRegex = /["&'<>`]/g;
10558
+ const surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
10559
+ const controlCharactersRegex =
10560
+ // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
10561
+ /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
10562
+ const regexEscapeRegex = /[|\\{}()[\]^$+*?.]/g;
10563
+
10564
+ /** @type {WeakMap<ReadonlyArray<string>, RegExp>} */
10565
+ const subsetToRegexCache = new WeakMap();
10566
+
10542
10567
  /**
10543
10568
  * Encode certain characters in `value`.
10544
10569
  *
@@ -10548,7 +10573,9 @@ function zwitch(key, options) {
10548
10573
  */
10549
10574
  function core(value, options) {
10550
10575
  value = value.replace(
10551
- options.subset ? charactersToExpression(options.subset) : /["&'<>`]/g,
10576
+ options.subset
10577
+ ? charactersToExpressionCached(options.subset)
10578
+ : defaultSubsetRegex,
10552
10579
  basic
10553
10580
  );
10554
10581
 
@@ -10559,14 +10586,10 @@ function core(value, options) {
10559
10586
  return (
10560
10587
  value
10561
10588
  // Surrogate pairs.
10562
- .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, surrogate)
10589
+ .replace(surrogatePairsRegex, surrogate)
10563
10590
  // BMP control characters (C0 except for LF, CR, SP; DEL; and some more
10564
10591
  // non-ASCII ones).
10565
- .replace(
10566
- // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
10567
- /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,
10568
- basic
10569
- )
10592
+ .replace(controlCharactersRegex, basic)
10570
10593
  )
10571
10594
 
10572
10595
  /**
@@ -10600,7 +10623,26 @@ function core(value, options) {
10600
10623
  }
10601
10624
 
10602
10625
  /**
10603
- * @param {Array<string>} subset
10626
+ * A wrapper function that caches the result of `charactersToExpression` with a WeakMap.
10627
+ * This can improve performance when tooling calls `charactersToExpression` repeatedly
10628
+ * with the same subset.
10629
+ *
10630
+ * @param {ReadonlyArray<string>} subset
10631
+ * @returns {RegExp}
10632
+ */
10633
+ function charactersToExpressionCached(subset) {
10634
+ let cached = subsetToRegexCache.get(subset);
10635
+
10636
+ if (!cached) {
10637
+ cached = charactersToExpression(subset);
10638
+ subsetToRegexCache.set(subset, cached);
10639
+ }
10640
+
10641
+ return cached
10642
+ }
10643
+
10644
+ /**
10645
+ * @param {ReadonlyArray<string>} subset
10604
10646
  * @returns {RegExp}
10605
10647
  */
10606
10648
  function charactersToExpression(subset) {
@@ -10609,12 +10651,14 @@ function charactersToExpression(subset) {
10609
10651
  let index = -1;
10610
10652
 
10611
10653
  while (++index < subset.length) {
10612
- groups.push(subset[index].replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'));
10654
+ groups.push(subset[index].replace(regexEscapeRegex, '\\$&'));
10613
10655
  }
10614
10656
 
10615
10657
  return new RegExp('(?:' + groups.join('|') + ')', 'g')
10616
10658
  }
10617
10659
 
10660
+ const hexadecimalRegex = /[\dA-Fa-f]/;
10661
+
10618
10662
  /**
10619
10663
  * Configurable ways to encode characters as hexadecimal references.
10620
10664
  *
@@ -10625,11 +10669,13 @@ function charactersToExpression(subset) {
10625
10669
  */
10626
10670
  function toHexadecimal(code, next, omit) {
10627
10671
  const value = '&#x' + code.toString(16).toUpperCase();
10628
- return omit && next && !/[\dA-Fa-f]/.test(String.fromCharCode(next))
10672
+ return omit && next && !hexadecimalRegex.test(String.fromCharCode(next))
10629
10673
  ? value
10630
10674
  : value + ';'
10631
10675
  }
10632
10676
 
10677
+ const decimalRegex = /\d/;
10678
+
10633
10679
  /**
10634
10680
  * Configurable ways to encode characters as decimal references.
10635
10681
  *
@@ -10640,7 +10686,7 @@ function toHexadecimal(code, next, omit) {
10640
10686
  */
10641
10687
  function toDecimal(code, next, omit) {
10642
10688
  const value = '&#' + String(code);
10643
- return omit && next && !/\d/.test(String.fromCharCode(next))
10689
+ return omit && next && !decimalRegex.test(String.fromCharCode(next))
10644
10690
  ? value
10645
10691
  : value + ';'
10646
10692
  }
@@ -11054,6 +11100,8 @@ for (key in characterEntitiesHtml4) {
11054
11100
  }
11055
11101
  }
11056
11102
 
11103
+ const notAlphanumericRegex = /[^\dA-Za-z]/;
11104
+
11057
11105
  /**
11058
11106
  * Configurable ways to encode characters as named references.
11059
11107
  *
@@ -11077,7 +11125,7 @@ function toNamed(code, next, omit, attribute) {
11077
11125
  (!attribute ||
11078
11126
  (next &&
11079
11127
  next !== 61 /* `=` */ &&
11080
- /[^\da-z]/i.test(String.fromCharCode(next))))
11128
+ notAlphanumericRegex.test(String.fromCharCode(next))))
11081
11129
  ) {
11082
11130
  return value
11083
11131
  }
@@ -11105,6 +11153,7 @@ function toNamed(code, next, omit, attribute) {
11105
11153
  * `omitOptionalSemicolons: true`.
11106
11154
  */
11107
11155
 
11156
+
11108
11157
  /**
11109
11158
  * Configurable ways to encode a character yielding pretty or small results.
11110
11159
  *
@@ -11159,6 +11208,7 @@ function formatSmart(code, next, options) {
11159
11208
  * @typedef {import('./core.js').CoreOptions} LightOptions
11160
11209
  */
11161
11210
 
11211
+
11162
11212
  /**
11163
11213
  * Encode special characters in `value`.
11164
11214
  *
@@ -11179,6 +11229,7 @@ function stringifyEntities(value, options) {
11179
11229
  * @typedef {import('../types.js').State} State
11180
11230
  */
11181
11231
 
11232
+
11182
11233
  /**
11183
11234
  * Serialize a comment.
11184
11235
  *
@@ -11305,6 +11356,7 @@ function whitespace(thing) {
11305
11356
  * @typedef {import('../../types.js').Content} Content
11306
11357
  */
11307
11358
 
11359
+
11308
11360
  const siblingAfter = siblings(1);
11309
11361
  const siblingBefore = siblings(-1);
11310
11362
 
@@ -11376,6 +11428,7 @@ function omission(handlers) {
11376
11428
  * @typedef {import('../types.js').Parent} Parent
11377
11429
  */
11378
11430
 
11431
+
11379
11432
  const closing = omission({
11380
11433
  html: html$1,
11381
11434
  head: headOrColgroupOrCaption,
@@ -11758,6 +11811,7 @@ function cells(_, index, parent) {
11758
11811
  * @typedef {import('../types.js').Content} Content
11759
11812
  */
11760
11813
 
11814
+
11761
11815
  const opening = omission({
11762
11816
  html,
11763
11817
  head,
@@ -11904,6 +11958,7 @@ function tbody(node, index, parent) {
11904
11958
  * @typedef {import('../types.js').PropertyValue} PropertyValue
11905
11959
  */
11906
11960
 
11961
+
11907
11962
  /**
11908
11963
  * Maps of subsets.
11909
11964
  *
@@ -12164,6 +12219,7 @@ function serializeAttribute(state, key, value) {
12164
12219
  * @typedef {import('../types.js').Text} Text
12165
12220
  */
12166
12221
 
12222
+
12167
12223
  /**
12168
12224
  * Serialize a text node.
12169
12225
  *
@@ -12198,6 +12254,7 @@ function text(node, _, parent, state) {
12198
12254
  * @typedef {import('../types.js').Raw} Raw
12199
12255
  */
12200
12256
 
12257
+
12201
12258
  /**
12202
12259
  * Serialize a raw node.
12203
12260
  *
@@ -12248,6 +12305,7 @@ function root(node, _1, _2, state) {
12248
12305
  * @typedef {import('../types.js').Parent} Parent
12249
12306
  */
12250
12307
 
12308
+
12251
12309
  /**
12252
12310
  * @type {(node: Node, index: number | undefined, parent: Parent | undefined, state: State) => string}
12253
12311
  */
@@ -12290,6 +12348,7 @@ function unknown(node) {
12290
12348
  * @typedef {import('./types.js').State} State
12291
12349
  */
12292
12350
 
12351
+
12293
12352
  /**
12294
12353
  * Serialize hast as HTML.
12295
12354
  *
@@ -12392,6 +12451,7 @@ function all(parent) {
12392
12451
  * @typedef {import('hast-util-to-html').Options} Options
12393
12452
  */
12394
12453
 
12454
+
12395
12455
  /**
12396
12456
  * @this {import('unified').Processor}
12397
12457
  * @type {import('unified').Plugin<[Options?]|Array<void>, Node, string>}
@@ -12435,6 +12495,8 @@ var isBuffer = function isBuffer (obj) {
12435
12495
  typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
12436
12496
  };
12437
12497
 
12498
+ var isBuffer$1 = /*@__PURE__*/getDefaultExportFromCjs(isBuffer);
12499
+
12438
12500
  var hasOwn = Object.prototype.hasOwnProperty;
12439
12501
  var toStr = Object.prototype.toString;
12440
12502
  var defineProperty = Object.defineProperty;
@@ -12551,6 +12613,8 @@ var extend = function extend() {
12551
12613
  return target;
12552
12614
  };
12553
12615
 
12616
+ var extend$1 = /*@__PURE__*/getDefaultExportFromCjs(extend);
12617
+
12554
12618
  function isPlainObject(value) {
12555
12619
  if (typeof value !== 'object' || value === null) {
12556
12620
  return false;
@@ -12560,22 +12624,43 @@ function isPlainObject(value) {
12560
12624
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
12561
12625
  }
12562
12626
 
12627
+ // To do: remove `void`s
12628
+ // To do: remove `null` from output of our APIs, allow it as user APIs.
12629
+
12563
12630
  /**
12564
- * @typedef {(error?: Error|null|undefined, ...output: Array<any>) => void} Callback
12631
+ * @typedef {(error?: Error | null | undefined, ...output: Array<any>) => void} Callback
12632
+ * Callback.
12633
+ *
12565
12634
  * @typedef {(...input: Array<any>) => any} Middleware
12635
+ * Ware.
12636
+ *
12637
+ * @typedef Pipeline
12638
+ * Pipeline.
12639
+ * @property {Run} run
12640
+ * Run the pipeline.
12641
+ * @property {Use} use
12642
+ * Add middleware.
12566
12643
  *
12567
12644
  * @typedef {(...input: Array<any>) => void} Run
12568
12645
  * Call all middleware.
12646
+ *
12647
+ * Calls `done` on completion with either an error or the output of the
12648
+ * last middleware.
12649
+ *
12650
+ * > 👉 **Note**: as the length of input defines whether async functions get a
12651
+ * > `next` function,
12652
+ * > it’s recommended to keep `input` at one value normally.
12653
+
12654
+ *
12569
12655
  * @typedef {(fn: Middleware) => Pipeline} Use
12570
- * Add `fn` (middleware) to the list.
12571
- * @typedef {{run: Run, use: Use}} Pipeline
12572
- * Middleware.
12656
+ * Add middleware.
12573
12657
  */
12574
12658
 
12575
12659
  /**
12576
12660
  * Create new middleware.
12577
12661
  *
12578
12662
  * @returns {Pipeline}
12663
+ * Pipeline.
12579
12664
  */
12580
12665
  function trough() {
12581
12666
  /** @type {Array<Middleware>} */
@@ -12600,7 +12685,7 @@ function trough() {
12600
12685
  /**
12601
12686
  * Run the next `fn`, or we’re done.
12602
12687
  *
12603
- * @param {Error|null|undefined} error
12688
+ * @param {Error | null | undefined} error
12604
12689
  * @param {Array<any>} output
12605
12690
  */
12606
12691
  function next(error, ...output) {
@@ -12645,12 +12730,36 @@ function trough() {
12645
12730
  }
12646
12731
 
12647
12732
  /**
12648
- * Wrap `middleware`.
12649
- * Can be sync or async; return a promise, receive a callback, or return new
12650
- * values and errors.
12733
+ * Wrap `middleware` into a uniform interface.
12734
+ *
12735
+ * You can pass all input to the resulting function.
12736
+ * `callback` is then called with the output of `middleware`.
12737
+ *
12738
+ * If `middleware` accepts more arguments than the later given in input,
12739
+ * an extra `done` function is passed to it after that input,
12740
+ * which must be called by `middleware`.
12741
+ *
12742
+ * The first value in `input` is the main input value.
12743
+ * All other input values are the rest input values.
12744
+ * The values given to `callback` are the input values,
12745
+ * merged with every non-nullish output value.
12746
+ *
12747
+ * * if `middleware` throws an error,
12748
+ * returns a promise that is rejected,
12749
+ * or calls the given `done` function with an error,
12750
+ * `callback` is called with that error
12751
+ * * if `middleware` returns a value or returns a promise that is resolved,
12752
+ * that value is the main output value
12753
+ * * if `middleware` calls `done`,
12754
+ * all non-nullish values except for the first one (the error) overwrite the
12755
+ * output values
12651
12756
  *
12652
12757
  * @param {Middleware} middleware
12758
+ * Function to wrap.
12653
12759
  * @param {Callback} callback
12760
+ * Callback called with the output of `middleware`.
12761
+ * @returns {Run}
12762
+ * Wrapped middleware.
12654
12763
  */
12655
12764
  function wrap(middleware, callback) {
12656
12765
  /** @type {boolean} */
@@ -12690,7 +12799,7 @@ function wrap(middleware, callback) {
12690
12799
  }
12691
12800
 
12692
12801
  if (!fnExpectsCallback) {
12693
- if (result instanceof Promise) {
12802
+ if (result && result.then && typeof result.then === 'function') {
12694
12803
  result.then(then, done);
12695
12804
  } else if (result instanceof Error) {
12696
12805
  done(result);
@@ -12702,6 +12811,7 @@ function wrap(middleware, callback) {
12702
12811
 
12703
12812
  /**
12704
12813
  * Call `callback`, only once.
12814
+ *
12705
12815
  * @type {Callback}
12706
12816
  */
12707
12817
  function done(error, ...output) {
@@ -12813,6 +12923,7 @@ function index(value) {
12813
12923
  * @typedef {object & {type: string, position?: Position | undefined}} NodeLike
12814
12924
  */
12815
12925
 
12926
+
12816
12927
  /**
12817
12928
  * Message.
12818
12929
  */
@@ -13077,6 +13188,7 @@ function isUrl(fileUrlOrPath) {
13077
13188
  * @typedef {import('../index.js').Value} Value
13078
13189
  */
13079
13190
 
13191
+
13080
13192
  /**
13081
13193
  * Order of setting (least specific to most), we need this because otherwise
13082
13194
  * `{stem: 'a', path: '~/b.js'}` would throw, as a path is needed before a
@@ -13504,7 +13616,7 @@ function assertPath(path, name) {
13504
13616
  * Whether `value` is a Node.js buffer.
13505
13617
  */
13506
13618
  function buffer(value) {
13507
- return isBuffer(value)
13619
+ return isBuffer$1(value)
13508
13620
  }
13509
13621
 
13510
13622
  /**
@@ -13527,6 +13639,7 @@ function buffer(value) {
13527
13639
  * @property {VFile} file
13528
13640
  */
13529
13641
 
13642
+
13530
13643
  // Expose a frozen processor.
13531
13644
  const unified = base().freeze();
13532
13645
 
@@ -13583,7 +13696,7 @@ function base() {
13583
13696
  destination.use(...attachers[index]);
13584
13697
  }
13585
13698
 
13586
- destination.data(extend(true, {}, namespace));
13699
+ destination.data(extend$1(true, {}, namespace));
13587
13700
 
13588
13701
  return destination
13589
13702
  }
@@ -13744,7 +13857,7 @@ function base() {
13744
13857
 
13745
13858
  if (entry) {
13746
13859
  if (isPlainObject(entry[1]) && isPlainObject(value)) {
13747
- value = extend(true, entry[1], value);
13860
+ value = extend$1(true, entry[1], value);
13748
13861
  }
13749
13862
 
13750
13863
  entry[1] = value;
@@ -14091,7 +14204,7 @@ function looksLikeAVFile(value) {
14091
14204
  * @returns {value is VFileValue}
14092
14205
  */
14093
14206
  function looksLikeAVFileValue(value) {
14094
- return typeof value === 'string' || isBuffer(value)
14207
+ return typeof value === 'string' || isBuffer$1(value)
14095
14208
  }
14096
14209
 
14097
14210
  /**
@@ -14204,36 +14317,11 @@ const isElement$1 =
14204
14317
  function (node, test, index, parent, context) {
14205
14318
  const check = convertElement(test);
14206
14319
 
14207
- if (
14208
- index !== undefined &&
14209
- index !== null &&
14210
- (typeof index !== 'number' ||
14211
- index < 0 ||
14212
- index === Number.POSITIVE_INFINITY)
14213
- ) {
14214
- throw new Error('Expected positive finite index for child node')
14215
- }
14216
-
14217
- if (
14218
- parent !== undefined &&
14219
- parent !== null &&
14220
- (!parent.type || !parent.children)
14221
- ) {
14222
- throw new Error('Expected parent node')
14223
- }
14224
-
14225
14320
  // @ts-expect-error Looks like a node.
14226
14321
  if (!node || !node.type || typeof node.type !== 'string') {
14227
14322
  return false
14228
14323
  }
14229
14324
 
14230
- if (
14231
- (parent === undefined || parent === null) !==
14232
- (index === undefined || index === null)
14233
- ) {
14234
- throw new Error('Expected both parent and index')
14235
- }
14236
-
14237
14325
  return check.call(context, node, index, parent)
14238
14326
  }
14239
14327
  );
@@ -14384,6 +14472,7 @@ function element(node) {
14384
14472
  * @typedef {import('unist').Parent} Parent
14385
14473
  */
14386
14474
 
14475
+
14387
14476
  /**
14388
14477
  * Generate an assertion from a test.
14389
14478
  *
@@ -14553,6 +14642,7 @@ function color(d) {
14553
14642
  * @typedef {import('unist-util-is').Test} Test
14554
14643
  */
14555
14644
 
14645
+
14556
14646
  /**
14557
14647
  * Continue traversing as normal.
14558
14648
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-doc/utils",
3
- "version": "17.6.8",
3
+ "version": "17.6.9",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "rehype": "12.0.1",