@readme/markdown 6.68.0-beta.1 → 6.68.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1993 -1926
- package/dist/main.node.js +1917 -1858
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -8786,64 +8786,94 @@ module.exports = function ImageCompiler() {
|
|
|
8786
8786
|
|
|
8787
8787
|
/***/ }),
|
|
8788
8788
|
|
|
8789
|
-
/***/
|
|
8789
|
+
/***/ 8457:
|
|
8790
8790
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8791
8791
|
|
|
8792
8792
|
"use strict";
|
|
8793
|
+
// ESM COMPAT FLAG
|
|
8793
8794
|
__webpack_require__.r(__webpack_exports__);
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
/*
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8795
|
+
|
|
8796
|
+
// EXPORTS
|
|
8797
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
8798
|
+
"breakCompiler": () => (/* reexport */ (break_default())),
|
|
8799
|
+
"codeTabsCompiler": () => (/* reexport */ (code_tabs_default())),
|
|
8800
|
+
"divCompiler": () => (/* reexport */ (div_default())),
|
|
8801
|
+
"escapeCompiler": () => (/* reexport */ (escape_default())),
|
|
8802
|
+
"figureCompiler": () => (/* reexport */ (figure_default())),
|
|
8803
|
+
"htmlBlockCompiler": () => (/* reexport */ (html_block_default())),
|
|
8804
|
+
"iconCompiler": () => (/* reexport */ (i_default())),
|
|
8805
|
+
"imageCompiler": () => (/* reexport */ (image_default())),
|
|
8806
|
+
"rdmeCalloutCompiler": () => (/* reexport */ (callout_default())),
|
|
8807
|
+
"rdmeEmbedCompiler": () => (/* reexport */ (embed_default())),
|
|
8808
|
+
"rdmeGlossaryCompiler": () => (/* reexport */ (glossary_default())),
|
|
8809
|
+
"rdmePinCompiler": () => (/* reexport */ (pin_default())),
|
|
8810
|
+
"rdmeVarCompiler": () => (/* reexport */ (var_default())),
|
|
8811
|
+
"reusableContentCompiler": () => (/* reexport */ ReusableContentCompiler),
|
|
8812
|
+
"tableCompiler": () => (/* reexport */ (table_default())),
|
|
8813
|
+
"tableHeadCompiler": () => (/* reexport */ (table_head_default())),
|
|
8814
|
+
"yamlCompiler": () => (/* reexport */ (yaml_default()))
|
|
8815
|
+
});
|
|
8816
|
+
|
|
8817
|
+
// EXTERNAL MODULE: ./processor/compile/break.js
|
|
8818
|
+
var compile_break = __webpack_require__(3688);
|
|
8819
|
+
var break_default = /*#__PURE__*/__webpack_require__.n(compile_break);
|
|
8820
|
+
// EXTERNAL MODULE: ./processor/compile/code-tabs.js
|
|
8821
|
+
var code_tabs = __webpack_require__(4079);
|
|
8822
|
+
var code_tabs_default = /*#__PURE__*/__webpack_require__.n(code_tabs);
|
|
8823
|
+
// EXTERNAL MODULE: ./processor/compile/div.js
|
|
8824
|
+
var div = __webpack_require__(58);
|
|
8825
|
+
var div_default = /*#__PURE__*/__webpack_require__.n(div);
|
|
8826
|
+
// EXTERNAL MODULE: ./processor/compile/escape.js
|
|
8827
|
+
var compile_escape = __webpack_require__(8418);
|
|
8828
|
+
var escape_default = /*#__PURE__*/__webpack_require__.n(compile_escape);
|
|
8829
|
+
// EXTERNAL MODULE: ./processor/compile/figure.js
|
|
8830
|
+
var figure = __webpack_require__(8705);
|
|
8831
|
+
var figure_default = /*#__PURE__*/__webpack_require__.n(figure);
|
|
8832
|
+
// EXTERNAL MODULE: ./processor/compile/html-block.js
|
|
8833
|
+
var html_block = __webpack_require__(3551);
|
|
8834
|
+
var html_block_default = /*#__PURE__*/__webpack_require__.n(html_block);
|
|
8835
|
+
// EXTERNAL MODULE: ./processor/compile/i.js
|
|
8836
|
+
var i = __webpack_require__(4258);
|
|
8837
|
+
var i_default = /*#__PURE__*/__webpack_require__.n(i);
|
|
8838
|
+
// EXTERNAL MODULE: ./processor/compile/image.js
|
|
8839
|
+
var compile_image = __webpack_require__(3356);
|
|
8840
|
+
var image_default = /*#__PURE__*/__webpack_require__.n(compile_image);
|
|
8841
|
+
// EXTERNAL MODULE: ./processor/compile/callout.js
|
|
8842
|
+
var callout = __webpack_require__(5733);
|
|
8843
|
+
var callout_default = /*#__PURE__*/__webpack_require__.n(callout);
|
|
8844
|
+
// EXTERNAL MODULE: ./processor/compile/embed.js
|
|
8845
|
+
var compile_embed = __webpack_require__(4338);
|
|
8846
|
+
var embed_default = /*#__PURE__*/__webpack_require__.n(compile_embed);
|
|
8847
|
+
// EXTERNAL MODULE: ./processor/compile/glossary.js
|
|
8848
|
+
var glossary = __webpack_require__(2459);
|
|
8849
|
+
var glossary_default = /*#__PURE__*/__webpack_require__.n(glossary);
|
|
8850
|
+
// EXTERNAL MODULE: ./processor/compile/pin.js
|
|
8851
|
+
var pin = __webpack_require__(2151);
|
|
8852
|
+
var pin_default = /*#__PURE__*/__webpack_require__.n(pin);
|
|
8853
|
+
// EXTERNAL MODULE: ./processor/compile/var.js
|
|
8854
|
+
var compile_var = __webpack_require__(1067);
|
|
8855
|
+
var var_default = /*#__PURE__*/__webpack_require__.n(compile_var);
|
|
8856
|
+
// EXTERNAL MODULE: ./processor/transform/reusable-content.js + 2 modules
|
|
8857
|
+
var reusable_content = __webpack_require__(6462);
|
|
8858
|
+
;// CONCATENATED MODULE: ./processor/compile/reusable-content.js
|
|
8859
|
+
|
|
8860
|
+
function ReusableContentCompiler() {
|
|
8861
|
+
var Compiler = this.Compiler;
|
|
8862
|
+
var visitors = Compiler.prototype.visitors;
|
|
8863
|
+
visitors[reusable_content/* type */.dt] = function (node) {
|
|
8864
|
+
return "<".concat(reusable_content/* tag */._q, " name=\"").concat(node.name, "\" />");
|
|
8865
|
+
};
|
|
8866
|
+
}
|
|
8867
|
+
// EXTERNAL MODULE: ./processor/compile/table.js
|
|
8868
|
+
var table = __webpack_require__(4669);
|
|
8869
|
+
var table_default = /*#__PURE__*/__webpack_require__.n(table);
|
|
8870
|
+
// EXTERNAL MODULE: ./processor/compile/table-head.js
|
|
8871
|
+
var table_head = __webpack_require__(186);
|
|
8872
|
+
var table_head_default = /*#__PURE__*/__webpack_require__.n(table_head);
|
|
8873
|
+
// EXTERNAL MODULE: ./processor/compile/yaml.js
|
|
8874
|
+
var yaml = __webpack_require__(1773);
|
|
8875
|
+
var yaml_default = /*#__PURE__*/__webpack_require__.n(yaml);
|
|
8876
|
+
;// CONCATENATED MODULE: ./processor/compile/index.js
|
|
8847
8877
|
|
|
8848
8878
|
|
|
8849
8879
|
|
|
@@ -8878,19 +8908,6 @@ module.exports = function PinCompiler() {
|
|
|
8878
8908
|
|
|
8879
8909
|
/***/ }),
|
|
8880
8910
|
|
|
8881
|
-
/***/ 9585:
|
|
8882
|
-
/***/ ((module) => {
|
|
8883
|
-
|
|
8884
|
-
module.exports = function ReusableContentCompiler() {
|
|
8885
|
-
var Compiler = this.Compiler;
|
|
8886
|
-
var visitors = Compiler.prototype.visitors;
|
|
8887
|
-
visitors['reusable-content'] = function (node) {
|
|
8888
|
-
return "<ReadMeReusableContent name=\"".concat(node.name, "\" />");
|
|
8889
|
-
};
|
|
8890
|
-
};
|
|
8891
|
-
|
|
8892
|
-
/***/ }),
|
|
8893
|
-
|
|
8894
8911
|
/***/ 186:
|
|
8895
8912
|
/***/ ((module) => {
|
|
8896
8913
|
|
|
@@ -10148,7 +10165,7 @@ module.exports.tableFlattening = transformer;
|
|
|
10148
10165
|
|
|
10149
10166
|
/***/ }),
|
|
10150
10167
|
|
|
10151
|
-
/***/
|
|
10168
|
+
/***/ 2692:
|
|
10152
10169
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10153
10170
|
|
|
10154
10171
|
"use strict";
|
|
@@ -10161,6 +10178,97 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
10161
10178
|
"remarkTransformers": () => (/* binding */ remarkTransformers)
|
|
10162
10179
|
});
|
|
10163
10180
|
|
|
10181
|
+
// EXTERNAL MODULE: ./processor/transform/reusable-content.js + 2 modules
|
|
10182
|
+
var reusable_content = __webpack_require__(6462);
|
|
10183
|
+
// EXTERNAL MODULE: ./node_modules/unist-util-visit/index.js
|
|
10184
|
+
var unist_util_visit = __webpack_require__(6393);
|
|
10185
|
+
;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
|
|
10186
|
+
|
|
10187
|
+
var singleCodeTabs = function singleCodeTabs() {
|
|
10188
|
+
return function (tree) {
|
|
10189
|
+
(0,unist_util_visit/* visit */.Vn)(tree, function (node, index, parent) {
|
|
10190
|
+
if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
|
|
10191
|
+
Object.assign(node, {
|
|
10192
|
+
className: 'tab-panel',
|
|
10193
|
+
data: {
|
|
10194
|
+
hName: 'code',
|
|
10195
|
+
hProperties: {
|
|
10196
|
+
meta: node.meta,
|
|
10197
|
+
lang: node.lang
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
});
|
|
10201
|
+
parent.children[index] = {
|
|
10202
|
+
type: 'code-tabs',
|
|
10203
|
+
className: 'tabs',
|
|
10204
|
+
data: {
|
|
10205
|
+
hName: 'div',
|
|
10206
|
+
hProperties: {
|
|
10207
|
+
className: ['code-tabs']
|
|
10208
|
+
}
|
|
10209
|
+
},
|
|
10210
|
+
children: [node]
|
|
10211
|
+
};
|
|
10212
|
+
}
|
|
10213
|
+
});
|
|
10214
|
+
return tree;
|
|
10215
|
+
};
|
|
10216
|
+
};
|
|
10217
|
+
/* harmony default export */ const single_code_tabs = (singleCodeTabs);
|
|
10218
|
+
// EXTERNAL MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js + 2 modules
|
|
10219
|
+
var unist_util_visit_parents = __webpack_require__(5605);
|
|
10220
|
+
;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
|
|
10221
|
+
|
|
10222
|
+
var rxEscapedPipe = /\\\|/g;
|
|
10223
|
+
|
|
10224
|
+
/**
|
|
10225
|
+
* HAST Transformer that finds all inline code nodes within table cells and
|
|
10226
|
+
* unescapes any escaped pipe chars so that the editor outputs them without
|
|
10227
|
+
* escape chars.
|
|
10228
|
+
*
|
|
10229
|
+
* This appears to be a bug with remark-parse < ~8
|
|
10230
|
+
*/
|
|
10231
|
+
var tableCellInlineCode = function tableCellInlineCode() {
|
|
10232
|
+
return function (tree) {
|
|
10233
|
+
(0,unist_util_visit/* visit */.Vn)(tree, [{
|
|
10234
|
+
tagName: 'th'
|
|
10235
|
+
}, {
|
|
10236
|
+
tagName: 'td'
|
|
10237
|
+
}], function (tableCellNode) {
|
|
10238
|
+
(0,unist_util_visit/* visit */.Vn)(tableCellNode, {
|
|
10239
|
+
tagName: 'code'
|
|
10240
|
+
}, function (inlineCodeNode) {
|
|
10241
|
+
var textNode = inlineCodeNode.children[0];
|
|
10242
|
+
if (textNode && rxEscapedPipe.test(textNode.value)) {
|
|
10243
|
+
textNode.value = textNode.value.replace(rxEscapedPipe, '|');
|
|
10244
|
+
}
|
|
10245
|
+
});
|
|
10246
|
+
return unist_util_visit_parents/* SKIP */.AM;
|
|
10247
|
+
});
|
|
10248
|
+
};
|
|
10249
|
+
};
|
|
10250
|
+
/* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
|
|
10251
|
+
;// CONCATENATED MODULE: ./processor/transform/index.js
|
|
10252
|
+
|
|
10253
|
+
|
|
10254
|
+
|
|
10255
|
+
var remarkTransformers = [single_code_tabs, reusable_content/* default */.ZP];
|
|
10256
|
+
var rehypeTransformers = [table_cell_inline_code];
|
|
10257
|
+
|
|
10258
|
+
/***/ }),
|
|
10259
|
+
|
|
10260
|
+
/***/ 6462:
|
|
10261
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10262
|
+
|
|
10263
|
+
"use strict";
|
|
10264
|
+
|
|
10265
|
+
// EXPORTS
|
|
10266
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
10267
|
+
"ZP": () => (/* binding */ reusable_content),
|
|
10268
|
+
"_q": () => (/* binding */ tag),
|
|
10269
|
+
"dt": () => (/* binding */ type)
|
|
10270
|
+
});
|
|
10271
|
+
|
|
10164
10272
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
10165
10273
|
var esm_typeof = __webpack_require__(1002);
|
|
10166
10274
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
@@ -10189,763 +10297,213 @@ function _inherits(subClass, superClass) {
|
|
|
10189
10297
|
});
|
|
10190
10298
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
10191
10299
|
}
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
* @typedef {import('unist').Parent} Parent
|
|
10196
|
-
*
|
|
10197
|
-
* @typedef {string} Type
|
|
10198
|
-
* @typedef {Object<string, unknown>} Props
|
|
10199
|
-
*
|
|
10200
|
-
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
|
|
10201
|
-
*/
|
|
10300
|
+
// EXTERNAL MODULE: ./node_modules/unist-util-visit/index.js
|
|
10301
|
+
var unist_util_visit = __webpack_require__(6393);
|
|
10302
|
+
;// CONCATENATED MODULE: ./processor/transform/reusable-content.js
|
|
10202
10303
|
|
|
10203
|
-
/**
|
|
10204
|
-
* Check if a node passes a test
|
|
10205
|
-
*
|
|
10206
|
-
* @callback TestFunctionAnything
|
|
10207
|
-
* @param {Node} node
|
|
10208
|
-
* @param {number|null|undefined} [index]
|
|
10209
|
-
* @param {Parent|null|undefined} [parent]
|
|
10210
|
-
* @returns {boolean|void}
|
|
10211
|
-
*/
|
|
10212
10304
|
|
|
10213
|
-
/**
|
|
10214
|
-
* Check if a node passes a certain node test
|
|
10215
|
-
*
|
|
10216
|
-
* @template {Node} X
|
|
10217
|
-
* @callback TestFunctionPredicate
|
|
10218
|
-
* @param {Node} node
|
|
10219
|
-
* @param {number|null|undefined} [index]
|
|
10220
|
-
* @param {Parent|null|undefined} [parent]
|
|
10221
|
-
* @returns {node is X}
|
|
10222
|
-
*/
|
|
10223
10305
|
|
|
10224
|
-
|
|
10225
|
-
* @callback AssertAnything
|
|
10226
|
-
* @param {unknown} [node]
|
|
10227
|
-
* @param {number|null|undefined} [index]
|
|
10228
|
-
* @param {Parent|null|undefined} [parent]
|
|
10229
|
-
* @returns {boolean}
|
|
10230
|
-
*/
|
|
10306
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { var i = g[name]; if ("number" == typeof i) groups[name] = result[i];else { for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) { k++; } groups[name] = result[i[k]]; } return groups; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != (0,esm_typeof/* default */.Z)(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
|
|
10231
10307
|
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10308
|
+
var type = 'reusable-content';
|
|
10309
|
+
var tag = 'RMReusableContent';
|
|
10310
|
+
var regexp = /*#__PURE__*/_wrapRegExp(/^\s*<RMReusableContent name="(.*)" \/>\s*$/, {
|
|
10311
|
+
name: 1
|
|
10312
|
+
});
|
|
10313
|
+
var reusableContentTransformer = function reusableContentTransformer() {
|
|
10314
|
+
var reusableContent = this.data('reusableContent');
|
|
10315
|
+
return function (tree) {
|
|
10316
|
+
(0,unist_util_visit/* visit */.Vn)(tree, 'html', function (node, index, parent) {
|
|
10317
|
+
var result = regexp.exec(node.value);
|
|
10318
|
+
if (!result || !result.groups.name) return;
|
|
10319
|
+
var name = result.groups.name;
|
|
10320
|
+
var block = {
|
|
10321
|
+
type: type,
|
|
10322
|
+
name: name,
|
|
10323
|
+
children: name in reusableContent ? reusableContent[name] : []
|
|
10324
|
+
};
|
|
10325
|
+
parent.children[index] = block;
|
|
10326
|
+
});
|
|
10327
|
+
return tree;
|
|
10328
|
+
};
|
|
10329
|
+
};
|
|
10330
|
+
/* harmony default export */ const reusable_content = (reusableContentTransformer);
|
|
10242
10331
|
|
|
10243
|
-
|
|
10244
|
-
/**
|
|
10245
|
-
* Check if a node passes a test.
|
|
10246
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
10247
|
-
*
|
|
10248
|
-
* @type {(
|
|
10249
|
-
* (<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) &
|
|
10250
|
-
* ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
|
|
10251
|
-
* )}
|
|
10252
|
-
*/
|
|
10253
|
-
(
|
|
10254
|
-
/**
|
|
10255
|
-
* Check if a node passes a test.
|
|
10256
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
10257
|
-
*
|
|
10258
|
-
* @param {unknown} [node] Node to check
|
|
10259
|
-
* @param {Test} [test]
|
|
10260
|
-
* When nullish, checks if `node` is a `Node`.
|
|
10261
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
10262
|
-
* When `function` checks if function passed the node is true.
|
|
10263
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
10264
|
-
* When `array`, checks any one of the subtests pass.
|
|
10265
|
-
* @param {number|null|undefined} [index] Position of `node` in `parent`
|
|
10266
|
-
* @param {Parent|null|undefined} [parent] Parent of `node`
|
|
10267
|
-
* @param {unknown} [context] Context object to invoke `test` with
|
|
10268
|
-
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
10269
|
-
*/
|
|
10270
|
-
// eslint-disable-next-line max-params
|
|
10271
|
-
function is(node, test, index, parent, context) {
|
|
10272
|
-
const check = convert(test)
|
|
10332
|
+
/***/ }),
|
|
10273
10333
|
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
index !== null &&
|
|
10277
|
-
(typeof index !== 'number' ||
|
|
10278
|
-
index < 0 ||
|
|
10279
|
-
index === Number.POSITIVE_INFINITY)
|
|
10280
|
-
) {
|
|
10281
|
-
throw new Error('Expected positive finite index')
|
|
10282
|
-
}
|
|
10334
|
+
/***/ 8229:
|
|
10335
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
10283
10336
|
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
}
|
|
10337
|
+
var _require = __webpack_require__(2781),
|
|
10338
|
+
defaultSchema = _require.defaultSchema;
|
|
10339
|
+
var createSchema = function createSchema() {
|
|
10340
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
10341
|
+
safeMode = _ref.safeMode;
|
|
10342
|
+
var schema = JSON.parse(JSON.stringify(defaultSchema));
|
|
10291
10343
|
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10344
|
+
// Sanitization Schema Defaults
|
|
10345
|
+
schema.clobberPrefix = '';
|
|
10346
|
+
schema.tagNames.push('span');
|
|
10347
|
+
schema.attributes['*'].push('class', 'className', 'align');
|
|
10348
|
+
if (!safeMode) {
|
|
10349
|
+
schema.attributes['*'].push('style');
|
|
10350
|
+
}
|
|
10351
|
+
schema.tagNames.push('rdme-pin');
|
|
10352
|
+
schema.tagNames.push('rdme-embed');
|
|
10353
|
+
schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
|
|
10354
|
+
schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
|
|
10355
|
+
schema.tagNames.push('figure');
|
|
10356
|
+
schema.tagNames.push('figcaption');
|
|
10357
|
+
schema.tagNames.push('input'); // allow GitHub-style todo lists
|
|
10358
|
+
schema.ancestors.input = ['li'];
|
|
10359
|
+
schema.tagNames.push('colgroup'); // wat
|
|
10360
|
+
schema.tagNames.push('col');
|
|
10361
|
+
return schema;
|
|
10362
|
+
};
|
|
10363
|
+
module.exports = createSchema;
|
|
10298
10364
|
|
|
10299
|
-
|
|
10300
|
-
return node && node.type && typeof node.type === 'string'
|
|
10301
|
-
? Boolean(check.call(context, node, index, parent))
|
|
10302
|
-
: false
|
|
10303
|
-
}
|
|
10304
|
-
)
|
|
10365
|
+
/***/ }),
|
|
10305
10366
|
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
* @type {(
|
|
10309
|
-
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
10310
|
-
* ((test?: Test) => AssertAnything)
|
|
10311
|
-
* )}
|
|
10312
|
-
*/
|
|
10313
|
-
(
|
|
10314
|
-
/**
|
|
10315
|
-
* Generate an assertion from a check.
|
|
10316
|
-
* @param {Test} [test]
|
|
10317
|
-
* When nullish, checks if `node` is a `Node`.
|
|
10318
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
10319
|
-
* When `function` checks if function passed the node is true.
|
|
10320
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
10321
|
-
* When `array`, checks any one of the subtests pass.
|
|
10322
|
-
* @returns {AssertAnything}
|
|
10323
|
-
*/
|
|
10324
|
-
function (test) {
|
|
10325
|
-
if (test === undefined || test === null) {
|
|
10326
|
-
return ok
|
|
10327
|
-
}
|
|
10328
|
-
|
|
10329
|
-
if (typeof test === 'string') {
|
|
10330
|
-
return typeFactory(test)
|
|
10331
|
-
}
|
|
10367
|
+
/***/ 8841:
|
|
10368
|
+
/***/ ((module) => {
|
|
10332
10369
|
|
|
10333
|
-
|
|
10334
|
-
return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
|
|
10335
|
-
}
|
|
10370
|
+
"use strict";
|
|
10336
10371
|
|
|
10337
|
-
if (typeof test === 'function') {
|
|
10338
|
-
return castFactory(test)
|
|
10339
|
-
}
|
|
10340
10372
|
|
|
10341
|
-
|
|
10342
|
-
}
|
|
10343
|
-
)
|
|
10344
|
-
/**
|
|
10345
|
-
* @param {Array.<Type|Props|TestFunctionAnything>} tests
|
|
10346
|
-
* @returns {AssertAnything}
|
|
10347
|
-
*/
|
|
10348
|
-
function anyFactory(tests) {
|
|
10349
|
-
/** @type {Array.<AssertAnything>} */
|
|
10350
|
-
const checks = []
|
|
10351
|
-
let index = -1
|
|
10373
|
+
module.exports = bail
|
|
10352
10374
|
|
|
10353
|
-
|
|
10354
|
-
|
|
10375
|
+
function bail(err) {
|
|
10376
|
+
if (err) {
|
|
10377
|
+
throw err
|
|
10355
10378
|
}
|
|
10379
|
+
}
|
|
10356
10380
|
|
|
10357
|
-
return castFactory(any)
|
|
10358
10381
|
|
|
10359
|
-
|
|
10360
|
-
* @this {unknown}
|
|
10361
|
-
* @param {unknown[]} parameters
|
|
10362
|
-
* @returns {boolean}
|
|
10363
|
-
*/
|
|
10364
|
-
function any(...parameters) {
|
|
10365
|
-
let index = -1
|
|
10382
|
+
/***/ }),
|
|
10366
10383
|
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
}
|
|
10384
|
+
/***/ 1073:
|
|
10385
|
+
/***/ ((module) => {
|
|
10370
10386
|
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10387
|
+
module.exports = {
|
|
10388
|
+
trueFunc: function trueFunc(){
|
|
10389
|
+
return true;
|
|
10390
|
+
},
|
|
10391
|
+
falseFunc: function falseFunc(){
|
|
10392
|
+
return false;
|
|
10393
|
+
}
|
|
10394
|
+
};
|
|
10374
10395
|
|
|
10375
|
-
|
|
10376
|
-
* Utility to assert each property in `test` is represented in `node`, and each
|
|
10377
|
-
* values are strictly equal.
|
|
10378
|
-
*
|
|
10379
|
-
* @param {Props} check
|
|
10380
|
-
* @returns {AssertAnything}
|
|
10381
|
-
*/
|
|
10382
|
-
function propsFactory(check) {
|
|
10383
|
-
return castFactory(all)
|
|
10396
|
+
/***/ }),
|
|
10384
10397
|
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
* @returns {boolean}
|
|
10388
|
-
*/
|
|
10389
|
-
function all(node) {
|
|
10390
|
-
/** @type {string} */
|
|
10391
|
-
let key
|
|
10398
|
+
/***/ 932:
|
|
10399
|
+
/***/ ((module) => {
|
|
10392
10400
|
|
|
10393
|
-
|
|
10394
|
-
// @ts-expect-error: hush, it sure works as an index.
|
|
10395
|
-
if (node[key] !== check[key]) return false
|
|
10396
|
-
}
|
|
10401
|
+
"use strict";
|
|
10397
10402
|
|
|
10398
|
-
|
|
10403
|
+
|
|
10404
|
+
module.exports = ccount
|
|
10405
|
+
|
|
10406
|
+
function ccount(value, character) {
|
|
10407
|
+
var val = String(value)
|
|
10408
|
+
var count = 0
|
|
10409
|
+
var index
|
|
10410
|
+
|
|
10411
|
+
if (typeof character !== 'string' || character.length !== 1) {
|
|
10412
|
+
throw new Error('Expected character')
|
|
10399
10413
|
}
|
|
10400
|
-
}
|
|
10401
10414
|
|
|
10402
|
-
|
|
10403
|
-
* Utility to convert a string into a function which checks a given node’s type
|
|
10404
|
-
* for said string.
|
|
10405
|
-
*
|
|
10406
|
-
* @param {Type} check
|
|
10407
|
-
* @returns {AssertAnything}
|
|
10408
|
-
*/
|
|
10409
|
-
function typeFactory(check) {
|
|
10410
|
-
return castFactory(type)
|
|
10415
|
+
index = val.indexOf(character)
|
|
10411
10416
|
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
function type(node) {
|
|
10416
|
-
return node && node.type === check
|
|
10417
|
+
while (index !== -1) {
|
|
10418
|
+
count++
|
|
10419
|
+
index = val.indexOf(character, index + 1)
|
|
10417
10420
|
}
|
|
10421
|
+
|
|
10422
|
+
return count
|
|
10418
10423
|
}
|
|
10419
10424
|
|
|
10420
|
-
/**
|
|
10421
|
-
* Utility to convert a string into a function which checks a given node’s type
|
|
10422
|
-
* for said string.
|
|
10423
|
-
* @param {TestFunctionAnything} check
|
|
10424
|
-
* @returns {AssertAnything}
|
|
10425
|
-
*/
|
|
10426
|
-
function castFactory(check) {
|
|
10427
|
-
return assertion
|
|
10428
10425
|
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10426
|
+
/***/ }),
|
|
10427
|
+
|
|
10428
|
+
/***/ 6313:
|
|
10429
|
+
/***/ ((module) => {
|
|
10430
|
+
|
|
10431
|
+
var clone = (function() {
|
|
10432
|
+
'use strict';
|
|
10433
|
+
|
|
10434
|
+
function _instanceof(obj, type) {
|
|
10435
|
+
return type != null && obj instanceof type;
|
|
10438
10436
|
}
|
|
10439
10437
|
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10438
|
+
var nativeMap;
|
|
10439
|
+
try {
|
|
10440
|
+
nativeMap = Map;
|
|
10441
|
+
} catch(_) {
|
|
10442
|
+
// maybe a reference error because no `Map`. Give it a dummy value that no
|
|
10443
|
+
// value will ever be an instanceof.
|
|
10444
|
+
nativeMap = function() {};
|
|
10443
10445
|
}
|
|
10444
10446
|
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10447
|
+
var nativeSet;
|
|
10448
|
+
try {
|
|
10449
|
+
nativeSet = Set;
|
|
10450
|
+
} catch(_) {
|
|
10451
|
+
nativeSet = function() {};
|
|
10452
|
+
}
|
|
10453
|
+
|
|
10454
|
+
var nativePromise;
|
|
10455
|
+
try {
|
|
10456
|
+
nativePromise = Promise;
|
|
10457
|
+
} catch(_) {
|
|
10458
|
+
nativePromise = function() {};
|
|
10452
10459
|
}
|
|
10453
10460
|
|
|
10454
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
|
|
10455
10461
|
/**
|
|
10456
|
-
*
|
|
10457
|
-
*
|
|
10458
|
-
*
|
|
10459
|
-
*
|
|
10460
|
-
*
|
|
10461
|
-
*
|
|
10462
|
-
*
|
|
10463
|
-
*
|
|
10464
|
-
|
|
10462
|
+
* Clones (copies) an Object using deep copying.
|
|
10463
|
+
*
|
|
10464
|
+
* This function supports circular references by default, but if you are certain
|
|
10465
|
+
* there are no circular references in your object, you can save some CPU time
|
|
10466
|
+
* by calling clone(obj, false).
|
|
10467
|
+
*
|
|
10468
|
+
* Caution: if `circular` is false and `parent` contains circular references,
|
|
10469
|
+
* your program may enter an infinite loop and crash.
|
|
10470
|
+
*
|
|
10471
|
+
* @param `parent` - the object to be cloned
|
|
10472
|
+
* @param `circular` - set to true if the object to be cloned may contain
|
|
10473
|
+
* circular references. (optional - true by default)
|
|
10474
|
+
* @param `depth` - set to a number if the object is only to be cloned to
|
|
10475
|
+
* a particular depth. (optional - defaults to Infinity)
|
|
10476
|
+
* @param `prototype` - sets the prototype to be used when cloning an object.
|
|
10477
|
+
* (optional - defaults to parent prototype).
|
|
10478
|
+
* @param `includeNonEnumerable` - set to true if the non-enumerable properties
|
|
10479
|
+
* should be cloned as well. Non-enumerable properties on the prototype
|
|
10480
|
+
* chain will be ignored. (optional - false by default)
|
|
10481
|
+
*/
|
|
10482
|
+
function clone(parent, circular, depth, prototype, includeNonEnumerable) {
|
|
10483
|
+
if (typeof circular === 'object') {
|
|
10484
|
+
depth = circular.depth;
|
|
10485
|
+
prototype = circular.prototype;
|
|
10486
|
+
includeNonEnumerable = circular.includeNonEnumerable;
|
|
10487
|
+
circular = circular.circular;
|
|
10488
|
+
}
|
|
10489
|
+
// maintain two arrays for circular references, where corresponding parents
|
|
10490
|
+
// and children have the same index
|
|
10491
|
+
var allParents = [];
|
|
10492
|
+
var allChildren = [];
|
|
10465
10493
|
|
|
10494
|
+
var useBuffer = typeof Buffer != 'undefined';
|
|
10466
10495
|
|
|
10496
|
+
if (typeof circular == 'undefined')
|
|
10497
|
+
circular = true;
|
|
10467
10498
|
|
|
10499
|
+
if (typeof depth == 'undefined')
|
|
10500
|
+
depth = Infinity;
|
|
10468
10501
|
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
* Do not traverse this node’s children
|
|
10475
|
-
*/
|
|
10476
|
-
const SKIP = 'skip'
|
|
10477
|
-
/**
|
|
10478
|
-
* Stop traversing immediately
|
|
10479
|
-
*/
|
|
10480
|
-
const EXIT = false
|
|
10481
|
-
|
|
10482
|
-
/**
|
|
10483
|
-
* Visit children of tree which pass test.
|
|
10484
|
-
*
|
|
10485
|
-
* @param tree
|
|
10486
|
-
* Tree to walk
|
|
10487
|
-
* @param [test]
|
|
10488
|
-
* `unist-util-is`-compatible test
|
|
10489
|
-
* @param visitor
|
|
10490
|
-
* Function called for nodes that pass `test`.
|
|
10491
|
-
* @param [reverse=false]
|
|
10492
|
-
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
10493
|
-
*/
|
|
10494
|
-
const visitParents =
|
|
10495
|
-
/**
|
|
10496
|
-
* @type {(
|
|
10497
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
10498
|
-
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
10499
|
-
* )}
|
|
10500
|
-
*/
|
|
10501
|
-
(
|
|
10502
|
-
/**
|
|
10503
|
-
* @param {Node} tree
|
|
10504
|
-
* @param {Test} test
|
|
10505
|
-
* @param {import('./complex-types.js').Visitor<Node>} visitor
|
|
10506
|
-
* @param {boolean} [reverse=false]
|
|
10507
|
-
*/
|
|
10508
|
-
function (tree, test, visitor, reverse) {
|
|
10509
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
10510
|
-
reverse = visitor
|
|
10511
|
-
// @ts-expect-error no visitor given, so `visitor` is test.
|
|
10512
|
-
visitor = test
|
|
10513
|
-
test = null
|
|
10514
|
-
}
|
|
10515
|
-
|
|
10516
|
-
const is = convert(test)
|
|
10517
|
-
const step = reverse ? -1 : 1
|
|
10518
|
-
|
|
10519
|
-
factory(tree, null, [])()
|
|
10520
|
-
|
|
10521
|
-
/**
|
|
10522
|
-
* @param {Node} node
|
|
10523
|
-
* @param {number?} index
|
|
10524
|
-
* @param {Array<Parent>} parents
|
|
10525
|
-
*/
|
|
10526
|
-
function factory(node, index, parents) {
|
|
10527
|
-
/** @type {Record<string, unknown>} */
|
|
10528
|
-
// @ts-expect-error: hush
|
|
10529
|
-
const value = typeof node === 'object' && node !== null ? node : {}
|
|
10530
|
-
/** @type {string|undefined} */
|
|
10531
|
-
let name
|
|
10532
|
-
|
|
10533
|
-
if (typeof value.type === 'string') {
|
|
10534
|
-
name =
|
|
10535
|
-
typeof value.tagName === 'string'
|
|
10536
|
-
? value.tagName
|
|
10537
|
-
: typeof value.name === 'string'
|
|
10538
|
-
? value.name
|
|
10539
|
-
: undefined
|
|
10540
|
-
|
|
10541
|
-
Object.defineProperty(visit, 'name', {
|
|
10542
|
-
value:
|
|
10543
|
-
'node (' +
|
|
10544
|
-
color(value.type + (name ? '<' + name + '>' : '')) +
|
|
10545
|
-
')'
|
|
10546
|
-
})
|
|
10547
|
-
}
|
|
10548
|
-
|
|
10549
|
-
return visit
|
|
10550
|
-
|
|
10551
|
-
function visit() {
|
|
10552
|
-
/** @type {ActionTuple} */
|
|
10553
|
-
let result = []
|
|
10554
|
-
/** @type {ActionTuple} */
|
|
10555
|
-
let subresult
|
|
10556
|
-
/** @type {number} */
|
|
10557
|
-
let offset
|
|
10558
|
-
/** @type {Array<Parent>} */
|
|
10559
|
-
let grandparents
|
|
10560
|
-
|
|
10561
|
-
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
|
10562
|
-
result = toResult(visitor(node, parents))
|
|
10563
|
-
|
|
10564
|
-
if (result[0] === EXIT) {
|
|
10565
|
-
return result
|
|
10566
|
-
}
|
|
10567
|
-
}
|
|
10568
|
-
|
|
10569
|
-
// @ts-expect-error looks like a parent.
|
|
10570
|
-
if (node.children && result[0] !== SKIP) {
|
|
10571
|
-
// @ts-expect-error looks like a parent.
|
|
10572
|
-
offset = (reverse ? node.children.length : -1) + step
|
|
10573
|
-
// @ts-expect-error looks like a parent.
|
|
10574
|
-
grandparents = parents.concat(node)
|
|
10575
|
-
|
|
10576
|
-
// @ts-expect-error looks like a parent.
|
|
10577
|
-
while (offset > -1 && offset < node.children.length) {
|
|
10578
|
-
// @ts-expect-error looks like a parent.
|
|
10579
|
-
subresult = factory(node.children[offset], offset, grandparents)()
|
|
10580
|
-
|
|
10581
|
-
if (subresult[0] === EXIT) {
|
|
10582
|
-
return subresult
|
|
10583
|
-
}
|
|
10584
|
-
|
|
10585
|
-
offset =
|
|
10586
|
-
typeof subresult[1] === 'number' ? subresult[1] : offset + step
|
|
10587
|
-
}
|
|
10588
|
-
}
|
|
10589
|
-
|
|
10590
|
-
return result
|
|
10591
|
-
}
|
|
10592
|
-
}
|
|
10593
|
-
}
|
|
10594
|
-
)
|
|
10595
|
-
|
|
10596
|
-
/**
|
|
10597
|
-
* @param {VisitorResult} value
|
|
10598
|
-
* @returns {ActionTuple}
|
|
10599
|
-
*/
|
|
10600
|
-
function toResult(value) {
|
|
10601
|
-
if (Array.isArray(value)) {
|
|
10602
|
-
return value
|
|
10603
|
-
}
|
|
10604
|
-
|
|
10605
|
-
if (typeof value === 'number') {
|
|
10606
|
-
return [CONTINUE, value]
|
|
10607
|
-
}
|
|
10608
|
-
|
|
10609
|
-
return [value]
|
|
10610
|
-
}
|
|
10611
|
-
|
|
10612
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/index.js
|
|
10613
|
-
/**
|
|
10614
|
-
* @typedef {import('unist').Node} Node
|
|
10615
|
-
* @typedef {import('unist').Parent} Parent
|
|
10616
|
-
* @typedef {import('unist-util-is').Test} Test
|
|
10617
|
-
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
|
|
10618
|
-
* @typedef {import('./complex-types.js').Visitor} Visitor
|
|
10619
|
-
*/
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
/**
|
|
10624
|
-
* Visit children of tree which pass test.
|
|
10625
|
-
*
|
|
10626
|
-
* @param tree
|
|
10627
|
-
* Tree to walk
|
|
10628
|
-
* @param [test]
|
|
10629
|
-
* `unist-util-is`-compatible test
|
|
10630
|
-
* @param visitor
|
|
10631
|
-
* Function called for nodes that pass `test`.
|
|
10632
|
-
* @param reverse
|
|
10633
|
-
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
10634
|
-
*/
|
|
10635
|
-
const visit =
|
|
10636
|
-
/**
|
|
10637
|
-
* @type {(
|
|
10638
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
10639
|
-
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
10640
|
-
* )}
|
|
10641
|
-
*/
|
|
10642
|
-
(
|
|
10643
|
-
/**
|
|
10644
|
-
* @param {Node} tree
|
|
10645
|
-
* @param {Test} test
|
|
10646
|
-
* @param {import('./complex-types.js').Visitor} visitor
|
|
10647
|
-
* @param {boolean} [reverse]
|
|
10648
|
-
*/
|
|
10649
|
-
function (tree, test, visitor, reverse) {
|
|
10650
|
-
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
10651
|
-
reverse = visitor
|
|
10652
|
-
visitor = test
|
|
10653
|
-
test = null
|
|
10654
|
-
}
|
|
10655
|
-
|
|
10656
|
-
visitParents(tree, test, overload, reverse)
|
|
10657
|
-
|
|
10658
|
-
/**
|
|
10659
|
-
* @param {Node} node
|
|
10660
|
-
* @param {Array<Parent>} parents
|
|
10661
|
-
*/
|
|
10662
|
-
function overload(node, parents) {
|
|
10663
|
-
const parent = parents[parents.length - 1]
|
|
10664
|
-
return visitor(
|
|
10665
|
-
node,
|
|
10666
|
-
parent ? parent.children.indexOf(node) : null,
|
|
10667
|
-
parent
|
|
10668
|
-
)
|
|
10669
|
-
}
|
|
10670
|
-
}
|
|
10671
|
-
)
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
|
|
10675
|
-
;// CONCATENATED MODULE: ./processor/transform/reusable-content.js
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { var i = g[name]; if ("number" == typeof i) groups[name] = result[i];else { for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) { k++; } groups[name] = result[i[k]]; } return groups; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != (0,esm_typeof/* default */.Z)(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
|
|
10680
|
-
|
|
10681
|
-
var type = 'reusable-content';
|
|
10682
|
-
var regexp = /*#__PURE__*/_wrapRegExp(/^\s*<ReadMeReusableContent name="(.*)" \/>\s*$/, {
|
|
10683
|
-
name: 1
|
|
10684
|
-
});
|
|
10685
|
-
var reusableContentTransformer = function reusableContentTransformer() {
|
|
10686
|
-
var reusableContent = this.data('reusableContent');
|
|
10687
|
-
return function (tree) {
|
|
10688
|
-
visit(tree, 'html', function (node, index, parent) {
|
|
10689
|
-
var result = regexp.exec(node.value);
|
|
10690
|
-
if (!result || !result.groups.name) return;
|
|
10691
|
-
var name = result.groups.name;
|
|
10692
|
-
var block = {
|
|
10693
|
-
type: type,
|
|
10694
|
-
name: name,
|
|
10695
|
-
children: name in reusableContent ? reusableContent[name] : []
|
|
10696
|
-
};
|
|
10697
|
-
parent.children[index] = block;
|
|
10698
|
-
});
|
|
10699
|
-
return tree;
|
|
10700
|
-
};
|
|
10701
|
-
};
|
|
10702
|
-
/* harmony default export */ const reusable_content = (reusableContentTransformer);
|
|
10703
|
-
;// CONCATENATED MODULE: ./processor/transform/single-code-tabs.js
|
|
10704
|
-
|
|
10705
|
-
var singleCodeTabs = function singleCodeTabs() {
|
|
10706
|
-
return function (tree) {
|
|
10707
|
-
visit(tree, function (node, index, parent) {
|
|
10708
|
-
if (node.type === 'code' && (node.lang || node.meta) && parent.type !== 'code-tabs') {
|
|
10709
|
-
Object.assign(node, {
|
|
10710
|
-
className: 'tab-panel',
|
|
10711
|
-
data: {
|
|
10712
|
-
hName: 'code',
|
|
10713
|
-
hProperties: {
|
|
10714
|
-
meta: node.meta,
|
|
10715
|
-
lang: node.lang
|
|
10716
|
-
}
|
|
10717
|
-
}
|
|
10718
|
-
});
|
|
10719
|
-
parent.children[index] = {
|
|
10720
|
-
type: 'code-tabs',
|
|
10721
|
-
className: 'tabs',
|
|
10722
|
-
data: {
|
|
10723
|
-
hName: 'div',
|
|
10724
|
-
hProperties: {
|
|
10725
|
-
className: ['code-tabs']
|
|
10726
|
-
}
|
|
10727
|
-
},
|
|
10728
|
-
children: [node]
|
|
10729
|
-
};
|
|
10730
|
-
}
|
|
10731
|
-
});
|
|
10732
|
-
return tree;
|
|
10733
|
-
};
|
|
10734
|
-
};
|
|
10735
|
-
/* harmony default export */ const single_code_tabs = (singleCodeTabs);
|
|
10736
|
-
;// CONCATENATED MODULE: ./processor/transform/table-cell-inline-code.js
|
|
10737
|
-
|
|
10738
|
-
var rxEscapedPipe = /\\\|/g;
|
|
10739
|
-
|
|
10740
|
-
/**
|
|
10741
|
-
* HAST Transformer that finds all inline code nodes within table cells and
|
|
10742
|
-
* unescapes any escaped pipe chars so that the editor outputs them without
|
|
10743
|
-
* escape chars.
|
|
10744
|
-
*
|
|
10745
|
-
* This appears to be a bug with remark-parse < ~8
|
|
10746
|
-
*/
|
|
10747
|
-
var tableCellInlineCode = function tableCellInlineCode() {
|
|
10748
|
-
return function (tree) {
|
|
10749
|
-
visit(tree, [{
|
|
10750
|
-
tagName: 'th'
|
|
10751
|
-
}, {
|
|
10752
|
-
tagName: 'td'
|
|
10753
|
-
}], function (tableCellNode) {
|
|
10754
|
-
visit(tableCellNode, {
|
|
10755
|
-
tagName: 'code'
|
|
10756
|
-
}, function (inlineCodeNode) {
|
|
10757
|
-
var textNode = inlineCodeNode.children[0];
|
|
10758
|
-
if (textNode && rxEscapedPipe.test(textNode.value)) {
|
|
10759
|
-
textNode.value = textNode.value.replace(rxEscapedPipe, '|');
|
|
10760
|
-
}
|
|
10761
|
-
});
|
|
10762
|
-
return SKIP;
|
|
10763
|
-
});
|
|
10764
|
-
};
|
|
10765
|
-
};
|
|
10766
|
-
/* harmony default export */ const table_cell_inline_code = (tableCellInlineCode);
|
|
10767
|
-
;// CONCATENATED MODULE: ./processor/transform/index.js
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
var remarkTransformers = [single_code_tabs, reusable_content];
|
|
10772
|
-
var rehypeTransformers = [table_cell_inline_code];
|
|
10773
|
-
|
|
10774
|
-
/***/ }),
|
|
10775
|
-
|
|
10776
|
-
/***/ 8229:
|
|
10777
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
10778
|
-
|
|
10779
|
-
var _require = __webpack_require__(2781),
|
|
10780
|
-
defaultSchema = _require.defaultSchema;
|
|
10781
|
-
var createSchema = function createSchema() {
|
|
10782
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
10783
|
-
safeMode = _ref.safeMode;
|
|
10784
|
-
var schema = JSON.parse(JSON.stringify(defaultSchema));
|
|
10785
|
-
|
|
10786
|
-
// Sanitization Schema Defaults
|
|
10787
|
-
schema.clobberPrefix = '';
|
|
10788
|
-
schema.tagNames.push('span');
|
|
10789
|
-
schema.attributes['*'].push('class', 'className', 'align');
|
|
10790
|
-
if (!safeMode) {
|
|
10791
|
-
schema.attributes['*'].push('style');
|
|
10792
|
-
}
|
|
10793
|
-
schema.tagNames.push('rdme-pin');
|
|
10794
|
-
schema.tagNames.push('rdme-embed');
|
|
10795
|
-
schema.attributes['rdme-embed'] = ['url', 'provider', 'html', 'title', 'href', 'iframe', 'width', 'height', 'image', 'favicon', 'align'];
|
|
10796
|
-
schema.attributes.a = ['href', 'title', 'class', 'className', 'download'];
|
|
10797
|
-
schema.tagNames.push('figure');
|
|
10798
|
-
schema.tagNames.push('figcaption');
|
|
10799
|
-
schema.tagNames.push('input'); // allow GitHub-style todo lists
|
|
10800
|
-
schema.ancestors.input = ['li'];
|
|
10801
|
-
schema.tagNames.push('colgroup'); // wat
|
|
10802
|
-
schema.tagNames.push('col');
|
|
10803
|
-
return schema;
|
|
10804
|
-
};
|
|
10805
|
-
module.exports = createSchema;
|
|
10806
|
-
|
|
10807
|
-
/***/ }),
|
|
10808
|
-
|
|
10809
|
-
/***/ 8841:
|
|
10810
|
-
/***/ ((module) => {
|
|
10811
|
-
|
|
10812
|
-
"use strict";
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
module.exports = bail
|
|
10816
|
-
|
|
10817
|
-
function bail(err) {
|
|
10818
|
-
if (err) {
|
|
10819
|
-
throw err
|
|
10820
|
-
}
|
|
10821
|
-
}
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
/***/ }),
|
|
10825
|
-
|
|
10826
|
-
/***/ 1073:
|
|
10827
|
-
/***/ ((module) => {
|
|
10828
|
-
|
|
10829
|
-
module.exports = {
|
|
10830
|
-
trueFunc: function trueFunc(){
|
|
10831
|
-
return true;
|
|
10832
|
-
},
|
|
10833
|
-
falseFunc: function falseFunc(){
|
|
10834
|
-
return false;
|
|
10835
|
-
}
|
|
10836
|
-
};
|
|
10837
|
-
|
|
10838
|
-
/***/ }),
|
|
10839
|
-
|
|
10840
|
-
/***/ 932:
|
|
10841
|
-
/***/ ((module) => {
|
|
10842
|
-
|
|
10843
|
-
"use strict";
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
module.exports = ccount
|
|
10847
|
-
|
|
10848
|
-
function ccount(value, character) {
|
|
10849
|
-
var val = String(value)
|
|
10850
|
-
var count = 0
|
|
10851
|
-
var index
|
|
10852
|
-
|
|
10853
|
-
if (typeof character !== 'string' || character.length !== 1) {
|
|
10854
|
-
throw new Error('Expected character')
|
|
10855
|
-
}
|
|
10856
|
-
|
|
10857
|
-
index = val.indexOf(character)
|
|
10858
|
-
|
|
10859
|
-
while (index !== -1) {
|
|
10860
|
-
count++
|
|
10861
|
-
index = val.indexOf(character, index + 1)
|
|
10862
|
-
}
|
|
10863
|
-
|
|
10864
|
-
return count
|
|
10865
|
-
}
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
/***/ }),
|
|
10869
|
-
|
|
10870
|
-
/***/ 6313:
|
|
10871
|
-
/***/ ((module) => {
|
|
10872
|
-
|
|
10873
|
-
var clone = (function() {
|
|
10874
|
-
'use strict';
|
|
10875
|
-
|
|
10876
|
-
function _instanceof(obj, type) {
|
|
10877
|
-
return type != null && obj instanceof type;
|
|
10878
|
-
}
|
|
10879
|
-
|
|
10880
|
-
var nativeMap;
|
|
10881
|
-
try {
|
|
10882
|
-
nativeMap = Map;
|
|
10883
|
-
} catch(_) {
|
|
10884
|
-
// maybe a reference error because no `Map`. Give it a dummy value that no
|
|
10885
|
-
// value will ever be an instanceof.
|
|
10886
|
-
nativeMap = function() {};
|
|
10887
|
-
}
|
|
10888
|
-
|
|
10889
|
-
var nativeSet;
|
|
10890
|
-
try {
|
|
10891
|
-
nativeSet = Set;
|
|
10892
|
-
} catch(_) {
|
|
10893
|
-
nativeSet = function() {};
|
|
10894
|
-
}
|
|
10895
|
-
|
|
10896
|
-
var nativePromise;
|
|
10897
|
-
try {
|
|
10898
|
-
nativePromise = Promise;
|
|
10899
|
-
} catch(_) {
|
|
10900
|
-
nativePromise = function() {};
|
|
10901
|
-
}
|
|
10902
|
-
|
|
10903
|
-
/**
|
|
10904
|
-
* Clones (copies) an Object using deep copying.
|
|
10905
|
-
*
|
|
10906
|
-
* This function supports circular references by default, but if you are certain
|
|
10907
|
-
* there are no circular references in your object, you can save some CPU time
|
|
10908
|
-
* by calling clone(obj, false).
|
|
10909
|
-
*
|
|
10910
|
-
* Caution: if `circular` is false and `parent` contains circular references,
|
|
10911
|
-
* your program may enter an infinite loop and crash.
|
|
10912
|
-
*
|
|
10913
|
-
* @param `parent` - the object to be cloned
|
|
10914
|
-
* @param `circular` - set to true if the object to be cloned may contain
|
|
10915
|
-
* circular references. (optional - true by default)
|
|
10916
|
-
* @param `depth` - set to a number if the object is only to be cloned to
|
|
10917
|
-
* a particular depth. (optional - defaults to Infinity)
|
|
10918
|
-
* @param `prototype` - sets the prototype to be used when cloning an object.
|
|
10919
|
-
* (optional - defaults to parent prototype).
|
|
10920
|
-
* @param `includeNonEnumerable` - set to true if the non-enumerable properties
|
|
10921
|
-
* should be cloned as well. Non-enumerable properties on the prototype
|
|
10922
|
-
* chain will be ignored. (optional - false by default)
|
|
10923
|
-
*/
|
|
10924
|
-
function clone(parent, circular, depth, prototype, includeNonEnumerable) {
|
|
10925
|
-
if (typeof circular === 'object') {
|
|
10926
|
-
depth = circular.depth;
|
|
10927
|
-
prototype = circular.prototype;
|
|
10928
|
-
includeNonEnumerable = circular.includeNonEnumerable;
|
|
10929
|
-
circular = circular.circular;
|
|
10930
|
-
}
|
|
10931
|
-
// maintain two arrays for circular references, where corresponding parents
|
|
10932
|
-
// and children have the same index
|
|
10933
|
-
var allParents = [];
|
|
10934
|
-
var allChildren = [];
|
|
10935
|
-
|
|
10936
|
-
var useBuffer = typeof Buffer != 'undefined';
|
|
10937
|
-
|
|
10938
|
-
if (typeof circular == 'undefined')
|
|
10939
|
-
circular = true;
|
|
10940
|
-
|
|
10941
|
-
if (typeof depth == 'undefined')
|
|
10942
|
-
depth = Infinity;
|
|
10943
|
-
|
|
10944
|
-
// recurse this function so we don't reset allParents and allChildren
|
|
10945
|
-
function _clone(parent, depth) {
|
|
10946
|
-
// cloning null always returns null
|
|
10947
|
-
if (parent === null)
|
|
10948
|
-
return null;
|
|
10502
|
+
// recurse this function so we don't reset allParents and allChildren
|
|
10503
|
+
function _clone(parent, depth) {
|
|
10504
|
+
// cloning null always returns null
|
|
10505
|
+
if (parent === null)
|
|
10506
|
+
return null;
|
|
10949
10507
|
|
|
10950
10508
|
if (depth === 0)
|
|
10951
10509
|
return parent;
|
|
@@ -32853,745 +32411,972 @@ const defaultSchema = {
|
|
|
32853
32411
|
}
|
|
32854
32412
|
|
|
32855
32413
|
|
|
32856
|
-
/***/ }),
|
|
32414
|
+
/***/ }),
|
|
32415
|
+
|
|
32416
|
+
/***/ 1445:
|
|
32417
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
32418
|
+
|
|
32419
|
+
"use strict";
|
|
32420
|
+
__webpack_require__.r(__webpack_exports__);
|
|
32421
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32422
|
+
/* harmony export */ "map": () => (/* binding */ map)
|
|
32423
|
+
/* harmony export */ });
|
|
32424
|
+
/**
|
|
32425
|
+
* @typedef {import('unist').Node} Node
|
|
32426
|
+
*/
|
|
32427
|
+
|
|
32428
|
+
/**
|
|
32429
|
+
* @template {Node} [Tree=Node]
|
|
32430
|
+
* @typedef {import('./complex-types.js').MapFunction<Tree>} MapFunction
|
|
32431
|
+
* Function called with a node, its index, and its parent to produce a new
|
|
32432
|
+
* node.
|
|
32433
|
+
*/
|
|
32434
|
+
|
|
32435
|
+
/**
|
|
32436
|
+
* Create a new tree by mapping all nodes with the given function.
|
|
32437
|
+
*
|
|
32438
|
+
* @template {Node} Tree
|
|
32439
|
+
* Type of input tree.
|
|
32440
|
+
* @param {Tree} tree
|
|
32441
|
+
* Tree to map.
|
|
32442
|
+
* @param {MapFunction<Tree>} mapFunction
|
|
32443
|
+
* Function called with a node, its index, and its parent to produce a new
|
|
32444
|
+
* node.
|
|
32445
|
+
* @returns {Tree}
|
|
32446
|
+
* New mapped tree.
|
|
32447
|
+
*/
|
|
32448
|
+
function map(tree, mapFunction) {
|
|
32449
|
+
// @ts-expect-error Looks like a children.
|
|
32450
|
+
return preorder(tree, null, null)
|
|
32451
|
+
|
|
32452
|
+
/** @type {import('./complex-types').MapFunction<Tree>} */
|
|
32453
|
+
function preorder(node, index, parent) {
|
|
32454
|
+
var newNode = Object.assign({}, mapFunction(node, index, parent))
|
|
32455
|
+
|
|
32456
|
+
if ('children' in node) {
|
|
32457
|
+
// @ts-expect-error Looks like a parent.
|
|
32458
|
+
newNode.children = node.children.map(function (
|
|
32459
|
+
/** @type {import('./complex-types').InclusiveDescendant<Tree>} */ child,
|
|
32460
|
+
/** @type {number} */ index
|
|
32461
|
+
) {
|
|
32462
|
+
return preorder(child, index, node)
|
|
32463
|
+
})
|
|
32464
|
+
}
|
|
32465
|
+
|
|
32466
|
+
return newNode
|
|
32467
|
+
}
|
|
32468
|
+
}
|
|
32469
|
+
|
|
32470
|
+
|
|
32471
|
+
/***/ }),
|
|
32472
|
+
|
|
32473
|
+
/***/ 5907:
|
|
32474
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
32475
|
+
|
|
32476
|
+
"use strict";
|
|
32477
|
+
// ESM COMPAT FLAG
|
|
32478
|
+
__webpack_require__.r(__webpack_exports__);
|
|
32479
|
+
|
|
32480
|
+
// EXPORTS
|
|
32481
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
32482
|
+
"matches": () => (/* binding */ unist_util_select_matches),
|
|
32483
|
+
"select": () => (/* binding */ unist_util_select_select),
|
|
32484
|
+
"selectAll": () => (/* binding */ selectAll)
|
|
32485
|
+
});
|
|
32486
|
+
|
|
32487
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/zwitch/index.js
|
|
32488
|
+
var own = {}.hasOwnProperty
|
|
32489
|
+
|
|
32490
|
+
/**
|
|
32491
|
+
* @callback Handler
|
|
32492
|
+
* @param {...unknown} value
|
|
32493
|
+
* @return {unknown}
|
|
32494
|
+
*
|
|
32495
|
+
* @typedef {Record<string, Handler>} Handlers
|
|
32496
|
+
*
|
|
32497
|
+
* @typedef {Object} Options
|
|
32498
|
+
* @property {Handler} [unknown]
|
|
32499
|
+
* @property {Handler} [invalid]
|
|
32500
|
+
* @property {Handlers} [handlers]
|
|
32501
|
+
*/
|
|
32502
|
+
|
|
32503
|
+
/**
|
|
32504
|
+
* Handle values based on a property.
|
|
32505
|
+
*
|
|
32506
|
+
* @param {string} key
|
|
32507
|
+
* @param {Options} [options]
|
|
32508
|
+
*/
|
|
32509
|
+
function zwitch(key, options) {
|
|
32510
|
+
var settings = options || {}
|
|
32511
|
+
|
|
32512
|
+
/**
|
|
32513
|
+
* Handle one value.
|
|
32514
|
+
* Based on the bound `key`, a respective handler will be called.
|
|
32515
|
+
* If `value` is not an object, or doesn’t have a `key` property, the special
|
|
32516
|
+
* “invalid” handler will be called.
|
|
32517
|
+
* If `value` has an unknown `key`, the special “unknown” handler will be
|
|
32518
|
+
* called.
|
|
32519
|
+
*
|
|
32520
|
+
* All arguments, and the context object, are passed through to the handler,
|
|
32521
|
+
* and it’s result is returned.
|
|
32522
|
+
*
|
|
32523
|
+
* @param {...unknown} [value]
|
|
32524
|
+
* @this {unknown}
|
|
32525
|
+
* @returns {unknown}
|
|
32526
|
+
* @property {Handler} invalid
|
|
32527
|
+
* @property {Handler} unknown
|
|
32528
|
+
* @property {Handlers} handlers
|
|
32529
|
+
*/
|
|
32530
|
+
function one(value) {
|
|
32531
|
+
var fn = one.invalid
|
|
32532
|
+
var handlers = one.handlers
|
|
32533
|
+
|
|
32534
|
+
if (value && own.call(value, key)) {
|
|
32535
|
+
fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
|
|
32536
|
+
}
|
|
32537
|
+
|
|
32538
|
+
if (fn) {
|
|
32539
|
+
return fn.apply(this, arguments)
|
|
32540
|
+
}
|
|
32541
|
+
}
|
|
32542
|
+
|
|
32543
|
+
one.handlers = settings.handlers || {}
|
|
32544
|
+
one.invalid = settings.invalid
|
|
32545
|
+
one.unknown = settings.unknown
|
|
32546
|
+
|
|
32547
|
+
return one
|
|
32548
|
+
}
|
|
32549
|
+
|
|
32550
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/util.js
|
|
32551
|
+
/**
|
|
32552
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
32553
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
32554
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
32555
|
+
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
32556
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
32557
|
+
* @typedef {import('./types.js').Query} Query
|
|
32558
|
+
* @typedef {import('./types.js').Node} Node
|
|
32559
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
32560
|
+
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
32561
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
32562
|
+
*/
|
|
32563
|
+
|
|
32564
|
+
/**
|
|
32565
|
+
* @param {Node} node
|
|
32566
|
+
* @returns {node is Parent}
|
|
32567
|
+
*/
|
|
32568
|
+
function root(node) {
|
|
32569
|
+
return (
|
|
32570
|
+
// Root in nlcst.
|
|
32571
|
+
node.type === 'RootNode' ||
|
|
32572
|
+
// Rest
|
|
32573
|
+
node.type === 'root'
|
|
32574
|
+
)
|
|
32575
|
+
}
|
|
32576
|
+
|
|
32577
|
+
/**
|
|
32578
|
+
* @param {Node} node
|
|
32579
|
+
* @returns {node is Parent}
|
|
32580
|
+
*/
|
|
32581
|
+
function util_parent(node) {
|
|
32582
|
+
return Array.isArray(node.children)
|
|
32583
|
+
}
|
|
32584
|
+
|
|
32585
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
|
|
32586
|
+
/**
|
|
32587
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
32588
|
+
* @typedef {import('./types.js').Query} Query
|
|
32589
|
+
* @typedef {import('./types.js').Node} Node
|
|
32590
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
32591
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
32592
|
+
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
32593
|
+
* @typedef {import('./types.js').Handler} Handler
|
|
32594
|
+
*/
|
|
32595
|
+
|
|
32596
|
+
|
|
32597
|
+
|
|
32598
|
+
|
|
32599
|
+
var nest_own = {}.hasOwnProperty
|
|
32600
|
+
|
|
32601
|
+
var handle = zwitch('nestingOperator', {
|
|
32602
|
+
unknown: unknownNesting,
|
|
32603
|
+
invalid: topScan, // `undefined` is the top query selector.
|
|
32604
|
+
handlers: {
|
|
32605
|
+
null: descendant, // `null` is the descendant combinator.
|
|
32606
|
+
'>': child,
|
|
32607
|
+
'+': adjacentSibling,
|
|
32608
|
+
'~': generalSibling
|
|
32609
|
+
}
|
|
32610
|
+
})
|
|
32611
|
+
|
|
32612
|
+
/** @type {Handler} */
|
|
32613
|
+
function nest(query, node, index, parent, state) {
|
|
32614
|
+
return handle(query, node, index, parent, state)
|
|
32615
|
+
}
|
|
32616
|
+
|
|
32617
|
+
// Shouldn’t be invoked, parser gives correct data.
|
|
32618
|
+
/* c8 ignore next 6 */
|
|
32619
|
+
/**
|
|
32620
|
+
* @param {{[x: string]: unknown, type: string}} query
|
|
32621
|
+
*/
|
|
32622
|
+
function unknownNesting(query) {
|
|
32623
|
+
throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
|
|
32624
|
+
}
|
|
32625
|
+
|
|
32626
|
+
/** @type {Handler} */
|
|
32627
|
+
function topScan(query, node, index, parent, state) {
|
|
32628
|
+
// Shouldn’t happen.
|
|
32629
|
+
/* c8 ignore next 3 */
|
|
32630
|
+
if (parent) {
|
|
32631
|
+
throw new Error('topScan is supposed to be called from the root node')
|
|
32632
|
+
}
|
|
32633
|
+
|
|
32634
|
+
state.iterator(query, node, index, parent, state)
|
|
32635
|
+
if (!state.shallow) descendant(query, node, index, parent, state)
|
|
32636
|
+
}
|
|
32637
|
+
|
|
32638
|
+
/** @type {Handler} */
|
|
32639
|
+
function descendant(query, node, index, parent, state) {
|
|
32640
|
+
var previous = state.iterator
|
|
32641
|
+
|
|
32642
|
+
state.iterator = iterator
|
|
32643
|
+
child(query, node, index, parent, state)
|
|
32857
32644
|
|
|
32858
|
-
|
|
32859
|
-
|
|
32645
|
+
/** @type {SelectIterator} */
|
|
32646
|
+
function iterator(query, node, index, parent, state) {
|
|
32647
|
+
state.iterator = previous
|
|
32648
|
+
previous(query, node, index, parent, state)
|
|
32649
|
+
state.iterator = iterator
|
|
32860
32650
|
|
|
32861
|
-
|
|
32862
|
-
__webpack_require__.r(__webpack_exports__);
|
|
32863
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32864
|
-
/* harmony export */ "map": () => (/* binding */ map)
|
|
32865
|
-
/* harmony export */ });
|
|
32866
|
-
/**
|
|
32867
|
-
* @typedef {import('unist').Node} Node
|
|
32868
|
-
*/
|
|
32651
|
+
if (state.one && state.found) return
|
|
32869
32652
|
|
|
32870
|
-
|
|
32871
|
-
|
|
32872
|
-
|
|
32873
|
-
* Function called with a node, its index, and its parent to produce a new
|
|
32874
|
-
* node.
|
|
32875
|
-
*/
|
|
32653
|
+
child(query, node, index, parent, state)
|
|
32654
|
+
}
|
|
32655
|
+
}
|
|
32876
32656
|
|
|
32877
|
-
/**
|
|
32878
|
-
|
|
32879
|
-
|
|
32880
|
-
|
|
32881
|
-
* Type of input tree.
|
|
32882
|
-
* @param {Tree} tree
|
|
32883
|
-
* Tree to map.
|
|
32884
|
-
* @param {MapFunction<Tree>} mapFunction
|
|
32885
|
-
* Function called with a node, its index, and its parent to produce a new
|
|
32886
|
-
* node.
|
|
32887
|
-
* @returns {Tree}
|
|
32888
|
-
* New mapped tree.
|
|
32889
|
-
*/
|
|
32890
|
-
function map(tree, mapFunction) {
|
|
32891
|
-
// @ts-expect-error Looks like a children.
|
|
32892
|
-
return preorder(tree, null, null)
|
|
32657
|
+
/** @type {Handler} */
|
|
32658
|
+
function child(query, node, _1, _2, state) {
|
|
32659
|
+
if (!util_parent(node)) return
|
|
32660
|
+
if (node.children.length === 0) return
|
|
32893
32661
|
|
|
32894
|
-
|
|
32895
|
-
|
|
32896
|
-
var newNode = Object.assign({}, mapFunction(node, index, parent))
|
|
32662
|
+
new WalkIterator(query, node, state).each().done()
|
|
32663
|
+
}
|
|
32897
32664
|
|
|
32898
|
-
|
|
32899
|
-
|
|
32900
|
-
|
|
32901
|
-
|
|
32902
|
-
|
|
32903
|
-
|
|
32904
|
-
|
|
32905
|
-
|
|
32665
|
+
/** @type {Handler} */
|
|
32666
|
+
function adjacentSibling(query, _, index, parent, state) {
|
|
32667
|
+
// Shouldn’t happen.
|
|
32668
|
+
/* c8 ignore next */
|
|
32669
|
+
if (!parent) return
|
|
32670
|
+
|
|
32671
|
+
new WalkIterator(query, parent, state)
|
|
32672
|
+
.prefillTypeIndex(0, ++index)
|
|
32673
|
+
.each(index, ++index)
|
|
32674
|
+
.prefillTypeIndex(index)
|
|
32675
|
+
.done()
|
|
32676
|
+
}
|
|
32677
|
+
|
|
32678
|
+
/** @type {Handler} */
|
|
32679
|
+
function generalSibling(query, _, index, parent, state) {
|
|
32680
|
+
// Shouldn’t happen.
|
|
32681
|
+
/* c8 ignore next */
|
|
32682
|
+
if (!parent) return
|
|
32683
|
+
|
|
32684
|
+
new WalkIterator(query, parent, state)
|
|
32685
|
+
.prefillTypeIndex(0, ++index)
|
|
32686
|
+
.each(index)
|
|
32687
|
+
.done()
|
|
32688
|
+
}
|
|
32689
|
+
|
|
32690
|
+
class WalkIterator {
|
|
32691
|
+
/**
|
|
32692
|
+
* Handles typeIndex and typeCount properties for every walker.
|
|
32693
|
+
*
|
|
32694
|
+
* @param {Rule} query
|
|
32695
|
+
* @param {Parent} parent
|
|
32696
|
+
* @param {SelectState} state
|
|
32697
|
+
*/
|
|
32698
|
+
constructor(query, parent, state) {
|
|
32699
|
+
/** @type {Rule} */
|
|
32700
|
+
this.query = query
|
|
32701
|
+
/** @type {Parent} */
|
|
32702
|
+
this.parent = parent
|
|
32703
|
+
/** @type {SelectState} */
|
|
32704
|
+
this.state = state
|
|
32705
|
+
/** @type {TypeIndex|undefined} */
|
|
32706
|
+
this.typeIndex = state.index ? new TypeIndex() : undefined
|
|
32707
|
+
/** @type {Array.<Function>} */
|
|
32708
|
+
this.delayed = []
|
|
32709
|
+
}
|
|
32710
|
+
|
|
32711
|
+
/**
|
|
32712
|
+
* @param {number|null|undefined} [x]
|
|
32713
|
+
* @param {number|null|undefined} [y]
|
|
32714
|
+
* @returns {this}
|
|
32715
|
+
*/
|
|
32716
|
+
prefillTypeIndex(x, y) {
|
|
32717
|
+
var [start, end] = this.defaults(x, y)
|
|
32718
|
+
|
|
32719
|
+
if (this.typeIndex) {
|
|
32720
|
+
while (start < end) {
|
|
32721
|
+
this.typeIndex.index(this.parent.children[start])
|
|
32722
|
+
start++
|
|
32723
|
+
}
|
|
32906
32724
|
}
|
|
32907
32725
|
|
|
32908
|
-
return
|
|
32726
|
+
return this
|
|
32909
32727
|
}
|
|
32910
|
-
}
|
|
32911
32728
|
|
|
32729
|
+
/**
|
|
32730
|
+
* @param {number|null|undefined} [x]
|
|
32731
|
+
* @param {number|null|undefined} [y]
|
|
32732
|
+
* @returns {this}
|
|
32733
|
+
*/
|
|
32734
|
+
each(x, y) {
|
|
32735
|
+
var [start, end] = this.defaults(x, y)
|
|
32736
|
+
var child = this.parent.children[start]
|
|
32737
|
+
/** @type {number} */
|
|
32738
|
+
var index
|
|
32739
|
+
/** @type {number} */
|
|
32740
|
+
var nodeIndex
|
|
32912
32741
|
|
|
32913
|
-
|
|
32742
|
+
if (start >= end) return this
|
|
32914
32743
|
|
|
32915
|
-
|
|
32916
|
-
|
|
32744
|
+
if (this.typeIndex) {
|
|
32745
|
+
nodeIndex = this.typeIndex.nodes
|
|
32746
|
+
index = this.typeIndex.index(child)
|
|
32747
|
+
this.delayed.push(delay)
|
|
32748
|
+
} else {
|
|
32749
|
+
this.state.iterator(this.query, child, start, this.parent, this.state)
|
|
32750
|
+
}
|
|
32917
32751
|
|
|
32918
|
-
|
|
32919
|
-
|
|
32920
|
-
__webpack_require__.r(__webpack_exports__);
|
|
32752
|
+
// Stop if we’re looking for one node and it’s already found.
|
|
32753
|
+
if (this.state.one && this.state.found) return this
|
|
32921
32754
|
|
|
32922
|
-
|
|
32923
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
32924
|
-
"matches": () => (/* binding */ unist_util_select_matches),
|
|
32925
|
-
"select": () => (/* binding */ unist_util_select_select),
|
|
32926
|
-
"selectAll": () => (/* binding */ selectAll)
|
|
32927
|
-
});
|
|
32755
|
+
return this.each(start + 1, end)
|
|
32928
32756
|
|
|
32929
|
-
|
|
32930
|
-
|
|
32757
|
+
/**
|
|
32758
|
+
* @this {WalkIterator}
|
|
32759
|
+
*/
|
|
32760
|
+
function delay() {
|
|
32761
|
+
this.state.typeIndex = index
|
|
32762
|
+
this.state.nodeIndex = nodeIndex
|
|
32763
|
+
this.state.typeCount = this.typeIndex.count(child)
|
|
32764
|
+
this.state.nodeCount = this.typeIndex.nodes
|
|
32765
|
+
this.state.iterator(this.query, child, start, this.parent, this.state)
|
|
32766
|
+
}
|
|
32767
|
+
}
|
|
32931
32768
|
|
|
32932
|
-
/**
|
|
32933
|
-
|
|
32934
|
-
|
|
32935
|
-
|
|
32936
|
-
|
|
32937
|
-
|
|
32938
|
-
*
|
|
32939
|
-
* @typedef {Object} Options
|
|
32940
|
-
* @property {Handler} [unknown]
|
|
32941
|
-
* @property {Handler} [invalid]
|
|
32942
|
-
* @property {Handlers} [handlers]
|
|
32943
|
-
*/
|
|
32769
|
+
/**
|
|
32770
|
+
* Done!
|
|
32771
|
+
* @returns {this}
|
|
32772
|
+
*/
|
|
32773
|
+
done() {
|
|
32774
|
+
var index = -1
|
|
32944
32775
|
|
|
32945
|
-
|
|
32946
|
-
|
|
32947
|
-
|
|
32948
|
-
|
|
32949
|
-
|
|
32950
|
-
|
|
32951
|
-
|
|
32952
|
-
var settings = options || {}
|
|
32776
|
+
while (++index < this.delayed.length) {
|
|
32777
|
+
this.delayed[index].call(this)
|
|
32778
|
+
if (this.state.one && this.state.found) break
|
|
32779
|
+
}
|
|
32780
|
+
|
|
32781
|
+
return this
|
|
32782
|
+
}
|
|
32953
32783
|
|
|
32954
32784
|
/**
|
|
32955
|
-
*
|
|
32956
|
-
*
|
|
32957
|
-
*
|
|
32958
|
-
* “invalid” handler will be called.
|
|
32959
|
-
* If `value` has an unknown `key`, the special “unknown” handler will be
|
|
32960
|
-
* called.
|
|
32961
|
-
*
|
|
32962
|
-
* All arguments, and the context object, are passed through to the handler,
|
|
32963
|
-
* and it’s result is returned.
|
|
32964
|
-
*
|
|
32965
|
-
* @param {...unknown} [value]
|
|
32966
|
-
* @this {unknown}
|
|
32967
|
-
* @returns {unknown}
|
|
32968
|
-
* @property {Handler} invalid
|
|
32969
|
-
* @property {Handler} unknown
|
|
32970
|
-
* @property {Handlers} handlers
|
|
32785
|
+
* @param {number|null|undefined} [start]
|
|
32786
|
+
* @param {number|null|undefined} [end]
|
|
32787
|
+
* @returns {[number, number]}
|
|
32971
32788
|
*/
|
|
32972
|
-
|
|
32973
|
-
|
|
32974
|
-
|
|
32789
|
+
defaults(start, end) {
|
|
32790
|
+
if (start === null || start === undefined || start < 0) start = 0
|
|
32791
|
+
if (end === null || end === undefined || end > this.parent.children.length)
|
|
32792
|
+
end = this.parent.children.length
|
|
32793
|
+
return [start, end]
|
|
32794
|
+
}
|
|
32795
|
+
}
|
|
32796
|
+
|
|
32797
|
+
class TypeIndex {
|
|
32798
|
+
constructor() {
|
|
32799
|
+
/** @type {Object.<string, number>} */
|
|
32800
|
+
this.counts = {}
|
|
32801
|
+
/** @type {number} */
|
|
32802
|
+
this.nodes = 0
|
|
32803
|
+
}
|
|
32804
|
+
|
|
32805
|
+
/**
|
|
32806
|
+
* @param {Node} node
|
|
32807
|
+
* @returns {number}
|
|
32808
|
+
*/
|
|
32809
|
+
index(node) {
|
|
32810
|
+
var type = node.type
|
|
32811
|
+
|
|
32812
|
+
this.nodes++
|
|
32975
32813
|
|
|
32976
|
-
if (
|
|
32977
|
-
fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
|
|
32978
|
-
}
|
|
32814
|
+
if (!nest_own.call(this.counts, type)) this.counts[type] = 0
|
|
32979
32815
|
|
|
32980
|
-
|
|
32981
|
-
|
|
32982
|
-
}
|
|
32816
|
+
// Note: `++` is intended to be postfixed!
|
|
32817
|
+
return this.counts[type]++
|
|
32983
32818
|
}
|
|
32984
32819
|
|
|
32985
|
-
|
|
32986
|
-
|
|
32987
|
-
|
|
32988
|
-
|
|
32989
|
-
|
|
32820
|
+
/**
|
|
32821
|
+
* @param {Node} node
|
|
32822
|
+
* @returns {number|undefined}
|
|
32823
|
+
*/
|
|
32824
|
+
count(node) {
|
|
32825
|
+
return this.counts[node.type]
|
|
32826
|
+
}
|
|
32990
32827
|
}
|
|
32991
32828
|
|
|
32992
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/
|
|
32829
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
|
|
32993
32830
|
/**
|
|
32994
|
-
* @typedef {import('
|
|
32995
|
-
* @typedef {import('
|
|
32996
|
-
*
|
|
32997
|
-
* @typedef {
|
|
32998
|
-
* @typedef {
|
|
32999
|
-
*
|
|
33000
|
-
* @typedef {
|
|
33001
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
33002
|
-
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
33003
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
32831
|
+
* @typedef {import('unist').Node} Node
|
|
32832
|
+
* @typedef {import('unist').Parent} Parent
|
|
32833
|
+
*
|
|
32834
|
+
* @typedef {string} Type
|
|
32835
|
+
* @typedef {Object<string, unknown>} Props
|
|
32836
|
+
*
|
|
32837
|
+
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
|
|
33004
32838
|
*/
|
|
33005
32839
|
|
|
33006
32840
|
/**
|
|
32841
|
+
* Check if a node passes a test
|
|
32842
|
+
*
|
|
32843
|
+
* @callback TestFunctionAnything
|
|
33007
32844
|
* @param {Node} node
|
|
33008
|
-
* @
|
|
32845
|
+
* @param {number} [index]
|
|
32846
|
+
* @param {Parent} [parent]
|
|
32847
|
+
* @returns {boolean|void}
|
|
33009
32848
|
*/
|
|
33010
|
-
function root(node) {
|
|
33011
|
-
return (
|
|
33012
|
-
// Root in nlcst.
|
|
33013
|
-
node.type === 'RootNode' ||
|
|
33014
|
-
// Rest
|
|
33015
|
-
node.type === 'root'
|
|
33016
|
-
)
|
|
33017
|
-
}
|
|
33018
32849
|
|
|
33019
32850
|
/**
|
|
32851
|
+
* Check if a node passes a certain node test
|
|
32852
|
+
*
|
|
32853
|
+
* @template {Node} X
|
|
32854
|
+
* @callback TestFunctionPredicate
|
|
33020
32855
|
* @param {Node} node
|
|
33021
|
-
* @
|
|
32856
|
+
* @param {number} [index]
|
|
32857
|
+
* @param {Parent} [parent]
|
|
32858
|
+
* @returns {node is X}
|
|
33022
32859
|
*/
|
|
33023
|
-
function util_parent(node) {
|
|
33024
|
-
return Array.isArray(node.children)
|
|
33025
|
-
}
|
|
33026
32860
|
|
|
33027
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/nest.js
|
|
33028
32861
|
/**
|
|
33029
|
-
* @
|
|
33030
|
-
* @
|
|
33031
|
-
* @
|
|
33032
|
-
* @
|
|
33033
|
-
* @
|
|
33034
|
-
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
33035
|
-
* @typedef {import('./types.js').Handler} Handler
|
|
32862
|
+
* @callback AssertAnything
|
|
32863
|
+
* @param {unknown} [node]
|
|
32864
|
+
* @param {number} [index]
|
|
32865
|
+
* @param {Parent} [parent]
|
|
32866
|
+
* @returns {boolean}
|
|
33036
32867
|
*/
|
|
33037
32868
|
|
|
32869
|
+
/**
|
|
32870
|
+
* Check if a node passes a certain node test
|
|
32871
|
+
*
|
|
32872
|
+
* @template {Node} Y
|
|
32873
|
+
* @callback AssertPredicate
|
|
32874
|
+
* @param {unknown} [node]
|
|
32875
|
+
* @param {number} [index]
|
|
32876
|
+
* @param {Parent} [parent]
|
|
32877
|
+
* @returns {node is Y}
|
|
32878
|
+
*/
|
|
33038
32879
|
|
|
32880
|
+
var is =
|
|
32881
|
+
/**
|
|
32882
|
+
* Check if a node passes a test.
|
|
32883
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
32884
|
+
*
|
|
32885
|
+
* @type {(
|
|
32886
|
+
* (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number, parent?: Parent, context?: unknown) => node is T) &
|
|
32887
|
+
* ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
|
|
32888
|
+
* )}
|
|
32889
|
+
*/
|
|
32890
|
+
(
|
|
32891
|
+
/**
|
|
32892
|
+
* Check if a node passes a test.
|
|
32893
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
32894
|
+
*
|
|
32895
|
+
* @param {unknown} [node] Node to check
|
|
32896
|
+
* @param {Test} [test]
|
|
32897
|
+
* When nullish, checks if `node` is a `Node`.
|
|
32898
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
32899
|
+
* When `function` checks if function passed the node is true.
|
|
32900
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
32901
|
+
* When `array`, checks any one of the subtests pass.
|
|
32902
|
+
* @param {number} [index] Position of `node` in `parent`
|
|
32903
|
+
* @param {Parent} [parent] Parent of `node`
|
|
32904
|
+
* @param {unknown} [context] Context object to invoke `test` with
|
|
32905
|
+
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
32906
|
+
*/
|
|
32907
|
+
// eslint-disable-next-line max-params
|
|
32908
|
+
function is(node, test, index, parent, context) {
|
|
32909
|
+
var check = convert(test)
|
|
33039
32910
|
|
|
32911
|
+
if (
|
|
32912
|
+
index !== undefined &&
|
|
32913
|
+
index !== null &&
|
|
32914
|
+
(typeof index !== 'number' ||
|
|
32915
|
+
index < 0 ||
|
|
32916
|
+
index === Number.POSITIVE_INFINITY)
|
|
32917
|
+
) {
|
|
32918
|
+
throw new Error('Expected positive finite index')
|
|
32919
|
+
}
|
|
33040
32920
|
|
|
33041
|
-
|
|
33042
|
-
|
|
33043
|
-
|
|
33044
|
-
|
|
33045
|
-
|
|
33046
|
-
|
|
33047
|
-
|
|
33048
|
-
'>': child,
|
|
33049
|
-
'+': adjacentSibling,
|
|
33050
|
-
'~': generalSibling
|
|
33051
|
-
}
|
|
33052
|
-
})
|
|
33053
|
-
|
|
33054
|
-
/** @type {Handler} */
|
|
33055
|
-
function nest(query, node, index, parent, state) {
|
|
33056
|
-
return handle(query, node, index, parent, state)
|
|
33057
|
-
}
|
|
32921
|
+
if (
|
|
32922
|
+
parent !== undefined &&
|
|
32923
|
+
parent !== null &&
|
|
32924
|
+
(!is(parent) || !parent.children)
|
|
32925
|
+
) {
|
|
32926
|
+
throw new Error('Expected parent node')
|
|
32927
|
+
}
|
|
33058
32928
|
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
|
|
33063
|
-
|
|
33064
|
-
|
|
33065
|
-
throw new Error('Unexpected nesting `' + query.nestingOperator + '`')
|
|
33066
|
-
}
|
|
32929
|
+
if (
|
|
32930
|
+
(parent === undefined || parent === null) !==
|
|
32931
|
+
(index === undefined || index === null)
|
|
32932
|
+
) {
|
|
32933
|
+
throw new Error('Expected both parent and index')
|
|
32934
|
+
}
|
|
33067
32935
|
|
|
33068
|
-
|
|
33069
|
-
|
|
33070
|
-
|
|
33071
|
-
|
|
33072
|
-
|
|
33073
|
-
|
|
33074
|
-
}
|
|
32936
|
+
// @ts-ignore Looks like a node.
|
|
32937
|
+
return node && node.type && typeof node.type === 'string'
|
|
32938
|
+
? Boolean(check.call(context, node, index, parent))
|
|
32939
|
+
: false
|
|
32940
|
+
}
|
|
32941
|
+
)
|
|
33075
32942
|
|
|
33076
|
-
|
|
33077
|
-
|
|
33078
|
-
|
|
32943
|
+
var convert =
|
|
32944
|
+
/**
|
|
32945
|
+
* @type {(
|
|
32946
|
+
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
32947
|
+
* ((test?: Test) => AssertAnything)
|
|
32948
|
+
* )}
|
|
32949
|
+
*/
|
|
32950
|
+
(
|
|
32951
|
+
/**
|
|
32952
|
+
* Generate an assertion from a check.
|
|
32953
|
+
* @param {Test} [test]
|
|
32954
|
+
* When nullish, checks if `node` is a `Node`.
|
|
32955
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
32956
|
+
* When `function` checks if function passed the node is true.
|
|
32957
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
32958
|
+
* When `array`, checks any one of the subtests pass.
|
|
32959
|
+
* @returns {AssertAnything}
|
|
32960
|
+
*/
|
|
32961
|
+
function (test) {
|
|
32962
|
+
if (test === undefined || test === null) {
|
|
32963
|
+
return ok
|
|
32964
|
+
}
|
|
33079
32965
|
|
|
33080
|
-
|
|
33081
|
-
|
|
33082
|
-
|
|
32966
|
+
if (typeof test === 'string') {
|
|
32967
|
+
return typeFactory(test)
|
|
32968
|
+
}
|
|
33083
32969
|
|
|
33084
|
-
|
|
33085
|
-
|
|
32970
|
+
if (typeof test === 'object') {
|
|
32971
|
+
// @ts-ignore looks like a list of tests / partial test object.
|
|
32972
|
+
return 'length' in test ? anyFactory(test) : propsFactory(test)
|
|
32973
|
+
}
|
|
33086
32974
|
|
|
33087
|
-
|
|
33088
|
-
|
|
33089
|
-
|
|
33090
|
-
previous(query, node, index, parent, state)
|
|
33091
|
-
state.iterator = iterator
|
|
32975
|
+
if (typeof test === 'function') {
|
|
32976
|
+
return castFactory(test)
|
|
32977
|
+
}
|
|
33092
32978
|
|
|
33093
|
-
|
|
32979
|
+
throw new Error('Expected function, string, or object as test')
|
|
32980
|
+
}
|
|
32981
|
+
)
|
|
32982
|
+
/**
|
|
32983
|
+
* @param {Array.<Type|Props|TestFunctionAnything>} tests
|
|
32984
|
+
* @returns {AssertAnything}
|
|
32985
|
+
*/
|
|
32986
|
+
function anyFactory(tests) {
|
|
32987
|
+
/** @type {Array.<AssertAnything>} */
|
|
32988
|
+
var checks = []
|
|
32989
|
+
var index = -1
|
|
33094
32990
|
|
|
33095
|
-
|
|
32991
|
+
while (++index < tests.length) {
|
|
32992
|
+
checks[index] = convert(tests[index])
|
|
33096
32993
|
}
|
|
33097
|
-
}
|
|
33098
32994
|
|
|
33099
|
-
|
|
33100
|
-
function child(query, node, _1, _2, state) {
|
|
33101
|
-
if (!util_parent(node)) return
|
|
33102
|
-
if (node.children.length === 0) return
|
|
32995
|
+
return castFactory(any)
|
|
33103
32996
|
|
|
33104
|
-
|
|
32997
|
+
/**
|
|
32998
|
+
* @this {unknown}
|
|
32999
|
+
* @param {unknown[]} parameters
|
|
33000
|
+
* @returns {boolean}
|
|
33001
|
+
*/
|
|
33002
|
+
function any(...parameters) {
|
|
33003
|
+
var index = -1
|
|
33004
|
+
|
|
33005
|
+
while (++index < checks.length) {
|
|
33006
|
+
if (checks[index].call(this, ...parameters)) return true
|
|
33007
|
+
}
|
|
33008
|
+
}
|
|
33105
33009
|
}
|
|
33106
33010
|
|
|
33107
|
-
/**
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
33011
|
+
/**
|
|
33012
|
+
* Utility to assert each property in `test` is represented in `node`, and each
|
|
33013
|
+
* values are strictly equal.
|
|
33014
|
+
*
|
|
33015
|
+
* @param {Props} check
|
|
33016
|
+
* @returns {AssertAnything}
|
|
33017
|
+
*/
|
|
33018
|
+
function propsFactory(check) {
|
|
33019
|
+
return castFactory(all)
|
|
33112
33020
|
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
|
|
33117
|
-
|
|
33118
|
-
}
|
|
33021
|
+
/**
|
|
33022
|
+
* @param {Node} node
|
|
33023
|
+
* @returns {boolean}
|
|
33024
|
+
*/
|
|
33025
|
+
function all(node) {
|
|
33026
|
+
/** @type {string} */
|
|
33027
|
+
var key
|
|
33119
33028
|
|
|
33120
|
-
|
|
33121
|
-
|
|
33122
|
-
|
|
33123
|
-
/* c8 ignore next */
|
|
33124
|
-
if (!parent) return
|
|
33029
|
+
for (key in check) {
|
|
33030
|
+
if (node[key] !== check[key]) return
|
|
33031
|
+
}
|
|
33125
33032
|
|
|
33126
|
-
|
|
33127
|
-
|
|
33128
|
-
.each(index)
|
|
33129
|
-
.done()
|
|
33033
|
+
return true
|
|
33034
|
+
}
|
|
33130
33035
|
}
|
|
33131
33036
|
|
|
33132
|
-
|
|
33037
|
+
/**
|
|
33038
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
33039
|
+
* for said string.
|
|
33040
|
+
*
|
|
33041
|
+
* @param {Type} check
|
|
33042
|
+
* @returns {AssertAnything}
|
|
33043
|
+
*/
|
|
33044
|
+
function typeFactory(check) {
|
|
33045
|
+
return castFactory(type)
|
|
33046
|
+
|
|
33133
33047
|
/**
|
|
33134
|
-
*
|
|
33135
|
-
*
|
|
33136
|
-
* @param {Rule} query
|
|
33137
|
-
* @param {Parent} parent
|
|
33138
|
-
* @param {SelectState} state
|
|
33048
|
+
* @param {Node} node
|
|
33139
33049
|
*/
|
|
33140
|
-
|
|
33141
|
-
|
|
33142
|
-
this.query = query
|
|
33143
|
-
/** @type {Parent} */
|
|
33144
|
-
this.parent = parent
|
|
33145
|
-
/** @type {SelectState} */
|
|
33146
|
-
this.state = state
|
|
33147
|
-
/** @type {TypeIndex|undefined} */
|
|
33148
|
-
this.typeIndex = state.index ? new TypeIndex() : undefined
|
|
33149
|
-
/** @type {Array.<Function>} */
|
|
33150
|
-
this.delayed = []
|
|
33050
|
+
function type(node) {
|
|
33051
|
+
return node && node.type === check
|
|
33151
33052
|
}
|
|
33053
|
+
}
|
|
33054
|
+
|
|
33055
|
+
/**
|
|
33056
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
33057
|
+
* for said string.
|
|
33058
|
+
* @param {TestFunctionAnything} check
|
|
33059
|
+
* @returns {AssertAnything}
|
|
33060
|
+
*/
|
|
33061
|
+
function castFactory(check) {
|
|
33062
|
+
return assertion
|
|
33152
33063
|
|
|
33153
33064
|
/**
|
|
33154
|
-
* @
|
|
33155
|
-
* @param {
|
|
33156
|
-
* @returns {
|
|
33065
|
+
* @this {unknown}
|
|
33066
|
+
* @param {Array.<unknown>} parameters
|
|
33067
|
+
* @returns {boolean}
|
|
33157
33068
|
*/
|
|
33158
|
-
|
|
33159
|
-
|
|
33069
|
+
function assertion(...parameters) {
|
|
33070
|
+
return Boolean(check.call(this, ...parameters))
|
|
33071
|
+
}
|
|
33072
|
+
}
|
|
33160
33073
|
|
|
33161
|
-
|
|
33162
|
-
|
|
33163
|
-
|
|
33164
|
-
|
|
33165
|
-
}
|
|
33166
|
-
}
|
|
33074
|
+
// Utility to return true.
|
|
33075
|
+
function ok() {
|
|
33076
|
+
return true
|
|
33077
|
+
}
|
|
33167
33078
|
|
|
33168
|
-
|
|
33169
|
-
|
|
33079
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
|
|
33080
|
+
/**
|
|
33081
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33082
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
33083
|
+
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
33084
|
+
* @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
|
|
33085
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
33086
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
33087
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
33088
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
33089
|
+
* @typedef {import('./types.js').Node} Node
|
|
33090
|
+
*/
|
|
33170
33091
|
|
|
33171
|
-
/**
|
|
33172
|
-
* @param {number|null|undefined} [x]
|
|
33173
|
-
* @param {number|null|undefined} [y]
|
|
33174
|
-
* @returns {this}
|
|
33175
|
-
*/
|
|
33176
|
-
each(x, y) {
|
|
33177
|
-
var [start, end] = this.defaults(x, y)
|
|
33178
|
-
var child = this.parent.children[start]
|
|
33179
|
-
/** @type {number} */
|
|
33180
|
-
var index
|
|
33181
|
-
/** @type {number} */
|
|
33182
|
-
var nodeIndex
|
|
33183
33092
|
|
|
33184
|
-
if (start >= end) return this
|
|
33185
33093
|
|
|
33186
|
-
if (this.typeIndex) {
|
|
33187
|
-
nodeIndex = this.typeIndex.nodes
|
|
33188
|
-
index = this.typeIndex.index(child)
|
|
33189
|
-
this.delayed.push(delay)
|
|
33190
|
-
} else {
|
|
33191
|
-
this.state.iterator(this.query, child, start, this.parent, this.state)
|
|
33192
|
-
}
|
|
33193
33094
|
|
|
33194
|
-
// Stop if we’re looking for one node and it’s already found.
|
|
33195
|
-
if (this.state.one && this.state.found) return this
|
|
33196
33095
|
|
|
33197
|
-
|
|
33096
|
+
var pseudo_is = convert()
|
|
33198
33097
|
|
|
33199
|
-
|
|
33200
|
-
|
|
33201
|
-
|
|
33202
|
-
|
|
33203
|
-
|
|
33204
|
-
|
|
33205
|
-
|
|
33206
|
-
|
|
33207
|
-
|
|
33208
|
-
|
|
33098
|
+
var pseudo_handle = zwitch('name', {
|
|
33099
|
+
unknown: unknownPseudo,
|
|
33100
|
+
invalid: invalidPseudo,
|
|
33101
|
+
handlers: {
|
|
33102
|
+
any: matches,
|
|
33103
|
+
blank: empty,
|
|
33104
|
+
empty,
|
|
33105
|
+
'first-child': firstChild,
|
|
33106
|
+
'first-of-type': firstOfType,
|
|
33107
|
+
has: hasSelector,
|
|
33108
|
+
'last-child': lastChild,
|
|
33109
|
+
'last-of-type': lastOfType,
|
|
33110
|
+
matches,
|
|
33111
|
+
not,
|
|
33112
|
+
'nth-child': nthChild,
|
|
33113
|
+
'nth-last-child': nthLastChild,
|
|
33114
|
+
'nth-of-type': nthOfType,
|
|
33115
|
+
'nth-last-of-type': nthLastOfType,
|
|
33116
|
+
'only-child': onlyChild,
|
|
33117
|
+
'only-of-type': onlyOfType,
|
|
33118
|
+
root: pseudo_root,
|
|
33119
|
+
scope
|
|
33209
33120
|
}
|
|
33121
|
+
})
|
|
33210
33122
|
|
|
33211
|
-
|
|
33212
|
-
|
|
33213
|
-
|
|
33214
|
-
|
|
33215
|
-
|
|
33216
|
-
|
|
33123
|
+
pseudo.needsIndex = [
|
|
33124
|
+
'first-child',
|
|
33125
|
+
'first-of-type',
|
|
33126
|
+
'last-child',
|
|
33127
|
+
'last-of-type',
|
|
33128
|
+
'nth-child',
|
|
33129
|
+
'nth-last-child',
|
|
33130
|
+
'nth-of-type',
|
|
33131
|
+
'nth-last-of-type',
|
|
33132
|
+
'only-child',
|
|
33133
|
+
'only-of-type'
|
|
33134
|
+
]
|
|
33217
33135
|
|
|
33218
|
-
|
|
33219
|
-
|
|
33220
|
-
|
|
33221
|
-
|
|
33136
|
+
/**
|
|
33137
|
+
* @param {Rule} query
|
|
33138
|
+
* @param {Node} node
|
|
33139
|
+
* @param {number|null} index
|
|
33140
|
+
* @param {Parent|null} parent
|
|
33141
|
+
* @param {SelectState} state
|
|
33142
|
+
* @returns {boolean}
|
|
33143
|
+
*/
|
|
33144
|
+
function pseudo(query, node, index, parent, state) {
|
|
33145
|
+
var pseudos = query.pseudos
|
|
33146
|
+
var offset = -1
|
|
33222
33147
|
|
|
33223
|
-
|
|
33148
|
+
while (++offset < pseudos.length) {
|
|
33149
|
+
if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
|
|
33224
33150
|
}
|
|
33225
33151
|
|
|
33226
|
-
|
|
33227
|
-
* @param {number|null|undefined} [start]
|
|
33228
|
-
* @param {number|null|undefined} [end]
|
|
33229
|
-
* @returns {[number, number]}
|
|
33230
|
-
*/
|
|
33231
|
-
defaults(start, end) {
|
|
33232
|
-
if (start === null || start === undefined || start < 0) start = 0
|
|
33233
|
-
if (end === null || end === undefined || end > this.parent.children.length)
|
|
33234
|
-
end = this.parent.children.length
|
|
33235
|
-
return [start, end]
|
|
33236
|
-
}
|
|
33152
|
+
return true
|
|
33237
33153
|
}
|
|
33238
33154
|
|
|
33239
|
-
|
|
33240
|
-
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33245
|
-
|
|
33246
|
-
|
|
33247
|
-
|
|
33248
|
-
|
|
33249
|
-
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
var type = node.type
|
|
33155
|
+
/**
|
|
33156
|
+
* @param {RulePseudoSelector} query
|
|
33157
|
+
* @param {Node} node
|
|
33158
|
+
* @param {number|null} _1
|
|
33159
|
+
* @param {Parent|null} _2
|
|
33160
|
+
* @param {SelectState} state
|
|
33161
|
+
* @returns {boolean}
|
|
33162
|
+
*/
|
|
33163
|
+
function matches(query, node, _1, _2, state) {
|
|
33164
|
+
var shallow = state.shallow
|
|
33165
|
+
var one = state.one
|
|
33166
|
+
/** @type {boolean} */
|
|
33167
|
+
var result
|
|
33253
33168
|
|
|
33254
|
-
|
|
33169
|
+
state.one = true
|
|
33170
|
+
state.shallow = true
|
|
33255
33171
|
|
|
33256
|
-
|
|
33172
|
+
result = state.any(query.value, node, state)[0] === node
|
|
33257
33173
|
|
|
33258
|
-
|
|
33259
|
-
|
|
33260
|
-
}
|
|
33174
|
+
state.shallow = shallow
|
|
33175
|
+
state.one = one
|
|
33261
33176
|
|
|
33262
|
-
|
|
33263
|
-
* @param {Node} node
|
|
33264
|
-
* @returns {number|undefined}
|
|
33265
|
-
*/
|
|
33266
|
-
count(node) {
|
|
33267
|
-
return this.counts[node.type]
|
|
33268
|
-
}
|
|
33177
|
+
return result
|
|
33269
33178
|
}
|
|
33270
33179
|
|
|
33271
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/node_modules/unist-util-is/index.js
|
|
33272
33180
|
/**
|
|
33273
|
-
* @
|
|
33274
|
-
* @
|
|
33275
|
-
*
|
|
33276
|
-
* @
|
|
33277
|
-
* @
|
|
33278
|
-
*
|
|
33279
|
-
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
|
|
33181
|
+
* @param {RulePseudoSelector} query
|
|
33182
|
+
* @param {Node} node
|
|
33183
|
+
* @param {number|null} index
|
|
33184
|
+
* @param {Parent|null} parent
|
|
33185
|
+
* @param {SelectState} state
|
|
33186
|
+
* @returns {boolean}
|
|
33280
33187
|
*/
|
|
33188
|
+
function not(query, node, index, parent, state) {
|
|
33189
|
+
return !matches(query, node, index, parent, state)
|
|
33190
|
+
}
|
|
33281
33191
|
|
|
33282
33192
|
/**
|
|
33283
|
-
*
|
|
33284
|
-
*
|
|
33285
|
-
* @callback TestFunctionAnything
|
|
33193
|
+
* @param {RulePseudo} _1
|
|
33286
33194
|
* @param {Node} node
|
|
33287
|
-
* @param {number}
|
|
33288
|
-
* @param {Parent}
|
|
33289
|
-
* @returns {boolean
|
|
33195
|
+
* @param {number|null} _2
|
|
33196
|
+
* @param {Parent|null} parent
|
|
33197
|
+
* @returns {boolean}
|
|
33290
33198
|
*/
|
|
33199
|
+
function pseudo_root(_1, node, _2, parent) {
|
|
33200
|
+
return pseudo_is(node) && !parent
|
|
33201
|
+
}
|
|
33291
33202
|
|
|
33292
33203
|
/**
|
|
33293
|
-
*
|
|
33294
|
-
*
|
|
33295
|
-
* @template {Node} X
|
|
33296
|
-
* @callback TestFunctionPredicate
|
|
33204
|
+
* @param {RulePseudo} _1
|
|
33297
33205
|
* @param {Node} node
|
|
33298
|
-
* @param {number}
|
|
33299
|
-
* @param {Parent}
|
|
33300
|
-
* @
|
|
33206
|
+
* @param {number|null} _2
|
|
33207
|
+
* @param {Parent|null} _3
|
|
33208
|
+
* @param {SelectState} state
|
|
33209
|
+
* @returns {boolean}
|
|
33301
33210
|
*/
|
|
33211
|
+
function scope(_1, node, _2, _3, state) {
|
|
33212
|
+
return pseudo_is(node) && state.scopeNodes.includes(node)
|
|
33213
|
+
}
|
|
33302
33214
|
|
|
33303
33215
|
/**
|
|
33304
|
-
* @
|
|
33305
|
-
* @param {
|
|
33306
|
-
* @param {number} [index]
|
|
33307
|
-
* @param {Parent} [parent]
|
|
33216
|
+
* @param {RulePseudo} _1
|
|
33217
|
+
* @param {Node} node
|
|
33308
33218
|
* @returns {boolean}
|
|
33309
33219
|
*/
|
|
33220
|
+
function empty(_1, node) {
|
|
33221
|
+
return util_parent(node) ? node.children.length === 0 : !('value' in node)
|
|
33222
|
+
}
|
|
33310
33223
|
|
|
33311
33224
|
/**
|
|
33312
|
-
*
|
|
33313
|
-
*
|
|
33314
|
-
* @
|
|
33315
|
-
* @
|
|
33316
|
-
* @param {
|
|
33317
|
-
* @
|
|
33318
|
-
* @param {Parent} [parent]
|
|
33319
|
-
* @returns {node is Y}
|
|
33225
|
+
* @param {RulePseudo} query
|
|
33226
|
+
* @param {Node} _1
|
|
33227
|
+
* @param {number|null} _2
|
|
33228
|
+
* @param {Parent|null} _3
|
|
33229
|
+
* @param {SelectState} state
|
|
33230
|
+
* @returns {boolean}
|
|
33320
33231
|
*/
|
|
33232
|
+
function firstChild(query, _1, _2, _3, state) {
|
|
33233
|
+
assertDeep(state, query)
|
|
33234
|
+
return state.nodeIndex === 0 // Specifically `0`, not falsey.
|
|
33235
|
+
}
|
|
33321
33236
|
|
|
33322
|
-
var is =
|
|
33323
|
-
/**
|
|
33324
|
-
* Check if a node passes a test.
|
|
33325
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
33326
|
-
*
|
|
33327
|
-
* @type {(
|
|
33328
|
-
* (<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) &
|
|
33329
|
-
* ((node?: unknown, test?: Test, index?: number, parent?: Parent, context?: unknown) => boolean)
|
|
33330
|
-
* )}
|
|
33331
|
-
*/
|
|
33332
|
-
(
|
|
33333
|
-
/**
|
|
33334
|
-
* Check if a node passes a test.
|
|
33335
|
-
* When a `parent` node is known the `index` of node should also be given.
|
|
33336
|
-
*
|
|
33337
|
-
* @param {unknown} [node] Node to check
|
|
33338
|
-
* @param {Test} [test]
|
|
33339
|
-
* When nullish, checks if `node` is a `Node`.
|
|
33340
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
33341
|
-
* When `function` checks if function passed the node is true.
|
|
33342
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
33343
|
-
* When `array`, checks any one of the subtests pass.
|
|
33344
|
-
* @param {number} [index] Position of `node` in `parent`
|
|
33345
|
-
* @param {Parent} [parent] Parent of `node`
|
|
33346
|
-
* @param {unknown} [context] Context object to invoke `test` with
|
|
33347
|
-
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
33348
|
-
*/
|
|
33349
|
-
// eslint-disable-next-line max-params
|
|
33350
|
-
function is(node, test, index, parent, context) {
|
|
33351
|
-
var check = convert(test)
|
|
33352
|
-
|
|
33353
|
-
if (
|
|
33354
|
-
index !== undefined &&
|
|
33355
|
-
index !== null &&
|
|
33356
|
-
(typeof index !== 'number' ||
|
|
33357
|
-
index < 0 ||
|
|
33358
|
-
index === Number.POSITIVE_INFINITY)
|
|
33359
|
-
) {
|
|
33360
|
-
throw new Error('Expected positive finite index')
|
|
33361
|
-
}
|
|
33362
|
-
|
|
33363
|
-
if (
|
|
33364
|
-
parent !== undefined &&
|
|
33365
|
-
parent !== null &&
|
|
33366
|
-
(!is(parent) || !parent.children)
|
|
33367
|
-
) {
|
|
33368
|
-
throw new Error('Expected parent node')
|
|
33369
|
-
}
|
|
33370
|
-
|
|
33371
|
-
if (
|
|
33372
|
-
(parent === undefined || parent === null) !==
|
|
33373
|
-
(index === undefined || index === null)
|
|
33374
|
-
) {
|
|
33375
|
-
throw new Error('Expected both parent and index')
|
|
33376
|
-
}
|
|
33377
|
-
|
|
33378
|
-
// @ts-ignore Looks like a node.
|
|
33379
|
-
return node && node.type && typeof node.type === 'string'
|
|
33380
|
-
? Boolean(check.call(context, node, index, parent))
|
|
33381
|
-
: false
|
|
33382
|
-
}
|
|
33383
|
-
)
|
|
33384
|
-
|
|
33385
|
-
var convert =
|
|
33386
|
-
/**
|
|
33387
|
-
* @type {(
|
|
33388
|
-
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
33389
|
-
* ((test?: Test) => AssertAnything)
|
|
33390
|
-
* )}
|
|
33391
|
-
*/
|
|
33392
|
-
(
|
|
33393
|
-
/**
|
|
33394
|
-
* Generate an assertion from a check.
|
|
33395
|
-
* @param {Test} [test]
|
|
33396
|
-
* When nullish, checks if `node` is a `Node`.
|
|
33397
|
-
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
33398
|
-
* When `function` checks if function passed the node is true.
|
|
33399
|
-
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
33400
|
-
* When `array`, checks any one of the subtests pass.
|
|
33401
|
-
* @returns {AssertAnything}
|
|
33402
|
-
*/
|
|
33403
|
-
function (test) {
|
|
33404
|
-
if (test === undefined || test === null) {
|
|
33405
|
-
return ok
|
|
33406
|
-
}
|
|
33407
|
-
|
|
33408
|
-
if (typeof test === 'string') {
|
|
33409
|
-
return typeFactory(test)
|
|
33410
|
-
}
|
|
33411
|
-
|
|
33412
|
-
if (typeof test === 'object') {
|
|
33413
|
-
// @ts-ignore looks like a list of tests / partial test object.
|
|
33414
|
-
return 'length' in test ? anyFactory(test) : propsFactory(test)
|
|
33415
|
-
}
|
|
33416
|
-
|
|
33417
|
-
if (typeof test === 'function') {
|
|
33418
|
-
return castFactory(test)
|
|
33419
|
-
}
|
|
33420
|
-
|
|
33421
|
-
throw new Error('Expected function, string, or object as test')
|
|
33422
|
-
}
|
|
33423
|
-
)
|
|
33424
33237
|
/**
|
|
33425
|
-
* @param {
|
|
33426
|
-
* @
|
|
33238
|
+
* @param {RulePseudo} query
|
|
33239
|
+
* @param {Node} _1
|
|
33240
|
+
* @param {number|null} _2
|
|
33241
|
+
* @param {Parent|null} _3
|
|
33242
|
+
* @param {SelectState} state
|
|
33243
|
+
* @returns {boolean}
|
|
33427
33244
|
*/
|
|
33428
|
-
function
|
|
33429
|
-
|
|
33430
|
-
|
|
33431
|
-
|
|
33245
|
+
function lastChild(query, _1, _2, _3, state) {
|
|
33246
|
+
assertDeep(state, query)
|
|
33247
|
+
return state.nodeIndex === state.nodeCount - 1
|
|
33248
|
+
}
|
|
33432
33249
|
|
|
33433
|
-
|
|
33434
|
-
|
|
33435
|
-
|
|
33250
|
+
/**
|
|
33251
|
+
* @param {RulePseudo} query
|
|
33252
|
+
* @param {Node} _1
|
|
33253
|
+
* @param {number|null} _2
|
|
33254
|
+
* @param {Parent|null} _3
|
|
33255
|
+
* @param {SelectState} state
|
|
33256
|
+
* @returns {boolean}
|
|
33257
|
+
*/
|
|
33258
|
+
function onlyChild(query, _1, _2, _3, state) {
|
|
33259
|
+
assertDeep(state, query)
|
|
33260
|
+
return state.nodeCount === 1
|
|
33261
|
+
}
|
|
33436
33262
|
|
|
33437
|
-
|
|
33263
|
+
/**
|
|
33264
|
+
* @param {RulePseudoNth} query
|
|
33265
|
+
* @param {Node} _1
|
|
33266
|
+
* @param {number|null} _2
|
|
33267
|
+
* @param {Parent|null} _3
|
|
33268
|
+
* @param {SelectState} state
|
|
33269
|
+
* @returns {boolean}
|
|
33270
|
+
*/
|
|
33271
|
+
function nthChild(query, _1, _2, _3, state) {
|
|
33272
|
+
assertDeep(state, query)
|
|
33273
|
+
return query.value(state.nodeIndex)
|
|
33274
|
+
}
|
|
33438
33275
|
|
|
33439
|
-
|
|
33440
|
-
|
|
33441
|
-
|
|
33442
|
-
|
|
33443
|
-
|
|
33444
|
-
|
|
33445
|
-
|
|
33276
|
+
/**
|
|
33277
|
+
* @param {RulePseudoNth} query
|
|
33278
|
+
* @param {Node} _1
|
|
33279
|
+
* @param {number|null} _2
|
|
33280
|
+
* @param {Parent|null} _3
|
|
33281
|
+
* @param {SelectState} state
|
|
33282
|
+
* @returns {boolean}
|
|
33283
|
+
*/
|
|
33284
|
+
function nthLastChild(query, _1, _2, _3, state) {
|
|
33285
|
+
assertDeep(state, query)
|
|
33286
|
+
return query.value(state.nodeCount - state.nodeIndex - 1)
|
|
33287
|
+
}
|
|
33446
33288
|
|
|
33447
|
-
|
|
33448
|
-
|
|
33449
|
-
|
|
33450
|
-
|
|
33289
|
+
/**
|
|
33290
|
+
* @param {RulePseudoNth} query
|
|
33291
|
+
* @param {Node} _1
|
|
33292
|
+
* @param {number|null} _2
|
|
33293
|
+
* @param {Parent|null} _3
|
|
33294
|
+
* @param {SelectState} state
|
|
33295
|
+
* @returns {boolean}
|
|
33296
|
+
*/
|
|
33297
|
+
function nthOfType(query, _1, _2, _3, state) {
|
|
33298
|
+
assertDeep(state, query)
|
|
33299
|
+
return query.value(state.typeIndex)
|
|
33451
33300
|
}
|
|
33452
33301
|
|
|
33453
33302
|
/**
|
|
33454
|
-
*
|
|
33455
|
-
*
|
|
33456
|
-
*
|
|
33457
|
-
* @param {
|
|
33458
|
-
* @
|
|
33303
|
+
* @param {RulePseudoNth} query
|
|
33304
|
+
* @param {Node} _1
|
|
33305
|
+
* @param {number|null} _2
|
|
33306
|
+
* @param {Parent|null} _3
|
|
33307
|
+
* @param {SelectState} state
|
|
33308
|
+
* @returns {boolean}
|
|
33459
33309
|
*/
|
|
33460
|
-
function
|
|
33461
|
-
|
|
33462
|
-
|
|
33463
|
-
/**
|
|
33464
|
-
* @param {Node} node
|
|
33465
|
-
* @returns {boolean}
|
|
33466
|
-
*/
|
|
33467
|
-
function all(node) {
|
|
33468
|
-
/** @type {string} */
|
|
33469
|
-
var key
|
|
33470
|
-
|
|
33471
|
-
for (key in check) {
|
|
33472
|
-
if (node[key] !== check[key]) return
|
|
33473
|
-
}
|
|
33474
|
-
|
|
33475
|
-
return true
|
|
33476
|
-
}
|
|
33310
|
+
function nthLastOfType(query, _1, _2, _3, state) {
|
|
33311
|
+
assertDeep(state, query)
|
|
33312
|
+
return query.value(state.typeCount - 1 - state.typeIndex)
|
|
33477
33313
|
}
|
|
33478
33314
|
|
|
33479
33315
|
/**
|
|
33480
|
-
*
|
|
33481
|
-
*
|
|
33482
|
-
*
|
|
33483
|
-
* @param {
|
|
33484
|
-
* @
|
|
33316
|
+
* @param {RulePseudo} query
|
|
33317
|
+
* @param {Node} _1
|
|
33318
|
+
* @param {number|null} _2
|
|
33319
|
+
* @param {Parent|null} _3
|
|
33320
|
+
* @param {SelectState} state
|
|
33321
|
+
* @returns {boolean}
|
|
33485
33322
|
*/
|
|
33486
|
-
function
|
|
33487
|
-
|
|
33488
|
-
|
|
33489
|
-
/**
|
|
33490
|
-
* @param {Node} node
|
|
33491
|
-
*/
|
|
33492
|
-
function type(node) {
|
|
33493
|
-
return node && node.type === check
|
|
33494
|
-
}
|
|
33323
|
+
function firstOfType(query, _1, _2, _3, state) {
|
|
33324
|
+
assertDeep(state, query)
|
|
33325
|
+
return state.typeIndex === 0
|
|
33495
33326
|
}
|
|
33496
33327
|
|
|
33497
33328
|
/**
|
|
33498
|
-
*
|
|
33499
|
-
*
|
|
33500
|
-
* @param {
|
|
33501
|
-
* @
|
|
33329
|
+
* @param {RulePseudo} query
|
|
33330
|
+
* @param {Node} _1
|
|
33331
|
+
* @param {number|null} _2
|
|
33332
|
+
* @param {Parent|null} _3
|
|
33333
|
+
* @param {SelectState} state
|
|
33334
|
+
* @returns {boolean}
|
|
33502
33335
|
*/
|
|
33503
|
-
function
|
|
33504
|
-
|
|
33336
|
+
function lastOfType(query, _1, _2, _3, state) {
|
|
33337
|
+
assertDeep(state, query)
|
|
33338
|
+
return state.typeIndex === state.typeCount - 1
|
|
33339
|
+
}
|
|
33505
33340
|
|
|
33506
|
-
|
|
33507
|
-
|
|
33508
|
-
|
|
33509
|
-
|
|
33510
|
-
|
|
33511
|
-
|
|
33512
|
-
|
|
33513
|
-
|
|
33341
|
+
/**
|
|
33342
|
+
* @param {RulePseudo} query
|
|
33343
|
+
* @param {Node} _1
|
|
33344
|
+
* @param {number|null} _2
|
|
33345
|
+
* @param {Parent|null} _3
|
|
33346
|
+
* @param {SelectState} state
|
|
33347
|
+
* @returns {boolean}
|
|
33348
|
+
*/
|
|
33349
|
+
function onlyOfType(query, _1, _2, _3, state) {
|
|
33350
|
+
assertDeep(state, query)
|
|
33351
|
+
return state.typeCount === 1
|
|
33514
33352
|
}
|
|
33515
33353
|
|
|
33516
|
-
//
|
|
33517
|
-
|
|
33518
|
-
|
|
33354
|
+
// Shouldn’t be invoked, parser gives correct data.
|
|
33355
|
+
/* c8 ignore next 3 */
|
|
33356
|
+
function invalidPseudo() {
|
|
33357
|
+
throw new Error('Invalid pseudo-selector')
|
|
33519
33358
|
}
|
|
33520
33359
|
|
|
33521
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/pseudo.js
|
|
33522
33360
|
/**
|
|
33523
|
-
* @
|
|
33524
|
-
* @
|
|
33525
|
-
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
33526
|
-
* @typedef {import('./types.js').RulePseudoSelector} RulePseudoSelector
|
|
33527
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
33528
|
-
* @typedef {import('./types.js').Selector} Selector
|
|
33529
|
-
* @typedef {import('./types.js').Selectors} Selectors
|
|
33530
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
33531
|
-
* @typedef {import('./types.js').Node} Node
|
|
33361
|
+
* @param {RulePseudo} query
|
|
33362
|
+
* @returns {boolean}
|
|
33532
33363
|
*/
|
|
33533
|
-
|
|
33534
|
-
|
|
33535
|
-
|
|
33536
|
-
|
|
33537
|
-
|
|
33538
|
-
var pseudo_is = convert()
|
|
33539
|
-
|
|
33540
|
-
var pseudo_handle = zwitch('name', {
|
|
33541
|
-
unknown: unknownPseudo,
|
|
33542
|
-
invalid: invalidPseudo,
|
|
33543
|
-
handlers: {
|
|
33544
|
-
any: matches,
|
|
33545
|
-
blank: empty,
|
|
33546
|
-
empty,
|
|
33547
|
-
'first-child': firstChild,
|
|
33548
|
-
'first-of-type': firstOfType,
|
|
33549
|
-
has: hasSelector,
|
|
33550
|
-
'last-child': lastChild,
|
|
33551
|
-
'last-of-type': lastOfType,
|
|
33552
|
-
matches,
|
|
33553
|
-
not,
|
|
33554
|
-
'nth-child': nthChild,
|
|
33555
|
-
'nth-last-child': nthLastChild,
|
|
33556
|
-
'nth-of-type': nthOfType,
|
|
33557
|
-
'nth-last-of-type': nthLastOfType,
|
|
33558
|
-
'only-child': onlyChild,
|
|
33559
|
-
'only-of-type': onlyOfType,
|
|
33560
|
-
root: pseudo_root,
|
|
33561
|
-
scope
|
|
33364
|
+
function unknownPseudo(query) {
|
|
33365
|
+
if (query.name) {
|
|
33366
|
+
throw new Error('Unknown pseudo-selector `' + query.name + '`')
|
|
33562
33367
|
}
|
|
33563
|
-
})
|
|
33564
33368
|
|
|
33565
|
-
pseudo
|
|
33566
|
-
|
|
33567
|
-
'first-of-type',
|
|
33568
|
-
'last-child',
|
|
33569
|
-
'last-of-type',
|
|
33570
|
-
'nth-child',
|
|
33571
|
-
'nth-last-child',
|
|
33572
|
-
'nth-of-type',
|
|
33573
|
-
'nth-last-of-type',
|
|
33574
|
-
'only-child',
|
|
33575
|
-
'only-of-type'
|
|
33576
|
-
]
|
|
33369
|
+
throw new Error('Unexpected pseudo-element or empty pseudo-class')
|
|
33370
|
+
}
|
|
33577
33371
|
|
|
33578
33372
|
/**
|
|
33579
|
-
* @param {Rule} query
|
|
33580
|
-
* @param {Node} node
|
|
33581
|
-
* @param {number|null} index
|
|
33582
|
-
* @param {Parent|null} parent
|
|
33583
33373
|
* @param {SelectState} state
|
|
33584
|
-
* @
|
|
33374
|
+
* @param {RulePseudo|RulePseudoNth} query
|
|
33585
33375
|
*/
|
|
33586
|
-
function
|
|
33587
|
-
|
|
33588
|
-
|
|
33589
|
-
|
|
33590
|
-
while (++offset < pseudos.length) {
|
|
33591
|
-
if (!pseudo_handle(pseudos[offset], node, index, parent, state)) return false
|
|
33376
|
+
function assertDeep(state, query) {
|
|
33377
|
+
if (state.shallow) {
|
|
33378
|
+
throw new Error('Cannot use `:' + query.name + '` without parent')
|
|
33592
33379
|
}
|
|
33593
|
-
|
|
33594
|
-
return true
|
|
33595
33380
|
}
|
|
33596
33381
|
|
|
33597
33382
|
/**
|
|
@@ -33602,780 +33387,1062 @@ function pseudo(query, node, index, parent, state) {
|
|
|
33602
33387
|
* @param {SelectState} state
|
|
33603
33388
|
* @returns {boolean}
|
|
33604
33389
|
*/
|
|
33605
|
-
function
|
|
33390
|
+
function hasSelector(query, node, _1, _2, state) {
|
|
33606
33391
|
var shallow = state.shallow
|
|
33607
33392
|
var one = state.one
|
|
33393
|
+
var scopeNodes = state.scopeNodes
|
|
33394
|
+
var value = appendScope(query.value)
|
|
33395
|
+
var anything = state.any
|
|
33608
33396
|
/** @type {boolean} */
|
|
33609
33397
|
var result
|
|
33610
33398
|
|
|
33399
|
+
state.shallow = false
|
|
33611
33400
|
state.one = true
|
|
33612
|
-
state.
|
|
33401
|
+
state.scopeNodes = [node]
|
|
33402
|
+
|
|
33403
|
+
result = Boolean(anything(value, node, state)[0])
|
|
33404
|
+
|
|
33405
|
+
state.shallow = shallow
|
|
33406
|
+
state.one = one
|
|
33407
|
+
state.scopeNodes = scopeNodes
|
|
33408
|
+
|
|
33409
|
+
return result
|
|
33410
|
+
}
|
|
33411
|
+
|
|
33412
|
+
/**
|
|
33413
|
+
* @param {Selector} value
|
|
33414
|
+
*/
|
|
33415
|
+
function appendScope(value) {
|
|
33416
|
+
/** @type {Selectors} */
|
|
33417
|
+
var selector =
|
|
33418
|
+
value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
|
|
33419
|
+
var index = -1
|
|
33420
|
+
/** @type {Rule} */
|
|
33421
|
+
var rule
|
|
33422
|
+
|
|
33423
|
+
while (++index < selector.selectors.length) {
|
|
33424
|
+
rule = selector.selectors[index].rule
|
|
33425
|
+
rule.nestingOperator = null
|
|
33426
|
+
|
|
33427
|
+
// Needed if new pseudo’s are added that accepts commas (such as
|
|
33428
|
+
// `:lang(en, nl)`)
|
|
33429
|
+
/* c8 ignore else */
|
|
33430
|
+
if (
|
|
33431
|
+
!rule.pseudos ||
|
|
33432
|
+
rule.pseudos.length !== 1 ||
|
|
33433
|
+
rule.pseudos[0].name !== 'scope'
|
|
33434
|
+
) {
|
|
33435
|
+
selector.selectors[index] = {
|
|
33436
|
+
type: 'ruleSet',
|
|
33437
|
+
rule: {
|
|
33438
|
+
type: 'rule',
|
|
33439
|
+
rule,
|
|
33440
|
+
// @ts-ignore pseudos are fine w/ just a name!
|
|
33441
|
+
pseudos: [{name: 'scope'}]
|
|
33442
|
+
}
|
|
33443
|
+
}
|
|
33444
|
+
}
|
|
33445
|
+
}
|
|
33446
|
+
|
|
33447
|
+
return selector
|
|
33448
|
+
}
|
|
33449
|
+
|
|
33450
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/attribute.js
|
|
33451
|
+
/**
|
|
33452
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33453
|
+
* @typedef {import('./types.js').RuleAttr} RuleAttr
|
|
33454
|
+
* @typedef {import('./types.js').Node} Node
|
|
33455
|
+
*/
|
|
33456
|
+
|
|
33457
|
+
|
|
33458
|
+
|
|
33459
|
+
var attribute_handle = zwitch('operator', {
|
|
33460
|
+
unknown: unknownOperator,
|
|
33461
|
+
invalid: exists,
|
|
33462
|
+
handlers: {
|
|
33463
|
+
'=': exact,
|
|
33464
|
+
'^=': begins,
|
|
33465
|
+
'$=': ends,
|
|
33466
|
+
'*=': containsString,
|
|
33467
|
+
'~=': containsArray
|
|
33468
|
+
}
|
|
33469
|
+
})
|
|
33613
33470
|
|
|
33614
|
-
|
|
33471
|
+
/**
|
|
33472
|
+
* @param {Rule} query
|
|
33473
|
+
* @param {Node} node
|
|
33474
|
+
*/
|
|
33475
|
+
function attribute(query, node) {
|
|
33476
|
+
var index = -1
|
|
33615
33477
|
|
|
33616
|
-
|
|
33617
|
-
|
|
33478
|
+
while (++index < query.attrs.length) {
|
|
33479
|
+
if (!attribute_handle(query.attrs[index], node)) return false
|
|
33480
|
+
}
|
|
33618
33481
|
|
|
33619
|
-
return
|
|
33482
|
+
return true
|
|
33620
33483
|
}
|
|
33621
33484
|
|
|
33622
33485
|
/**
|
|
33623
|
-
*
|
|
33486
|
+
* `[attr]`
|
|
33487
|
+
*
|
|
33488
|
+
* @param {RuleAttr} query
|
|
33624
33489
|
* @param {Node} node
|
|
33625
|
-
* @param {number|null} index
|
|
33626
|
-
* @param {Parent|null} parent
|
|
33627
|
-
* @param {SelectState} state
|
|
33628
|
-
* @returns {boolean}
|
|
33629
33490
|
*/
|
|
33630
|
-
function
|
|
33631
|
-
return
|
|
33491
|
+
function exists(query, node) {
|
|
33492
|
+
return node[query.name] !== null && node[query.name] !== undefined
|
|
33632
33493
|
}
|
|
33633
33494
|
|
|
33634
33495
|
/**
|
|
33635
|
-
*
|
|
33496
|
+
* `[attr=value]`
|
|
33497
|
+
*
|
|
33498
|
+
* @param {RuleAttr} query
|
|
33636
33499
|
* @param {Node} node
|
|
33637
|
-
* @param {number|null} _2
|
|
33638
|
-
* @param {Parent|null} parent
|
|
33639
|
-
* @returns {boolean}
|
|
33640
33500
|
*/
|
|
33641
|
-
function
|
|
33642
|
-
return
|
|
33501
|
+
function exact(query, node) {
|
|
33502
|
+
return exists(query, node) && String(node[query.name]) === query.value
|
|
33643
33503
|
}
|
|
33644
33504
|
|
|
33645
33505
|
/**
|
|
33646
|
-
*
|
|
33506
|
+
* `[attr~=value]`
|
|
33507
|
+
*
|
|
33508
|
+
* @param {RuleAttr} query
|
|
33647
33509
|
* @param {Node} node
|
|
33648
|
-
* @param {number|null} _2
|
|
33649
|
-
* @param {Parent|null} _3
|
|
33650
|
-
* @param {SelectState} state
|
|
33651
|
-
* @returns {boolean}
|
|
33652
33510
|
*/
|
|
33653
|
-
function
|
|
33654
|
-
|
|
33511
|
+
function containsArray(query, node) {
|
|
33512
|
+
var value = node[query.name]
|
|
33513
|
+
|
|
33514
|
+
if (value === null || value === undefined) return false
|
|
33515
|
+
|
|
33516
|
+
// If this is an array, and the query is contained in it, return true.
|
|
33517
|
+
// Coverage comment in place because TS turns `Array.isArray(unknown)`
|
|
33518
|
+
// into `Array.<any>` instead of `Array.<unknown>`.
|
|
33519
|
+
// type-coverage:ignore-next-line
|
|
33520
|
+
if (Array.isArray(value) && value.includes(query.value)) {
|
|
33521
|
+
return true
|
|
33522
|
+
}
|
|
33523
|
+
|
|
33524
|
+
// For all other values, return whether this is an exact match.
|
|
33525
|
+
return String(value) === query.value
|
|
33655
33526
|
}
|
|
33656
33527
|
|
|
33657
33528
|
/**
|
|
33658
|
-
*
|
|
33529
|
+
* `[attr^=value]`
|
|
33530
|
+
*
|
|
33531
|
+
* @param {RuleAttr} query
|
|
33659
33532
|
* @param {Node} node
|
|
33660
|
-
* @returns {boolean}
|
|
33661
33533
|
*/
|
|
33662
|
-
function
|
|
33663
|
-
|
|
33664
|
-
}
|
|
33534
|
+
function begins(query, node) {
|
|
33535
|
+
var value = node[query.name]
|
|
33665
33536
|
|
|
33666
|
-
|
|
33667
|
-
|
|
33668
|
-
|
|
33669
|
-
|
|
33670
|
-
* @param {Parent|null} _3
|
|
33671
|
-
* @param {SelectState} state
|
|
33672
|
-
* @returns {boolean}
|
|
33673
|
-
*/
|
|
33674
|
-
function firstChild(query, _1, _2, _3, state) {
|
|
33675
|
-
assertDeep(state, query)
|
|
33676
|
-
return state.nodeIndex === 0 // Specifically `0`, not falsey.
|
|
33537
|
+
return (
|
|
33538
|
+
typeof value === 'string' &&
|
|
33539
|
+
value.slice(0, query.value.length) === query.value
|
|
33540
|
+
)
|
|
33677
33541
|
}
|
|
33678
33542
|
|
|
33679
33543
|
/**
|
|
33680
|
-
*
|
|
33681
|
-
*
|
|
33682
|
-
* @param {
|
|
33683
|
-
* @param {
|
|
33684
|
-
* @param {SelectState} state
|
|
33685
|
-
* @returns {boolean}
|
|
33544
|
+
* `[attr$=value]`
|
|
33545
|
+
*
|
|
33546
|
+
* @param {RuleAttr} query
|
|
33547
|
+
* @param {Node} node
|
|
33686
33548
|
*/
|
|
33687
|
-
function
|
|
33688
|
-
|
|
33689
|
-
return state.nodeIndex === state.nodeCount - 1
|
|
33690
|
-
}
|
|
33549
|
+
function ends(query, node) {
|
|
33550
|
+
var value = node[query.name]
|
|
33691
33551
|
|
|
33692
|
-
|
|
33693
|
-
|
|
33694
|
-
|
|
33695
|
-
|
|
33696
|
-
* @param {Parent|null} _3
|
|
33697
|
-
* @param {SelectState} state
|
|
33698
|
-
* @returns {boolean}
|
|
33699
|
-
*/
|
|
33700
|
-
function onlyChild(query, _1, _2, _3, state) {
|
|
33701
|
-
assertDeep(state, query)
|
|
33702
|
-
return state.nodeCount === 1
|
|
33552
|
+
return (
|
|
33553
|
+
typeof value === 'string' &&
|
|
33554
|
+
value.slice(-query.value.length) === query.value
|
|
33555
|
+
)
|
|
33703
33556
|
}
|
|
33704
33557
|
|
|
33705
33558
|
/**
|
|
33706
|
-
*
|
|
33707
|
-
*
|
|
33708
|
-
* @param {
|
|
33709
|
-
* @param {
|
|
33710
|
-
* @param {SelectState} state
|
|
33711
|
-
* @returns {boolean}
|
|
33559
|
+
* `[attr*=value]`
|
|
33560
|
+
*
|
|
33561
|
+
* @param {RuleAttr} query
|
|
33562
|
+
* @param {Node} node
|
|
33712
33563
|
*/
|
|
33713
|
-
function
|
|
33714
|
-
|
|
33715
|
-
return query.value
|
|
33564
|
+
function containsString(query, node) {
|
|
33565
|
+
var value = node[query.name]
|
|
33566
|
+
return typeof value === 'string' && value.includes(query.value)
|
|
33716
33567
|
}
|
|
33717
33568
|
|
|
33569
|
+
// Shouldn’t be invoked, Parser throws an error instead.
|
|
33570
|
+
/* c8 ignore next 6 */
|
|
33718
33571
|
/**
|
|
33719
|
-
* @param {
|
|
33720
|
-
* @param {Node} _1
|
|
33721
|
-
* @param {number|null} _2
|
|
33722
|
-
* @param {Parent|null} _3
|
|
33723
|
-
* @param {SelectState} state
|
|
33724
|
-
* @returns {boolean}
|
|
33572
|
+
* @param {{[x: string]: unknown, type: string}} query
|
|
33725
33573
|
*/
|
|
33726
|
-
function
|
|
33727
|
-
|
|
33728
|
-
return query.value(state.nodeCount - state.nodeIndex - 1)
|
|
33574
|
+
function unknownOperator(query) {
|
|
33575
|
+
throw new Error('Unknown operator `' + query.operator + '`')
|
|
33729
33576
|
}
|
|
33730
33577
|
|
|
33578
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
|
|
33731
33579
|
/**
|
|
33732
|
-
* @
|
|
33733
|
-
* @
|
|
33734
|
-
* @param {number|null} _2
|
|
33735
|
-
* @param {Parent|null} _3
|
|
33736
|
-
* @param {SelectState} state
|
|
33737
|
-
* @returns {boolean}
|
|
33580
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33581
|
+
* @typedef {import('./types.js').Node} Node
|
|
33738
33582
|
*/
|
|
33739
|
-
function nthOfType(query, _1, _2, _3, state) {
|
|
33740
|
-
assertDeep(state, query)
|
|
33741
|
-
return query.value(state.typeIndex)
|
|
33742
|
-
}
|
|
33743
33583
|
|
|
33744
33584
|
/**
|
|
33745
|
-
* @param {
|
|
33746
|
-
* @param {Node}
|
|
33747
|
-
* @param {number|null} _2
|
|
33748
|
-
* @param {Parent|null} _3
|
|
33749
|
-
* @param {SelectState} state
|
|
33750
|
-
* @returns {boolean}
|
|
33585
|
+
* @param {Rule} query
|
|
33586
|
+
* @param {Node} node
|
|
33751
33587
|
*/
|
|
33752
|
-
function
|
|
33753
|
-
|
|
33754
|
-
return query.value(state.typeCount - 1 - state.typeIndex)
|
|
33588
|
+
function name_name(query, node) {
|
|
33589
|
+
return query.tagName === '*' || query.tagName === node.type
|
|
33755
33590
|
}
|
|
33756
33591
|
|
|
33592
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
|
|
33757
33593
|
/**
|
|
33758
|
-
* @
|
|
33759
|
-
* @
|
|
33760
|
-
* @
|
|
33761
|
-
* @
|
|
33762
|
-
* @param {SelectState} state
|
|
33763
|
-
* @returns {boolean}
|
|
33594
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33595
|
+
* @typedef {import('./types.js').Node} Node
|
|
33596
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
33597
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
33764
33598
|
*/
|
|
33765
|
-
|
|
33766
|
-
|
|
33767
|
-
|
|
33768
|
-
|
|
33599
|
+
|
|
33600
|
+
|
|
33601
|
+
|
|
33602
|
+
|
|
33769
33603
|
|
|
33770
33604
|
/**
|
|
33771
|
-
* @param {
|
|
33772
|
-
* @param {Node}
|
|
33773
|
-
* @param {number|null}
|
|
33774
|
-
* @param {Parent|null}
|
|
33605
|
+
* @param {Rule} query
|
|
33606
|
+
* @param {Node} node
|
|
33607
|
+
* @param {number|null} index
|
|
33608
|
+
* @param {Parent|null} parent
|
|
33775
33609
|
* @param {SelectState} state
|
|
33776
33610
|
* @returns {boolean}
|
|
33777
33611
|
*/
|
|
33778
|
-
function
|
|
33779
|
-
|
|
33780
|
-
|
|
33612
|
+
function test(query, node, index, parent, state) {
|
|
33613
|
+
if (query.id) throw new Error('Invalid selector: id')
|
|
33614
|
+
if (query.classNames) throw new Error('Invalid selector: class')
|
|
33615
|
+
|
|
33616
|
+
return Boolean(
|
|
33617
|
+
node &&
|
|
33618
|
+
(!query.tagName || name_name(query, node)) &&
|
|
33619
|
+
(!query.attrs || attribute(query, node)) &&
|
|
33620
|
+
(!query.pseudos || pseudo(query, node, index, parent, state))
|
|
33621
|
+
)
|
|
33781
33622
|
}
|
|
33782
33623
|
|
|
33624
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/any.js
|
|
33783
33625
|
/**
|
|
33784
|
-
* @
|
|
33785
|
-
* @
|
|
33786
|
-
* @
|
|
33787
|
-
* @
|
|
33788
|
-
* @
|
|
33789
|
-
* @
|
|
33626
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
33627
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
33628
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33629
|
+
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
33630
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
33631
|
+
* @typedef {import('./types.js').Query} Query
|
|
33632
|
+
* @typedef {import('./types.js').Node} Node
|
|
33633
|
+
* @typedef {import('./types.js').Parent} Parent
|
|
33634
|
+
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
33635
|
+
* @typedef {import('./types.js').SelectState} SelectState
|
|
33790
33636
|
*/
|
|
33791
|
-
function onlyOfType(query, _1, _2, _3, state) {
|
|
33792
|
-
assertDeep(state, query)
|
|
33793
|
-
return state.typeCount === 1
|
|
33794
|
-
}
|
|
33795
33637
|
|
|
33796
|
-
|
|
33797
|
-
|
|
33798
|
-
|
|
33799
|
-
|
|
33638
|
+
|
|
33639
|
+
|
|
33640
|
+
|
|
33641
|
+
|
|
33642
|
+
|
|
33643
|
+
|
|
33644
|
+
var type = zwitch('type', {
|
|
33645
|
+
unknown: unknownType,
|
|
33646
|
+
invalid: invalidType,
|
|
33647
|
+
handlers: {selectors, ruleSet, rule}
|
|
33648
|
+
})
|
|
33649
|
+
|
|
33650
|
+
/**
|
|
33651
|
+
* @param {Selectors|RuleSet|Rule} query
|
|
33652
|
+
* @param {Node} node
|
|
33653
|
+
* @param {SelectState} state
|
|
33654
|
+
*/
|
|
33655
|
+
function any(query, node, state) {
|
|
33656
|
+
// @ts-ignore zwitch types are off.
|
|
33657
|
+
return query && node ? type(query, node, state) : []
|
|
33800
33658
|
}
|
|
33801
33659
|
|
|
33802
33660
|
/**
|
|
33803
|
-
* @param {
|
|
33804
|
-
* @
|
|
33661
|
+
* @param {Selectors} query
|
|
33662
|
+
* @param {Node} node
|
|
33663
|
+
* @param {SelectState} state
|
|
33805
33664
|
*/
|
|
33806
|
-
function
|
|
33807
|
-
|
|
33808
|
-
|
|
33665
|
+
function selectors(query, node, state) {
|
|
33666
|
+
var collect = collector(state.one)
|
|
33667
|
+
var index = -1
|
|
33668
|
+
|
|
33669
|
+
while (++index < query.selectors.length) {
|
|
33670
|
+
collect(ruleSet(query.selectors[index], node, state))
|
|
33809
33671
|
}
|
|
33810
33672
|
|
|
33811
|
-
|
|
33673
|
+
return collect.result
|
|
33812
33674
|
}
|
|
33813
33675
|
|
|
33814
33676
|
/**
|
|
33677
|
+
* @param {RuleSet} query
|
|
33678
|
+
* @param {Node} node
|
|
33815
33679
|
* @param {SelectState} state
|
|
33816
|
-
* @param {RulePseudo|RulePseudoNth} query
|
|
33817
33680
|
*/
|
|
33818
|
-
function
|
|
33819
|
-
|
|
33820
|
-
throw new Error('Cannot use `:' + query.name + '` without parent')
|
|
33821
|
-
}
|
|
33681
|
+
function ruleSet(query, node, state) {
|
|
33682
|
+
return rule(query.rule, node, state)
|
|
33822
33683
|
}
|
|
33823
33684
|
|
|
33824
33685
|
/**
|
|
33825
|
-
* @param {
|
|
33826
|
-
* @param {Node}
|
|
33827
|
-
* @param {number|null} _1
|
|
33828
|
-
* @param {Parent|null} _2
|
|
33686
|
+
* @param {Rule} query
|
|
33687
|
+
* @param {Node} tree
|
|
33829
33688
|
* @param {SelectState} state
|
|
33830
|
-
* @returns {boolean}
|
|
33831
33689
|
*/
|
|
33832
|
-
function
|
|
33833
|
-
var
|
|
33834
|
-
var one = state.one
|
|
33835
|
-
var scopeNodes = state.scopeNodes
|
|
33836
|
-
var value = appendScope(query.value)
|
|
33837
|
-
var anything = state.any
|
|
33838
|
-
/** @type {boolean} */
|
|
33839
|
-
var result
|
|
33690
|
+
function rule(query, tree, state) {
|
|
33691
|
+
var collect = collector(state.one)
|
|
33840
33692
|
|
|
33841
|
-
state.shallow
|
|
33842
|
-
|
|
33843
|
-
|
|
33693
|
+
if (state.shallow && query.rule) {
|
|
33694
|
+
throw new Error('Expected selector without nesting')
|
|
33695
|
+
}
|
|
33844
33696
|
|
|
33845
|
-
|
|
33697
|
+
nest(
|
|
33698
|
+
query,
|
|
33699
|
+
tree,
|
|
33700
|
+
0,
|
|
33701
|
+
null,
|
|
33702
|
+
configure(query, {
|
|
33703
|
+
scopeNodes: root(tree) ? tree.children : [tree],
|
|
33704
|
+
index: false,
|
|
33705
|
+
iterator,
|
|
33706
|
+
one: state.one,
|
|
33707
|
+
shallow: state.shallow,
|
|
33708
|
+
any: state.any
|
|
33709
|
+
})
|
|
33710
|
+
)
|
|
33846
33711
|
|
|
33847
|
-
|
|
33848
|
-
state.one = one
|
|
33849
|
-
state.scopeNodes = scopeNodes
|
|
33712
|
+
return collect.result
|
|
33850
33713
|
|
|
33851
|
-
|
|
33714
|
+
/** @type {SelectIterator} */
|
|
33715
|
+
function iterator(query, node, index, parent, state) {
|
|
33716
|
+
if (test(query, node, index, parent, state)) {
|
|
33717
|
+
if ('rule' in query) {
|
|
33718
|
+
nest(query.rule, node, index, parent, configure(query.rule, state))
|
|
33719
|
+
} else {
|
|
33720
|
+
collect(node)
|
|
33721
|
+
state.found = true
|
|
33722
|
+
}
|
|
33723
|
+
}
|
|
33724
|
+
}
|
|
33852
33725
|
}
|
|
33853
33726
|
|
|
33854
33727
|
/**
|
|
33855
|
-
* @
|
|
33728
|
+
* @template {SelectState} S
|
|
33729
|
+
* @param {Rule} query
|
|
33730
|
+
* @param {S} state
|
|
33731
|
+
* @returns {S}
|
|
33856
33732
|
*/
|
|
33857
|
-
function
|
|
33858
|
-
|
|
33859
|
-
var selector =
|
|
33860
|
-
value.type === 'ruleSet' ? {type: 'selectors', selectors: [value]} : value
|
|
33733
|
+
function configure(query, state) {
|
|
33734
|
+
var pseudos = query.pseudos || []
|
|
33861
33735
|
var index = -1
|
|
33862
|
-
/** @type {Rule} */
|
|
33863
|
-
var rule
|
|
33864
|
-
|
|
33865
|
-
while (++index < selector.selectors.length) {
|
|
33866
|
-
rule = selector.selectors[index].rule
|
|
33867
|
-
rule.nestingOperator = null
|
|
33868
33736
|
|
|
33869
|
-
|
|
33870
|
-
|
|
33871
|
-
|
|
33872
|
-
|
|
33873
|
-
!rule.pseudos ||
|
|
33874
|
-
rule.pseudos.length !== 1 ||
|
|
33875
|
-
rule.pseudos[0].name !== 'scope'
|
|
33876
|
-
) {
|
|
33877
|
-
selector.selectors[index] = {
|
|
33878
|
-
type: 'ruleSet',
|
|
33879
|
-
rule: {
|
|
33880
|
-
type: 'rule',
|
|
33881
|
-
rule,
|
|
33882
|
-
// @ts-ignore pseudos are fine w/ just a name!
|
|
33883
|
-
pseudos: [{name: 'scope'}]
|
|
33884
|
-
}
|
|
33885
|
-
}
|
|
33737
|
+
while (++index < pseudos.length) {
|
|
33738
|
+
if (pseudo.needsIndex.includes(pseudos[index].name)) {
|
|
33739
|
+
state.index = true
|
|
33740
|
+
break
|
|
33886
33741
|
}
|
|
33887
33742
|
}
|
|
33888
33743
|
|
|
33889
|
-
return
|
|
33744
|
+
return state
|
|
33890
33745
|
}
|
|
33891
33746
|
|
|
33892
|
-
|
|
33747
|
+
// Shouldn’t be invoked, all data is handled.
|
|
33748
|
+
/* c8 ignore next 6 */
|
|
33893
33749
|
/**
|
|
33894
|
-
* @
|
|
33895
|
-
* @typedef {import('./types.js').RuleAttr} RuleAttr
|
|
33896
|
-
* @typedef {import('./types.js').Node} Node
|
|
33750
|
+
* @param {{[x: string]: unknown, type: string}} query
|
|
33897
33751
|
*/
|
|
33752
|
+
function unknownType(query) {
|
|
33753
|
+
throw new Error('Unknown type `' + query.type + '`')
|
|
33754
|
+
}
|
|
33898
33755
|
|
|
33899
|
-
|
|
33900
|
-
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
handlers: {
|
|
33905
|
-
'=': exact,
|
|
33906
|
-
'^=': begins,
|
|
33907
|
-
'$=': ends,
|
|
33908
|
-
'*=': containsString,
|
|
33909
|
-
'~=': containsArray
|
|
33910
|
-
}
|
|
33911
|
-
})
|
|
33756
|
+
// Shouldn’t be invoked, parser gives correct data.
|
|
33757
|
+
/* c8 ignore next 3 */
|
|
33758
|
+
function invalidType() {
|
|
33759
|
+
throw new Error('Invalid type')
|
|
33760
|
+
}
|
|
33912
33761
|
|
|
33913
33762
|
/**
|
|
33914
|
-
* @param {
|
|
33915
|
-
* @param {Node} node
|
|
33763
|
+
* @param {boolean} one
|
|
33916
33764
|
*/
|
|
33917
|
-
function
|
|
33918
|
-
|
|
33765
|
+
function collector(one) {
|
|
33766
|
+
/** @type {Array.<Node>} */
|
|
33767
|
+
var result = []
|
|
33768
|
+
/** @type {boolean} */
|
|
33769
|
+
var found
|
|
33919
33770
|
|
|
33920
|
-
|
|
33921
|
-
|
|
33771
|
+
collect.result = result
|
|
33772
|
+
|
|
33773
|
+
return collect
|
|
33774
|
+
|
|
33775
|
+
/**
|
|
33776
|
+
* Append nodes to array, filtering out duplicates.
|
|
33777
|
+
*
|
|
33778
|
+
* @param {Node|Array.<Node>} node
|
|
33779
|
+
*/
|
|
33780
|
+
function collect(node) {
|
|
33781
|
+
var index = -1
|
|
33782
|
+
|
|
33783
|
+
if ('length' in node) {
|
|
33784
|
+
while (++index < node.length) {
|
|
33785
|
+
collectOne(node[index])
|
|
33786
|
+
}
|
|
33787
|
+
} else {
|
|
33788
|
+
collectOne(node)
|
|
33789
|
+
}
|
|
33922
33790
|
}
|
|
33923
33791
|
|
|
33924
|
-
|
|
33925
|
-
}
|
|
33792
|
+
/**
|
|
33793
|
+
* @param {Node} node
|
|
33794
|
+
*/
|
|
33795
|
+
function collectOne(node) {
|
|
33796
|
+
if (one) {
|
|
33797
|
+
/* Shouldn’t happen, safeguards performance problems. */
|
|
33798
|
+
/* c8 ignore next */
|
|
33799
|
+
if (found) throw new Error('Cannot collect multiple nodes')
|
|
33926
33800
|
|
|
33927
|
-
|
|
33928
|
-
|
|
33929
|
-
*
|
|
33930
|
-
* @param {RuleAttr} query
|
|
33931
|
-
* @param {Node} node
|
|
33932
|
-
*/
|
|
33933
|
-
function exists(query, node) {
|
|
33934
|
-
return node[query.name] !== null && node[query.name] !== undefined
|
|
33935
|
-
}
|
|
33801
|
+
found = true
|
|
33802
|
+
}
|
|
33936
33803
|
|
|
33937
|
-
|
|
33938
|
-
|
|
33939
|
-
*
|
|
33940
|
-
* @param {RuleAttr} query
|
|
33941
|
-
* @param {Node} node
|
|
33942
|
-
*/
|
|
33943
|
-
function exact(query, node) {
|
|
33944
|
-
return exists(query, node) && String(node[query.name]) === query.value
|
|
33804
|
+
if (!result.includes(node)) result.push(node)
|
|
33805
|
+
}
|
|
33945
33806
|
}
|
|
33946
33807
|
|
|
33808
|
+
// EXTERNAL MODULE: ./node_modules/css-selector-parser/lib/index.js
|
|
33809
|
+
var lib = __webpack_require__(8079);
|
|
33810
|
+
// EXTERNAL MODULE: ./node_modules/nth-check/lib/index.js
|
|
33811
|
+
var nth_check_lib = __webpack_require__(7540);
|
|
33812
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/parse.js
|
|
33947
33813
|
/**
|
|
33948
|
-
*
|
|
33949
|
-
*
|
|
33950
|
-
* @
|
|
33951
|
-
* @
|
|
33814
|
+
* @typedef {import('./types.js').Selector} Selector
|
|
33815
|
+
* @typedef {import('./types.js').Selectors} Selectors
|
|
33816
|
+
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
33817
|
+
* @typedef {import('./types.js').Rule} Rule
|
|
33818
|
+
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
33819
|
+
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
33952
33820
|
*/
|
|
33953
|
-
function containsArray(query, node) {
|
|
33954
|
-
var value = node[query.name]
|
|
33955
33821
|
|
|
33956
|
-
if (value === null || value === undefined) return false
|
|
33957
33822
|
|
|
33958
|
-
// If this is an array, and the query is contained in it, return true.
|
|
33959
|
-
// Coverage comment in place because TS turns `Array.isArray(unknown)`
|
|
33960
|
-
// into `Array.<any>` instead of `Array.<unknown>`.
|
|
33961
|
-
// type-coverage:ignore-next-line
|
|
33962
|
-
if (Array.isArray(value) && value.includes(query.value)) {
|
|
33963
|
-
return true
|
|
33964
|
-
}
|
|
33965
33823
|
|
|
33966
|
-
|
|
33967
|
-
|
|
33968
|
-
}
|
|
33824
|
+
|
|
33825
|
+
|
|
33826
|
+
/** @type {import('nth-check').default} */
|
|
33827
|
+
// @ts-ignore
|
|
33828
|
+
var nthCheck = nth_check_lib/* default */.ZP
|
|
33829
|
+
|
|
33830
|
+
var nth = new Set([
|
|
33831
|
+
'nth-child',
|
|
33832
|
+
'nth-last-child',
|
|
33833
|
+
'nth-of-type',
|
|
33834
|
+
'nth-last-of-type'
|
|
33835
|
+
])
|
|
33836
|
+
|
|
33837
|
+
var parser = new lib/* CssSelectorParser */.N()
|
|
33838
|
+
|
|
33839
|
+
parser.registerAttrEqualityMods('~', '^', '$', '*')
|
|
33840
|
+
parser.registerSelectorPseudos('any', 'matches', 'not', 'has')
|
|
33841
|
+
parser.registerNestingOperators('>', '+', '~')
|
|
33842
|
+
|
|
33843
|
+
var compile = zwitch('type', {handlers: {selectors: parse_selectors, ruleSet: parse_ruleSet, rule: parse_rule}})
|
|
33969
33844
|
|
|
33970
33845
|
/**
|
|
33971
|
-
*
|
|
33972
|
-
*
|
|
33973
|
-
* @param {RuleAttr} query
|
|
33974
|
-
* @param {Node} node
|
|
33846
|
+
* @param {string} selector
|
|
33847
|
+
* @returns {Selector}
|
|
33975
33848
|
*/
|
|
33976
|
-
function
|
|
33977
|
-
|
|
33849
|
+
function parse(selector) {
|
|
33850
|
+
if (typeof selector !== 'string') {
|
|
33851
|
+
throw new TypeError('Expected `string` as selector, not `' + selector + '`')
|
|
33852
|
+
}
|
|
33978
33853
|
|
|
33979
|
-
|
|
33980
|
-
|
|
33981
|
-
value.slice(0, query.value.length) === query.value
|
|
33982
|
-
)
|
|
33854
|
+
// @ts-ignore types are wrong.
|
|
33855
|
+
return compile(parser.parse(selector))
|
|
33983
33856
|
}
|
|
33984
33857
|
|
|
33985
33858
|
/**
|
|
33986
|
-
*
|
|
33987
|
-
*
|
|
33988
|
-
* @param {RuleAttr} query
|
|
33989
|
-
* @param {Node} node
|
|
33859
|
+
* @param {Selectors} query
|
|
33990
33860
|
*/
|
|
33991
|
-
function
|
|
33992
|
-
var
|
|
33861
|
+
function parse_selectors(query) {
|
|
33862
|
+
var selectors = query.selectors
|
|
33863
|
+
var index = -1
|
|
33993
33864
|
|
|
33994
|
-
|
|
33995
|
-
|
|
33996
|
-
|
|
33997
|
-
)
|
|
33998
|
-
}
|
|
33865
|
+
while (++index < selectors.length) {
|
|
33866
|
+
compile(selectors[index])
|
|
33867
|
+
}
|
|
33999
33868
|
|
|
34000
|
-
|
|
34001
|
-
* `[attr*=value]`
|
|
34002
|
-
*
|
|
34003
|
-
* @param {RuleAttr} query
|
|
34004
|
-
* @param {Node} node
|
|
34005
|
-
*/
|
|
34006
|
-
function containsString(query, node) {
|
|
34007
|
-
var value = node[query.name]
|
|
34008
|
-
return typeof value === 'string' && value.includes(query.value)
|
|
33869
|
+
return query
|
|
34009
33870
|
}
|
|
34010
33871
|
|
|
34011
|
-
// Shouldn’t be invoked, Parser throws an error instead.
|
|
34012
|
-
/* c8 ignore next 6 */
|
|
34013
33872
|
/**
|
|
34014
|
-
* @param {
|
|
33873
|
+
* @param {RuleSet} query
|
|
34015
33874
|
*/
|
|
34016
|
-
function
|
|
34017
|
-
|
|
33875
|
+
function parse_ruleSet(query) {
|
|
33876
|
+
return parse_rule(query.rule)
|
|
34018
33877
|
}
|
|
34019
33878
|
|
|
34020
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/name.js
|
|
34021
|
-
/**
|
|
34022
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34023
|
-
* @typedef {import('./types.js').Node} Node
|
|
34024
|
-
*/
|
|
34025
|
-
|
|
34026
33879
|
/**
|
|
34027
33880
|
* @param {Rule} query
|
|
34028
|
-
* @param {Node} node
|
|
34029
|
-
*/
|
|
34030
|
-
function name_name(query, node) {
|
|
34031
|
-
return query.tagName === '*' || query.tagName === node.type
|
|
34032
|
-
}
|
|
34033
|
-
|
|
34034
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/lib/test.js
|
|
34035
|
-
/**
|
|
34036
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34037
|
-
* @typedef {import('./types.js').Node} Node
|
|
34038
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
34039
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
34040
33881
|
*/
|
|
33882
|
+
function parse_rule(query) {
|
|
33883
|
+
var pseudos = query.pseudos || []
|
|
33884
|
+
var index = -1
|
|
33885
|
+
/** @type {RulePseudo|RulePseudoNth} */
|
|
33886
|
+
var pseudo
|
|
34041
33887
|
|
|
33888
|
+
while (++index < pseudos.length) {
|
|
33889
|
+
pseudo = pseudos[index]
|
|
34042
33890
|
|
|
33891
|
+
if (nth.has(pseudo.name)) {
|
|
33892
|
+
// @ts-ignore Patch a non-primitive type.
|
|
33893
|
+
pseudo.value = nthCheck(pseudo.value)
|
|
33894
|
+
// @ts-ignore Patch a non-primitive type.
|
|
33895
|
+
pseudo.valueType = 'function'
|
|
33896
|
+
}
|
|
33897
|
+
}
|
|
34043
33898
|
|
|
33899
|
+
compile(query.rule)
|
|
34044
33900
|
|
|
34045
|
-
|
|
34046
|
-
/**
|
|
34047
|
-
* @param {Rule} query
|
|
34048
|
-
* @param {Node} node
|
|
34049
|
-
* @param {number|null} index
|
|
34050
|
-
* @param {Parent|null} parent
|
|
34051
|
-
* @param {SelectState} state
|
|
34052
|
-
* @returns {boolean}
|
|
34053
|
-
*/
|
|
34054
|
-
function test(query, node, index, parent, state) {
|
|
34055
|
-
if (query.id) throw new Error('Invalid selector: id')
|
|
34056
|
-
if (query.classNames) throw new Error('Invalid selector: class')
|
|
34057
|
-
|
|
34058
|
-
return Boolean(
|
|
34059
|
-
node &&
|
|
34060
|
-
(!query.tagName || name_name(query, node)) &&
|
|
34061
|
-
(!query.attrs || attribute(query, node)) &&
|
|
34062
|
-
(!query.pseudos || pseudo(query, node, index, parent, state))
|
|
34063
|
-
)
|
|
33901
|
+
return query
|
|
34064
33902
|
}
|
|
34065
33903
|
|
|
34066
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/
|
|
33904
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
|
|
34067
33905
|
/**
|
|
34068
|
-
* @typedef {import('
|
|
34069
|
-
* @typedef {import('./types.js').Selectors} Selectors
|
|
34070
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34071
|
-
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
34072
|
-
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
34073
|
-
* @typedef {import('./types.js').Query} Query
|
|
34074
|
-
* @typedef {import('./types.js').Node} Node
|
|
34075
|
-
* @typedef {import('./types.js').Parent} Parent
|
|
34076
|
-
* @typedef {import('./types.js').SelectIterator} SelectIterator
|
|
34077
|
-
* @typedef {import('./types.js').SelectState} SelectState
|
|
33906
|
+
* @typedef {import('unist').Node} Node
|
|
34078
33907
|
*/
|
|
34079
33908
|
|
|
34080
33909
|
|
|
34081
33910
|
|
|
34082
33911
|
|
|
34083
|
-
|
|
34084
|
-
|
|
34085
|
-
|
|
34086
|
-
var type = zwitch('type', {
|
|
34087
|
-
unknown: unknownType,
|
|
34088
|
-
invalid: invalidType,
|
|
34089
|
-
handlers: {selectors, ruleSet, rule}
|
|
34090
|
-
})
|
|
34091
|
-
|
|
34092
33912
|
/**
|
|
34093
|
-
* @param {
|
|
34094
|
-
* @param {Node} node
|
|
34095
|
-
* @
|
|
33913
|
+
* @param {string} selector
|
|
33914
|
+
* @param {Node} [node]
|
|
33915
|
+
* @returns {boolean}
|
|
34096
33916
|
*/
|
|
34097
|
-
function
|
|
34098
|
-
|
|
34099
|
-
return query && node ? type(query, node, state) : []
|
|
33917
|
+
function unist_util_select_matches(selector, node) {
|
|
33918
|
+
return Boolean(any(parse(selector), node, {one: true, shallow: true, any: any})[0])
|
|
34100
33919
|
}
|
|
34101
33920
|
|
|
34102
33921
|
/**
|
|
34103
|
-
* @param {
|
|
34104
|
-
* @param {Node} node
|
|
34105
|
-
* @
|
|
33922
|
+
* @param {string} selector
|
|
33923
|
+
* @param {Node} [node]
|
|
33924
|
+
* @returns {Node|null}
|
|
34106
33925
|
*/
|
|
34107
|
-
function
|
|
34108
|
-
|
|
34109
|
-
var index = -1
|
|
34110
|
-
|
|
34111
|
-
while (++index < query.selectors.length) {
|
|
34112
|
-
collect(ruleSet(query.selectors[index], node, state))
|
|
34113
|
-
}
|
|
34114
|
-
|
|
34115
|
-
return collect.result
|
|
33926
|
+
function unist_util_select_select(selector, node) {
|
|
33927
|
+
return any(parse(selector), node, {one: true, any: any})[0] || null
|
|
34116
33928
|
}
|
|
34117
33929
|
|
|
34118
33930
|
/**
|
|
34119
|
-
* @param {
|
|
34120
|
-
* @param {Node} node
|
|
34121
|
-
* @
|
|
33931
|
+
* @param {string} selector
|
|
33932
|
+
* @param {Node} [node]
|
|
33933
|
+
* @returns {Array.<Node>}
|
|
34122
33934
|
*/
|
|
34123
|
-
function
|
|
34124
|
-
return
|
|
33935
|
+
function selectAll(selector, node) {
|
|
33936
|
+
return any(parse(selector), node, {any: any})
|
|
34125
33937
|
}
|
|
34126
33938
|
|
|
33939
|
+
|
|
33940
|
+
/***/ }),
|
|
33941
|
+
|
|
33942
|
+
/***/ 6393:
|
|
33943
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
33944
|
+
|
|
33945
|
+
"use strict";
|
|
33946
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
33947
|
+
/* harmony export */ "Vn": () => (/* binding */ visit)
|
|
33948
|
+
/* harmony export */ });
|
|
33949
|
+
/* harmony import */ var unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5605);
|
|
34127
33950
|
/**
|
|
34128
|
-
* @
|
|
34129
|
-
* @
|
|
34130
|
-
* @
|
|
33951
|
+
* @typedef {import('unist').Node} Node
|
|
33952
|
+
* @typedef {import('unist').Parent} Parent
|
|
33953
|
+
* @typedef {import('unist-util-is').Test} Test
|
|
33954
|
+
* @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult
|
|
33955
|
+
* @typedef {import('./complex-types.js').Visitor} Visitor
|
|
34131
33956
|
*/
|
|
34132
|
-
function rule(query, tree, state) {
|
|
34133
|
-
var collect = collector(state.one)
|
|
34134
33957
|
|
|
34135
|
-
if (state.shallow && query.rule) {
|
|
34136
|
-
throw new Error('Expected selector without nesting')
|
|
34137
|
-
}
|
|
34138
33958
|
|
|
34139
|
-
nest(
|
|
34140
|
-
query,
|
|
34141
|
-
tree,
|
|
34142
|
-
0,
|
|
34143
|
-
null,
|
|
34144
|
-
configure(query, {
|
|
34145
|
-
scopeNodes: root(tree) ? tree.children : [tree],
|
|
34146
|
-
index: false,
|
|
34147
|
-
iterator,
|
|
34148
|
-
one: state.one,
|
|
34149
|
-
shallow: state.shallow,
|
|
34150
|
-
any: state.any
|
|
34151
|
-
})
|
|
34152
|
-
)
|
|
34153
33959
|
|
|
34154
|
-
|
|
33960
|
+
/**
|
|
33961
|
+
* Visit children of tree which pass test.
|
|
33962
|
+
*
|
|
33963
|
+
* @param tree
|
|
33964
|
+
* Tree to walk
|
|
33965
|
+
* @param [test]
|
|
33966
|
+
* `unist-util-is`-compatible test
|
|
33967
|
+
* @param visitor
|
|
33968
|
+
* Function called for nodes that pass `test`.
|
|
33969
|
+
* @param reverse
|
|
33970
|
+
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
33971
|
+
*/
|
|
33972
|
+
const visit =
|
|
33973
|
+
/**
|
|
33974
|
+
* @type {(
|
|
33975
|
+
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
33976
|
+
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
33977
|
+
* )}
|
|
33978
|
+
*/
|
|
33979
|
+
(
|
|
33980
|
+
/**
|
|
33981
|
+
* @param {Node} tree
|
|
33982
|
+
* @param {Test} test
|
|
33983
|
+
* @param {import('./complex-types.js').Visitor} visitor
|
|
33984
|
+
* @param {boolean} [reverse]
|
|
33985
|
+
*/
|
|
33986
|
+
function (tree, test, visitor, reverse) {
|
|
33987
|
+
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
33988
|
+
reverse = visitor
|
|
33989
|
+
visitor = test
|
|
33990
|
+
test = null
|
|
33991
|
+
}
|
|
34155
33992
|
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
|
|
34162
|
-
|
|
34163
|
-
|
|
33993
|
+
(0,unist_util_visit_parents__WEBPACK_IMPORTED_MODULE_0__/* .visitParents */ .S4)(tree, test, overload, reverse)
|
|
33994
|
+
|
|
33995
|
+
/**
|
|
33996
|
+
* @param {Node} node
|
|
33997
|
+
* @param {Array<Parent>} parents
|
|
33998
|
+
*/
|
|
33999
|
+
function overload(node, parents) {
|
|
34000
|
+
const parent = parents[parents.length - 1]
|
|
34001
|
+
return visitor(
|
|
34002
|
+
node,
|
|
34003
|
+
parent ? parent.children.indexOf(node) : null,
|
|
34004
|
+
parent
|
|
34005
|
+
)
|
|
34164
34006
|
}
|
|
34165
34007
|
}
|
|
34166
|
-
|
|
34167
|
-
}
|
|
34008
|
+
)
|
|
34168
34009
|
|
|
34169
|
-
/**
|
|
34170
|
-
* @template {SelectState} S
|
|
34171
|
-
* @param {Rule} query
|
|
34172
|
-
* @param {S} state
|
|
34173
|
-
* @returns {S}
|
|
34174
|
-
*/
|
|
34175
|
-
function configure(query, state) {
|
|
34176
|
-
var pseudos = query.pseudos || []
|
|
34177
|
-
var index = -1
|
|
34178
34010
|
|
|
34179
|
-
while (++index < pseudos.length) {
|
|
34180
|
-
if (pseudo.needsIndex.includes(pseudos[index].name)) {
|
|
34181
|
-
state.index = true
|
|
34182
|
-
break
|
|
34183
|
-
}
|
|
34184
|
-
}
|
|
34185
34011
|
|
|
34186
|
-
return state
|
|
34187
|
-
}
|
|
34188
34012
|
|
|
34189
|
-
|
|
34190
|
-
|
|
34013
|
+
/***/ }),
|
|
34014
|
+
|
|
34015
|
+
/***/ 5605:
|
|
34016
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
34017
|
+
|
|
34018
|
+
"use strict";
|
|
34019
|
+
|
|
34020
|
+
// EXPORTS
|
|
34021
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
34022
|
+
"AM": () => (/* binding */ SKIP),
|
|
34023
|
+
"S4": () => (/* binding */ visitParents)
|
|
34024
|
+
});
|
|
34025
|
+
|
|
34026
|
+
// UNUSED EXPORTS: CONTINUE, EXIT
|
|
34027
|
+
|
|
34028
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-is/index.js
|
|
34191
34029
|
/**
|
|
34192
|
-
* @
|
|
34030
|
+
* @typedef {import('unist').Node} Node
|
|
34031
|
+
* @typedef {import('unist').Parent} Parent
|
|
34032
|
+
*
|
|
34033
|
+
* @typedef {string} Type
|
|
34034
|
+
* @typedef {Object<string, unknown>} Props
|
|
34035
|
+
*
|
|
34036
|
+
* @typedef {null|undefined|Type|Props|TestFunctionAnything|Array.<Type|Props|TestFunctionAnything>} Test
|
|
34193
34037
|
*/
|
|
34194
|
-
function unknownType(query) {
|
|
34195
|
-
throw new Error('Unknown type `' + query.type + '`')
|
|
34196
|
-
}
|
|
34197
34038
|
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
|
|
34202
|
-
}
|
|
34039
|
+
/**
|
|
34040
|
+
* Check if a node passes a test
|
|
34041
|
+
*
|
|
34042
|
+
* @callback TestFunctionAnything
|
|
34043
|
+
* @param {Node} node
|
|
34044
|
+
* @param {number|null|undefined} [index]
|
|
34045
|
+
* @param {Parent|null|undefined} [parent]
|
|
34046
|
+
* @returns {boolean|void}
|
|
34047
|
+
*/
|
|
34203
34048
|
|
|
34204
34049
|
/**
|
|
34205
|
-
*
|
|
34050
|
+
* Check if a node passes a certain node test
|
|
34051
|
+
*
|
|
34052
|
+
* @template {Node} X
|
|
34053
|
+
* @callback TestFunctionPredicate
|
|
34054
|
+
* @param {Node} node
|
|
34055
|
+
* @param {number|null|undefined} [index]
|
|
34056
|
+
* @param {Parent|null|undefined} [parent]
|
|
34057
|
+
* @returns {node is X}
|
|
34206
34058
|
*/
|
|
34207
|
-
function collector(one) {
|
|
34208
|
-
/** @type {Array.<Node>} */
|
|
34209
|
-
var result = []
|
|
34210
|
-
/** @type {boolean} */
|
|
34211
|
-
var found
|
|
34212
34059
|
|
|
34213
|
-
|
|
34060
|
+
/**
|
|
34061
|
+
* @callback AssertAnything
|
|
34062
|
+
* @param {unknown} [node]
|
|
34063
|
+
* @param {number|null|undefined} [index]
|
|
34064
|
+
* @param {Parent|null|undefined} [parent]
|
|
34065
|
+
* @returns {boolean}
|
|
34066
|
+
*/
|
|
34214
34067
|
|
|
34215
|
-
|
|
34068
|
+
/**
|
|
34069
|
+
* Check if a node passes a certain node test
|
|
34070
|
+
*
|
|
34071
|
+
* @template {Node} Y
|
|
34072
|
+
* @callback AssertPredicate
|
|
34073
|
+
* @param {unknown} [node]
|
|
34074
|
+
* @param {number|null|undefined} [index]
|
|
34075
|
+
* @param {Parent|null|undefined} [parent]
|
|
34076
|
+
* @returns {node is Y}
|
|
34077
|
+
*/
|
|
34216
34078
|
|
|
34079
|
+
const is =
|
|
34217
34080
|
/**
|
|
34218
|
-
*
|
|
34081
|
+
* Check if a node passes a test.
|
|
34082
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
34219
34083
|
*
|
|
34220
|
-
* @
|
|
34084
|
+
* @type {(
|
|
34085
|
+
* (<T extends Node>(node: unknown, test: T['type']|Partial<T>|TestFunctionPredicate<T>|Array.<T['type']|Partial<T>|TestFunctionPredicate<T>>, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => node is T) &
|
|
34086
|
+
* ((node?: unknown, test?: Test, index?: number|null|undefined, parent?: Parent|null|undefined, context?: unknown) => boolean)
|
|
34087
|
+
* )}
|
|
34221
34088
|
*/
|
|
34222
|
-
|
|
34223
|
-
|
|
34089
|
+
(
|
|
34090
|
+
/**
|
|
34091
|
+
* Check if a node passes a test.
|
|
34092
|
+
* When a `parent` node is known the `index` of node should also be given.
|
|
34093
|
+
*
|
|
34094
|
+
* @param {unknown} [node] Node to check
|
|
34095
|
+
* @param {Test} [test]
|
|
34096
|
+
* When nullish, checks if `node` is a `Node`.
|
|
34097
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
34098
|
+
* When `function` checks if function passed the node is true.
|
|
34099
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
34100
|
+
* When `array`, checks any one of the subtests pass.
|
|
34101
|
+
* @param {number|null|undefined} [index] Position of `node` in `parent`
|
|
34102
|
+
* @param {Parent|null|undefined} [parent] Parent of `node`
|
|
34103
|
+
* @param {unknown} [context] Context object to invoke `test` with
|
|
34104
|
+
* @returns {boolean} Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
|
|
34105
|
+
*/
|
|
34106
|
+
// eslint-disable-next-line max-params
|
|
34107
|
+
function is(node, test, index, parent, context) {
|
|
34108
|
+
const check = convert(test)
|
|
34224
34109
|
|
|
34225
|
-
|
|
34226
|
-
|
|
34227
|
-
|
|
34110
|
+
if (
|
|
34111
|
+
index !== undefined &&
|
|
34112
|
+
index !== null &&
|
|
34113
|
+
(typeof index !== 'number' ||
|
|
34114
|
+
index < 0 ||
|
|
34115
|
+
index === Number.POSITIVE_INFINITY)
|
|
34116
|
+
) {
|
|
34117
|
+
throw new Error('Expected positive finite index')
|
|
34228
34118
|
}
|
|
34229
|
-
|
|
34230
|
-
|
|
34119
|
+
|
|
34120
|
+
if (
|
|
34121
|
+
parent !== undefined &&
|
|
34122
|
+
parent !== null &&
|
|
34123
|
+
(!is(parent) || !parent.children)
|
|
34124
|
+
) {
|
|
34125
|
+
throw new Error('Expected parent node')
|
|
34126
|
+
}
|
|
34127
|
+
|
|
34128
|
+
if (
|
|
34129
|
+
(parent === undefined || parent === null) !==
|
|
34130
|
+
(index === undefined || index === null)
|
|
34131
|
+
) {
|
|
34132
|
+
throw new Error('Expected both parent and index')
|
|
34133
|
+
}
|
|
34134
|
+
|
|
34135
|
+
// @ts-expect-error Looks like a node.
|
|
34136
|
+
return node && node.type && typeof node.type === 'string'
|
|
34137
|
+
? Boolean(check.call(context, node, index, parent))
|
|
34138
|
+
: false
|
|
34231
34139
|
}
|
|
34232
|
-
|
|
34140
|
+
)
|
|
34233
34141
|
|
|
34142
|
+
const convert =
|
|
34234
34143
|
/**
|
|
34235
|
-
* @
|
|
34144
|
+
* @type {(
|
|
34145
|
+
* (<T extends Node>(test: T['type']|Partial<T>|TestFunctionPredicate<T>) => AssertPredicate<T>) &
|
|
34146
|
+
* ((test?: Test) => AssertAnything)
|
|
34147
|
+
* )}
|
|
34236
34148
|
*/
|
|
34237
|
-
|
|
34238
|
-
|
|
34239
|
-
|
|
34240
|
-
|
|
34241
|
-
|
|
34149
|
+
(
|
|
34150
|
+
/**
|
|
34151
|
+
* Generate an assertion from a check.
|
|
34152
|
+
* @param {Test} [test]
|
|
34153
|
+
* When nullish, checks if `node` is a `Node`.
|
|
34154
|
+
* When `string`, works like passing `function (node) {return node.type === test}`.
|
|
34155
|
+
* When `function` checks if function passed the node is true.
|
|
34156
|
+
* When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
|
|
34157
|
+
* When `array`, checks any one of the subtests pass.
|
|
34158
|
+
* @returns {AssertAnything}
|
|
34159
|
+
*/
|
|
34160
|
+
function (test) {
|
|
34161
|
+
if (test === undefined || test === null) {
|
|
34162
|
+
return ok
|
|
34163
|
+
}
|
|
34242
34164
|
|
|
34243
|
-
|
|
34244
|
-
|
|
34165
|
+
if (typeof test === 'string') {
|
|
34166
|
+
return typeFactory(test)
|
|
34167
|
+
}
|
|
34245
34168
|
|
|
34246
|
-
|
|
34247
|
-
|
|
34248
|
-
}
|
|
34169
|
+
if (typeof test === 'object') {
|
|
34170
|
+
return Array.isArray(test) ? anyFactory(test) : propsFactory(test)
|
|
34171
|
+
}
|
|
34249
34172
|
|
|
34250
|
-
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
|
|
34173
|
+
if (typeof test === 'function') {
|
|
34174
|
+
return castFactory(test)
|
|
34175
|
+
}
|
|
34176
|
+
|
|
34177
|
+
throw new Error('Expected function, string, or object as test')
|
|
34178
|
+
}
|
|
34179
|
+
)
|
|
34255
34180
|
/**
|
|
34256
|
-
* @
|
|
34257
|
-
* @
|
|
34258
|
-
* @typedef {import('./types.js').RuleSet} RuleSet
|
|
34259
|
-
* @typedef {import('./types.js').Rule} Rule
|
|
34260
|
-
* @typedef {import('./types.js').RulePseudo} RulePseudo
|
|
34261
|
-
* @typedef {import('./types.js').RulePseudoNth} RulePseudoNth
|
|
34181
|
+
* @param {Array.<Type|Props|TestFunctionAnything>} tests
|
|
34182
|
+
* @returns {AssertAnything}
|
|
34262
34183
|
*/
|
|
34184
|
+
function anyFactory(tests) {
|
|
34185
|
+
/** @type {Array.<AssertAnything>} */
|
|
34186
|
+
const checks = []
|
|
34187
|
+
let index = -1
|
|
34263
34188
|
|
|
34189
|
+
while (++index < tests.length) {
|
|
34190
|
+
checks[index] = convert(tests[index])
|
|
34191
|
+
}
|
|
34264
34192
|
|
|
34193
|
+
return castFactory(any)
|
|
34265
34194
|
|
|
34195
|
+
/**
|
|
34196
|
+
* @this {unknown}
|
|
34197
|
+
* @param {unknown[]} parameters
|
|
34198
|
+
* @returns {boolean}
|
|
34199
|
+
*/
|
|
34200
|
+
function any(...parameters) {
|
|
34201
|
+
let index = -1
|
|
34266
34202
|
|
|
34203
|
+
while (++index < checks.length) {
|
|
34204
|
+
if (checks[index].call(this, ...parameters)) return true
|
|
34205
|
+
}
|
|
34267
34206
|
|
|
34268
|
-
|
|
34269
|
-
|
|
34270
|
-
|
|
34207
|
+
return false
|
|
34208
|
+
}
|
|
34209
|
+
}
|
|
34271
34210
|
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
|
|
34211
|
+
/**
|
|
34212
|
+
* Utility to assert each property in `test` is represented in `node`, and each
|
|
34213
|
+
* values are strictly equal.
|
|
34214
|
+
*
|
|
34215
|
+
* @param {Props} check
|
|
34216
|
+
* @returns {AssertAnything}
|
|
34217
|
+
*/
|
|
34218
|
+
function propsFactory(check) {
|
|
34219
|
+
return castFactory(all)
|
|
34278
34220
|
|
|
34279
|
-
|
|
34221
|
+
/**
|
|
34222
|
+
* @param {Node} node
|
|
34223
|
+
* @returns {boolean}
|
|
34224
|
+
*/
|
|
34225
|
+
function all(node) {
|
|
34226
|
+
/** @type {string} */
|
|
34227
|
+
let key
|
|
34280
34228
|
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
|
|
34229
|
+
for (key in check) {
|
|
34230
|
+
// @ts-expect-error: hush, it sure works as an index.
|
|
34231
|
+
if (node[key] !== check[key]) return false
|
|
34232
|
+
}
|
|
34284
34233
|
|
|
34285
|
-
|
|
34234
|
+
return true
|
|
34235
|
+
}
|
|
34236
|
+
}
|
|
34286
34237
|
|
|
34287
34238
|
/**
|
|
34288
|
-
*
|
|
34289
|
-
*
|
|
34239
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
34240
|
+
* for said string.
|
|
34241
|
+
*
|
|
34242
|
+
* @param {Type} check
|
|
34243
|
+
* @returns {AssertAnything}
|
|
34290
34244
|
*/
|
|
34291
|
-
function
|
|
34292
|
-
|
|
34293
|
-
throw new TypeError('Expected `string` as selector, not `' + selector + '`')
|
|
34294
|
-
}
|
|
34245
|
+
function typeFactory(check) {
|
|
34246
|
+
return castFactory(type)
|
|
34295
34247
|
|
|
34296
|
-
|
|
34297
|
-
|
|
34248
|
+
/**
|
|
34249
|
+
* @param {Node} node
|
|
34250
|
+
*/
|
|
34251
|
+
function type(node) {
|
|
34252
|
+
return node && node.type === check
|
|
34253
|
+
}
|
|
34298
34254
|
}
|
|
34299
34255
|
|
|
34300
34256
|
/**
|
|
34301
|
-
*
|
|
34257
|
+
* Utility to convert a string into a function which checks a given node’s type
|
|
34258
|
+
* for said string.
|
|
34259
|
+
* @param {TestFunctionAnything} check
|
|
34260
|
+
* @returns {AssertAnything}
|
|
34302
34261
|
*/
|
|
34303
|
-
function
|
|
34304
|
-
|
|
34305
|
-
var index = -1
|
|
34262
|
+
function castFactory(check) {
|
|
34263
|
+
return assertion
|
|
34306
34264
|
|
|
34307
|
-
|
|
34308
|
-
|
|
34265
|
+
/**
|
|
34266
|
+
* @this {unknown}
|
|
34267
|
+
* @param {Array.<unknown>} parameters
|
|
34268
|
+
* @returns {boolean}
|
|
34269
|
+
*/
|
|
34270
|
+
function assertion(...parameters) {
|
|
34271
|
+
// @ts-expect-error: spreading is fine.
|
|
34272
|
+
return Boolean(check.call(this, ...parameters))
|
|
34309
34273
|
}
|
|
34274
|
+
}
|
|
34310
34275
|
|
|
34311
|
-
|
|
34276
|
+
// Utility to return true.
|
|
34277
|
+
function ok() {
|
|
34278
|
+
return true
|
|
34312
34279
|
}
|
|
34313
34280
|
|
|
34281
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/color.browser.js
|
|
34314
34282
|
/**
|
|
34315
|
-
* @param {
|
|
34283
|
+
* @param {string} d
|
|
34284
|
+
* @returns {string}
|
|
34316
34285
|
*/
|
|
34317
|
-
function
|
|
34318
|
-
return
|
|
34286
|
+
function color(d) {
|
|
34287
|
+
return d
|
|
34319
34288
|
}
|
|
34320
34289
|
|
|
34290
|
+
;// CONCATENATED MODULE: ./node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
|
|
34321
34291
|
/**
|
|
34322
|
-
* @
|
|
34292
|
+
* @typedef {import('unist').Node} Node
|
|
34293
|
+
* @typedef {import('unist').Parent} Parent
|
|
34294
|
+
* @typedef {import('unist-util-is').Test} Test
|
|
34295
|
+
* @typedef {import('./complex-types.js').Action} Action
|
|
34296
|
+
* @typedef {import('./complex-types.js').Index} Index
|
|
34297
|
+
* @typedef {import('./complex-types.js').ActionTuple} ActionTuple
|
|
34298
|
+
* @typedef {import('./complex-types.js').VisitorResult} VisitorResult
|
|
34299
|
+
* @typedef {import('./complex-types.js').Visitor} Visitor
|
|
34323
34300
|
*/
|
|
34324
|
-
function parse_rule(query) {
|
|
34325
|
-
var pseudos = query.pseudos || []
|
|
34326
|
-
var index = -1
|
|
34327
|
-
/** @type {RulePseudo|RulePseudoNth} */
|
|
34328
|
-
var pseudo
|
|
34329
34301
|
|
|
34330
|
-
while (++index < pseudos.length) {
|
|
34331
|
-
pseudo = pseudos[index]
|
|
34332
34302
|
|
|
34333
|
-
if (nth.has(pseudo.name)) {
|
|
34334
|
-
// @ts-ignore Patch a non-primitive type.
|
|
34335
|
-
pseudo.value = nthCheck(pseudo.value)
|
|
34336
|
-
// @ts-ignore Patch a non-primitive type.
|
|
34337
|
-
pseudo.valueType = 'function'
|
|
34338
|
-
}
|
|
34339
|
-
}
|
|
34340
34303
|
|
|
34341
|
-
compile(query.rule)
|
|
34342
34304
|
|
|
34343
|
-
|
|
34344
|
-
|
|
34305
|
+
/**
|
|
34306
|
+
* Continue traversing as normal
|
|
34307
|
+
*/
|
|
34308
|
+
const CONTINUE = true
|
|
34309
|
+
/**
|
|
34310
|
+
* Do not traverse this node’s children
|
|
34311
|
+
*/
|
|
34312
|
+
const SKIP = 'skip'
|
|
34313
|
+
/**
|
|
34314
|
+
* Stop traversing immediately
|
|
34315
|
+
*/
|
|
34316
|
+
const EXIT = false
|
|
34345
34317
|
|
|
34346
|
-
;// CONCATENATED MODULE: ./node_modules/unist-util-select/index.js
|
|
34347
34318
|
/**
|
|
34348
|
-
*
|
|
34319
|
+
* Visit children of tree which pass test.
|
|
34320
|
+
*
|
|
34321
|
+
* @param tree
|
|
34322
|
+
* Tree to walk
|
|
34323
|
+
* @param [test]
|
|
34324
|
+
* `unist-util-is`-compatible test
|
|
34325
|
+
* @param visitor
|
|
34326
|
+
* Function called for nodes that pass `test`.
|
|
34327
|
+
* @param [reverse=false]
|
|
34328
|
+
* Traverse in reverse preorder (NRL) instead of preorder (NLR) (default).
|
|
34349
34329
|
*/
|
|
34330
|
+
const visitParents =
|
|
34331
|
+
/**
|
|
34332
|
+
* @type {(
|
|
34333
|
+
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: import('./complex-types.js').BuildVisitor<Tree, Check>, reverse?: boolean) => void) &
|
|
34334
|
+
* (<Tree extends Node>(tree: Tree, visitor: import('./complex-types.js').BuildVisitor<Tree>, reverse?: boolean) => void)
|
|
34335
|
+
* )}
|
|
34336
|
+
*/
|
|
34337
|
+
(
|
|
34338
|
+
/**
|
|
34339
|
+
* @param {Node} tree
|
|
34340
|
+
* @param {Test} test
|
|
34341
|
+
* @param {import('./complex-types.js').Visitor<Node>} visitor
|
|
34342
|
+
* @param {boolean} [reverse=false]
|
|
34343
|
+
*/
|
|
34344
|
+
function (tree, test, visitor, reverse) {
|
|
34345
|
+
if (typeof test === 'function' && typeof visitor !== 'function') {
|
|
34346
|
+
reverse = visitor
|
|
34347
|
+
// @ts-expect-error no visitor given, so `visitor` is test.
|
|
34348
|
+
visitor = test
|
|
34349
|
+
test = null
|
|
34350
|
+
}
|
|
34350
34351
|
|
|
34352
|
+
const is = convert(test)
|
|
34353
|
+
const step = reverse ? -1 : 1
|
|
34351
34354
|
|
|
34355
|
+
factory(tree, null, [])()
|
|
34352
34356
|
|
|
34357
|
+
/**
|
|
34358
|
+
* @param {Node} node
|
|
34359
|
+
* @param {number?} index
|
|
34360
|
+
* @param {Array<Parent>} parents
|
|
34361
|
+
*/
|
|
34362
|
+
function factory(node, index, parents) {
|
|
34363
|
+
/** @type {Record<string, unknown>} */
|
|
34364
|
+
// @ts-expect-error: hush
|
|
34365
|
+
const value = typeof node === 'object' && node !== null ? node : {}
|
|
34366
|
+
/** @type {string|undefined} */
|
|
34367
|
+
let name
|
|
34353
34368
|
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
34359
|
-
|
|
34360
|
-
|
|
34361
|
-
}
|
|
34369
|
+
if (typeof value.type === 'string') {
|
|
34370
|
+
name =
|
|
34371
|
+
typeof value.tagName === 'string'
|
|
34372
|
+
? value.tagName
|
|
34373
|
+
: typeof value.name === 'string'
|
|
34374
|
+
? value.name
|
|
34375
|
+
: undefined
|
|
34362
34376
|
|
|
34363
|
-
|
|
34364
|
-
|
|
34365
|
-
|
|
34366
|
-
|
|
34367
|
-
|
|
34368
|
-
|
|
34369
|
-
|
|
34370
|
-
|
|
34377
|
+
Object.defineProperty(visit, 'name', {
|
|
34378
|
+
value:
|
|
34379
|
+
'node (' +
|
|
34380
|
+
color(value.type + (name ? '<' + name + '>' : '')) +
|
|
34381
|
+
')'
|
|
34382
|
+
})
|
|
34383
|
+
}
|
|
34384
|
+
|
|
34385
|
+
return visit
|
|
34386
|
+
|
|
34387
|
+
function visit() {
|
|
34388
|
+
/** @type {ActionTuple} */
|
|
34389
|
+
let result = []
|
|
34390
|
+
/** @type {ActionTuple} */
|
|
34391
|
+
let subresult
|
|
34392
|
+
/** @type {number} */
|
|
34393
|
+
let offset
|
|
34394
|
+
/** @type {Array<Parent>} */
|
|
34395
|
+
let grandparents
|
|
34396
|
+
|
|
34397
|
+
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
|
34398
|
+
result = toResult(visitor(node, parents))
|
|
34399
|
+
|
|
34400
|
+
if (result[0] === EXIT) {
|
|
34401
|
+
return result
|
|
34402
|
+
}
|
|
34403
|
+
}
|
|
34404
|
+
|
|
34405
|
+
// @ts-expect-error looks like a parent.
|
|
34406
|
+
if (node.children && result[0] !== SKIP) {
|
|
34407
|
+
// @ts-expect-error looks like a parent.
|
|
34408
|
+
offset = (reverse ? node.children.length : -1) + step
|
|
34409
|
+
// @ts-expect-error looks like a parent.
|
|
34410
|
+
grandparents = parents.concat(node)
|
|
34411
|
+
|
|
34412
|
+
// @ts-expect-error looks like a parent.
|
|
34413
|
+
while (offset > -1 && offset < node.children.length) {
|
|
34414
|
+
// @ts-expect-error looks like a parent.
|
|
34415
|
+
subresult = factory(node.children[offset], offset, grandparents)()
|
|
34416
|
+
|
|
34417
|
+
if (subresult[0] === EXIT) {
|
|
34418
|
+
return subresult
|
|
34419
|
+
}
|
|
34420
|
+
|
|
34421
|
+
offset =
|
|
34422
|
+
typeof subresult[1] === 'number' ? subresult[1] : offset + step
|
|
34423
|
+
}
|
|
34424
|
+
}
|
|
34425
|
+
|
|
34426
|
+
return result
|
|
34427
|
+
}
|
|
34428
|
+
}
|
|
34429
|
+
}
|
|
34430
|
+
)
|
|
34371
34431
|
|
|
34372
34432
|
/**
|
|
34373
|
-
* @param {
|
|
34374
|
-
* @
|
|
34375
|
-
* @returns {Array.<Node>}
|
|
34433
|
+
* @param {VisitorResult} value
|
|
34434
|
+
* @returns {ActionTuple}
|
|
34376
34435
|
*/
|
|
34377
|
-
function
|
|
34378
|
-
|
|
34436
|
+
function toResult(value) {
|
|
34437
|
+
if (Array.isArray(value)) {
|
|
34438
|
+
return value
|
|
34439
|
+
}
|
|
34440
|
+
|
|
34441
|
+
if (typeof value === 'number') {
|
|
34442
|
+
return [CONTINUE, value]
|
|
34443
|
+
}
|
|
34444
|
+
|
|
34445
|
+
return [value]
|
|
34379
34446
|
}
|
|
34380
34447
|
|
|
34381
34448
|
|
|
@@ -34635,7 +34702,7 @@ var _require3 = __webpack_require__(8447),
|
|
|
34635
34702
|
var BaseUrlContext = __webpack_require__(6785);
|
|
34636
34703
|
var createElement = __webpack_require__(5894);
|
|
34637
34704
|
var CustomParsers = Object.values(__webpack_require__(8521));
|
|
34638
|
-
var customCompilers = Object.values(__webpack_require__(
|
|
34705
|
+
var customCompilers = Object.values(__webpack_require__(8457));
|
|
34639
34706
|
var registerCustomComponents = __webpack_require__(1264);
|
|
34640
34707
|
var _require4 = __webpack_require__(2531),
|
|
34641
34708
|
options = _require4.options,
|
|
@@ -34645,7 +34712,7 @@ var _require5 = __webpack_require__(6284),
|
|
|
34645
34712
|
var toPlainText = __webpack_require__(4792);
|
|
34646
34713
|
var sectionAnchorId = __webpack_require__(9620);
|
|
34647
34714
|
var tableFlattening = __webpack_require__(4625);
|
|
34648
|
-
var _require6 = __webpack_require__(
|
|
34715
|
+
var _require6 = __webpack_require__(2692),
|
|
34649
34716
|
remarkTransformers = _require6.remarkTransformers,
|
|
34650
34717
|
rehypeTransformers = _require6.rehypeTransformers;
|
|
34651
34718
|
var createSchema = __webpack_require__(8229);
|