@readme/markdown 6.67.0 → 6.68.0-beta.2

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 (3) hide show
  1. package/dist/main.js +1891 -1708
  2. package/dist/main.node.js +985 -850
  3. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -8507,6 +8507,7 @@ var options = {
8507
8507
  },
8508
8508
  lazyImages: true,
8509
8509
  normalize: true,
8510
+ reusableContent: {},
8510
8511
  safeMode: false,
8511
8512
  settings: {
8512
8513
  position: false
@@ -8785,61 +8786,95 @@ module.exports = function ImageCompiler() {
8785
8786
 
8786
8787
  /***/ }),
8787
8788
 
8788
- /***/ 9647:
8789
+ /***/ 8457:
8789
8790
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8790
8791
 
8791
8792
  "use strict";
8793
+ // ESM COMPAT FLAG
8792
8794
  __webpack_require__.r(__webpack_exports__);
8793
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8794
- /* harmony export */ "breakCompiler": () => (/* reexport default from dynamic */ _break__WEBPACK_IMPORTED_MODULE_0___default.a),
8795
- /* harmony export */ "codeTabsCompiler": () => (/* reexport default from dynamic */ _code_tabs__WEBPACK_IMPORTED_MODULE_1___default.a),
8796
- /* harmony export */ "divCompiler": () => (/* reexport default from dynamic */ _div__WEBPACK_IMPORTED_MODULE_2___default.a),
8797
- /* harmony export */ "escapeCompiler": () => (/* reexport default from dynamic */ _escape__WEBPACK_IMPORTED_MODULE_3___default.a),
8798
- /* harmony export */ "figureCompiler": () => (/* reexport default from dynamic */ _figure__WEBPACK_IMPORTED_MODULE_4___default.a),
8799
- /* harmony export */ "htmlBlockCompiler": () => (/* reexport default from dynamic */ _html_block__WEBPACK_IMPORTED_MODULE_5___default.a),
8800
- /* harmony export */ "iconCompiler": () => (/* reexport default from dynamic */ _i__WEBPACK_IMPORTED_MODULE_6___default.a),
8801
- /* harmony export */ "imageCompiler": () => (/* reexport default from dynamic */ _image__WEBPACK_IMPORTED_MODULE_7___default.a),
8802
- /* harmony export */ "rdmeCalloutCompiler": () => (/* reexport default from dynamic */ _callout__WEBPACK_IMPORTED_MODULE_8___default.a),
8803
- /* harmony export */ "rdmeEmbedCompiler": () => (/* reexport default from dynamic */ _embed__WEBPACK_IMPORTED_MODULE_9___default.a),
8804
- /* harmony export */ "rdmeGlossaryCompiler": () => (/* reexport default from dynamic */ _glossary__WEBPACK_IMPORTED_MODULE_10___default.a),
8805
- /* harmony export */ "rdmePinCompiler": () => (/* reexport default from dynamic */ _pin__WEBPACK_IMPORTED_MODULE_11___default.a),
8806
- /* harmony export */ "rdmeVarCompiler": () => (/* reexport default from dynamic */ _var__WEBPACK_IMPORTED_MODULE_12___default.a),
8807
- /* harmony export */ "tableCompiler": () => (/* reexport default from dynamic */ _table__WEBPACK_IMPORTED_MODULE_13___default.a),
8808
- /* harmony export */ "tableHeadCompiler": () => (/* reexport default from dynamic */ _table_head__WEBPACK_IMPORTED_MODULE_14___default.a),
8809
- /* harmony export */ "yamlCompiler": () => (/* reexport default from dynamic */ _yaml__WEBPACK_IMPORTED_MODULE_15___default.a)
8810
- /* harmony export */ });
8811
- /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3688);
8812
- /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_break__WEBPACK_IMPORTED_MODULE_0__);
8813
- /* harmony import */ var _code_tabs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4079);
8814
- /* harmony import */ var _code_tabs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_code_tabs__WEBPACK_IMPORTED_MODULE_1__);
8815
- /* harmony import */ var _div__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58);
8816
- /* harmony import */ var _div__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_div__WEBPACK_IMPORTED_MODULE_2__);
8817
- /* harmony import */ var _escape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8418);
8818
- /* harmony import */ var _escape__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_escape__WEBPACK_IMPORTED_MODULE_3__);
8819
- /* harmony import */ var _figure__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8705);
8820
- /* harmony import */ var _figure__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_figure__WEBPACK_IMPORTED_MODULE_4__);
8821
- /* harmony import */ var _html_block__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3551);
8822
- /* harmony import */ var _html_block__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_html_block__WEBPACK_IMPORTED_MODULE_5__);
8823
- /* harmony import */ var _i__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4258);
8824
- /* harmony import */ var _i__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_i__WEBPACK_IMPORTED_MODULE_6__);
8825
- /* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3356);
8826
- /* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_image__WEBPACK_IMPORTED_MODULE_7__);
8827
- /* harmony import */ var _callout__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5733);
8828
- /* harmony import */ var _callout__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_callout__WEBPACK_IMPORTED_MODULE_8__);
8829
- /* harmony import */ var _embed__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4338);
8830
- /* harmony import */ var _embed__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_embed__WEBPACK_IMPORTED_MODULE_9__);
8831
- /* harmony import */ var _glossary__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2459);
8832
- /* harmony import */ var _glossary__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_glossary__WEBPACK_IMPORTED_MODULE_10__);
8833
- /* harmony import */ var _pin__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(2151);
8834
- /* harmony import */ var _pin__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_pin__WEBPACK_IMPORTED_MODULE_11__);
8835
- /* harmony import */ var _var__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(1067);
8836
- /* harmony import */ var _var__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_var__WEBPACK_IMPORTED_MODULE_12__);
8837
- /* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4669);
8838
- /* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_table__WEBPACK_IMPORTED_MODULE_13__);
8839
- /* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(186);
8840
- /* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_table_head__WEBPACK_IMPORTED_MODULE_14__);
8841
- /* harmony import */ var _yaml__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(1773);
8842
- /* harmony import */ var _yaml__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_yaml__WEBPACK_IMPORTED_MODULE_15__);
8795
+
8796
+ // EXPORTS
8797
+ __webpack_require__.d(__webpack_exports__, {
8798
+ "breakCompiler": () => (/* reexport */ (break_default())),
8799
+ "codeTabsCompiler": () => (/* reexport */ (code_tabs_default())),
8800
+ "divCompiler": () => (/* reexport */ (div_default())),
8801
+ "escapeCompiler": () => (/* reexport */ (escape_default())),
8802
+ "figureCompiler": () => (/* reexport */ (figure_default())),
8803
+ "htmlBlockCompiler": () => (/* reexport */ (html_block_default())),
8804
+ "iconCompiler": () => (/* reexport */ (i_default())),
8805
+ "imageCompiler": () => (/* reexport */ (image_default())),
8806
+ "rdmeCalloutCompiler": () => (/* reexport */ (callout_default())),
8807
+ "rdmeEmbedCompiler": () => (/* reexport */ (embed_default())),
8808
+ "rdmeGlossaryCompiler": () => (/* reexport */ (glossary_default())),
8809
+ "rdmePinCompiler": () => (/* reexport */ (pin_default())),
8810
+ "rdmeVarCompiler": () => (/* reexport */ (var_default())),
8811
+ "reusableContentCompiler": () => (/* reexport */ ReusableContentCompiler),
8812
+ "tableCompiler": () => (/* reexport */ (table_default())),
8813
+ "tableHeadCompiler": () => (/* reexport */ (table_head_default())),
8814
+ "yamlCompiler": () => (/* reexport */ (yaml_default()))
8815
+ });
8816
+
8817
+ // EXTERNAL MODULE: ./processor/compile/break.js
8818
+ var compile_break = __webpack_require__(3688);
8819
+ var break_default = /*#__PURE__*/__webpack_require__.n(compile_break);
8820
+ // EXTERNAL MODULE: ./processor/compile/code-tabs.js
8821
+ var code_tabs = __webpack_require__(4079);
8822
+ var code_tabs_default = /*#__PURE__*/__webpack_require__.n(code_tabs);
8823
+ // EXTERNAL MODULE: ./processor/compile/div.js
8824
+ var div = __webpack_require__(58);
8825
+ var div_default = /*#__PURE__*/__webpack_require__.n(div);
8826
+ // EXTERNAL MODULE: ./processor/compile/escape.js
8827
+ var compile_escape = __webpack_require__(8418);
8828
+ var escape_default = /*#__PURE__*/__webpack_require__.n(compile_escape);
8829
+ // EXTERNAL MODULE: ./processor/compile/figure.js
8830
+ var figure = __webpack_require__(8705);
8831
+ var figure_default = /*#__PURE__*/__webpack_require__.n(figure);
8832
+ // EXTERNAL MODULE: ./processor/compile/html-block.js
8833
+ var html_block = __webpack_require__(3551);
8834
+ var html_block_default = /*#__PURE__*/__webpack_require__.n(html_block);
8835
+ // EXTERNAL MODULE: ./processor/compile/i.js
8836
+ var i = __webpack_require__(4258);
8837
+ var i_default = /*#__PURE__*/__webpack_require__.n(i);
8838
+ // EXTERNAL MODULE: ./processor/compile/image.js
8839
+ var compile_image = __webpack_require__(3356);
8840
+ var image_default = /*#__PURE__*/__webpack_require__.n(compile_image);
8841
+ // EXTERNAL MODULE: ./processor/compile/callout.js
8842
+ var callout = __webpack_require__(5733);
8843
+ var callout_default = /*#__PURE__*/__webpack_require__.n(callout);
8844
+ // EXTERNAL MODULE: ./processor/compile/embed.js
8845
+ var compile_embed = __webpack_require__(4338);
8846
+ var embed_default = /*#__PURE__*/__webpack_require__.n(compile_embed);
8847
+ // EXTERNAL MODULE: ./processor/compile/glossary.js
8848
+ var glossary = __webpack_require__(2459);
8849
+ var glossary_default = /*#__PURE__*/__webpack_require__.n(glossary);
8850
+ // EXTERNAL MODULE: ./processor/compile/pin.js
8851
+ var pin = __webpack_require__(2151);
8852
+ var pin_default = /*#__PURE__*/__webpack_require__.n(pin);
8853
+ // EXTERNAL MODULE: ./processor/compile/var.js
8854
+ var compile_var = __webpack_require__(1067);
8855
+ var var_default = /*#__PURE__*/__webpack_require__.n(compile_var);
8856
+ // EXTERNAL MODULE: ./processor/transform/reusable-content.js + 2 modules
8857
+ var reusable_content = __webpack_require__(6462);
8858
+ ;// CONCATENATED MODULE: ./processor/compile/reusable-content.js
8859
+
8860
+ function ReusableContentCompiler() {
8861
+ var Compiler = this.Compiler;
8862
+ var visitors = Compiler.prototype.visitors;
8863
+ visitors[reusable_content/* type */.dt] = function (node) {
8864
+ return "<".concat(reusable_content/* tag */._q, " name=\"").concat(node.name, "\" />");
8865
+ };
8866
+ }
8867
+ // EXTERNAL MODULE: ./processor/compile/table.js
8868
+ var table = __webpack_require__(4669);
8869
+ var table_default = /*#__PURE__*/__webpack_require__.n(table);
8870
+ // EXTERNAL MODULE: ./processor/compile/table-head.js
8871
+ var table_head = __webpack_require__(186);
8872
+ var table_head_default = /*#__PURE__*/__webpack_require__.n(table_head);
8873
+ // EXTERNAL MODULE: ./processor/compile/yaml.js
8874
+ var yaml = __webpack_require__(1773);
8875
+ var yaml_default = /*#__PURE__*/__webpack_require__.n(yaml);
8876
+ ;// CONCATENATED MODULE: ./processor/compile/index.js
8877
+
8843
8878
 
8844
8879
 
8845
8880
 
@@ -8992,7 +9027,7 @@ module.exports.sanitize = function (sanitizeSchema) {
8992
9027
 
8993
9028
  /***/ }),
8994
9029
 
8995
- /***/ 8160:
9030
+ /***/ 6284:
8996
9031
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8997
9032
 
8998
9033
  "use strict";
@@ -9006,8 +9041,31 @@ __webpack_require__.d(__webpack_exports__, {
9006
9041
  "sanitize": () => (/* binding */ sanitize)
9007
9042
  });
9008
9043
 
9009
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules
9010
- var toConsumableArray = __webpack_require__(2982);
9044
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
9045
+ var arrayLikeToArray = __webpack_require__(907);
9046
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
9047
+
9048
+ function _arrayWithoutHoles(arr) {
9049
+ if (Array.isArray(arr)) return (0,arrayLikeToArray/* default */.Z)(arr);
9050
+ }
9051
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
9052
+ function _iterableToArray(iter) {
9053
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9054
+ }
9055
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
9056
+ var unsupportedIterableToArray = __webpack_require__(181);
9057
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
9058
+ function _nonIterableSpread() {
9059
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9060
+ }
9061
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
9062
+
9063
+
9064
+
9065
+
9066
+ function _toConsumableArray(arr) {
9067
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || (0,unsupportedIterableToArray/* default */.Z)(arr) || _nonIterableSpread();
9068
+ }
9011
9069
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
9012
9070
  var slicedToArray = __webpack_require__(1037);
9013
9071
  ;// CONCATENATED MODULE: ./node_modules/emoji-regex/index.mjs
@@ -9159,7 +9217,7 @@ function blockquoteReadme(eat, value, silent) {
9159
9217
  }
9160
9218
  };
9161
9219
  var _exit = self.enterBlock();
9162
- var _children = [].concat((0,toConsumableArray/* default */.Z)(self.tokenizeBlock(title, now)), (0,toConsumableArray/* default */.Z)(self.tokenizeBlock(body, now)));
9220
+ var _children = [].concat(_toConsumableArray(self.tokenizeBlock(title, now)), _toConsumableArray(self.tokenizeBlock(body, now)));
9163
9221
  _exit();
9164
9222
  return add({
9165
9223
  type: 'rdme-callout',
@@ -9433,8 +9491,8 @@ var magic_block_parser_default = /*#__PURE__*/__webpack_require__.n(magic_block_
9433
9491
  // EXTERNAL MODULE: ./processor/parse/flavored/code-tabs.js
9434
9492
  var code_tabs = __webpack_require__(5289);
9435
9493
  var code_tabs_default = /*#__PURE__*/__webpack_require__.n(code_tabs);
9436
- // EXTERNAL MODULE: ./processor/parse/flavored/callout.js + 1 modules
9437
- var callout = __webpack_require__(8160);
9494
+ // EXTERNAL MODULE: ./processor/parse/flavored/callout.js + 5 modules
9495
+ var callout = __webpack_require__(6284);
9438
9496
  // EXTERNAL MODULE: ./processor/parse/flavored/embed.js
9439
9497
  var flavored_embed = __webpack_require__(1559);
9440
9498
  var embed_default = /*#__PURE__*/__webpack_require__.n(flavored_embed);
@@ -10107,7 +10165,7 @@ module.exports.tableFlattening = transformer;
10107
10165
 
10108
10166
  /***/ }),
10109
10167
 
10110
- /***/ 3628:
10168
+ /***/ 2692:
10111
10169
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10112
10170
 
10113
10171
  "use strict";
@@ -10120,728 +10178,326 @@ __webpack_require__.d(__webpack_exports__, {
10120
10178
  "remarkTransformers": () => (/* binding */ remarkTransformers)
10121
10179
  });
10122
10180
 
10123
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
10124
- /**
10125
- * @typedef {import('unist').Node} Node
10126
- * @typedef {import('unist').Parent} Parent
10127
- *
10128
- * @typedef {string} Type
10129
- * @typedef {Object<string, unknown>} Props
10130
- *
10131
- * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
10132
- */
10181
+ // EXTERNAL MODULE: ./processor/transform/reusable-content.js + 2 modules
10182
+ var reusable_content = __webpack_require__(6462);
10183
+ // EXTERNAL MODULE: ./node_modules/unist-util-visit/index.js
10184
+ var unist_util_visit = __webpack_require__(6393);
10185
+ ;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
10133
10186
 
10134
- /**
10135
- * Check if a node passes a test
10136
- *
10137
- * @callback TestFunctionAnything
10138
- * @param {Node} node
10139
- * @param {number|null|undefined} [index]
10140
- * @param {Parent|null|undefined} [parent]
10141
- * @returns {boolean|void}
10142
- */
10187
+ var singleCodeTabs = function singleCodeTabs() {
10188
+ return function (tree) {
10189
+ (0,unist_util_visit/* visit */.Vn)(tree, function (node, index, parent) {
10190
+ if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
10191
+ Object.assign(node, {
10192
+ className: 'tab-panel',
10193
+ data: {
10194
+ hName: 'code',
10195
+ hProperties: {
10196
+ meta: node.meta,
10197
+ lang: node.lang
10198
+ }
10199
+ }
10200
+ });
10201
+ parent.children[index] = {
10202
+ type: 'code-tabs',
10203
+ className: 'tabs',
10204
+ data: {
10205
+ hName: 'div',
10206
+ hProperties: {
10207
+ className: ['code-tabs']
10208
+ }
10209
+ },
10210
+ children: [node]
10211
+ };
10212
+ }
10213
+ });
10214
+ return tree;
10215
+ };
10216
+ };
10217
+ /* harmony default export */ const single_code_tabs = (singleCodeTabs);
10218
+ // EXTERNAL MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js + 2 modules
10219
+ var unist_util_visit_parents = __webpack_require__(5605);
10220
+ ;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
10221
+
10222
+ var rxEscapedPipe = /\\\|/g;
10143
10223
 
10144
10224
  /**
10145
- * Check if a node passes a certain node test
10225
+ * HAST Transformer that finds all inline code nodes within table cells and
10226
+ * unescapes any escaped pipe chars so that the editor outputs them without
10227
+ * escape chars.
10146
10228
  *
10147
- * @template {Node} X
10148
- * @callback TestFunctionPredicate
10149
- * @param {Node} node
10150
- * @param {number|null|undefined} [index]
10151
- * @param {Parent|null|undefined} [parent]
10152
- * @returns {node is X}
10229
+ * This appears to be a bug with remark-parse < ~8
10153
10230
  */
10231
+ var tableCellInlineCode = function tableCellInlineCode() {
10232
+ return function (tree) {
10233
+ (0,unist_util_visit/* visit */.Vn)(tree, [{
10234
+ tagName: 'th'
10235
+ }, {
10236
+ tagName: 'td'
10237
+ }], function (tableCellNode) {
10238
+ (0,unist_util_visit/* visit */.Vn)(tableCellNode, {
10239
+ tagName: 'code'
10240
+ }, function (inlineCodeNode) {
10241
+ var textNode = inlineCodeNode.children[0];
10242
+ if (textNode && rxEscapedPipe.test(textNode.value)) {
10243
+ textNode.value = textNode.value.replace(rxEscapedPipe, '|');
10244
+ }
10245
+ });
10246
+ return unist_util_visit_parents/* SKIP */.AM;
10247
+ });
10248
+ };
10249
+ };
10250
+ /* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
10251
+ ;// CONCATENATED MODULE: ./processor/transform/index.js
10154
10252
 
10155
- /**
10156
- * @callback AssertAnything
10157
- * @param {unknown} [node]
10158
- * @param {number|null|undefined} [index]
10159
- * @param {Parent|null|undefined} [parent]
10160
- * @returns {boolean}
10161
- */
10162
10253
 
10163
- /**
10164
- * Check if a node passes a certain node test
10165
- *
10166
- * @template {Node} Y
10167
- * @callback AssertPredicate
10168
- * @param {unknown} [node]
10169
- * @param {number|null|undefined} [index]
10170
- * @param {Parent|null|undefined} [parent]
10171
- * @returns {node is Y}
10172
- */
10173
10254
 
10174
- const is =
10175
- /**
10176
- * Check if a node passes a test.
10177
- * When a `parent` node is known the `index` of node should also be given.
10178
- *
10179
- * @type {(
10180
- * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => node is T) &
10181
- * ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
10182
- * )}
10183
- */
10184
- (
10185
- /**
10186
- * Check if a node passes a test.
10187
- * When a `parent` node is known the `index` of node should also be given.
10188
- *
10189
- * @param {unknown} [node] Node to check
10190
- * @param {Test} [test]
10191
- * When nullish, checks if `node` is a `Node`.
10192
- * When `string`, works like passing `function (node) {return node.type === test}`.
10193
- * When `function` checks if function passed the node is true.
10194
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
10195
- * When `array`, checks any one of the subtests pass.
10196
- * @param {number|null|undefined} [index] Position of `node` in `parent`
10197
- * @param {Parent|null|undefined} [parent] Parent of `node`
10198
- * @param {unknown} [context] Context object to invoke `test` with
10199
- * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
10200
- */
10201
- // eslint-disable-next-line max-params
10202
- function is(node, test, index, parent, context) {
10203
- const check = convert(test)
10255
+ var remarkTransformers = [single_code_tabs, reusable_content/* default */.ZP];
10256
+ var rehypeTransformers = [table_cell_inline_code];
10204
10257
 
10205
- if (
10206
- index !== undefined &&
10207
- index !== null &&
10208
- (typeof index !== 'number' ||
10209
- index < 0 ||
10210
- index === Number.POSITIVE_INFINITY)
10211
- ) {
10212
- throw new Error('Expected positive finite index')
10213
- }
10258
+ /***/ }),
10214
10259
 
10215
- if (
10216
- parent !== undefined &&
10217
- parent !== null &&
10218
- (!is(parent) || !parent.children)
10219
- ) {
10220
- throw new Error('Expected parent node')
10221
- }
10260
+ /***/ 6462:
10261
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10222
10262
 
10223
- if (
10224
- (parent === undefined || parent === null) !==
10225
- (index === undefined || index === null)
10226
- ) {
10227
- throw new Error('Expected both parent and index')
10228
- }
10263
+ "use strict";
10229
10264
 
10230
- // @ts-expect-error Looks like a node.
10231
- return node && node.type && typeof node.type === 'string'
10232
- ? Boolean(check.call(context, node, index, parent))
10233
- : false
10265
+ // EXPORTS
10266
+ __webpack_require__.d(__webpack_exports__, {
10267
+ "ZP": () => (/* binding */ reusable_content),
10268
+ "_q": () => (/* binding */ tag),
10269
+ "dt": () => (/* binding */ type)
10270
+ });
10271
+
10272
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
10273
+ var esm_typeof = __webpack_require__(1002);
10274
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
10275
+ function _setPrototypeOf(o, p) {
10276
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
10277
+ o.__proto__ = p;
10278
+ return o;
10279
+ };
10280
+ return _setPrototypeOf(o, p);
10281
+ }
10282
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
10283
+
10284
+ function _inherits(subClass, superClass) {
10285
+ if (typeof superClass !== "function" && superClass !== null) {
10286
+ throw new TypeError("Super expression must either be null or a function");
10287
+ }
10288
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
10289
+ constructor: {
10290
+ value: subClass,
10291
+ writable: true,
10292
+ configurable: true
10234
10293
  }
10235
- )
10294
+ });
10295
+ Object.defineProperty(subClass, "prototype", {
10296
+ writable: false
10297
+ });
10298
+ if (superClass) _setPrototypeOf(subClass, superClass);
10299
+ }
10300
+ // EXTERNAL MODULE: ./node_modules/unist-util-visit/index.js
10301
+ var unist_util_visit = __webpack_require__(6393);
10302
+ ;// CONCATENATED MODULE: ./processor/transform/reusable-content.js
10236
10303
 
10237
- const convert =
10238
- /**
10239
- * @type {(
10240
- * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
10241
- * ((test?: Test) => AssertAnything)
10242
- * )}
10243
- */
10244
- (
10245
- /**
10246
- * Generate an assertion from a check.
10247
- * @param {Test} [test]
10248
- * When nullish, checks if `node` is a `Node`.
10249
- * When `string`, works like passing `function (node) {return node.type === test}`.
10250
- * When `function` checks if function passed the node is true.
10251
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
10252
- * When `array`, checks any one of the subtests pass.
10253
- * @returns {AssertAnything}
10254
- */
10255
- function (test) {
10256
- if (test === undefined || test === null) {
10257
- return ok
10258
- }
10259
10304
 
10260
- if (typeof test === 'string') {
10261
- return typeFactory(test)
10262
- }
10263
10305
 
10264
- if (typeof test === 'object') {
10265
- return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
10266
- }
10306
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { var i = g[name]; if ("number" == typeof i) groups[name] = result[i];else { for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) { k++; } groups[name] = result[i[k]]; } return groups; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != (0,esm_typeof/* default */.Z)(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
10267
10307
 
10268
- if (typeof test === 'function') {
10269
- return castFactory(test)
10270
- }
10308
+ var type = 'reusable-content';
10309
+ var tag = 'RMReusableContent';
10310
+ var regexp = /*#__PURE__*/_wrapRegExp(/^\s*<RMReusableContent name="(.*)" \/>\s*$/, {
10311
+ name: 1
10312
+ });
10313
+ var reusableContentTransformer = function reusableContentTransformer() {
10314
+ var reusableContent = this.data('reusableContent');
10315
+ return function (tree) {
10316
+ (0,unist_util_visit/* visit */.Vn)(tree, 'html', function (node, index, parent) {
10317
+ var result = regexp.exec(node.value);
10318
+ if (!result || !result.groups.name) return;
10319
+ var name = result.groups.name;
10320
+ var block = {
10321
+ type: type,
10322
+ name: name,
10323
+ children: name in reusableContent ? reusableContent[name] : []
10324
+ };
10325
+ parent.children[index] = block;
10326
+ });
10327
+ return tree;
10328
+ };
10329
+ };
10330
+ /* harmony default export */ const reusable_content = (reusableContentTransformer);
10271
10331
 
10272
- throw new Error('Expected function, string, or object as test')
10273
- }
10274
- )
10275
- /**
10276
- * @param {Array.<Type|Props|TestFunctionAnything>} tests
10277
- * @returns {AssertAnything}
10278
- */
10279
- function anyFactory(tests) {
10280
- /** @type {Array.<AssertAnything>} */
10281
- const checks = []
10282
- let index = -1
10332
+ /***/ }),
10283
10333
 
10284
- while (++index < tests.length) {
10285
- checks[index] = convert(tests[index])
10334
+ /***/ 8229:
10335
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10336
+
10337
+ var _require = __webpack_require__(2781),
10338
+ defaultSchema = _require.defaultSchema;
10339
+ var createSchema = function createSchema() {
10340
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
10341
+ safeMode = _ref.safeMode;
10342
+ var schema = JSON.parse(JSON.stringify(defaultSchema));
10343
+
10344
+ // Sanitization Schema Defaults
10345
+ schema.clobberPrefix = '';
10346
+ schema.tagNames.push('span');
10347
+ schema.attributes['*'].push('class', 'className', 'align');
10348
+ if (!safeMode) {
10349
+ schema.attributes['*'].push('style');
10286
10350
  }
10351
+ schema.tagNames.push('rdme-pin');
10352
+ schema.tagNames.push('rdme-embed');
10353
+ schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
10354
+ schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
10355
+ schema.tagNames.push('figure');
10356
+ schema.tagNames.push('figcaption');
10357
+ schema.tagNames.push('input'); // allow GitHub-style todo lists
10358
+ schema.ancestors.input = ['li'];
10359
+ schema.tagNames.push('colgroup'); // wat
10360
+ schema.tagNames.push('col');
10361
+ return schema;
10362
+ };
10363
+ module.exports = createSchema;
10287
10364
 
10288
- return castFactory(any)
10365
+ /***/ }),
10289
10366
 
10290
- /**
10291
- * @this {unknown}
10292
- * @param {unknown[]} parameters
10293
- * @returns {boolean}
10294
- */
10295
- function any(...parameters) {
10296
- let index = -1
10367
+ /***/ 8841:
10368
+ /***/ ((module) => {
10297
10369
 
10298
- while (++index < checks.length) {
10299
- if (checks[index].call(this, ...parameters)) return true
10300
- }
10370
+ "use strict";
10301
10371
 
10302
- return false
10372
+
10373
+ module.exports = bail
10374
+
10375
+ function bail(err) {
10376
+ if (err) {
10377
+ throw err
10303
10378
  }
10304
10379
  }
10305
10380
 
10306
- /**
10307
- * Utility to assert each property in `test` is represented in `node`, and each
10308
- * values are strictly equal.
10309
- *
10310
- * @param {Props} check
10311
- * @returns {AssertAnything}
10312
- */
10313
- function propsFactory(check) {
10314
- return castFactory(all)
10315
10381
 
10316
- /**
10317
- * @param {Node} node
10318
- * @returns {boolean}
10319
- */
10320
- function all(node) {
10321
- /** @type {string} */
10322
- let key
10382
+ /***/ }),
10323
10383
 
10324
- for (key in check) {
10325
- // @ts-expect-error: hush, it sure works as an index.
10326
- if (node[key] !== check[key]) return false
10327
- }
10384
+ /***/ 1073:
10385
+ /***/ ((module) => {
10328
10386
 
10329
- return true
10387
+ module.exports = {
10388
+ trueFunc: function trueFunc(){
10389
+ return true;
10390
+ },
10391
+ falseFunc: function falseFunc(){
10392
+ return false;
10393
+ }
10394
+ };
10395
+
10396
+ /***/ }),
10397
+
10398
+ /***/ 932:
10399
+ /***/ ((module) => {
10400
+
10401
+ "use strict";
10402
+
10403
+
10404
+ module.exports = ccount
10405
+
10406
+ function ccount(value, character) {
10407
+ var val = String(value)
10408
+ var count = 0
10409
+ var index
10410
+
10411
+ if (typeof character !== 'string' || character.length !== 1) {
10412
+ throw new Error('Expected character')
10330
10413
  }
10331
- }
10332
10414
 
10333
- /**
10334
- * Utility to convert a string into a function which checks a given node’s type
10335
- * for said string.
10336
- *
10337
- * @param {Type} check
10338
- * @returns {AssertAnything}
10339
- */
10340
- function typeFactory(check) {
10341
- return castFactory(type)
10415
+ index = val.indexOf(character)
10342
10416
 
10343
- /**
10344
- * @param {Node} node
10345
- */
10346
- function type(node) {
10347
- return node && node.type === check
10417
+ while (index !== -1) {
10418
+ count++
10419
+ index = val.indexOf(character, index + 1)
10348
10420
  }
10421
+
10422
+ return count
10349
10423
  }
10350
10424
 
10351
- /**
10352
- * Utility to convert a string into a function which checks a given node’s type
10353
- * for said string.
10354
- * @param {TestFunctionAnything} check
10355
- * @returns {AssertAnything}
10356
- */
10357
- function castFactory(check) {
10358
- return assertion
10359
10425
 
10360
- /**
10361
- * @this {unknown}
10362
- * @param {Array.<unknown>} parameters
10363
- * @returns {boolean}
10364
- */
10365
- function assertion(...parameters) {
10366
- // @ts-expect-error: spreading is fine.
10367
- return Boolean(check.call(this, ...parameters))
10368
- }
10426
+ /***/ }),
10427
+
10428
+ /***/ 6313:
10429
+ /***/ ((module) => {
10430
+
10431
+ var clone = (function() {
10432
+ 'use strict';
10433
+
10434
+ function _instanceof(obj, type) {
10435
+ return type != null && obj instanceof type;
10369
10436
  }
10370
10437
 
10371
- // Utility to return true.
10372
- function ok() {
10373
- return true
10438
+ var nativeMap;
10439
+ try {
10440
+ nativeMap = Map;
10441
+ } catch(_) {
10442
+ // maybe a reference error because no `Map`. Give it a dummy value that no
10443
+ // value will ever be an instanceof.
10444
+ nativeMap = function() {};
10374
10445
  }
10375
10446
 
10376
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.browser.js
10377
- /**
10378
- * @param {string} d
10379
- * @returns {string}
10380
- */
10381
- function color(d) {
10382
- return d
10447
+ var nativeSet;
10448
+ try {
10449
+ nativeSet = Set;
10450
+ } catch(_) {
10451
+ nativeSet = function() {};
10452
+ }
10453
+
10454
+ var nativePromise;
10455
+ try {
10456
+ nativePromise = Promise;
10457
+ } catch(_) {
10458
+ nativePromise = function() {};
10383
10459
  }
10384
10460
 
10385
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
10386
10461
  /**
10387
- * @typedef {import('unist').Node} Node
10388
- * @typedef {import('unist').Parent} Parent
10389
- * @typedef {import('unist-util-is').Test} Test
10390
- * @typedef {import('./complex-types.js').Action} Action
10391
- * @typedef {import('./complex-types.js').Index} Index
10392
- * @typedef {import('./complex-types.js').ActionTuple} ActionTuple
10393
- * @typedef {import('./complex-types.js').VisitorResult} VisitorResult
10394
- * @typedef {import('./complex-types.js').Visitor} Visitor
10395
- */
10462
+ * Clones (copies) an Object using deep copying.
10463
+ *
10464
+ * This function supports circular references by default, but if you are certain
10465
+ * there are no circular references in your object, you can save some CPU time
10466
+ * by calling clone(obj, false).
10467
+ *
10468
+ * Caution: if `circular` is false and `parent` contains circular references,
10469
+ * your program may enter an infinite loop and crash.
10470
+ *
10471
+ * @param `parent` - the object to be cloned
10472
+ * @param `circular` - set to true if the object to be cloned may contain
10473
+ * circular references. (optional - true by default)
10474
+ * @param `depth` - set to a number if the object is only to be cloned to
10475
+ * a particular depth. (optional - defaults to Infinity)
10476
+ * @param `prototype` - sets the prototype to be used when cloning an object.
10477
+ * (optional - defaults to parent prototype).
10478
+ * @param `includeNonEnumerable` - set to true if the non-enumerable properties
10479
+ * should be cloned as well. Non-enumerable properties on the prototype
10480
+ * chain will be ignored. (optional - false by default)
10481
+ */
10482
+ function clone(parent, circular, depth, prototype, includeNonEnumerable) {
10483
+ if (typeof circular === 'object') {
10484
+ depth = circular.depth;
10485
+ prototype = circular.prototype;
10486
+ includeNonEnumerable = circular.includeNonEnumerable;
10487
+ circular = circular.circular;
10488
+ }
10489
+ // maintain two arrays for circular references, where corresponding parents
10490
+ // and children have the same index
10491
+ var allParents = [];
10492
+ var allChildren = [];
10396
10493
 
10494
+ var useBuffer = typeof Buffer != 'undefined';
10397
10495
 
10496
+ if (typeof circular == 'undefined')
10497
+ circular = true;
10398
10498
 
10399
-
10400
- /**
10401
- * Continue traversing as normal
10402
- */
10403
- const CONTINUE = true
10404
- /**
10405
- * Do not traverse this node’s children
10406
- */
10407
- const SKIP = 'skip'
10408
- /**
10409
- * Stop traversing immediately
10410
- */
10411
- const EXIT = false
10412
-
10413
- /**
10414
- * Visit children of tree which pass test.
10415
- *
10416
- * @param tree
10417
- * Tree to walk
10418
- * @param [test]
10419
- * `unist-util-is`-compatible test
10420
- * @param visitor
10421
- * Function called for nodes that pass `test`.
10422
- * @param [reverse=false]
10423
- * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
10424
- */
10425
- const visitParents =
10426
- /**
10427
- * @type {(
10428
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
10429
- * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
10430
- * )}
10431
- */
10432
- (
10433
- /**
10434
- * @param {Node} tree
10435
- * @param {Test} test
10436
- * @param {import('./complex-types.js').Visitor<Node>} visitor
10437
- * @param {boolean} [reverse=false]
10438
- */
10439
- function (tree, test, visitor, reverse) {
10440
- if (typeof test === 'function' && typeof visitor !== 'function') {
10441
- reverse = visitor
10442
- // @ts-expect-error no visitor given, so `visitor` is test.
10443
- visitor = test
10444
- test = null
10445
- }
10446
-
10447
- const is = convert(test)
10448
- const step = reverse ? -1 : 1
10449
-
10450
- factory(tree, null, [])()
10451
-
10452
- /**
10453
- * @param {Node} node
10454
- * @param {number?} index
10455
- * @param {Array<Parent>} parents
10456
- */
10457
- function factory(node, index, parents) {
10458
- /** @type {Record<string, unknown>} */
10459
- // @ts-expect-error: hush
10460
- const value = typeof node === 'object' && node !== null ? node : {}
10461
- /** @type {string|undefined} */
10462
- let name
10463
-
10464
- if (typeof value.type === 'string') {
10465
- name =
10466
- typeof value.tagName === 'string'
10467
- ? value.tagName
10468
- : typeof value.name === 'string'
10469
- ? value.name
10470
- : undefined
10471
-
10472
- Object.defineProperty(visit, 'name', {
10473
- value:
10474
- 'node (' +
10475
- color(value.type + (name ? '<' + name + '>' : '')) +
10476
- ')'
10477
- })
10478
- }
10479
-
10480
- return visit
10481
-
10482
- function visit() {
10483
- /** @type {ActionTuple} */
10484
- let result = []
10485
- /** @type {ActionTuple} */
10486
- let subresult
10487
- /** @type {number} */
10488
- let offset
10489
- /** @type {Array<Parent>} */
10490
- let grandparents
10491
-
10492
- if (!test || is(node, index, parents[parents.length - 1] || null)) {
10493
- result = toResult(visitor(node, parents))
10494
-
10495
- if (result[0] === EXIT) {
10496
- return result
10497
- }
10498
- }
10499
-
10500
- // @ts-expect-error looks like a parent.
10501
- if (node.children && result[0] !== SKIP) {
10502
- // @ts-expect-error looks like a parent.
10503
- offset = (reverse ? node.children.length : -1) + step
10504
- // @ts-expect-error looks like a parent.
10505
- grandparents = parents.concat(node)
10506
-
10507
- // @ts-expect-error looks like a parent.
10508
- while (offset > -1 && offset < node.children.length) {
10509
- // @ts-expect-error looks like a parent.
10510
- subresult = factory(node.children[offset], offset, grandparents)()
10511
-
10512
- if (subresult[0] === EXIT) {
10513
- return subresult
10514
- }
10515
-
10516
- offset =
10517
- typeof subresult[1] === 'number' ? subresult[1] : offset + step
10518
- }
10519
- }
10520
-
10521
- return result
10522
- }
10523
- }
10524
- }
10525
- )
10526
-
10527
- /**
10528
- * @param {VisitorResult} value
10529
- * @returns {ActionTuple}
10530
- */
10531
- function toResult(value) {
10532
- if (Array.isArray(value)) {
10533
- return value
10534
- }
10535
-
10536
- if (typeof value === 'number') {
10537
- return [CONTINUE, value]
10538
- }
10539
-
10540
- return [value]
10541
- }
10542
-
10543
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/index.js
10544
- /**
10545
- * @typedef {import('unist').Node} Node
10546
- * @typedef {import('unist').Parent} Parent
10547
- * @typedef {import('unist-util-is').Test} Test
10548
- * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
10549
- * @typedef {import('./complex-types.js').Visitor} Visitor
10550
- */
10551
-
10552
-
10553
-
10554
- /**
10555
- * Visit children of tree which pass test.
10556
- *
10557
- * @param tree
10558
- * Tree to walk
10559
- * @param [test]
10560
- * `unist-util-is`-compatible test
10561
- * @param visitor
10562
- * Function called for nodes that pass `test`.
10563
- * @param reverse
10564
- * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
10565
- */
10566
- const visit =
10567
- /**
10568
- * @type {(
10569
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
10570
- * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
10571
- * )}
10572
- */
10573
- (
10574
- /**
10575
- * @param {Node} tree
10576
- * @param {Test} test
10577
- * @param {import('./complex-types.js').Visitor} visitor
10578
- * @param {boolean} [reverse]
10579
- */
10580
- function (tree, test, visitor, reverse) {
10581
- if (typeof test === 'function' && typeof visitor !== 'function') {
10582
- reverse = visitor
10583
- visitor = test
10584
- test = null
10585
- }
10586
-
10587
- visitParents(tree, test, overload, reverse)
10588
-
10589
- /**
10590
- * @param {Node} node
10591
- * @param {Array<Parent>} parents
10592
- */
10593
- function overload(node, parents) {
10594
- const parent = parents[parents.length - 1]
10595
- return visitor(
10596
- node,
10597
- parent ? parent.children.indexOf(node) : null,
10598
- parent
10599
- )
10600
- }
10601
- }
10602
- )
10603
-
10604
-
10605
-
10606
- ;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
10607
-
10608
- var singleCodeTabs = function singleCodeTabs() {
10609
- return function (tree) {
10610
- visit(tree, function (node, index, parent) {
10611
- if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
10612
- Object.assign(node, {
10613
- className: 'tab-panel',
10614
- data: {
10615
- hName: 'code',
10616
- hProperties: {
10617
- meta: node.meta,
10618
- lang: node.lang
10619
- }
10620
- }
10621
- });
10622
- parent.children[index] = {
10623
- type: 'code-tabs',
10624
- className: 'tabs',
10625
- data: {
10626
- hName: 'div',
10627
- hProperties: {
10628
- className: ['code-tabs']
10629
- }
10630
- },
10631
- children: [node]
10632
- };
10633
- }
10634
- });
10635
- return tree;
10636
- };
10637
- };
10638
- /* harmony default export */ const single_code_tabs = (singleCodeTabs);
10639
- ;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
10640
-
10641
- var rxEscapedPipe = /\\\|/g;
10642
-
10643
- /**
10644
- * HAST Transformer that finds all inline code nodes within table cells and
10645
- * unescapes any escaped pipe chars so that the editor outputs them without
10646
- * escape chars.
10647
- *
10648
- * This appears to be a bug with remark-parse < ~8
10649
- */
10650
- var tableCellInlineCode = function tableCellInlineCode() {
10651
- return function (tree) {
10652
- visit(tree, [{
10653
- tagName: 'th'
10654
- }, {
10655
- tagName: 'td'
10656
- }], function (tableCellNode) {
10657
- visit(tableCellNode, {
10658
- tagName: 'code'
10659
- }, function (inlineCodeNode) {
10660
- var textNode = inlineCodeNode.children[0];
10661
- if (textNode && rxEscapedPipe.test(textNode.value)) {
10662
- textNode.value = textNode.value.replace(rxEscapedPipe, '|');
10663
- }
10664
- });
10665
- return SKIP;
10666
- });
10667
- };
10668
- };
10669
- /* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
10670
- ;// CONCATENATED MODULE: ./processor/transform/index.js
10671
-
10672
-
10673
- var remarkTransformers = [single_code_tabs];
10674
- var rehypeTransformers = [table_cell_inline_code];
10675
-
10676
- /***/ }),
10677
-
10678
- /***/ 8229:
10679
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10680
-
10681
- var _require = __webpack_require__(2781),
10682
- defaultSchema = _require.defaultSchema;
10683
- var createSchema = function createSchema() {
10684
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
10685
- safeMode = _ref.safeMode;
10686
- var schema = JSON.parse(JSON.stringify(defaultSchema));
10687
-
10688
- // Sanitization Schema Defaults
10689
- schema.clobberPrefix = '';
10690
- schema.tagNames.push('span');
10691
- schema.attributes['*'].push('class', 'className', 'align');
10692
- if (!safeMode) {
10693
- schema.attributes['*'].push('style');
10694
- }
10695
- schema.tagNames.push('rdme-pin');
10696
- schema.tagNames.push('rdme-embed');
10697
- schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
10698
- schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
10699
- schema.tagNames.push('figure');
10700
- schema.tagNames.push('figcaption');
10701
- schema.tagNames.push('input'); // allow GitHub-style todo lists
10702
- schema.ancestors.input = ['li'];
10703
- schema.tagNames.push('colgroup'); // wat
10704
- schema.tagNames.push('col');
10705
- return schema;
10706
- };
10707
- module.exports = createSchema;
10708
-
10709
- /***/ }),
10710
-
10711
- /***/ 8841:
10712
- /***/ ((module) => {
10713
-
10714
- "use strict";
10715
-
10716
-
10717
- module.exports = bail
10718
-
10719
- function bail(err) {
10720
- if (err) {
10721
- throw err
10722
- }
10723
- }
10724
-
10725
-
10726
- /***/ }),
10727
-
10728
- /***/ 1073:
10729
- /***/ ((module) => {
10730
-
10731
- module.exports = {
10732
- trueFunc: function trueFunc(){
10733
- return true;
10734
- },
10735
- falseFunc: function falseFunc(){
10736
- return false;
10737
- }
10738
- };
10739
-
10740
- /***/ }),
10741
-
10742
- /***/ 932:
10743
- /***/ ((module) => {
10744
-
10745
- "use strict";
10746
-
10747
-
10748
- module.exports = ccount
10749
-
10750
- function ccount(value, character) {
10751
- var val = String(value)
10752
- var count = 0
10753
- var index
10754
-
10755
- if (typeof character !== 'string' || character.length !== 1) {
10756
- throw new Error('Expected character')
10757
- }
10758
-
10759
- index = val.indexOf(character)
10760
-
10761
- while (index !== -1) {
10762
- count++
10763
- index = val.indexOf(character, index + 1)
10764
- }
10765
-
10766
- return count
10767
- }
10768
-
10769
-
10770
- /***/ }),
10771
-
10772
- /***/ 6313:
10773
- /***/ ((module) => {
10774
-
10775
- var clone = (function() {
10776
- 'use strict';
10777
-
10778
- function _instanceof(obj, type) {
10779
- return type != null && obj instanceof type;
10780
- }
10781
-
10782
- var nativeMap;
10783
- try {
10784
- nativeMap = Map;
10785
- } catch(_) {
10786
- // maybe a reference error because no `Map`. Give it a dummy value that no
10787
- // value will ever be an instanceof.
10788
- nativeMap = function() {};
10789
- }
10790
-
10791
- var nativeSet;
10792
- try {
10793
- nativeSet = Set;
10794
- } catch(_) {
10795
- nativeSet = function() {};
10796
- }
10797
-
10798
- var nativePromise;
10799
- try {
10800
- nativePromise = Promise;
10801
- } catch(_) {
10802
- nativePromise = function() {};
10803
- }
10804
-
10805
- /**
10806
- * Clones (copies) an Object using deep copying.
10807
- *
10808
- * This function supports circular references by default, but if you are certain
10809
- * there are no circular references in your object, you can save some CPU time
10810
- * by calling clone(obj, false).
10811
- *
10812
- * Caution: if `circular` is false and `parent` contains circular references,
10813
- * your program may enter an infinite loop and crash.
10814
- *
10815
- * @param `parent` - the object to be cloned
10816
- * @param `circular` - set to true if the object to be cloned may contain
10817
- * circular references. (optional - true by default)
10818
- * @param `depth` - set to a number if the object is only to be cloned to
10819
- * a particular depth. (optional - defaults to Infinity)
10820
- * @param `prototype` - sets the prototype to be used when cloning an object.
10821
- * (optional - defaults to parent prototype).
10822
- * @param `includeNonEnumerable` - set to true if the non-enumerable properties
10823
- * should be cloned as well. Non-enumerable properties on the prototype
10824
- * chain will be ignored. (optional - false by default)
10825
- */
10826
- function clone(parent, circular, depth, prototype, includeNonEnumerable) {
10827
- if (typeof circular === 'object') {
10828
- depth = circular.depth;
10829
- prototype = circular.prototype;
10830
- includeNonEnumerable = circular.includeNonEnumerable;
10831
- circular = circular.circular;
10832
- }
10833
- // maintain two arrays for circular references, where corresponding parents
10834
- // and children have the same index
10835
- var allParents = [];
10836
- var allChildren = [];
10837
-
10838
- var useBuffer = typeof Buffer != 'undefined';
10839
-
10840
- if (typeof circular == 'undefined')
10841
- circular = true;
10842
-
10843
- if (typeof depth == 'undefined')
10844
- depth = Infinity;
10499
+ if (typeof depth == 'undefined')
10500
+ depth = Infinity;
10845
10501
 
10846
10502
  // recurse this function so we don't reset allParents and allChildren
10847
10503
  function _clone(parent, depth) {
@@ -32497,72 +32153,34 @@ function _iterableToArrayLimit(arr, i) {
32497
32153
  _d = !1;
32498
32154
  try {
32499
32155
  if (_x = (_i = _i.call(arr)).next, 0 === i) {
32500
- if (Object(_i) !== _i) return;
32501
- _n = !1;
32502
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
32503
- } catch (err) {
32504
- _d = !0, _e = err;
32505
- } finally {
32506
- try {
32507
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
32508
- } finally {
32509
- if (_d) throw _e;
32510
- }
32511
- }
32512
- return _arr;
32513
- }
32514
- }
32515
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
32516
- var unsupportedIterableToArray = __webpack_require__(181);
32517
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
32518
- function _nonIterableRest() {
32519
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
32520
- }
32521
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
32522
-
32523
-
32524
-
32525
-
32526
- function _slicedToArray(arr, i) {
32527
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || (0,unsupportedIterableToArray/* default */.Z)(arr, i) || _nonIterableRest();
32528
- }
32529
-
32530
- /***/ }),
32531
-
32532
- /***/ 2982:
32533
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32534
-
32535
- "use strict";
32536
-
32537
- // EXPORTS
32538
- __webpack_require__.d(__webpack_exports__, {
32539
- "Z": () => (/* binding */ _toConsumableArray)
32540
- });
32541
-
32542
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
32543
- var arrayLikeToArray = __webpack_require__(907);
32544
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
32545
-
32546
- function _arrayWithoutHoles(arr) {
32547
- if (Array.isArray(arr)) return (0,arrayLikeToArray/* default */.Z)(arr);
32548
- }
32549
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
32550
- function _iterableToArray(iter) {
32551
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
32156
+ if (Object(_i) !== _i) return;
32157
+ _n = !1;
32158
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
32159
+ } catch (err) {
32160
+ _d = !0, _e = err;
32161
+ } finally {
32162
+ try {
32163
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
32164
+ } finally {
32165
+ if (_d) throw _e;
32166
+ }
32167
+ }
32168
+ return _arr;
32169
+ }
32552
32170
  }
32553
32171
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
32554
32172
  var unsupportedIterableToArray = __webpack_require__(181);
32555
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
32556
- function _nonIterableSpread() {
32557
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
32173
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
32174
+ function _nonIterableRest() {
32175
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
32558
32176
  }
32559
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
32177
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
32560
32178
 
32561
32179
 
32562
32180
 
32563
32181
 
32564
- function _toConsumableArray(arr) {
32565
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || (0,unsupportedIterableToArray/* default */.Z)(arr) || _nonIterableSpread();
32182
+ function _slicedToArray(arr, i) {
32183
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || (0,unsupportedIterableToArray/* default */.Z)(arr, i) || _nonIterableRest();
32566
32184
  }
32567
32185
 
32568
32186
  /***/ }),
@@ -33121,1201 +32739,1710 @@ class WalkIterator {
33121
32739
  /** @type {number} */
33122
32740
  var nodeIndex
33123
32741
 
33124
- if (start >= end) return this
32742
+ if (start >= end) return this
32743
+
32744
+ if (this.typeIndex) {
32745
+ nodeIndex = this.typeIndex.nodes
32746
+ index = this.typeIndex.index(child)
32747
+ this.delayed.push(delay)
32748
+ } else {
32749
+ this.state.iterator(this.query, child, start, this.parent, this.state)
32750
+ }
32751
+
32752
+ // Stop if we’re looking for one node and it’s already found.
32753
+ if (this.state.one && this.state.found) return this
32754
+
32755
+ return this.each(start + 1, end)
32756
+
32757
+ /**
32758
+ * @this {WalkIterator}
32759
+ */
32760
+ function delay() {
32761
+ this.state.typeIndex = index
32762
+ this.state.nodeIndex = nodeIndex
32763
+ this.state.typeCount = this.typeIndex.count(child)
32764
+ this.state.nodeCount = this.typeIndex.nodes
32765
+ this.state.iterator(this.query, child, start, this.parent, this.state)
32766
+ }
32767
+ }
32768
+
32769
+ /**
32770
+ * Done!
32771
+ * @returns {this}
32772
+ */
32773
+ done() {
32774
+ var index = -1
32775
+
32776
+ while (++index < this.delayed.length) {
32777
+ this.delayed[index].call(this)
32778
+ if (this.state.one && this.state.found) break
32779
+ }
32780
+
32781
+ return this
32782
+ }
32783
+
32784
+ /**
32785
+ * @param {number|null|undefined} [start]
32786
+ * @param {number|null|undefined} [end]
32787
+ * @returns {[number, number]}
32788
+ */
32789
+ defaults(start, end) {
32790
+ if (start === null || start === undefined || start < 0) start = 0
32791
+ if (end === null || end === undefined || end > this.parent.children.length)
32792
+ end = this.parent.children.length
32793
+ return [start, end]
32794
+ }
32795
+ }
32796
+
32797
+ class TypeIndex {
32798
+ constructor() {
32799
+ /** @type {Object.<string, number>} */
32800
+ this.counts = {}
32801
+ /** @type {number} */
32802
+ this.nodes = 0
32803
+ }
32804
+
32805
+ /**
32806
+ * @param {Node} node
32807
+ * @returns {number}
32808
+ */
32809
+ index(node) {
32810
+ var type = node.type
32811
+
32812
+ this.nodes++
32813
+
32814
+ if (!nest_own.call(this.counts, type)) this.counts[type] = 0
32815
+
32816
+ // Note: `++` is intended to be postfixed!
32817
+ return this.counts[type]++
32818
+ }
32819
+
32820
+ /**
32821
+ * @param {Node} node
32822
+ * @returns {number|undefined}
32823
+ */
32824
+ count(node) {
32825
+ return this.counts[node.type]
32826
+ }
32827
+ }
32828
+
32829
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
32830
+ /**
32831
+ * @typedef {import('unist').Node} Node
32832
+ * @typedef {import('unist').Parent} Parent
32833
+ *
32834
+ * @typedef {string} Type
32835
+ * @typedef {Object<string, unknown>} Props
32836
+ *
32837
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
32838
+ */
32839
+
32840
+ /**
32841
+ * Check if a node passes a test
32842
+ *
32843
+ * @callback TestFunctionAnything
32844
+ * @param {Node} node
32845
+ * @param {number} [index]
32846
+ * @param {Parent} [parent]
32847
+ * @returns {boolean|void}
32848
+ */
32849
+
32850
+ /**
32851
+ * Check if a node passes a certain node test
32852
+ *
32853
+ * @template {Node} X
32854
+ * @callback TestFunctionPredicate
32855
+ * @param {Node} node
32856
+ * @param {number} [index]
32857
+ * @param {Parent} [parent]
32858
+ * @returns {node is X}
32859
+ */
32860
+
32861
+ /**
32862
+ * @callback AssertAnything
32863
+ * @param {unknown} [node]
32864
+ * @param {number} [index]
32865
+ * @param {Parent} [parent]
32866
+ * @returns {boolean}
32867
+ */
32868
+
32869
+ /**
32870
+ * Check if a node passes a certain node test
32871
+ *
32872
+ * @template {Node} Y
32873
+ * @callback AssertPredicate
32874
+ * @param {unknown} [node]
32875
+ * @param {number} [index]
32876
+ * @param {Parent} [parent]
32877
+ * @returns {node is Y}
32878
+ */
32879
+
32880
+ var is =
32881
+ /**
32882
+ * Check if a node passes a test.
32883
+ * When a `parent` node is known the `index` of node should also be given.
32884
+ *
32885
+ * @type {(
32886
+ * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) &
32887
+ * ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
32888
+ * )}
32889
+ */
32890
+ (
32891
+ /**
32892
+ * Check if a node passes a test.
32893
+ * When a `parent` node is known the `index` of node should also be given.
32894
+ *
32895
+ * @param {unknown} [node] Node to check
32896
+ * @param {Test} [test]
32897
+ * When nullish, checks if `node` is a `Node`.
32898
+ * When `string`, works like passing `function (node) {return node.type === test}`.
32899
+ * When `function` checks if function passed the node is true.
32900
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
32901
+ * When `array`, checks any one of the subtests pass.
32902
+ * @param {number} [index] Position of `node` in `parent`
32903
+ * @param {Parent} [parent] Parent of `node`
32904
+ * @param {unknown} [context] Context object to invoke `test` with
32905
+ * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
32906
+ */
32907
+ // eslint-disable-next-line max-params
32908
+ function is(node, test, index, parent, context) {
32909
+ var check = convert(test)
32910
+
32911
+ if (
32912
+ index !== undefined &&
32913
+ index !== null &&
32914
+ (typeof index !== 'number' ||
32915
+ index < 0 ||
32916
+ index === Number.POSITIVE_INFINITY)
32917
+ ) {
32918
+ throw new Error('Expected positive finite index')
32919
+ }
32920
+
32921
+ if (
32922
+ parent !== undefined &&
32923
+ parent !== null &&
32924
+ (!is(parent) || !parent.children)
32925
+ ) {
32926
+ throw new Error('Expected parent node')
32927
+ }
32928
+
32929
+ if (
32930
+ (parent === undefined || parent === null) !==
32931
+ (index === undefined || index === null)
32932
+ ) {
32933
+ throw new Error('Expected both parent and index')
32934
+ }
32935
+
32936
+ // @ts-ignore Looks like a node.
32937
+ return node && node.type && typeof node.type === 'string'
32938
+ ? Boolean(check.call(context, node, index, parent))
32939
+ : false
32940
+ }
32941
+ )
32942
+
32943
+ var convert =
32944
+ /**
32945
+ * @type {(
32946
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
32947
+ * ((test?: Test) => AssertAnything)
32948
+ * )}
32949
+ */
32950
+ (
32951
+ /**
32952
+ * Generate an assertion from a check.
32953
+ * @param {Test} [test]
32954
+ * When nullish, checks if `node` is a `Node`.
32955
+ * When `string`, works like passing `function (node) {return node.type === test}`.
32956
+ * When `function` checks if function passed the node is true.
32957
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
32958
+ * When `array`, checks any one of the subtests pass.
32959
+ * @returns {AssertAnything}
32960
+ */
32961
+ function (test) {
32962
+ if (test === undefined || test === null) {
32963
+ return ok
32964
+ }
32965
+
32966
+ if (typeof test === 'string') {
32967
+ return typeFactory(test)
32968
+ }
32969
+
32970
+ if (typeof test === 'object') {
32971
+ // @ts-ignore looks like a list of tests / partial test object.
32972
+ return 'length' in test ? anyFactory(test) : propsFactory(test)
32973
+ }
32974
+
32975
+ if (typeof test === 'function') {
32976
+ return castFactory(test)
32977
+ }
33125
32978
 
33126
- if (this.typeIndex) {
33127
- nodeIndex = this.typeIndex.nodes
33128
- index = this.typeIndex.index(child)
33129
- this.delayed.push(delay)
33130
- } else {
33131
- this.state.iterator(this.query, child, start, this.parent, this.state)
32979
+ throw new Error('Expected function, string, or object as test')
33132
32980
  }
32981
+ )
32982
+ /**
32983
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
32984
+ * @returns {AssertAnything}
32985
+ */
32986
+ function anyFactory(tests) {
32987
+ /** @type {Array.<AssertAnything>} */
32988
+ var checks = []
32989
+ var index = -1
33133
32990
 
33134
- // Stop if we’re looking for one node and it’s already found.
33135
- if (this.state.one && this.state.found) return this
32991
+ while (++index < tests.length) {
32992
+ checks[index] = convert(tests[index])
32993
+ }
33136
32994
 
33137
- return this.each(start + 1, end)
32995
+ return castFactory(any)
33138
32996
 
33139
- /**
33140
- * @this {WalkIterator}
33141
- */
33142
- function delay() {
33143
- this.state.typeIndex = index
33144
- this.state.nodeIndex = nodeIndex
33145
- this.state.typeCount = this.typeIndex.count(child)
33146
- this.state.nodeCount = this.typeIndex.nodes
33147
- this.state.iterator(this.query, child, start, this.parent, this.state)
32997
+ /**
32998
+ * @this {unknown}
32999
+ * @param {unknown[]} parameters
33000
+ * @returns {boolean}
33001
+ */
33002
+ function any(...parameters) {
33003
+ var index = -1
33004
+
33005
+ while (++index < checks.length) {
33006
+ if (checks[index].call(this, ...parameters)) return true
33148
33007
  }
33149
33008
  }
33009
+ }
33010
+
33011
+ /**
33012
+ * Utility to assert each property in `test` is represented in `node`, and each
33013
+ * values are strictly equal.
33014
+ *
33015
+ * @param {Props} check
33016
+ * @returns {AssertAnything}
33017
+ */
33018
+ function propsFactory(check) {
33019
+ return castFactory(all)
33150
33020
 
33151
33021
  /**
33152
- * Done!
33153
- * @returns {this}
33022
+ * @param {Node} node
33023
+ * @returns {boolean}
33154
33024
  */
33155
- done() {
33156
- var index = -1
33025
+ function all(node) {
33026
+ /** @type {string} */
33027
+ var key
33157
33028
 
33158
- while (++index < this.delayed.length) {
33159
- this.delayed[index].call(this)
33160
- if (this.state.one && this.state.found) break
33029
+ for (key in check) {
33030
+ if (node[key] !== check[key]) return
33161
33031
  }
33162
33032
 
33163
- return this
33033
+ return true
33164
33034
  }
33035
+ }
33036
+
33037
+ /**
33038
+ * Utility to convert a string into a function which checks a given node’s type
33039
+ * for said string.
33040
+ *
33041
+ * @param {Type} check
33042
+ * @returns {AssertAnything}
33043
+ */
33044
+ function typeFactory(check) {
33045
+ return castFactory(type)
33165
33046
 
33166
33047
  /**
33167
- * @param {number|null|undefined} [start]
33168
- * @param {number|null|undefined} [end]
33169
- * @returns {[number, number]}
33048
+ * @param {Node} node
33170
33049
  */
33171
- defaults(start, end) {
33172
- if (start === null || start === undefined || start < 0) start = 0
33173
- if (end === null || end === undefined || end > this.parent.children.length)
33174
- end = this.parent.children.length
33175
- return [start, end]
33050
+ function type(node) {
33051
+ return node && node.type === check
33176
33052
  }
33177
33053
  }
33178
33054
 
33179
- class TypeIndex {
33180
- constructor() {
33181
- /** @type {Object.<string, number>} */
33182
- this.counts = {}
33183
- /** @type {number} */
33184
- this.nodes = 0
33185
- }
33055
+ /**
33056
+ * Utility to convert a string into a function which checks a given node’s type
33057
+ * for said string.
33058
+ * @param {TestFunctionAnything} check
33059
+ * @returns {AssertAnything}
33060
+ */
33061
+ function castFactory(check) {
33062
+ return assertion
33186
33063
 
33187
33064
  /**
33188
- * @param {Node} node
33189
- * @returns {number}
33065
+ * @this {unknown}
33066
+ * @param {Array.<unknown>} parameters
33067
+ * @returns {boolean}
33190
33068
  */
33191
- index(node) {
33192
- var type = node.type
33069
+ function assertion(...parameters) {
33070
+ return Boolean(check.call(this, ...parameters))
33071
+ }
33072
+ }
33193
33073
 
33194
- this.nodes++
33074
+ // Utility to return true.
33075
+ function ok() {
33076
+ return true
33077
+ }
33195
33078
 
33196
- if (!nest_own.call(this.counts, type)) this.counts[type] = 0
33079
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
33080
+ /**
33081
+ * @typedef {import('./types.js').Rule} Rule
33082
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
33083
+ * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33084
+ * @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
33085
+ * @typedef {import('./types.js').Parent} Parent
33086
+ * @typedef {import('./types.js').Selector} Selector
33087
+ * @typedef {import('./types.js').Selectors} Selectors
33088
+ * @typedef {import('./types.js').SelectState} SelectState
33089
+ * @typedef {import('./types.js').Node} Node
33090
+ */
33197
33091
 
33198
- // Note: `++` is intended to be postfixed!
33199
- return this.counts[type]++
33092
+
33093
+
33094
+
33095
+
33096
+ var pseudo_is = convert()
33097
+
33098
+ var pseudo_handle = zwitch('name', {
33099
+ unknown: unknownPseudo,
33100
+ invalid: invalidPseudo,
33101
+ handlers: {
33102
+ any: matches,
33103
+ blank: empty,
33104
+ empty,
33105
+ 'first-child': firstChild,
33106
+ 'first-of-type': firstOfType,
33107
+ has: hasSelector,
33108
+ 'last-child': lastChild,
33109
+ 'last-of-type': lastOfType,
33110
+ matches,
33111
+ not,
33112
+ 'nth-child': nthChild,
33113
+ 'nth-last-child': nthLastChild,
33114
+ 'nth-of-type': nthOfType,
33115
+ 'nth-last-of-type': nthLastOfType,
33116
+ 'only-child': onlyChild,
33117
+ 'only-of-type': onlyOfType,
33118
+ root: pseudo_root,
33119
+ scope
33200
33120
  }
33121
+ })
33201
33122
 
33202
- /**
33203
- * @param {Node} node
33204
- * @returns {number|undefined}
33205
- */
33206
- count(node) {
33207
- return this.counts[node.type]
33123
+ pseudo.needsIndex = [
33124
+ 'first-child',
33125
+ 'first-of-type',
33126
+ 'last-child',
33127
+ 'last-of-type',
33128
+ 'nth-child',
33129
+ 'nth-last-child',
33130
+ 'nth-of-type',
33131
+ 'nth-last-of-type',
33132
+ 'only-child',
33133
+ 'only-of-type'
33134
+ ]
33135
+
33136
+ /**
33137
+ * @param {Rule} query
33138
+ * @param {Node} node
33139
+ * @param {number|null} index
33140
+ * @param {Parent|null} parent
33141
+ * @param {SelectState} state
33142
+ * @returns {boolean}
33143
+ */
33144
+ function pseudo(query, node, index, parent, state) {
33145
+ var pseudos = query.pseudos
33146
+ var offset = -1
33147
+
33148
+ while (++offset < pseudos.length) {
33149
+ if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
33208
33150
  }
33151
+
33152
+ return true
33209
33153
  }
33210
33154
 
33211
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
33212
33155
  /**
33213
- * @typedef {import('unist').Node} Node
33214
- * @typedef {import('unist').Parent} Parent
33215
- *
33216
- * @typedef {string} Type
33217
- * @typedef {Object<string, unknown>} Props
33218
- *
33219
- * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
33156
+ * @param {RulePseudoSelector} query
33157
+ * @param {Node} node
33158
+ * @param {number|null} _1
33159
+ * @param {Parent|null} _2
33160
+ * @param {SelectState} state
33161
+ * @returns {boolean}
33162
+ */
33163
+ function matches(query, node, _1, _2, state) {
33164
+ var shallow = state.shallow
33165
+ var one = state.one
33166
+ /** @type {boolean} */
33167
+ var result
33168
+
33169
+ state.one = true
33170
+ state.shallow = true
33171
+
33172
+ result = state.any(query.value, node, state)[0] === node
33173
+
33174
+ state.shallow = shallow
33175
+ state.one = one
33176
+
33177
+ return result
33178
+ }
33179
+
33180
+ /**
33181
+ * @param {RulePseudoSelector} query
33182
+ * @param {Node} node
33183
+ * @param {number|null} index
33184
+ * @param {Parent|null} parent
33185
+ * @param {SelectState} state
33186
+ * @returns {boolean}
33187
+ */
33188
+ function not(query, node, index, parent, state) {
33189
+ return !matches(query, node, index, parent, state)
33190
+ }
33191
+
33192
+ /**
33193
+ * @param {RulePseudo} _1
33194
+ * @param {Node} node
33195
+ * @param {number|null} _2
33196
+ * @param {Parent|null} parent
33197
+ * @returns {boolean}
33220
33198
  */
33199
+ function pseudo_root(_1, node, _2, parent) {
33200
+ return pseudo_is(node) && !parent
33201
+ }
33221
33202
 
33222
33203
  /**
33223
- * Check if a node passes a test
33224
- *
33225
- * @callback TestFunctionAnything
33204
+ * @param {RulePseudo} _1
33226
33205
  * @param {Node} node
33227
- * @param {number} [index]
33228
- * @param {Parent} [parent]
33229
- * @returns {boolean|void}
33206
+ * @param {number|null} _2
33207
+ * @param {Parent|null} _3
33208
+ * @param {SelectState} state
33209
+ * @returns {boolean}
33230
33210
  */
33211
+ function scope(_1, node, _2, _3, state) {
33212
+ return pseudo_is(node) && state.scopeNodes.includes(node)
33213
+ }
33231
33214
 
33232
33215
  /**
33233
- * Check if a node passes a certain node test
33234
- *
33235
- * @template {Node} X
33236
- * @callback TestFunctionPredicate
33216
+ * @param {RulePseudo} _1
33237
33217
  * @param {Node} node
33238
- * @param {number} [index]
33239
- * @param {Parent} [parent]
33240
- * @returns {node is X}
33218
+ * @returns {boolean}
33241
33219
  */
33220
+ function empty(_1, node) {
33221
+ return util_parent(node) ? node.children.length === 0 : !('value' in node)
33222
+ }
33242
33223
 
33243
33224
  /**
33244
- * @callback AssertAnything
33245
- * @param {unknown} [node]
33246
- * @param {number} [index]
33247
- * @param {Parent} [parent]
33225
+ * @param {RulePseudo} query
33226
+ * @param {Node} _1
33227
+ * @param {number|null} _2
33228
+ * @param {Parent|null} _3
33229
+ * @param {SelectState} state
33248
33230
  * @returns {boolean}
33249
33231
  */
33232
+ function firstChild(query, _1, _2, _3, state) {
33233
+ assertDeep(state, query)
33234
+ return state.nodeIndex === 0 // Specifically `0`, not falsey.
33235
+ }
33250
33236
 
33251
33237
  /**
33252
- * Check if a node passes a certain node test
33253
- *
33254
- * @template {Node} Y
33255
- * @callback AssertPredicate
33256
- * @param {unknown} [node]
33257
- * @param {number} [index]
33258
- * @param {Parent} [parent]
33259
- * @returns {node is Y}
33238
+ * @param {RulePseudo} query
33239
+ * @param {Node} _1
33240
+ * @param {number|null} _2
33241
+ * @param {Parent|null} _3
33242
+ * @param {SelectState} state
33243
+ * @returns {boolean}
33260
33244
  */
33245
+ function lastChild(query, _1, _2, _3, state) {
33246
+ assertDeep(state, query)
33247
+ return state.nodeIndex === state.nodeCount - 1
33248
+ }
33261
33249
 
33262
- var is =
33263
- /**
33264
- * Check if a node passes a test.
33265
- * When a `parent` node is known the `index` of node should also be given.
33266
- *
33267
- * @type {(
33268
- * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) &
33269
- * ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
33270
- * )}
33271
- */
33272
- (
33273
- /**
33274
- * Check if a node passes a test.
33275
- * When a `parent` node is known the `index` of node should also be given.
33276
- *
33277
- * @param {unknown} [node] Node to check
33278
- * @param {Test} [test]
33279
- * When nullish, checks if `node` is a `Node`.
33280
- * When `string`, works like passing `function (node) {return node.type === test}`.
33281
- * When `function` checks if function passed the node is true.
33282
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33283
- * When `array`, checks any one of the subtests pass.
33284
- * @param {number} [index] Position of `node` in `parent`
33285
- * @param {Parent} [parent] Parent of `node`
33286
- * @param {unknown} [context] Context object to invoke `test` with
33287
- * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
33288
- */
33289
- // eslint-disable-next-line max-params
33290
- function is(node, test, index, parent, context) {
33291
- var check = convert(test)
33250
+ /**
33251
+ * @param {RulePseudo} query
33252
+ * @param {Node} _1
33253
+ * @param {number|null} _2
33254
+ * @param {Parent|null} _3
33255
+ * @param {SelectState} state
33256
+ * @returns {boolean}
33257
+ */
33258
+ function onlyChild(query, _1, _2, _3, state) {
33259
+ assertDeep(state, query)
33260
+ return state.nodeCount === 1
33261
+ }
33292
33262
 
33293
- if (
33294
- index !== undefined &&
33295
- index !== null &&
33296
- (typeof index !== 'number' ||
33297
- index < 0 ||
33298
- index === Number.POSITIVE_INFINITY)
33299
- ) {
33300
- throw new Error('Expected positive finite index')
33301
- }
33263
+ /**
33264
+ * @param {RulePseudoNth} query
33265
+ * @param {Node} _1
33266
+ * @param {number|null} _2
33267
+ * @param {Parent|null} _3
33268
+ * @param {SelectState} state
33269
+ * @returns {boolean}
33270
+ */
33271
+ function nthChild(query, _1, _2, _3, state) {
33272
+ assertDeep(state, query)
33273
+ return query.value(state.nodeIndex)
33274
+ }
33302
33275
 
33303
- if (
33304
- parent !== undefined &&
33305
- parent !== null &&
33306
- (!is(parent) || !parent.children)
33307
- ) {
33308
- throw new Error('Expected parent node')
33309
- }
33276
+ /**
33277
+ * @param {RulePseudoNth} query
33278
+ * @param {Node} _1
33279
+ * @param {number|null} _2
33280
+ * @param {Parent|null} _3
33281
+ * @param {SelectState} state
33282
+ * @returns {boolean}
33283
+ */
33284
+ function nthLastChild(query, _1, _2, _3, state) {
33285
+ assertDeep(state, query)
33286
+ return query.value(state.nodeCount - state.nodeIndex - 1)
33287
+ }
33310
33288
 
33311
- if (
33312
- (parent === undefined || parent === null) !==
33313
- (index === undefined || index === null)
33314
- ) {
33315
- throw new Error('Expected both parent and index')
33316
- }
33289
+ /**
33290
+ * @param {RulePseudoNth} query
33291
+ * @param {Node} _1
33292
+ * @param {number|null} _2
33293
+ * @param {Parent|null} _3
33294
+ * @param {SelectState} state
33295
+ * @returns {boolean}
33296
+ */
33297
+ function nthOfType(query, _1, _2, _3, state) {
33298
+ assertDeep(state, query)
33299
+ return query.value(state.typeIndex)
33300
+ }
33317
33301
 
33318
- // @ts-ignore Looks like a node.
33319
- return node && node.type && typeof node.type === 'string'
33320
- ? Boolean(check.call(context, node, index, parent))
33321
- : false
33322
- }
33323
- )
33302
+ /**
33303
+ * @param {RulePseudoNth} query
33304
+ * @param {Node} _1
33305
+ * @param {number|null} _2
33306
+ * @param {Parent|null} _3
33307
+ * @param {SelectState} state
33308
+ * @returns {boolean}
33309
+ */
33310
+ function nthLastOfType(query, _1, _2, _3, state) {
33311
+ assertDeep(state, query)
33312
+ return query.value(state.typeCount - 1 - state.typeIndex)
33313
+ }
33324
33314
 
33325
- var convert =
33326
- /**
33327
- * @type {(
33328
- * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
33329
- * ((test?: Test) => AssertAnything)
33330
- * )}
33331
- */
33332
- (
33333
- /**
33334
- * Generate an assertion from a check.
33335
- * @param {Test} [test]
33336
- * When nullish, checks if `node` is a `Node`.
33337
- * When `string`, works like passing `function (node) {return node.type === test}`.
33338
- * When `function` checks if function passed the node is true.
33339
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33340
- * When `array`, checks any one of the subtests pass.
33341
- * @returns {AssertAnything}
33342
- */
33343
- function (test) {
33344
- if (test === undefined || test === null) {
33345
- return ok
33346
- }
33315
+ /**
33316
+ * @param {RulePseudo} query
33317
+ * @param {Node} _1
33318
+ * @param {number|null} _2
33319
+ * @param {Parent|null} _3
33320
+ * @param {SelectState} state
33321
+ * @returns {boolean}
33322
+ */
33323
+ function firstOfType(query, _1, _2, _3, state) {
33324
+ assertDeep(state, query)
33325
+ return state.typeIndex === 0
33326
+ }
33347
33327
 
33348
- if (typeof test === 'string') {
33349
- return typeFactory(test)
33350
- }
33328
+ /**
33329
+ * @param {RulePseudo} query
33330
+ * @param {Node} _1
33331
+ * @param {number|null} _2
33332
+ * @param {Parent|null} _3
33333
+ * @param {SelectState} state
33334
+ * @returns {boolean}
33335
+ */
33336
+ function lastOfType(query, _1, _2, _3, state) {
33337
+ assertDeep(state, query)
33338
+ return state.typeIndex === state.typeCount - 1
33339
+ }
33351
33340
 
33352
- if (typeof test === 'object') {
33353
- // @ts-ignore looks like a list of tests / partial test object.
33354
- return 'length' in test ? anyFactory(test) : propsFactory(test)
33355
- }
33341
+ /**
33342
+ * @param {RulePseudo} query
33343
+ * @param {Node} _1
33344
+ * @param {number|null} _2
33345
+ * @param {Parent|null} _3
33346
+ * @param {SelectState} state
33347
+ * @returns {boolean}
33348
+ */
33349
+ function onlyOfType(query, _1, _2, _3, state) {
33350
+ assertDeep(state, query)
33351
+ return state.typeCount === 1
33352
+ }
33356
33353
 
33357
- if (typeof test === 'function') {
33358
- return castFactory(test)
33359
- }
33354
+ // Shouldn’t be invoked, parser gives correct data.
33355
+ /* c8 ignore next 3 */
33356
+ function invalidPseudo() {
33357
+ throw new Error('Invalid pseudo-selector')
33358
+ }
33360
33359
 
33361
- throw new Error('Expected function, string, or object as test')
33362
- }
33363
- )
33364
33360
  /**
33365
- * @param {Array.<Type|Props|TestFunctionAnything>} tests
33366
- * @returns {AssertAnything}
33361
+ * @param {RulePseudo} query
33362
+ * @returns {boolean}
33367
33363
  */
33368
- function anyFactory(tests) {
33369
- /** @type {Array.<AssertAnything>} */
33370
- var checks = []
33371
- var index = -1
33372
-
33373
- while (++index < tests.length) {
33374
- checks[index] = convert(tests[index])
33364
+ function unknownPseudo(query) {
33365
+ if (query.name) {
33366
+ throw new Error('Unknown pseudo-selector `' + query.name + '`')
33375
33367
  }
33376
33368
 
33377
- return castFactory(any)
33378
-
33379
- /**
33380
- * @this {unknown}
33381
- * @param {unknown[]} parameters
33382
- * @returns {boolean}
33383
- */
33384
- function any(...parameters) {
33385
- var index = -1
33386
-
33387
- while (++index < checks.length) {
33388
- if (checks[index].call(this, ...parameters)) return true
33389
- }
33390
- }
33369
+ throw new Error('Unexpected pseudo-element or empty pseudo-class')
33391
33370
  }
33392
33371
 
33393
33372
  /**
33394
- * Utility to assert each property in `test` is represented in `node`, and each
33395
- * values are strictly equal.
33396
- *
33397
- * @param {Props} check
33398
- * @returns {AssertAnything}
33373
+ * @param {SelectState} state
33374
+ * @param {RulePseudo|RulePseudoNth} query
33399
33375
  */
33400
- function propsFactory(check) {
33401
- return castFactory(all)
33402
-
33403
- /**
33404
- * @param {Node} node
33405
- * @returns {boolean}
33406
- */
33407
- function all(node) {
33408
- /** @type {string} */
33409
- var key
33410
-
33411
- for (key in check) {
33412
- if (node[key] !== check[key]) return
33413
- }
33414
-
33415
- return true
33376
+ function assertDeep(state, query) {
33377
+ if (state.shallow) {
33378
+ throw new Error('Cannot use `:' + query.name + '` without parent')
33416
33379
  }
33417
33380
  }
33418
33381
 
33419
33382
  /**
33420
- * Utility to convert a string into a function which checks a given node’s type
33421
- * for said string.
33422
- *
33423
- * @param {Type} check
33424
- * @returns {AssertAnything}
33383
+ * @param {RulePseudoSelector} query
33384
+ * @param {Node} node
33385
+ * @param {number|null} _1
33386
+ * @param {Parent|null} _2
33387
+ * @param {SelectState} state
33388
+ * @returns {boolean}
33425
33389
  */
33426
- function typeFactory(check) {
33427
- return castFactory(type)
33390
+ function hasSelector(query, node, _1, _2, state) {
33391
+ var shallow = state.shallow
33392
+ var one = state.one
33393
+ var scopeNodes = state.scopeNodes
33394
+ var value = appendScope(query.value)
33395
+ var anything = state.any
33396
+ /** @type {boolean} */
33397
+ var result
33428
33398
 
33429
- /**
33430
- * @param {Node} node
33431
- */
33432
- function type(node) {
33433
- return node && node.type === check
33434
- }
33399
+ state.shallow = false
33400
+ state.one = true
33401
+ state.scopeNodes = [node]
33402
+
33403
+ result = Boolean(anything(value, node, state)[0])
33404
+
33405
+ state.shallow = shallow
33406
+ state.one = one
33407
+ state.scopeNodes = scopeNodes
33408
+
33409
+ return result
33435
33410
  }
33436
33411
 
33437
33412
  /**
33438
- * Utility to convert a string into a function which checks a given node’s type
33439
- * for said string.
33440
- * @param {TestFunctionAnything} check
33441
- * @returns {AssertAnything}
33413
+ * @param {Selector} value
33442
33414
  */
33443
- function castFactory(check) {
33444
- return assertion
33415
+ function appendScope(value) {
33416
+ /** @type {Selectors} */
33417
+ var selector =
33418
+ value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
33419
+ var index = -1
33420
+ /** @type {Rule} */
33421
+ var rule
33445
33422
 
33446
- /**
33447
- * @this {unknown}
33448
- * @param {Array.<unknown>} parameters
33449
- * @returns {boolean}
33450
- */
33451
- function assertion(...parameters) {
33452
- return Boolean(check.call(this, ...parameters))
33423
+ while (++index < selector.selectors.length) {
33424
+ rule = selector.selectors[index].rule
33425
+ rule.nestingOperator = null
33426
+
33427
+ // Needed if new pseudo’s are added that accepts commas (such as
33428
+ // `:lang(en, nl)`)
33429
+ /* c8 ignore else */
33430
+ if (
33431
+ !rule.pseudos ||
33432
+ rule.pseudos.length !== 1 ||
33433
+ rule.pseudos[0].name !== 'scope'
33434
+ ) {
33435
+ selector.selectors[index] = {
33436
+ type: 'ruleSet',
33437
+ rule: {
33438
+ type: 'rule',
33439
+ rule,
33440
+ // @ts-ignore pseudos are fine w/ just a name!
33441
+ pseudos: [{name: 'scope'}]
33442
+ }
33443
+ }
33444
+ }
33453
33445
  }
33454
- }
33455
33446
 
33456
- // Utility to return true.
33457
- function ok() {
33458
- return true
33447
+ return selector
33459
33448
  }
33460
33449
 
33461
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
33450
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
33462
33451
  /**
33463
33452
  * @typedef {import('./types.js').Rule} Rule
33464
- * @typedef {import('./types.js').RulePseudo} RulePseudo
33465
- * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33466
- * @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
33467
- * @typedef {import('./types.js').Parent} Parent
33468
- * @typedef {import('./types.js').Selector} Selector
33469
- * @typedef {import('./types.js').Selectors} Selectors
33470
- * @typedef {import('./types.js').SelectState} SelectState
33453
+ * @typedef {import('./types.js').RuleAttr} RuleAttr
33471
33454
  * @typedef {import('./types.js').Node} Node
33472
33455
  */
33473
33456
 
33474
33457
 
33475
33458
 
33476
-
33477
-
33478
- var pseudo_is = convert()
33479
-
33480
- var pseudo_handle = zwitch('name', {
33481
- unknown: unknownPseudo,
33482
- invalid: invalidPseudo,
33459
+ var attribute_handle = zwitch('operator', {
33460
+ unknown: unknownOperator,
33461
+ invalid: exists,
33483
33462
  handlers: {
33484
- any: matches,
33485
- blank: empty,
33486
- empty,
33487
- 'first-child': firstChild,
33488
- 'first-of-type': firstOfType,
33489
- has: hasSelector,
33490
- 'last-child': lastChild,
33491
- 'last-of-type': lastOfType,
33492
- matches,
33493
- not,
33494
- 'nth-child': nthChild,
33495
- 'nth-last-child': nthLastChild,
33496
- 'nth-of-type': nthOfType,
33497
- 'nth-last-of-type': nthLastOfType,
33498
- 'only-child': onlyChild,
33499
- 'only-of-type': onlyOfType,
33500
- root: pseudo_root,
33501
- scope
33463
+ '=': exact,
33464
+ '^=': begins,
33465
+ '$=': ends,
33466
+ '*=': containsString,
33467
+ '~=': containsArray
33502
33468
  }
33503
33469
  })
33504
33470
 
33505
- pseudo.needsIndex = [
33506
- 'first-child',
33507
- 'first-of-type',
33508
- 'last-child',
33509
- 'last-of-type',
33510
- 'nth-child',
33511
- 'nth-last-child',
33512
- 'nth-of-type',
33513
- 'nth-last-of-type',
33514
- 'only-child',
33515
- 'only-of-type'
33516
- ]
33517
-
33518
33471
  /**
33519
33472
  * @param {Rule} query
33520
33473
  * @param {Node} node
33521
- * @param {number|null} index
33522
- * @param {Parent|null} parent
33523
- * @param {SelectState} state
33524
- * @returns {boolean}
33525
33474
  */
33526
- function pseudo(query, node, index, parent, state) {
33527
- var pseudos = query.pseudos
33528
- var offset = -1
33475
+ function attribute(query, node) {
33476
+ var index = -1
33529
33477
 
33530
- while (++offset < pseudos.length) {
33531
- if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
33478
+ while (++index < query.attrs.length) {
33479
+ if (!attribute_handle(query.attrs[index], node)) return false
33532
33480
  }
33533
33481
 
33534
33482
  return true
33535
33483
  }
33536
33484
 
33537
33485
  /**
33538
- * @param {RulePseudoSelector} query
33486
+ * `[attr]`
33487
+ *
33488
+ * @param {RuleAttr} query
33539
33489
  * @param {Node} node
33540
- * @param {number|null} _1
33541
- * @param {Parent|null} _2
33542
- * @param {SelectState} state
33543
- * @returns {boolean}
33544
33490
  */
33545
- function matches(query, node, _1, _2, state) {
33546
- var shallow = state.shallow
33547
- var one = state.one
33548
- /** @type {boolean} */
33549
- var result
33491
+ function exists(query, node) {
33492
+ return node[query.name] !== null && node[query.name] !== undefined
33493
+ }
33550
33494
 
33551
- state.one = true
33552
- state.shallow = true
33495
+ /**
33496
+ * `[attr=value]`
33497
+ *
33498
+ * @param {RuleAttr} query
33499
+ * @param {Node} node
33500
+ */
33501
+ function exact(query, node) {
33502
+ return exists(query, node) && String(node[query.name]) === query.value
33503
+ }
33553
33504
 
33554
- result = state.any(query.value, node, state)[0] === node
33505
+ /**
33506
+ * `[attr~=value]`
33507
+ *
33508
+ * @param {RuleAttr} query
33509
+ * @param {Node} node
33510
+ */
33511
+ function containsArray(query, node) {
33512
+ var value = node[query.name]
33555
33513
 
33556
- state.shallow = shallow
33557
- state.one = one
33514
+ if (value === null || value === undefined) return false
33515
+
33516
+ // If this is an array, and the query is contained in it, return true.
33517
+ // Coverage comment in place because TS turns `Array.isArray(unknown)`
33518
+ // into `Array.<any>` instead of `Array.<unknown>`.
33519
+ // type-coverage:ignore-next-line
33520
+ if (Array.isArray(value) && value.includes(query.value)) {
33521
+ return true
33522
+ }
33558
33523
 
33559
- return result
33524
+ // For all other values, return whether this is an exact match.
33525
+ return String(value) === query.value
33560
33526
  }
33561
33527
 
33562
33528
  /**
33563
- * @param {RulePseudoSelector} query
33529
+ * `[attr^=value]`
33530
+ *
33531
+ * @param {RuleAttr} query
33564
33532
  * @param {Node} node
33565
- * @param {number|null} index
33566
- * @param {Parent|null} parent
33567
- * @param {SelectState} state
33568
- * @returns {boolean}
33569
33533
  */
33570
- function not(query, node, index, parent, state) {
33571
- return !matches(query, node, index, parent, state)
33572
- }
33534
+ function begins(query, node) {
33535
+ var value = node[query.name]
33573
33536
 
33574
- /**
33575
- * @param {RulePseudo} _1
33576
- * @param {Node} node
33577
- * @param {number|null} _2
33578
- * @param {Parent|null} parent
33579
- * @returns {boolean}
33580
- */
33581
- function pseudo_root(_1, node, _2, parent) {
33582
- return pseudo_is(node) && !parent
33537
+ return (
33538
+ typeof value === 'string' &&
33539
+ value.slice(0, query.value.length) === query.value
33540
+ )
33583
33541
  }
33584
33542
 
33585
33543
  /**
33586
- * @param {RulePseudo} _1
33544
+ * `[attr$=value]`
33545
+ *
33546
+ * @param {RuleAttr} query
33587
33547
  * @param {Node} node
33588
- * @param {number|null} _2
33589
- * @param {Parent|null} _3
33590
- * @param {SelectState} state
33591
- * @returns {boolean}
33592
33548
  */
33593
- function scope(_1, node, _2, _3, state) {
33594
- return pseudo_is(node) && state.scopeNodes.includes(node)
33549
+ function ends(query, node) {
33550
+ var value = node[query.name]
33551
+
33552
+ return (
33553
+ typeof value === 'string' &&
33554
+ value.slice(-query.value.length) === query.value
33555
+ )
33595
33556
  }
33596
33557
 
33597
33558
  /**
33598
- * @param {RulePseudo} _1
33559
+ * `[attr*=value]`
33560
+ *
33561
+ * @param {RuleAttr} query
33599
33562
  * @param {Node} node
33600
- * @returns {boolean}
33601
33563
  */
33602
- function empty(_1, node) {
33603
- return util_parent(node) ? node.children.length === 0 : !('value' in node)
33564
+ function containsString(query, node) {
33565
+ var value = node[query.name]
33566
+ return typeof value === 'string' && value.includes(query.value)
33604
33567
  }
33605
33568
 
33569
+ // Shouldn’t be invoked, Parser throws an error instead.
33570
+ /* c8 ignore next 6 */
33606
33571
  /**
33607
- * @param {RulePseudo} query
33608
- * @param {Node} _1
33609
- * @param {number|null} _2
33610
- * @param {Parent|null} _3
33611
- * @param {SelectState} state
33612
- * @returns {boolean}
33572
+ * @param {{[x: string]: unknown, type: string}} query
33613
33573
  */
33614
- function firstChild(query, _1, _2, _3, state) {
33615
- assertDeep(state, query)
33616
- return state.nodeIndex === 0 // Specifically `0`, not falsey.
33574
+ function unknownOperator(query) {
33575
+ throw new Error('Unknown operator `' + query.operator + '`')
33617
33576
  }
33618
33577
 
33578
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
33619
33579
  /**
33620
- * @param {RulePseudo} query
33621
- * @param {Node} _1
33622
- * @param {number|null} _2
33623
- * @param {Parent|null} _3
33624
- * @param {SelectState} state
33625
- * @returns {boolean}
33580
+ * @typedef {import('./types.js').Rule} Rule
33581
+ * @typedef {import('./types.js').Node} Node
33626
33582
  */
33627
- function lastChild(query, _1, _2, _3, state) {
33628
- assertDeep(state, query)
33629
- return state.nodeIndex === state.nodeCount - 1
33630
- }
33631
33583
 
33632
33584
  /**
33633
- * @param {RulePseudo} query
33634
- * @param {Node} _1
33635
- * @param {number|null} _2
33636
- * @param {Parent|null} _3
33637
- * @param {SelectState} state
33638
- * @returns {boolean}
33585
+ * @param {Rule} query
33586
+ * @param {Node} node
33639
33587
  */
33640
- function onlyChild(query, _1, _2, _3, state) {
33641
- assertDeep(state, query)
33642
- return state.nodeCount === 1
33588
+ function name_name(query, node) {
33589
+ return query.tagName === '*' || query.tagName === node.type
33643
33590
  }
33644
33591
 
33592
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
33645
33593
  /**
33646
- * @param {RulePseudoNth} query
33647
- * @param {Node} _1
33648
- * @param {number|null} _2
33649
- * @param {Parent|null} _3
33650
- * @param {SelectState} state
33651
- * @returns {boolean}
33594
+ * @typedef {import('./types.js').Rule} Rule
33595
+ * @typedef {import('./types.js').Node} Node
33596
+ * @typedef {import('./types.js').Parent} Parent
33597
+ * @typedef {import('./types.js').SelectState} SelectState
33652
33598
  */
33653
- function nthChild(query, _1, _2, _3, state) {
33654
- assertDeep(state, query)
33655
- return query.value(state.nodeIndex)
33656
- }
33599
+
33600
+
33601
+
33602
+
33657
33603
 
33658
33604
  /**
33659
- * @param {RulePseudoNth} query
33660
- * @param {Node} _1
33661
- * @param {number|null} _2
33662
- * @param {Parent|null} _3
33605
+ * @param {Rule} query
33606
+ * @param {Node} node
33607
+ * @param {number|null} index
33608
+ * @param {Parent|null} parent
33663
33609
  * @param {SelectState} state
33664
33610
  * @returns {boolean}
33665
33611
  */
33666
- function nthLastChild(query, _1, _2, _3, state) {
33667
- assertDeep(state, query)
33668
- return query.value(state.nodeCount - state.nodeIndex - 1)
33612
+ function test(query, node, index, parent, state) {
33613
+ if (query.id) throw new Error('Invalid selector: id')
33614
+ if (query.classNames) throw new Error('Invalid selector: class')
33615
+
33616
+ return Boolean(
33617
+ node &&
33618
+ (!query.tagName || name_name(query, node)) &&
33619
+ (!query.attrs || attribute(query, node)) &&
33620
+ (!query.pseudos || pseudo(query, node, index, parent, state))
33621
+ )
33669
33622
  }
33670
33623
 
33624
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
33671
33625
  /**
33672
- * @param {RulePseudoNth} query
33673
- * @param {Node} _1
33674
- * @param {number|null} _2
33675
- * @param {Parent|null} _3
33676
- * @param {SelectState} state
33677
- * @returns {boolean}
33626
+ * @typedef {import('./types.js').Selector} Selector
33627
+ * @typedef {import('./types.js').Selectors} Selectors
33628
+ * @typedef {import('./types.js').Rule} Rule
33629
+ * @typedef {import('./types.js').RuleSet} RuleSet
33630
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
33631
+ * @typedef {import('./types.js').Query} Query
33632
+ * @typedef {import('./types.js').Node} Node
33633
+ * @typedef {import('./types.js').Parent} Parent
33634
+ * @typedef {import('./types.js').SelectIterator} SelectIterator
33635
+ * @typedef {import('./types.js').SelectState} SelectState
33678
33636
  */
33679
- function nthOfType(query, _1, _2, _3, state) {
33680
- assertDeep(state, query)
33681
- return query.value(state.typeIndex)
33682
- }
33637
+
33638
+
33639
+
33640
+
33641
+
33642
+
33643
+
33644
+ var type = zwitch('type', {
33645
+ unknown: unknownType,
33646
+ invalid: invalidType,
33647
+ handlers: {selectors, ruleSet, rule}
33648
+ })
33683
33649
 
33684
33650
  /**
33685
- * @param {RulePseudoNth} query
33686
- * @param {Node} _1
33687
- * @param {number|null} _2
33688
- * @param {Parent|null} _3
33651
+ * @param {Selectors|RuleSet|Rule} query
33652
+ * @param {Node} node
33689
33653
  * @param {SelectState} state
33690
- * @returns {boolean}
33691
33654
  */
33692
- function nthLastOfType(query, _1, _2, _3, state) {
33693
- assertDeep(state, query)
33694
- return query.value(state.typeCount - 1 - state.typeIndex)
33655
+ function any(query, node, state) {
33656
+ // @ts-ignore zwitch types are off.
33657
+ return query && node ? type(query, node, state) : []
33695
33658
  }
33696
33659
 
33697
33660
  /**
33698
- * @param {RulePseudo} query
33699
- * @param {Node} _1
33700
- * @param {number|null} _2
33701
- * @param {Parent|null} _3
33661
+ * @param {Selectors} query
33662
+ * @param {Node} node
33702
33663
  * @param {SelectState} state
33703
- * @returns {boolean}
33704
33664
  */
33705
- function firstOfType(query, _1, _2, _3, state) {
33706
- assertDeep(state, query)
33707
- return state.typeIndex === 0
33665
+ function selectors(query, node, state) {
33666
+ var collect = collector(state.one)
33667
+ var index = -1
33668
+
33669
+ while (++index < query.selectors.length) {
33670
+ collect(ruleSet(query.selectors[index], node, state))
33671
+ }
33672
+
33673
+ return collect.result
33708
33674
  }
33709
33675
 
33710
33676
  /**
33711
- * @param {RulePseudo} query
33712
- * @param {Node} _1
33713
- * @param {number|null} _2
33714
- * @param {Parent|null} _3
33677
+ * @param {RuleSet} query
33678
+ * @param {Node} node
33715
33679
  * @param {SelectState} state
33716
- * @returns {boolean}
33717
33680
  */
33718
- function lastOfType(query, _1, _2, _3, state) {
33719
- assertDeep(state, query)
33720
- return state.typeIndex === state.typeCount - 1
33681
+ function ruleSet(query, node, state) {
33682
+ return rule(query.rule, node, state)
33721
33683
  }
33722
33684
 
33723
33685
  /**
33724
- * @param {RulePseudo} query
33725
- * @param {Node} _1
33726
- * @param {number|null} _2
33727
- * @param {Parent|null} _3
33686
+ * @param {Rule} query
33687
+ * @param {Node} tree
33728
33688
  * @param {SelectState} state
33729
- * @returns {boolean}
33730
33689
  */
33731
- function onlyOfType(query, _1, _2, _3, state) {
33732
- assertDeep(state, query)
33733
- return state.typeCount === 1
33734
- }
33690
+ function rule(query, tree, state) {
33691
+ var collect = collector(state.one)
33735
33692
 
33736
- // Shouldn’t be invoked, parser gives correct data.
33737
- /* c8 ignore next 3 */
33738
- function invalidPseudo() {
33739
- throw new Error('Invalid pseudo-selector')
33693
+ if (state.shallow && query.rule) {
33694
+ throw new Error('Expected selector without nesting')
33695
+ }
33696
+
33697
+ nest(
33698
+ query,
33699
+ tree,
33700
+ 0,
33701
+ null,
33702
+ configure(query, {
33703
+ scopeNodes: root(tree) ? tree.children : [tree],
33704
+ index: false,
33705
+ iterator,
33706
+ one: state.one,
33707
+ shallow: state.shallow,
33708
+ any: state.any
33709
+ })
33710
+ )
33711
+
33712
+ return collect.result
33713
+
33714
+ /** @type {SelectIterator} */
33715
+ function iterator(query, node, index, parent, state) {
33716
+ if (test(query, node, index, parent, state)) {
33717
+ if ('rule' in query) {
33718
+ nest(query.rule, node, index, parent, configure(query.rule, state))
33719
+ } else {
33720
+ collect(node)
33721
+ state.found = true
33722
+ }
33723
+ }
33724
+ }
33740
33725
  }
33741
33726
 
33742
33727
  /**
33743
- * @param {RulePseudo} query
33744
- * @returns {boolean}
33728
+ * @template {SelectState} S
33729
+ * @param {Rule} query
33730
+ * @param {S} state
33731
+ * @returns {S}
33745
33732
  */
33746
- function unknownPseudo(query) {
33747
- if (query.name) {
33748
- throw new Error('Unknown pseudo-selector `' + query.name + '`')
33733
+ function configure(query, state) {
33734
+ var pseudos = query.pseudos || []
33735
+ var index = -1
33736
+
33737
+ while (++index < pseudos.length) {
33738
+ if (pseudo.needsIndex.includes(pseudos[index].name)) {
33739
+ state.index = true
33740
+ break
33741
+ }
33749
33742
  }
33750
33743
 
33751
- throw new Error('Unexpected pseudo-element or empty pseudo-class')
33744
+ return state
33752
33745
  }
33753
33746
 
33747
+ // Shouldn’t be invoked, all data is handled.
33748
+ /* c8 ignore next 6 */
33754
33749
  /**
33755
- * @param {SelectState} state
33756
- * @param {RulePseudo|RulePseudoNth} query
33750
+ * @param {{[x: string]: unknown, type: string}} query
33757
33751
  */
33758
- function assertDeep(state, query) {
33759
- if (state.shallow) {
33760
- throw new Error('Cannot use `:' + query.name + '` without parent')
33761
- }
33752
+ function unknownType(query) {
33753
+ throw new Error('Unknown type `' + query.type + '`')
33754
+ }
33755
+
33756
+ // Shouldn’t be invoked, parser gives correct data.
33757
+ /* c8 ignore next 3 */
33758
+ function invalidType() {
33759
+ throw new Error('Invalid type')
33762
33760
  }
33763
33761
 
33764
33762
  /**
33765
- * @param {RulePseudoSelector} query
33766
- * @param {Node} node
33767
- * @param {number|null} _1
33768
- * @param {Parent|null} _2
33769
- * @param {SelectState} state
33770
- * @returns {boolean}
33763
+ * @param {boolean} one
33771
33764
  */
33772
- function hasSelector(query, node, _1, _2, state) {
33773
- var shallow = state.shallow
33774
- var one = state.one
33775
- var scopeNodes = state.scopeNodes
33776
- var value = appendScope(query.value)
33777
- var anything = state.any
33765
+ function collector(one) {
33766
+ /** @type {Array.<Node>} */
33767
+ var result = []
33778
33768
  /** @type {boolean} */
33779
- var result
33780
-
33781
- state.shallow = false
33782
- state.one = true
33783
- state.scopeNodes = [node]
33784
-
33785
- result = Boolean(anything(value, node, state)[0])
33786
-
33787
- state.shallow = shallow
33788
- state.one = one
33789
- state.scopeNodes = scopeNodes
33769
+ var found
33790
33770
 
33791
- return result
33792
- }
33771
+ collect.result = result
33793
33772
 
33794
- /**
33795
- * @param {Selector} value
33796
- */
33797
- function appendScope(value) {
33798
- /** @type {Selectors} */
33799
- var selector =
33800
- value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
33801
- var index = -1
33802
- /** @type {Rule} */
33803
- var rule
33773
+ return collect
33804
33774
 
33805
- while (++index < selector.selectors.length) {
33806
- rule = selector.selectors[index].rule
33807
- rule.nestingOperator = null
33775
+ /**
33776
+ * Append nodes to array, filtering out duplicates.
33777
+ *
33778
+ * @param {Node|Array.<Node>} node
33779
+ */
33780
+ function collect(node) {
33781
+ var index = -1
33808
33782
 
33809
- // Needed if new pseudo’s are added that accepts commas (such as
33810
- // `:lang(en, nl)`)
33811
- /* c8 ignore else */
33812
- if (
33813
- !rule.pseudos ||
33814
- rule.pseudos.length !== 1 ||
33815
- rule.pseudos[0].name !== 'scope'
33816
- ) {
33817
- selector.selectors[index] = {
33818
- type: 'ruleSet',
33819
- rule: {
33820
- type: 'rule',
33821
- rule,
33822
- // @ts-ignore pseudos are fine w/ just a name!
33823
- pseudos: [{name: 'scope'}]
33824
- }
33783
+ if ('length' in node) {
33784
+ while (++index < node.length) {
33785
+ collectOne(node[index])
33825
33786
  }
33787
+ } else {
33788
+ collectOne(node)
33826
33789
  }
33827
33790
  }
33828
33791
 
33829
- return selector
33792
+ /**
33793
+ * @param {Node} node
33794
+ */
33795
+ function collectOne(node) {
33796
+ if (one) {
33797
+ /* Shouldn’t happen, safeguards performance problems. */
33798
+ /* c8 ignore next */
33799
+ if (found) throw new Error('Cannot collect multiple nodes')
33800
+
33801
+ found = true
33802
+ }
33803
+
33804
+ if (!result.includes(node)) result.push(node)
33805
+ }
33830
33806
  }
33831
33807
 
33832
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
33808
+ // EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
33809
+ var lib = __webpack_require__(8079);
33810
+ // EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
33811
+ var nth_check_lib = __webpack_require__(7540);
33812
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
33833
33813
  /**
33814
+ * @typedef {import('./types.js').Selector} Selector
33815
+ * @typedef {import('./types.js').Selectors} Selectors
33816
+ * @typedef {import('./types.js').RuleSet} RuleSet
33834
33817
  * @typedef {import('./types.js').Rule} Rule
33835
- * @typedef {import('./types.js').RuleAttr} RuleAttr
33836
- * @typedef {import('./types.js').Node} Node
33818
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
33819
+ * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33837
33820
  */
33838
33821
 
33839
33822
 
33840
33823
 
33841
- var attribute_handle = zwitch('operator', {
33842
- unknown: unknownOperator,
33843
- invalid: exists,
33844
- handlers: {
33845
- '=': exact,
33846
- '^=': begins,
33847
- '$=': ends,
33848
- '*=': containsString,
33849
- '~=': containsArray
33850
- }
33851
- })
33824
+
33825
+
33826
+ /** @type {import('nth-check').default} */
33827
+ // @ts-ignore
33828
+ var nthCheck = nth_check_lib/* default */.ZP
33829
+
33830
+ var nth = new Set([
33831
+ 'nth-child',
33832
+ 'nth-last-child',
33833
+ 'nth-of-type',
33834
+ 'nth-last-of-type'
33835
+ ])
33836
+
33837
+ var parser = new lib/* CssSelectorParser */.N()
33838
+
33839
+ parser.registerAttrEqualityMods('~', '^', '$', '*')
33840
+ parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
33841
+ parser.registerNestingOperators('>', '+', '~')
33842
+
33843
+ var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
33852
33844
 
33853
33845
  /**
33854
- * @param {Rule} query
33855
- * @param {Node} node
33846
+ * @param {string} selector
33847
+ * @returns {Selector}
33856
33848
  */
33857
- function attribute(query, node) {
33858
- var index = -1
33859
-
33860
- while (++index < query.attrs.length) {
33861
- if (!attribute_handle(query.attrs[index], node)) return false
33849
+ function parse(selector) {
33850
+ if (typeof selector !== 'string') {
33851
+ throw new TypeError('Expected `string` as selector, not `' + selector + '`')
33862
33852
  }
33863
33853
 
33864
- return true
33854
+ // @ts-ignore types are wrong.
33855
+ return compile(parser.parse(selector))
33865
33856
  }
33866
33857
 
33867
33858
  /**
33868
- * `[attr]`
33869
- *
33870
- * @param {RuleAttr} query
33871
- * @param {Node} node
33859
+ * @param {Selectors} query
33872
33860
  */
33873
- function exists(query, node) {
33874
- return node[query.name] !== null && node[query.name] !== undefined
33861
+ function parse_selectors(query) {
33862
+ var selectors = query.selectors
33863
+ var index = -1
33864
+
33865
+ while (++index < selectors.length) {
33866
+ compile(selectors[index])
33867
+ }
33868
+
33869
+ return query
33875
33870
  }
33876
33871
 
33877
33872
  /**
33878
- * `[attr=value]`
33879
- *
33880
- * @param {RuleAttr} query
33881
- * @param {Node} node
33873
+ * @param {RuleSet} query
33882
33874
  */
33883
- function exact(query, node) {
33884
- return exists(query, node) && String(node[query.name]) === query.value
33875
+ function parse_ruleSet(query) {
33876
+ return parse_rule(query.rule)
33885
33877
  }
33886
33878
 
33887
33879
  /**
33888
- * `[attr~=value]`
33889
- *
33890
- * @param {RuleAttr} query
33891
- * @param {Node} node
33880
+ * @param {Rule} query
33892
33881
  */
33893
- function containsArray(query, node) {
33894
- var value = node[query.name]
33895
-
33896
- if (value === null || value === undefined) return false
33897
-
33898
- // If this is an array, and the query is contained in it, return true.
33899
- // Coverage comment in place because TS turns `Array.isArray(unknown)`
33900
- // into `Array.<any>` instead of `Array.<unknown>`.
33901
- // type-coverage:ignore-next-line
33902
- if (Array.isArray(value) && value.includes(query.value)) {
33903
- return true
33904
- }
33882
+ function parse_rule(query) {
33883
+ var pseudos = query.pseudos || []
33884
+ var index = -1
33885
+ /** @type {RulePseudo|RulePseudoNth} */
33886
+ var pseudo
33905
33887
 
33906
- // For all other values, return whether this is an exact match.
33907
- return String(value) === query.value
33908
- }
33888
+ while (++index < pseudos.length) {
33889
+ pseudo = pseudos[index]
33909
33890
 
33910
- /**
33911
- * `[attr^=value]`
33912
- *
33913
- * @param {RuleAttr} query
33914
- * @param {Node} node
33915
- */
33916
- function begins(query, node) {
33917
- var value = node[query.name]
33891
+ if (nth.has(pseudo.name)) {
33892
+ // @ts-ignore Patch a non-primitive type.
33893
+ pseudo.value = nthCheck(pseudo.value)
33894
+ // @ts-ignore Patch a non-primitive type.
33895
+ pseudo.valueType = 'function'
33896
+ }
33897
+ }
33918
33898
 
33919
- return (
33920
- typeof value === 'string' &&
33921
- value.slice(0, query.value.length) === query.value
33922
- )
33899
+ compile(query.rule)
33900
+
33901
+ return query
33923
33902
  }
33924
33903
 
33904
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
33925
33905
  /**
33926
- * `[attr$=value]`
33927
- *
33928
- * @param {RuleAttr} query
33929
- * @param {Node} node
33906
+ * @typedef {import('unist').Node} Node
33930
33907
  */
33931
- function ends(query, node) {
33932
- var value = node[query.name]
33933
33908
 
33934
- return (
33935
- typeof value === 'string' &&
33936
- value.slice(-query.value.length) === query.value
33937
- )
33938
- }
33939
33909
 
33940
- /**
33941
- * `[attr*=value]`
33942
- *
33943
- * @param {RuleAttr} query
33944
- * @param {Node} node
33945
- */
33946
- function containsString(query, node) {
33947
- var value = node[query.name]
33948
- return typeof value === 'string' && value.includes(query.value)
33949
- }
33950
33910
 
33951
- // Shouldn’t be invoked, Parser throws an error instead.
33952
- /* c8 ignore next 6 */
33911
+
33953
33912
  /**
33954
- * @param {{[x: string]: unknown, type: string}} query
33913
+ * @param {string} selector
33914
+ * @param {Node} [node]
33915
+ * @returns {boolean}
33955
33916
  */
33956
- function unknownOperator(query) {
33957
- throw new Error('Unknown operator `' + query.operator + '`')
33917
+ function unist_util_select_matches(selector, node) {
33918
+ return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
33958
33919
  }
33959
33920
 
33960
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
33961
33921
  /**
33962
- * @typedef {import('./types.js').Rule} Rule
33963
- * @typedef {import('./types.js').Node} Node
33922
+ * @param {string} selector
33923
+ * @param {Node} [node]
33924
+ * @returns {Node|null}
33964
33925
  */
33926
+ function unist_util_select_select(selector, node) {
33927
+ return any(parse(selector), node, {one: true, any: any})[0] || null
33928
+ }
33965
33929
 
33966
33930
  /**
33967
- * @param {Rule} query
33968
- * @param {Node} node
33931
+ * @param {string} selector
33932
+ * @param {Node} [node]
33933
+ * @returns {Array.<Node>}
33969
33934
  */
33970
- function name_name(query, node) {
33971
- return query.tagName === '*' || query.tagName === node.type
33935
+ function selectAll(selector, node) {
33936
+ return any(parse(selector), node, {any: any})
33972
33937
  }
33973
33938
 
33974
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
33975
- /**
33976
- * @typedef {import('./types.js').Rule} Rule
33977
- * @typedef {import('./types.js').Node} Node
33978
- * @typedef {import('./types.js').Parent} Parent
33979
- * @typedef {import('./types.js').SelectState} SelectState
33980
- */
33981
33939
 
33940
+ /***/ }),
33941
+
33942
+ /***/ 6393:
33943
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
33982
33944
 
33945
+ "use strict";
33946
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33947
+ /* harmony export */ "Vn": () => (/* binding */ visit)
33948
+ /* harmony export */ });
33949
+ /* harmony import */ var unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5605);
33950
+ /**
33951
+ * @typedef {import('unist').Node} Node
33952
+ * @typedef {import('unist').Parent} Parent
33953
+ * @typedef {import('unist-util-is').Test} Test
33954
+ * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
33955
+ * @typedef {import('./complex-types.js').Visitor} Visitor
33956
+ */
33983
33957
 
33984
33958
 
33985
33959
 
33986
33960
  /**
33987
- * @param {Rule} query
33988
- * @param {Node} node
33989
- * @param {number|null} index
33990
- * @param {Parent|null} parent
33991
- * @param {SelectState} state
33992
- * @returns {boolean}
33961
+ * Visit children of tree which pass test.
33962
+ *
33963
+ * @param tree
33964
+ * Tree to walk
33965
+ * @param [test]
33966
+ * `unist-util-is`-compatible test
33967
+ * @param visitor
33968
+ * Function called for nodes that pass `test`.
33969
+ * @param reverse
33970
+ * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
33993
33971
  */
33994
- function test(query, node, index, parent, state) {
33995
- if (query.id) throw new Error('Invalid selector: id')
33996
- if (query.classNames) throw new Error('Invalid selector: class')
33972
+ const visit =
33973
+ /**
33974
+ * @type {(
33975
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
33976
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
33977
+ * )}
33978
+ */
33979
+ (
33980
+ /**
33981
+ * @param {Node} tree
33982
+ * @param {Test} test
33983
+ * @param {import('./complex-types.js').Visitor} visitor
33984
+ * @param {boolean} [reverse]
33985
+ */
33986
+ function (tree, test, visitor, reverse) {
33987
+ if (typeof test === 'function' && typeof visitor !== 'function') {
33988
+ reverse = visitor
33989
+ visitor = test
33990
+ test = null
33991
+ }
33997
33992
 
33998
- return Boolean(
33999
- node &&
34000
- (!query.tagName || name_name(query, node)) &&
34001
- (!query.attrs || attribute(query, node)) &&
34002
- (!query.pseudos || pseudo(query, node, index, parent, state))
33993
+ (0,unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__/* .visitParents */ .S4)(tree, test, overload, reverse)
33994
+
33995
+ /**
33996
+ * @param {Node} node
33997
+ * @param {Array<Parent>} parents
33998
+ */
33999
+ function overload(node, parents) {
34000
+ const parent = parents[parents.length - 1]
34001
+ return visitor(
34002
+ node,
34003
+ parent ? parent.children.indexOf(node) : null,
34004
+ parent
34005
+ )
34006
+ }
34007
+ }
34003
34008
  )
34004
- }
34005
34009
 
34006
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
34007
- /**
34008
- * @typedef {import('./types.js').Selector} Selector
34009
- * @typedef {import('./types.js').Selectors} Selectors
34010
- * @typedef {import('./types.js').Rule} Rule
34011
- * @typedef {import('./types.js').RuleSet} RuleSet
34012
- * @typedef {import('./types.js').RulePseudo} RulePseudo
34013
- * @typedef {import('./types.js').Query} Query
34014
- * @typedef {import('./types.js').Node} Node
34015
- * @typedef {import('./types.js').Parent} Parent
34016
- * @typedef {import('./types.js').SelectIterator} SelectIterator
34017
- * @typedef {import('./types.js').SelectState} SelectState
34018
- */
34019
34010
 
34020
34011
 
34021
34012
 
34013
+ /***/ }),
34022
34014
 
34015
+ /***/ 5605:
34016
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
34023
34017
 
34018
+ "use strict";
34024
34019
 
34020
+ // EXPORTS
34021
+ __webpack_require__.d(__webpack_exports__, {
34022
+ "AM": () => (/* binding */ SKIP),
34023
+ "S4": () => (/* binding */ visitParents)
34024
+ });
34025
34025
 
34026
- var type = zwitch('type', {
34027
- unknown: unknownType,
34028
- invalid: invalidType,
34029
- handlers: {selectors, ruleSet, rule}
34030
- })
34026
+ // UNUSED EXPORTS: CONTINUE, EXIT
34031
34027
 
34028
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
34032
34029
  /**
34033
- * @param {Selectors|RuleSet|Rule} query
34034
- * @param {Node} node
34035
- * @param {SelectState} state
34030
+ * @typedef {import('unist').Node} Node
34031
+ * @typedef {import('unist').Parent} Parent
34032
+ *
34033
+ * @typedef {string} Type
34034
+ * @typedef {Object<string, unknown>} Props
34035
+ *
34036
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
34036
34037
  */
34037
- function any(query, node, state) {
34038
- // @ts-ignore zwitch types are off.
34039
- return query && node ? type(query, node, state) : []
34040
- }
34041
34038
 
34042
34039
  /**
34043
- * @param {Selectors} query
34040
+ * Check if a node passes a test
34041
+ *
34042
+ * @callback TestFunctionAnything
34044
34043
  * @param {Node} node
34045
- * @param {SelectState} state
34044
+ * @param {number|null|undefined} [index]
34045
+ * @param {Parent|null|undefined} [parent]
34046
+ * @returns {boolean|void}
34046
34047
  */
34047
- function selectors(query, node, state) {
34048
- var collect = collector(state.one)
34049
- var index = -1
34050
-
34051
- while (++index < query.selectors.length) {
34052
- collect(ruleSet(query.selectors[index], node, state))
34053
- }
34054
-
34055
- return collect.result
34056
- }
34057
34048
 
34058
34049
  /**
34059
- * @param {RuleSet} query
34050
+ * Check if a node passes a certain node test
34051
+ *
34052
+ * @template {Node} X
34053
+ * @callback TestFunctionPredicate
34060
34054
  * @param {Node} node
34061
- * @param {SelectState} state
34055
+ * @param {number|null|undefined} [index]
34056
+ * @param {Parent|null|undefined} [parent]
34057
+ * @returns {node is X}
34062
34058
  */
34063
- function ruleSet(query, node, state) {
34064
- return rule(query.rule, node, state)
34065
- }
34066
34059
 
34067
34060
  /**
34068
- * @param {Rule} query
34069
- * @param {Node} tree
34070
- * @param {SelectState} state
34061
+ * @callback AssertAnything
34062
+ * @param {unknown} [node]
34063
+ * @param {number|null|undefined} [index]
34064
+ * @param {Parent|null|undefined} [parent]
34065
+ * @returns {boolean}
34071
34066
  */
34072
- function rule(query, tree, state) {
34073
- var collect = collector(state.one)
34074
34067
 
34075
- if (state.shallow && query.rule) {
34076
- throw new Error('Expected selector without nesting')
34077
- }
34068
+ /**
34069
+ * Check if a node passes a certain node test
34070
+ *
34071
+ * @template {Node} Y
34072
+ * @callback AssertPredicate
34073
+ * @param {unknown} [node]
34074
+ * @param {number|null|undefined} [index]
34075
+ * @param {Parent|null|undefined} [parent]
34076
+ * @returns {node is Y}
34077
+ */
34078
34078
 
34079
- nest(
34080
- query,
34081
- tree,
34082
- 0,
34083
- null,
34084
- configure(query, {
34085
- scopeNodes: root(tree) ? tree.children : [tree],
34086
- index: false,
34087
- iterator,
34088
- one: state.one,
34089
- shallow: state.shallow,
34090
- any: state.any
34091
- })
34092
- )
34079
+ const is =
34080
+ /**
34081
+ * Check if a node passes a test.
34082
+ * When a `parent` node is known the `index` of node should also be given.
34083
+ *
34084
+ * @type {(
34085
+ * (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => node is T) &
34086
+ * ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
34087
+ * )}
34088
+ */
34089
+ (
34090
+ /**
34091
+ * Check if a node passes a test.
34092
+ * When a `parent` node is known the `index` of node should also be given.
34093
+ *
34094
+ * @param {unknown} [node] Node to check
34095
+ * @param {Test} [test]
34096
+ * When nullish, checks if `node` is a `Node`.
34097
+ * When `string`, works like passing `function (node) {return node.type === test}`.
34098
+ * When `function` checks if function passed the node is true.
34099
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
34100
+ * When `array`, checks any one of the subtests pass.
34101
+ * @param {number|null|undefined} [index] Position of `node` in `parent`
34102
+ * @param {Parent|null|undefined} [parent] Parent of `node`
34103
+ * @param {unknown} [context] Context object to invoke `test` with
34104
+ * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
34105
+ */
34106
+ // eslint-disable-next-line max-params
34107
+ function is(node, test, index, parent, context) {
34108
+ const check = convert(test)
34093
34109
 
34094
- return collect.result
34110
+ if (
34111
+ index !== undefined &&
34112
+ index !== null &&
34113
+ (typeof index !== 'number' ||
34114
+ index < 0 ||
34115
+ index === Number.POSITIVE_INFINITY)
34116
+ ) {
34117
+ throw new Error('Expected positive finite index')
34118
+ }
34095
34119
 
34096
- /** @type {SelectIterator} */
34097
- function iterator(query, node, index, parent, state) {
34098
- if (test(query, node, index, parent, state)) {
34099
- if ('rule' in query) {
34100
- nest(query.rule, node, index, parent, configure(query.rule, state))
34101
- } else {
34102
- collect(node)
34103
- state.found = true
34120
+ if (
34121
+ parent !== undefined &&
34122
+ parent !== null &&
34123
+ (!is(parent) || !parent.children)
34124
+ ) {
34125
+ throw new Error('Expected parent node')
34104
34126
  }
34105
- }
34106
- }
34107
- }
34108
34127
 
34109
- /**
34110
- * @template {SelectState} S
34111
- * @param {Rule} query
34112
- * @param {S} state
34113
- * @returns {S}
34114
- */
34115
- function configure(query, state) {
34116
- var pseudos = query.pseudos || []
34117
- var index = -1
34128
+ if (
34129
+ (parent === undefined || parent === null) !==
34130
+ (index === undefined || index === null)
34131
+ ) {
34132
+ throw new Error('Expected both parent and index')
34133
+ }
34118
34134
 
34119
- while (++index < pseudos.length) {
34120
- if (pseudo.needsIndex.includes(pseudos[index].name)) {
34121
- state.index = true
34122
- break
34135
+ // @ts-expect-error Looks like a node.
34136
+ return node && node.type && typeof node.type === 'string'
34137
+ ? Boolean(check.call(context, node, index, parent))
34138
+ : false
34123
34139
  }
34124
- }
34140
+ )
34125
34141
 
34126
- return state
34127
- }
34142
+ const convert =
34143
+ /**
34144
+ * @type {(
34145
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
34146
+ * ((test?: Test) => AssertAnything)
34147
+ * )}
34148
+ */
34149
+ (
34150
+ /**
34151
+ * Generate an assertion from a check.
34152
+ * @param {Test} [test]
34153
+ * When nullish, checks if `node` is a `Node`.
34154
+ * When `string`, works like passing `function (node) {return node.type === test}`.
34155
+ * When `function` checks if function passed the node is true.
34156
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
34157
+ * When `array`, checks any one of the subtests pass.
34158
+ * @returns {AssertAnything}
34159
+ */
34160
+ function (test) {
34161
+ if (test === undefined || test === null) {
34162
+ return ok
34163
+ }
34128
34164
 
34129
- // Shouldn’t be invoked, all data is handled.
34130
- /* c8 ignore next 6 */
34131
- /**
34132
- * @param {{[x: string]: unknown, type: string}} query
34133
- */
34134
- function unknownType(query) {
34135
- throw new Error('Unknown type `' + query.type + '`')
34136
- }
34165
+ if (typeof test === 'string') {
34166
+ return typeFactory(test)
34167
+ }
34137
34168
 
34138
- // Shouldn’t be invoked, parser gives correct data.
34139
- /* c8 ignore next 3 */
34140
- function invalidType() {
34141
- throw new Error('Invalid type')
34142
- }
34169
+ if (typeof test === 'object') {
34170
+ return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
34171
+ }
34172
+
34173
+ if (typeof test === 'function') {
34174
+ return castFactory(test)
34175
+ }
34143
34176
 
34177
+ throw new Error('Expected function, string, or object as test')
34178
+ }
34179
+ )
34144
34180
  /**
34145
- * @param {boolean} one
34181
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
34182
+ * @returns {AssertAnything}
34146
34183
  */
34147
- function collector(one) {
34148
- /** @type {Array.<Node>} */
34149
- var result = []
34150
- /** @type {boolean} */
34151
- var found
34184
+ function anyFactory(tests) {
34185
+ /** @type {Array.<AssertAnything>} */
34186
+ const checks = []
34187
+ let index = -1
34152
34188
 
34153
- collect.result = result
34189
+ while (++index < tests.length) {
34190
+ checks[index] = convert(tests[index])
34191
+ }
34154
34192
 
34155
- return collect
34193
+ return castFactory(any)
34156
34194
 
34157
34195
  /**
34158
- * Append nodes to array, filtering out duplicates.
34159
- *
34160
- * @param {Node|Array.<Node>} node
34196
+ * @this {unknown}
34197
+ * @param {unknown[]} parameters
34198
+ * @returns {boolean}
34161
34199
  */
34162
- function collect(node) {
34163
- var index = -1
34200
+ function any(...parameters) {
34201
+ let index = -1
34164
34202
 
34165
- if ('length' in node) {
34166
- while (++index < node.length) {
34167
- collectOne(node[index])
34168
- }
34169
- } else {
34170
- collectOne(node)
34203
+ while (++index < checks.length) {
34204
+ if (checks[index].call(this, ...parameters)) return true
34171
34205
  }
34206
+
34207
+ return false
34172
34208
  }
34209
+ }
34210
+
34211
+ /**
34212
+ * Utility to assert each property in `test` is represented in `node`, and each
34213
+ * values are strictly equal.
34214
+ *
34215
+ * @param {Props} check
34216
+ * @returns {AssertAnything}
34217
+ */
34218
+ function propsFactory(check) {
34219
+ return castFactory(all)
34173
34220
 
34174
34221
  /**
34175
34222
  * @param {Node} node
34223
+ * @returns {boolean}
34176
34224
  */
34177
- function collectOne(node) {
34178
- if (one) {
34179
- /* Shouldn’t happen, safeguards performance problems. */
34180
- /* c8 ignore next */
34181
- if (found) throw new Error('Cannot collect multiple nodes')
34225
+ function all(node) {
34226
+ /** @type {string} */
34227
+ let key
34182
34228
 
34183
- found = true
34229
+ for (key in check) {
34230
+ // @ts-expect-error: hush, it sure works as an index.
34231
+ if (node[key] !== check[key]) return false
34184
34232
  }
34185
34233
 
34186
- if (!result.includes(node)) result.push(node)
34234
+ return true
34187
34235
  }
34188
34236
  }
34189
34237
 
34190
- // EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
34191
- var lib = __webpack_require__(8079);
34192
- // EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
34193
- var nth_check_lib = __webpack_require__(7540);
34194
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
34195
34238
  /**
34196
- * @typedef {import('./types.js').Selector} Selector
34197
- * @typedef {import('./types.js').Selectors} Selectors
34198
- * @typedef {import('./types.js').RuleSet} RuleSet
34199
- * @typedef {import('./types.js').Rule} Rule
34200
- * @typedef {import('./types.js').RulePseudo} RulePseudo
34201
- * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
34239
+ * Utility to convert a string into a function which checks a given node’s type
34240
+ * for said string.
34241
+ *
34242
+ * @param {Type} check
34243
+ * @returns {AssertAnything}
34202
34244
  */
34245
+ function typeFactory(check) {
34246
+ return castFactory(type)
34203
34247
 
34204
-
34205
-
34206
-
34207
-
34208
- /** @type {import('nth-check').default} */
34209
- // @ts-ignore
34210
- var nthCheck = nth_check_lib/* default */.ZP
34211
-
34212
- var nth = new Set([
34213
- 'nth-child',
34214
- 'nth-last-child',
34215
- 'nth-of-type',
34216
- 'nth-last-of-type'
34217
- ])
34218
-
34219
- var parser = new lib/* CssSelectorParser */.N()
34220
-
34221
- parser.registerAttrEqualityMods('~', '^', '$', '*')
34222
- parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
34223
- parser.registerNestingOperators('>', '+', '~')
34224
-
34225
- var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
34248
+ /**
34249
+ * @param {Node} node
34250
+ */
34251
+ function type(node) {
34252
+ return node && node.type === check
34253
+ }
34254
+ }
34226
34255
 
34227
34256
  /**
34228
- * @param {string} selector
34229
- * @returns {Selector}
34257
+ * Utility to convert a string into a function which checks a given node’s type
34258
+ * for said string.
34259
+ * @param {TestFunctionAnything} check
34260
+ * @returns {AssertAnything}
34230
34261
  */
34231
- function parse(selector) {
34232
- if (typeof selector !== 'string') {
34233
- throw new TypeError('Expected `string` as selector, not `' + selector + '`')
34262
+ function castFactory(check) {
34263
+ return assertion
34264
+
34265
+ /**
34266
+ * @this {unknown}
34267
+ * @param {Array.<unknown>} parameters
34268
+ * @returns {boolean}
34269
+ */
34270
+ function assertion(...parameters) {
34271
+ // @ts-expect-error: spreading is fine.
34272
+ return Boolean(check.call(this, ...parameters))
34234
34273
  }
34274
+ }
34275
+
34276
+ // Utility to return true.
34277
+ function ok() {
34278
+ return true
34279
+ }
34235
34280
 
34236
- // @ts-ignore types are wrong.
34237
- return compile(parser.parse(selector))
34281
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.browser.js
34282
+ /**
34283
+ * @param {string} d
34284
+ * @returns {string}
34285
+ */
34286
+ function color(d) {
34287
+ return d
34238
34288
  }
34239
34289
 
34290
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
34240
34291
  /**
34241
- * @param {Selectors} query
34292
+ * @typedef {import('unist').Node} Node
34293
+ * @typedef {import('unist').Parent} Parent
34294
+ * @typedef {import('unist-util-is').Test} Test
34295
+ * @typedef {import('./complex-types.js').Action} Action
34296
+ * @typedef {import('./complex-types.js').Index} Index
34297
+ * @typedef {import('./complex-types.js').ActionTuple} ActionTuple
34298
+ * @typedef {import('./complex-types.js').VisitorResult} VisitorResult
34299
+ * @typedef {import('./complex-types.js').Visitor} Visitor
34242
34300
  */
34243
- function parse_selectors(query) {
34244
- var selectors = query.selectors
34245
- var index = -1
34246
34301
 
34247
- while (++index < selectors.length) {
34248
- compile(selectors[index])
34249
- }
34250
34302
 
34251
- return query
34252
- }
34303
+
34253
34304
 
34254
34305
  /**
34255
- * @param {RuleSet} query
34306
+ * Continue traversing as normal
34256
34307
  */
34257
- function parse_ruleSet(query) {
34258
- return parse_rule(query.rule)
34259
- }
34308
+ const CONTINUE = true
34309
+ /**
34310
+ * Do not traverse this node’s children
34311
+ */
34312
+ const SKIP = 'skip'
34313
+ /**
34314
+ * Stop traversing immediately
34315
+ */
34316
+ const EXIT = false
34260
34317
 
34261
34318
  /**
34262
- * @param {Rule} query
34319
+ * Visit children of tree which pass test.
34320
+ *
34321
+ * @param tree
34322
+ * Tree to walk
34323
+ * @param [test]
34324
+ * `unist-util-is`-compatible test
34325
+ * @param visitor
34326
+ * Function called for nodes that pass `test`.
34327
+ * @param [reverse=false]
34328
+ * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
34263
34329
  */
34264
- function parse_rule(query) {
34265
- var pseudos = query.pseudos || []
34266
- var index = -1
34267
- /** @type {RulePseudo|RulePseudoNth} */
34268
- var pseudo
34330
+ const visitParents =
34331
+ /**
34332
+ * @type {(
34333
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
34334
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
34335
+ * )}
34336
+ */
34337
+ (
34338
+ /**
34339
+ * @param {Node} tree
34340
+ * @param {Test} test
34341
+ * @param {import('./complex-types.js').Visitor<Node>} visitor
34342
+ * @param {boolean} [reverse=false]
34343
+ */
34344
+ function (tree, test, visitor, reverse) {
34345
+ if (typeof test === 'function' && typeof visitor !== 'function') {
34346
+ reverse = visitor
34347
+ // @ts-expect-error no visitor given, so `visitor` is test.
34348
+ visitor = test
34349
+ test = null
34350
+ }
34269
34351
 
34270
- while (++index < pseudos.length) {
34271
- pseudo = pseudos[index]
34352
+ const is = convert(test)
34353
+ const step = reverse ? -1 : 1
34272
34354
 
34273
- if (nth.has(pseudo.name)) {
34274
- // @ts-ignore Patch a non-primitive type.
34275
- pseudo.value = nthCheck(pseudo.value)
34276
- // @ts-ignore Patch a non-primitive type.
34277
- pseudo.valueType = 'function'
34278
- }
34279
- }
34355
+ factory(tree, null, [])()
34280
34356
 
34281
- compile(query.rule)
34357
+ /**
34358
+ * @param {Node} node
34359
+ * @param {number?} index
34360
+ * @param {Array<Parent>} parents
34361
+ */
34362
+ function factory(node, index, parents) {
34363
+ /** @type {Record<string, unknown>} */
34364
+ // @ts-expect-error: hush
34365
+ const value = typeof node === 'object' && node !== null ? node : {}
34366
+ /** @type {string|undefined} */
34367
+ let name
34282
34368
 
34283
- return query
34284
- }
34369
+ if (typeof value.type === 'string') {
34370
+ name =
34371
+ typeof value.tagName === 'string'
34372
+ ? value.tagName
34373
+ : typeof value.name === 'string'
34374
+ ? value.name
34375
+ : undefined
34285
34376
 
34286
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
34287
- /**
34288
- * @typedef {import('unist').Node} Node
34289
- */
34377
+ Object.defineProperty(visit, 'name', {
34378
+ value:
34379
+ 'node (' +
34380
+ color(value.type + (name ? '<' + name + '>' : '')) +
34381
+ ')'
34382
+ })
34383
+ }
34384
+
34385
+ return visit
34290
34386
 
34387
+ function visit() {
34388
+ /** @type {ActionTuple} */
34389
+ let result = []
34390
+ /** @type {ActionTuple} */
34391
+ let subresult
34392
+ /** @type {number} */
34393
+ let offset
34394
+ /** @type {Array<Parent>} */
34395
+ let grandparents
34291
34396
 
34397
+ if (!test || is(node, index, parents[parents.length - 1] || null)) {
34398
+ result = toResult(visitor(node, parents))
34292
34399
 
34400
+ if (result[0] === EXIT) {
34401
+ return result
34402
+ }
34403
+ }
34293
34404
 
34294
- /**
34295
- * @param {string} selector
34296
- * @param {Node} [node]
34297
- * @returns {boolean}
34298
- */
34299
- function unist_util_select_matches(selector, node) {
34300
- return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
34301
- }
34405
+ // @ts-expect-error looks like a parent.
34406
+ if (node.children && result[0] !== SKIP) {
34407
+ // @ts-expect-error looks like a parent.
34408
+ offset = (reverse ? node.children.length : -1) + step
34409
+ // @ts-expect-error looks like a parent.
34410
+ grandparents = parents.concat(node)
34302
34411
 
34303
- /**
34304
- * @param {string} selector
34305
- * @param {Node} [node]
34306
- * @returns {Node|null}
34307
- */
34308
- function unist_util_select_select(selector, node) {
34309
- return any(parse(selector), node, {one: true, any: any})[0] || null
34310
- }
34412
+ // @ts-expect-error looks like a parent.
34413
+ while (offset > -1 && offset < node.children.length) {
34414
+ // @ts-expect-error looks like a parent.
34415
+ subresult = factory(node.children[offset], offset, grandparents)()
34416
+
34417
+ if (subresult[0] === EXIT) {
34418
+ return subresult
34419
+ }
34420
+
34421
+ offset =
34422
+ typeof subresult[1] === 'number' ? subresult[1] : offset + step
34423
+ }
34424
+ }
34425
+
34426
+ return result
34427
+ }
34428
+ }
34429
+ }
34430
+ )
34311
34431
 
34312
34432
  /**
34313
- * @param {string} selector
34314
- * @param {Node} [node]
34315
- * @returns {Array.<Node>}
34433
+ * @param {VisitorResult} value
34434
+ * @returns {ActionTuple}
34316
34435
  */
34317
- function selectAll(selector, node) {
34318
- return any(parse(selector), node, {any: any})
34436
+ function toResult(value) {
34437
+ if (Array.isArray(value)) {
34438
+ return value
34439
+ }
34440
+
34441
+ if (typeof value === 'number') {
34442
+ return [CONTINUE, value]
34443
+ }
34444
+
34445
+ return [value]
34319
34446
  }
34320
34447
 
34321
34448
 
@@ -34485,32 +34612,69 @@ var __webpack_exports__ = {};
34485
34612
  // This entry need to be wrapped in an IIFE because it need to be in strict mode.
34486
34613
  (() => {
34487
34614
  "use strict";
34615
+ // ESM COMPAT FLAG
34488
34616
  __webpack_require__.r(__webpack_exports__);
34489
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
34490
- /* harmony export */ "Components": () => (/* binding */ Components),
34491
- /* harmony export */ "astToPlainText": () => (/* binding */ astToPlainText),
34492
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
34493
- /* harmony export */ "hast": () => (/* binding */ hast),
34494
- /* harmony export */ "html": () => (/* binding */ html),
34495
- /* harmony export */ "htmlProcessor": () => (/* binding */ htmlProcessor),
34496
- /* harmony export */ "md": () => (/* binding */ md),
34497
- /* harmony export */ "mdast": () => (/* binding */ mdast),
34498
- /* harmony export */ "plain": () => (/* binding */ plain),
34499
- /* harmony export */ "processor": () => (/* binding */ processor),
34500
- /* harmony export */ "react": () => (/* binding */ react),
34501
- /* harmony export */ "reactProcessor": () => (/* binding */ reactProcessor),
34502
- /* harmony export */ "reactTOC": () => (/* binding */ reactTOC),
34503
- /* harmony export */ "setup": () => (/* binding */ setup),
34504
- /* harmony export */ "utils": () => (/* binding */ utils)
34505
- /* harmony export */ });
34506
- /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2982);
34507
- /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1037);
34508
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2167);
34509
34617
 
34618
+ // EXPORTS
34619
+ __webpack_require__.d(__webpack_exports__, {
34620
+ "Components": () => (/* binding */ Components),
34621
+ "astToPlainText": () => (/* binding */ astToPlainText),
34622
+ "default": () => (/* binding */ index),
34623
+ "hast": () => (/* binding */ hast),
34624
+ "html": () => (/* binding */ html),
34625
+ "htmlProcessor": () => (/* binding */ htmlProcessor),
34626
+ "md": () => (/* binding */ md),
34627
+ "mdast": () => (/* binding */ mdast),
34628
+ "plain": () => (/* binding */ plain),
34629
+ "processor": () => (/* binding */ processor),
34630
+ "react": () => (/* binding */ react),
34631
+ "reactProcessor": () => (/* binding */ reactProcessor),
34632
+ "reactTOC": () => (/* binding */ reactTOC),
34633
+ "setup": () => (/* binding */ setup),
34634
+ "utils": () => (/* binding */ utils)
34635
+ });
34636
+
34637
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
34638
+ var slicedToArray = __webpack_require__(1037);
34639
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
34640
+ function _objectWithoutPropertiesLoose(source, excluded) {
34641
+ if (source == null) return {};
34642
+ var target = {};
34643
+ var sourceKeys = Object.keys(source);
34644
+ var key, i;
34645
+ for (i = 0; i < sourceKeys.length; i++) {
34646
+ key = sourceKeys[i];
34647
+ if (excluded.indexOf(key) >= 0) continue;
34648
+ target[key] = source[key];
34649
+ }
34650
+ return target;
34651
+ }
34652
+ ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
34653
+
34654
+ function _objectWithoutProperties(source, excluded) {
34655
+ if (source == null) return {};
34656
+ var target = _objectWithoutPropertiesLoose(source, excluded);
34657
+ var key, i;
34658
+ if (Object.getOwnPropertySymbols) {
34659
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
34660
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
34661
+ key = sourceSymbolKeys[i];
34662
+ if (excluded.indexOf(key) >= 0) continue;
34663
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
34664
+ target[key] = source[key];
34665
+ }
34666
+ }
34667
+ return target;
34668
+ }
34669
+ // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js + 2 modules
34670
+ var defineProperty = __webpack_require__(2167);
34671
+ ;// CONCATENATED MODULE: ./index.js
34510
34672
 
34511
34673
 
34674
+
34675
+ var _excluded = ["reusableContent"];
34512
34676
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
34513
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
34677
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0,defineProperty/* default */.Z)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
34514
34678
  /* eslint-disable no-param-reassign */
34515
34679
  __webpack_require__(2787);
34516
34680
  var Variable = __webpack_require__(3689);
@@ -34538,17 +34702,17 @@ var _require3 = __webpack_require__(8447),
34538
34702
  var BaseUrlContext = __webpack_require__(6785);
34539
34703
  var createElement = __webpack_require__(5894);
34540
34704
  var CustomParsers = Object.values(__webpack_require__(8521));
34541
- var customCompilers = Object.values(__webpack_require__(9647));
34705
+ var customCompilers = Object.values(__webpack_require__(8457));
34542
34706
  var registerCustomComponents = __webpack_require__(1264);
34543
34707
  var _require4 = __webpack_require__(2531),
34544
34708
  options = _require4.options,
34545
34709
  parseOptions = _require4.parseOptions;
34546
- var _require5 = __webpack_require__(8160),
34710
+ var _require5 = __webpack_require__(6284),
34547
34711
  calloutIcons = _require5.icons;
34548
34712
  var toPlainText = __webpack_require__(4792);
34549
34713
  var sectionAnchorId = __webpack_require__(9620);
34550
34714
  var tableFlattening = __webpack_require__(4625);
34551
- var _require6 = __webpack_require__(3628),
34715
+ var _require6 = __webpack_require__(2692),
34552
34716
  remarkTransformers = _require6.remarkTransformers,
34553
34717
  rehypeTransformers = _require6.rehypeTransformers;
34554
34718
  var createSchema = __webpack_require__(8229);
@@ -34598,34 +34762,53 @@ var utils = {
34598
34762
  calloutIcons: calloutIcons
34599
34763
  };
34600
34764
 
34765
+ /**
34766
+ * Pre-parse reusable content blocks. Note that they do not pass the content
34767
+ * blocks recursively.
34768
+ */
34769
+ var parseReusableContent = function parseReusableContent(_ref) {
34770
+ var reusableContent = _ref.reusableContent,
34771
+ opts = _objectWithoutProperties(_ref, _excluded);
34772
+ var parsedReusableContent = Object.entries(reusableContent).reduce(function (memo, _ref2) {
34773
+ var _ref3 = (0,slicedToArray/* default */.Z)(_ref2, 2),
34774
+ name = _ref3[0],
34775
+ content = _ref3[1];
34776
+ // eslint-disable-next-line no-use-before-define
34777
+ memo[name] = mdast(content, opts).children;
34778
+ return memo;
34779
+ }, {});
34780
+ return [parsedReusableContent, opts];
34781
+ };
34782
+
34601
34783
  /**
34602
34784
  * Core markdown to mdast processor
34603
34785
  */
34604
34786
  function processor() {
34605
- var _unified$use$use$data;
34606
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34607
- var _setup = setup('', opts);
34608
- var _setup2 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup, 2);
34609
- opts = _setup2[1];
34610
- var _opts = opts,
34611
- sanitize = _opts.sanitize;
34612
- return (_unified$use$use$data = unified().use(remarkParse, opts.markdownOptions).use(remarkFrontmatter, ['yaml', 'toml']).data('settings', opts.settings).data('compatibilityMode', opts.compatibilityMode).data('alwaysThrow', opts.alwaysThrow).use(!opts.correctnewlines ? remarkBreaks : function () {}).use(CustomParsers.map(function (parser) {
34787
+ var userOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34788
+ var _setup = setup('', userOpts),
34789
+ _setup2 = (0,slicedToArray/* default */.Z)(_setup, 2),
34790
+ parsedOpts = _setup2[1];
34791
+ var sanitize = parsedOpts.sanitize;
34792
+ var _parseReusableContent = parseReusableContent(parsedOpts),
34793
+ _parseReusableContent2 = (0,slicedToArray/* default */.Z)(_parseReusableContent, 2),
34794
+ reusableContent = _parseReusableContent2[0],
34795
+ opts = _parseReusableContent2[1];
34796
+ return unified().use(remarkParse, opts.markdownOptions).use(remarkFrontmatter, ['yaml', 'toml']).data('settings', opts.settings).data('compatibilityMode', opts.compatibilityMode).data('alwaysThrow', opts.alwaysThrow).data('reusableContent', reusableContent).use(!opts.correctnewlines ? remarkBreaks : function () {}).use(CustomParsers.map(function (parser) {
34613
34797
  var _parser$sanitize;
34614
34798
  return ((_parser$sanitize = parser.sanitize) === null || _parser$sanitize === void 0 ? void 0 : _parser$sanitize.call(parser, sanitize)) || parser;
34615
- }))).use.apply(_unified$use$use$data, (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(remarkTransformers)).use(remarkSlug).use(remarkDisableTokenizers, opts.disableTokenizers);
34799
+ })).use(remarkTransformers).use(remarkSlug).use(remarkDisableTokenizers, opts.disableTokenizers);
34616
34800
  }
34617
34801
 
34618
34802
  /**
34619
34803
  * Full markdown to html processor
34620
34804
  */
34621
34805
  function htmlProcessor() {
34622
- var _processor$use$use$us;
34623
34806
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34624
34807
  var _setup3 = setup('', opts);
34625
- var _setup4 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup3, 2);
34808
+ var _setup4 = (0,slicedToArray/* default */.Z)(_setup3, 2);
34626
34809
  opts = _setup4[1];
34627
- var _opts2 = opts,
34628
- sanitize = _opts2.sanitize;
34810
+ var _opts = opts,
34811
+ sanitize = _opts.sanitize;
34629
34812
 
34630
34813
  /*
34631
34814
  * This is kinda complicated: "markdown" within ReadMe is
@@ -34645,16 +34828,16 @@ function htmlProcessor() {
34645
34828
  * - sanitize and remove any disallowed attributes
34646
34829
  * - output the hast to a React vdom with our custom components
34647
34830
  */
34648
- return (_processor$use$use$us = processor(opts).use(remarkRehype, {
34831
+ return processor(opts).use(remarkRehype, {
34649
34832
  allowDangerousHtml: true
34650
- }).use(rehypeRaw).use(rehypeSanitize, sanitize)).use.apply(_processor$use$use$us, (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(rehypeTransformers));
34833
+ }).use(rehypeRaw).use(rehypeSanitize, sanitize).use(rehypeTransformers);
34651
34834
  }
34652
34835
  function plain(text) {
34653
34836
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34654
34837
  var components = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
34655
34838
  if (!text) return null;
34656
34839
  var _setup5 = setup(text, opts);
34657
- var _setup6 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup5, 2);
34840
+ var _setup6 = (0,slicedToArray/* default */.Z)(_setup5, 2);
34658
34841
  text = _setup6[0];
34659
34842
  opts = _setup6[1];
34660
34843
  var proc = htmlProcessor(opts).use(rehypeReact, {
@@ -34669,8 +34852,8 @@ function plain(text) {
34669
34852
  * return a React VDOM component tree
34670
34853
  */
34671
34854
  // eslint-disable-next-line react/prop-types
34672
- var PinWrap = function PinWrap(_ref) {
34673
- var children = _ref.children;
34855
+ var PinWrap = function PinWrap(_ref4) {
34856
+ var children = _ref4.children;
34674
34857
  return /*#__PURE__*/React.createElement("div", {
34675
34858
  className: "pin"
34676
34859
  }, children);
@@ -34680,10 +34863,10 @@ function reactProcessor() {
34680
34863
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
34681
34864
  var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34682
34865
  var _setup7 = setup('', opts);
34683
- var _setup8 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup7, 2);
34866
+ var _setup8 = (0,slicedToArray/* default */.Z)(_setup7, 2);
34684
34867
  opts = _setup8[1];
34685
- var _opts3 = opts,
34686
- sanitize = _opts3.sanitize;
34868
+ var _opts2 = opts,
34869
+ sanitize = _opts2.sanitize;
34687
34870
  return htmlProcessor(_objectSpread({}, opts)).use(sectionAnchorId).use(rehypeReact, {
34688
34871
  createElement: createElement(opts),
34689
34872
  Fragment: React.Fragment,
@@ -34714,12 +34897,12 @@ function react(content) {
34714
34897
  var components = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
34715
34898
  if (!content) return null;else if (typeof content === 'string') {
34716
34899
  var _setup9 = setup(content, opts);
34717
- var _setup10 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup9, 2);
34900
+ var _setup10 = (0,slicedToArray/* default */.Z)(_setup9, 2);
34718
34901
  content = _setup10[0];
34719
34902
  opts = _setup10[1];
34720
34903
  } else {
34721
34904
  var _setup11 = setup('', opts);
34722
- var _setup12 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup11, 2);
34905
+ var _setup12 = (0,slicedToArray/* default */.Z)(_setup11, 2);
34723
34906
  opts = _setup12[1];
34724
34907
  }
34725
34908
  var proc = reactProcessor(opts, components);
@@ -34730,7 +34913,7 @@ function reactTOC(tree) {
34730
34913
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34731
34914
  if (!tree) return null;
34732
34915
  var _setup13 = setup('', opts);
34733
- var _setup14 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup13, 2);
34916
+ var _setup14 = (0,slicedToArray/* default */.Z)(_setup13, 2);
34734
34917
  opts = _setup14[1];
34735
34918
  var proc = htmlProcessor(opts).use(rehypeReact, {
34736
34919
  createElement: React.createElement,
@@ -34742,8 +34925,8 @@ function reactTOC(tree) {
34742
34925
  });
34743
34926
 
34744
34927
  // Normalize Heading Levels
34745
- var minLevel = selectAll('heading', tree).reduce(function (i, _ref2) {
34746
- var depth = _ref2.depth;
34928
+ var minLevel = selectAll('heading', tree).reduce(function (i, _ref5) {
34929
+ var depth = _ref5.depth;
34747
34930
  return !i || depth <= i ? depth : i;
34748
34931
  }, false); // determine "root" depth
34749
34932
  tree = mapNodes(tree, function (n) {
@@ -34764,7 +34947,7 @@ function html(text) {
34764
34947
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34765
34948
  if (!text) return null;
34766
34949
  var _setup15 = setup(text, opts);
34767
- var _setup16 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup15, 2);
34950
+ var _setup16 = (0,slicedToArray/* default */.Z)(_setup15, 2);
34768
34951
  text = _setup16[0];
34769
34952
  opts = _setup16[1];
34770
34953
  return htmlProcessor(opts).use(rehypeStringify).processSync(text).contents;
@@ -34777,7 +34960,7 @@ function hast(text) {
34777
34960
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34778
34961
  if (!text) return null;
34779
34962
  var _setup17 = setup(text, opts);
34780
- var _setup18 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup17, 2);
34963
+ var _setup18 = (0,slicedToArray/* default */.Z)(_setup17, 2);
34781
34964
  text = _setup18[0];
34782
34965
  opts = _setup18[1];
34783
34966
  var rdmd = htmlProcessor(opts).use(tableFlattening);
@@ -34792,7 +34975,7 @@ function mdast(text) {
34792
34975
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34793
34976
  if (!text) return null;
34794
34977
  var _setup19 = setup(text, opts);
34795
- var _setup20 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup19, 2);
34978
+ var _setup20 = (0,slicedToArray/* default */.Z)(_setup19, 2);
34796
34979
  text = _setup20[0];
34797
34980
  opts = _setup20[1];
34798
34981
  var rdmd = processor(opts);
@@ -34806,7 +34989,7 @@ function astToPlainText(node) {
34806
34989
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34807
34990
  if (!node) return '';
34808
34991
  var _setup21 = setup('', opts);
34809
- var _setup22 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup21, 2);
34992
+ var _setup22 = (0,slicedToArray/* default */.Z)(_setup21, 2);
34810
34993
  opts = _setup22[1];
34811
34994
  return processor(opts).use(toPlainText).stringify(node);
34812
34995
  }
@@ -34818,7 +35001,7 @@ function md(tree) {
34818
35001
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34819
35002
  if (!tree) return null;
34820
35003
  var _setup23 = setup('', opts);
34821
- var _setup24 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(_setup23, 2);
35004
+ var _setup24 = (0,slicedToArray/* default */.Z)(_setup23, 2);
34822
35005
  opts = _setup24[1];
34823
35006
  return processor(opts).use(remarkStringify, opts.markdownOptions).use(customCompilers).stringify(tree);
34824
35007
  }
@@ -34826,7 +35009,7 @@ var ReadMeMarkdown = function ReadMeMarkdown(text) {
34826
35009
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34827
35010
  return react(text, opts);
34828
35011
  };
34829
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReadMeMarkdown);
35012
+ /* harmony default export */ const index = (ReadMeMarkdown);
34830
35013
  })();
34831
35014
 
34832
35015
  /******/ return __webpack_exports__;