diff --git a/action.yml b/action.yml index aaa658850..f0bd0f1f5 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,7 @@ author: "platane" runs: using: docker - image: docker://platane/snk@sha256:e40bb02de6ed0f164eca8586b3f6c32109b2bcb426cd57c6882764825b40fe0d + image: docker://platane/snk@sha256:3169a2e4a5b5181c203ae18e7075d0d92be88a0cdeabce6c3221288ef6a17675 inputs: github_user_name: diff --git a/package.json b/package.json index 01c221e9d..24df46450 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "snk", "description": "Generates a snake game from a github user contributions grid", - "version": "2.0.0-rc.3", + "version": "2.0.0", "private": true, "repository": "github:platane/snk", "devDependencies": { diff --git a/svg-only/dist/index.js b/svg-only/dist/index.js index a30447ab4..29e6e6163 100644 --- a/svg-only/dist/index.js +++ b/svg-only/dist/index.js @@ -1341,20 +1341,6 @@ function range(a, b, str) { } -/***/ }), - -/***/ 6288: -/***/ ((module) => { - -module.exports = { - trueFunc: function trueFunc(){ - return true; - }, - falseFunc: function falseFunc(){ - return false; - } -}; - /***/ }), /***/ 3197: @@ -1565,25741 +1551,6069 @@ function expand(str, isTop) { /***/ }), -/***/ 9933: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; +/***/ 4527: +/***/ ((module) => { -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.groupSelectors = exports.getDocumentRoot = void 0; -var positionals_1 = __webpack_require__(2326); -function getDocumentRoot(node) { - while (node.parent) - node = node.parent; - return node; -} -exports.getDocumentRoot = getDocumentRoot; -function groupSelectors(selectors) { - var filteredSelectors = []; - var plainSelectors = []; - for (var _i = 0, selectors_1 = selectors; _i < selectors_1.length; _i++) { - var selector = selectors_1[_i]; - if (selector.some(positionals_1.isFilter)) { - filteredSelectors.push(selector); - } - else { - plainSelectors.push(selector); - } +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); } - return [plainSelectors, filteredSelectors]; -} -exports.groupSelectors = groupSelectors; + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; /***/ }), -/***/ 3470: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/***/ 8945: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -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; -}; -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.select = exports.filter = exports.some = exports.is = exports.aliases = exports.pseudos = exports.filters = void 0; -var css_what_1 = __webpack_require__(8934); -var css_select_1 = __webpack_require__(339); -var DomUtils = __importStar(__webpack_require__(31)); -var helpers_1 = __webpack_require__(9933); -var positionals_1 = __webpack_require__(2326); -// Re-export pseudo extension points -var css_select_2 = __webpack_require__(339); -Object.defineProperty(exports, "filters", ({ enumerable: true, get: function () { return css_select_2.filters; } })); -Object.defineProperty(exports, "pseudos", ({ enumerable: true, get: function () { return css_select_2.pseudos; } })); -Object.defineProperty(exports, "aliases", ({ enumerable: true, get: function () { return css_select_2.aliases; } })); -/** Used to indicate a scope should be filtered. Might be ignored when filtering. */ -var SCOPE_PSEUDO = { - type: "pseudo", - name: "scope", - data: null, -}; -/** Used for actually filtering for scope. */ -var CUSTOM_SCOPE_PSEUDO = __assign({}, SCOPE_PSEUDO); -var UNIVERSAL_SELECTOR = { type: "universal", namespace: null }; -function is(element, selector, options) { - if (options === void 0) { options = {}; } - return some([element], selector, options); -} -exports.is = is; -function some(elements, selector, options) { - if (options === void 0) { options = {}; } - if (typeof selector === "function") - return elements.some(selector); - var _a = helpers_1.groupSelectors(css_what_1.parse(selector, options)), plain = _a[0], filtered = _a[1]; - return ((plain.length > 0 && elements.some(css_select_1._compileToken(plain, options))) || - filtered.some(function (sel) { return filterBySelector(sel, elements, options).length > 0; })); -} -exports.some = some; -function filterByPosition(filter, elems, data, options) { - var num = typeof data === "string" ? parseInt(data, 10) : NaN; - switch (filter) { - case "first": - case "lt": - // Already done in `getLimit` - return elems; - case "last": - return elems.length > 0 ? [elems[elems.length - 1]] : elems; - case "nth": - case "eq": - return isFinite(num) && Math.abs(num) < elems.length - ? [num < 0 ? elems[elems.length + num] : elems[num]] - : []; - case "gt": - return isFinite(num) ? elems.slice(num + 1) : []; - case "even": - return elems.filter(function (_, i) { return i % 2 === 0; }); - case "odd": - return elems.filter(function (_, i) { return i % 2 === 1; }); - case "not": { - var filtered_1 = new Set(filterParsed(data, elems, options)); - return elems.filter(function (e) { return !filtered_1.has(e); }); - } - } -} -function filter(selector, elements, options) { - if (options === void 0) { options = {}; } - return filterParsed(css_what_1.parse(selector, options), elements, options); -} -exports.filter = filter; -/** - * Filter a set of elements by a selector. - * - * Will return elements in the original order. - * - * @param selector Selector to filter by. - * @param elements Elements to filter. - * @param options Options for selector. - */ -function filterParsed(selector, elements, options) { - if (elements.length === 0) - return []; - var _a = helpers_1.groupSelectors(selector), plainSelectors = _a[0], filteredSelectors = _a[1]; - var found; - if (plainSelectors.length) { - var filtered = filterElements(elements, plainSelectors, options); - // If there are no filters, just return - if (filteredSelectors.length === 0) { - return filtered; - } - // Otherwise, we have to do some filtering - if (filtered.length) { - found = new Set(filtered); - } - } - for (var i = 0; i < filteredSelectors.length && (found === null || found === void 0 ? void 0 : found.size) !== elements.length; i++) { - var filteredSelector = filteredSelectors[i]; - var missing = found - ? elements.filter(function (e) { return DomUtils.isTag(e) && !found.has(e); }) - : elements; - if (missing.length === 0) - break; - var filtered = filterBySelector(filteredSelector, elements, options); - if (filtered.length) { - if (!found) { - /* - * If we haven't found anything before the last selector, - * just return what we found now. - */ - if (i === filteredSelectors.length - 1) { - return filtered; - } - found = new Set(filtered); - } - else { - filtered.forEach(function (el) { return found.add(el); }); - } - } - } - return typeof found !== "undefined" - ? (found.size === elements.length - ? elements - : // Filter elements to preserve order - elements.filter(function (el) { - return found.has(el); - })) - : []; +var fs = __webpack_require__(5747) +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = __webpack_require__(4403) + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) } -function filterBySelector(selector, elements, options) { - var _a; - if (selector.some(css_what_1.isTraversal)) { - /* - * Get root node, run selector with the scope - * set to all of our nodes. - */ - var root = (_a = options.root) !== null && _a !== void 0 ? _a : helpers_1.getDocumentRoot(elements[0]); - var sel = __spreadArray(__spreadArray([], selector), [CUSTOM_SCOPE_PSEUDO]); - return findFilterElements(root, sel, options, true, elements); - } - // Performance optimization: If we don't have to traverse, just filter set. - return findFilterElements(elements, selector, options, false); -} -function select(selector, root, options) { - if (options === void 0) { options = {}; } - if (typeof selector === "function") { - return find(root, selector); + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) } - var _a = helpers_1.groupSelectors(css_what_1.parse(selector, options)), plain = _a[0], filtered = _a[1]; - var results = filtered.map(function (sel) { - return findFilterElements(root, sel, options, true); - }); - // Plain selectors can be queried in a single go - if (plain.length) { - results.push(findElements(root, plain, options, Infinity)); - } - // If there was only a single selector, just return the result - if (results.length === 1) { - return results[0]; - } - // Sort results, filtering for duplicates - return DomUtils.uniqueSort(results.reduce(function (a, b) { return __spreadArray(__spreadArray([], a), b); })); -} -exports.select = select; -// Traversals that are treated differently in css-select. -var specialTraversal = new Set(["descendant", "adjacent"]); -function includesScopePseudo(t) { - return (t !== SCOPE_PSEUDO && - t.type === "pseudo" && - (t.name === "scope" || - (Array.isArray(t.data) && - t.data.some(function (data) { return data.some(includesScopePseudo); })))); -} -function addContextIfScope(selector, options, scopeContext) { - return scopeContext && selector.some(includesScopePseudo) - ? __assign(__assign({}, options), { context: scopeContext }) : options; + }) } -/** - * - * @param root Element(s) to search from. - * @param selector Selector to look for. - * @param options Options for querying. - * @param queryForSelector Query multiple levels deep for the initial selector, even if it doesn't contain a traversal. - * @param scopeContext Optional context for a :scope. - */ -function findFilterElements(root, selector, options, queryForSelector, scopeContext) { - var filterIndex = selector.findIndex(positionals_1.isFilter); - var sub = selector.slice(0, filterIndex); - var filter = selector[filterIndex]; - /* - * Set the number of elements to retrieve. - * Eg. for :first, we only have to get a single element. - */ - var limit = positionals_1.getLimit(filter.name, filter.data); - if (limit === 0) - return []; - var subOpts = addContextIfScope(sub, options, scopeContext); - /* - * Skip `findElements` call if our selector starts with a positional - * pseudo. - */ - var elemsNoLimit = sub.length === 0 && !Array.isArray(root) - ? DomUtils.getChildren(root).filter(DomUtils.isTag) - : sub.length === 0 || (sub.length === 1 && sub[0] === SCOPE_PSEUDO) - ? (Array.isArray(root) ? root : [root]).filter(DomUtils.isTag) - : queryForSelector || sub.some(css_what_1.isTraversal) - ? findElements(root, [sub], subOpts, limit) - : filterElements(root, [sub], subOpts); - var elems = elemsNoLimit.slice(0, limit); - var result = filterByPosition(filter.name, elems, filter.data, options); - if (result.length === 0 || selector.length === filterIndex + 1) { - return result; + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er } - var remainingSelector = selector.slice(filterIndex + 1); - var remainingHasTraversal = remainingSelector.some(css_what_1.isTraversal); - var remainingOpts = addContextIfScope(remainingSelector, options, scopeContext); - if (remainingHasTraversal) { - /* - * Some types of traversals have special logic when they start a selector - * in css-select. If this is the case, add a universal selector in front of - * the selector to avoid this behavior. - */ - if (specialTraversal.has(remainingSelector[0].type)) { - remainingSelector.unshift(UNIVERSAL_SELECTOR); - } - /* - * Add a scope token in front of the remaining selector, - * to make sure traversals don't match elements that aren't a - * part of the considered tree. - */ - remainingSelector.unshift(SCOPE_PSEUDO); - } - /* - * If we have another filter, recursively call `findFilterElements`, - * with the `recursive` flag disabled. We only have to look for more - * elements when we see a traversal. - * - * Otherwise, - */ - return remainingSelector.some(positionals_1.isFilter) - ? findFilterElements(result, remainingSelector, options, false, scopeContext) - : remainingHasTraversal - ? // Query existing elements to resolve traversal. - findElements(result, [remainingSelector], remainingOpts, Infinity) - : // If we don't have any more traversals, simply filter elements. - filterElements(result, [remainingSelector], remainingOpts); -} -function findElements(root, sel, options, limit) { - if (limit === 0) - return []; - var query = css_select_1._compileToken(sel, options, root); - return find(root, query, limit); + } } -function find(root, query, limit) { - if (limit === void 0) { limit = Infinity; } - var elems = css_select_1.prepareContext(root, DomUtils, query.shouldTestNextSiblings); - return DomUtils.find(function (node) { return DomUtils.isTag(node) && query(node); }, elems, true, limit); + +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync } -function filterElements(elements, sel, options) { - var els = (Array.isArray(elements) ? elements : [elements]).filter(DomUtils.isTag); - if (els.length === 0) - return els; - var query = css_select_1._compileToken(sel, options); - return els.filter(query); + +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync } /***/ }), -/***/ 2326: -/***/ ((__unused_webpack_module, exports) => { +/***/ 4403: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getLimit = exports.isFilter = exports.filterNames = void 0; -exports.filterNames = new Set([ - "first", - "last", - "eq", - "gt", - "nth", - "lt", - "even", - "odd", -]); -function isFilter(s) { - if (s.type !== "pseudo") - return false; - if (exports.filterNames.has(s.name)) - return true; - if (s.name === "not" && Array.isArray(s.data)) { - // Only consider `:not` with embedded filters - return s.data.some(function (s) { return s.some(isFilter); }); - } - return false; -} -exports.isFilter = isFilter; -function getLimit(filter, data) { - var num = data != null ? parseInt(data, 10) : NaN; - switch (filter) { - case "first": - return 1; - case "nth": - case "eq": - return isFinite(num) ? (num >= 0 ? num + 1 : Infinity) : 0; - case "lt": - return isFinite(num) ? (num >= 0 ? num : Infinity) : 0; - case "gt": - return isFinite(num) ? Infinity : 0; - default: - return Infinity; - } -} -exports.getLimit = getLimit; +var pathModule = __webpack_require__(5622); +var isWindows = process.platform === 'win32'; +var fs = __webpack_require__(5747); +// JavaScript implementation of realpath, ported from node pre-v6 -/***/ }), +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); -/***/ 3363: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; -"use strict"; + return callback; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getFeed = void 0; -var stringify_1 = __webpack_require__(4113); -var legacy_1 = __webpack_require__(4828); -/** - * Get the feed object from the root of a DOM tree. - * - * @param doc - The DOM to to extract the feed from. - * @returns The feed. - */ -function getFeed(doc) { - var feedRoot = getOneElement(isValidFeed, doc); - return !feedRoot - ? null - : feedRoot.name === "feed" - ? getAtomFeed(feedRoot) - : getRssFeed(feedRoot); -} -exports.getFeed = getFeed; -/** - * Parse an Atom feed. - * - * @param feedRoot The root of the feed. - * @returns The parsed feed. - */ -function getAtomFeed(feedRoot) { - var _a; - var childs = feedRoot.children; - var feed = { - type: "atom", - items: (0, legacy_1.getElementsByTagName)("entry", childs).map(function (item) { - var _a; - var children = item.children; - var entry = { media: getMediaElements(children) }; - addConditionally(entry, "id", "id", children); - addConditionally(entry, "title", "title", children); - var href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs.href; - if (href) { - entry.link = href; - } - var description = fetch("summary", children) || fetch("content", children); - if (description) { - entry.description = description; - } - var pubDate = fetch("updated", children); - if (pubDate) { - entry.pubDate = new Date(pubDate); - } - return entry; - }), - }; - addConditionally(feed, "id", "id", childs); - addConditionally(feed, "title", "title", childs); - var href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs.href; - if (href) { - feed.link = href; + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); } - addConditionally(feed, "description", "subtitle", childs); - var updated = fetch("updated", childs); - if (updated) { - feed.updated = new Date(updated); + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } } - addConditionally(feed, "author", "email", childs, true); - return feed; + } } -/** - * Parse a RSS feed. - * - * @param feedRoot The root of the feed. - * @returns The parsed feed. - */ -function getRssFeed(feedRoot) { - var _a, _b; - var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []; - var feed = { - type: feedRoot.name.substr(0, 3), - id: "", - items: (0, legacy_1.getElementsByTagName)("item", feedRoot.children).map(function (item) { - var children = item.children; - var entry = { media: getMediaElements(children) }; - addConditionally(entry, "id", "guid", children); - addConditionally(entry, "title", "title", children); - addConditionally(entry, "link", "link", children); - addConditionally(entry, "description", "description", children); - var pubDate = fetch("pubDate", children); - if (pubDate) - entry.pubDate = new Date(pubDate); - return entry; - }), - }; - addConditionally(feed, "title", "title", childs); - addConditionally(feed, "link", "link", childs); - addConditionally(feed, "description", "description", childs); - var updated = fetch("lastBuildDate", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally(feed, "author", "managingEditor", childs, true); - return feed; -} -var MEDIA_KEYS_STRING = ["url", "type", "lang"]; -var MEDIA_KEYS_INT = [ - "fileSize", - "bitrate", - "framerate", - "samplingrate", - "channels", - "duration", - "height", - "width", -]; -/** - * Get all media elements of a feed item. - * - * @param where Nodes to search in. - * @returns Media elements. - */ -function getMediaElements(where) { - return (0, legacy_1.getElementsByTagName)("media:content", where).map(function (elem) { - var attribs = elem.attribs; - var media = { - medium: attribs.medium, - isDefault: !!attribs.isDefault, - }; - for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING; _i < MEDIA_KEYS_STRING_1.length; _i++) { - var attrib = MEDIA_KEYS_STRING_1[_i]; - if (attribs[attrib]) { - media[attrib] = attribs[attrib]; - } - } - for (var _a = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT; _a < MEDIA_KEYS_INT_1.length; _a++) { - var attrib = MEDIA_KEYS_INT_1[_a]; - if (attribs[attrib]) { - media[attrib] = parseInt(attribs[attrib], 10); - } - } - if (attribs.expression) { - media.expression = - attribs.expression; - } - return media; - }); -} -/** - * Get one element by tag name. - * - * @param tagName Tag name to look for - * @param node Node to search in - * @returns The element or null - */ -function getOneElement(tagName, node) { - return (0, legacy_1.getElementsByTagName)(tagName, node, true, 1)[0]; -} -/** - * Get the text content of an element with a certain tag name. - * - * @param tagName Tag name to look for. - * @param where Node to search in. - * @param recurse Whether to recurse into child nodes. - * @returns The text content of the element. - */ -function fetch(tagName, where, recurse) { - if (recurse === void 0) { recurse = false; } - return (0, stringify_1.textContent)((0, legacy_1.getElementsByTagName)(tagName, where, recurse, 1)).trim(); + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); } -/** - * Adds a property to an object if it has a value. - * - * @param obj Object to be extended - * @param prop Property name - * @param tagName Tag name that contains the conditionally added property - * @param where Element to search for the property - * @param recurse Whether to recurse into child nodes. - */ -function addConditionally(obj, prop, tagName, where, recurse) { - if (recurse === void 0) { recurse = false; } - var val = fetch(tagName, where, recurse); - if (val) - obj[prop] = val; + +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; } -/** - * Checks if an element is a feed root node. - * - * @param value The name of the element to check. - * @returns Whether an element is a feed root node. - */ -function isValidFeed(value) { - return value === "rss" || value === "feed" || value === "rdf:RDF"; + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; } +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); -/***/ }), + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } -/***/ 7025: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + var original = p, + seenLinks = {}, + knownHard = {}; -"use strict"; + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.uniqueSort = exports.compareDocumentPosition = exports.removeSubsets = void 0; -var domhandler_1 = __webpack_require__(7366); -/** - * Given an array of nodes, remove any member that is contained by another. - * - * @param nodes Nodes to filter. - * @returns Remaining nodes that aren't subtrees of each other. - */ -function removeSubsets(nodes) { - var idx = nodes.length; - /* - * Check if each node (or one of its ancestors) is already contained in the - * array. - */ - while (--idx >= 0) { - var node = nodes[idx]; - /* - * Remove the node if it is not unique. - * We are going through the array from the end, so we only - * have to check nodes that preceed the node under consideration in the array. - */ - if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) { - nodes.splice(idx, 1); - continue; - } - for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) { - if (nodes.includes(ancestor)) { - nodes.splice(idx, 1); - break; - } - } - } - return nodes; -} -exports.removeSubsets = removeSubsets; -/** - * Compare the position of one node against another node in any other document. - * The return value is a bitmask with the following values: - * - * Document order: - * > There is an ordering, document order, defined on all the nodes in the - * > document corresponding to the order in which the first character of the - * > XML representation of each node occurs in the XML representation of the - * > document after expansion of general entities. Thus, the document element - * > node will be the first node. Element nodes occur before their children. - * > Thus, document order orders element nodes in order of the occurrence of - * > their start-tag in the XML (after expansion of entities). The attribute - * > nodes of an element occur after the element and before its children. The - * > relative order of attribute nodes is implementation-dependent./ - * - * Source: - * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order - * - * @param nodeA The first node to use in the comparison - * @param nodeB The second node to use in the comparison - * @returns A bitmask describing the input nodes' relative position. - * - * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for - * a description of these values. - */ -function compareDocumentPosition(nodeA, nodeB) { - var aParents = []; - var bParents = []; - if (nodeA === nodeB) { - return 0; - } - var current = (0, domhandler_1.hasChildren)(nodeA) ? nodeA : nodeA.parent; - while (current) { - aParents.unshift(current); - current = current.parent; - } - current = (0, domhandler_1.hasChildren)(nodeB) ? nodeB : nodeB.parent; - while (current) { - bParents.unshift(current); - current = current.parent; - } - var maxIdx = Math.min(aParents.length, bParents.length); - var idx = 0; - while (idx < maxIdx && aParents[idx] === bParents[idx]) { - idx++; - } - if (idx === 0) { - return 1 /* DISCONNECTED */; - } - var sharedParent = aParents[idx - 1]; - var siblings = sharedParent.children; - var aSibling = aParents[idx]; - var bSibling = bParents[idx]; - if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { - if (sharedParent === nodeB) { - return 4 /* FOLLOWING */ | 16 /* CONTAINED_BY */; - } - return 4 /* FOLLOWING */; + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; } - if (sharedParent === nodeA) { - return 2 /* PRECEDING */ | 8 /* CONTAINS */; + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; } - return 2 /* PRECEDING */; -} -exports.compareDocumentPosition = compareDocumentPosition; -/** - * Sort an array of nodes based on their relative position in the document and - * remove any duplicate nodes. If the array contains nodes that do not belong - * to the same document, sort order is unspecified. - * - * @param nodes Array of DOM nodes. - * @returns Collection of unique nodes, sorted in document order. - */ -function uniqueSort(nodes) { - nodes = nodes.filter(function (node, i, arr) { return !arr.includes(node, i + 1); }); - nodes.sort(function (a, b) { - var relative = compareDocumentPosition(a, b); - if (relative & 2 /* PRECEDING */) { - return -1; - } - else if (relative & 4 /* FOLLOWING */) { - return 1; - } - return 0; - }); - return nodes; -} -exports.uniqueSort = uniqueSort; + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } -/***/ }), + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } -/***/ 31: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } -"use strict"; + if (cache) cache[original] = p; -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 __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); + return p; }; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.hasChildren = exports.isDocument = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = void 0; -__exportStar(__webpack_require__(4113), exports); -__exportStar(__webpack_require__(3362), exports); -__exportStar(__webpack_require__(6262), exports); -__exportStar(__webpack_require__(4789), exports); -__exportStar(__webpack_require__(4828), exports); -__exportStar(__webpack_require__(7025), exports); -__exportStar(__webpack_require__(3363), exports); -/** @deprecated Use these methods from `domhandler` directly. */ -var domhandler_1 = __webpack_require__(7366); -Object.defineProperty(exports, "isTag", ({ enumerable: true, get: function () { return domhandler_1.isTag; } })); -Object.defineProperty(exports, "isCDATA", ({ enumerable: true, get: function () { return domhandler_1.isCDATA; } })); -Object.defineProperty(exports, "isText", ({ enumerable: true, get: function () { return domhandler_1.isText; } })); -Object.defineProperty(exports, "isComment", ({ enumerable: true, get: function () { return domhandler_1.isComment; } })); -Object.defineProperty(exports, "isDocument", ({ enumerable: true, get: function () { return domhandler_1.isDocument; } })); -Object.defineProperty(exports, "hasChildren", ({ enumerable: true, get: function () { return domhandler_1.hasChildren; } })); - -/***/ }), -/***/ 4828: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } -"use strict"; + // make p is absolute + p = pathModule.resolve(p); -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getElementsByTagType = exports.getElementsByTagName = exports.getElementById = exports.getElements = exports.testElement = void 0; -var domhandler_1 = __webpack_require__(7366); -var querying_1 = __webpack_require__(4789); -var Checks = { - tag_name: function (name) { - if (typeof name === "function") { - return function (elem) { return (0, domhandler_1.isTag)(elem) && name(elem.name); }; - } - else if (name === "*") { - return domhandler_1.isTag; - } - return function (elem) { return (0, domhandler_1.isTag)(elem) && elem.name === name; }; - }, - tag_type: function (type) { - if (typeof type === "function") { - return function (elem) { return type(elem.type); }; - } - return function (elem) { return elem.type === type; }; - }, - tag_contains: function (data) { - if (typeof data === "function") { - return function (elem) { return (0, domhandler_1.isText)(elem) && data(elem.data); }; - } - return function (elem) { return (0, domhandler_1.isText)(elem) && elem.data === data; }; - }, -}; -/** - * @param attrib Attribute to check. - * @param value Attribute value to look for. - * @returns A function to check whether the a node has an attribute with a particular value. - */ -function getAttribCheck(attrib, value) { - if (typeof value === "function") { - return function (elem) { return (0, domhandler_1.isTag)(elem) && value(elem.attribs[attrib]); }; - } - return function (elem) { return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value; }; -} -/** - * @param a First function to combine. - * @param b Second function to combine. - * @returns A function taking a node and returning `true` if either - * of the input functions returns `true` for the node. - */ -function combineFuncs(a, b) { - return function (elem) { return a(elem) || b(elem); }; -} -/** - * @param options An object describing nodes to look for. - * @returns A function executing all checks in `options` and returning `true` - * if any of them match a node. - */ -function compileTest(options) { - var funcs = Object.keys(options).map(function (key) { - var value = options[key]; - return Object.prototype.hasOwnProperty.call(Checks, key) - ? Checks[key](value) - : getAttribCheck(key, value); - }); - return funcs.length === 0 ? null : funcs.reduce(combineFuncs); -} -/** - * @param options An object describing nodes to look for. - * @param node The element to test. - * @returns Whether the element matches the description in `options`. - */ -function testElement(options, node) { - var test = compileTest(options); - return test ? test(node) : true; -} -exports.testElement = testElement; -/** - * @param options An object describing nodes to look for. - * @param nodes Nodes to search through. - * @param recurse Also consider child nodes. - * @param limit Maximum number of nodes to return. - * @returns All nodes that match `options`. - */ -function getElements(options, nodes, recurse, limit) { - if (limit === void 0) { limit = Infinity; } - var test = compileTest(options); - return test ? (0, querying_1.filter)(test, nodes, recurse, limit) : []; -} -exports.getElements = getElements; -/** - * @param id The unique ID attribute value to look for. - * @param nodes Nodes to search through. - * @param recurse Also consider child nodes. - * @returns The node with the supplied ID. - */ -function getElementById(id, nodes, recurse) { - if (recurse === void 0) { recurse = true; } - if (!Array.isArray(nodes)) - nodes = [nodes]; - return (0, querying_1.findOne)(getAttribCheck("id", id), nodes, recurse); -} -exports.getElementById = getElementById; -/** - * @param tagName Tag name to search for. - * @param nodes Nodes to search through. - * @param recurse Also consider child nodes. - * @param limit Maximum number of nodes to return. - * @returns All nodes with the supplied `tagName`. - */ -function getElementsByTagName(tagName, nodes, recurse, limit) { - if (recurse === void 0) { recurse = true; } - if (limit === void 0) { limit = Infinity; } - return (0, querying_1.filter)(Checks.tag_name(tagName), nodes, recurse, limit); -} -exports.getElementsByTagName = getElementsByTagName; -/** - * @param type Element type to look for. - * @param nodes Nodes to search through. - * @param recurse Also consider child nodes. - * @param limit Maximum number of nodes to return. - * @returns All nodes with the supplied `type`. - */ -function getElementsByTagType(type, nodes, recurse, limit) { - if (recurse === void 0) { recurse = true; } - if (limit === void 0) { limit = Infinity; } - return (0, querying_1.filter)(Checks.tag_type(type), nodes, recurse, limit); -} -exports.getElementsByTagType = getElementsByTagType; + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + var original = p, + seenLinks = {}, + knownHard = {}; -/***/ }), + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; -/***/ 6262: -/***/ ((__unused_webpack_module, exports) => { + start(); -"use strict"; + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.prepend = exports.prependChild = exports.append = exports.appendChild = exports.replaceElement = exports.removeElement = void 0; -/** - * Remove an element from the dom - * - * @param elem The element to be removed - */ -function removeElement(elem) { - if (elem.prev) - elem.prev.next = elem.next; - if (elem.next) - elem.next.prev = elem.prev; - if (elem.parent) { - var childs = elem.parent.children; - childs.splice(childs.lastIndexOf(elem), 1); - } -} -exports.removeElement = removeElement; -/** - * Replace an element in the dom - * - * @param elem The element to be replaced - * @param replacement The element to be added - */ -function replaceElement(elem, replacement) { - var prev = (replacement.prev = elem.prev); - if (prev) { - prev.next = replacement; + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); } - var next = (replacement.next = elem.next); - if (next) { - next.prev = replacement; - } - var parent = (replacement.parent = elem.parent); - if (parent) { - var childs = parent.children; - childs[childs.lastIndexOf(elem)] = replacement; - } -} -exports.replaceElement = replaceElement; -/** - * Append a child to an element. - * - * @param elem The element to append to. - * @param child The element to be added as a child. - */ -function appendChild(elem, child) { - removeElement(child); - child.next = null; - child.parent = elem; - if (elem.children.push(child) > 1) { - var sibling = elem.children[elem.children.length - 2]; - sibling.next = child; - child.prev = sibling; - } - else { - child.prev = null; - } -} -exports.appendChild = appendChild; -/** - * Append an element after another. - * - * @param elem The element to append after. - * @param next The element be added. - */ -function append(elem, next) { - removeElement(next); - var parent = elem.parent; - var currNext = elem.next; - next.next = currNext; - next.prev = elem; - elem.next = next; - next.parent = parent; - if (currNext) { - currNext.prev = next; - if (parent) { - var childs = parent.children; - childs.splice(childs.lastIndexOf(currNext), 0, next); - } - } - else if (parent) { - parent.children.push(next); - } -} -exports.append = append; -/** - * Prepend a child to an element. - * - * @param elem The element to prepend before. - * @param child The element to be added as a child. - */ -function prependChild(elem, child) { - removeElement(child); - child.parent = elem; - child.prev = null; - if (elem.children.unshift(child) !== 1) { - var sibling = elem.children[1]; - sibling.prev = child; - child.next = sibling; - } - else { - child.next = null; - } -} -exports.prependChild = prependChild; -/** - * Prepend an element before another. - * - * @param elem The element to prepend before. - * @param prev The element be added. - */ -function prepend(elem, prev) { - removeElement(prev); - var parent = elem.parent; - if (parent) { - var childs = parent.children; - childs.splice(childs.indexOf(elem), 0, prev); - } - if (elem.prev) { - elem.prev.next = prev; + } + + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); } - prev.parent = parent; - prev.prev = elem.prev; - prev.next = elem; - elem.prev = prev; -} -exports.prepend = prepend; + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; -/***/ }), + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } -/***/ 4789: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } -"use strict"; + return fs.lstat(base, gotStat); + } -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.findAll = exports.existsOne = exports.findOne = exports.findOneChild = exports.find = exports.filter = void 0; -var domhandler_1 = __webpack_require__(7366); -/** - * Search a node and its children for nodes passing a test function. - * - * @param test Function to test nodes on. - * @param node Node to search. Will be included in the result set if it matches. - * @param recurse Also consider child nodes. - * @param limit Maximum number of nodes to return. - * @returns All nodes passing `test`. - */ -function filter(test, node, recurse, limit) { - if (recurse === void 0) { recurse = true; } - if (limit === void 0) { limit = Infinity; } - if (!Array.isArray(node)) - node = [node]; - return find(test, node, recurse, limit); -} -exports.filter = filter; -/** - * Search an array of node and its children for nodes passing a test function. - * - * @param test Function to test nodes on. - * @param nodes Array of nodes to search. - * @param recurse Also consider child nodes. - * @param limit Maximum number of nodes to return. - * @returns All nodes passing `test`. - */ -function find(test, nodes, recurse, limit) { - var result = []; - for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { - var elem = nodes_1[_i]; - if (test(elem)) { - result.push(elem); - if (--limit <= 0) - break; - } - if (recurse && (0, domhandler_1.hasChildren)(elem) && elem.children.length > 0) { - var children = find(test, elem.children, recurse, limit); - result.push.apply(result, children); - limit -= children.length; - if (limit <= 0) - break; - } - } - return result; -} -exports.find = find; -/** - * Finds the first element inside of an array that matches a test function. - * - * @param test Function to test nodes on. - * @param nodes Array of nodes to search. - * @returns The first node in the array that passes `test`. - */ -function findOneChild(test, nodes) { - return nodes.find(test); -} -exports.findOneChild = findOneChild; -/** - * Finds one element in a tree that passes a test. - * - * @param test Function to test nodes on. - * @param nodes Array of nodes to search. - * @param recurse Also consider child nodes. - * @returns The first child node that passes `test`. - */ -function findOne(test, nodes, recurse) { - if (recurse === void 0) { recurse = true; } - var elem = null; - for (var i = 0; i < nodes.length && !elem; i++) { - var checked = nodes[i]; - if (!(0, domhandler_1.isTag)(checked)) { - continue; - } - else if (test(checked)) { - elem = checked; - } - else if (recurse && checked.children.length > 0) { - elem = findOne(test, checked.children); - } - } - return elem; -} -exports.findOne = findOne; -/** - * @param test Function to test nodes on. - * @param nodes Array of nodes to search. - * @returns Whether a tree of nodes contains at least one node passing a test. - */ -function existsOne(test, nodes) { - return nodes.some(function (checked) { - return (0, domhandler_1.isTag)(checked) && - (test(checked) || - (checked.children.length > 0 && - existsOne(test, checked.children))); - }); -} -exports.existsOne = existsOne; -/** - * Search and array of nodes and its children for nodes passing a test function. - * - * Same as `find`, only with less options, leading to reduced complexity. - * - * @param test Function to test nodes on. - * @param nodes Array of nodes to search. - * @returns All nodes passing `test`. - */ -function findAll(test, nodes) { - var _a; - var result = []; - var stack = nodes.filter(domhandler_1.isTag); - var elem; - while ((elem = stack.shift())) { - var children = (_a = elem.children) === null || _a === void 0 ? void 0 : _a.filter(domhandler_1.isTag); - if (children && children.length > 0) { - stack.unshift.apply(stack, children); - } - if (test(elem)) - result.push(elem); + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); } - return result; -} -exports.findAll = findAll; + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); -/***/ }), + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } -/***/ 4113: -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + function gotTarget(err, target, base) { + if (err) return cb(err); -"use strict"; + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } }; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.innerText = exports.textContent = exports.getText = exports.getInnerHTML = exports.getOuterHTML = void 0; -var domhandler_1 = __webpack_require__(7366); -var dom_serializer_1 = __importDefault(__webpack_require__(9312)); -var domelementtype_1 = __webpack_require__(2795); -/** - * @param node Node to get the outer HTML of. - * @param options Options for serialization. - * @deprecated Use the `dom-serializer` module directly. - * @returns `node`'s outer HTML. - */ -function getOuterHTML(node, options) { - return (0, dom_serializer_1.default)(node, options); -} -exports.getOuterHTML = getOuterHTML; -/** - * @param node Node to get the inner HTML of. - * @param options Options for serialization. - * @deprecated Use the `dom-serializer` module directly. - * @returns `node`'s inner HTML. - */ -function getInnerHTML(node, options) { - return (0, domhandler_1.hasChildren)(node) - ? node.children.map(function (node) { return getOuterHTML(node, options); }).join("") - : ""; -} -exports.getInnerHTML = getInnerHTML; -/** - * Get a node's inner text. Same as `textContent`, but inserts newlines for `
` tags. - * - * @deprecated Use `textContent` instead. - * @param node Node to get the inner text of. - * @returns `node`'s inner text. - */ -function getText(node) { - if (Array.isArray(node)) - return node.map(getText).join(""); - if ((0, domhandler_1.isTag)(node)) - return node.name === "br" ? "\n" : getText(node.children); - if ((0, domhandler_1.isCDATA)(node)) - return getText(node.children); - if ((0, domhandler_1.isText)(node)) - return node.data; - return ""; -} -exports.getText = getText; -/** - * Get a node's text content. - * - * @param node Node to get the text content of. - * @returns `node`'s text content. - * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent} - */ -function textContent(node) { - if (Array.isArray(node)) - return node.map(textContent).join(""); - if ((0, domhandler_1.hasChildren)(node) && !(0, domhandler_1.isComment)(node)) { - return textContent(node.children); - } - if ((0, domhandler_1.isText)(node)) - return node.data; - return ""; -} -exports.textContent = textContent; -/** - * Get a node's inner text. - * - * @param node Node to get the inner text of. - * @returns `node`'s inner text. - * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText} - */ -function innerText(node) { - if (Array.isArray(node)) - return node.map(innerText).join(""); - if ((0, domhandler_1.hasChildren)(node) && (node.type === domelementtype_1.ElementType.Tag || (0, domhandler_1.isCDATA)(node))) { - return innerText(node.children); - } - if ((0, domhandler_1.isText)(node)) - return node.data; - return ""; -} -exports.innerText = innerText; /***/ }), -/***/ 3362: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; +/***/ 3561: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.prevElementSibling = exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0; -var domhandler_1 = __webpack_require__(7366); -var emptyArray = []; -/** - * Get a node's children. - * - * @param elem Node to get the children of. - * @returns `elem`'s children, or an empty array. - */ -function getChildren(elem) { - var _a; - return (_a = elem.children) !== null && _a !== void 0 ? _a : emptyArray; -} -exports.getChildren = getChildren; -/** - * Get a node's parent. - * - * @param elem Node to get the parent of. - * @returns `elem`'s parent node. - */ -function getParent(elem) { - return elem.parent || null; -} -exports.getParent = getParent; -/** - * Gets an elements siblings, including the element itself. - * - * Attempts to get the children through the element's parent first. - * If we don't have a parent (the element is a root node), - * we walk the element's `prev` & `next` to get all remaining nodes. - * - * @param elem Element to get the siblings of. - * @returns `elem`'s siblings. - */ -function getSiblings(elem) { - var _a, _b; - var parent = getParent(elem); - if (parent != null) - return getChildren(parent); - var siblings = [elem]; - var prev = elem.prev, next = elem.next; - while (prev != null) { - siblings.unshift(prev); - (_a = prev, prev = _a.prev); - } - while (next != null) { - siblings.push(next); - (_b = next, next = _b.next); - } - return siblings; -} -exports.getSiblings = getSiblings; -/** - * Gets an attribute from an element. - * - * @param elem Element to check. - * @param name Attribute name to retrieve. - * @returns The element's attribute value, or `undefined`. - */ -function getAttributeValue(elem, name) { - var _a; - return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name]; -} -exports.getAttributeValue = getAttributeValue; -/** - * Checks whether an element has an attribute. - * - * @param elem Element to check. - * @param name Attribute name to look for. - * @returns Returns whether `elem` has the attribute `name`. - */ -function hasAttrib(elem, name) { - return (elem.attribs != null && - Object.prototype.hasOwnProperty.call(elem.attribs, name) && - elem.attribs[name] != null); -} -exports.hasAttrib = hasAttrib; -/** - * Get the tag name of an element. - * - * @param elem The element to get the name for. - * @returns The tag name of `elem`. - */ -function getName(elem) { - return elem.name; -} -exports.getName = getName; -/** - * Returns the next element sibling of a node. - * - * @param elem The element to get the next sibling of. - * @returns `elem`'s next sibling that is a tag. - */ -function nextElementSibling(elem) { - var _a; - var next = elem.next; - while (next !== null && !(0, domhandler_1.isTag)(next)) - (_a = next, next = _a.next); - return next; -} -exports.nextElementSibling = nextElementSibling; -/** - * Returns the previous element sibling of a node. - * - * @param elem The element to get the previous sibling of. - * @returns `elem`'s previous sibling that is a tag. - */ -function prevElementSibling(elem) { - var _a; - var prev = elem.prev; - while (prev !== null && !(0, domhandler_1.isTag)(prev)) - (_a = prev, prev = _a.prev); - return prev; -} -exports.prevElementSibling = prevElementSibling; +module.exports = __webpack_require__(9244) /***/ }), -/***/ 9729: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; +/***/ 9244: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/** - * Methods for getting and modifying attributes. - * - * @module cheerio/attributes - */ -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.toggleClass = exports.removeClass = exports.addClass = exports.hasClass = exports.removeAttr = exports.val = exports.data = exports.prop = exports.attr = void 0; -var static_1 = __webpack_require__(5796); -var utils_1 = __webpack_require__(1468); -var hasOwn = Object.prototype.hasOwnProperty; -var rspace = /\s+/; -var dataAttrPrefix = 'data-'; -/* - * Lookup table for coercing string data-* attributes to their corresponding - * JavaScript primitives - */ -var primitives = { - null: null, - true: true, - false: false, -}; -// Attributes that are booleans -var rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i; -// Matches strings that look like JSON objects or arrays -var rbrace = /^{[^]*}$|^\[[^]*]$/; -function getAttr(elem, name, xmlMode) { - var _a; - if (!elem || !utils_1.isTag(elem)) - return undefined; - (_a = elem.attribs) !== null && _a !== void 0 ? _a : (elem.attribs = {}); - // Return the entire attribs object if no attribute specified - if (!name) { - return elem.attribs; - } - if (hasOwn.call(elem.attribs, name)) { - // Get the (decoded) attribute - return !xmlMode && rboolean.test(name) ? name : elem.attribs[name]; - } - // Mimic the DOM and return text content as value for `option's` - if (elem.name === 'option' && name === 'value') { - return static_1.text(elem.children); - } - // Mimic DOM with default value for radios/checkboxes - if (elem.name === 'input' && - (elem.attribs.type === 'radio' || elem.attribs.type === 'checkbox') && - name === 'value') { - return 'on'; - } - return undefined; -} -/** - * Sets the value of an attribute. The attribute will be deleted if the value is `null`. - * - * @private - * @param el - The element to set the attribute on. - * @param name - The attribute's name. - * @param value - The attribute's value. - */ -function setAttr(el, name, value) { - if (value === null) { - removeAttribute(el, name); - } - else { - el.attribs[name] = "" + value; - } -} -function attr(name, value) { - // Set the value (with attr map support) - if (typeof name === 'object' || value !== undefined) { - if (typeof value === 'function') { - if (typeof name !== 'string') { - { - throw new Error('Bad combination of arguments.'); - } - } - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) - setAttr(el, name, value.call(el, i, el.attribs[name])); - }); - } - return utils_1.domEach(this, function (el) { - if (!utils_1.isTag(el)) - return; - if (typeof name === 'object') { - Object.keys(name).forEach(function (objName) { - var objValue = name[objName]; - setAttr(el, objName, objValue); - }); - } - else { - setAttr(el, name, value); - } - }); - } - return arguments.length > 1 - ? this - : getAttr(this[0], name, this.options.xmlMode); -} -exports.attr = attr; -/** - * Gets a node's prop. - * - * @private - * @category Attributes - * @param el - Elenent to get the prop of. - * @param name - Name of the prop. - * @returns The prop's value. - */ -function getProp(el, name, xmlMode) { - if (!el || !utils_1.isTag(el)) - return; - return name in el - ? // @ts-expect-error TS doesn't like us accessing the value directly here. - el[name] - : !xmlMode && rboolean.test(name) - ? getAttr(el, name, false) !== undefined - : getAttr(el, name, xmlMode); -} -/** - * Sets the value of a prop. - * - * @private - * @param el - The element to set the prop on. - * @param name - The prop's name. - * @param value - The prop's value. - */ -function setProp(el, name, value, xmlMode) { - if (name in el) { - // @ts-expect-error Overriding value - el[name] = value; - } - else { - setAttr(el, name, !xmlMode && rboolean.test(name) ? (value ? '' : null) : "" + value); - } -} -function prop(name, value) { - var _this = this; - if (typeof name === 'string' && value === undefined) { - switch (name) { - case 'style': { - var property_1 = this.css(); - var keys = Object.keys(property_1); - keys.forEach(function (p, i) { - property_1[i] = p; - }); - property_1.length = keys.length; - return property_1; - } - case 'tagName': - case 'nodeName': { - var el = this[0]; - return utils_1.isTag(el) ? el.name.toUpperCase() : undefined; - } - case 'outerHTML': - return this.clone().wrap('').parent().html(); - case 'innerHTML': - return this.html(); - default: - return getProp(this[0], name, this.options.xmlMode); - } - } - if (typeof name === 'object' || value !== undefined) { - if (typeof value === 'function') { - if (typeof name === 'object') { - throw new Error('Bad combination of arguments.'); - } - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) - setProp(el, name, value.call(el, i, getProp(el, name, _this.options.xmlMode)), _this.options.xmlMode); - }); - } - return utils_1.domEach(this, function (el) { - if (!utils_1.isTag(el)) - return; - if (typeof name === 'object') { - Object.keys(name).forEach(function (key) { - var val = name[key]; - setProp(el, key, val, _this.options.xmlMode); - }); - } - else { - setProp(el, name, value, _this.options.xmlMode); - } - }); - } - return undefined; -} -exports.prop = prop; -/** - * Sets the value of a data attribute. - * - * @private - * @param el - The element to set the data attribute on. - * @param name - The data attribute's name. - * @param value - The data attribute's value. - */ -function setData(el, name, value) { - var _a; - var elem = el; - (_a = elem.data) !== null && _a !== void 0 ? _a : (elem.data = {}); - if (typeof name === 'object') - Object.assign(elem.data, name); - else if (typeof name === 'string' && value !== undefined) { - elem.data[name] = value; - } -} -/** - * Read the specified attribute from the equivalent HTML5 `data-*` attribute, - * and (if present) cache the value in the node's internal data store. If no - * attribute name is specified, read *all* HTML5 `data-*` attributes in this manner. - * - * @private - * @category Attributes - * @param el - Elenent to get the data attribute of. - * @param name - Name of the data attribute. - * @returns The data attribute's value, or a map with all of the data attribute. - */ -function readData(el, name) { - var domNames; - var jsNames; - var value; - if (name == null) { - domNames = Object.keys(el.attribs).filter(function (attrName) { - return attrName.startsWith(dataAttrPrefix); - }); - jsNames = domNames.map(function (domName) { - return utils_1.camelCase(domName.slice(dataAttrPrefix.length)); - }); - } - else { - domNames = [dataAttrPrefix + utils_1.cssCase(name)]; - jsNames = [name]; - } - for (var idx = 0; idx < domNames.length; ++idx) { - var domName = domNames[idx]; - var jsName = jsNames[idx]; - if (hasOwn.call(el.attribs, domName) && - !hasOwn.call(el.data, jsName)) { - value = el.attribs[domName]; - if (hasOwn.call(primitives, value)) { - value = primitives[value]; - } - else if (value === String(Number(value))) { - value = Number(value); - } - else if (rbrace.test(value)) { - try { - value = JSON.parse(value); - } - catch (e) { - /* Ignore */ - } - } - el.data[jsName] = value; - } - } - return name == null ? el.data : value; -} -function data(name, value) { - var _a; - var elem = this[0]; - if (!elem || !utils_1.isTag(elem)) - return; - var dataEl = elem; - (_a = dataEl.data) !== null && _a !== void 0 ? _a : (dataEl.data = {}); - // Return the entire data object if no data specified - if (!name) { - return readData(dataEl); - } - // Set the value (with attr map support) - if (typeof name === 'object' || value !== undefined) { - utils_1.domEach(this, function (el) { - if (utils_1.isTag(el)) - if (typeof name === 'object') - setData(el, name); - else - setData(el, name, value); - }); - return this; - } - if (hasOwn.call(dataEl.data, name)) { - return dataEl.data[name]; - } - return readData(dataEl, name); -} -exports.data = data; -function val(value) { - var querying = arguments.length === 0; - var element = this[0]; - if (!element || !utils_1.isTag(element)) - return querying ? undefined : this; - switch (element.name) { - case 'textarea': - return this.text(value); - case 'select': { - var option = this.find('option:selected'); - if (!querying) { - if (this.attr('multiple') == null && typeof value === 'object') { - return this; - } - this.find('option').removeAttr('selected'); - var values = typeof value !== 'object' ? [value] : value; - for (var i = 0; i < values.length; i++) { - this.find("option[value=\"" + values[i] + "\"]").attr('selected', ''); - } - return this; - } - return this.attr('multiple') - ? option.toArray().map(function (el) { return static_1.text(el.children); }) - : option.attr('value'); - } - case 'input': - case 'option': - return querying - ? this.attr('value') - : this.attr('value', value); - } - return undefined; -} -exports.val = val; -/** - * Remove an attribute. - * - * @private - * @param elem - Node to remove attribute from. - * @param name - Name of the attribute to remove. - */ -function removeAttribute(elem, name) { - if (!elem.attribs || !hasOwn.call(elem.attribs, name)) - return; - delete elem.attribs[name]; -} -/** - * Splits a space-separated list of names to individual names. - * - * @category Attributes - * @param names - Names to split. - * @returns - Split names. - */ -function splitNames(names) { - return names ? names.trim().split(rspace) : []; -} -/** - * Method for removing attributes by `name`. - * - * @category Attributes - * @example - * - * ```js - * $('.pear').removeAttr('class').html(); - * //=>
  • Pear
  • - * - * $('.apple').attr('id', 'favorite'); - * $('.apple').removeAttr('id class').html(); - * //=>
  • Apple
  • - * ``` - * - * @param name - Name of the attribute. - * @returns The instance itself. - * @see {@link https://api.jquery.com/removeAttr/} - */ -function removeAttr(name) { - var attrNames = splitNames(name); - var _loop_1 = function (i) { - utils_1.domEach(this_1, function (elem) { - if (utils_1.isTag(elem)) - removeAttribute(elem, attrNames[i]); - }); - }; - var this_1 = this; - for (var i = 0; i < attrNames.length; i++) { - _loop_1(i); - } - return this; -} -exports.removeAttr = removeAttr; -/** - * Check to see if *any* of the matched elements have the given `className`. - * - * @category Attributes - * @example - * - * ```js - * $('.pear').hasClass('pear'); - * //=> true - * - * $('apple').hasClass('fruit'); - * //=> false - * - * $('li').hasClass('pear'); - * //=> true - * ``` - * - * @param className - Name of the class. - * @returns Indicates if an element has the given `className`. - * @see {@link https://api.jquery.com/hasClass/} - */ -function hasClass(className) { - return this.toArray().some(function (elem) { - var clazz = utils_1.isTag(elem) && elem.attribs.class; - var idx = -1; - if (clazz && className.length) { - while ((idx = clazz.indexOf(className, idx + 1)) > -1) { - var end = idx + className.length; - if ((idx === 0 || rspace.test(clazz[idx - 1])) && - (end === clazz.length || rspace.test(clazz[end]))) { - return true; - } - } - } - return false; - }); -} -exports.hasClass = hasClass; -/** - * Adds class(es) to all of the matched elements. Also accepts a `function`. - * - * @category Attributes - * @example - * - * ```js - * $('.pear').addClass('fruit').html(); - * //=>
  • Pear
  • - * - * $('.apple').addClass('fruit red').html(); - * //=>
  • Apple
  • - * ``` - * - * @param value - Name of new class. - * @returns The instance itself. - * @see {@link https://api.jquery.com/addClass/} - */ -function addClass(value) { - // Support functions - if (typeof value === 'function') { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) { - var className = el.attribs.class || ''; - addClass.call([el], value.call(el, i, className)); - } - }); - } - // Return if no value or not a string or function - if (!value || typeof value !== 'string') - return this; - var classNames = value.split(rspace); - var numElements = this.length; - for (var i = 0; i < numElements; i++) { - var el = this[i]; - // If selected element isn't a tag, move on - if (!utils_1.isTag(el)) - continue; - // If we don't already have classes — always set xmlMode to false here, as it doesn't matter for classes - var className = getAttr(el, 'class', false); - if (!className) { - setAttr(el, 'class', classNames.join(' ').trim()); - } - else { - var setClass = " " + className + " "; - // Check if class already exists - for (var j = 0; j < classNames.length; j++) { - var appendClass = classNames[j] + " "; - if (!setClass.includes(" " + appendClass)) - setClass += appendClass; - } - setAttr(el, 'class', setClass.trim()); - } - } - return this; -} -exports.addClass = addClass; -/** - * Removes one or more space-separated classes from the selected elements. If no - * `className` is defined, all classes will be removed. Also accepts a `function`. - * - * @category Attributes - * @example - * - * ```js - * $('.pear').removeClass('pear').html(); - * //=>
  • Pear
  • - * - * $('.apple').addClass('red').removeClass().html(); - * //=>
  • Apple
  • - * ``` - * - * @param name - Name of the class. If not specified, removes all elements. - * @returns The instance itself. - * @see {@link https://api.jquery.com/removeClass/} - */ -function removeClass(name) { - // Handle if value is a function - if (typeof name === 'function') { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) - removeClass.call([el], name.call(el, i, el.attribs.class || '')); - }); - } - var classes = splitNames(name); - var numClasses = classes.length; - var removeAll = arguments.length === 0; - return utils_1.domEach(this, function (el) { - if (!utils_1.isTag(el)) - return; - if (removeAll) { - // Short circuit the remove all case as this is the nice one - el.attribs.class = ''; - } - else { - var elClasses = splitNames(el.attribs.class); - var changed = false; - for (var j = 0; j < numClasses; j++) { - var index = elClasses.indexOf(classes[j]); - if (index >= 0) { - elClasses.splice(index, 1); - changed = true; - /* - * We have to do another pass to ensure that there are not duplicate - * classes listed - */ - j--; - } - } - if (changed) { - el.attribs.class = elClasses.join(' '); - } - } - }); -} -exports.removeClass = removeClass; -/** - * Add or remove class(es) from the matched elements, depending on either the - * class's presence or the value of the switch argument. Also accepts a `function`. - * - * @category Attributes - * @example - * - * ```js - * $('.apple.green').toggleClass('fruit green red').html(); - * //=>
  • Apple
  • - * - * $('.apple.green').toggleClass('fruit green red', true).html(); - * //=>
  • Apple
  • - * ``` - * - * @param value - Name of the class. Can also be a function. - * @param stateVal - If specified the state of the class. - * @returns The instance itself. - * @see {@link https://api.jquery.com/toggleClass/} - */ -function toggleClass(value, stateVal) { - // Support functions - if (typeof value === 'function') { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) { - toggleClass.call([el], value.call(el, i, el.attribs.class || '', stateVal), stateVal); - } - }); - } - // Return if no value or not a string or function - if (!value || typeof value !== 'string') - return this; - var classNames = value.split(rspace); - var numClasses = classNames.length; - var state = typeof stateVal === 'boolean' ? (stateVal ? 1 : -1) : 0; - var numElements = this.length; - for (var i = 0; i < numElements; i++) { - var el = this[i]; - // If selected element isn't a tag, move on - if (!utils_1.isTag(el)) - continue; - var elementClasses = splitNames(el.attribs.class); - // Check if class already exists - for (var j = 0; j < numClasses; j++) { - // Check if the class name is currently defined - var index = elementClasses.indexOf(classNames[j]); - // Add if stateValue === true or we are toggling and there is no value - if (state >= 0 && index < 0) { - elementClasses.push(classNames[j]); - } - else if (state <= 0 && index >= 0) { - // Otherwise remove but only if the item exists - elementClasses.splice(index, 1); - } - } - el.attribs.class = elementClasses.join(' '); - } - return this; -} -exports.toggleClass = toggleClass; - - -/***/ }), - -/***/ 1497: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.css = void 0; -var utils_1 = __webpack_require__(1468); -function css(prop, val) { - if ((prop != null && val != null) || - // When `prop` is a "plain" object - (typeof prop === 'object' && !Array.isArray(prop))) { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) { - // `prop` can't be an array here anymore. - setCss(el, prop, val, i); - } - }); - } - return getCss(this[0], prop); -} -exports.css = css; -/** - * Set styles of all elements. - * - * @private - * @param el - Element to set style of. - * @param prop - Name of property. - * @param value - Value to set property to. - * @param idx - Optional index within the selection. - */ -function setCss(el, prop, value, idx) { - if (typeof prop === 'string') { - var styles = getCss(el); - var val = typeof value === 'function' ? value.call(el, idx, styles[prop]) : value; - if (val === '') { - delete styles[prop]; - } - else if (val != null) { - styles[prop] = val; - } - el.attribs.style = stringify(styles); - } - else if (typeof prop === 'object') { - Object.keys(prop).forEach(function (k, i) { - setCss(el, k, prop[k], i); - }); - } -} -function getCss(el, prop) { - if (!el || !utils_1.isTag(el)) - return; - var styles = parse(el.attribs.style); - if (typeof prop === 'string') { - return styles[prop]; - } - if (Array.isArray(prop)) { - var newStyles_1 = {}; - prop.forEach(function (item) { - if (styles[item] != null) { - newStyles_1[item] = styles[item]; - } - }); - return newStyles_1; - } - return styles; -} -/** - * Stringify `obj` to styles. - * - * @private - * @category CSS - * @param obj - Object to stringify. - * @returns The serialized styles. - */ -function stringify(obj) { - return Object.keys(obj).reduce(function (str, prop) { return "" + str + (str ? ' ' : '') + prop + ": " + obj[prop] + ";"; }, ''); -} -/** - * Parse `styles`. - * - * @private - * @category CSS - * @param styles - Styles to be parsed. - * @returns The parsed styles. - */ -function parse(styles) { - styles = (styles || '').trim(); - if (!styles) - return {}; - return styles.split(';').reduce(function (obj, str) { - var n = str.indexOf(':'); - // Skip if there is no :, or if it is the first/last character - if (n < 1 || n === str.length - 1) - return obj; - obj[str.slice(0, n).trim()] = str.slice(n + 1).trim(); - return obj; - }, {}); -} - - -/***/ }), - -/***/ 8027: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.serializeArray = exports.serialize = void 0; -var utils_1 = __webpack_require__(1468); -/* - * https://github.com/jquery/jquery/blob/2.1.3/src/manipulation/var/rcheckableType.js - * https://github.com/jquery/jquery/blob/2.1.3/src/serialize.js - */ -var submittableSelector = 'input,select,textarea,keygen'; -var r20 = /%20/g; -var rCRLF = /\r?\n/g; -/** - * Encode a set of form elements as a string for submission. - * - * @category Forms - * @returns The serialized form. - * @see {@link https://api.jquery.com/serialize/} - */ -function serialize() { - // Convert form elements into name/value objects - var arr = this.serializeArray(); - // Serialize each element into a key/value string - var retArr = arr.map(function (data) { - return encodeURIComponent(data.name) + "=" + encodeURIComponent(data.value); - }); - // Return the resulting serialization - return retArr.join('&').replace(r20, '+'); -} -exports.serialize = serialize; -/** - * Encode a set of form elements as an array of names and values. - * - * @category Forms - * @example - * - * ```js - * $('
    ').serializeArray(); - * //=> [ { name: 'foo', value: 'bar' } ] - * ``` - * - * @returns The serialized form. - * @see {@link https://api.jquery.com/serializeArray/} - */ -function serializeArray() { - var _this = this; - // Resolve all form elements from either forms or collections of form elements - return this.map(function (_, elem) { - var $elem = _this._make(elem); - if (utils_1.isTag(elem) && elem.name === 'form') { - return $elem.find(submittableSelector).toArray(); - } - return $elem.filter(submittableSelector).toArray(); - }) - .filter( - // Verify elements have a name (`attr.name`) and are not disabled (`:enabled`) - '[name!=""]:enabled' + - // And cannot be clicked (`[type=submit]`) or are used in `x-www-form-urlencoded` (`[type=file]`) - ':not(:submit, :button, :image, :reset, :file)' + - // And are either checked/don't have a checkable state - ':matches([checked], :not(:checkbox, :radio))' - // Convert each of the elements to its value(s) - ) - .map(function (_, elem) { - var _a; - var $elem = _this._make(elem); - var name = $elem.attr('name'); // We have filtered for elements with a name before. - // If there is no value set (e.g. `undefined`, `null`), then default value to empty - var value = (_a = $elem.val()) !== null && _a !== void 0 ? _a : ''; - // If we have an array of values (e.g. `