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GACJ,OAAgC,QAAxBA,GAAKnD,KAAKzC,gBAA6B,IAAP4F,GAAgBA,GAAKsB,WASjE,SAASF,UAAUvE,MACf,OAAOA,KAAKlD,QAAU,KAR1BZ,QAAQsI,YAAcA,YAUtBtI,QAAQqI,UAAYA,UA4BpBrI,QAAQoI,YAjBR,SAASA,YAAYtE,MACjB,IACIlD,OAASyH,UAAUvE,MACvB,GAAc,MAAVlD,OACA,OAAO0H,YAAY1H,QAGvB,IAFA,IAAIQ,SAAW,CAAC0C,MACZ4B,KAAO5B,KAAK4B,KAAMC,KAAO7B,KAAK6B,KACnB,MAARD,MACHtE,SAASP,QAAQ6E,MACLA,KAANA,KAAgBA,KAE1B,KAAe,MAARC,MACHvE,SAASgF,KAAKT,MACFA,KAANA,KAAgBA,KAE1B,OAAOvE,UAcXpB,QAAQmI,kBAJR,SAASA,kBAAkBrE,KAAMD,MAC7B,IAAIoD,GACJ,OAA+B,QAAvBA,GAAKnD,KAAKS,eAA4B,IAAP0C,QAAgB,EAASA,GAAGpD,OAevE7D,QAAQkI,UALR,SAASA,UAAUpE,KAAMD,MACrB,OAAwB,MAAhBC,KAAKS,SACTzE,OAAOoD,UAAUC,eAAeC,KAAKU,KAAKS,QAASV,OAC7B,MAAtBC,KAAKS,QAAQV,OAYrB7D,QAAQiI,QAHR,SAASA,QAAQnE,MACb,OAAOA,KAAKD,MAgBhB7D,QAAQgI,mBAPR,SAASA,mBAAmBlE,MAGxB,IAFA,IACI6B,KAAO7B,KAAK6B,KACA,OAATA,OAAkBtF,WAAW0D,MAAM4B,OAC1BA,KAANA,KAAgBA,KAC1B,OAAOA","sources":["webpack://giveeasy.cloud/./node_modules/domutils/lib/helpers.js","webpack://giveeasy.cloud/./node_modules/domutils/lib/index.js","webpack://giveeasy.cloud/./node_modules/domutils/lib/legacy.js","webpack://giveeasy.cloud/./node_modules/domutils/lib/manipulation.js","webpack://giveeasy.cloud/./node_modules/domutils/lib/querying.js","webpack://giveeasy.cloud/./node_modules/domutils/lib/stringify.js","webpack://giveeasy.cloud/./node_modules/domutils/lib/tagtypes.js","webpack://giveeasy.cloud/./node_modules/domutils/lib/traversal.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uniqueSort = exports.compareDocumentPosition = exports.removeSubsets = void 0;\nvar tagtypes_1 = require(\"./tagtypes\");\n/**\n * Given an array of nodes, remove any member that is contained by another.\n *\n * @param nodes Nodes to filter.\n * @returns Remaining nodes that aren't subtrees of each other.\n */\nfunction removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}\nexports.removeSubsets = removeSubsets;\n/**\n * Compare the position of one node against another node in any other document.\n * The return value is a bitmask with the following values:\n *\n * Document order:\n * > There is an ordering, document order, defined on all the nodes in the\n * > document corresponding to the order in which the first character of the\n * > XML representation of each node occurs in the XML representation of the\n * > document after expansion of general entities. Thus, the document element\n * > node will be the first node. Element nodes occur before their children.\n * > Thus, document order orders element nodes in order of the occurrence of\n * > their start-tag in the XML (after expansion of entities). The attribute\n * > nodes of an element occur after the element and before its children. The\n * > relative order of attribute nodes is implementation-dependent./\n *\n * Source:\n * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order\n *\n * @param nodeA The first node to use in the comparison\n * @param nodeB The second node to use in the comparison\n * @returns A bitmask describing the input nodes' relative position.\n *\n * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for\n * a description of these values.\n */\nfunction compareDocumentPosition(nodeA, nodeB) {\n var aParents = [];\n var bParents = [];\n if (nodeA === nodeB) {\n return 0;\n }\n var current = tagtypes_1.hasChildren(nodeA) ? nodeA : nodeA.parent;\n while (current) {\n aParents.unshift(current);\n current = current.parent;\n }\n current = tagtypes_1.hasChildren(nodeB) ? nodeB : nodeB.parent;\n while (current) {\n bParents.unshift(current);\n current = current.parent;\n }\n var maxIdx = Math.min(aParents.length, bParents.length);\n var idx = 0;\n while (idx < maxIdx && aParents[idx] === bParents[idx]) {\n idx++;\n }\n if (idx === 0) {\n return 1 /* DISCONNECTED */;\n }\n var sharedParent = aParents[idx - 1];\n var siblings = sharedParent.children;\n var aSibling = aParents[idx];\n var bSibling = bParents[idx];\n if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {\n if (sharedParent === nodeB) {\n return 4 /* FOLLOWING */ | 16 /* CONTAINED_BY */;\n }\n return 4 /* FOLLOWING */;\n }\n if (sharedParent === nodeA) {\n return 2 /* PRECEDING */ | 8 /* CONTAINS */;\n }\n return 2 /* PRECEDING */;\n}\nexports.compareDocumentPosition = compareDocumentPosition;\n/**\n * Sort an array of nodes based on their relative position in the document and\n * remove any duplicate nodes. If the array contains nodes that do not belong\n * to the same document, sort order is unspecified.\n *\n * @param nodes Array of DOM nodes.\n * @returns Collection of unique nodes, sorted in document order.\n */\nfunction uniqueSort(nodes) {\n nodes = nodes.filter(function (node, i, arr) { return !arr.includes(node, i + 1); });\n nodes.sort(function (a, b) {\n var relative = compareDocumentPosition(a, b);\n if (relative & 2 /* PRECEDING */) {\n return -1;\n }\n else if (relative & 4 /* FOLLOWING */) {\n return 1;\n }\n return 0;\n });\n return nodes;\n}\nexports.uniqueSort = uniqueSort;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./stringify\"), exports);\n__exportStar(require(\"./traversal\"), exports);\n__exportStar(require(\"./manipulation\"), exports);\n__exportStar(require(\"./querying\"), exports);\n__exportStar(require(\"./legacy\"), exports);\n__exportStar(require(\"./helpers\"), exports);\n__exportStar(require(\"./tagtypes\"), exports);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getElementsByTagType = exports.getElementsByTagName = exports.getElementById = exports.getElements = exports.testElement = void 0;\nvar querying_1 = require(\"./querying\");\nvar tagtypes_1 = require(\"./tagtypes\");\nvar Checks = {\n tag_name: function (name) {\n if (typeof name === \"function\") {\n return function (elem) { return tagtypes_1.isTag(elem) && name(elem.name); };\n }\n else if (name === \"*\") {\n return tagtypes_1.isTag;\n }\n return function (elem) { return tagtypes_1.isTag(elem) && elem.name === name; };\n },\n tag_type: function (type) {\n if (typeof type === \"function\") {\n return function (elem) { return type(elem.type); };\n }\n return function (elem) { return elem.type === type; };\n },\n tag_contains: function (data) {\n if (typeof data === \"function\") {\n return function (elem) { return tagtypes_1.isText(elem) && data(elem.data); };\n }\n return function (elem) { return tagtypes_1.isText(elem) && elem.data === data; };\n },\n};\n/**\n * @param attrib Attribute to check.\n * @param value Attribute value to look for.\n * @returns A function to check whether the a node has an attribute with a particular value.\n */\nfunction getAttribCheck(attrib, value) {\n if (typeof value === \"function\") {\n return function (elem) { return tagtypes_1.isTag(elem) && value(elem.attribs[attrib]); };\n }\n return function (elem) { return tagtypes_1.isTag(elem) && elem.attribs[attrib] === value; };\n}\n/**\n * @param a First function to combine.\n * @param b Second function to combine.\n * @returns A function taking a node and returning `true` if either\n * of the input functions returns `true` for the node.\n */\nfunction combineFuncs(a, b) {\n return function (elem) { return a(elem) || b(elem); };\n}\n/**\n * @param options An object describing nodes to look for.\n * @returns A function executing all checks in `options` and returning `true`\n * if any of them match a node.\n */\nfunction compileTest(options) {\n var funcs = Object.keys(options).map(function (key) {\n var value = options[key];\n return key in Checks\n ? Checks[key](value)\n : getAttribCheck(key, value);\n });\n return funcs.length === 0 ? null : funcs.reduce(combineFuncs);\n}\n/**\n * @param options An object describing nodes to look for.\n * @param node The element to test.\n * @returns Whether the element matches the description in `options`.\n */\nfunction testElement(options, node) {\n var test = compileTest(options);\n return test ? test(node) : true;\n}\nexports.testElement = testElement;\n/**\n * @param options An object describing nodes to look for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes that match `options`.\n */\nfunction getElements(options, nodes, recurse, limit) {\n if (limit === void 0) { limit = Infinity; }\n var test = compileTest(options);\n return test ? querying_1.filter(test, nodes, recurse, limit) : [];\n}\nexports.getElements = getElements;\n/**\n * @param id The unique ID attribute value to look for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @returns The node with the supplied ID.\n */\nfunction getElementById(id, nodes, recurse) {\n if (recurse === void 0) { recurse = true; }\n if (!Array.isArray(nodes))\n nodes = [nodes];\n return querying_1.findOne(getAttribCheck(\"id\", id), nodes, recurse);\n}\nexports.getElementById = getElementById;\n/**\n * @param tagName Tag name to search for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes with the supplied `tagName`.\n */\nfunction getElementsByTagName(tagName, nodes, recurse, limit) {\n if (recurse === void 0) { recurse = true; }\n if (limit === void 0) { limit = Infinity; }\n return querying_1.filter(Checks.tag_name(tagName), nodes, recurse, limit);\n}\nexports.getElementsByTagName = getElementsByTagName;\n/**\n * @param type Element type to look for.\n * @param nodes Nodes to search through.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes with the supplied `type`.\n */\nfunction getElementsByTagType(type, nodes, recurse, limit) {\n if (recurse === void 0) { recurse = true; }\n if (limit === void 0) { limit = Infinity; }\n return querying_1.filter(Checks.tag_type(type), nodes, recurse, limit);\n}\nexports.getElementsByTagType = getElementsByTagType;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.prepend = exports.prependChild = exports.append = exports.appendChild = exports.replaceElement = exports.removeElement = void 0;\n/**\n * Remove an element from the dom\n *\n * @param elem The element to be removed\n */\nfunction removeElement(elem) {\n if (elem.prev)\n elem.prev.next = elem.next;\n if (elem.next)\n elem.next.prev = elem.prev;\n if (elem.parent) {\n var childs = elem.parent.children;\n childs.splice(childs.lastIndexOf(elem), 1);\n }\n}\nexports.removeElement = removeElement;\n/**\n * Replace an element in the dom\n *\n * @param elem The element to be replaced\n * @param replacement The element to be added\n */\nfunction replaceElement(elem, replacement) {\n var prev = (replacement.prev = elem.prev);\n if (prev) {\n prev.next = replacement;\n }\n var next = (replacement.next = elem.next);\n if (next) {\n next.prev = replacement;\n }\n var parent = (replacement.parent = elem.parent);\n if (parent) {\n var childs = parent.children;\n childs[childs.lastIndexOf(elem)] = replacement;\n }\n}\nexports.replaceElement = replaceElement;\n/**\n * Append a child to an element.\n *\n * @param elem The element to append to.\n * @param child The element to be added as a child.\n */\nfunction appendChild(elem, child) {\n removeElement(child);\n child.next = null;\n child.parent = elem;\n if (elem.children.push(child) > 1) {\n var sibling = elem.children[elem.children.length - 2];\n sibling.next = child;\n child.prev = sibling;\n }\n else {\n child.prev = null;\n }\n}\nexports.appendChild = appendChild;\n/**\n * Append an element after another.\n *\n * @param elem The element to append after.\n * @param next The element be added.\n */\nfunction append(elem, next) {\n removeElement(next);\n var parent = elem.parent;\n var currNext = elem.next;\n next.next = currNext;\n next.prev = elem;\n elem.next = next;\n next.parent = parent;\n if (currNext) {\n currNext.prev = next;\n if (parent) {\n var childs = parent.children;\n childs.splice(childs.lastIndexOf(currNext), 0, next);\n }\n }\n else if (parent) {\n parent.children.push(next);\n }\n}\nexports.append = append;\n/**\n * Prepend a child to an element.\n *\n * @param elem The element to prepend before.\n * @param child The element to be added as a child.\n */\nfunction prependChild(elem, child) {\n removeElement(child);\n child.parent = elem;\n child.prev = null;\n if (elem.children.unshift(child) !== 1) {\n var sibling = elem.children[1];\n sibling.prev = child;\n child.next = sibling;\n }\n else {\n child.next = null;\n }\n}\nexports.prependChild = prependChild;\n/**\n * Prepend an element before another.\n *\n * @param elem The element to prepend before.\n * @param prev The element be added.\n */\nfunction prepend(elem, prev) {\n removeElement(prev);\n var parent = elem.parent;\n if (parent) {\n var childs = parent.children;\n childs.splice(childs.indexOf(elem), 0, prev);\n }\n if (elem.prev) {\n elem.prev.next = prev;\n }\n prev.parent = parent;\n prev.prev = elem.prev;\n prev.next = elem;\n elem.prev = prev;\n}\nexports.prepend = prepend;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.findAll = exports.existsOne = exports.findOne = exports.findOneChild = exports.find = exports.filter = void 0;\nvar tagtypes_1 = require(\"./tagtypes\");\n/**\n * Search a node and its children for nodes passing a test function.\n *\n * @param test Function to test nodes on.\n * @param node Node to search. Will be included in the result set if it matches.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes passing `test`.\n */\nfunction filter(test, node, recurse, limit) {\n if (recurse === void 0) { recurse = true; }\n if (limit === void 0) { limit = Infinity; }\n if (!Array.isArray(node))\n node = [node];\n return find(test, node, recurse, limit);\n}\nexports.filter = filter;\n/**\n * Search an array of node and its children for nodes passing a test function.\n *\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @param recurse Also consider child nodes.\n * @param limit Maximum number of nodes to return.\n * @returns All nodes passing `test`.\n */\nfunction find(test, nodes, recurse, limit) {\n var result = [];\n for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {\n var elem = nodes_1[_i];\n if (test(elem)) {\n result.push(elem);\n if (--limit <= 0)\n break;\n }\n if (recurse && tagtypes_1.hasChildren(elem) && elem.children.length > 0) {\n var children = find(test, elem.children, recurse, limit);\n result.push.apply(result, children);\n limit -= children.length;\n if (limit <= 0)\n break;\n }\n }\n return result;\n}\nexports.find = find;\n/**\n * Finds the first element inside of an array that matches a test function.\n *\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @returns The first node in the array that passes `test`.\n */\nfunction findOneChild(test, nodes) {\n return nodes.find(test);\n}\nexports.findOneChild = findOneChild;\n/**\n * Finds one element in a tree that passes a test.\n *\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @param recurse Also consider child nodes.\n * @returns The first child node that passes `test`.\n */\nfunction findOne(test, nodes, recurse) {\n if (recurse === void 0) { recurse = true; }\n var elem = null;\n for (var i = 0; i < nodes.length && !elem; i++) {\n var checked = nodes[i];\n if (!tagtypes_1.isTag(checked)) {\n continue;\n }\n else if (test(checked)) {\n elem = checked;\n }\n else if (recurse && checked.children.length > 0) {\n elem = findOne(test, checked.children);\n }\n }\n return elem;\n}\nexports.findOne = findOne;\n/**\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @returns Whether a tree of nodes contains at least one node passing a test.\n */\nfunction existsOne(test, nodes) {\n return nodes.some(function (checked) {\n return tagtypes_1.isTag(checked) &&\n (test(checked) ||\n (checked.children.length > 0 &&\n existsOne(test, checked.children)));\n });\n}\nexports.existsOne = existsOne;\n/**\n * Search and array of nodes and its children for nodes passing a test function.\n *\n * Same as `find`, only with less options, leading to reduced complexity.\n *\n * @param test Function to test nodes on.\n * @param nodes Array of nodes to search.\n * @returns All nodes passing `test`.\n */\nfunction findAll(test, nodes) {\n var _a;\n var result = [];\n var stack = nodes.filter(tagtypes_1.isTag);\n var elem;\n while ((elem = stack.shift())) {\n var children = (_a = elem.children) === null || _a === void 0 ? void 0 : _a.filter(tagtypes_1.isTag);\n if (children && children.length > 0) {\n stack.unshift.apply(stack, children);\n }\n if (test(elem))\n result.push(elem);\n }\n return result;\n}\nexports.findAll = findAll;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getText = exports.getInnerHTML = exports.getOuterHTML = void 0;\nvar tagtypes_1 = require(\"./tagtypes\");\nvar dom_serializer_1 = __importDefault(require(\"dom-serializer\"));\n/**\n * @param node Node to get the outer HTML of.\n * @param options Options for serialization.\n * @deprecated Use the `dom-serializer` module directly.\n * @returns `node`'s outer HTML.\n */\nfunction getOuterHTML(node, options) {\n return dom_serializer_1.default(node, options);\n}\nexports.getOuterHTML = getOuterHTML;\n/**\n * @param node Node to get the inner HTML of.\n * @param options Options for serialization.\n * @deprecated Use the `dom-serializer` module directly.\n * @returns `node`'s inner HTML.\n */\nfunction getInnerHTML(node, options) {\n return tagtypes_1.hasChildren(node)\n ? node.children.map(function (node) { return getOuterHTML(node, options); }).join(\"\")\n : \"\";\n}\nexports.getInnerHTML = getInnerHTML;\n/**\n * Get a node's inner text.\n *\n * @param node Node to get the inner text of.\n * @returns `node`'s inner text.\n */\nfunction getText(node) {\n if (Array.isArray(node))\n return node.map(getText).join(\"\");\n if (tagtypes_1.isTag(node))\n return node.name === \"br\" ? \"\\n\" : getText(node.children);\n if (tagtypes_1.isCDATA(node))\n return getText(node.children);\n if (tagtypes_1.isText(node))\n return node.data;\n return \"\";\n}\nexports.getText = getText;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasChildren = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = void 0;\nvar domelementtype_1 = require(\"domelementtype\");\n/**\n * @param node Node to check.\n * @returns `true` if the node is a `Element`, `false` otherwise.\n */\nfunction isTag(node) {\n return domelementtype_1.isTag(node);\n}\nexports.isTag = isTag;\n/**\n * @param node Node to check.\n * @returns `true` if the node is a `NodeWithChildren`, `false` otherwise.\n */\nfunction isCDATA(node) {\n return node.type === \"cdata\" /* CDATA */;\n}\nexports.isCDATA = isCDATA;\n/**\n * @param node Node to check.\n * @returns `true` if the node is a `DataNode`, `false` otherwise.\n */\nfunction isText(node) {\n return node.type === \"text\" /* Text */;\n}\nexports.isText = isText;\n/**\n * @param node Node to check.\n * @returns `true` if the node is a `DataNode`, `false` otherwise.\n */\nfunction isComment(node) {\n return node.type === \"comment\" /* Comment */;\n}\nexports.isComment = isComment;\n/**\n * @param node Node to check.\n * @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise.\n */\nfunction hasChildren(node) {\n return Object.prototype.hasOwnProperty.call(node, \"children\");\n}\nexports.hasChildren = hasChildren;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0;\nvar tagtypes_1 = require(\"./tagtypes\");\nvar emptyArray = [];\n/**\n * Get a node's children.\n *\n * @param elem Node to get the children of.\n * @returns `elem`'s children, or an empty array.\n */\nfunction getChildren(elem) {\n var _a;\n return (_a = elem.children) !== null && _a !== void 0 ? _a : emptyArray;\n}\nexports.getChildren = getChildren;\n/**\n * Get a node's parent.\n *\n * @param elem Node to get the parent of.\n * @returns `elem`'s parent node.\n */\nfunction getParent(elem) {\n return elem.parent || null;\n}\nexports.getParent = getParent;\n/**\n * Gets an elements siblings, including the element itself.\n *\n * Attempts to get the children through the element's parent first.\n * If we don't have a parent (the element is a root node),\n * we walk the element's `prev` & `next` to get all remaining nodes.\n *\n * @param elem Element to get the siblings of.\n * @returns `elem`'s siblings.\n */\nfunction getSiblings(elem) {\n var _a, _b;\n var parent = getParent(elem);\n if (parent != null)\n return getChildren(parent);\n var siblings = [elem];\n var prev = elem.prev, next = elem.next;\n while (prev != null) {\n siblings.unshift(prev);\n (_a = prev, prev = _a.prev);\n }\n while (next != null) {\n siblings.push(next);\n (_b = next, next = _b.next);\n }\n return siblings;\n}\nexports.getSiblings = getSiblings;\n/**\n * Gets an attribute from an element.\n *\n * @param elem Element to check.\n * @param name Attribute name to retrieve.\n * @returns The element's attribute value, or `undefined`.\n */\nfunction getAttributeValue(elem, name) {\n var _a;\n return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name];\n}\nexports.getAttributeValue = getAttributeValue;\n/**\n * Checks whether an element has an attribute.\n *\n * @param elem Element to check.\n * @param name Attribute name to look for.\n * @returns Returns whether `elem` has the attribute `name`.\n */\nfunction hasAttrib(elem, name) {\n return (elem.attribs != null &&\n Object.prototype.hasOwnProperty.call(elem.attribs, name) &&\n elem.attribs[name] != null);\n}\nexports.hasAttrib = hasAttrib;\n/**\n * Get the tag name of an element.\n *\n * @param elem The element to get the name for.\n * @returns The tag name of `elem`.\n */\nfunction getName(elem) {\n return elem.name;\n}\nexports.getName = getName;\n/**\n * Returns the next element sibling of a node.\n *\n * @param elem The element to get the next sibling of.\n * @returns `elem`'s next sibling that is a tag.\n */\nfunction nextElementSibling(elem) {\n var _a;\n var next = elem.next;\n while (next !== null && !tagtypes_1.isTag(next))\n (_a = next, next = _a.next);\n return next;\n}\nexports.nextElementSibling = nextElementSibling;\n"],"names":["Object","defineProperty","exports","value","uniqueSort","compareDocumentPosition","removeSubsets","tagtypes_1","nodeA","nodeB","aParents","bParents","current","hasChildren","parent","unshift","maxIdx","Math","min","length","idx","sharedParent","siblings","children","aSibling","bSibling","indexOf","nodes","node","lastIndexOf","splice","ancestor","includes","filter","i","arr","sort","a","b","relative","__createBinding","this","create","o","m","k","k2","undefined","enumerable","get","__exportStar","p","prototype","hasOwnProperty","call","getElementsByTagType","getElementsByTagName","getElementById","getElements","testElement","querying_1","Checks","tag_name","name","elem","isTag","tag_type","type","tag_contains","data","isText","getAttribCheck","attrib","attribs","combineFuncs","compileTest","options","funcs","keys","map","key","reduce","test","recurse","limit","Infinity","id","Array","isArray","findOne","tagName","removeElement","prev","next","childs","prepend","prependChild","append","appendChild","replaceElement","replacement","child","push","sibling","currNext","findAll","existsOne","findOneChild","find","result","_i","nodes_1","apply","checked","some","_a","stack","shift","__importDefault","mod","__esModule","getText","getInnerHTML","getOuterHTML","dom_serializer_1","default","join","isCDATA","isComment","domelementtype_1","nextElementSibling","getName","hasAttrib","getAttributeValue","getSiblings","getParent","getChildren","emptyArray"],"sourceRoot":""}