aboutsummaryrefslogtreecommitdiff
path: root/node_modules/css-select/lib
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/css-select/lib')
-rw-r--r--node_modules/css-select/lib/attributes.d.ts7
-rw-r--r--node_modules/css-select/lib/attributes.d.ts.map1
-rw-r--r--node_modules/css-select/lib/attributes.js171
-rw-r--r--node_modules/css-select/lib/compile.d.ts14
-rw-r--r--node_modules/css-select/lib/compile.d.ts.map1
-rw-r--r--node_modules/css-select/lib/compile.js115
-rw-r--r--node_modules/css-select/lib/general.d.ts3
-rw-r--r--node_modules/css-select/lib/general.d.ts.map1
-rw-r--r--node_modules/css-select/lib/general.js104
-rw-r--r--node_modules/css-select/lib/index.d.ts49
-rw-r--r--node_modules/css-select/lib/index.d.ts.map1
-rw-r--r--node_modules/css-select/lib/index.js145
-rw-r--r--node_modules/css-select/lib/procedure.d.ts5
-rw-r--r--node_modules/css-select/lib/procedure.d.ts.map1
-rw-r--r--node_modules/css-select/lib/procedure.js20
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/aliases.d.ts5
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map1
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/aliases.js33
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/filters.d.ts4
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map1
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/filters.js156
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/index.d.ts8
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/index.d.ts.map1
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/index.js54
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts6
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map1
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/pseudos.js89
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/subselects.d.ts10
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map1
-rw-r--r--node_modules/css-select/lib/pseudo-selectors/subselects.js110
-rw-r--r--node_modules/css-select/lib/sort.d.ts10
-rw-r--r--node_modules/css-select/lib/sort.d.ts.map1
-rw-r--r--node_modules/css-select/lib/sort.js84
-rw-r--r--node_modules/css-select/lib/types.d.ts120
-rw-r--r--node_modules/css-select/lib/types.d.ts.map1
-rw-r--r--node_modules/css-select/lib/types.js2
36 files changed, 1336 insertions, 0 deletions
diff --git a/node_modules/css-select/lib/attributes.d.ts b/node_modules/css-select/lib/attributes.d.ts
new file mode 100644
index 0000000..bcbc396
--- /dev/null
+++ b/node_modules/css-select/lib/attributes.d.ts
@@ -0,0 +1,7 @@
+import { CompiledQuery, InternalOptions } from "./types";
+import type { AttributeSelector, AttributeAction } from "css-what";
+/**
+ * Attribute selectors
+ */
+export declare const attributeRules: Record<AttributeAction, <Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, data: AttributeSelector, options: InternalOptions<Node, ElementNode>) => CompiledQuery<ElementNode>>;
+//# sourceMappingURL=attributes.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/attributes.d.ts.map b/node_modules/css-select/lib/attributes.d.ts.map
new file mode 100644
index 0000000..ac431da
--- /dev/null
+++ b/node_modules/css-select/lib/attributes.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAanE;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAC/B,eAAe,EACf,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC3B,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,KAC1C,aAAa,CAAC,WAAW,CAAC,CA8KlC,CAAC"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/attributes.js b/node_modules/css-select/lib/attributes.js
new file mode 100644
index 0000000..bbe57e2
--- /dev/null
+++ b/node_modules/css-select/lib/attributes.js
@@ -0,0 +1,171 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.attributeRules = void 0;
+var boolbase_1 = require("boolbase");
+/**
+ * All reserved characters in a regex, used for escaping.
+ *
+ * Taken from XRegExp, (c) 2007-2020 Steven Levithan under the MIT license
+ * https://github.com/slevithan/xregexp/blob/95eeebeb8fac8754d54eafe2b4743661ac1cf028/src/xregexp.js#L794
+ */
+var reChars = /[-[\]{}()*+?.,\\^$|#\s]/g;
+function escapeRegex(value) {
+ return value.replace(reChars, "\\$&");
+}
+/**
+ * Attribute selectors
+ */
+exports.attributeRules = {
+ equals: function (next, data, _a) {
+ var adapter = _a.adapter;
+ var name = data.name;
+ var value = data.value;
+ if (data.ignoreCase) {
+ value = value.toLowerCase();
+ return function (elem) {
+ var attr = adapter.getAttributeValue(elem, name);
+ return (attr != null &&
+ attr.length === value.length &&
+ attr.toLowerCase() === value &&
+ next(elem));
+ };
+ }
+ return function (elem) {
+ return adapter.getAttributeValue(elem, name) === value && next(elem);
+ };
+ },
+ hyphen: function (next, data, _a) {
+ var adapter = _a.adapter;
+ var name = data.name;
+ var value = data.value;
+ var len = value.length;
+ if (data.ignoreCase) {
+ value = value.toLowerCase();
+ return function hyphenIC(elem) {
+ var attr = adapter.getAttributeValue(elem, name);
+ return (attr != null &&
+ (attr.length === len || attr.charAt(len) === "-") &&
+ attr.substr(0, len).toLowerCase() === value &&
+ next(elem));
+ };
+ }
+ return function hyphen(elem) {
+ var attr = adapter.getAttributeValue(elem, name);
+ return (attr != null &&
+ (attr.length === len || attr.charAt(len) === "-") &&
+ attr.substr(0, len) === value &&
+ next(elem));
+ };
+ },
+ element: function (next, _a, _b) {
+ var name = _a.name, value = _a.value, ignoreCase = _a.ignoreCase;
+ var adapter = _b.adapter;
+ if (/\s/.test(value)) {
+ return boolbase_1.falseFunc;
+ }
+ var regex = new RegExp("(?:^|\\s)".concat(escapeRegex(value), "(?:$|\\s)"), ignoreCase ? "i" : "");
+ return function element(elem) {
+ var attr = adapter.getAttributeValue(elem, name);
+ return (attr != null &&
+ attr.length >= value.length &&
+ regex.test(attr) &&
+ next(elem));
+ };
+ },
+ exists: function (next, _a, _b) {
+ var name = _a.name;
+ var adapter = _b.adapter;
+ return function (elem) { return adapter.hasAttrib(elem, name) && next(elem); };
+ },
+ start: function (next, data, _a) {
+ var adapter = _a.adapter;
+ var name = data.name;
+ var value = data.value;
+ var len = value.length;
+ if (len === 0) {
+ return boolbase_1.falseFunc;
+ }
+ if (data.ignoreCase) {
+ value = value.toLowerCase();
+ return function (elem) {
+ var attr = adapter.getAttributeValue(elem, name);
+ return (attr != null &&
+ attr.length >= len &&
+ attr.substr(0, len).toLowerCase() === value &&
+ next(elem));
+ };
+ }
+ return function (elem) {
+ var _a;
+ return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.startsWith(value)) &&
+ next(elem);
+ };
+ },
+ end: function (next, data, _a) {
+ var adapter = _a.adapter;
+ var name = data.name;
+ var value = data.value;
+ var len = -value.length;
+ if (len === 0) {
+ return boolbase_1.falseFunc;
+ }
+ if (data.ignoreCase) {
+ value = value.toLowerCase();
+ return function (elem) {
+ var _a;
+ return ((_a = adapter
+ .getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.substr(len).toLowerCase()) === value && next(elem);
+ };
+ }
+ return function (elem) {
+ var _a;
+ return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.endsWith(value)) &&
+ next(elem);
+ };
+ },
+ any: function (next, data, _a) {
+ var adapter = _a.adapter;
+ var name = data.name, value = data.value;
+ if (value === "") {
+ return boolbase_1.falseFunc;
+ }
+ if (data.ignoreCase) {
+ var regex_1 = new RegExp(escapeRegex(value), "i");
+ return function anyIC(elem) {
+ var attr = adapter.getAttributeValue(elem, name);
+ return (attr != null &&
+ attr.length >= value.length &&
+ regex_1.test(attr) &&
+ next(elem));
+ };
+ }
+ return function (elem) {
+ var _a;
+ return !!((_a = adapter.getAttributeValue(elem, name)) === null || _a === void 0 ? void 0 : _a.includes(value)) &&
+ next(elem);
+ };
+ },
+ not: function (next, data, _a) {
+ var adapter = _a.adapter;
+ var name = data.name;
+ var value = data.value;
+ if (value === "") {
+ return function (elem) {
+ return !!adapter.getAttributeValue(elem, name) && next(elem);
+ };
+ }
+ else if (data.ignoreCase) {
+ value = value.toLowerCase();
+ return function (elem) {
+ var attr = adapter.getAttributeValue(elem, name);
+ return ((attr == null ||
+ attr.length !== value.length ||
+ attr.toLowerCase() !== value) &&
+ next(elem));
+ };
+ }
+ return function (elem) {
+ return adapter.getAttributeValue(elem, name) !== value && next(elem);
+ };
+ },
+};
diff --git a/node_modules/css-select/lib/compile.d.ts b/node_modules/css-select/lib/compile.d.ts
new file mode 100644
index 0000000..7184c95
--- /dev/null
+++ b/node_modules/css-select/lib/compile.d.ts
@@ -0,0 +1,14 @@
+import { InternalSelector } from "./types";
+import { Selector } from "css-what";
+import type { CompiledQuery, InternalOptions } from "./types";
+/**
+ * Compiles a selector to an executable function.
+ *
+ * @param selector Selector to compile.
+ * @param options Compilation options.
+ * @param context Optional context for the selector.
+ */
+export declare function compile<Node, ElementNode extends Node>(selector: string | Selector[][], options: InternalOptions<Node, ElementNode>, context?: Node[] | Node): CompiledQuery<Node>;
+export declare function compileUnsafe<Node, ElementNode extends Node>(selector: string | Selector[][], options: InternalOptions<Node, ElementNode>, context?: Node[] | Node): CompiledQuery<ElementNode>;
+export declare function compileToken<Node, ElementNode extends Node>(token: InternalSelector[][], options: InternalOptions<Node, ElementNode>, context?: Node[] | Node): CompiledQuery<ElementNode>;
+//# sourceMappingURL=compile.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/compile.d.ts.map b/node_modules/css-select/lib/compile.d.ts.map
new file mode 100644
index 0000000..9187dcf
--- /dev/null
+++ b/node_modules/css-select/lib/compile.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAS,QAAQ,EAAE,MAAM,UAAU,CAAC;AAS3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAClD,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,EAC/B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,IAAI,CAAC,CAGrB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACxD,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,EAC/B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,WAAW,CAAC,CAI5B;AA6CD,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACvD,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAC3B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,WAAW,CAAC,CA2C5B"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/compile.js b/node_modules/css-select/lib/compile.js
new file mode 100644
index 0000000..e2f4795
--- /dev/null
+++ b/node_modules/css-select/lib/compile.js
@@ -0,0 +1,115 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.compileToken = exports.compileUnsafe = exports.compile = void 0;
+var css_what_1 = require("css-what");
+var boolbase_1 = require("boolbase");
+var sort_1 = __importDefault(require("./sort"));
+var procedure_1 = require("./procedure");
+var general_1 = require("./general");
+var subselects_1 = require("./pseudo-selectors/subselects");
+/**
+ * Compiles a selector to an executable function.
+ *
+ * @param selector Selector to compile.
+ * @param options Compilation options.
+ * @param context Optional context for the selector.
+ */
+function compile(selector, options, context) {
+ var next = compileUnsafe(selector, options, context);
+ return (0, subselects_1.ensureIsTag)(next, options.adapter);
+}
+exports.compile = compile;
+function compileUnsafe(selector, options, context) {
+ var token = typeof selector === "string" ? (0, css_what_1.parse)(selector, options) : selector;
+ return compileToken(token, options, context);
+}
+exports.compileUnsafe = compileUnsafe;
+function includesScopePseudo(t) {
+ return (t.type === "pseudo" &&
+ (t.name === "scope" ||
+ (Array.isArray(t.data) &&
+ t.data.some(function (data) { return data.some(includesScopePseudo); }))));
+}
+var DESCENDANT_TOKEN = { type: "descendant" };
+var FLEXIBLE_DESCENDANT_TOKEN = {
+ type: "_flexibleDescendant",
+};
+var SCOPE_TOKEN = { type: "pseudo", name: "scope", data: null };
+/*
+ * CSS 4 Spec (Draft): 3.3.1. Absolutizing a Scope-relative Selector
+ * http://www.w3.org/TR/selectors4/#absolutizing
+ */
+function absolutize(token, _a, context) {
+ var adapter = _a.adapter;
+ // TODO Use better check if the context is a document
+ var hasContext = !!(context === null || context === void 0 ? void 0 : context.every(function (e) {
+ var parent = adapter.isTag(e) && adapter.getParent(e);
+ return e === subselects_1.PLACEHOLDER_ELEMENT || (parent && adapter.isTag(parent));
+ }));
+ for (var _i = 0, token_1 = token; _i < token_1.length; _i++) {
+ var t = token_1[_i];
+ if (t.length > 0 && (0, procedure_1.isTraversal)(t[0]) && t[0].type !== "descendant") {
+ // Don't continue in else branch
+ }
+ else if (hasContext && !t.some(includesScopePseudo)) {
+ t.unshift(DESCENDANT_TOKEN);
+ }
+ else {
+ continue;
+ }
+ t.unshift(SCOPE_TOKEN);
+ }
+}
+function compileToken(token, options, context) {
+ var _a;
+ token = token.filter(function (t) { return t.length > 0; });
+ token.forEach(sort_1.default);
+ context = (_a = options.context) !== null && _a !== void 0 ? _a : context;
+ var isArrayContext = Array.isArray(context);
+ var finalContext = context && (Array.isArray(context) ? context : [context]);
+ absolutize(token, options, finalContext);
+ var shouldTestNextSiblings = false;
+ var query = token
+ .map(function (rules) {
+ if (rules.length >= 2) {
+ var first = rules[0], second = rules[1];
+ if (first.type !== "pseudo" || first.name !== "scope") {
+ // Ignore
+ }
+ else if (isArrayContext && second.type === "descendant") {
+ rules[1] = FLEXIBLE_DESCENDANT_TOKEN;
+ }
+ else if (second.type === "adjacent" ||
+ second.type === "sibling") {
+ shouldTestNextSiblings = true;
+ }
+ }
+ return compileRules(rules, options, finalContext);
+ })
+ .reduce(reduceRules, boolbase_1.falseFunc);
+ query.shouldTestNextSiblings = shouldTestNextSiblings;
+ return query;
+}
+exports.compileToken = compileToken;
+function compileRules(rules, options, context) {
+ var _a;
+ return rules.reduce(function (previous, rule) {
+ return previous === boolbase_1.falseFunc
+ ? boolbase_1.falseFunc
+ : (0, general_1.compileGeneralSelector)(previous, rule, options, context, compileToken);
+ }, (_a = options.rootFunc) !== null && _a !== void 0 ? _a : boolbase_1.trueFunc);
+}
+function reduceRules(a, b) {
+ if (b === boolbase_1.falseFunc || a === boolbase_1.trueFunc) {
+ return a;
+ }
+ if (a === boolbase_1.falseFunc || b === boolbase_1.trueFunc) {
+ return b;
+ }
+ return function combine(elem) {
+ return a(elem) || b(elem);
+ };
+}
diff --git a/node_modules/css-select/lib/general.d.ts b/node_modules/css-select/lib/general.d.ts
new file mode 100644
index 0000000..de69fee
--- /dev/null
+++ b/node_modules/css-select/lib/general.d.ts
@@ -0,0 +1,3 @@
+import type { CompiledQuery, InternalOptions, InternalSelector, CompileToken } from "./types";
+export declare function compileGeneralSelector<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, selector: InternalSelector, options: InternalOptions<Node, ElementNode>, context: Node[] | undefined, compileToken: CompileToken<Node, ElementNode>): CompiledQuery<ElementNode>;
+//# sourceMappingURL=general.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/general.d.ts.map b/node_modules/css-select/lib/general.d.ts.map
new file mode 100644
index 0000000..ef605f7
--- /dev/null
+++ b/node_modules/css-select/lib/general.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../src/general.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACf,MAAM,SAAS,CAAC;AAMjB,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACjE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,GAC9C,aAAa,CAAC,WAAW,CAAC,CAwH5B"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/general.js b/node_modules/css-select/lib/general.js
new file mode 100644
index 0000000..031265e
--- /dev/null
+++ b/node_modules/css-select/lib/general.js
@@ -0,0 +1,104 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.compileGeneralSelector = void 0;
+var attributes_1 = require("./attributes");
+var pseudo_selectors_1 = require("./pseudo-selectors");
+/*
+ * All available rules
+ */
+function compileGeneralSelector(next, selector, options, context, compileToken) {
+ var adapter = options.adapter, equals = options.equals;
+ switch (selector.type) {
+ case "pseudo-element":
+ throw new Error("Pseudo-elements are not supported by css-select");
+ case "attribute":
+ return attributes_1.attributeRules[selector.action](next, selector, options);
+ case "pseudo":
+ return (0, pseudo_selectors_1.compilePseudoSelector)(next, selector, options, context, compileToken);
+ // Tags
+ case "tag":
+ return function tag(elem) {
+ return adapter.getName(elem) === selector.name && next(elem);
+ };
+ // Traversal
+ case "descendant":
+ if (options.cacheResults === false ||
+ typeof WeakSet === "undefined") {
+ return function descendant(elem) {
+ var current = elem;
+ while ((current = adapter.getParent(current))) {
+ if (adapter.isTag(current) && next(current)) {
+ return true;
+ }
+ }
+ return false;
+ };
+ }
+ // @ts-expect-error `ElementNode` is not extending object
+ // eslint-disable-next-line no-case-declarations
+ var isFalseCache_1 = new WeakSet();
+ return function cachedDescendant(elem) {
+ var current = elem;
+ while ((current = adapter.getParent(current))) {
+ if (!isFalseCache_1.has(current)) {
+ if (adapter.isTag(current) && next(current)) {
+ return true;
+ }
+ isFalseCache_1.add(current);
+ }
+ }
+ return false;
+ };
+ case "_flexibleDescendant":
+ // Include element itself, only used while querying an array
+ return function flexibleDescendant(elem) {
+ var current = elem;
+ do {
+ if (adapter.isTag(current) && next(current))
+ return true;
+ } while ((current = adapter.getParent(current)));
+ return false;
+ };
+ case "parent":
+ return function parent(elem) {
+ return adapter
+ .getChildren(elem)
+ .some(function (elem) { return adapter.isTag(elem) && next(elem); });
+ };
+ case "child":
+ return function child(elem) {
+ var parent = adapter.getParent(elem);
+ return parent != null && adapter.isTag(parent) && next(parent);
+ };
+ case "sibling":
+ return function sibling(elem) {
+ var siblings = adapter.getSiblings(elem);
+ for (var i = 0; i < siblings.length; i++) {
+ var currentSibling = siblings[i];
+ if (equals(elem, currentSibling))
+ break;
+ if (adapter.isTag(currentSibling) && next(currentSibling)) {
+ return true;
+ }
+ }
+ return false;
+ };
+ case "adjacent":
+ return function adjacent(elem) {
+ var siblings = adapter.getSiblings(elem);
+ var lastElement;
+ for (var i = 0; i < siblings.length; i++) {
+ var currentSibling = siblings[i];
+ if (equals(elem, currentSibling))
+ break;
+ if (adapter.isTag(currentSibling)) {
+ lastElement = currentSibling;
+ }
+ }
+ return !!lastElement && next(lastElement);
+ };
+ case "universal":
+ return next;
+ }
+}
+exports.compileGeneralSelector = compileGeneralSelector;
diff --git a/node_modules/css-select/lib/index.d.ts b/node_modules/css-select/lib/index.d.ts
new file mode 100644
index 0000000..4d9f644
--- /dev/null
+++ b/node_modules/css-select/lib/index.d.ts
@@ -0,0 +1,49 @@
+import type { CompiledQuery, Options, Query, Adapter } from "./types";
+export type { Options };
+/**
+ * Compiles the query, returns a function.
+ */
+export declare const compile: <Node_1, ElementNode extends Node_1>(selector: string | import("css-what").Selector[][], options?: Options<Node_1, ElementNode> | undefined, context?: Node_1 | Node_1[] | undefined) => CompiledQuery<Node_1>;
+export declare const _compileUnsafe: <Node_1, ElementNode extends Node_1>(selector: string | import("css-what").Selector[][], options?: Options<Node_1, ElementNode> | undefined, context?: Node_1 | Node_1[] | undefined) => CompiledQuery<ElementNode>;
+export declare const _compileToken: <Node_1, ElementNode extends Node_1>(selector: import("./types").InternalSelector[][], options?: Options<Node_1, ElementNode> | undefined, context?: Node_1 | Node_1[] | undefined) => CompiledQuery<ElementNode>;
+export declare function prepareContext<Node, ElementNode extends Node>(elems: Node | Node[], adapter: Adapter<Node, ElementNode>, shouldTestNextSiblings?: boolean): Node[];
+/**
+ * @template Node The generic Node type for the DOM adapter being used.
+ * @template ElementNode The Node type for elements for the DOM adapter being used.
+ * @param elems Elements to query. If it is an element, its children will be queried..
+ * @param query can be either a CSS selector string or a compiled query function.
+ * @param [options] options for querying the document.
+ * @see compile for supported selector queries.
+ * @returns All matching elements.
+ *
+ */
+export declare const selectAll: <Node_1, ElementNode extends Node_1>(query: Query<ElementNode>, elements: Node_1 | Node_1[], options?: Options<Node_1, ElementNode> | undefined) => ElementNode[];
+/**
+ * @template Node The generic Node type for the DOM adapter being used.
+ * @template ElementNode The Node type for elements for the DOM adapter being used.
+ * @param elems Elements to query. If it is an element, its children will be queried..
+ * @param query can be either a CSS selector string or a compiled query function.
+ * @param [options] options for querying the document.
+ * @see compile for supported selector queries.
+ * @returns the first match, or null if there was no match.
+ */
+export declare const selectOne: <Node_1, ElementNode extends Node_1>(query: Query<ElementNode>, elements: Node_1 | Node_1[], options?: Options<Node_1, ElementNode> | undefined) => ElementNode | null;
+/**
+ * Tests whether or not an element is matched by query.
+ *
+ * @template Node The generic Node type for the DOM adapter being used.
+ * @template ElementNode The Node type for elements for the DOM adapter being used.
+ * @param elem The element to test if it matches the query.
+ * @param query can be either a CSS selector string or a compiled query function.
+ * @param [options] options for querying the document.
+ * @see compile for supported selector queries.
+ * @returns
+ */
+export declare function is<Node, ElementNode extends Node>(elem: ElementNode, query: Query<ElementNode>, options?: Options<Node, ElementNode>): boolean;
+/**
+ * Alias for selectAll(query, elems, options).
+ * @see [compile] for supported selector queries.
+ */
+export default selectAll;
+export { filters, pseudos, aliases } from "./pseudo-selectors";
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/index.d.ts.map b/node_modules/css-select/lib/index.d.ts.map
new file mode 100644
index 0000000..159d5f8
--- /dev/null
+++ b/node_modules/css-select/lib/index.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,aAAa,EACb,OAAO,EAEP,KAAK,EACL,OAAO,EAEV,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,OAAO,EAAE,CAAC;AA0CxB;;GAEG;AACH,eAAO,MAAM,OAAO,gNAA0B,CAAC;AAC/C,eAAO,MAAM,cAAc,qNAA6B,CAAC;AACzD,eAAO,MAAM,aAAa,mNAA4B,CAAC;AA6BvD,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACzD,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EACpB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,EACnC,sBAAsB,UAAQ,GAC/B,IAAI,EAAE,CAYR;AAiBD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,mKASrB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,wKASrB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC7C,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,EACzB,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACrC,OAAO,CAKT;AAED;;;GAGG;AACH,eAAe,SAAS,CAAC;AAGzB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/index.js b/node_modules/css-select/lib/index.js
new file mode 100644
index 0000000..3519397
--- /dev/null
+++ b/node_modules/css-select/lib/index.js
@@ -0,0 +1,145 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.aliases = exports.pseudos = exports.filters = exports.is = exports.selectOne = exports.selectAll = exports.prepareContext = exports._compileToken = exports._compileUnsafe = exports.compile = void 0;
+var DomUtils = __importStar(require("domutils"));
+var boolbase_1 = require("boolbase");
+var compile_1 = require("./compile");
+var subselects_1 = require("./pseudo-selectors/subselects");
+var defaultEquals = function (a, b) { return a === b; };
+var defaultOptions = {
+ adapter: DomUtils,
+ equals: defaultEquals,
+};
+function convertOptionFormats(options) {
+ var _a, _b, _c, _d;
+ /*
+ * We force one format of options to the other one.
+ */
+ // @ts-expect-error Default options may have incompatible `Node` / `ElementNode`.
+ var opts = options !== null && options !== void 0 ? options : defaultOptions;
+ // @ts-expect-error Same as above.
+ (_a = opts.adapter) !== null && _a !== void 0 ? _a : (opts.adapter = DomUtils);
+ // @ts-expect-error `equals` does not exist on `Options`
+ (_b = opts.equals) !== null && _b !== void 0 ? _b : (opts.equals = (_d = (_c = opts.adapter) === null || _c === void 0 ? void 0 : _c.equals) !== null && _d !== void 0 ? _d : defaultEquals);
+ return opts;
+}
+function wrapCompile(func) {
+ return function addAdapter(selector, options, context) {
+ var opts = convertOptionFormats(options);
+ return func(selector, opts, context);
+ };
+}
+/**
+ * Compiles the query, returns a function.
+ */
+exports.compile = wrapCompile(compile_1.compile);
+exports._compileUnsafe = wrapCompile(compile_1.compileUnsafe);
+exports._compileToken = wrapCompile(compile_1.compileToken);
+function getSelectorFunc(searchFunc) {
+ return function select(query, elements, options) {
+ var opts = convertOptionFormats(options);
+ if (typeof query !== "function") {
+ query = (0, compile_1.compileUnsafe)(query, opts, elements);
+ }
+ var filteredElements = prepareContext(elements, opts.adapter, query.shouldTestNextSiblings);
+ return searchFunc(query, filteredElements, opts);
+ };
+}
+function prepareContext(elems, adapter, shouldTestNextSiblings) {
+ if (shouldTestNextSiblings === void 0) { shouldTestNextSiblings = false; }
+ /*
+ * Add siblings if the query requires them.
+ * See https://github.com/fb55/css-select/pull/43#issuecomment-225414692
+ */
+ if (shouldTestNextSiblings) {
+ elems = appendNextSiblings(elems, adapter);
+ }
+ return Array.isArray(elems)
+ ? adapter.removeSubsets(elems)
+ : adapter.getChildren(elems);
+}
+exports.prepareContext = prepareContext;
+function appendNextSiblings(elem, adapter) {
+ // Order matters because jQuery seems to check the children before the siblings
+ var elems = Array.isArray(elem) ? elem.slice(0) : [elem];
+ var elemsLength = elems.length;
+ for (var i = 0; i < elemsLength; i++) {
+ var nextSiblings = (0, subselects_1.getNextSiblings)(elems[i], adapter);
+ elems.push.apply(elems, nextSiblings);
+ }
+ return elems;
+}
+/**
+ * @template Node The generic Node type for the DOM adapter being used.
+ * @template ElementNode The Node type for elements for the DOM adapter being used.
+ * @param elems Elements to query. If it is an element, its children will be queried..
+ * @param query can be either a CSS selector string or a compiled query function.
+ * @param [options] options for querying the document.
+ * @see compile for supported selector queries.
+ * @returns All matching elements.
+ *
+ */
+exports.selectAll = getSelectorFunc(function (query, elems, options) {
+ return query === boolbase_1.falseFunc || !elems || elems.length === 0
+ ? []
+ : options.adapter.findAll(query, elems);
+});
+/**
+ * @template Node The generic Node type for the DOM adapter being used.
+ * @template ElementNode The Node type for elements for the DOM adapter being used.
+ * @param elems Elements to query. If it is an element, its children will be queried..
+ * @param query can be either a CSS selector string or a compiled query function.
+ * @param [options] options for querying the document.
+ * @see compile for supported selector queries.
+ * @returns the first match, or null if there was no match.
+ */
+exports.selectOne = getSelectorFunc(function (query, elems, options) {
+ return query === boolbase_1.falseFunc || !elems || elems.length === 0
+ ? null
+ : options.adapter.findOne(query, elems);
+});
+/**
+ * Tests whether or not an element is matched by query.
+ *
+ * @template Node The generic Node type for the DOM adapter being used.
+ * @template ElementNode The Node type for elements for the DOM adapter being used.
+ * @param elem The element to test if it matches the query.
+ * @param query can be either a CSS selector string or a compiled query function.
+ * @param [options] options for querying the document.
+ * @see compile for supported selector queries.
+ * @returns
+ */
+function is(elem, query, options) {
+ var opts = convertOptionFormats(options);
+ return (typeof query === "function" ? query : (0, compile_1.compile)(query, opts))(elem);
+}
+exports.is = is;
+/**
+ * Alias for selectAll(query, elems, options).
+ * @see [compile] for supported selector queries.
+ */
+exports.default = exports.selectAll;
+// Export filters, pseudos and aliases to allow users to supply their own.
+var pseudo_selectors_1 = require("./pseudo-selectors");
+Object.defineProperty(exports, "filters", { enumerable: true, get: function () { return pseudo_selectors_1.filters; } });
+Object.defineProperty(exports, "pseudos", { enumerable: true, get: function () { return pseudo_selectors_1.pseudos; } });
+Object.defineProperty(exports, "aliases", { enumerable: true, get: function () { return pseudo_selectors_1.aliases; } });
diff --git a/node_modules/css-select/lib/procedure.d.ts b/node_modules/css-select/lib/procedure.d.ts
new file mode 100644
index 0000000..a911623
--- /dev/null
+++ b/node_modules/css-select/lib/procedure.d.ts
@@ -0,0 +1,5 @@
+import type { Traversal } from "css-what";
+import type { InternalSelector } from "./types";
+export declare const procedure: Record<InternalSelector["type"], number>;
+export declare function isTraversal(t: InternalSelector): t is Traversal;
+//# sourceMappingURL=procedure.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/procedure.d.ts.map b/node_modules/css-select/lib/procedure.d.ts.map
new file mode 100644
index 0000000..fb47658
--- /dev/null
+++ b/node_modules/css-select/lib/procedure.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"procedure.d.ts","sourceRoot":"","sources":["../src/procedure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAY9D,CAAC;AAEF,wBAAgB,WAAW,CAAC,CAAC,EAAE,gBAAgB,GAAG,CAAC,IAAI,SAAS,CAE/D"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/procedure.js b/node_modules/css-select/lib/procedure.js
new file mode 100644
index 0000000..d28f368
--- /dev/null
+++ b/node_modules/css-select/lib/procedure.js
@@ -0,0 +1,20 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.isTraversal = exports.procedure = void 0;
+exports.procedure = {
+ universal: 50,
+ tag: 30,
+ attribute: 1,
+ pseudo: 0,
+ "pseudo-element": 0,
+ descendant: -1,
+ child: -1,
+ parent: -1,
+ sibling: -1,
+ adjacent: -1,
+ _flexibleDescendant: -1,
+};
+function isTraversal(t) {
+ return exports.procedure[t.type] < 0;
+}
+exports.isTraversal = isTraversal;
diff --git a/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts b/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts
new file mode 100644
index 0000000..1bcb31a
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts
@@ -0,0 +1,5 @@
+/**
+ * Aliases are pseudos that are expressed as selectors.
+ */
+export declare const aliases: Record<string, string>;
+//# sourceMappingURL=aliases.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map
new file mode 100644
index 0000000..5734659
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/aliases.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwC1C,CAAC"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/aliases.js b/node_modules/css-select/lib/pseudo-selectors/aliases.js
new file mode 100644
index 0000000..f9a03da
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/aliases.js
@@ -0,0 +1,33 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.aliases = void 0;
+/**
+ * Aliases are pseudos that are expressed as selectors.
+ */
+exports.aliases = {
+ // Links
+ "any-link": ":is(a, area, link)[href]",
+ link: ":any-link:not(:visited)",
+ // Forms
+ // https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements
+ disabled: ":is(\n :is(button, input, select, textarea, optgroup, option)[disabled],\n optgroup[disabled] > option,\n fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)\n )",
+ enabled: ":not(:disabled)",
+ checked: ":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)",
+ required: ":is(input, select, textarea)[required]",
+ optional: ":is(input, select, textarea):not([required])",
+ // JQuery extensions
+ // https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness
+ selected: "option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",
+ checkbox: "[type=checkbox]",
+ file: "[type=file]",
+ password: "[type=password]",
+ radio: "[type=radio]",
+ reset: "[type=reset]",
+ image: "[type=image]",
+ submit: "[type=submit]",
+ parent: ":not(:empty)",
+ header: ":is(h1, h2, h3, h4, h5, h6)",
+ button: ":is(button, input[type=button])",
+ input: ":is(input, textarea, select, button)",
+ text: "input:is(:not([type!='']), [type=text])",
+};
diff --git a/node_modules/css-select/lib/pseudo-selectors/filters.d.ts b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts
new file mode 100644
index 0000000..90634f7
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts
@@ -0,0 +1,4 @@
+import type { CompiledQuery, InternalOptions } from "../types";
+export declare type Filter = <Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, text: string, options: InternalOptions<Node, ElementNode>, context?: Node[]) => CompiledQuery<ElementNode>;
+export declare const filters: Record<string, Filter>;
+//# sourceMappingURL=filters.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map
new file mode 100644
index 0000000..c2caa25
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/filters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAExE,oBAAY,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,KACf,aAAa,CAAC,WAAW,CAAC,CAAC;AAYhC,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2I1C,CAAC"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/filters.js b/node_modules/css-select/lib/pseudo-selectors/filters.js
new file mode 100644
index 0000000..84f86c1
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/filters.js
@@ -0,0 +1,156 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.filters = void 0;
+var nth_check_1 = __importDefault(require("nth-check"));
+var boolbase_1 = require("boolbase");
+function getChildFunc(next, adapter) {
+ return function (elem) {
+ var parent = adapter.getParent(elem);
+ return parent != null && adapter.isTag(parent) && next(elem);
+ };
+}
+exports.filters = {
+ contains: function (next, text, _a) {
+ var adapter = _a.adapter;
+ return function contains(elem) {
+ return next(elem) && adapter.getText(elem).includes(text);
+ };
+ },
+ icontains: function (next, text, _a) {
+ var adapter = _a.adapter;
+ var itext = text.toLowerCase();
+ return function icontains(elem) {
+ return (next(elem) &&
+ adapter.getText(elem).toLowerCase().includes(itext));
+ };
+ },
+ // Location specific methods
+ "nth-child": function (next, rule, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var func = (0, nth_check_1.default)(rule);
+ if (func === boolbase_1.falseFunc)
+ return boolbase_1.falseFunc;
+ if (func === boolbase_1.trueFunc)
+ return getChildFunc(next, adapter);
+ return function nthChild(elem) {
+ var siblings = adapter.getSiblings(elem);
+ var pos = 0;
+ for (var i = 0; i < siblings.length; i++) {
+ if (equals(elem, siblings[i]))
+ break;
+ if (adapter.isTag(siblings[i])) {
+ pos++;
+ }
+ }
+ return func(pos) && next(elem);
+ };
+ },
+ "nth-last-child": function (next, rule, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var func = (0, nth_check_1.default)(rule);
+ if (func === boolbase_1.falseFunc)
+ return boolbase_1.falseFunc;
+ if (func === boolbase_1.trueFunc)
+ return getChildFunc(next, adapter);
+ return function nthLastChild(elem) {
+ var siblings = adapter.getSiblings(elem);
+ var pos = 0;
+ for (var i = siblings.length - 1; i >= 0; i--) {
+ if (equals(elem, siblings[i]))
+ break;
+ if (adapter.isTag(siblings[i])) {
+ pos++;
+ }
+ }
+ return func(pos) && next(elem);
+ };
+ },
+ "nth-of-type": function (next, rule, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var func = (0, nth_check_1.default)(rule);
+ if (func === boolbase_1.falseFunc)
+ return boolbase_1.falseFunc;
+ if (func === boolbase_1.trueFunc)
+ return getChildFunc(next, adapter);
+ return function nthOfType(elem) {
+ var siblings = adapter.getSiblings(elem);
+ var pos = 0;
+ for (var i = 0; i < siblings.length; i++) {
+ var currentSibling = siblings[i];
+ if (equals(elem, currentSibling))
+ break;
+ if (adapter.isTag(currentSibling) &&
+ adapter.getName(currentSibling) === adapter.getName(elem)) {
+ pos++;
+ }
+ }
+ return func(pos) && next(elem);
+ };
+ },
+ "nth-last-of-type": function (next, rule, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var func = (0, nth_check_1.default)(rule);
+ if (func === boolbase_1.falseFunc)
+ return boolbase_1.falseFunc;
+ if (func === boolbase_1.trueFunc)
+ return getChildFunc(next, adapter);
+ return function nthLastOfType(elem) {
+ var siblings = adapter.getSiblings(elem);
+ var pos = 0;
+ for (var i = siblings.length - 1; i >= 0; i--) {
+ var currentSibling = siblings[i];
+ if (equals(elem, currentSibling))
+ break;
+ if (adapter.isTag(currentSibling) &&
+ adapter.getName(currentSibling) === adapter.getName(elem)) {
+ pos++;
+ }
+ }
+ return func(pos) && next(elem);
+ };
+ },
+ // TODO determine the actual root element
+ root: function (next, _rule, _a) {
+ var adapter = _a.adapter;
+ return function (elem) {
+ var parent = adapter.getParent(elem);
+ return (parent == null || !adapter.isTag(parent)) && next(elem);
+ };
+ },
+ scope: function (next, rule, options, context) {
+ var equals = options.equals;
+ if (!context || context.length === 0) {
+ // Equivalent to :root
+ return exports.filters.root(next, rule, options);
+ }
+ if (context.length === 1) {
+ // NOTE: can't be unpacked, as :has uses this for side-effects
+ return function (elem) { return equals(context[0], elem) && next(elem); };
+ }
+ return function (elem) { return context.includes(elem) && next(elem); };
+ },
+ hover: dynamicStatePseudo("isHovered"),
+ visited: dynamicStatePseudo("isVisited"),
+ active: dynamicStatePseudo("isActive"),
+};
+/**
+ * Dynamic state pseudos. These depend on optional Adapter methods.
+ *
+ * @param name The name of the adapter method to call.
+ * @returns Pseudo for the `filters` object.
+ */
+function dynamicStatePseudo(name) {
+ return function dynamicPseudo(next, _rule, _a) {
+ var adapter = _a.adapter;
+ var func = adapter[name];
+ if (typeof func !== "function") {
+ return boolbase_1.falseFunc;
+ }
+ return function active(elem) {
+ return func(elem) && next(elem);
+ };
+ };
+}
diff --git a/node_modules/css-select/lib/pseudo-selectors/index.d.ts b/node_modules/css-select/lib/pseudo-selectors/index.d.ts
new file mode 100644
index 0000000..70f467d
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/index.d.ts
@@ -0,0 +1,8 @@
+import type { CompiledQuery, InternalOptions, CompileToken } from "../types";
+import { PseudoSelector } from "css-what";
+import { filters } from "./filters";
+import { pseudos } from "./pseudos";
+import { aliases } from "./aliases";
+export { filters, pseudos, aliases };
+export declare function compilePseudoSelector<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, selector: PseudoSelector, options: InternalOptions<Node, ElementNode>, context: Node[] | undefined, compileToken: CompileToken<Node, ElementNode>): CompiledQuery<ElementNode>;
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map
new file mode 100644
index 0000000..abe85a6
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAS,cAAc,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAoB,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAErC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,GAC9C,aAAa,CAAC,WAAW,CAAC,CA6B5B"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/index.js b/node_modules/css-select/lib/pseudo-selectors/index.js
new file mode 100644
index 0000000..feaf7e5
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/index.js
@@ -0,0 +1,54 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.compilePseudoSelector = exports.aliases = exports.pseudos = exports.filters = void 0;
+/*
+ * Pseudo selectors
+ *
+ * Pseudo selectors are available in three forms:
+ *
+ * 1. Filters are called when the selector is compiled and return a function
+ * that has to return either false, or the results of `next()`.
+ * 2. Pseudos are called on execution. They have to return a boolean.
+ * 3. Subselects work like filters, but have an embedded selector that will be run separately.
+ *
+ * Filters are great if you want to do some pre-processing, or change the call order
+ * of `next()` and your code.
+ * Pseudos should be used to implement simple checks.
+ */
+var boolbase_1 = require("boolbase");
+var css_what_1 = require("css-what");
+var filters_1 = require("./filters");
+Object.defineProperty(exports, "filters", { enumerable: true, get: function () { return filters_1.filters; } });
+var pseudos_1 = require("./pseudos");
+Object.defineProperty(exports, "pseudos", { enumerable: true, get: function () { return pseudos_1.pseudos; } });
+var aliases_1 = require("./aliases");
+Object.defineProperty(exports, "aliases", { enumerable: true, get: function () { return aliases_1.aliases; } });
+var subselects_1 = require("./subselects");
+function compilePseudoSelector(next, selector, options, context, compileToken) {
+ var name = selector.name, data = selector.data;
+ if (Array.isArray(data)) {
+ return subselects_1.subselects[name](next, data, options, context, compileToken);
+ }
+ if (name in aliases_1.aliases) {
+ if (data != null) {
+ throw new Error("Pseudo ".concat(name, " doesn't have any arguments"));
+ }
+ // The alias has to be parsed here, to make sure options are respected.
+ var alias = (0, css_what_1.parse)(aliases_1.aliases[name], options);
+ return subselects_1.subselects.is(next, alias, options, context, compileToken);
+ }
+ if (name in filters_1.filters) {
+ return filters_1.filters[name](next, data, options, context);
+ }
+ if (name in pseudos_1.pseudos) {
+ var pseudo_1 = pseudos_1.pseudos[name];
+ (0, pseudos_1.verifyPseudoArgs)(pseudo_1, name, data);
+ return pseudo_1 === boolbase_1.falseFunc
+ ? boolbase_1.falseFunc
+ : next === boolbase_1.trueFunc
+ ? function (elem) { return pseudo_1(elem, options, data); }
+ : function (elem) { return pseudo_1(elem, options, data) && next(elem); };
+ }
+ throw new Error("unmatched pseudo-class :".concat(name));
+}
+exports.compilePseudoSelector = compilePseudoSelector;
diff --git a/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts
new file mode 100644
index 0000000..afd483f
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts
@@ -0,0 +1,6 @@
+import { PseudoSelector } from "css-what";
+import type { InternalOptions } from "../types";
+export declare type Pseudo = <Node, ElementNode extends Node>(elem: ElementNode, options: InternalOptions<Node, ElementNode>, subselect?: ElementNode | string | null) => boolean;
+export declare const pseudos: Record<string, Pseudo>;
+export declare function verifyPseudoArgs(func: Pseudo, name: string, subselect: PseudoSelector["data"]): void;
+//# sourceMappingURL=pseudos.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map
new file mode 100644
index 0000000..daa0f45
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"pseudos.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/pseudos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,oBAAY,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChD,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,KACtC,OAAO,CAAC;AAGb,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA8E1C,CAAC;AAEF,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,GAClC,IAAI,CAQN"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/pseudos.js b/node_modules/css-select/lib/pseudo-selectors/pseudos.js
new file mode 100644
index 0000000..c5da839
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/pseudos.js
@@ -0,0 +1,89 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.verifyPseudoArgs = exports.pseudos = void 0;
+// While filters are precompiled, pseudos get called when they are needed
+exports.pseudos = {
+ empty: function (elem, _a) {
+ var adapter = _a.adapter;
+ return !adapter.getChildren(elem).some(function (elem) {
+ // FIXME: `getText` call is potentially expensive.
+ return adapter.isTag(elem) || adapter.getText(elem) !== "";
+ });
+ },
+ "first-child": function (elem, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var firstChild = adapter
+ .getSiblings(elem)
+ .find(function (elem) { return adapter.isTag(elem); });
+ return firstChild != null && equals(elem, firstChild);
+ },
+ "last-child": function (elem, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var siblings = adapter.getSiblings(elem);
+ for (var i = siblings.length - 1; i >= 0; i--) {
+ if (equals(elem, siblings[i]))
+ return true;
+ if (adapter.isTag(siblings[i]))
+ break;
+ }
+ return false;
+ },
+ "first-of-type": function (elem, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var siblings = adapter.getSiblings(elem);
+ var elemName = adapter.getName(elem);
+ for (var i = 0; i < siblings.length; i++) {
+ var currentSibling = siblings[i];
+ if (equals(elem, currentSibling))
+ return true;
+ if (adapter.isTag(currentSibling) &&
+ adapter.getName(currentSibling) === elemName) {
+ break;
+ }
+ }
+ return false;
+ },
+ "last-of-type": function (elem, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var siblings = adapter.getSiblings(elem);
+ var elemName = adapter.getName(elem);
+ for (var i = siblings.length - 1; i >= 0; i--) {
+ var currentSibling = siblings[i];
+ if (equals(elem, currentSibling))
+ return true;
+ if (adapter.isTag(currentSibling) &&
+ adapter.getName(currentSibling) === elemName) {
+ break;
+ }
+ }
+ return false;
+ },
+ "only-of-type": function (elem, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ var elemName = adapter.getName(elem);
+ return adapter
+ .getSiblings(elem)
+ .every(function (sibling) {
+ return equals(elem, sibling) ||
+ !adapter.isTag(sibling) ||
+ adapter.getName(sibling) !== elemName;
+ });
+ },
+ "only-child": function (elem, _a) {
+ var adapter = _a.adapter, equals = _a.equals;
+ return adapter
+ .getSiblings(elem)
+ .every(function (sibling) { return equals(elem, sibling) || !adapter.isTag(sibling); });
+ },
+};
+function verifyPseudoArgs(func, name, subselect) {
+ if (subselect === null) {
+ if (func.length > 2) {
+ throw new Error("pseudo-selector :".concat(name, " requires an argument"));
+ }
+ }
+ else if (func.length === 2) {
+ throw new Error("pseudo-selector :".concat(name, " doesn't have any arguments"));
+ }
+}
+exports.verifyPseudoArgs = verifyPseudoArgs;
diff --git a/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts
new file mode 100644
index 0000000..192d880
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts
@@ -0,0 +1,10 @@
+import { CompileToken } from "./../types";
+import type { Selector } from "css-what";
+import type { CompiledQuery, InternalOptions, Adapter } from "../types";
+/** Used as a placeholder for :has. Will be replaced with the actual element. */
+export declare const PLACEHOLDER_ELEMENT: {};
+export declare function ensureIsTag<Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, adapter: Adapter<Node, ElementNode>): CompiledQuery<Node>;
+export declare type Subselect = <Node, ElementNode extends Node>(next: CompiledQuery<ElementNode>, subselect: Selector[][], options: InternalOptions<Node, ElementNode>, context: Node[] | undefined, compileToken: CompileToken<Node, ElementNode>) => CompiledQuery<ElementNode>;
+export declare function getNextSiblings<Node, ElementNode extends Node>(elem: Node, adapter: Adapter<Node, ElementNode>): ElementNode[];
+export declare const subselects: Record<string, Subselect>;
+//# sourceMappingURL=subselects.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map
new file mode 100644
index 0000000..a6f188f
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"subselects.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/subselects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxE,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,IAAK,CAAC;AAEtC,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACtD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACpC,aAAa,CAAC,IAAI,CAAC,CAGrB;AAED,oBAAY,SAAS,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACnD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,SAAS,EAAE,QAAQ,EAAE,EAAE,EACvB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,KAC5C,aAAa,CAAC,WAAW,CAAC,CAAC;AAEhC,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC1D,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACpC,WAAW,EAAE,CAMf;AAkBD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CA6EhD,CAAC"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/pseudo-selectors/subselects.js b/node_modules/css-select/lib/pseudo-selectors/subselects.js
new file mode 100644
index 0000000..a42ee0c
--- /dev/null
+++ b/node_modules/css-select/lib/pseudo-selectors/subselects.js
@@ -0,0 +1,110 @@
+"use strict";
+var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
+ if (ar || !(i in from)) {
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
+ ar[i] = from[i];
+ }
+ }
+ return to.concat(ar || Array.prototype.slice.call(from));
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.subselects = exports.getNextSiblings = exports.ensureIsTag = exports.PLACEHOLDER_ELEMENT = void 0;
+var boolbase_1 = require("boolbase");
+var procedure_1 = require("../procedure");
+/** Used as a placeholder for :has. Will be replaced with the actual element. */
+exports.PLACEHOLDER_ELEMENT = {};
+function ensureIsTag(next, adapter) {
+ if (next === boolbase_1.falseFunc)
+ return boolbase_1.falseFunc;
+ return function (elem) { return adapter.isTag(elem) && next(elem); };
+}
+exports.ensureIsTag = ensureIsTag;
+function getNextSiblings(elem, adapter) {
+ var siblings = adapter.getSiblings(elem);
+ if (siblings.length <= 1)
+ return [];
+ var elemIndex = siblings.indexOf(elem);
+ if (elemIndex < 0 || elemIndex === siblings.length - 1)
+ return [];
+ return siblings.slice(elemIndex + 1).filter(adapter.isTag);
+}
+exports.getNextSiblings = getNextSiblings;
+var is = function (next, token, options, context, compileToken) {
+ var opts = {
+ xmlMode: !!options.xmlMode,
+ adapter: options.adapter,
+ equals: options.equals,
+ };
+ var func = compileToken(token, opts, context);
+ return function (elem) { return func(elem) && next(elem); };
+};
+/*
+ * :not, :has, :is, :matches and :where have to compile selectors
+ * doing this in src/pseudos.ts would lead to circular dependencies,
+ * so we add them here
+ */
+exports.subselects = {
+ is: is,
+ /**
+ * `:matches` and `:where` are aliases for `:is`.
+ */
+ matches: is,
+ where: is,
+ not: function (next, token, options, context, compileToken) {
+ var opts = {
+ xmlMode: !!options.xmlMode,
+ adapter: options.adapter,
+ equals: options.equals,
+ };
+ var func = compileToken(token, opts, context);
+ if (func === boolbase_1.falseFunc)
+ return next;
+ if (func === boolbase_1.trueFunc)
+ return boolbase_1.falseFunc;
+ return function not(elem) {
+ return !func(elem) && next(elem);
+ };
+ },
+ has: function (next, subselect, options, _context, compileToken) {
+ var adapter = options.adapter;
+ var opts = {
+ xmlMode: !!options.xmlMode,
+ adapter: adapter,
+ equals: options.equals,
+ };
+ // @ts-expect-error Uses an array as a pointer to the current element (side effects)
+ var context = subselect.some(function (s) {
+ return s.some(procedure_1.isTraversal);
+ })
+ ? [exports.PLACEHOLDER_ELEMENT]
+ : undefined;
+ var compiled = compileToken(subselect, opts, context);
+ if (compiled === boolbase_1.falseFunc)
+ return boolbase_1.falseFunc;
+ if (compiled === boolbase_1.trueFunc) {
+ return function (elem) {
+ return adapter.getChildren(elem).some(adapter.isTag) && next(elem);
+ };
+ }
+ var hasElement = ensureIsTag(compiled, adapter);
+ var _a = compiled.shouldTestNextSiblings, shouldTestNextSiblings = _a === void 0 ? false : _a;
+ /*
+ * `shouldTestNextSiblings` will only be true if the query starts with
+ * a traversal (sibling or adjacent). That means we will always have a context.
+ */
+ if (context) {
+ return function (elem) {
+ context[0] = elem;
+ var childs = adapter.getChildren(elem);
+ var nextElements = shouldTestNextSiblings
+ ? __spreadArray(__spreadArray([], childs, true), getNextSiblings(elem, adapter), true) : childs;
+ return (next(elem) && adapter.existsOne(hasElement, nextElements));
+ };
+ }
+ return function (elem) {
+ return next(elem) &&
+ adapter.existsOne(hasElement, adapter.getChildren(elem));
+ };
+ },
+};
diff --git a/node_modules/css-select/lib/sort.d.ts b/node_modules/css-select/lib/sort.d.ts
new file mode 100644
index 0000000..d5b9c6e
--- /dev/null
+++ b/node_modules/css-select/lib/sort.d.ts
@@ -0,0 +1,10 @@
+import type { InternalSelector } from "./types";
+/**
+ * Sort the parts of the passed selector,
+ * as there is potential for optimization
+ * (some types of selectors are faster than others)
+ *
+ * @param arr Selector to sort
+ */
+export default function sortByProcedure(arr: InternalSelector[]): void;
+//# sourceMappingURL=sort.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/sort.d.ts.map b/node_modules/css-select/lib/sort.d.ts.map
new file mode 100644
index 0000000..f55e27b
--- /dev/null
+++ b/node_modules/css-select/lib/sort.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAehD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAerE"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/sort.js b/node_modules/css-select/lib/sort.js
new file mode 100644
index 0000000..ae01830
--- /dev/null
+++ b/node_modules/css-select/lib/sort.js
@@ -0,0 +1,84 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var procedure_1 = require("./procedure");
+var attributes = {
+ exists: 10,
+ equals: 8,
+ not: 7,
+ start: 6,
+ end: 6,
+ any: 5,
+ hyphen: 4,
+ element: 4,
+};
+/**
+ * Sort the parts of the passed selector,
+ * as there is potential for optimization
+ * (some types of selectors are faster than others)
+ *
+ * @param arr Selector to sort
+ */
+function sortByProcedure(arr) {
+ var procs = arr.map(getProcedure);
+ for (var i = 1; i < arr.length; i++) {
+ var procNew = procs[i];
+ if (procNew < 0)
+ continue;
+ for (var j = i - 1; j >= 0 && procNew < procs[j]; j--) {
+ var token = arr[j + 1];
+ arr[j + 1] = arr[j];
+ arr[j] = token;
+ procs[j + 1] = procs[j];
+ procs[j] = procNew;
+ }
+ }
+}
+exports.default = sortByProcedure;
+function getProcedure(token) {
+ var proc = procedure_1.procedure[token.type];
+ if (token.type === "attribute") {
+ proc = attributes[token.action];
+ if (proc === attributes.equals && token.name === "id") {
+ // Prefer ID selectors (eg. #ID)
+ proc = 9;
+ }
+ if (token.ignoreCase) {
+ /*
+ * IgnoreCase adds some overhead, prefer "normal" token
+ * this is a binary operation, to ensure it's still an int
+ */
+ proc >>= 1;
+ }
+ }
+ else if (token.type === "pseudo") {
+ if (!token.data) {
+ proc = 3;
+ }
+ else if (token.name === "has" || token.name === "contains") {
+ proc = 0; // Expensive in any case
+ }
+ else if (Array.isArray(token.data)) {
+ // "matches" and "not"
+ proc = 0;
+ for (var i = 0; i < token.data.length; i++) {
+ // TODO better handling of complex selectors
+ if (token.data[i].length !== 1)
+ continue;
+ var cur = getProcedure(token.data[i][0]);
+ // Avoid executing :has or :contains
+ if (cur === 0) {
+ proc = 0;
+ break;
+ }
+ if (cur > proc)
+ proc = cur;
+ }
+ if (token.data.length > 1 && proc > 0)
+ proc -= 1;
+ }
+ else {
+ proc = 1;
+ }
+ }
+ return proc;
+}
diff --git a/node_modules/css-select/lib/types.d.ts b/node_modules/css-select/lib/types.d.ts
new file mode 100644
index 0000000..814f288
--- /dev/null
+++ b/node_modules/css-select/lib/types.d.ts
@@ -0,0 +1,120 @@
+import type { Selector } from "css-what";
+export declare type InternalSelector = Selector | {
+ type: "_flexibleDescendant";
+};
+export declare type Predicate<Value> = (v: Value) => boolean;
+export interface Adapter<Node, ElementNode extends Node> {
+ /**
+ * Is the node a tag?
+ */
+ isTag: (node: Node) => node is ElementNode;
+ /**
+ * Does at least one of passed element nodes pass the test predicate?
+ */
+ existsOne: (test: Predicate<ElementNode>, elems: Node[]) => boolean;
+ /**
+ * Get the attribute value.
+ */
+ getAttributeValue: (elem: ElementNode, name: string) => string | undefined;
+ /**
+ * Get the node's children
+ */
+ getChildren: (node: Node) => Node[];
+ /**
+ * Get the name of the tag
+ */
+ getName: (elem: ElementNode) => string;
+ /**
+ * Get the parent of the node
+ */
+ getParent: (node: ElementNode) => ElementNode | null;
+ /**
+ * Get the siblings of the node. Note that unlike jQuery's `siblings` method,
+ * this is expected to include the current node as well
+ */
+ getSiblings: (node: Node) => Node[];
+ /**
+ * Get the text content of the node, and its children if it has any.
+ */
+ getText: (node: Node) => string;
+ /**
+ * Does the element have the named attribute?
+ */
+ hasAttrib: (elem: ElementNode, name: string) => boolean;
+ /**
+ * Takes an array of nodes, and removes any duplicates, as well as any
+ * nodes whose ancestors are also in the array.
+ */
+ removeSubsets: (nodes: Node[]) => Node[];
+ /**
+ * Finds all of the element nodes in the array that match the test predicate,
+ * as well as any of their children that match it.
+ */
+ findAll: (test: Predicate<ElementNode>, nodes: Node[]) => ElementNode[];
+ /**
+ * Finds the first node in the array that matches the test predicate, or one
+ * of its children.
+ */
+ findOne: (test: Predicate<ElementNode>, elems: Node[]) => ElementNode | null;
+ /**
+ * The adapter can also optionally include an equals method, if your DOM
+ * structure needs a custom equality test to compare two objects which refer
+ * to the same underlying node. If not provided, `css-select` will fall back to
+ * `a === b`.
+ */
+ equals?: (a: Node, b: Node) => boolean;
+ /**
+ * Is the element in hovered state?
+ */
+ isHovered?: (elem: ElementNode) => boolean;
+ /**
+ * Is the element in visited state?
+ */
+ isVisited?: (elem: ElementNode) => boolean;
+ /**
+ * Is the element in active state?
+ */
+ isActive?: (elem: ElementNode) => boolean;
+}
+export interface Options<Node, ElementNode extends Node> {
+ /**
+ * When enabled, tag names will be case-sensitive.
+ *
+ * @default false
+ */
+ xmlMode?: boolean;
+ /**
+ * The last function in the stack, will be called with the last element
+ * that's looked at.
+ */
+ rootFunc?: (element: ElementNode) => boolean;
+ /**
+ * The adapter to use when interacting with the backing DOM structure. By
+ * default it uses the `domutils` module.
+ */
+ adapter?: Adapter<Node, ElementNode>;
+ /**
+ * The context of the current query. Used to limit the scope of searches.
+ * Can be matched directly using the `:scope` pseudo-selector.
+ */
+ context?: Node | Node[];
+ /**
+ * Allow css-select to cache results for some selectors, sometimes greatly
+ * improving querying performance. Disable this if your document can
+ * change in between queries with the same compiled selector.
+ *
+ * @default true
+ */
+ cacheResults?: boolean;
+}
+export interface InternalOptions<Node, ElementNode extends Node> extends Options<Node, ElementNode> {
+ adapter: Adapter<Node, ElementNode>;
+ equals: (a: Node, b: Node) => boolean;
+}
+export interface CompiledQuery<ElementNode> {
+ (node: ElementNode): boolean;
+ shouldTestNextSiblings?: boolean;
+}
+export declare type Query<ElementNode> = string | CompiledQuery<ElementNode> | Selector[][];
+export declare type CompileToken<Node, ElementNode extends Node> = (token: InternalSelector[][], options: InternalOptions<Node, ElementNode>, context?: Node[] | Node) => CompiledQuery<ElementNode>;
+//# sourceMappingURL=types.d.ts.map \ No newline at end of file
diff --git a/node_modules/css-select/lib/types.d.ts.map b/node_modules/css-select/lib/types.d.ts.map
new file mode 100644
index 0000000..882f659
--- /dev/null
+++ b/node_modules/css-select/lib/types.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,oBAAY,gBAAgB,GAAG,QAAQ,GAAG;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAE1E,oBAAY,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK,OAAO,CAAC;AACrD,MAAM,WAAW,OAAO,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI;IACnD;;OAEG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,IAAI,WAAW,CAAC;IAE3C;;OAEG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC;IAEpE;;OAEG;IACH,iBAAiB,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAE3E;;OAEG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC;IAEpC;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,MAAM,CAAC;IAEvC;;OAEG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,WAAW,GAAG,IAAI,CAAC;IAErD;;;OAGG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC;IAEpC;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAExD;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;IAEzC;;;OAGG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,CAAC;IAExE;;;OAGG;IACH,OAAO,EAAE,CACL,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC,EAC5B,KAAK,EAAE,IAAI,EAAE,KACZ,WAAW,GAAG,IAAI,CAAC;IAExB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC;IAEvC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC;IAE3C;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC;IAE3C;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC;CAC7C;AAED,MAAM,WAAW,OAAO,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI;IACnD;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;IACxB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAGD,MAAM,WAAW,eAAe,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,CAC3D,SAAQ,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC;CACzC;AAED,MAAM,WAAW,aAAa,CAAC,WAAW;IACtC,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC;AACD,oBAAY,KAAK,CAAC,WAAW,IACvB,MAAM,GACN,aAAa,CAAC,WAAW,CAAC,GAC1B,QAAQ,EAAE,EAAE,CAAC;AACnB,oBAAY,YAAY,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,IAAI,CACvD,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAC3B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,KACtB,aAAa,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file
diff --git a/node_modules/css-select/lib/types.js b/node_modules/css-select/lib/types.js
new file mode 100644
index 0000000..c8ad2e5
--- /dev/null
+++ b/node_modules/css-select/lib/types.js
@@ -0,0 +1,2 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });