@readme/markdown 6.68.0-beta.1 → 6.68.0-beta.3

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 +1977 -1949
  2. package/dist/main.node.js +1908 -1861
  3. package/package.json +1 -1
package/dist/main.node.js CHANGED
@@ -9154,64 +9154,94 @@ module.exports = function ImageCompiler() {
9154
9154
 
9155
9155
  /***/ }),
9156
9156
 
9157
- /***/ 9647:
9157
+ /***/ 8457:
9158
9158
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9159
9159
 
9160
9160
  "use strict";
9161
+ // ESM COMPAT FLAG
9161
9162
  __webpack_require__.r(__webpack_exports__);
9162
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9163
- /* harmony export */ "breakCompiler": () => (/* reexport default from dynamic */ _break__WEBPACK_IMPORTED_MODULE_0___default.a),
9164
- /* harmony export */ "codeTabsCompiler": () => (/* reexport default from dynamic */ _code_tabs__WEBPACK_IMPORTED_MODULE_1___default.a),
9165
- /* harmony export */ "divCompiler": () => (/* reexport default from dynamic */ _div__WEBPACK_IMPORTED_MODULE_2___default.a),
9166
- /* harmony export */ "escapeCompiler": () => (/* reexport default from dynamic */ _escape__WEBPACK_IMPORTED_MODULE_3___default.a),
9167
- /* harmony export */ "figureCompiler": () => (/* reexport default from dynamic */ _figure__WEBPACK_IMPORTED_MODULE_4___default.a),
9168
- /* harmony export */ "htmlBlockCompiler": () => (/* reexport default from dynamic */ _html_block__WEBPACK_IMPORTED_MODULE_5___default.a),
9169
- /* harmony export */ "iconCompiler": () => (/* reexport default from dynamic */ _i__WEBPACK_IMPORTED_MODULE_6___default.a),
9170
- /* harmony export */ "imageCompiler": () => (/* reexport default from dynamic */ _image__WEBPACK_IMPORTED_MODULE_7___default.a),
9171
- /* harmony export */ "rdmeCalloutCompiler": () => (/* reexport default from dynamic */ _callout__WEBPACK_IMPORTED_MODULE_8___default.a),
9172
- /* harmony export */ "rdmeEmbedCompiler": () => (/* reexport default from dynamic */ _embed__WEBPACK_IMPORTED_MODULE_9___default.a),
9173
- /* harmony export */ "rdmeGlossaryCompiler": () => (/* reexport default from dynamic */ _glossary__WEBPACK_IMPORTED_MODULE_10___default.a),
9174
- /* harmony export */ "rdmePinCompiler": () => (/* reexport default from dynamic */ _pin__WEBPACK_IMPORTED_MODULE_11___default.a),
9175
- /* harmony export */ "rdmeVarCompiler": () => (/* reexport default from dynamic */ _var__WEBPACK_IMPORTED_MODULE_12___default.a),
9176
- /* harmony export */ "reusableContentCompiler": () => (/* reexport default from dynamic */ _reusable_content__WEBPACK_IMPORTED_MODULE_13___default.a),
9177
- /* harmony export */ "tableCompiler": () => (/* reexport default from dynamic */ _table__WEBPACK_IMPORTED_MODULE_14___default.a),
9178
- /* harmony export */ "tableHeadCompiler": () => (/* reexport default from dynamic */ _table_head__WEBPACK_IMPORTED_MODULE_15___default.a),
9179
- /* harmony export */ "yamlCompiler": () => (/* reexport default from dynamic */ _yaml__WEBPACK_IMPORTED_MODULE_16___default.a)
9180
- /* harmony export */ });
9181
- /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3688);
9182
- /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_break__WEBPACK_IMPORTED_MODULE_0__);
9183
- /* harmony import */ var _code_tabs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4079);
9184
- /* harmony import */ var _code_tabs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_code_tabs__WEBPACK_IMPORTED_MODULE_1__);
9185
- /* harmony import */ var _div__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58);
9186
- /* harmony import */ var _div__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_div__WEBPACK_IMPORTED_MODULE_2__);
9187
- /* harmony import */ var _escape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8418);
9188
- /* harmony import */ var _escape__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_escape__WEBPACK_IMPORTED_MODULE_3__);
9189
- /* harmony import */ var _figure__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8705);
9190
- /* harmony import */ var _figure__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_figure__WEBPACK_IMPORTED_MODULE_4__);
9191
- /* harmony import */ var _html_block__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3551);
9192
- /* harmony import */ var _html_block__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_html_block__WEBPACK_IMPORTED_MODULE_5__);
9193
- /* harmony import */ var _i__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4258);
9194
- /* harmony import */ var _i__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_i__WEBPACK_IMPORTED_MODULE_6__);
9195
- /* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3356);
9196
- /* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_image__WEBPACK_IMPORTED_MODULE_7__);
9197
- /* harmony import */ var _callout__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5733);
9198
- /* harmony import */ var _callout__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_callout__WEBPACK_IMPORTED_MODULE_8__);
9199
- /* harmony import */ var _embed__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4338);
9200
- /* harmony import */ var _embed__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_embed__WEBPACK_IMPORTED_MODULE_9__);
9201
- /* harmony import */ var _glossary__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2459);
9202
- /* harmony import */ var _glossary__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_glossary__WEBPACK_IMPORTED_MODULE_10__);
9203
- /* harmony import */ var _pin__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(2151);
9204
- /* harmony import */ var _pin__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_pin__WEBPACK_IMPORTED_MODULE_11__);
9205
- /* harmony import */ var _var__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(1067);
9206
- /* harmony import */ var _var__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_var__WEBPACK_IMPORTED_MODULE_12__);
9207
- /* harmony import */ var _reusable_content__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(9585);
9208
- /* harmony import */ var _reusable_content__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_reusable_content__WEBPACK_IMPORTED_MODULE_13__);
9209
- /* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4669);
9210
- /* harmony import */ var _table__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_table__WEBPACK_IMPORTED_MODULE_14__);
9211
- /* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(186);
9212
- /* harmony import */ var _table_head__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_table_head__WEBPACK_IMPORTED_MODULE_15__);
9213
- /* harmony import */ var _yaml__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(1773);
9214
- /* harmony import */ var _yaml__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_yaml__WEBPACK_IMPORTED_MODULE_16__);
9163
+
9164
+ // EXPORTS
9165
+ __webpack_require__.d(__webpack_exports__, {
9166
+ "breakCompiler": () => (/* reexport */ (break_default())),
9167
+ "codeTabsCompiler": () => (/* reexport */ (code_tabs_default())),
9168
+ "divCompiler": () => (/* reexport */ (div_default())),
9169
+ "escapeCompiler": () => (/* reexport */ (escape_default())),
9170
+ "figureCompiler": () => (/* reexport */ (figure_default())),
9171
+ "htmlBlockCompiler": () => (/* reexport */ (html_block_default())),
9172
+ "iconCompiler": () => (/* reexport */ (i_default())),
9173
+ "imageCompiler": () => (/* reexport */ (image_default())),
9174
+ "rdmeCalloutCompiler": () => (/* reexport */ (callout_default())),
9175
+ "rdmeEmbedCompiler": () => (/* reexport */ (embed_default())),
9176
+ "rdmeGlossaryCompiler": () => (/* reexport */ (glossary_default())),
9177
+ "rdmePinCompiler": () => (/* reexport */ (pin_default())),
9178
+ "rdmeVarCompiler": () => (/* reexport */ (var_default())),
9179
+ "reusableContentCompiler": () => (/* reexport */ ReusableContentCompiler),
9180
+ "tableCompiler": () => (/* reexport */ (table_default())),
9181
+ "tableHeadCompiler": () => (/* reexport */ (table_head_default())),
9182
+ "yamlCompiler": () => (/* reexport */ (yaml_default()))
9183
+ });
9184
+
9185
+ // EXTERNAL MODULE: ./processor/compile/break.js
9186
+ var compile_break = __webpack_require__(3688);
9187
+ var break_default = /*#__PURE__*/__webpack_require__.n(compile_break);
9188
+ // EXTERNAL MODULE: ./processor/compile/code-tabs.js
9189
+ var code_tabs = __webpack_require__(4079);
9190
+ var code_tabs_default = /*#__PURE__*/__webpack_require__.n(code_tabs);
9191
+ // EXTERNAL MODULE: ./processor/compile/div.js
9192
+ var div = __webpack_require__(58);
9193
+ var div_default = /*#__PURE__*/__webpack_require__.n(div);
9194
+ // EXTERNAL MODULE: ./processor/compile/escape.js
9195
+ var compile_escape = __webpack_require__(8418);
9196
+ var escape_default = /*#__PURE__*/__webpack_require__.n(compile_escape);
9197
+ // EXTERNAL MODULE: ./processor/compile/figure.js
9198
+ var figure = __webpack_require__(8705);
9199
+ var figure_default = /*#__PURE__*/__webpack_require__.n(figure);
9200
+ // EXTERNAL MODULE: ./processor/compile/html-block.js
9201
+ var html_block = __webpack_require__(3551);
9202
+ var html_block_default = /*#__PURE__*/__webpack_require__.n(html_block);
9203
+ // EXTERNAL MODULE: ./processor/compile/i.js
9204
+ var i = __webpack_require__(4258);
9205
+ var i_default = /*#__PURE__*/__webpack_require__.n(i);
9206
+ // EXTERNAL MODULE: ./processor/compile/image.js
9207
+ var compile_image = __webpack_require__(3356);
9208
+ var image_default = /*#__PURE__*/__webpack_require__.n(compile_image);
9209
+ // EXTERNAL MODULE: ./processor/compile/callout.js
9210
+ var callout = __webpack_require__(5733);
9211
+ var callout_default = /*#__PURE__*/__webpack_require__.n(callout);
9212
+ // EXTERNAL MODULE: ./processor/compile/embed.js
9213
+ var compile_embed = __webpack_require__(4338);
9214
+ var embed_default = /*#__PURE__*/__webpack_require__.n(compile_embed);
9215
+ // EXTERNAL MODULE: ./processor/compile/glossary.js
9216
+ var glossary = __webpack_require__(2459);
9217
+ var glossary_default = /*#__PURE__*/__webpack_require__.n(glossary);
9218
+ // EXTERNAL MODULE: ./processor/compile/pin.js
9219
+ var pin = __webpack_require__(2151);
9220
+ var pin_default = /*#__PURE__*/__webpack_require__.n(pin);
9221
+ // EXTERNAL MODULE: ./processor/compile/var.js
9222
+ var compile_var = __webpack_require__(1067);
9223
+ var var_default = /*#__PURE__*/__webpack_require__.n(compile_var);
9224
+ // EXTERNAL MODULE: ./processor/transform/reusable-content.js
9225
+ var reusable_content = __webpack_require__(5772);
9226
+ ;// CONCATENATED MODULE: ./processor/compile/reusable-content.js
9227
+
9228
+ function ReusableContentCompiler() {
9229
+ var Compiler = this.Compiler;
9230
+ var visitors = Compiler.prototype.visitors;
9231
+ visitors[reusable_content/* type */.dt] = function (node) {
9232
+ return "<".concat(reusable_content/* tag */._q, " name=\"").concat(node.name, "\" />");
9233
+ };
9234
+ }
9235
+ // EXTERNAL MODULE: ./processor/compile/table.js
9236
+ var table = __webpack_require__(4669);
9237
+ var table_default = /*#__PURE__*/__webpack_require__.n(table);
9238
+ // EXTERNAL MODULE: ./processor/compile/table-head.js
9239
+ var table_head = __webpack_require__(186);
9240
+ var table_head_default = /*#__PURE__*/__webpack_require__.n(table_head);
9241
+ // EXTERNAL MODULE: ./processor/compile/yaml.js
9242
+ var yaml = __webpack_require__(1773);
9243
+ var yaml_default = /*#__PURE__*/__webpack_require__.n(yaml);
9244
+ ;// CONCATENATED MODULE: ./processor/compile/index.js
9215
9245
 
9216
9246
 
9217
9247
 
@@ -9246,19 +9276,6 @@ module.exports = function PinCompiler() {
9246
9276
 
9247
9277
  /***/ }),
9248
9278
 
9249
- /***/ 9585:
9250
- /***/ ((module) => {
9251
-
9252
- module.exports = function ReusableContentCompiler() {
9253
- var Compiler = this.Compiler;
9254
- var visitors = Compiler.prototype.visitors;
9255
- visitors['reusable-content'] = function (node) {
9256
- return "<ReadMeReusableContent name=\"".concat(node.name, "\" />");
9257
- };
9258
- };
9259
-
9260
- /***/ }),
9261
-
9262
9279
  /***/ 186:
9263
9280
  /***/ ((module) => {
9264
9281
 
@@ -10497,7 +10514,7 @@ module.exports.tableFlattening = transformer;
10497
10514
 
10498
10515
  /***/ }),
10499
10516
 
10500
- /***/ 1269:
10517
+ /***/ 2692:
10501
10518
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10502
10519
 
10503
10520
  "use strict";
@@ -10510,702 +10527,223 @@ __webpack_require__.d(__webpack_exports__, {
10510
10527
  "remarkTransformers": () => (/* binding */ remarkTransformers)
10511
10528
  });
10512
10529
 
10513
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/typeof.js
10514
- var helpers_typeof = __webpack_require__(8698);
10515
- var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof);
10516
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inherits.js
10517
- var inherits = __webpack_require__(1655);
10518
- var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);
10519
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/setPrototypeOf.js
10520
- var setPrototypeOf = __webpack_require__(6015);
10521
- var setPrototypeOf_default = /*#__PURE__*/__webpack_require__.n(setPrototypeOf);
10522
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
10523
- /**
10524
- * @typedef {import('unist').Node} Node
10525
- * @typedef {import('unist').Parent} Parent
10526
- *
10527
- * @typedef {string} Type
10528
- * @typedef {Object<string, unknown>} Props
10529
- *
10530
- * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
10531
- */
10532
-
10533
- /**
10534
- * Check if a node passes a test
10535
- *
10536
- * @callback TestFunctionAnything
10537
- * @param {Node} node
10538
- * @param {number|null|undefined} [index]
10539
- * @param {Parent|null|undefined} [parent]
10540
- * @returns {boolean|void}
10541
- */
10530
+ // EXTERNAL MODULE: ./processor/transform/reusable-content.js
10531
+ var reusable_content = __webpack_require__(5772);
10532
+ // EXTERNAL MODULE: ./node_modules/unist-util-visit/index.js
10533
+ var unist_util_visit = __webpack_require__(6393);
10534
+ ;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
10542
10535
 
10543
- /**
10544
- * Check if a node passes a certain node test
10545
- *
10546
- * @template {Node} X
10547
- * @callback TestFunctionPredicate
10548
- * @param {Node} node
10549
- * @param {number|null|undefined} [index]
10550
- * @param {Parent|null|undefined} [parent]
10551
- * @returns {node is X}
10552
- */
10536
+ var singleCodeTabs = function singleCodeTabs() {
10537
+ return function (tree) {
10538
+ (0,unist_util_visit/* visit */.Vn)(tree, function (node, index, parent) {
10539
+ if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
10540
+ Object.assign(node, {
10541
+ className: 'tab-panel',
10542
+ data: {
10543
+ hName: 'code',
10544
+ hProperties: {
10545
+ meta: node.meta,
10546
+ lang: node.lang
10547
+ }
10548
+ }
10549
+ });
10550
+ parent.children[index] = {
10551
+ type: 'code-tabs',
10552
+ className: 'tabs',
10553
+ data: {
10554
+ hName: 'div',
10555
+ hProperties: {
10556
+ className: ['code-tabs']
10557
+ }
10558
+ },
10559
+ children: [node]
10560
+ };
10561
+ }
10562
+ });
10563
+ return tree;
10564
+ };
10565
+ };
10566
+ /* harmony default export */ const single_code_tabs = (singleCodeTabs);
10567
+ // EXTERNAL MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js + 2 modules
10568
+ var unist_util_visit_parents = __webpack_require__(9445);
10569
+ ;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
10553
10570
 
10554
- /**
10555
- * @callback AssertAnything
10556
- * @param {unknown} [node]
10557
- * @param {number|null|undefined} [index]
10558
- * @param {Parent|null|undefined} [parent]
10559
- * @returns {boolean}
10560
- */
10571
+ var rxEscapedPipe = /\\\|/g;
10561
10572
 
10562
10573
  /**
10563
- * Check if a node passes a certain node test
10574
+ * HAST Transformer that finds all inline code nodes within table cells and
10575
+ * unescapes any escaped pipe chars so that the editor outputs them without
10576
+ * escape chars.
10564
10577
  *
10565
- * @template {Node} Y
10566
- * @callback AssertPredicate
10567
- * @param {unknown} [node]
10568
- * @param {number|null|undefined} [index]
10569
- * @param {Parent|null|undefined} [parent]
10570
- * @returns {node is Y}
10578
+ * This appears to be a bug with remark-parse < ~8
10571
10579
  */
10580
+ var tableCellInlineCode = function tableCellInlineCode() {
10581
+ return function (tree) {
10582
+ (0,unist_util_visit/* visit */.Vn)(tree, [{
10583
+ tagName: 'th'
10584
+ }, {
10585
+ tagName: 'td'
10586
+ }], function (tableCellNode) {
10587
+ (0,unist_util_visit/* visit */.Vn)(tableCellNode, {
10588
+ tagName: 'code'
10589
+ }, function (inlineCodeNode) {
10590
+ var textNode = inlineCodeNode.children[0];
10591
+ if (textNode && rxEscapedPipe.test(textNode.value)) {
10592
+ textNode.value = textNode.value.replace(rxEscapedPipe, '|');
10593
+ }
10594
+ });
10595
+ return unist_util_visit_parents/* SKIP */.AM;
10596
+ });
10597
+ };
10598
+ };
10599
+ /* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
10600
+ ;// CONCATENATED MODULE: ./processor/transform/index.js
10572
10601
 
10573
- const is =
10574
- /**
10575
- * Check if a node passes a test.
10576
- * When a `parent` node is known the `index` of node should also be given.
10577
- *
10578
- * @type {(
10579
- * (<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) &
10580
- * ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
10581
- * )}
10582
- */
10583
- (
10584
- /**
10585
- * Check if a node passes a test.
10586
- * When a `parent` node is known the `index` of node should also be given.
10587
- *
10588
- * @param {unknown} [node] Node to check
10589
- * @param {Test} [test]
10590
- * When nullish, checks if `node` is a `Node`.
10591
- * When `string`, works like passing `function (node) {return node.type === test}`.
10592
- * When `function` checks if function passed the node is true.
10593
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
10594
- * When `array`, checks any one of the subtests pass.
10595
- * @param {number|null|undefined} [index] Position of `node` in `parent`
10596
- * @param {Parent|null|undefined} [parent] Parent of `node`
10597
- * @param {unknown} [context] Context object to invoke `test` with
10598
- * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
10599
- */
10600
- // eslint-disable-next-line max-params
10601
- function is(node, test, index, parent, context) {
10602
- const check = convert(test)
10603
-
10604
- if (
10605
- index !== undefined &&
10606
- index !== null &&
10607
- (typeof index !== 'number' ||
10608
- index < 0 ||
10609
- index === Number.POSITIVE_INFINITY)
10610
- ) {
10611
- throw new Error('Expected positive finite index')
10612
- }
10613
-
10614
- if (
10615
- parent !== undefined &&
10616
- parent !== null &&
10617
- (!is(parent) || !parent.children)
10618
- ) {
10619
- throw new Error('Expected parent node')
10620
- }
10621
10602
 
10622
- if (
10623
- (parent === undefined || parent === null) !==
10624
- (index === undefined || index === null)
10625
- ) {
10626
- throw new Error('Expected both parent and index')
10627
- }
10628
10603
 
10629
- // @ts-expect-error Looks like a node.
10630
- return node && node.type && typeof node.type === 'string'
10631
- ? Boolean(check.call(context, node, index, parent))
10632
- : false
10633
- }
10634
- )
10604
+ var remarkTransformers = [single_code_tabs, reusable_content/* default */.ZP];
10605
+ var rehypeTransformers = [table_cell_inline_code];
10635
10606
 
10636
- const convert =
10637
- /**
10638
- * @type {(
10639
- * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
10640
- * ((test?: Test) => AssertAnything)
10641
- * )}
10642
- */
10643
- (
10644
- /**
10645
- * Generate an assertion from a check.
10646
- * @param {Test} [test]
10647
- * When nullish, checks if `node` is a `Node`.
10648
- * When `string`, works like passing `function (node) {return node.type === test}`.
10649
- * When `function` checks if function passed the node is true.
10650
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
10651
- * When `array`, checks any one of the subtests pass.
10652
- * @returns {AssertAnything}
10653
- */
10654
- function (test) {
10655
- if (test === undefined || test === null) {
10656
- return ok
10657
- }
10607
+ /***/ }),
10658
10608
 
10659
- if (typeof test === 'string') {
10660
- return typeFactory(test)
10661
- }
10609
+ /***/ 5772:
10610
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10662
10611
 
10663
- if (typeof test === 'object') {
10664
- return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
10665
- }
10612
+ "use strict";
10613
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10614
+ /* harmony export */ "ZP": () => (__WEBPACK_DEFAULT_EXPORT__),
10615
+ /* harmony export */ "_q": () => (/* binding */ tag),
10616
+ /* harmony export */ "dt": () => (/* binding */ type)
10617
+ /* harmony export */ });
10618
+ /* harmony import */ var unist_util_visit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6393);
10666
10619
 
10667
- if (typeof test === 'function') {
10668
- return castFactory(test)
10669
- }
10620
+ var type = 'reusable-content';
10621
+ var tag = 'RMReusableContent';
10622
+ var regexp = new RegExp("^\\s*<".concat(tag, " name=\"(?<name>.*)\" />\\s*$"));
10623
+ var reusableContentTransformer = function reusableContentTransformer() {
10624
+ var reusableContent = this.data('reusableContent');
10625
+ return function (tree) {
10626
+ (0,unist_util_visit__WEBPACK_IMPORTED_MODULE_0__/* .visit */ .Vn)(tree, 'html', function (node, index, parent) {
10627
+ var result = regexp.exec(node.value);
10628
+ if (!result || !result.groups.name) return;
10629
+ var name = result.groups.name;
10630
+ var block = {
10631
+ type: type,
10632
+ name: name,
10633
+ children: name in reusableContent ? reusableContent[name] : []
10634
+ };
10635
+ parent.children[index] = block;
10636
+ });
10637
+ return tree;
10638
+ };
10639
+ };
10640
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reusableContentTransformer);
10670
10641
 
10671
- throw new Error('Expected function, string, or object as test')
10672
- }
10673
- )
10674
- /**
10675
- * @param {Array.<Type|Props|TestFunctionAnything>} tests
10676
- * @returns {AssertAnything}
10677
- */
10678
- function anyFactory(tests) {
10679
- /** @type {Array.<AssertAnything>} */
10680
- const checks = []
10681
- let index = -1
10642
+ /***/ }),
10682
10643
 
10683
- while (++index < tests.length) {
10684
- checks[index] = convert(tests[index])
10685
- }
10644
+ /***/ 8229:
10645
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
10686
10646
 
10687
- return castFactory(any)
10688
-
10689
- /**
10690
- * @this {unknown}
10691
- * @param {unknown[]} parameters
10692
- * @returns {boolean}
10693
- */
10694
- function any(...parameters) {
10695
- let index = -1
10696
-
10697
- while (++index < checks.length) {
10698
- if (checks[index].call(this, ...parameters)) return true
10699
- }
10647
+ var _require = __webpack_require__(2781),
10648
+ defaultSchema = _require.defaultSchema;
10649
+ var createSchema = function createSchema() {
10650
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
10651
+ safeMode = _ref.safeMode;
10652
+ var schema = JSON.parse(JSON.stringify(defaultSchema));
10700
10653
 
10701
- return false
10654
+ // Sanitization Schema Defaults
10655
+ schema.clobberPrefix = '';
10656
+ schema.tagNames.push('span');
10657
+ schema.attributes['*'].push('class', 'className', 'align');
10658
+ if (!safeMode) {
10659
+ schema.attributes['*'].push('style');
10702
10660
  }
10703
- }
10661
+ schema.tagNames.push('rdme-pin');
10662
+ schema.tagNames.push('rdme-embed');
10663
+ schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
10664
+ schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
10665
+ schema.tagNames.push('figure');
10666
+ schema.tagNames.push('figcaption');
10667
+ schema.tagNames.push('input'); // allow GitHub-style todo lists
10668
+ schema.ancestors.input = ['li'];
10669
+ schema.tagNames.push('colgroup'); // wat
10670
+ schema.tagNames.push('col');
10671
+ return schema;
10672
+ };
10673
+ module.exports = createSchema;
10704
10674
 
10705
- /**
10706
- * Utility to assert each property in `test` is represented in `node`, and each
10707
- * values are strictly equal.
10708
- *
10709
- * @param {Props} check
10710
- * @returns {AssertAnything}
10711
- */
10712
- function propsFactory(check) {
10713
- return castFactory(all)
10675
+ /***/ }),
10714
10676
 
10715
- /**
10716
- * @param {Node} node
10717
- * @returns {boolean}
10718
- */
10719
- function all(node) {
10720
- /** @type {string} */
10721
- let key
10677
+ /***/ 8841:
10678
+ /***/ ((module) => {
10722
10679
 
10723
- for (key in check) {
10724
- // @ts-expect-error: hush, it sure works as an index.
10725
- if (node[key] !== check[key]) return false
10726
- }
10680
+ "use strict";
10727
10681
 
10728
- return true
10729
- }
10730
- }
10731
10682
 
10732
- /**
10733
- * Utility to convert a string into a function which checks a given node’s type
10734
- * for said string.
10735
- *
10736
- * @param {Type} check
10737
- * @returns {AssertAnything}
10738
- */
10739
- function typeFactory(check) {
10740
- return castFactory(type)
10683
+ module.exports = bail
10741
10684
 
10742
- /**
10743
- * @param {Node} node
10744
- */
10745
- function type(node) {
10746
- return node && node.type === check
10685
+ function bail(err) {
10686
+ if (err) {
10687
+ throw err
10747
10688
  }
10748
10689
  }
10749
10690
 
10750
- /**
10751
- * Utility to convert a string into a function which checks a given node’s type
10752
- * for said string.
10753
- * @param {TestFunctionAnything} check
10754
- * @returns {AssertAnything}
10755
- */
10756
- function castFactory(check) {
10757
- return assertion
10758
10691
 
10759
- /**
10760
- * @this {unknown}
10761
- * @param {Array.<unknown>} parameters
10762
- * @returns {boolean}
10763
- */
10764
- function assertion(...parameters) {
10765
- // @ts-expect-error: spreading is fine.
10766
- return Boolean(check.call(this, ...parameters))
10767
- }
10768
- }
10692
+ /***/ }),
10769
10693
 
10770
- // Utility to return true.
10771
- function ok() {
10772
- return true
10773
- }
10694
+ /***/ 1073:
10695
+ /***/ ((module) => {
10774
10696
 
10775
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.js
10776
- /**
10777
- * @param {string} d
10778
- * @returns {string}
10779
- */
10780
- function color(d) {
10781
- return '\u001B[33m' + d + '\u001B[39m'
10782
- }
10697
+ module.exports = {
10698
+ trueFunc: function trueFunc(){
10699
+ return true;
10700
+ },
10701
+ falseFunc: function falseFunc(){
10702
+ return false;
10703
+ }
10704
+ };
10783
10705
 
10784
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
10785
- /**
10786
- * @typedef {import('unist').Node} Node
10787
- * @typedef {import('unist').Parent} Parent
10788
- * @typedef {import('unist-util-is').Test} Test
10789
- * @typedef {import('./complex-types.js').Action} Action
10790
- * @typedef {import('./complex-types.js').Index} Index
10791
- * @typedef {import('./complex-types.js').ActionTuple} ActionTuple
10792
- * @typedef {import('./complex-types.js').VisitorResult} VisitorResult
10793
- * @typedef {import('./complex-types.js').Visitor} Visitor
10794
- */
10706
+ /***/ }),
10795
10707
 
10708
+ /***/ 932:
10709
+ /***/ ((module) => {
10796
10710
 
10711
+ "use strict";
10797
10712
 
10798
10713
 
10799
- /**
10800
- * Continue traversing as normal
10801
- */
10802
- const CONTINUE = true
10803
- /**
10804
- * Do not traverse this node’s children
10805
- */
10806
- const SKIP = 'skip'
10807
- /**
10808
- * Stop traversing immediately
10809
- */
10810
- const EXIT = false
10714
+ module.exports = ccount
10811
10715
 
10812
- /**
10813
- * Visit children of tree which pass test.
10814
- *
10815
- * @param tree
10816
- * Tree to walk
10817
- * @param [test]
10818
- * `unist-util-is`-compatible test
10819
- * @param visitor
10820
- * Function called for nodes that pass `test`.
10821
- * @param [reverse=false]
10822
- * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
10823
- */
10824
- const visitParents =
10825
- /**
10826
- * @type {(
10827
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
10828
- * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
10829
- * )}
10830
- */
10831
- (
10832
- /**
10833
- * @param {Node} tree
10834
- * @param {Test} test
10835
- * @param {import('./complex-types.js').Visitor<Node>} visitor
10836
- * @param {boolean} [reverse=false]
10837
- */
10838
- function (tree, test, visitor, reverse) {
10839
- if (typeof test === 'function' && typeof visitor !== 'function') {
10840
- reverse = visitor
10841
- // @ts-expect-error no visitor given, so `visitor` is test.
10842
- visitor = test
10843
- test = null
10844
- }
10716
+ function ccount(value, character) {
10717
+ var val = String(value)
10718
+ var count = 0
10719
+ var index
10845
10720
 
10846
- const is = convert(test)
10847
- const step = reverse ? -1 : 1
10721
+ if (typeof character !== 'string' || character.length !== 1) {
10722
+ throw new Error('Expected character')
10723
+ }
10848
10724
 
10849
- factory(tree, null, [])()
10725
+ index = val.indexOf(character)
10850
10726
 
10851
- /**
10852
- * @param {Node} node
10853
- * @param {number?} index
10854
- * @param {Array<Parent>} parents
10855
- */
10856
- function factory(node, index, parents) {
10857
- /** @type {Record<string, unknown>} */
10858
- // @ts-expect-error: hush
10859
- const value = typeof node === 'object' && node !== null ? node : {}
10860
- /** @type {string|undefined} */
10861
- let name
10727
+ while (index !== -1) {
10728
+ count++
10729
+ index = val.indexOf(character, index + 1)
10730
+ }
10862
10731
 
10863
- if (typeof value.type === 'string') {
10864
- name =
10865
- typeof value.tagName === 'string'
10866
- ? value.tagName
10867
- : typeof value.name === 'string'
10868
- ? value.name
10869
- : undefined
10732
+ return count
10733
+ }
10870
10734
 
10871
- Object.defineProperty(visit, 'name', {
10872
- value:
10873
- 'node (' +
10874
- color(value.type + (name ? '<' + name + '>' : '')) +
10875
- ')'
10876
- })
10877
- }
10878
10735
 
10879
- return visit
10736
+ /***/ }),
10880
10737
 
10881
- function visit() {
10882
- /** @type {ActionTuple} */
10883
- let result = []
10884
- /** @type {ActionTuple} */
10885
- let subresult
10886
- /** @type {number} */
10887
- let offset
10888
- /** @type {Array<Parent>} */
10889
- let grandparents
10738
+ /***/ 6313:
10739
+ /***/ ((module) => {
10890
10740
 
10891
- if (!test || is(node, index, parents[parents.length - 1] || null)) {
10892
- result = toResult(visitor(node, parents))
10741
+ var clone = (function() {
10742
+ 'use strict';
10893
10743
 
10894
- if (result[0] === EXIT) {
10895
- return result
10896
- }
10897
- }
10898
-
10899
- // @ts-expect-error looks like a parent.
10900
- if (node.children && result[0] !== SKIP) {
10901
- // @ts-expect-error looks like a parent.
10902
- offset = (reverse ? node.children.length : -1) + step
10903
- // @ts-expect-error looks like a parent.
10904
- grandparents = parents.concat(node)
10905
-
10906
- // @ts-expect-error looks like a parent.
10907
- while (offset > -1 && offset < node.children.length) {
10908
- // @ts-expect-error looks like a parent.
10909
- subresult = factory(node.children[offset], offset, grandparents)()
10910
-
10911
- if (subresult[0] === EXIT) {
10912
- return subresult
10913
- }
10914
-
10915
- offset =
10916
- typeof subresult[1] === 'number' ? subresult[1] : offset + step
10917
- }
10918
- }
10919
-
10920
- return result
10921
- }
10922
- }
10923
- }
10924
- )
10925
-
10926
- /**
10927
- * @param {VisitorResult} value
10928
- * @returns {ActionTuple}
10929
- */
10930
- function toResult(value) {
10931
- if (Array.isArray(value)) {
10932
- return value
10933
- }
10934
-
10935
- if (typeof value === 'number') {
10936
- return [CONTINUE, value]
10937
- }
10938
-
10939
- return [value]
10940
- }
10941
-
10942
- ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/index.js
10943
- /**
10944
- * @typedef {import('unist').Node} Node
10945
- * @typedef {import('unist').Parent} Parent
10946
- * @typedef {import('unist-util-is').Test} Test
10947
- * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
10948
- * @typedef {import('./complex-types.js').Visitor} Visitor
10949
- */
10950
-
10951
-
10952
-
10953
- /**
10954
- * Visit children of tree which pass test.
10955
- *
10956
- * @param tree
10957
- * Tree to walk
10958
- * @param [test]
10959
- * `unist-util-is`-compatible test
10960
- * @param visitor
10961
- * Function called for nodes that pass `test`.
10962
- * @param reverse
10963
- * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
10964
- */
10965
- const visit =
10966
- /**
10967
- * @type {(
10968
- * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
10969
- * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
10970
- * )}
10971
- */
10972
- (
10973
- /**
10974
- * @param {Node} tree
10975
- * @param {Test} test
10976
- * @param {import('./complex-types.js').Visitor} visitor
10977
- * @param {boolean} [reverse]
10978
- */
10979
- function (tree, test, visitor, reverse) {
10980
- if (typeof test === 'function' && typeof visitor !== 'function') {
10981
- reverse = visitor
10982
- visitor = test
10983
- test = null
10984
- }
10985
-
10986
- visitParents(tree, test, overload, reverse)
10987
-
10988
- /**
10989
- * @param {Node} node
10990
- * @param {Array<Parent>} parents
10991
- */
10992
- function overload(node, parents) {
10993
- const parent = parents[parents.length - 1]
10994
- return visitor(
10995
- node,
10996
- parent ? parent.children.indexOf(node) : null,
10997
- parent
10998
- )
10999
- }
11000
- }
11001
- )
11002
-
11003
-
11004
-
11005
- ;// CONCATENATED MODULE: ./processor/transform/reusable-content.js
11006
-
11007
-
11008
-
11009
- 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_default()(_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_default()(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" != typeof_default()(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); }
11010
-
11011
- var type = 'reusable-content';
11012
- var regexp = /*#__PURE__*/_wrapRegExp(/^\s*<ReadMeReusableContent name="(.*)" \/>\s*$/, {
11013
- name: 1
11014
- });
11015
- var reusableContentTransformer = function reusableContentTransformer() {
11016
- var reusableContent = this.data('reusableContent');
11017
- return function (tree) {
11018
- visit(tree, 'html', function (node, index, parent) {
11019
- var result = regexp.exec(node.value);
11020
- if (!result || !result.groups.name) return;
11021
- var name = result.groups.name;
11022
- var block = {
11023
- type: type,
11024
- name: name,
11025
- children: name in reusableContent ? reusableContent[name] : []
11026
- };
11027
- parent.children[index] = block;
11028
- });
11029
- return tree;
11030
- };
11031
- };
11032
- /* harmony default export */ const reusable_content = (reusableContentTransformer);
11033
- ;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
11034
-
11035
- var singleCodeTabs = function singleCodeTabs() {
11036
- return function (tree) {
11037
- visit(tree, function (node, index, parent) {
11038
- if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
11039
- Object.assign(node, {
11040
- className: 'tab-panel',
11041
- data: {
11042
- hName: 'code',
11043
- hProperties: {
11044
- meta: node.meta,
11045
- lang: node.lang
11046
- }
11047
- }
11048
- });
11049
- parent.children[index] = {
11050
- type: 'code-tabs',
11051
- className: 'tabs',
11052
- data: {
11053
- hName: 'div',
11054
- hProperties: {
11055
- className: ['code-tabs']
11056
- }
11057
- },
11058
- children: [node]
11059
- };
11060
- }
11061
- });
11062
- return tree;
11063
- };
11064
- };
11065
- /* harmony default export */ const single_code_tabs = (singleCodeTabs);
11066
- ;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
11067
-
11068
- var rxEscapedPipe = /\\\|/g;
11069
-
11070
- /**
11071
- * HAST Transformer that finds all inline code nodes within table cells and
11072
- * unescapes any escaped pipe chars so that the editor outputs them without
11073
- * escape chars.
11074
- *
11075
- * This appears to be a bug with remark-parse < ~8
11076
- */
11077
- var tableCellInlineCode = function tableCellInlineCode() {
11078
- return function (tree) {
11079
- visit(tree, [{
11080
- tagName: 'th'
11081
- }, {
11082
- tagName: 'td'
11083
- }], function (tableCellNode) {
11084
- visit(tableCellNode, {
11085
- tagName: 'code'
11086
- }, function (inlineCodeNode) {
11087
- var textNode = inlineCodeNode.children[0];
11088
- if (textNode && rxEscapedPipe.test(textNode.value)) {
11089
- textNode.value = textNode.value.replace(rxEscapedPipe, '|');
11090
- }
11091
- });
11092
- return SKIP;
11093
- });
11094
- };
11095
- };
11096
- /* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
11097
- ;// CONCATENATED MODULE: ./processor/transform/index.js
11098
-
11099
-
11100
-
11101
- var remarkTransformers = [single_code_tabs, reusable_content];
11102
- var rehypeTransformers = [table_cell_inline_code];
11103
-
11104
- /***/ }),
11105
-
11106
- /***/ 8229:
11107
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
11108
-
11109
- var _require = __webpack_require__(2781),
11110
- defaultSchema = _require.defaultSchema;
11111
- var createSchema = function createSchema() {
11112
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
11113
- safeMode = _ref.safeMode;
11114
- var schema = JSON.parse(JSON.stringify(defaultSchema));
11115
-
11116
- // Sanitization Schema Defaults
11117
- schema.clobberPrefix = '';
11118
- schema.tagNames.push('span');
11119
- schema.attributes['*'].push('class', 'className', 'align');
11120
- if (!safeMode) {
11121
- schema.attributes['*'].push('style');
11122
- }
11123
- schema.tagNames.push('rdme-pin');
11124
- schema.tagNames.push('rdme-embed');
11125
- schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
11126
- schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
11127
- schema.tagNames.push('figure');
11128
- schema.tagNames.push('figcaption');
11129
- schema.tagNames.push('input'); // allow GitHub-style todo lists
11130
- schema.ancestors.input = ['li'];
11131
- schema.tagNames.push('colgroup'); // wat
11132
- schema.tagNames.push('col');
11133
- return schema;
11134
- };
11135
- module.exports = createSchema;
11136
-
11137
- /***/ }),
11138
-
11139
- /***/ 8841:
11140
- /***/ ((module) => {
11141
-
11142
- "use strict";
11143
-
11144
-
11145
- module.exports = bail
11146
-
11147
- function bail(err) {
11148
- if (err) {
11149
- throw err
11150
- }
11151
- }
11152
-
11153
-
11154
- /***/ }),
11155
-
11156
- /***/ 1073:
11157
- /***/ ((module) => {
11158
-
11159
- module.exports = {
11160
- trueFunc: function trueFunc(){
11161
- return true;
11162
- },
11163
- falseFunc: function falseFunc(){
11164
- return false;
11165
- }
11166
- };
11167
-
11168
- /***/ }),
11169
-
11170
- /***/ 932:
11171
- /***/ ((module) => {
11172
-
11173
- "use strict";
11174
-
11175
-
11176
- module.exports = ccount
11177
-
11178
- function ccount(value, character) {
11179
- var val = String(value)
11180
- var count = 0
11181
- var index
11182
-
11183
- if (typeof character !== 'string' || character.length !== 1) {
11184
- throw new Error('Expected character')
11185
- }
11186
-
11187
- index = val.indexOf(character)
11188
-
11189
- while (index !== -1) {
11190
- count++
11191
- index = val.indexOf(character, index + 1)
11192
- }
11193
-
11194
- return count
11195
- }
11196
-
11197
-
11198
- /***/ }),
11199
-
11200
- /***/ 6313:
11201
- /***/ ((module) => {
11202
-
11203
- var clone = (function() {
11204
- 'use strict';
11205
-
11206
- function _instanceof(obj, type) {
11207
- return type != null && obj instanceof type;
11208
- }
10744
+ function _instanceof(obj, type) {
10745
+ return type != null && obj instanceof type;
10746
+ }
11209
10747
 
11210
10748
  var nativeMap;
11211
10749
  try {
@@ -32657,745 +32195,972 @@ const defaultSchema = {
32657
32195
  }
32658
32196
 
32659
32197
 
32660
- /***/ }),
32198
+ /***/ }),
32199
+
32200
+ /***/ 1445:
32201
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32202
+
32203
+ "use strict";
32204
+ __webpack_require__.r(__webpack_exports__);
32205
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32206
+ /* harmony export */ "map": () => (/* binding */ map)
32207
+ /* harmony export */ });
32208
+ /**
32209
+ * @typedef {import('unist').Node} Node
32210
+ */
32211
+
32212
+ /**
32213
+ * @template {Node} [Tree=Node]
32214
+ * @typedef {import('./complex-types.js').MapFunction<Tree>} MapFunction
32215
+ * Function called with a node, its index, and its parent to produce a new
32216
+ * node.
32217
+ */
32218
+
32219
+ /**
32220
+ * Create a new tree by mapping all nodes with the given function.
32221
+ *
32222
+ * @template {Node} Tree
32223
+ * Type of input tree.
32224
+ * @param {Tree} tree
32225
+ * Tree to map.
32226
+ * @param {MapFunction<Tree>} mapFunction
32227
+ * Function called with a node, its index, and its parent to produce a new
32228
+ * node.
32229
+ * @returns {Tree}
32230
+ * New mapped tree.
32231
+ */
32232
+ function map(tree, mapFunction) {
32233
+ // @ts-expect-error Looks like a children.
32234
+ return preorder(tree, null, null)
32235
+
32236
+ /** @type {import('./complex-types').MapFunction<Tree>} */
32237
+ function preorder(node, index, parent) {
32238
+ var newNode = Object.assign({}, mapFunction(node, index, parent))
32239
+
32240
+ if ('children' in node) {
32241
+ // @ts-expect-error Looks like a parent.
32242
+ newNode.children = node.children.map(function (
32243
+ /** @type {import('./complex-types').InclusiveDescendant<Tree>} */ child,
32244
+ /** @type {number} */ index
32245
+ ) {
32246
+ return preorder(child, index, node)
32247
+ })
32248
+ }
32249
+
32250
+ return newNode
32251
+ }
32252
+ }
32253
+
32254
+
32255
+ /***/ }),
32256
+
32257
+ /***/ 5907:
32258
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32259
+
32260
+ "use strict";
32261
+ // ESM COMPAT FLAG
32262
+ __webpack_require__.r(__webpack_exports__);
32263
+
32264
+ // EXPORTS
32265
+ __webpack_require__.d(__webpack_exports__, {
32266
+ "matches": () => (/* binding */ unist_util_select_matches),
32267
+ "select": () => (/* binding */ unist_util_select_select),
32268
+ "selectAll": () => (/* binding */ selectAll)
32269
+ });
32270
+
32271
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/zwitch/index.js
32272
+ var own = {}.hasOwnProperty
32273
+
32274
+ /**
32275
+ * @callback Handler
32276
+ * @param {...unknown} value
32277
+ * @return {unknown}
32278
+ *
32279
+ * @typedef {Record<string, Handler>} Handlers
32280
+ *
32281
+ * @typedef {Object} Options
32282
+ * @property {Handler} [unknown]
32283
+ * @property {Handler} [invalid]
32284
+ * @property {Handlers} [handlers]
32285
+ */
32286
+
32287
+ /**
32288
+ * Handle values based on a property.
32289
+ *
32290
+ * @param {string} key
32291
+ * @param {Options} [options]
32292
+ */
32293
+ function zwitch(key, options) {
32294
+ var settings = options || {}
32295
+
32296
+ /**
32297
+ * Handle one value.
32298
+ * Based on the bound `key`, a respective handler will be called.
32299
+ * If `value` is not an object, or doesn’t have a `key` property, the special
32300
+ * “invalid” handler will be called.
32301
+ * If `value` has an unknown `key`, the special “unknown” handler will be
32302
+ * called.
32303
+ *
32304
+ * All arguments, and the context object, are passed through to the handler,
32305
+ * and it’s result is returned.
32306
+ *
32307
+ * @param {...unknown} [value]
32308
+ * @this {unknown}
32309
+ * @returns {unknown}
32310
+ * @property {Handler} invalid
32311
+ * @property {Handler} unknown
32312
+ * @property {Handlers} handlers
32313
+ */
32314
+ function one(value) {
32315
+ var fn = one.invalid
32316
+ var handlers = one.handlers
32317
+
32318
+ if (value && own.call(value, key)) {
32319
+ fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
32320
+ }
32321
+
32322
+ if (fn) {
32323
+ return fn.apply(this, arguments)
32324
+ }
32325
+ }
32326
+
32327
+ one.handlers = settings.handlers || {}
32328
+ one.invalid = settings.invalid
32329
+ one.unknown = settings.unknown
32330
+
32331
+ return one
32332
+ }
32333
+
32334
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/util.js
32335
+ /**
32336
+ * @typedef {import('./types.js').Selector} Selector
32337
+ * @typedef {import('./types.js').Selectors} Selectors
32338
+ * @typedef {import('./types.js').Rule} Rule
32339
+ * @typedef {import('./types.js').RuleSet} RuleSet
32340
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
32341
+ * @typedef {import('./types.js').Query} Query
32342
+ * @typedef {import('./types.js').Node} Node
32343
+ * @typedef {import('./types.js').Parent} Parent
32344
+ * @typedef {import('./types.js').SelectIterator} SelectIterator
32345
+ * @typedef {import('./types.js').SelectState} SelectState
32346
+ */
32347
+
32348
+ /**
32349
+ * @param {Node} node
32350
+ * @returns {node is Parent}
32351
+ */
32352
+ function root(node) {
32353
+ return (
32354
+ // Root in nlcst.
32355
+ node.type === 'RootNode' ||
32356
+ // Rest
32357
+ node.type === 'root'
32358
+ )
32359
+ }
32360
+
32361
+ /**
32362
+ * @param {Node} node
32363
+ * @returns {node is Parent}
32364
+ */
32365
+ function util_parent(node) {
32366
+ return Array.isArray(node.children)
32367
+ }
32368
+
32369
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
32370
+ /**
32371
+ * @typedef {import('./types.js').Rule} Rule
32372
+ * @typedef {import('./types.js').Query} Query
32373
+ * @typedef {import('./types.js').Node} Node
32374
+ * @typedef {import('./types.js').Parent} Parent
32375
+ * @typedef {import('./types.js').SelectState} SelectState
32376
+ * @typedef {import('./types.js').SelectIterator} SelectIterator
32377
+ * @typedef {import('./types.js').Handler} Handler
32378
+ */
32379
+
32380
+
32381
+
32382
+
32383
+ var nest_own = {}.hasOwnProperty
32384
+
32385
+ var handle = zwitch('nestingOperator', {
32386
+ unknown: unknownNesting,
32387
+ invalid: topScan, // `undefined` is the top query selector.
32388
+ handlers: {
32389
+ null: descendant, // `null` is the descendant combinator.
32390
+ '>': child,
32391
+ '+': adjacentSibling,
32392
+ '~': generalSibling
32393
+ }
32394
+ })
32395
+
32396
+ /** @type {Handler} */
32397
+ function nest(query, node, index, parent, state) {
32398
+ return handle(query, node, index, parent, state)
32399
+ }
32400
+
32401
+ // Shouldn’t be invoked, parser gives correct data.
32402
+ /* c8 ignore next 6 */
32403
+ /**
32404
+ * @param {{[x: string]: unknown, type: string}} query
32405
+ */
32406
+ function unknownNesting(query) {
32407
+ throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
32408
+ }
32409
+
32410
+ /** @type {Handler} */
32411
+ function topScan(query, node, index, parent, state) {
32412
+ // Shouldn’t happen.
32413
+ /* c8 ignore next 3 */
32414
+ if (parent) {
32415
+ throw new Error('topScan is supposed to be called from the root node')
32416
+ }
32417
+
32418
+ state.iterator(query, node, index, parent, state)
32419
+ if (!state.shallow) descendant(query, node, index, parent, state)
32420
+ }
32421
+
32422
+ /** @type {Handler} */
32423
+ function descendant(query, node, index, parent, state) {
32424
+ var previous = state.iterator
32425
+
32426
+ state.iterator = iterator
32427
+ child(query, node, index, parent, state)
32661
32428
 
32662
- /***/ 1445:
32663
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32429
+ /** @type {SelectIterator} */
32430
+ function iterator(query, node, index, parent, state) {
32431
+ state.iterator = previous
32432
+ previous(query, node, index, parent, state)
32433
+ state.iterator = iterator
32664
32434
 
32665
- "use strict";
32666
- __webpack_require__.r(__webpack_exports__);
32667
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32668
- /* harmony export */ "map": () => (/* binding */ map)
32669
- /* harmony export */ });
32670
- /**
32671
- * @typedef {import('unist').Node} Node
32672
- */
32435
+ if (state.one && state.found) return
32673
32436
 
32674
- /**
32675
- * @template {Node} [Tree=Node]
32676
- * @typedef {import('./complex-types.js').MapFunction<Tree>} MapFunction
32677
- * Function called with a node, its index, and its parent to produce a new
32678
- * node.
32679
- */
32437
+ child(query, node, index, parent, state)
32438
+ }
32439
+ }
32680
32440
 
32681
- /**
32682
- * Create a new tree by mapping all nodes with the given function.
32683
- *
32684
- * @template {Node} Tree
32685
- * Type of input tree.
32686
- * @param {Tree} tree
32687
- * Tree to map.
32688
- * @param {MapFunction<Tree>} mapFunction
32689
- * Function called with a node, its index, and its parent to produce a new
32690
- * node.
32691
- * @returns {Tree}
32692
- * New mapped tree.
32693
- */
32694
- function map(tree, mapFunction) {
32695
- // @ts-expect-error Looks like a children.
32696
- return preorder(tree, null, null)
32441
+ /** @type {Handler} */
32442
+ function child(query, node, _1, _2, state) {
32443
+ if (!util_parent(node)) return
32444
+ if (node.children.length === 0) return
32697
32445
 
32698
- /** @type {import('./complex-types').MapFunction<Tree>} */
32699
- function preorder(node, index, parent) {
32700
- var newNode = Object.assign({}, mapFunction(node, index, parent))
32446
+ new WalkIterator(query, node, state).each().done()
32447
+ }
32701
32448
 
32702
- if ('children' in node) {
32703
- // @ts-expect-error Looks like a parent.
32704
- newNode.children = node.children.map(function (
32705
- /** @type {import('./complex-types').InclusiveDescendant<Tree>} */ child,
32706
- /** @type {number} */ index
32707
- ) {
32708
- return preorder(child, index, node)
32709
- })
32449
+ /** @type {Handler} */
32450
+ function adjacentSibling(query, _, index, parent, state) {
32451
+ // Shouldn’t happen.
32452
+ /* c8 ignore next */
32453
+ if (!parent) return
32454
+
32455
+ new WalkIterator(query, parent, state)
32456
+ .prefillTypeIndex(0, ++index)
32457
+ .each(index, ++index)
32458
+ .prefillTypeIndex(index)
32459
+ .done()
32460
+ }
32461
+
32462
+ /** @type {Handler} */
32463
+ function generalSibling(query, _, index, parent, state) {
32464
+ // Shouldn’t happen.
32465
+ /* c8 ignore next */
32466
+ if (!parent) return
32467
+
32468
+ new WalkIterator(query, parent, state)
32469
+ .prefillTypeIndex(0, ++index)
32470
+ .each(index)
32471
+ .done()
32472
+ }
32473
+
32474
+ class WalkIterator {
32475
+ /**
32476
+ * Handles typeIndex and typeCount properties for every walker.
32477
+ *
32478
+ * @param {Rule} query
32479
+ * @param {Parent} parent
32480
+ * @param {SelectState} state
32481
+ */
32482
+ constructor(query, parent, state) {
32483
+ /** @type {Rule} */
32484
+ this.query = query
32485
+ /** @type {Parent} */
32486
+ this.parent = parent
32487
+ /** @type {SelectState} */
32488
+ this.state = state
32489
+ /** @type {TypeIndex|undefined} */
32490
+ this.typeIndex = state.index ? new TypeIndex() : undefined
32491
+ /** @type {Array.<Function>} */
32492
+ this.delayed = []
32493
+ }
32494
+
32495
+ /**
32496
+ * @param {number|null|undefined} [x]
32497
+ * @param {number|null|undefined} [y]
32498
+ * @returns {this}
32499
+ */
32500
+ prefillTypeIndex(x, y) {
32501
+ var [start, end] = this.defaults(x, y)
32502
+
32503
+ if (this.typeIndex) {
32504
+ while (start < end) {
32505
+ this.typeIndex.index(this.parent.children[start])
32506
+ start++
32507
+ }
32710
32508
  }
32711
32509
 
32712
- return newNode
32510
+ return this
32713
32511
  }
32714
- }
32715
32512
 
32513
+ /**
32514
+ * @param {number|null|undefined} [x]
32515
+ * @param {number|null|undefined} [y]
32516
+ * @returns {this}
32517
+ */
32518
+ each(x, y) {
32519
+ var [start, end] = this.defaults(x, y)
32520
+ var child = this.parent.children[start]
32521
+ /** @type {number} */
32522
+ var index
32523
+ /** @type {number} */
32524
+ var nodeIndex
32716
32525
 
32717
- /***/ }),
32526
+ if (start >= end) return this
32718
32527
 
32719
- /***/ 5907:
32720
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
32528
+ if (this.typeIndex) {
32529
+ nodeIndex = this.typeIndex.nodes
32530
+ index = this.typeIndex.index(child)
32531
+ this.delayed.push(delay)
32532
+ } else {
32533
+ this.state.iterator(this.query, child, start, this.parent, this.state)
32534
+ }
32721
32535
 
32722
- "use strict";
32723
- // ESM COMPAT FLAG
32724
- __webpack_require__.r(__webpack_exports__);
32536
+ // Stop if we’re looking for one node and it’s already found.
32537
+ if (this.state.one && this.state.found) return this
32725
32538
 
32726
- // EXPORTS
32727
- __webpack_require__.d(__webpack_exports__, {
32728
- "matches": () => (/* binding */ unist_util_select_matches),
32729
- "select": () => (/* binding */ unist_util_select_select),
32730
- "selectAll": () => (/* binding */ selectAll)
32731
- });
32539
+ return this.each(start + 1, end)
32732
32540
 
32733
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/zwitch/index.js
32734
- var own = {}.hasOwnProperty
32541
+ /**
32542
+ * @this {WalkIterator}
32543
+ */
32544
+ function delay() {
32545
+ this.state.typeIndex = index
32546
+ this.state.nodeIndex = nodeIndex
32547
+ this.state.typeCount = this.typeIndex.count(child)
32548
+ this.state.nodeCount = this.typeIndex.nodes
32549
+ this.state.iterator(this.query, child, start, this.parent, this.state)
32550
+ }
32551
+ }
32735
32552
 
32736
- /**
32737
- * @callback Handler
32738
- * @param {...unknown} value
32739
- * @return {unknown}
32740
- *
32741
- * @typedef {Record<string, Handler>} Handlers
32742
- *
32743
- * @typedef {Object} Options
32744
- * @property {Handler} [unknown]
32745
- * @property {Handler} [invalid]
32746
- * @property {Handlers} [handlers]
32747
- */
32553
+ /**
32554
+ * Done!
32555
+ * @returns {this}
32556
+ */
32557
+ done() {
32558
+ var index = -1
32748
32559
 
32749
- /**
32750
- * Handle values based on a property.
32751
- *
32752
- * @param {string} key
32753
- * @param {Options} [options]
32754
- */
32755
- function zwitch(key, options) {
32756
- var settings = options || {}
32560
+ while (++index < this.delayed.length) {
32561
+ this.delayed[index].call(this)
32562
+ if (this.state.one && this.state.found) break
32563
+ }
32564
+
32565
+ return this
32566
+ }
32757
32567
 
32758
32568
  /**
32759
- * Handle one value.
32760
- * Based on the bound `key`, a respective handler will be called.
32761
- * If `value` is not an object, or doesn’t have a `key` property, the special
32762
- * “invalid” handler will be called.
32763
- * If `value` has an unknown `key`, the special “unknown” handler will be
32764
- * called.
32765
- *
32766
- * All arguments, and the context object, are passed through to the handler,
32767
- * and it’s result is returned.
32768
- *
32769
- * @param {...unknown} [value]
32770
- * @this {unknown}
32771
- * @returns {unknown}
32772
- * @property {Handler} invalid
32773
- * @property {Handler} unknown
32774
- * @property {Handlers} handlers
32569
+ * @param {number|null|undefined} [start]
32570
+ * @param {number|null|undefined} [end]
32571
+ * @returns {[number, number]}
32775
32572
  */
32776
- function one(value) {
32777
- var fn = one.invalid
32778
- var handlers = one.handlers
32573
+ defaults(start, end) {
32574
+ if (start === null || start === undefined || start < 0) start = 0
32575
+ if (end === null || end === undefined || end > this.parent.children.length)
32576
+ end = this.parent.children.length
32577
+ return [start, end]
32578
+ }
32579
+ }
32580
+
32581
+ class TypeIndex {
32582
+ constructor() {
32583
+ /** @type {Object.<string, number>} */
32584
+ this.counts = {}
32585
+ /** @type {number} */
32586
+ this.nodes = 0
32587
+ }
32588
+
32589
+ /**
32590
+ * @param {Node} node
32591
+ * @returns {number}
32592
+ */
32593
+ index(node) {
32594
+ var type = node.type
32595
+
32596
+ this.nodes++
32779
32597
 
32780
- if (value && own.call(value, key)) {
32781
- fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
32782
- }
32598
+ if (!nest_own.call(this.counts, type)) this.counts[type] = 0
32783
32599
 
32784
- if (fn) {
32785
- return fn.apply(this, arguments)
32786
- }
32600
+ // Note: `++` is intended to be postfixed!
32601
+ return this.counts[type]++
32787
32602
  }
32788
32603
 
32789
- one.handlers = settings.handlers || {}
32790
- one.invalid = settings.invalid
32791
- one.unknown = settings.unknown
32792
-
32793
- return one
32604
+ /**
32605
+ * @param {Node} node
32606
+ * @returns {number|undefined}
32607
+ */
32608
+ count(node) {
32609
+ return this.counts[node.type]
32610
+ }
32794
32611
  }
32795
32612
 
32796
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/util.js
32613
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
32797
32614
  /**
32798
- * @typedef {import('./types.js').Selector} Selector
32799
- * @typedef {import('./types.js').Selectors} Selectors
32800
- * @typedef {import('./types.js').Rule} Rule
32801
- * @typedef {import('./types.js').RuleSet} RuleSet
32802
- * @typedef {import('./types.js').RulePseudo} RulePseudo
32803
- * @typedef {import('./types.js').Query} Query
32804
- * @typedef {import('./types.js').Node} Node
32805
- * @typedef {import('./types.js').Parent} Parent
32806
- * @typedef {import('./types.js').SelectIterator} SelectIterator
32807
- * @typedef {import('./types.js').SelectState} SelectState
32615
+ * @typedef {import('unist').Node} Node
32616
+ * @typedef {import('unist').Parent} Parent
32617
+ *
32618
+ * @typedef {string} Type
32619
+ * @typedef {Object<string, unknown>} Props
32620
+ *
32621
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
32808
32622
  */
32809
32623
 
32810
32624
  /**
32625
+ * Check if a node passes a test
32626
+ *
32627
+ * @callback TestFunctionAnything
32811
32628
  * @param {Node} node
32812
- * @returns {node is Parent}
32629
+ * @param {number} [index]
32630
+ * @param {Parent} [parent]
32631
+ * @returns {boolean|void}
32813
32632
  */
32814
- function root(node) {
32815
- return (
32816
- // Root in nlcst.
32817
- node.type === 'RootNode' ||
32818
- // Rest
32819
- node.type === 'root'
32820
- )
32821
- }
32822
32633
 
32823
32634
  /**
32635
+ * Check if a node passes a certain node test
32636
+ *
32637
+ * @template {Node} X
32638
+ * @callback TestFunctionPredicate
32824
32639
  * @param {Node} node
32825
- * @returns {node is Parent}
32640
+ * @param {number} [index]
32641
+ * @param {Parent} [parent]
32642
+ * @returns {node is X}
32826
32643
  */
32827
- function util_parent(node) {
32828
- return Array.isArray(node.children)
32829
- }
32830
32644
 
32831
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
32832
32645
  /**
32833
- * @typedef {import('./types.js').Rule} Rule
32834
- * @typedef {import('./types.js').Query} Query
32835
- * @typedef {import('./types.js').Node} Node
32836
- * @typedef {import('./types.js').Parent} Parent
32837
- * @typedef {import('./types.js').SelectState} SelectState
32838
- * @typedef {import('./types.js').SelectIterator} SelectIterator
32839
- * @typedef {import('./types.js').Handler} Handler
32646
+ * @callback AssertAnything
32647
+ * @param {unknown} [node]
32648
+ * @param {number} [index]
32649
+ * @param {Parent} [parent]
32650
+ * @returns {boolean}
32840
32651
  */
32841
32652
 
32653
+ /**
32654
+ * Check if a node passes a certain node test
32655
+ *
32656
+ * @template {Node} Y
32657
+ * @callback AssertPredicate
32658
+ * @param {unknown} [node]
32659
+ * @param {number} [index]
32660
+ * @param {Parent} [parent]
32661
+ * @returns {node is Y}
32662
+ */
32842
32663
 
32664
+ var is =
32665
+ /**
32666
+ * Check if a node passes a test.
32667
+ * When a `parent` node is known the `index` of node should also be given.
32668
+ *
32669
+ * @type {(
32670
+ * (<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) &
32671
+ * ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
32672
+ * )}
32673
+ */
32674
+ (
32675
+ /**
32676
+ * Check if a node passes a test.
32677
+ * When a `parent` node is known the `index` of node should also be given.
32678
+ *
32679
+ * @param {unknown} [node] Node to check
32680
+ * @param {Test} [test]
32681
+ * When nullish, checks if `node` is a `Node`.
32682
+ * When `string`, works like passing `function (node) {return node.type === test}`.
32683
+ * When `function` checks if function passed the node is true.
32684
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
32685
+ * When `array`, checks any one of the subtests pass.
32686
+ * @param {number} [index] Position of `node` in `parent`
32687
+ * @param {Parent} [parent] Parent of `node`
32688
+ * @param {unknown} [context] Context object to invoke `test` with
32689
+ * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
32690
+ */
32691
+ // eslint-disable-next-line max-params
32692
+ function is(node, test, index, parent, context) {
32693
+ var check = convert(test)
32843
32694
 
32695
+ if (
32696
+ index !== undefined &&
32697
+ index !== null &&
32698
+ (typeof index !== 'number' ||
32699
+ index < 0 ||
32700
+ index === Number.POSITIVE_INFINITY)
32701
+ ) {
32702
+ throw new Error('Expected positive finite index')
32703
+ }
32844
32704
 
32845
- var nest_own = {}.hasOwnProperty
32846
-
32847
- var handle = zwitch('nestingOperator', {
32848
- unknown: unknownNesting,
32849
- invalid: topScan, // `undefined` is the top query selector.
32850
- handlers: {
32851
- null: descendant, // `null` is the descendant combinator.
32852
- '>': child,
32853
- '+': adjacentSibling,
32854
- '~': generalSibling
32855
- }
32856
- })
32857
-
32858
- /** @type {Handler} */
32859
- function nest(query, node, index, parent, state) {
32860
- return handle(query, node, index, parent, state)
32861
- }
32705
+ if (
32706
+ parent !== undefined &&
32707
+ parent !== null &&
32708
+ (!is(parent) || !parent.children)
32709
+ ) {
32710
+ throw new Error('Expected parent node')
32711
+ }
32862
32712
 
32863
- // Shouldn’t be invoked, parser gives correct data.
32864
- /* c8 ignore next 6 */
32865
- /**
32866
- * @param {{[x: string]: unknown, type: string}} query
32867
- */
32868
- function unknownNesting(query) {
32869
- throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
32870
- }
32713
+ if (
32714
+ (parent === undefined || parent === null) !==
32715
+ (index === undefined || index === null)
32716
+ ) {
32717
+ throw new Error('Expected both parent and index')
32718
+ }
32871
32719
 
32872
- /** @type {Handler} */
32873
- function topScan(query, node, index, parent, state) {
32874
- // Shouldn’t happen.
32875
- /* c8 ignore next 3 */
32876
- if (parent) {
32877
- throw new Error('topScan is supposed to be called from the root node')
32878
- }
32720
+ // @ts-ignore Looks like a node.
32721
+ return node && node.type && typeof node.type === 'string'
32722
+ ? Boolean(check.call(context, node, index, parent))
32723
+ : false
32724
+ }
32725
+ )
32879
32726
 
32880
- state.iterator(query, node, index, parent, state)
32881
- if (!state.shallow) descendant(query, node, index, parent, state)
32882
- }
32727
+ var convert =
32728
+ /**
32729
+ * @type {(
32730
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
32731
+ * ((test?: Test) => AssertAnything)
32732
+ * )}
32733
+ */
32734
+ (
32735
+ /**
32736
+ * Generate an assertion from a check.
32737
+ * @param {Test} [test]
32738
+ * When nullish, checks if `node` is a `Node`.
32739
+ * When `string`, works like passing `function (node) {return node.type === test}`.
32740
+ * When `function` checks if function passed the node is true.
32741
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
32742
+ * When `array`, checks any one of the subtests pass.
32743
+ * @returns {AssertAnything}
32744
+ */
32745
+ function (test) {
32746
+ if (test === undefined || test === null) {
32747
+ return ok
32748
+ }
32883
32749
 
32884
- /** @type {Handler} */
32885
- function descendant(query, node, index, parent, state) {
32886
- var previous = state.iterator
32750
+ if (typeof test === 'string') {
32751
+ return typeFactory(test)
32752
+ }
32887
32753
 
32888
- state.iterator = iterator
32889
- child(query, node, index, parent, state)
32754
+ if (typeof test === 'object') {
32755
+ // @ts-ignore looks like a list of tests / partial test object.
32756
+ return 'length' in test ? anyFactory(test) : propsFactory(test)
32757
+ }
32890
32758
 
32891
- /** @type {SelectIterator} */
32892
- function iterator(query, node, index, parent, state) {
32893
- state.iterator = previous
32894
- previous(query, node, index, parent, state)
32895
- state.iterator = iterator
32759
+ if (typeof test === 'function') {
32760
+ return castFactory(test)
32761
+ }
32896
32762
 
32897
- if (state.one && state.found) return
32763
+ throw new Error('Expected function, string, or object as test')
32764
+ }
32765
+ )
32766
+ /**
32767
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
32768
+ * @returns {AssertAnything}
32769
+ */
32770
+ function anyFactory(tests) {
32771
+ /** @type {Array.<AssertAnything>} */
32772
+ var checks = []
32773
+ var index = -1
32898
32774
 
32899
- child(query, node, index, parent, state)
32775
+ while (++index < tests.length) {
32776
+ checks[index] = convert(tests[index])
32900
32777
  }
32901
- }
32902
32778
 
32903
- /** @type {Handler} */
32904
- function child(query, node, _1, _2, state) {
32905
- if (!util_parent(node)) return
32906
- if (node.children.length === 0) return
32779
+ return castFactory(any)
32907
32780
 
32908
- new WalkIterator(query, node, state).each().done()
32781
+ /**
32782
+ * @this {unknown}
32783
+ * @param {unknown[]} parameters
32784
+ * @returns {boolean}
32785
+ */
32786
+ function any(...parameters) {
32787
+ var index = -1
32788
+
32789
+ while (++index < checks.length) {
32790
+ if (checks[index].call(this, ...parameters)) return true
32791
+ }
32792
+ }
32909
32793
  }
32910
32794
 
32911
- /** @type {Handler} */
32912
- function adjacentSibling(query, _, index, parent, state) {
32913
- // Shouldn’t happen.
32914
- /* c8 ignore next */
32915
- if (!parent) return
32795
+ /**
32796
+ * Utility to assert each property in `test` is represented in `node`, and each
32797
+ * values are strictly equal.
32798
+ *
32799
+ * @param {Props} check
32800
+ * @returns {AssertAnything}
32801
+ */
32802
+ function propsFactory(check) {
32803
+ return castFactory(all)
32916
32804
 
32917
- new WalkIterator(query, parent, state)
32918
- .prefillTypeIndex(0, ++index)
32919
- .each(index, ++index)
32920
- .prefillTypeIndex(index)
32921
- .done()
32922
- }
32805
+ /**
32806
+ * @param {Node} node
32807
+ * @returns {boolean}
32808
+ */
32809
+ function all(node) {
32810
+ /** @type {string} */
32811
+ var key
32923
32812
 
32924
- /** @type {Handler} */
32925
- function generalSibling(query, _, index, parent, state) {
32926
- // Shouldn’t happen.
32927
- /* c8 ignore next */
32928
- if (!parent) return
32813
+ for (key in check) {
32814
+ if (node[key] !== check[key]) return
32815
+ }
32929
32816
 
32930
- new WalkIterator(query, parent, state)
32931
- .prefillTypeIndex(0, ++index)
32932
- .each(index)
32933
- .done()
32817
+ return true
32818
+ }
32934
32819
  }
32935
32820
 
32936
- class WalkIterator {
32821
+ /**
32822
+ * Utility to convert a string into a function which checks a given node’s type
32823
+ * for said string.
32824
+ *
32825
+ * @param {Type} check
32826
+ * @returns {AssertAnything}
32827
+ */
32828
+ function typeFactory(check) {
32829
+ return castFactory(type)
32830
+
32937
32831
  /**
32938
- * Handles typeIndex and typeCount properties for every walker.
32939
- *
32940
- * @param {Rule} query
32941
- * @param {Parent} parent
32942
- * @param {SelectState} state
32832
+ * @param {Node} node
32943
32833
  */
32944
- constructor(query, parent, state) {
32945
- /** @type {Rule} */
32946
- this.query = query
32947
- /** @type {Parent} */
32948
- this.parent = parent
32949
- /** @type {SelectState} */
32950
- this.state = state
32951
- /** @type {TypeIndex|undefined} */
32952
- this.typeIndex = state.index ? new TypeIndex() : undefined
32953
- /** @type {Array.<Function>} */
32954
- this.delayed = []
32834
+ function type(node) {
32835
+ return node && node.type === check
32955
32836
  }
32837
+ }
32838
+
32839
+ /**
32840
+ * Utility to convert a string into a function which checks a given node’s type
32841
+ * for said string.
32842
+ * @param {TestFunctionAnything} check
32843
+ * @returns {AssertAnything}
32844
+ */
32845
+ function castFactory(check) {
32846
+ return assertion
32956
32847
 
32957
32848
  /**
32958
- * @param {number|null|undefined} [x]
32959
- * @param {number|null|undefined} [y]
32960
- * @returns {this}
32849
+ * @this {unknown}
32850
+ * @param {Array.<unknown>} parameters
32851
+ * @returns {boolean}
32961
32852
  */
32962
- prefillTypeIndex(x, y) {
32963
- var [start, end] = this.defaults(x, y)
32853
+ function assertion(...parameters) {
32854
+ return Boolean(check.call(this, ...parameters))
32855
+ }
32856
+ }
32964
32857
 
32965
- if (this.typeIndex) {
32966
- while (start < end) {
32967
- this.typeIndex.index(this.parent.children[start])
32968
- start++
32969
- }
32970
- }
32858
+ // Utility to return true.
32859
+ function ok() {
32860
+ return true
32861
+ }
32971
32862
 
32972
- return this
32973
- }
32863
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
32864
+ /**
32865
+ * @typedef {import('./types.js').Rule} Rule
32866
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
32867
+ * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
32868
+ * @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
32869
+ * @typedef {import('./types.js').Parent} Parent
32870
+ * @typedef {import('./types.js').Selector} Selector
32871
+ * @typedef {import('./types.js').Selectors} Selectors
32872
+ * @typedef {import('./types.js').SelectState} SelectState
32873
+ * @typedef {import('./types.js').Node} Node
32874
+ */
32974
32875
 
32975
- /**
32976
- * @param {number|null|undefined} [x]
32977
- * @param {number|null|undefined} [y]
32978
- * @returns {this}
32979
- */
32980
- each(x, y) {
32981
- var [start, end] = this.defaults(x, y)
32982
- var child = this.parent.children[start]
32983
- /** @type {number} */
32984
- var index
32985
- /** @type {number} */
32986
- var nodeIndex
32987
32876
 
32988
- if (start >= end) return this
32989
32877
 
32990
- if (this.typeIndex) {
32991
- nodeIndex = this.typeIndex.nodes
32992
- index = this.typeIndex.index(child)
32993
- this.delayed.push(delay)
32994
- } else {
32995
- this.state.iterator(this.query, child, start, this.parent, this.state)
32996
- }
32997
32878
 
32998
- // Stop if we’re looking for one node and it’s already found.
32999
- if (this.state.one && this.state.found) return this
33000
32879
 
33001
- return this.each(start + 1, end)
32880
+ var pseudo_is = convert()
33002
32881
 
33003
- /**
33004
- * @this {WalkIterator}
33005
- */
33006
- function delay() {
33007
- this.state.typeIndex = index
33008
- this.state.nodeIndex = nodeIndex
33009
- this.state.typeCount = this.typeIndex.count(child)
33010
- this.state.nodeCount = this.typeIndex.nodes
33011
- this.state.iterator(this.query, child, start, this.parent, this.state)
33012
- }
32882
+ var pseudo_handle = zwitch('name', {
32883
+ unknown: unknownPseudo,
32884
+ invalid: invalidPseudo,
32885
+ handlers: {
32886
+ any: matches,
32887
+ blank: empty,
32888
+ empty,
32889
+ 'first-child': firstChild,
32890
+ 'first-of-type': firstOfType,
32891
+ has: hasSelector,
32892
+ 'last-child': lastChild,
32893
+ 'last-of-type': lastOfType,
32894
+ matches,
32895
+ not,
32896
+ 'nth-child': nthChild,
32897
+ 'nth-last-child': nthLastChild,
32898
+ 'nth-of-type': nthOfType,
32899
+ 'nth-last-of-type': nthLastOfType,
32900
+ 'only-child': onlyChild,
32901
+ 'only-of-type': onlyOfType,
32902
+ root: pseudo_root,
32903
+ scope
33013
32904
  }
32905
+ })
33014
32906
 
33015
- /**
33016
- * Done!
33017
- * @returns {this}
33018
- */
33019
- done() {
33020
- var index = -1
32907
+ pseudo.needsIndex = [
32908
+ 'first-child',
32909
+ 'first-of-type',
32910
+ 'last-child',
32911
+ 'last-of-type',
32912
+ 'nth-child',
32913
+ 'nth-last-child',
32914
+ 'nth-of-type',
32915
+ 'nth-last-of-type',
32916
+ 'only-child',
32917
+ 'only-of-type'
32918
+ ]
33021
32919
 
33022
- while (++index < this.delayed.length) {
33023
- this.delayed[index].call(this)
33024
- if (this.state.one && this.state.found) break
33025
- }
32920
+ /**
32921
+ * @param {Rule} query
32922
+ * @param {Node} node
32923
+ * @param {number|null} index
32924
+ * @param {Parent|null} parent
32925
+ * @param {SelectState} state
32926
+ * @returns {boolean}
32927
+ */
32928
+ function pseudo(query, node, index, parent, state) {
32929
+ var pseudos = query.pseudos
32930
+ var offset = -1
33026
32931
 
33027
- return this
32932
+ while (++offset < pseudos.length) {
32933
+ if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
33028
32934
  }
33029
32935
 
33030
- /**
33031
- * @param {number|null|undefined} [start]
33032
- * @param {number|null|undefined} [end]
33033
- * @returns {[number, number]}
33034
- */
33035
- defaults(start, end) {
33036
- if (start === null || start === undefined || start < 0) start = 0
33037
- if (end === null || end === undefined || end > this.parent.children.length)
33038
- end = this.parent.children.length
33039
- return [start, end]
33040
- }
32936
+ return true
33041
32937
  }
33042
32938
 
33043
- class TypeIndex {
33044
- constructor() {
33045
- /** @type {Object.<string, number>} */
33046
- this.counts = {}
33047
- /** @type {number} */
33048
- this.nodes = 0
33049
- }
33050
-
33051
- /**
33052
- * @param {Node} node
33053
- * @returns {number}
33054
- */
33055
- index(node) {
33056
- var type = node.type
32939
+ /**
32940
+ * @param {RulePseudoSelector} query
32941
+ * @param {Node} node
32942
+ * @param {number|null} _1
32943
+ * @param {Parent|null} _2
32944
+ * @param {SelectState} state
32945
+ * @returns {boolean}
32946
+ */
32947
+ function matches(query, node, _1, _2, state) {
32948
+ var shallow = state.shallow
32949
+ var one = state.one
32950
+ /** @type {boolean} */
32951
+ var result
33057
32952
 
33058
- this.nodes++
32953
+ state.one = true
32954
+ state.shallow = true
33059
32955
 
33060
- if (!nest_own.call(this.counts, type)) this.counts[type] = 0
32956
+ result = state.any(query.value, node, state)[0] === node
33061
32957
 
33062
- // Note: `++` is intended to be postfixed!
33063
- return this.counts[type]++
33064
- }
32958
+ state.shallow = shallow
32959
+ state.one = one
33065
32960
 
33066
- /**
33067
- * @param {Node} node
33068
- * @returns {number|undefined}
33069
- */
33070
- count(node) {
33071
- return this.counts[node.type]
33072
- }
32961
+ return result
33073
32962
  }
33074
32963
 
33075
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
33076
32964
  /**
33077
- * @typedef {import('unist').Node} Node
33078
- * @typedef {import('unist').Parent} Parent
33079
- *
33080
- * @typedef {string} Type
33081
- * @typedef {Object<string, unknown>} Props
33082
- *
33083
- * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
32965
+ * @param {RulePseudoSelector} query
32966
+ * @param {Node} node
32967
+ * @param {number|null} index
32968
+ * @param {Parent|null} parent
32969
+ * @param {SelectState} state
32970
+ * @returns {boolean}
33084
32971
  */
32972
+ function not(query, node, index, parent, state) {
32973
+ return !matches(query, node, index, parent, state)
32974
+ }
33085
32975
 
33086
32976
  /**
33087
- * Check if a node passes a test
33088
- *
33089
- * @callback TestFunctionAnything
32977
+ * @param {RulePseudo} _1
33090
32978
  * @param {Node} node
33091
- * @param {number} [index]
33092
- * @param {Parent} [parent]
33093
- * @returns {boolean|void}
32979
+ * @param {number|null} _2
32980
+ * @param {Parent|null} parent
32981
+ * @returns {boolean}
33094
32982
  */
32983
+ function pseudo_root(_1, node, _2, parent) {
32984
+ return pseudo_is(node) && !parent
32985
+ }
33095
32986
 
33096
32987
  /**
33097
- * Check if a node passes a certain node test
33098
- *
33099
- * @template {Node} X
33100
- * @callback TestFunctionPredicate
32988
+ * @param {RulePseudo} _1
33101
32989
  * @param {Node} node
33102
- * @param {number} [index]
33103
- * @param {Parent} [parent]
33104
- * @returns {node is X}
32990
+ * @param {number|null} _2
32991
+ * @param {Parent|null} _3
32992
+ * @param {SelectState} state
32993
+ * @returns {boolean}
33105
32994
  */
32995
+ function scope(_1, node, _2, _3, state) {
32996
+ return pseudo_is(node) && state.scopeNodes.includes(node)
32997
+ }
33106
32998
 
33107
32999
  /**
33108
- * @callback AssertAnything
33109
- * @param {unknown} [node]
33110
- * @param {number} [index]
33111
- * @param {Parent} [parent]
33000
+ * @param {RulePseudo} _1
33001
+ * @param {Node} node
33112
33002
  * @returns {boolean}
33113
33003
  */
33004
+ function empty(_1, node) {
33005
+ return util_parent(node) ? node.children.length === 0 : !('value' in node)
33006
+ }
33114
33007
 
33115
33008
  /**
33116
- * Check if a node passes a certain node test
33117
- *
33118
- * @template {Node} Y
33119
- * @callback AssertPredicate
33120
- * @param {unknown} [node]
33121
- * @param {number} [index]
33122
- * @param {Parent} [parent]
33123
- * @returns {node is Y}
33009
+ * @param {RulePseudo} query
33010
+ * @param {Node} _1
33011
+ * @param {number|null} _2
33012
+ * @param {Parent|null} _3
33013
+ * @param {SelectState} state
33014
+ * @returns {boolean}
33124
33015
  */
33016
+ function firstChild(query, _1, _2, _3, state) {
33017
+ assertDeep(state, query)
33018
+ return state.nodeIndex === 0 // Specifically `0`, not falsey.
33019
+ }
33125
33020
 
33126
- var is =
33127
- /**
33128
- * Check if a node passes a test.
33129
- * When a `parent` node is known the `index` of node should also be given.
33130
- *
33131
- * @type {(
33132
- * (<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) &
33133
- * ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
33134
- * )}
33135
- */
33136
- (
33137
- /**
33138
- * Check if a node passes a test.
33139
- * When a `parent` node is known the `index` of node should also be given.
33140
- *
33141
- * @param {unknown} [node] Node to check
33142
- * @param {Test} [test]
33143
- * When nullish, checks if `node` is a `Node`.
33144
- * When `string`, works like passing `function (node) {return node.type === test}`.
33145
- * When `function` checks if function passed the node is true.
33146
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33147
- * When `array`, checks any one of the subtests pass.
33148
- * @param {number} [index] Position of `node` in `parent`
33149
- * @param {Parent} [parent] Parent of `node`
33150
- * @param {unknown} [context] Context object to invoke `test` with
33151
- * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
33152
- */
33153
- // eslint-disable-next-line max-params
33154
- function is(node, test, index, parent, context) {
33155
- var check = convert(test)
33156
-
33157
- if (
33158
- index !== undefined &&
33159
- index !== null &&
33160
- (typeof index !== 'number' ||
33161
- index < 0 ||
33162
- index === Number.POSITIVE_INFINITY)
33163
- ) {
33164
- throw new Error('Expected positive finite index')
33165
- }
33166
-
33167
- if (
33168
- parent !== undefined &&
33169
- parent !== null &&
33170
- (!is(parent) || !parent.children)
33171
- ) {
33172
- throw new Error('Expected parent node')
33173
- }
33174
-
33175
- if (
33176
- (parent === undefined || parent === null) !==
33177
- (index === undefined || index === null)
33178
- ) {
33179
- throw new Error('Expected both parent and index')
33180
- }
33181
-
33182
- // @ts-ignore Looks like a node.
33183
- return node && node.type && typeof node.type === 'string'
33184
- ? Boolean(check.call(context, node, index, parent))
33185
- : false
33186
- }
33187
- )
33188
-
33189
- var convert =
33190
- /**
33191
- * @type {(
33192
- * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
33193
- * ((test?: Test) => AssertAnything)
33194
- * )}
33195
- */
33196
- (
33197
- /**
33198
- * Generate an assertion from a check.
33199
- * @param {Test} [test]
33200
- * When nullish, checks if `node` is a `Node`.
33201
- * When `string`, works like passing `function (node) {return node.type === test}`.
33202
- * When `function` checks if function passed the node is true.
33203
- * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33204
- * When `array`, checks any one of the subtests pass.
33205
- * @returns {AssertAnything}
33206
- */
33207
- function (test) {
33208
- if (test === undefined || test === null) {
33209
- return ok
33210
- }
33211
-
33212
- if (typeof test === 'string') {
33213
- return typeFactory(test)
33214
- }
33215
-
33216
- if (typeof test === 'object') {
33217
- // @ts-ignore looks like a list of tests / partial test object.
33218
- return 'length' in test ? anyFactory(test) : propsFactory(test)
33219
- }
33220
-
33221
- if (typeof test === 'function') {
33222
- return castFactory(test)
33223
- }
33224
-
33225
- throw new Error('Expected function, string, or object as test')
33226
- }
33227
- )
33228
33021
  /**
33229
- * @param {Array.<Type|Props|TestFunctionAnything>} tests
33230
- * @returns {AssertAnything}
33022
+ * @param {RulePseudo} query
33023
+ * @param {Node} _1
33024
+ * @param {number|null} _2
33025
+ * @param {Parent|null} _3
33026
+ * @param {SelectState} state
33027
+ * @returns {boolean}
33231
33028
  */
33232
- function anyFactory(tests) {
33233
- /** @type {Array.<AssertAnything>} */
33234
- var checks = []
33235
- var index = -1
33029
+ function lastChild(query, _1, _2, _3, state) {
33030
+ assertDeep(state, query)
33031
+ return state.nodeIndex === state.nodeCount - 1
33032
+ }
33236
33033
 
33237
- while (++index < tests.length) {
33238
- checks[index] = convert(tests[index])
33239
- }
33034
+ /**
33035
+ * @param {RulePseudo} query
33036
+ * @param {Node} _1
33037
+ * @param {number|null} _2
33038
+ * @param {Parent|null} _3
33039
+ * @param {SelectState} state
33040
+ * @returns {boolean}
33041
+ */
33042
+ function onlyChild(query, _1, _2, _3, state) {
33043
+ assertDeep(state, query)
33044
+ return state.nodeCount === 1
33045
+ }
33240
33046
 
33241
- return castFactory(any)
33047
+ /**
33048
+ * @param {RulePseudoNth} query
33049
+ * @param {Node} _1
33050
+ * @param {number|null} _2
33051
+ * @param {Parent|null} _3
33052
+ * @param {SelectState} state
33053
+ * @returns {boolean}
33054
+ */
33055
+ function nthChild(query, _1, _2, _3, state) {
33056
+ assertDeep(state, query)
33057
+ return query.value(state.nodeIndex)
33058
+ }
33242
33059
 
33243
- /**
33244
- * @this {unknown}
33245
- * @param {unknown[]} parameters
33246
- * @returns {boolean}
33247
- */
33248
- function any(...parameters) {
33249
- var index = -1
33060
+ /**
33061
+ * @param {RulePseudoNth} query
33062
+ * @param {Node} _1
33063
+ * @param {number|null} _2
33064
+ * @param {Parent|null} _3
33065
+ * @param {SelectState} state
33066
+ * @returns {boolean}
33067
+ */
33068
+ function nthLastChild(query, _1, _2, _3, state) {
33069
+ assertDeep(state, query)
33070
+ return query.value(state.nodeCount - state.nodeIndex - 1)
33071
+ }
33250
33072
 
33251
- while (++index < checks.length) {
33252
- if (checks[index].call(this, ...parameters)) return true
33253
- }
33254
- }
33073
+ /**
33074
+ * @param {RulePseudoNth} query
33075
+ * @param {Node} _1
33076
+ * @param {number|null} _2
33077
+ * @param {Parent|null} _3
33078
+ * @param {SelectState} state
33079
+ * @returns {boolean}
33080
+ */
33081
+ function nthOfType(query, _1, _2, _3, state) {
33082
+ assertDeep(state, query)
33083
+ return query.value(state.typeIndex)
33255
33084
  }
33256
33085
 
33257
33086
  /**
33258
- * Utility to assert each property in `test` is represented in `node`, and each
33259
- * values are strictly equal.
33260
- *
33261
- * @param {Props} check
33262
- * @returns {AssertAnything}
33087
+ * @param {RulePseudoNth} query
33088
+ * @param {Node} _1
33089
+ * @param {number|null} _2
33090
+ * @param {Parent|null} _3
33091
+ * @param {SelectState} state
33092
+ * @returns {boolean}
33263
33093
  */
33264
- function propsFactory(check) {
33265
- return castFactory(all)
33266
-
33267
- /**
33268
- * @param {Node} node
33269
- * @returns {boolean}
33270
- */
33271
- function all(node) {
33272
- /** @type {string} */
33273
- var key
33274
-
33275
- for (key in check) {
33276
- if (node[key] !== check[key]) return
33277
- }
33278
-
33279
- return true
33280
- }
33094
+ function nthLastOfType(query, _1, _2, _3, state) {
33095
+ assertDeep(state, query)
33096
+ return query.value(state.typeCount - 1 - state.typeIndex)
33281
33097
  }
33282
33098
 
33283
33099
  /**
33284
- * Utility to convert a string into a function which checks a given node’s type
33285
- * for said string.
33286
- *
33287
- * @param {Type} check
33288
- * @returns {AssertAnything}
33100
+ * @param {RulePseudo} query
33101
+ * @param {Node} _1
33102
+ * @param {number|null} _2
33103
+ * @param {Parent|null} _3
33104
+ * @param {SelectState} state
33105
+ * @returns {boolean}
33289
33106
  */
33290
- function typeFactory(check) {
33291
- return castFactory(type)
33292
-
33293
- /**
33294
- * @param {Node} node
33295
- */
33296
- function type(node) {
33297
- return node && node.type === check
33298
- }
33107
+ function firstOfType(query, _1, _2, _3, state) {
33108
+ assertDeep(state, query)
33109
+ return state.typeIndex === 0
33299
33110
  }
33300
33111
 
33301
33112
  /**
33302
- * Utility to convert a string into a function which checks a given node’s type
33303
- * for said string.
33304
- * @param {TestFunctionAnything} check
33305
- * @returns {AssertAnything}
33113
+ * @param {RulePseudo} query
33114
+ * @param {Node} _1
33115
+ * @param {number|null} _2
33116
+ * @param {Parent|null} _3
33117
+ * @param {SelectState} state
33118
+ * @returns {boolean}
33306
33119
  */
33307
- function castFactory(check) {
33308
- return assertion
33120
+ function lastOfType(query, _1, _2, _3, state) {
33121
+ assertDeep(state, query)
33122
+ return state.typeIndex === state.typeCount - 1
33123
+ }
33309
33124
 
33310
- /**
33311
- * @this {unknown}
33312
- * @param {Array.<unknown>} parameters
33313
- * @returns {boolean}
33314
- */
33315
- function assertion(...parameters) {
33316
- return Boolean(check.call(this, ...parameters))
33317
- }
33125
+ /**
33126
+ * @param {RulePseudo} query
33127
+ * @param {Node} _1
33128
+ * @param {number|null} _2
33129
+ * @param {Parent|null} _3
33130
+ * @param {SelectState} state
33131
+ * @returns {boolean}
33132
+ */
33133
+ function onlyOfType(query, _1, _2, _3, state) {
33134
+ assertDeep(state, query)
33135
+ return state.typeCount === 1
33318
33136
  }
33319
33137
 
33320
- // Utility to return true.
33321
- function ok() {
33322
- return true
33138
+ // Shouldn’t be invoked, parser gives correct data.
33139
+ /* c8 ignore next 3 */
33140
+ function invalidPseudo() {
33141
+ throw new Error('Invalid pseudo-selector')
33323
33142
  }
33324
33143
 
33325
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
33326
33144
  /**
33327
- * @typedef {import('./types.js').Rule} Rule
33328
- * @typedef {import('./types.js').RulePseudo} RulePseudo
33329
- * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33330
- * @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
33331
- * @typedef {import('./types.js').Parent} Parent
33332
- * @typedef {import('./types.js').Selector} Selector
33333
- * @typedef {import('./types.js').Selectors} Selectors
33334
- * @typedef {import('./types.js').SelectState} SelectState
33335
- * @typedef {import('./types.js').Node} Node
33145
+ * @param {RulePseudo} query
33146
+ * @returns {boolean}
33336
33147
  */
33337
-
33338
-
33339
-
33340
-
33341
-
33342
- var pseudo_is = convert()
33343
-
33344
- var pseudo_handle = zwitch('name', {
33345
- unknown: unknownPseudo,
33346
- invalid: invalidPseudo,
33347
- handlers: {
33348
- any: matches,
33349
- blank: empty,
33350
- empty,
33351
- 'first-child': firstChild,
33352
- 'first-of-type': firstOfType,
33353
- has: hasSelector,
33354
- 'last-child': lastChild,
33355
- 'last-of-type': lastOfType,
33356
- matches,
33357
- not,
33358
- 'nth-child': nthChild,
33359
- 'nth-last-child': nthLastChild,
33360
- 'nth-of-type': nthOfType,
33361
- 'nth-last-of-type': nthLastOfType,
33362
- 'only-child': onlyChild,
33363
- 'only-of-type': onlyOfType,
33364
- root: pseudo_root,
33365
- scope
33148
+ function unknownPseudo(query) {
33149
+ if (query.name) {
33150
+ throw new Error('Unknown pseudo-selector `' + query.name + '`')
33366
33151
  }
33367
- })
33368
33152
 
33369
- pseudo.needsIndex = [
33370
- 'first-child',
33371
- 'first-of-type',
33372
- 'last-child',
33373
- 'last-of-type',
33374
- 'nth-child',
33375
- 'nth-last-child',
33376
- 'nth-of-type',
33377
- 'nth-last-of-type',
33378
- 'only-child',
33379
- 'only-of-type'
33380
- ]
33153
+ throw new Error('Unexpected pseudo-element or empty pseudo-class')
33154
+ }
33381
33155
 
33382
33156
  /**
33383
- * @param {Rule} query
33384
- * @param {Node} node
33385
- * @param {number|null} index
33386
- * @param {Parent|null} parent
33387
33157
  * @param {SelectState} state
33388
- * @returns {boolean}
33158
+ * @param {RulePseudo|RulePseudoNth} query
33389
33159
  */
33390
- function pseudo(query, node, index, parent, state) {
33391
- var pseudos = query.pseudos
33392
- var offset = -1
33393
-
33394
- while (++offset < pseudos.length) {
33395
- if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
33160
+ function assertDeep(state, query) {
33161
+ if (state.shallow) {
33162
+ throw new Error('Cannot use `:' + query.name + '` without parent')
33396
33163
  }
33397
-
33398
- return true
33399
33164
  }
33400
33165
 
33401
33166
  /**
@@ -33406,780 +33171,1062 @@ function pseudo(query, node, index, parent, state) {
33406
33171
  * @param {SelectState} state
33407
33172
  * @returns {boolean}
33408
33173
  */
33409
- function matches(query, node, _1, _2, state) {
33174
+ function hasSelector(query, node, _1, _2, state) {
33410
33175
  var shallow = state.shallow
33411
33176
  var one = state.one
33177
+ var scopeNodes = state.scopeNodes
33178
+ var value = appendScope(query.value)
33179
+ var anything = state.any
33412
33180
  /** @type {boolean} */
33413
33181
  var result
33414
33182
 
33183
+ state.shallow = false
33415
33184
  state.one = true
33416
- state.shallow = true
33185
+ state.scopeNodes = [node]
33186
+
33187
+ result = Boolean(anything(value, node, state)[0])
33188
+
33189
+ state.shallow = shallow
33190
+ state.one = one
33191
+ state.scopeNodes = scopeNodes
33192
+
33193
+ return result
33194
+ }
33195
+
33196
+ /**
33197
+ * @param {Selector} value
33198
+ */
33199
+ function appendScope(value) {
33200
+ /** @type {Selectors} */
33201
+ var selector =
33202
+ value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
33203
+ var index = -1
33204
+ /** @type {Rule} */
33205
+ var rule
33206
+
33207
+ while (++index < selector.selectors.length) {
33208
+ rule = selector.selectors[index].rule
33209
+ rule.nestingOperator = null
33210
+
33211
+ // Needed if new pseudo’s are added that accepts commas (such as
33212
+ // `:lang(en, nl)`)
33213
+ /* c8 ignore else */
33214
+ if (
33215
+ !rule.pseudos ||
33216
+ rule.pseudos.length !== 1 ||
33217
+ rule.pseudos[0].name !== 'scope'
33218
+ ) {
33219
+ selector.selectors[index] = {
33220
+ type: 'ruleSet',
33221
+ rule: {
33222
+ type: 'rule',
33223
+ rule,
33224
+ // @ts-ignore pseudos are fine w/ just a name!
33225
+ pseudos: [{name: 'scope'}]
33226
+ }
33227
+ }
33228
+ }
33229
+ }
33230
+
33231
+ return selector
33232
+ }
33233
+
33234
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
33235
+ /**
33236
+ * @typedef {import('./types.js').Rule} Rule
33237
+ * @typedef {import('./types.js').RuleAttr} RuleAttr
33238
+ * @typedef {import('./types.js').Node} Node
33239
+ */
33240
+
33241
+
33242
+
33243
+ var attribute_handle = zwitch('operator', {
33244
+ unknown: unknownOperator,
33245
+ invalid: exists,
33246
+ handlers: {
33247
+ '=': exact,
33248
+ '^=': begins,
33249
+ '$=': ends,
33250
+ '*=': containsString,
33251
+ '~=': containsArray
33252
+ }
33253
+ })
33417
33254
 
33418
- result = state.any(query.value, node, state)[0] === node
33255
+ /**
33256
+ * @param {Rule} query
33257
+ * @param {Node} node
33258
+ */
33259
+ function attribute(query, node) {
33260
+ var index = -1
33419
33261
 
33420
- state.shallow = shallow
33421
- state.one = one
33262
+ while (++index < query.attrs.length) {
33263
+ if (!attribute_handle(query.attrs[index], node)) return false
33264
+ }
33422
33265
 
33423
- return result
33266
+ return true
33424
33267
  }
33425
33268
 
33426
33269
  /**
33427
- * @param {RulePseudoSelector} query
33270
+ * `[attr]`
33271
+ *
33272
+ * @param {RuleAttr} query
33428
33273
  * @param {Node} node
33429
- * @param {number|null} index
33430
- * @param {Parent|null} parent
33431
- * @param {SelectState} state
33432
- * @returns {boolean}
33433
33274
  */
33434
- function not(query, node, index, parent, state) {
33435
- return !matches(query, node, index, parent, state)
33275
+ function exists(query, node) {
33276
+ return node[query.name] !== null && node[query.name] !== undefined
33436
33277
  }
33437
33278
 
33438
33279
  /**
33439
- * @param {RulePseudo} _1
33280
+ * `[attr=value]`
33281
+ *
33282
+ * @param {RuleAttr} query
33440
33283
  * @param {Node} node
33441
- * @param {number|null} _2
33442
- * @param {Parent|null} parent
33443
- * @returns {boolean}
33444
33284
  */
33445
- function pseudo_root(_1, node, _2, parent) {
33446
- return pseudo_is(node) && !parent
33285
+ function exact(query, node) {
33286
+ return exists(query, node) && String(node[query.name]) === query.value
33447
33287
  }
33448
33288
 
33449
33289
  /**
33450
- * @param {RulePseudo} _1
33290
+ * `[attr~=value]`
33291
+ *
33292
+ * @param {RuleAttr} query
33451
33293
  * @param {Node} node
33452
- * @param {number|null} _2
33453
- * @param {Parent|null} _3
33454
- * @param {SelectState} state
33455
- * @returns {boolean}
33456
33294
  */
33457
- function scope(_1, node, _2, _3, state) {
33458
- return pseudo_is(node) && state.scopeNodes.includes(node)
33295
+ function containsArray(query, node) {
33296
+ var value = node[query.name]
33297
+
33298
+ if (value === null || value === undefined) return false
33299
+
33300
+ // If this is an array, and the query is contained in it, return true.
33301
+ // Coverage comment in place because TS turns `Array.isArray(unknown)`
33302
+ // into `Array.<any>` instead of `Array.<unknown>`.
33303
+ // type-coverage:ignore-next-line
33304
+ if (Array.isArray(value) && value.includes(query.value)) {
33305
+ return true
33306
+ }
33307
+
33308
+ // For all other values, return whether this is an exact match.
33309
+ return String(value) === query.value
33459
33310
  }
33460
33311
 
33461
33312
  /**
33462
- * @param {RulePseudo} _1
33313
+ * `[attr^=value]`
33314
+ *
33315
+ * @param {RuleAttr} query
33463
33316
  * @param {Node} node
33464
- * @returns {boolean}
33465
33317
  */
33466
- function empty(_1, node) {
33467
- return util_parent(node) ? node.children.length === 0 : !('value' in node)
33468
- }
33318
+ function begins(query, node) {
33319
+ var value = node[query.name]
33469
33320
 
33470
- /**
33471
- * @param {RulePseudo} query
33472
- * @param {Node} _1
33473
- * @param {number|null} _2
33474
- * @param {Parent|null} _3
33475
- * @param {SelectState} state
33476
- * @returns {boolean}
33477
- */
33478
- function firstChild(query, _1, _2, _3, state) {
33479
- assertDeep(state, query)
33480
- return state.nodeIndex === 0 // Specifically `0`, not falsey.
33321
+ return (
33322
+ typeof value === 'string' &&
33323
+ value.slice(0, query.value.length) === query.value
33324
+ )
33481
33325
  }
33482
33326
 
33483
33327
  /**
33484
- * @param {RulePseudo} query
33485
- * @param {Node} _1
33486
- * @param {number|null} _2
33487
- * @param {Parent|null} _3
33488
- * @param {SelectState} state
33489
- * @returns {boolean}
33328
+ * `[attr$=value]`
33329
+ *
33330
+ * @param {RuleAttr} query
33331
+ * @param {Node} node
33490
33332
  */
33491
- function lastChild(query, _1, _2, _3, state) {
33492
- assertDeep(state, query)
33493
- return state.nodeIndex === state.nodeCount - 1
33494
- }
33333
+ function ends(query, node) {
33334
+ var value = node[query.name]
33495
33335
 
33496
- /**
33497
- * @param {RulePseudo} query
33498
- * @param {Node} _1
33499
- * @param {number|null} _2
33500
- * @param {Parent|null} _3
33501
- * @param {SelectState} state
33502
- * @returns {boolean}
33503
- */
33504
- function onlyChild(query, _1, _2, _3, state) {
33505
- assertDeep(state, query)
33506
- return state.nodeCount === 1
33336
+ return (
33337
+ typeof value === 'string' &&
33338
+ value.slice(-query.value.length) === query.value
33339
+ )
33507
33340
  }
33508
33341
 
33509
33342
  /**
33510
- * @param {RulePseudoNth} query
33511
- * @param {Node} _1
33512
- * @param {number|null} _2
33513
- * @param {Parent|null} _3
33514
- * @param {SelectState} state
33515
- * @returns {boolean}
33343
+ * `[attr*=value]`
33344
+ *
33345
+ * @param {RuleAttr} query
33346
+ * @param {Node} node
33516
33347
  */
33517
- function nthChild(query, _1, _2, _3, state) {
33518
- assertDeep(state, query)
33519
- return query.value(state.nodeIndex)
33348
+ function containsString(query, node) {
33349
+ var value = node[query.name]
33350
+ return typeof value === 'string' && value.includes(query.value)
33520
33351
  }
33521
33352
 
33353
+ // Shouldn’t be invoked, Parser throws an error instead.
33354
+ /* c8 ignore next 6 */
33522
33355
  /**
33523
- * @param {RulePseudoNth} query
33524
- * @param {Node} _1
33525
- * @param {number|null} _2
33526
- * @param {Parent|null} _3
33527
- * @param {SelectState} state
33528
- * @returns {boolean}
33356
+ * @param {{[x: string]: unknown, type: string}} query
33529
33357
  */
33530
- function nthLastChild(query, _1, _2, _3, state) {
33531
- assertDeep(state, query)
33532
- return query.value(state.nodeCount - state.nodeIndex - 1)
33358
+ function unknownOperator(query) {
33359
+ throw new Error('Unknown operator `' + query.operator + '`')
33533
33360
  }
33534
33361
 
33362
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
33535
33363
  /**
33536
- * @param {RulePseudoNth} query
33537
- * @param {Node} _1
33538
- * @param {number|null} _2
33539
- * @param {Parent|null} _3
33540
- * @param {SelectState} state
33541
- * @returns {boolean}
33364
+ * @typedef {import('./types.js').Rule} Rule
33365
+ * @typedef {import('./types.js').Node} Node
33542
33366
  */
33543
- function nthOfType(query, _1, _2, _3, state) {
33544
- assertDeep(state, query)
33545
- return query.value(state.typeIndex)
33546
- }
33547
33367
 
33548
33368
  /**
33549
- * @param {RulePseudoNth} query
33550
- * @param {Node} _1
33551
- * @param {number|null} _2
33552
- * @param {Parent|null} _3
33553
- * @param {SelectState} state
33554
- * @returns {boolean}
33369
+ * @param {Rule} query
33370
+ * @param {Node} node
33555
33371
  */
33556
- function nthLastOfType(query, _1, _2, _3, state) {
33557
- assertDeep(state, query)
33558
- return query.value(state.typeCount - 1 - state.typeIndex)
33372
+ function name_name(query, node) {
33373
+ return query.tagName === '*' || query.tagName === node.type
33559
33374
  }
33560
33375
 
33376
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
33561
33377
  /**
33562
- * @param {RulePseudo} query
33563
- * @param {Node} _1
33564
- * @param {number|null} _2
33565
- * @param {Parent|null} _3
33566
- * @param {SelectState} state
33567
- * @returns {boolean}
33378
+ * @typedef {import('./types.js').Rule} Rule
33379
+ * @typedef {import('./types.js').Node} Node
33380
+ * @typedef {import('./types.js').Parent} Parent
33381
+ * @typedef {import('./types.js').SelectState} SelectState
33568
33382
  */
33569
- function firstOfType(query, _1, _2, _3, state) {
33570
- assertDeep(state, query)
33571
- return state.typeIndex === 0
33572
- }
33383
+
33384
+
33385
+
33386
+
33573
33387
 
33574
33388
  /**
33575
- * @param {RulePseudo} query
33576
- * @param {Node} _1
33577
- * @param {number|null} _2
33578
- * @param {Parent|null} _3
33389
+ * @param {Rule} query
33390
+ * @param {Node} node
33391
+ * @param {number|null} index
33392
+ * @param {Parent|null} parent
33579
33393
  * @param {SelectState} state
33580
33394
  * @returns {boolean}
33581
33395
  */
33582
- function lastOfType(query, _1, _2, _3, state) {
33583
- assertDeep(state, query)
33584
- return state.typeIndex === state.typeCount - 1
33396
+ function test(query, node, index, parent, state) {
33397
+ if (query.id) throw new Error('Invalid selector: id')
33398
+ if (query.classNames) throw new Error('Invalid selector: class')
33399
+
33400
+ return Boolean(
33401
+ node &&
33402
+ (!query.tagName || name_name(query, node)) &&
33403
+ (!query.attrs || attribute(query, node)) &&
33404
+ (!query.pseudos || pseudo(query, node, index, parent, state))
33405
+ )
33585
33406
  }
33586
33407
 
33408
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
33587
33409
  /**
33588
- * @param {RulePseudo} query
33589
- * @param {Node} _1
33590
- * @param {number|null} _2
33591
- * @param {Parent|null} _3
33592
- * @param {SelectState} state
33593
- * @returns {boolean}
33410
+ * @typedef {import('./types.js').Selector} Selector
33411
+ * @typedef {import('./types.js').Selectors} Selectors
33412
+ * @typedef {import('./types.js').Rule} Rule
33413
+ * @typedef {import('./types.js').RuleSet} RuleSet
33414
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
33415
+ * @typedef {import('./types.js').Query} Query
33416
+ * @typedef {import('./types.js').Node} Node
33417
+ * @typedef {import('./types.js').Parent} Parent
33418
+ * @typedef {import('./types.js').SelectIterator} SelectIterator
33419
+ * @typedef {import('./types.js').SelectState} SelectState
33594
33420
  */
33595
- function onlyOfType(query, _1, _2, _3, state) {
33596
- assertDeep(state, query)
33597
- return state.typeCount === 1
33598
- }
33599
33421
 
33600
- // Shouldn’t be invoked, parser gives correct data.
33601
- /* c8 ignore next 3 */
33602
- function invalidPseudo() {
33603
- throw new Error('Invalid pseudo-selector')
33422
+
33423
+
33424
+
33425
+
33426
+
33427
+
33428
+ var type = zwitch('type', {
33429
+ unknown: unknownType,
33430
+ invalid: invalidType,
33431
+ handlers: {selectors, ruleSet, rule}
33432
+ })
33433
+
33434
+ /**
33435
+ * @param {Selectors|RuleSet|Rule} query
33436
+ * @param {Node} node
33437
+ * @param {SelectState} state
33438
+ */
33439
+ function any(query, node, state) {
33440
+ // @ts-ignore zwitch types are off.
33441
+ return query && node ? type(query, node, state) : []
33604
33442
  }
33605
33443
 
33606
33444
  /**
33607
- * @param {RulePseudo} query
33608
- * @returns {boolean}
33445
+ * @param {Selectors} query
33446
+ * @param {Node} node
33447
+ * @param {SelectState} state
33609
33448
  */
33610
- function unknownPseudo(query) {
33611
- if (query.name) {
33612
- throw new Error('Unknown pseudo-selector `' + query.name + '`')
33449
+ function selectors(query, node, state) {
33450
+ var collect = collector(state.one)
33451
+ var index = -1
33452
+
33453
+ while (++index < query.selectors.length) {
33454
+ collect(ruleSet(query.selectors[index], node, state))
33613
33455
  }
33614
33456
 
33615
- throw new Error('Unexpected pseudo-element or empty pseudo-class')
33457
+ return collect.result
33616
33458
  }
33617
33459
 
33618
33460
  /**
33461
+ * @param {RuleSet} query
33462
+ * @param {Node} node
33619
33463
  * @param {SelectState} state
33620
- * @param {RulePseudo|RulePseudoNth} query
33621
33464
  */
33622
- function assertDeep(state, query) {
33623
- if (state.shallow) {
33624
- throw new Error('Cannot use `:' + query.name + '` without parent')
33625
- }
33465
+ function ruleSet(query, node, state) {
33466
+ return rule(query.rule, node, state)
33626
33467
  }
33627
33468
 
33628
33469
  /**
33629
- * @param {RulePseudoSelector} query
33630
- * @param {Node} node
33631
- * @param {number|null} _1
33632
- * @param {Parent|null} _2
33470
+ * @param {Rule} query
33471
+ * @param {Node} tree
33633
33472
  * @param {SelectState} state
33634
- * @returns {boolean}
33635
33473
  */
33636
- function hasSelector(query, node, _1, _2, state) {
33637
- var shallow = state.shallow
33638
- var one = state.one
33639
- var scopeNodes = state.scopeNodes
33640
- var value = appendScope(query.value)
33641
- var anything = state.any
33642
- /** @type {boolean} */
33643
- var result
33474
+ function rule(query, tree, state) {
33475
+ var collect = collector(state.one)
33644
33476
 
33645
- state.shallow = false
33646
- state.one = true
33647
- state.scopeNodes = [node]
33477
+ if (state.shallow && query.rule) {
33478
+ throw new Error('Expected selector without nesting')
33479
+ }
33648
33480
 
33649
- result = Boolean(anything(value, node, state)[0])
33481
+ nest(
33482
+ query,
33483
+ tree,
33484
+ 0,
33485
+ null,
33486
+ configure(query, {
33487
+ scopeNodes: root(tree) ? tree.children : [tree],
33488
+ index: false,
33489
+ iterator,
33490
+ one: state.one,
33491
+ shallow: state.shallow,
33492
+ any: state.any
33493
+ })
33494
+ )
33650
33495
 
33651
- state.shallow = shallow
33652
- state.one = one
33653
- state.scopeNodes = scopeNodes
33496
+ return collect.result
33654
33497
 
33655
- return result
33498
+ /** @type {SelectIterator} */
33499
+ function iterator(query, node, index, parent, state) {
33500
+ if (test(query, node, index, parent, state)) {
33501
+ if ('rule' in query) {
33502
+ nest(query.rule, node, index, parent, configure(query.rule, state))
33503
+ } else {
33504
+ collect(node)
33505
+ state.found = true
33506
+ }
33507
+ }
33508
+ }
33656
33509
  }
33657
33510
 
33658
33511
  /**
33659
- * @param {Selector} value
33512
+ * @template {SelectState} S
33513
+ * @param {Rule} query
33514
+ * @param {S} state
33515
+ * @returns {S}
33660
33516
  */
33661
- function appendScope(value) {
33662
- /** @type {Selectors} */
33663
- var selector =
33664
- value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
33517
+ function configure(query, state) {
33518
+ var pseudos = query.pseudos || []
33665
33519
  var index = -1
33666
- /** @type {Rule} */
33667
- var rule
33668
-
33669
- while (++index < selector.selectors.length) {
33670
- rule = selector.selectors[index].rule
33671
- rule.nestingOperator = null
33672
33520
 
33673
- // Needed if new pseudo’s are added that accepts commas (such as
33674
- // `:lang(en, nl)`)
33675
- /* c8 ignore else */
33676
- if (
33677
- !rule.pseudos ||
33678
- rule.pseudos.length !== 1 ||
33679
- rule.pseudos[0].name !== 'scope'
33680
- ) {
33681
- selector.selectors[index] = {
33682
- type: 'ruleSet',
33683
- rule: {
33684
- type: 'rule',
33685
- rule,
33686
- // @ts-ignore pseudos are fine w/ just a name!
33687
- pseudos: [{name: 'scope'}]
33688
- }
33689
- }
33521
+ while (++index < pseudos.length) {
33522
+ if (pseudo.needsIndex.includes(pseudos[index].name)) {
33523
+ state.index = true
33524
+ break
33690
33525
  }
33691
33526
  }
33692
33527
 
33693
- return selector
33528
+ return state
33694
33529
  }
33695
33530
 
33696
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
33531
+ // Shouldn’t be invoked, all data is handled.
33532
+ /* c8 ignore next 6 */
33697
33533
  /**
33698
- * @typedef {import('./types.js').Rule} Rule
33699
- * @typedef {import('./types.js').RuleAttr} RuleAttr
33700
- * @typedef {import('./types.js').Node} Node
33534
+ * @param {{[x: string]: unknown, type: string}} query
33701
33535
  */
33536
+ function unknownType(query) {
33537
+ throw new Error('Unknown type `' + query.type + '`')
33538
+ }
33702
33539
 
33703
-
33704
-
33705
- var attribute_handle = zwitch('operator', {
33706
- unknown: unknownOperator,
33707
- invalid: exists,
33708
- handlers: {
33709
- '=': exact,
33710
- '^=': begins,
33711
- '$=': ends,
33712
- '*=': containsString,
33713
- '~=': containsArray
33714
- }
33715
- })
33540
+ // Shouldn’t be invoked, parser gives correct data.
33541
+ /* c8 ignore next 3 */
33542
+ function invalidType() {
33543
+ throw new Error('Invalid type')
33544
+ }
33716
33545
 
33717
33546
  /**
33718
- * @param {Rule} query
33719
- * @param {Node} node
33547
+ * @param {boolean} one
33720
33548
  */
33721
- function attribute(query, node) {
33722
- var index = -1
33549
+ function collector(one) {
33550
+ /** @type {Array.<Node>} */
33551
+ var result = []
33552
+ /** @type {boolean} */
33553
+ var found
33723
33554
 
33724
- while (++index < query.attrs.length) {
33725
- if (!attribute_handle(query.attrs[index], node)) return false
33555
+ collect.result = result
33556
+
33557
+ return collect
33558
+
33559
+ /**
33560
+ * Append nodes to array, filtering out duplicates.
33561
+ *
33562
+ * @param {Node|Array.<Node>} node
33563
+ */
33564
+ function collect(node) {
33565
+ var index = -1
33566
+
33567
+ if ('length' in node) {
33568
+ while (++index < node.length) {
33569
+ collectOne(node[index])
33570
+ }
33571
+ } else {
33572
+ collectOne(node)
33573
+ }
33726
33574
  }
33727
33575
 
33728
- return true
33729
- }
33576
+ /**
33577
+ * @param {Node} node
33578
+ */
33579
+ function collectOne(node) {
33580
+ if (one) {
33581
+ /* Shouldn’t happen, safeguards performance problems. */
33582
+ /* c8 ignore next */
33583
+ if (found) throw new Error('Cannot collect multiple nodes')
33730
33584
 
33731
- /**
33732
- * `[attr]`
33733
- *
33734
- * @param {RuleAttr} query
33735
- * @param {Node} node
33736
- */
33737
- function exists(query, node) {
33738
- return node[query.name] !== null && node[query.name] !== undefined
33739
- }
33585
+ found = true
33586
+ }
33740
33587
 
33741
- /**
33742
- * `[attr=value]`
33743
- *
33744
- * @param {RuleAttr} query
33745
- * @param {Node} node
33746
- */
33747
- function exact(query, node) {
33748
- return exists(query, node) && String(node[query.name]) === query.value
33588
+ if (!result.includes(node)) result.push(node)
33589
+ }
33749
33590
  }
33750
33591
 
33592
+ // EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
33593
+ var lib = __webpack_require__(8079);
33594
+ // EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
33595
+ var nth_check_lib = __webpack_require__(7540);
33596
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
33751
33597
  /**
33752
- * `[attr~=value]`
33753
- *
33754
- * @param {RuleAttr} query
33755
- * @param {Node} node
33598
+ * @typedef {import('./types.js').Selector} Selector
33599
+ * @typedef {import('./types.js').Selectors} Selectors
33600
+ * @typedef {import('./types.js').RuleSet} RuleSet
33601
+ * @typedef {import('./types.js').Rule} Rule
33602
+ * @typedef {import('./types.js').RulePseudo} RulePseudo
33603
+ * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33756
33604
  */
33757
- function containsArray(query, node) {
33758
- var value = node[query.name]
33759
33605
 
33760
- if (value === null || value === undefined) return false
33761
33606
 
33762
- // If this is an array, and the query is contained in it, return true.
33763
- // Coverage comment in place because TS turns `Array.isArray(unknown)`
33764
- // into `Array.<any>` instead of `Array.<unknown>`.
33765
- // type-coverage:ignore-next-line
33766
- if (Array.isArray(value) && value.includes(query.value)) {
33767
- return true
33768
- }
33769
33607
 
33770
- // For all other values, return whether this is an exact match.
33771
- return String(value) === query.value
33772
- }
33608
+
33609
+
33610
+ /** @type {import('nth-check').default} */
33611
+ // @ts-ignore
33612
+ var nthCheck = nth_check_lib/* default */.ZP
33613
+
33614
+ var nth = new Set([
33615
+ 'nth-child',
33616
+ 'nth-last-child',
33617
+ 'nth-of-type',
33618
+ 'nth-last-of-type'
33619
+ ])
33620
+
33621
+ var parser = new lib/* CssSelectorParser */.N()
33622
+
33623
+ parser.registerAttrEqualityMods('~', '^', '$', '*')
33624
+ parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
33625
+ parser.registerNestingOperators('>', '+', '~')
33626
+
33627
+ var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
33773
33628
 
33774
33629
  /**
33775
- * `[attr^=value]`
33776
- *
33777
- * @param {RuleAttr} query
33778
- * @param {Node} node
33630
+ * @param {string} selector
33631
+ * @returns {Selector}
33779
33632
  */
33780
- function begins(query, node) {
33781
- var value = node[query.name]
33633
+ function parse(selector) {
33634
+ if (typeof selector !== 'string') {
33635
+ throw new TypeError('Expected `string` as selector, not `' + selector + '`')
33636
+ }
33782
33637
 
33783
- return (
33784
- typeof value === 'string' &&
33785
- value.slice(0, query.value.length) === query.value
33786
- )
33638
+ // @ts-ignore types are wrong.
33639
+ return compile(parser.parse(selector))
33787
33640
  }
33788
33641
 
33789
33642
  /**
33790
- * `[attr$=value]`
33791
- *
33792
- * @param {RuleAttr} query
33793
- * @param {Node} node
33643
+ * @param {Selectors} query
33794
33644
  */
33795
- function ends(query, node) {
33796
- var value = node[query.name]
33645
+ function parse_selectors(query) {
33646
+ var selectors = query.selectors
33647
+ var index = -1
33797
33648
 
33798
- return (
33799
- typeof value === 'string' &&
33800
- value.slice(-query.value.length) === query.value
33801
- )
33802
- }
33649
+ while (++index < selectors.length) {
33650
+ compile(selectors[index])
33651
+ }
33803
33652
 
33804
- /**
33805
- * `[attr*=value]`
33806
- *
33807
- * @param {RuleAttr} query
33808
- * @param {Node} node
33809
- */
33810
- function containsString(query, node) {
33811
- var value = node[query.name]
33812
- return typeof value === 'string' && value.includes(query.value)
33653
+ return query
33813
33654
  }
33814
33655
 
33815
- // Shouldn’t be invoked, Parser throws an error instead.
33816
- /* c8 ignore next 6 */
33817
33656
  /**
33818
- * @param {{[x: string]: unknown, type: string}} query
33657
+ * @param {RuleSet} query
33819
33658
  */
33820
- function unknownOperator(query) {
33821
- throw new Error('Unknown operator `' + query.operator + '`')
33659
+ function parse_ruleSet(query) {
33660
+ return parse_rule(query.rule)
33822
33661
  }
33823
33662
 
33824
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
33825
- /**
33826
- * @typedef {import('./types.js').Rule} Rule
33827
- * @typedef {import('./types.js').Node} Node
33828
- */
33829
-
33830
33663
  /**
33831
33664
  * @param {Rule} query
33832
- * @param {Node} node
33833
- */
33834
- function name_name(query, node) {
33835
- return query.tagName === '*' || query.tagName === node.type
33836
- }
33837
-
33838
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
33839
- /**
33840
- * @typedef {import('./types.js').Rule} Rule
33841
- * @typedef {import('./types.js').Node} Node
33842
- * @typedef {import('./types.js').Parent} Parent
33843
- * @typedef {import('./types.js').SelectState} SelectState
33844
33665
  */
33666
+ function parse_rule(query) {
33667
+ var pseudos = query.pseudos || []
33668
+ var index = -1
33669
+ /** @type {RulePseudo|RulePseudoNth} */
33670
+ var pseudo
33845
33671
 
33672
+ while (++index < pseudos.length) {
33673
+ pseudo = pseudos[index]
33846
33674
 
33675
+ if (nth.has(pseudo.name)) {
33676
+ // @ts-ignore Patch a non-primitive type.
33677
+ pseudo.value = nthCheck(pseudo.value)
33678
+ // @ts-ignore Patch a non-primitive type.
33679
+ pseudo.valueType = 'function'
33680
+ }
33681
+ }
33847
33682
 
33683
+ compile(query.rule)
33848
33684
 
33849
-
33850
- /**
33851
- * @param {Rule} query
33852
- * @param {Node} node
33853
- * @param {number|null} index
33854
- * @param {Parent|null} parent
33855
- * @param {SelectState} state
33856
- * @returns {boolean}
33857
- */
33858
- function test(query, node, index, parent, state) {
33859
- if (query.id) throw new Error('Invalid selector: id')
33860
- if (query.classNames) throw new Error('Invalid selector: class')
33861
-
33862
- return Boolean(
33863
- node &&
33864
- (!query.tagName || name_name(query, node)) &&
33865
- (!query.attrs || attribute(query, node)) &&
33866
- (!query.pseudos || pseudo(query, node, index, parent, state))
33867
- )
33685
+ return query
33868
33686
  }
33869
33687
 
33870
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
33688
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
33871
33689
  /**
33872
- * @typedef {import('./types.js').Selector} Selector
33873
- * @typedef {import('./types.js').Selectors} Selectors
33874
- * @typedef {import('./types.js').Rule} Rule
33875
- * @typedef {import('./types.js').RuleSet} RuleSet
33876
- * @typedef {import('./types.js').RulePseudo} RulePseudo
33877
- * @typedef {import('./types.js').Query} Query
33878
- * @typedef {import('./types.js').Node} Node
33879
- * @typedef {import('./types.js').Parent} Parent
33880
- * @typedef {import('./types.js').SelectIterator} SelectIterator
33881
- * @typedef {import('./types.js').SelectState} SelectState
33690
+ * @typedef {import('unist').Node} Node
33882
33691
  */
33883
33692
 
33884
33693
 
33885
33694
 
33886
33695
 
33887
-
33888
-
33889
-
33890
- var type = zwitch('type', {
33891
- unknown: unknownType,
33892
- invalid: invalidType,
33893
- handlers: {selectors, ruleSet, rule}
33894
- })
33895
-
33896
33696
  /**
33897
- * @param {Selectors|RuleSet|Rule} query
33898
- * @param {Node} node
33899
- * @param {SelectState} state
33697
+ * @param {string} selector
33698
+ * @param {Node} [node]
33699
+ * @returns {boolean}
33900
33700
  */
33901
- function any(query, node, state) {
33902
- // @ts-ignore zwitch types are off.
33903
- return query && node ? type(query, node, state) : []
33701
+ function unist_util_select_matches(selector, node) {
33702
+ return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
33904
33703
  }
33905
33704
 
33906
33705
  /**
33907
- * @param {Selectors} query
33908
- * @param {Node} node
33909
- * @param {SelectState} state
33706
+ * @param {string} selector
33707
+ * @param {Node} [node]
33708
+ * @returns {Node|null}
33910
33709
  */
33911
- function selectors(query, node, state) {
33912
- var collect = collector(state.one)
33913
- var index = -1
33914
-
33915
- while (++index < query.selectors.length) {
33916
- collect(ruleSet(query.selectors[index], node, state))
33917
- }
33918
-
33919
- return collect.result
33710
+ function unist_util_select_select(selector, node) {
33711
+ return any(parse(selector), node, {one: true, any: any})[0] || null
33920
33712
  }
33921
33713
 
33922
33714
  /**
33923
- * @param {RuleSet} query
33924
- * @param {Node} node
33925
- * @param {SelectState} state
33715
+ * @param {string} selector
33716
+ * @param {Node} [node]
33717
+ * @returns {Array.<Node>}
33926
33718
  */
33927
- function ruleSet(query, node, state) {
33928
- return rule(query.rule, node, state)
33719
+ function selectAll(selector, node) {
33720
+ return any(parse(selector), node, {any: any})
33929
33721
  }
33930
33722
 
33723
+
33724
+ /***/ }),
33725
+
33726
+ /***/ 6393:
33727
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
33728
+
33729
+ "use strict";
33730
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33731
+ /* harmony export */ "Vn": () => (/* binding */ visit)
33732
+ /* harmony export */ });
33733
+ /* harmony import */ var unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9445);
33931
33734
  /**
33932
- * @param {Rule} query
33933
- * @param {Node} tree
33934
- * @param {SelectState} state
33735
+ * @typedef {import('unist').Node} Node
33736
+ * @typedef {import('unist').Parent} Parent
33737
+ * @typedef {import('unist-util-is').Test} Test
33738
+ * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
33739
+ * @typedef {import('./complex-types.js').Visitor} Visitor
33935
33740
  */
33936
- function rule(query, tree, state) {
33937
- var collect = collector(state.one)
33938
33741
 
33939
- if (state.shallow && query.rule) {
33940
- throw new Error('Expected selector without nesting')
33941
- }
33942
33742
 
33943
- nest(
33944
- query,
33945
- tree,
33946
- 0,
33947
- null,
33948
- configure(query, {
33949
- scopeNodes: root(tree) ? tree.children : [tree],
33950
- index: false,
33951
- iterator,
33952
- one: state.one,
33953
- shallow: state.shallow,
33954
- any: state.any
33955
- })
33956
- )
33957
33743
 
33958
- return collect.result
33744
+ /**
33745
+ * Visit children of tree which pass test.
33746
+ *
33747
+ * @param tree
33748
+ * Tree to walk
33749
+ * @param [test]
33750
+ * `unist-util-is`-compatible test
33751
+ * @param visitor
33752
+ * Function called for nodes that pass `test`.
33753
+ * @param reverse
33754
+ * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
33755
+ */
33756
+ const visit =
33757
+ /**
33758
+ * @type {(
33759
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
33760
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
33761
+ * )}
33762
+ */
33763
+ (
33764
+ /**
33765
+ * @param {Node} tree
33766
+ * @param {Test} test
33767
+ * @param {import('./complex-types.js').Visitor} visitor
33768
+ * @param {boolean} [reverse]
33769
+ */
33770
+ function (tree, test, visitor, reverse) {
33771
+ if (typeof test === 'function' && typeof visitor !== 'function') {
33772
+ reverse = visitor
33773
+ visitor = test
33774
+ test = null
33775
+ }
33959
33776
 
33960
- /** @type {SelectIterator} */
33961
- function iterator(query, node, index, parent, state) {
33962
- if (test(query, node, index, parent, state)) {
33963
- if ('rule' in query) {
33964
- nest(query.rule, node, index, parent, configure(query.rule, state))
33965
- } else {
33966
- collect(node)
33967
- state.found = true
33777
+ (0,unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__/* .visitParents */ .S4)(tree, test, overload, reverse)
33778
+
33779
+ /**
33780
+ * @param {Node} node
33781
+ * @param {Array<Parent>} parents
33782
+ */
33783
+ function overload(node, parents) {
33784
+ const parent = parents[parents.length - 1]
33785
+ return visitor(
33786
+ node,
33787
+ parent ? parent.children.indexOf(node) : null,
33788
+ parent
33789
+ )
33968
33790
  }
33969
33791
  }
33970
- }
33971
- }
33792
+ )
33972
33793
 
33973
- /**
33974
- * @template {SelectState} S
33975
- * @param {Rule} query
33976
- * @param {S} state
33977
- * @returns {S}
33978
- */
33979
- function configure(query, state) {
33980
- var pseudos = query.pseudos || []
33981
- var index = -1
33982
33794
 
33983
- while (++index < pseudos.length) {
33984
- if (pseudo.needsIndex.includes(pseudos[index].name)) {
33985
- state.index = true
33986
- break
33987
- }
33988
- }
33989
33795
 
33990
- return state
33991
- }
33992
33796
 
33993
- // Shouldn’t be invoked, all data is handled.
33994
- /* c8 ignore next 6 */
33797
+ /***/ }),
33798
+
33799
+ /***/ 9445:
33800
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
33801
+
33802
+ "use strict";
33803
+
33804
+ // EXPORTS
33805
+ __webpack_require__.d(__webpack_exports__, {
33806
+ "AM": () => (/* binding */ SKIP),
33807
+ "S4": () => (/* binding */ visitParents)
33808
+ });
33809
+
33810
+ // UNUSED EXPORTS: CONTINUE, EXIT
33811
+
33812
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
33995
33813
  /**
33996
- * @param {{[x: string]: unknown, type: string}} query
33814
+ * @typedef {import('unist').Node} Node
33815
+ * @typedef {import('unist').Parent} Parent
33816
+ *
33817
+ * @typedef {string} Type
33818
+ * @typedef {Object<string, unknown>} Props
33819
+ *
33820
+ * @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
33997
33821
  */
33998
- function unknownType(query) {
33999
- throw new Error('Unknown type `' + query.type + '`')
34000
- }
34001
33822
 
34002
- // Shouldn’t be invoked, parser gives correct data.
34003
- /* c8 ignore next 3 */
34004
- function invalidType() {
34005
- throw new Error('Invalid type')
34006
- }
33823
+ /**
33824
+ * Check if a node passes a test
33825
+ *
33826
+ * @callback TestFunctionAnything
33827
+ * @param {Node} node
33828
+ * @param {number|null|undefined} [index]
33829
+ * @param {Parent|null|undefined} [parent]
33830
+ * @returns {boolean|void}
33831
+ */
34007
33832
 
34008
33833
  /**
34009
- * @param {boolean} one
33834
+ * Check if a node passes a certain node test
33835
+ *
33836
+ * @template {Node} X
33837
+ * @callback TestFunctionPredicate
33838
+ * @param {Node} node
33839
+ * @param {number|null|undefined} [index]
33840
+ * @param {Parent|null|undefined} [parent]
33841
+ * @returns {node is X}
34010
33842
  */
34011
- function collector(one) {
34012
- /** @type {Array.<Node>} */
34013
- var result = []
34014
- /** @type {boolean} */
34015
- var found
34016
33843
 
34017
- collect.result = result
33844
+ /**
33845
+ * @callback AssertAnything
33846
+ * @param {unknown} [node]
33847
+ * @param {number|null|undefined} [index]
33848
+ * @param {Parent|null|undefined} [parent]
33849
+ * @returns {boolean}
33850
+ */
34018
33851
 
34019
- return collect
33852
+ /**
33853
+ * Check if a node passes a certain node test
33854
+ *
33855
+ * @template {Node} Y
33856
+ * @callback AssertPredicate
33857
+ * @param {unknown} [node]
33858
+ * @param {number|null|undefined} [index]
33859
+ * @param {Parent|null|undefined} [parent]
33860
+ * @returns {node is Y}
33861
+ */
34020
33862
 
33863
+ const is =
34021
33864
  /**
34022
- * Append nodes to array, filtering out duplicates.
33865
+ * Check if a node passes a test.
33866
+ * When a `parent` node is known the `index` of node should also be given.
34023
33867
  *
34024
- * @param {Node|Array.<Node>} node
33868
+ * @type {(
33869
+ * (<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) &
33870
+ * ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
33871
+ * )}
34025
33872
  */
34026
- function collect(node) {
34027
- var index = -1
33873
+ (
33874
+ /**
33875
+ * Check if a node passes a test.
33876
+ * When a `parent` node is known the `index` of node should also be given.
33877
+ *
33878
+ * @param {unknown} [node] Node to check
33879
+ * @param {Test} [test]
33880
+ * When nullish, checks if `node` is a `Node`.
33881
+ * When `string`, works like passing `function (node) {return node.type === test}`.
33882
+ * When `function` checks if function passed the node is true.
33883
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33884
+ * When `array`, checks any one of the subtests pass.
33885
+ * @param {number|null|undefined} [index] Position of `node` in `parent`
33886
+ * @param {Parent|null|undefined} [parent] Parent of `node`
33887
+ * @param {unknown} [context] Context object to invoke `test` with
33888
+ * @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
33889
+ */
33890
+ // eslint-disable-next-line max-params
33891
+ function is(node, test, index, parent, context) {
33892
+ const check = convert(test)
34028
33893
 
34029
- if ('length' in node) {
34030
- while (++index < node.length) {
34031
- collectOne(node[index])
33894
+ if (
33895
+ index !== undefined &&
33896
+ index !== null &&
33897
+ (typeof index !== 'number' ||
33898
+ index < 0 ||
33899
+ index === Number.POSITIVE_INFINITY)
33900
+ ) {
33901
+ throw new Error('Expected positive finite index')
34032
33902
  }
34033
- } else {
34034
- collectOne(node)
33903
+
33904
+ if (
33905
+ parent !== undefined &&
33906
+ parent !== null &&
33907
+ (!is(parent) || !parent.children)
33908
+ ) {
33909
+ throw new Error('Expected parent node')
33910
+ }
33911
+
33912
+ if (
33913
+ (parent === undefined || parent === null) !==
33914
+ (index === undefined || index === null)
33915
+ ) {
33916
+ throw new Error('Expected both parent and index')
33917
+ }
33918
+
33919
+ // @ts-expect-error Looks like a node.
33920
+ return node && node.type && typeof node.type === 'string'
33921
+ ? Boolean(check.call(context, node, index, parent))
33922
+ : false
34035
33923
  }
34036
- }
33924
+ )
34037
33925
 
33926
+ const convert =
34038
33927
  /**
34039
- * @param {Node} node
33928
+ * @type {(
33929
+ * (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
33930
+ * ((test?: Test) => AssertAnything)
33931
+ * )}
34040
33932
  */
34041
- function collectOne(node) {
34042
- if (one) {
34043
- /* Shouldn’t happen, safeguards performance problems. */
34044
- /* c8 ignore next */
34045
- if (found) throw new Error('Cannot collect multiple nodes')
33933
+ (
33934
+ /**
33935
+ * Generate an assertion from a check.
33936
+ * @param {Test} [test]
33937
+ * When nullish, checks if `node` is a `Node`.
33938
+ * When `string`, works like passing `function (node) {return node.type === test}`.
33939
+ * When `function` checks if function passed the node is true.
33940
+ * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
33941
+ * When `array`, checks any one of the subtests pass.
33942
+ * @returns {AssertAnything}
33943
+ */
33944
+ function (test) {
33945
+ if (test === undefined || test === null) {
33946
+ return ok
33947
+ }
34046
33948
 
34047
- found = true
34048
- }
33949
+ if (typeof test === 'string') {
33950
+ return typeFactory(test)
33951
+ }
34049
33952
 
34050
- if (!result.includes(node)) result.push(node)
34051
- }
34052
- }
33953
+ if (typeof test === 'object') {
33954
+ return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
33955
+ }
34053
33956
 
34054
- // EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
34055
- var lib = __webpack_require__(8079);
34056
- // EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
34057
- var nth_check_lib = __webpack_require__(7540);
34058
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
33957
+ if (typeof test === 'function') {
33958
+ return castFactory(test)
33959
+ }
33960
+
33961
+ throw new Error('Expected function, string, or object as test')
33962
+ }
33963
+ )
34059
33964
  /**
34060
- * @typedef {import('./types.js').Selector} Selector
34061
- * @typedef {import('./types.js').Selectors} Selectors
34062
- * @typedef {import('./types.js').RuleSet} RuleSet
34063
- * @typedef {import('./types.js').Rule} Rule
34064
- * @typedef {import('./types.js').RulePseudo} RulePseudo
34065
- * @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
33965
+ * @param {Array.<Type|Props|TestFunctionAnything>} tests
33966
+ * @returns {AssertAnything}
34066
33967
  */
33968
+ function anyFactory(tests) {
33969
+ /** @type {Array.<AssertAnything>} */
33970
+ const checks = []
33971
+ let index = -1
34067
33972
 
33973
+ while (++index < tests.length) {
33974
+ checks[index] = convert(tests[index])
33975
+ }
34068
33976
 
33977
+ return castFactory(any)
34069
33978
 
33979
+ /**
33980
+ * @this {unknown}
33981
+ * @param {unknown[]} parameters
33982
+ * @returns {boolean}
33983
+ */
33984
+ function any(...parameters) {
33985
+ let index = -1
34070
33986
 
33987
+ while (++index < checks.length) {
33988
+ if (checks[index].call(this, ...parameters)) return true
33989
+ }
34071
33990
 
34072
- /** @type {import('nth-check').default} */
34073
- // @ts-ignore
34074
- var nthCheck = nth_check_lib/* default */.ZP
33991
+ return false
33992
+ }
33993
+ }
34075
33994
 
34076
- var nth = new Set([
34077
- 'nth-child',
34078
- 'nth-last-child',
34079
- 'nth-of-type',
34080
- 'nth-last-of-type'
34081
- ])
33995
+ /**
33996
+ * Utility to assert each property in `test` is represented in `node`, and each
33997
+ * values are strictly equal.
33998
+ *
33999
+ * @param {Props} check
34000
+ * @returns {AssertAnything}
34001
+ */
34002
+ function propsFactory(check) {
34003
+ return castFactory(all)
34082
34004
 
34083
- var parser = new lib/* CssSelectorParser */.N()
34005
+ /**
34006
+ * @param {Node} node
34007
+ * @returns {boolean}
34008
+ */
34009
+ function all(node) {
34010
+ /** @type {string} */
34011
+ let key
34084
34012
 
34085
- parser.registerAttrEqualityMods('~', '^', '$', '*')
34086
- parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
34087
- parser.registerNestingOperators('>', '+', '~')
34013
+ for (key in check) {
34014
+ // @ts-expect-error: hush, it sure works as an index.
34015
+ if (node[key] !== check[key]) return false
34016
+ }
34088
34017
 
34089
- var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
34018
+ return true
34019
+ }
34020
+ }
34090
34021
 
34091
34022
  /**
34092
- * @param {string} selector
34093
- * @returns {Selector}
34023
+ * Utility to convert a string into a function which checks a given node’s type
34024
+ * for said string.
34025
+ *
34026
+ * @param {Type} check
34027
+ * @returns {AssertAnything}
34094
34028
  */
34095
- function parse(selector) {
34096
- if (typeof selector !== 'string') {
34097
- throw new TypeError('Expected `string` as selector, not `' + selector + '`')
34098
- }
34029
+ function typeFactory(check) {
34030
+ return castFactory(type)
34099
34031
 
34100
- // @ts-ignore types are wrong.
34101
- return compile(parser.parse(selector))
34032
+ /**
34033
+ * @param {Node} node
34034
+ */
34035
+ function type(node) {
34036
+ return node && node.type === check
34037
+ }
34102
34038
  }
34103
34039
 
34104
34040
  /**
34105
- * @param {Selectors} query
34041
+ * Utility to convert a string into a function which checks a given node’s type
34042
+ * for said string.
34043
+ * @param {TestFunctionAnything} check
34044
+ * @returns {AssertAnything}
34106
34045
  */
34107
- function parse_selectors(query) {
34108
- var selectors = query.selectors
34109
- var index = -1
34046
+ function castFactory(check) {
34047
+ return assertion
34110
34048
 
34111
- while (++index < selectors.length) {
34112
- compile(selectors[index])
34049
+ /**
34050
+ * @this {unknown}
34051
+ * @param {Array.<unknown>} parameters
34052
+ * @returns {boolean}
34053
+ */
34054
+ function assertion(...parameters) {
34055
+ // @ts-expect-error: spreading is fine.
34056
+ return Boolean(check.call(this, ...parameters))
34113
34057
  }
34058
+ }
34114
34059
 
34115
- return query
34060
+ // Utility to return true.
34061
+ function ok() {
34062
+ return true
34116
34063
  }
34117
34064
 
34065
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.js
34118
34066
  /**
34119
- * @param {RuleSet} query
34067
+ * @param {string} d
34068
+ * @returns {string}
34120
34069
  */
34121
- function parse_ruleSet(query) {
34122
- return parse_rule(query.rule)
34070
+ function color(d) {
34071
+ return '\u001B[33m' + d + '\u001B[39m'
34123
34072
  }
34124
34073
 
34074
+ ;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
34125
34075
  /**
34126
- * @param {Rule} query
34076
+ * @typedef {import('unist').Node} Node
34077
+ * @typedef {import('unist').Parent} Parent
34078
+ * @typedef {import('unist-util-is').Test} Test
34079
+ * @typedef {import('./complex-types.js').Action} Action
34080
+ * @typedef {import('./complex-types.js').Index} Index
34081
+ * @typedef {import('./complex-types.js').ActionTuple} ActionTuple
34082
+ * @typedef {import('./complex-types.js').VisitorResult} VisitorResult
34083
+ * @typedef {import('./complex-types.js').Visitor} Visitor
34127
34084
  */
34128
- function parse_rule(query) {
34129
- var pseudos = query.pseudos || []
34130
- var index = -1
34131
- /** @type {RulePseudo|RulePseudoNth} */
34132
- var pseudo
34133
34085
 
34134
- while (++index < pseudos.length) {
34135
- pseudo = pseudos[index]
34136
34086
 
34137
- if (nth.has(pseudo.name)) {
34138
- // @ts-ignore Patch a non-primitive type.
34139
- pseudo.value = nthCheck(pseudo.value)
34140
- // @ts-ignore Patch a non-primitive type.
34141
- pseudo.valueType = 'function'
34142
- }
34143
- }
34144
34087
 
34145
- compile(query.rule)
34146
34088
 
34147
- return query
34148
- }
34089
+ /**
34090
+ * Continue traversing as normal
34091
+ */
34092
+ const CONTINUE = true
34093
+ /**
34094
+ * Do not traverse this node’s children
34095
+ */
34096
+ const SKIP = 'skip'
34097
+ /**
34098
+ * Stop traversing immediately
34099
+ */
34100
+ const EXIT = false
34149
34101
 
34150
- ;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
34151
34102
  /**
34152
- * @typedef {import('unist').Node} Node
34103
+ * Visit children of tree which pass test.
34104
+ *
34105
+ * @param tree
34106
+ * Tree to walk
34107
+ * @param [test]
34108
+ * `unist-util-is`-compatible test
34109
+ * @param visitor
34110
+ * Function called for nodes that pass `test`.
34111
+ * @param [reverse=false]
34112
+ * Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
34153
34113
  */
34114
+ const visitParents =
34115
+ /**
34116
+ * @type {(
34117
+ * (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
34118
+ * (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
34119
+ * )}
34120
+ */
34121
+ (
34122
+ /**
34123
+ * @param {Node} tree
34124
+ * @param {Test} test
34125
+ * @param {import('./complex-types.js').Visitor<Node>} visitor
34126
+ * @param {boolean} [reverse=false]
34127
+ */
34128
+ function (tree, test, visitor, reverse) {
34129
+ if (typeof test === 'function' && typeof visitor !== 'function') {
34130
+ reverse = visitor
34131
+ // @ts-expect-error no visitor given, so `visitor` is test.
34132
+ visitor = test
34133
+ test = null
34134
+ }
34154
34135
 
34136
+ const is = convert(test)
34137
+ const step = reverse ? -1 : 1
34155
34138
 
34139
+ factory(tree, null, [])()
34156
34140
 
34141
+ /**
34142
+ * @param {Node} node
34143
+ * @param {number?} index
34144
+ * @param {Array<Parent>} parents
34145
+ */
34146
+ function factory(node, index, parents) {
34147
+ /** @type {Record<string, unknown>} */
34148
+ // @ts-expect-error: hush
34149
+ const value = typeof node === 'object' && node !== null ? node : {}
34150
+ /** @type {string|undefined} */
34151
+ let name
34157
34152
 
34158
- /**
34159
- * @param {string} selector
34160
- * @param {Node} [node]
34161
- * @returns {boolean}
34162
- */
34163
- function unist_util_select_matches(selector, node) {
34164
- return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
34165
- }
34153
+ if (typeof value.type === 'string') {
34154
+ name =
34155
+ typeof value.tagName === 'string'
34156
+ ? value.tagName
34157
+ : typeof value.name === 'string'
34158
+ ? value.name
34159
+ : undefined
34166
34160
 
34167
- /**
34168
- * @param {string} selector
34169
- * @param {Node} [node]
34170
- * @returns {Node|null}
34171
- */
34172
- function unist_util_select_select(selector, node) {
34173
- return any(parse(selector), node, {one: true, any: any})[0] || null
34174
- }
34161
+ Object.defineProperty(visit, 'name', {
34162
+ value:
34163
+ 'node (' +
34164
+ color(value.type + (name ? '<' + name + '>' : '')) +
34165
+ ')'
34166
+ })
34167
+ }
34168
+
34169
+ return visit
34170
+
34171
+ function visit() {
34172
+ /** @type {ActionTuple} */
34173
+ let result = []
34174
+ /** @type {ActionTuple} */
34175
+ let subresult
34176
+ /** @type {number} */
34177
+ let offset
34178
+ /** @type {Array<Parent>} */
34179
+ let grandparents
34180
+
34181
+ if (!test || is(node, index, parents[parents.length - 1] || null)) {
34182
+ result = toResult(visitor(node, parents))
34183
+
34184
+ if (result[0] === EXIT) {
34185
+ return result
34186
+ }
34187
+ }
34188
+
34189
+ // @ts-expect-error looks like a parent.
34190
+ if (node.children && result[0] !== SKIP) {
34191
+ // @ts-expect-error looks like a parent.
34192
+ offset = (reverse ? node.children.length : -1) + step
34193
+ // @ts-expect-error looks like a parent.
34194
+ grandparents = parents.concat(node)
34195
+
34196
+ // @ts-expect-error looks like a parent.
34197
+ while (offset > -1 && offset < node.children.length) {
34198
+ // @ts-expect-error looks like a parent.
34199
+ subresult = factory(node.children[offset], offset, grandparents)()
34200
+
34201
+ if (subresult[0] === EXIT) {
34202
+ return subresult
34203
+ }
34204
+
34205
+ offset =
34206
+ typeof subresult[1] === 'number' ? subresult[1] : offset + step
34207
+ }
34208
+ }
34209
+
34210
+ return result
34211
+ }
34212
+ }
34213
+ }
34214
+ )
34175
34215
 
34176
34216
  /**
34177
- * @param {string} selector
34178
- * @param {Node} [node]
34179
- * @returns {Array.<Node>}
34217
+ * @param {VisitorResult} value
34218
+ * @returns {ActionTuple}
34180
34219
  */
34181
- function selectAll(selector, node) {
34182
- return any(parse(selector), node, {any: any})
34220
+ function toResult(value) {
34221
+ if (Array.isArray(value)) {
34222
+ return value
34223
+ }
34224
+
34225
+ if (typeof value === 'number') {
34226
+ return [CONTINUE, value]
34227
+ }
34228
+
34229
+ return [value]
34183
34230
  }
34184
34231
 
34185
34232
 
@@ -34402,7 +34449,7 @@ var _require3 = __webpack_require__(8447),
34402
34449
  var BaseUrlContext = __webpack_require__(6785);
34403
34450
  var createElement = __webpack_require__(5894);
34404
34451
  var CustomParsers = Object.values(__webpack_require__(8521));
34405
- var customCompilers = Object.values(__webpack_require__(9647));
34452
+ var customCompilers = Object.values(__webpack_require__(8457));
34406
34453
  var registerCustomComponents = __webpack_require__(1264);
34407
34454
  var _require4 = __webpack_require__(2531),
34408
34455
  options = _require4.options,
@@ -34412,7 +34459,7 @@ var _require5 = __webpack_require__(8160),
34412
34459
  var toPlainText = __webpack_require__(4792);
34413
34460
  var sectionAnchorId = __webpack_require__(9620);
34414
34461
  var tableFlattening = __webpack_require__(4625);
34415
- var _require6 = __webpack_require__(1269),
34462
+ var _require6 = __webpack_require__(2692),
34416
34463
  remarkTransformers = _require6.remarkTransformers,
34417
34464
  rehypeTransformers = _require6.rehypeTransformers;
34418
34465
  var createSchema = __webpack_require__(8229);