//#region rolldown:runtime
var __create$2 = Object.create;
var __defProp$2 = Object.defineProperty;
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames$2 = Object.getOwnPropertyNames;
var __getProtoOf$2 = Object.getPrototypeOf;
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
var __commonJS$1 = (cb, mod) => function() {
	return mod || (0, cb[__getOwnPropNames$2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps$2 = (to, from, except, desc) => {
	if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$2(from), i = 0, n = keys.length, key; i < n; i++) {
		key = keys[i];
		if (!__hasOwnProp$2.call(to, key) && key !== except) __defProp$2(to, key, {
			get: ((k) => from[k]).bind(null, key),
			enumerable: !(desc = __getOwnPropDesc$2(from, key)) || desc.enumerable
		});
	}
	return to;
};
var __toESM$2 = (mod, isNodeMode, target) => (target = mod != null ? __create$2(__getProtoOf$2(mod)) : {}, __copyProps$2(isNodeMode || !mod || !mod.__esModule ? __defProp$2(target, "default", {
	value: mod,
	enumerable: true
}) : target, mod));

//#endregion

//#region ../template-function-json/build/index.js
var require_build$1 = /* @__PURE__ */ __commonJS$1({ "../template-function-json/build/index.js": ((exports) => {
	var __create$1 = Object.create;
	var __defProp$1 = Object.defineProperty;
	var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
	var __getOwnPropNames$1 = Object.getOwnPropertyNames;
	var __getProtoOf$1 = Object.getPrototypeOf;
	var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
	var __copyProps$1 = (to, from, except, desc) => {
		if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$1(from), i = 0, n = keys.length, key; i < n; i++) {
			key = keys[i];
			if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$1(to, key, {
				get: ((k) => from[k]).bind(null, key),
				enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
			});
		}
		return to;
	};
	var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$1(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
		value: mod,
		enumerable: true
	}) : target, mod));
	let vm = require("vm");
	vm = __toESM$1(vm);
	/**
	* @implements {IHooks}
	*/
	var Hooks = class {
		/**
		* @callback HookCallback
		* @this {*|Jsep} this
		* @param {Jsep} env
		* @returns: void
		*/
		/**
		* Adds the given callback to the list of callbacks for the given hook.
		*
		* The callback will be invoked when the hook it is registered for is run.
		*
		* One callback function can be registered to multiple hooks and the same hook multiple times.
		*
		* @param {string|object} name The name of the hook, or an object of callbacks keyed by name
		* @param {HookCallback|boolean} callback The callback function which is given environment variables.
		* @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)
		* @public
		*/
		add(name$1, callback, first) {
			if (typeof arguments[0] != "string") for (let name$1$1 in arguments[0]) this.add(name$1$1, arguments[0][name$1$1], arguments[1]);
			else (Array.isArray(name$1) ? name$1 : [name$1]).forEach(function(name$1$1) {
				this[name$1$1] = this[name$1$1] || [];
				if (callback) this[name$1$1][first ? "unshift" : "push"](callback);
			}, this);
		}
		/**
		* Runs a hook invoking all registered callbacks with the given environment variables.
		*
		* Callbacks will be invoked synchronously and in the order in which they were registered.
		*
		* @param {string} name The name of the hook.
		* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
		* @public
		*/
		run(name$1, env) {
			this[name$1] = this[name$1] || [];
			this[name$1].forEach(function(callback) {
				callback.call(env && env.context ? env.context : env, env);
			});
		}
	};
	/**
	* @implements {IPlugins}
	*/
	var Plugins = class {
		constructor(jsep$1) {
			this.jsep = jsep$1;
			this.registered = {};
		}
		/**
		* @callback PluginSetup
		* @this {Jsep} jsep
		* @returns: void
		*/
		/**
		* Adds the given plugin(s) to the registry
		*
		* @param {object} plugins
		* @param {string} plugins.name The name of the plugin
		* @param {PluginSetup} plugins.init The init function
		* @public
		*/
		register(...plugins) {
			plugins.forEach((plugin$2) => {
				if (typeof plugin$2 !== "object" || !plugin$2.name || !plugin$2.init) throw new Error("Invalid JSEP plugin format");
				if (this.registered[plugin$2.name]) return;
				plugin$2.init(this.jsep);
				this.registered[plugin$2.name] = plugin$2;
			});
		}
	};
	var Jsep = class Jsep$1 {
		/**
		* @returns {string}
		*/
		static get version() {
			return "1.4.0";
		}
		/**
		* @returns {string}
		*/
		static toString() {
			return "JavaScript Expression Parser (JSEP) v" + Jsep$1.version;
		}
		/**
		* @method addUnaryOp
		* @param {string} op_name The name of the unary op to add
		* @returns {Jsep}
		*/
		static addUnaryOp(op_name) {
			Jsep$1.max_unop_len = Math.max(op_name.length, Jsep$1.max_unop_len);
			Jsep$1.unary_ops[op_name] = 1;
			return Jsep$1;
		}
		/**
		* @method jsep.addBinaryOp
		* @param {string} op_name The name of the binary op to add
		* @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence
		* @param {boolean} [isRightAssociative=false] whether operator is right-associative
		* @returns {Jsep}
		*/
		static addBinaryOp(op_name, precedence, isRightAssociative) {
			Jsep$1.max_binop_len = Math.max(op_name.length, Jsep$1.max_binop_len);
			Jsep$1.binary_ops[op_name] = precedence;
			if (isRightAssociative) Jsep$1.right_associative.add(op_name);
			else Jsep$1.right_associative.delete(op_name);
			return Jsep$1;
		}
		/**
		* @method addIdentifierChar
		* @param {string} char The additional character to treat as a valid part of an identifier
		* @returns {Jsep}
		*/
		static addIdentifierChar(char) {
			Jsep$1.additional_identifier_chars.add(char);
			return Jsep$1;
		}
		/**
		* @method addLiteral
		* @param {string} literal_name The name of the literal to add
		* @param {*} literal_value The value of the literal
		* @returns {Jsep}
		*/
		static addLiteral(literal_name, literal_value) {
			Jsep$1.literals[literal_name] = literal_value;
			return Jsep$1;
		}
		/**
		* @method removeUnaryOp
		* @param {string} op_name The name of the unary op to remove
		* @returns {Jsep}
		*/
		static removeUnaryOp(op_name) {
			delete Jsep$1.unary_ops[op_name];
			if (op_name.length === Jsep$1.max_unop_len) Jsep$1.max_unop_len = Jsep$1.getMaxKeyLen(Jsep$1.unary_ops);
			return Jsep$1;
		}
		/**
		* @method removeAllUnaryOps
		* @returns {Jsep}
		*/
		static removeAllUnaryOps() {
			Jsep$1.unary_ops = {};
			Jsep$1.max_unop_len = 0;
			return Jsep$1;
		}
		/**
		* @method removeIdentifierChar
		* @param {string} char The additional character to stop treating as a valid part of an identifier
		* @returns {Jsep}
		*/
		static removeIdentifierChar(char) {
			Jsep$1.additional_identifier_chars.delete(char);
			return Jsep$1;
		}
		/**
		* @method removeBinaryOp
		* @param {string} op_name The name of the binary op to remove
		* @returns {Jsep}
		*/
		static removeBinaryOp(op_name) {
			delete Jsep$1.binary_ops[op_name];
			if (op_name.length === Jsep$1.max_binop_len) Jsep$1.max_binop_len = Jsep$1.getMaxKeyLen(Jsep$1.binary_ops);
			Jsep$1.right_associative.delete(op_name);
			return Jsep$1;
		}
		/**
		* @method removeAllBinaryOps
		* @returns {Jsep}
		*/
		static removeAllBinaryOps() {
			Jsep$1.binary_ops = {};
			Jsep$1.max_binop_len = 0;
			return Jsep$1;
		}
		/**
		* @method removeLiteral
		* @param {string} literal_name The name of the literal to remove
		* @returns {Jsep}
		*/
		static removeLiteral(literal_name) {
			delete Jsep$1.literals[literal_name];
			return Jsep$1;
		}
		/**
		* @method removeAllLiterals
		* @returns {Jsep}
		*/
		static removeAllLiterals() {
			Jsep$1.literals = {};
			return Jsep$1;
		}
		/**
		* @returns {string}
		*/
		get char() {
			return this.expr.charAt(this.index);
		}
		/**
		* @returns {number}
		*/
		get code() {
			return this.expr.charCodeAt(this.index);
		}
		/**
		* @param {string} expr a string with the passed in express
		* @returns Jsep
		*/
		constructor(expr) {
			this.expr = expr;
			this.index = 0;
		}
		/**
		* static top-level parser
		* @returns {jsep.Expression}
		*/
		static parse(expr) {
			return new Jsep$1(expr).parse();
		}
		/**
		* Get the longest key length of any object
		* @param {object} obj
		* @returns {number}
		*/
		static getMaxKeyLen(obj) {
			return Math.max(0, ...Object.keys(obj).map((k) => k.length));
		}
		/**
		* `ch` is a character code in the next three functions
		* @param {number} ch
		* @returns {boolean}
		*/
		static isDecimalDigit(ch) {
			return ch >= 48 && ch <= 57;
		}
		/**
		* Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.
		* @param {string} op_val
		* @returns {number}
		*/
		static binaryPrecedence(op_val) {
			return Jsep$1.binary_ops[op_val] || 0;
		}
		/**
		* Looks for start of identifier
		* @param {number} ch
		* @returns {boolean}
		*/
		static isIdentifierStart(ch) {
			return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 128 && !Jsep$1.binary_ops[String.fromCharCode(ch)] || Jsep$1.additional_identifier_chars.has(String.fromCharCode(ch));
		}
		/**
		* @param {number} ch
		* @returns {boolean}
		*/
		static isIdentifierPart(ch) {
			return Jsep$1.isIdentifierStart(ch) || Jsep$1.isDecimalDigit(ch);
		}
		/**
		* throw error at index of the expression
		* @param {string} message
		* @throws
		*/
		throwError(message) {
			const error = /* @__PURE__ */ new Error(message + " at character " + this.index);
			error.index = this.index;
			error.description = message;
			throw error;
		}
		/**
		* Run a given hook
		* @param {string} name
		* @param {jsep.Expression|false} [node]
		* @returns {?jsep.Expression}
		*/
		runHook(name$1, node) {
			if (Jsep$1.hooks[name$1]) {
				const env = {
					context: this,
					node
				};
				Jsep$1.hooks.run(name$1, env);
				return env.node;
			}
			return node;
		}
		/**
		* Runs a given hook until one returns a node
		* @param {string} name
		* @returns {?jsep.Expression}
		*/
		searchHook(name$1) {
			if (Jsep$1.hooks[name$1]) {
				const env = { context: this };
				Jsep$1.hooks[name$1].find(function(callback) {
					callback.call(env.context, env);
					return env.node;
				});
				return env.node;
			}
		}
		/**
		* Push `index` up to the next non-space character
		*/
		gobbleSpaces() {
			let ch = this.code;
			while (ch === Jsep$1.SPACE_CODE || ch === Jsep$1.TAB_CODE || ch === Jsep$1.LF_CODE || ch === Jsep$1.CR_CODE) ch = this.expr.charCodeAt(++this.index);
			this.runHook("gobble-spaces");
		}
		/**
		* Top-level method to parse all expressions and returns compound or single node
		* @returns {jsep.Expression}
		*/
		parse() {
			this.runHook("before-all");
			const nodes = this.gobbleExpressions();
			const node = nodes.length === 1 ? nodes[0] : {
				type: Jsep$1.COMPOUND,
				body: nodes
			};
			return this.runHook("after-all", node);
		}
		/**
		* top-level parser (but can be reused within as well)
		* @param {number} [untilICode]
		* @returns {jsep.Expression[]}
		*/
		gobbleExpressions(untilICode) {
			let nodes = [], ch_i, node;
			while (this.index < this.expr.length) {
				ch_i = this.code;
				if (ch_i === Jsep$1.SEMCOL_CODE || ch_i === Jsep$1.COMMA_CODE) this.index++;
				else if (node = this.gobbleExpression()) nodes.push(node);
				else if (this.index < this.expr.length) {
					if (ch_i === untilICode) break;
					this.throwError("Unexpected \"" + this.char + "\"");
				}
			}
			return nodes;
		}
		/**
		* The main parsing function.
		* @returns {?jsep.Expression}
		*/
		gobbleExpression() {
			const node = this.searchHook("gobble-expression") || this.gobbleBinaryExpression();
			this.gobbleSpaces();
			return this.runHook("after-expression", node);
		}
		/**
		* Search for the operation portion of the string (e.g. `+`, `===`)
		* Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)
		* and move down from 3 to 2 to 1 character until a matching binary operation is found
		* then, return that binary operation
		* @returns {string|boolean}
		*/
		gobbleBinaryOp() {
			this.gobbleSpaces();
			let to_check = this.expr.substr(this.index, Jsep$1.max_binop_len);
			let tc_len = to_check.length;
			while (tc_len > 0) {
				if (Jsep$1.binary_ops.hasOwnProperty(to_check) && (!Jsep$1.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep$1.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
					this.index += tc_len;
					return to_check;
				}
				to_check = to_check.substr(0, --tc_len);
			}
			return false;
		}
		/**
		* This function is responsible for gobbling an individual expression,
		* e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`
		* @returns {?jsep.BinaryExpression}
		*/
		gobbleBinaryExpression() {
			let node, biop, prec, stack, biop_info, left, right, i, cur_biop;
			left = this.gobbleToken();
			if (!left) return left;
			biop = this.gobbleBinaryOp();
			if (!biop) return left;
			biop_info = {
				value: biop,
				prec: Jsep$1.binaryPrecedence(biop),
				right_a: Jsep$1.right_associative.has(biop)
			};
			right = this.gobbleToken();
			if (!right) this.throwError("Expected expression after " + biop);
			stack = [
				left,
				biop_info,
				right
			];
			while (biop = this.gobbleBinaryOp()) {
				prec = Jsep$1.binaryPrecedence(biop);
				if (prec === 0) {
					this.index -= biop.length;
					break;
				}
				biop_info = {
					value: biop,
					prec,
					right_a: Jsep$1.right_associative.has(biop)
				};
				cur_biop = biop;
				const comparePrev = (prev) => biop_info.right_a && prev.right_a ? prec > prev.prec : prec <= prev.prec;
				while (stack.length > 2 && comparePrev(stack[stack.length - 2])) {
					right = stack.pop();
					biop = stack.pop().value;
					left = stack.pop();
					node = {
						type: Jsep$1.BINARY_EXP,
						operator: biop,
						left,
						right
					};
					stack.push(node);
				}
				node = this.gobbleToken();
				if (!node) this.throwError("Expected expression after " + cur_biop);
				stack.push(biop_info, node);
			}
			i = stack.length - 1;
			node = stack[i];
			while (i > 1) {
				node = {
					type: Jsep$1.BINARY_EXP,
					operator: stack[i - 1].value,
					left: stack[i - 2],
					right: node
				};
				i -= 2;
			}
			return node;
		}
		/**
		* An individual part of a binary expression:
		* e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis)
		* @returns {boolean|jsep.Expression}
		*/
		gobbleToken() {
			let ch, to_check, tc_len, node;
			this.gobbleSpaces();
			node = this.searchHook("gobble-token");
			if (node) return this.runHook("after-token", node);
			ch = this.code;
			if (Jsep$1.isDecimalDigit(ch) || ch === Jsep$1.PERIOD_CODE) return this.gobbleNumericLiteral();
			if (ch === Jsep$1.SQUOTE_CODE || ch === Jsep$1.DQUOTE_CODE) node = this.gobbleStringLiteral();
			else if (ch === Jsep$1.OBRACK_CODE) node = this.gobbleArray();
			else {
				to_check = this.expr.substr(this.index, Jsep$1.max_unop_len);
				tc_len = to_check.length;
				while (tc_len > 0) {
					if (Jsep$1.unary_ops.hasOwnProperty(to_check) && (!Jsep$1.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep$1.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
						this.index += tc_len;
						const argument = this.gobbleToken();
						if (!argument) this.throwError("missing unaryOp argument");
						return this.runHook("after-token", {
							type: Jsep$1.UNARY_EXP,
							operator: to_check,
							argument,
							prefix: true
						});
					}
					to_check = to_check.substr(0, --tc_len);
				}
				if (Jsep$1.isIdentifierStart(ch)) {
					node = this.gobbleIdentifier();
					if (Jsep$1.literals.hasOwnProperty(node.name)) node = {
						type: Jsep$1.LITERAL,
						value: Jsep$1.literals[node.name],
						raw: node.name
					};
					else if (node.name === Jsep$1.this_str) node = { type: Jsep$1.THIS_EXP };
				} else if (ch === Jsep$1.OPAREN_CODE) node = this.gobbleGroup();
			}
			if (!node) return this.runHook("after-token", false);
			node = this.gobbleTokenProperty(node);
			return this.runHook("after-token", node);
		}
		/**
		* Gobble properties of of identifiers/strings/arrays/groups.
		* e.g. `foo`, `bar.baz`, `foo['bar'].baz`
		* It also gobbles function calls:
		* e.g. `Math.acos(obj.angle)`
		* @param {jsep.Expression} node
		* @returns {jsep.Expression}
		*/
		gobbleTokenProperty(node) {
			this.gobbleSpaces();
			let ch = this.code;
			while (ch === Jsep$1.PERIOD_CODE || ch === Jsep$1.OBRACK_CODE || ch === Jsep$1.OPAREN_CODE || ch === Jsep$1.QUMARK_CODE) {
				let optional;
				if (ch === Jsep$1.QUMARK_CODE) {
					if (this.expr.charCodeAt(this.index + 1) !== Jsep$1.PERIOD_CODE) break;
					optional = true;
					this.index += 2;
					this.gobbleSpaces();
					ch = this.code;
				}
				this.index++;
				if (ch === Jsep$1.OBRACK_CODE) {
					node = {
						type: Jsep$1.MEMBER_EXP,
						computed: true,
						object: node,
						property: this.gobbleExpression()
					};
					if (!node.property) this.throwError("Unexpected \"" + this.char + "\"");
					this.gobbleSpaces();
					ch = this.code;
					if (ch !== Jsep$1.CBRACK_CODE) this.throwError("Unclosed [");
					this.index++;
				} else if (ch === Jsep$1.OPAREN_CODE) node = {
					type: Jsep$1.CALL_EXP,
					"arguments": this.gobbleArguments(Jsep$1.CPAREN_CODE),
					callee: node
				};
				else if (ch === Jsep$1.PERIOD_CODE || optional) {
					if (optional) this.index--;
					this.gobbleSpaces();
					node = {
						type: Jsep$1.MEMBER_EXP,
						computed: false,
						object: node,
						property: this.gobbleIdentifier()
					};
				}
				if (optional) node.optional = true;
				this.gobbleSpaces();
				ch = this.code;
			}
			return node;
		}
		/**
		* Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to
		* keep track of everything in the numeric literal and then calling `parseFloat` on that string
		* @returns {jsep.Literal}
		*/
		gobbleNumericLiteral() {
			let number = "", ch, chCode;
			while (Jsep$1.isDecimalDigit(this.code)) number += this.expr.charAt(this.index++);
			if (this.code === Jsep$1.PERIOD_CODE) {
				number += this.expr.charAt(this.index++);
				while (Jsep$1.isDecimalDigit(this.code)) number += this.expr.charAt(this.index++);
			}
			ch = this.char;
			if (ch === "e" || ch === "E") {
				number += this.expr.charAt(this.index++);
				ch = this.char;
				if (ch === "+" || ch === "-") number += this.expr.charAt(this.index++);
				while (Jsep$1.isDecimalDigit(this.code)) number += this.expr.charAt(this.index++);
				if (!Jsep$1.isDecimalDigit(this.expr.charCodeAt(this.index - 1))) this.throwError("Expected exponent (" + number + this.char + ")");
			}
			chCode = this.code;
			if (Jsep$1.isIdentifierStart(chCode)) this.throwError("Variable names cannot start with a number (" + number + this.char + ")");
			else if (chCode === Jsep$1.PERIOD_CODE || number.length === 1 && number.charCodeAt(0) === Jsep$1.PERIOD_CODE) this.throwError("Unexpected period");
			return {
				type: Jsep$1.LITERAL,
				value: parseFloat(number),
				raw: number
			};
		}
		/**
		* Parses a string literal, staring with single or double quotes with basic support for escape codes
		* e.g. `"hello world"`, `'this is\nJSEP'`
		* @returns {jsep.Literal}
		*/
		gobbleStringLiteral() {
			let str = "";
			const startIndex = this.index;
			const quote = this.expr.charAt(this.index++);
			let closed = false;
			while (this.index < this.expr.length) {
				let ch = this.expr.charAt(this.index++);
				if (ch === quote) {
					closed = true;
					break;
				} else if (ch === "\\") {
					ch = this.expr.charAt(this.index++);
					switch (ch) {
						case "n":
							str += "\n";
							break;
						case "r":
							str += "\r";
							break;
						case "t":
							str += "	";
							break;
						case "b":
							str += "\b";
							break;
						case "f":
							str += "\f";
							break;
						case "v":
							str += "\v";
							break;
						default: str += ch;
					}
				} else str += ch;
			}
			if (!closed) this.throwError("Unclosed quote after \"" + str + "\"");
			return {
				type: Jsep$1.LITERAL,
				value: str,
				raw: this.expr.substring(startIndex, this.index)
			};
		}
		/**
		* Gobbles only identifiers
		* e.g.: `foo`, `_value`, `$x1`
		* Also, this function checks if that identifier is a literal:
		* (e.g. `true`, `false`, `null`) or `this`
		* @returns {jsep.Identifier}
		*/
		gobbleIdentifier() {
			let ch = this.code, start = this.index;
			if (Jsep$1.isIdentifierStart(ch)) this.index++;
			else this.throwError("Unexpected " + this.char);
			while (this.index < this.expr.length) {
				ch = this.code;
				if (Jsep$1.isIdentifierPart(ch)) this.index++;
				else break;
			}
			return {
				type: Jsep$1.IDENTIFIER,
				name: this.expr.slice(start, this.index)
			};
		}
		/**
		* Gobbles a list of arguments within the context of a function call
		* or array literal. This function also assumes that the opening character
		* `(` or `[` has already been gobbled, and gobbles expressions and commas
		* until the terminator character `)` or `]` is encountered.
		* e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`
		* @param {number} termination
		* @returns {jsep.Expression[]}
		*/
		gobbleArguments(termination) {
			const args = [];
			let closed = false;
			let separator_count = 0;
			while (this.index < this.expr.length) {
				this.gobbleSpaces();
				let ch_i = this.code;
				if (ch_i === termination) {
					closed = true;
					this.index++;
					if (termination === Jsep$1.CPAREN_CODE && separator_count && separator_count >= args.length) this.throwError("Unexpected token " + String.fromCharCode(termination));
					break;
				} else if (ch_i === Jsep$1.COMMA_CODE) {
					this.index++;
					separator_count++;
					if (separator_count !== args.length) {
						if (termination === Jsep$1.CPAREN_CODE) this.throwError("Unexpected token ,");
						else if (termination === Jsep$1.CBRACK_CODE) for (let arg = args.length; arg < separator_count; arg++) args.push(null);
					}
				} else if (args.length !== separator_count && separator_count !== 0) this.throwError("Expected comma");
				else {
					const node = this.gobbleExpression();
					if (!node || node.type === Jsep$1.COMPOUND) this.throwError("Expected comma");
					args.push(node);
				}
			}
			if (!closed) this.throwError("Expected " + String.fromCharCode(termination));
			return args;
		}
		/**
		* Responsible for parsing a group of things within parentheses `()`
		* that have no identifier in front (so not a function call)
		* This function assumes that it needs to gobble the opening parenthesis
		* and then tries to gobble everything within that parenthesis, assuming
		* that the next thing it should see is the close parenthesis. If not,
		* then the expression probably doesn't have a `)`
		* @returns {boolean|jsep.Expression}
		*/
		gobbleGroup() {
			this.index++;
			let nodes = this.gobbleExpressions(Jsep$1.CPAREN_CODE);
			if (this.code === Jsep$1.CPAREN_CODE) {
				this.index++;
				if (nodes.length === 1) return nodes[0];
				else if (!nodes.length) return false;
				else return {
					type: Jsep$1.SEQUENCE_EXP,
					expressions: nodes
				};
			} else this.throwError("Unclosed (");
		}
		/**
		* Responsible for parsing Array literals `[1, 2, 3]`
		* This function assumes that it needs to gobble the opening bracket
		* and then tries to gobble the expressions as arguments.
		* @returns {jsep.ArrayExpression}
		*/
		gobbleArray() {
			this.index++;
			return {
				type: Jsep$1.ARRAY_EXP,
				elements: this.gobbleArguments(Jsep$1.CBRACK_CODE)
			};
		}
	};
	const hooks = new Hooks();
	Object.assign(Jsep, {
		hooks,
		plugins: new Plugins(Jsep),
		COMPOUND: "Compound",
		SEQUENCE_EXP: "SequenceExpression",
		IDENTIFIER: "Identifier",
		MEMBER_EXP: "MemberExpression",
		LITERAL: "Literal",
		THIS_EXP: "ThisExpression",
		CALL_EXP: "CallExpression",
		UNARY_EXP: "UnaryExpression",
		BINARY_EXP: "BinaryExpression",
		ARRAY_EXP: "ArrayExpression",
		TAB_CODE: 9,
		LF_CODE: 10,
		CR_CODE: 13,
		SPACE_CODE: 32,
		PERIOD_CODE: 46,
		COMMA_CODE: 44,
		SQUOTE_CODE: 39,
		DQUOTE_CODE: 34,
		OPAREN_CODE: 40,
		CPAREN_CODE: 41,
		OBRACK_CODE: 91,
		CBRACK_CODE: 93,
		QUMARK_CODE: 63,
		SEMCOL_CODE: 59,
		COLON_CODE: 58,
		unary_ops: {
			"-": 1,
			"!": 1,
			"~": 1,
			"+": 1
		},
		binary_ops: {
			"||": 1,
			"??": 1,
			"&&": 2,
			"|": 3,
			"^": 4,
			"&": 5,
			"==": 6,
			"!=": 6,
			"===": 6,
			"!==": 6,
			"<": 7,
			">": 7,
			"<=": 7,
			">=": 7,
			"<<": 8,
			">>": 8,
			">>>": 8,
			"+": 9,
			"-": 9,
			"*": 10,
			"/": 10,
			"%": 10,
			"**": 11
		},
		right_associative: new Set(["**"]),
		additional_identifier_chars: new Set(["$", "_"]),
		literals: {
			"true": true,
			"false": false,
			"null": null
		},
		this_str: "this"
	});
	Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
	Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
	const jsep = (expr) => new Jsep(expr).parse();
	const stdClassProps = Object.getOwnPropertyNames(class Test {});
	Object.getOwnPropertyNames(Jsep).filter((prop) => !stdClassProps.includes(prop) && jsep[prop] === void 0).forEach((m) => {
		jsep[m] = Jsep[m];
	});
	jsep.Jsep = Jsep;
	const CONDITIONAL_EXP = "ConditionalExpression";
	jsep.plugins.register({
		name: "ternary",
		init(jsep$1) {
			jsep$1.hooks.add("after-expression", function gobbleTernary(env) {
				if (env.node && this.code === jsep$1.QUMARK_CODE) {
					this.index++;
					const test = env.node;
					const consequent = this.gobbleExpression();
					if (!consequent) this.throwError("Expected expression");
					this.gobbleSpaces();
					if (this.code === jsep$1.COLON_CODE) {
						this.index++;
						const alternate = this.gobbleExpression();
						if (!alternate) this.throwError("Expected expression");
						env.node = {
							type: CONDITIONAL_EXP,
							test,
							consequent,
							alternate
						};
						if (test.operator && jsep$1.binary_ops[test.operator] <= .9) {
							let newTest = test;
							while (newTest.right.operator && jsep$1.binary_ops[newTest.right.operator] <= .9) newTest = newTest.right;
							env.node.test = newTest.right;
							newTest.right = env.node;
							env.node = test;
						}
					} else this.throwError("Expected :");
				}
			});
		}
	});
	const FSLASH_CODE = 47;
	const BSLASH_CODE = 92;
	var index = {
		name: "regex",
		init(jsep$1) {
			jsep$1.hooks.add("gobble-token", function gobbleRegexLiteral(env) {
				if (this.code === FSLASH_CODE) {
					const patternIndex = ++this.index;
					let inCharSet = false;
					while (this.index < this.expr.length) {
						if (this.code === FSLASH_CODE && !inCharSet) {
							const pattern = this.expr.slice(patternIndex, this.index);
							let flags = "";
							while (++this.index < this.expr.length) {
								const code = this.code;
								if (code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57) flags += this.char;
								else break;
							}
							let value;
							try {
								value = new RegExp(pattern, flags);
							} catch (e) {
								this.throwError(e.message);
							}
							env.node = {
								type: jsep$1.LITERAL,
								value,
								raw: this.expr.slice(patternIndex - 1, this.index)
							};
							env.node = this.gobbleTokenProperty(env.node);
							return env.node;
						}
						if (this.code === jsep$1.OBRACK_CODE) inCharSet = true;
						else if (inCharSet && this.code === jsep$1.CBRACK_CODE) inCharSet = false;
						this.index += this.code === BSLASH_CODE ? 2 : 1;
					}
					this.throwError("Unclosed Regex");
				}
			});
		}
	};
	const PLUS_CODE = 43;
	const plugin$1 = {
		name: "assignment",
		assignmentOperators: new Set([
			"=",
			"*=",
			"**=",
			"/=",
			"%=",
			"+=",
			"-=",
			"<<=",
			">>=",
			">>>=",
			"&=",
			"^=",
			"|=",
			"||=",
			"&&=",
			"??="
		]),
		updateOperators: [PLUS_CODE, 45],
		assignmentPrecedence: .9,
		init(jsep$1) {
			const updateNodeTypes = [jsep$1.IDENTIFIER, jsep$1.MEMBER_EXP];
			plugin$1.assignmentOperators.forEach((op) => jsep$1.addBinaryOp(op, plugin$1.assignmentPrecedence, true));
			jsep$1.hooks.add("gobble-token", function gobbleUpdatePrefix(env) {
				const code = this.code;
				if (plugin$1.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
					this.index += 2;
					env.node = {
						type: "UpdateExpression",
						operator: code === PLUS_CODE ? "++" : "--",
						argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
						prefix: true
					};
					if (!env.node.argument || !updateNodeTypes.includes(env.node.argument.type)) this.throwError(`Unexpected ${env.node.operator}`);
				}
			});
			jsep$1.hooks.add("after-token", function gobbleUpdatePostfix(env) {
				if (env.node) {
					const code = this.code;
					if (plugin$1.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
						if (!updateNodeTypes.includes(env.node.type)) this.throwError(`Unexpected ${env.node.operator}`);
						this.index += 2;
						env.node = {
							type: "UpdateExpression",
							operator: code === PLUS_CODE ? "++" : "--",
							argument: env.node,
							prefix: false
						};
					}
				}
			});
			jsep$1.hooks.add("after-expression", function gobbleAssignment(env) {
				if (env.node) updateBinariesToAssignments(env.node);
			});
			function updateBinariesToAssignments(node) {
				if (plugin$1.assignmentOperators.has(node.operator)) {
					node.type = "AssignmentExpression";
					updateBinariesToAssignments(node.left);
					updateBinariesToAssignments(node.right);
				} else if (!node.operator) Object.values(node).forEach((val) => {
					if (val && typeof val === "object") updateBinariesToAssignments(val);
				});
			}
		}
	};
	jsep.plugins.register(index, plugin$1);
	jsep.addUnaryOp("typeof");
	jsep.addLiteral("null", null);
	jsep.addLiteral("undefined", void 0);
	const BLOCKED_PROTO_PROPERTIES = new Set([
		"constructor",
		"__proto__",
		"__defineGetter__",
		"__defineSetter__"
	]);
	const SafeEval = {
		evalAst(ast, subs) {
			switch (ast.type) {
				case "BinaryExpression":
				case "LogicalExpression": return SafeEval.evalBinaryExpression(ast, subs);
				case "Compound": return SafeEval.evalCompound(ast, subs);
				case "ConditionalExpression": return SafeEval.evalConditionalExpression(ast, subs);
				case "Identifier": return SafeEval.evalIdentifier(ast, subs);
				case "Literal": return SafeEval.evalLiteral(ast, subs);
				case "MemberExpression": return SafeEval.evalMemberExpression(ast, subs);
				case "UnaryExpression": return SafeEval.evalUnaryExpression(ast, subs);
				case "ArrayExpression": return SafeEval.evalArrayExpression(ast, subs);
				case "CallExpression": return SafeEval.evalCallExpression(ast, subs);
				case "AssignmentExpression": return SafeEval.evalAssignmentExpression(ast, subs);
				default: throw SyntaxError("Unexpected expression", ast);
			}
		},
		evalBinaryExpression(ast, subs) {
			return {
				"||": (a, b) => a || b(),
				"&&": (a, b) => a && b(),
				"|": (a, b) => a | b(),
				"^": (a, b) => a ^ b(),
				"&": (a, b) => a & b(),
				"==": (a, b) => a == b(),
				"!=": (a, b) => a != b(),
				"===": (a, b) => a === b(),
				"!==": (a, b) => a !== b(),
				"<": (a, b) => a < b(),
				">": (a, b) => a > b(),
				"<=": (a, b) => a <= b(),
				">=": (a, b) => a >= b(),
				"<<": (a, b) => a << b(),
				">>": (a, b) => a >> b(),
				">>>": (a, b) => a >>> b(),
				"+": (a, b) => a + b(),
				"-": (a, b) => a - b(),
				"*": (a, b) => a * b(),
				"/": (a, b) => a / b(),
				"%": (a, b) => a % b()
			}[ast.operator](SafeEval.evalAst(ast.left, subs), () => SafeEval.evalAst(ast.right, subs));
		},
		evalCompound(ast, subs) {
			let last;
			for (let i = 0; i < ast.body.length; i++) {
				if (ast.body[i].type === "Identifier" && [
					"var",
					"let",
					"const"
				].includes(ast.body[i].name) && ast.body[i + 1] && ast.body[i + 1].type === "AssignmentExpression") i += 1;
				const expr = ast.body[i];
				last = SafeEval.evalAst(expr, subs);
			}
			return last;
		},
		evalConditionalExpression(ast, subs) {
			if (SafeEval.evalAst(ast.test, subs)) return SafeEval.evalAst(ast.consequent, subs);
			return SafeEval.evalAst(ast.alternate, subs);
		},
		evalIdentifier(ast, subs) {
			if (Object.hasOwn(subs, ast.name)) return subs[ast.name];
			throw ReferenceError(`${ast.name} is not defined`);
		},
		evalLiteral(ast) {
			return ast.value;
		},
		evalMemberExpression(ast, subs) {
			const prop = String(ast.computed ? SafeEval.evalAst(ast.property) : ast.property.name);
			const obj = SafeEval.evalAst(ast.object, subs);
			if (obj === void 0 || obj === null) throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
			if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
			const result = obj[prop];
			if (typeof result === "function") return result.bind(obj);
			return result;
		},
		evalUnaryExpression(ast, subs) {
			return {
				"-": (a) => -SafeEval.evalAst(a, subs),
				"!": (a) => !SafeEval.evalAst(a, subs),
				"~": (a) => ~SafeEval.evalAst(a, subs),
				"+": (a) => +SafeEval.evalAst(a, subs),
				typeof: (a) => typeof SafeEval.evalAst(a, subs)
			}[ast.operator](ast.argument);
		},
		evalArrayExpression(ast, subs) {
			return ast.elements.map((el) => SafeEval.evalAst(el, subs));
		},
		evalCallExpression(ast, subs) {
			const args = ast.arguments.map((arg) => SafeEval.evalAst(arg, subs));
			return SafeEval.evalAst(ast.callee, subs)(...args);
		},
		evalAssignmentExpression(ast, subs) {
			if (ast.left.type !== "Identifier") throw SyntaxError("Invalid left-hand side in assignment");
			const id = ast.left.name;
			subs[id] = SafeEval.evalAst(ast.right, subs);
			return subs[id];
		}
	};
	/**
	* A replacement for NodeJS' VM.Script which is also {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP | Content Security Policy} friendly.
	*/
	var SafeScript = class {
		/**
		* @param {string} expr Expression to evaluate
		*/
		constructor(expr) {
			this.code = expr;
			this.ast = jsep(this.code);
		}
		/**
		* @param {object} context Object whose items will be added
		*   to evaluation
		* @returns {EvaluatedResult} Result of evaluated code
		*/
		runInNewContext(context) {
			const keyMap = Object.assign(Object.create(null), context);
			return SafeEval.evalAst(this.ast, keyMap);
		}
	};
	/**
	* @typedef {null|boolean|number|string|object|GenericArray} JSONObject
	*/
	/**
	* @typedef {any} AnyItem
	*/
	/**
	* @typedef {any} AnyResult
	*/
	/**
	* Copies array and then pushes item into it.
	* @param {GenericArray} arr Array to copy and into which to push
	* @param {AnyItem} item Array item to add (to end)
	* @returns {GenericArray} Copy of the original array
	*/
	function push(arr, item) {
		arr = arr.slice();
		arr.push(item);
		return arr;
	}
	/**
	* Copies array and then unshifts item into it.
	* @param {AnyItem} item Array item to add (to beginning)
	* @param {GenericArray} arr Array to copy and into which to unshift
	* @returns {GenericArray} Copy of the original array
	*/
	function unshift(item, arr) {
		arr = arr.slice();
		arr.unshift(item);
		return arr;
	}
	/**
	* Caught when JSONPath is used without `new` but rethrown if with `new`
	* @extends Error
	*/
	var NewError = class extends Error {
		/**
		* @param {AnyResult} value The evaluated scalar value
		*/
		constructor(value) {
			super("JSONPath should not be called with \"new\" (it prevents return of (unwrapped) scalar values)");
			this.avoidNew = true;
			this.value = value;
			this.name = "NewError";
		}
	};
	/**
	* @typedef {object} ReturnObject
	* @property {string} path
	* @property {JSONObject} value
	* @property {object|GenericArray} parent
	* @property {string} parentProperty
	*/
	/**
	* @callback JSONPathCallback
	* @param {string|object} preferredOutput
	* @param {"value"|"property"} type
	* @param {ReturnObject} fullRetObj
	* @returns {void}
	*/
	/**
	* @callback OtherTypeCallback
	* @param {JSONObject} val
	* @param {string} path
	* @param {object|GenericArray} parent
	* @param {string} parentPropName
	* @returns {boolean}
	*/
	/**
	* @typedef {any} ContextItem
	*/
	/**
	* @typedef {any} EvaluatedResult
	*/
	/**
	* @callback EvalCallback
	* @param {string} code
	* @param {ContextItem} context
	* @returns {EvaluatedResult}
	*/
	/**
	* @typedef {typeof SafeScript} EvalClass
	*/
	/**
	* @typedef {object} JSONPathOptions
	* @property {JSON} json
	* @property {string|string[]} path
	* @property {"value"|"path"|"pointer"|"parent"|"parentProperty"|
	*   "all"} [resultType="value"]
	* @property {boolean} [flatten=false]
	* @property {boolean} [wrap=true]
	* @property {object} [sandbox={}]
	* @property {EvalCallback|EvalClass|'safe'|'native'|
	*   boolean} [eval = 'safe']
	* @property {object|GenericArray|null} [parent=null]
	* @property {string|null} [parentProperty=null]
	* @property {JSONPathCallback} [callback]
	* @property {OtherTypeCallback} [otherTypeCallback] Defaults to
	*   function which throws on encountering `@other`
	* @property {boolean} [autostart=true]
	*/
	/**
	* @param {string|JSONPathOptions} opts If a string, will be treated as `expr`
	* @param {string} [expr] JSON path to evaluate
	* @param {JSON} [obj] JSON object to evaluate against
	* @param {JSONPathCallback} [callback] Passed 3 arguments: 1) desired payload
	*     per `resultType`, 2) `"value"|"property"`, 3) Full returned object with
	*     all payloads
	* @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the end
	*   of one's query, this will be invoked with the value of the item, its
	*   path, its parent, and its parent's property name, and it should return
	*   a boolean indicating whether the supplied value belongs to the "other"
	*   type or not (or it may handle transformations and return `false`).
	* @returns {JSONPath}
	* @class
	*/
	function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
		if (!(this instanceof JSONPath)) try {
			return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
		} catch (e) {
			if (!e.avoidNew) throw e;
			return e.value;
		}
		if (typeof opts === "string") {
			otherTypeCallback = callback;
			callback = obj;
			obj = expr;
			expr = opts;
			opts = null;
		}
		const optObj = opts && typeof opts === "object";
		opts = opts || {};
		this.json = opts.json || obj;
		this.path = opts.path || expr;
		this.resultType = opts.resultType || "value";
		this.flatten = opts.flatten || false;
		this.wrap = Object.hasOwn(opts, "wrap") ? opts.wrap : true;
		this.sandbox = opts.sandbox || {};
		this.eval = opts.eval === void 0 ? "safe" : opts.eval;
		this.ignoreEvalErrors = typeof opts.ignoreEvalErrors === "undefined" ? false : opts.ignoreEvalErrors;
		this.parent = opts.parent || null;
		this.parentProperty = opts.parentProperty || null;
		this.callback = opts.callback || callback || null;
		this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function() {
			throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.");
		};
		if (opts.autostart !== false) {
			const args = { path: optObj ? opts.path : expr };
			if (!optObj) args.json = obj;
			else if ("json" in opts) args.json = opts.json;
			const ret = this.evaluate(args);
			if (!ret || typeof ret !== "object") throw new NewError(ret);
			return ret;
		}
	}
	JSONPath.prototype.evaluate = function(expr, json, callback, otherTypeCallback) {
		let currParent = this.parent, currParentProperty = this.parentProperty;
		let { flatten, wrap } = this;
		this.currResultType = this.resultType;
		this.currEval = this.eval;
		this.currSandbox = this.sandbox;
		callback = callback || this.callback;
		this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
		json = json || this.json;
		expr = expr || this.path;
		if (expr && typeof expr === "object" && !Array.isArray(expr)) {
			if (!expr.path && expr.path !== "") throw new TypeError("You must supply a \"path\" property when providing an object argument to JSONPath.evaluate().");
			if (!Object.hasOwn(expr, "json")) throw new TypeError("You must supply a \"json\" property when providing an object argument to JSONPath.evaluate().");
			({json} = expr);
			flatten = Object.hasOwn(expr, "flatten") ? expr.flatten : flatten;
			this.currResultType = Object.hasOwn(expr, "resultType") ? expr.resultType : this.currResultType;
			this.currSandbox = Object.hasOwn(expr, "sandbox") ? expr.sandbox : this.currSandbox;
			wrap = Object.hasOwn(expr, "wrap") ? expr.wrap : wrap;
			this.currEval = Object.hasOwn(expr, "eval") ? expr.eval : this.currEval;
			callback = Object.hasOwn(expr, "callback") ? expr.callback : callback;
			this.currOtherTypeCallback = Object.hasOwn(expr, "otherTypeCallback") ? expr.otherTypeCallback : this.currOtherTypeCallback;
			currParent = Object.hasOwn(expr, "parent") ? expr.parent : currParent;
			currParentProperty = Object.hasOwn(expr, "parentProperty") ? expr.parentProperty : currParentProperty;
			expr = expr.path;
		}
		currParent = currParent || null;
		currParentProperty = currParentProperty || null;
		if (Array.isArray(expr)) expr = JSONPath.toPathString(expr);
		if (!expr && expr !== "" || !json) return;
		const exprList = JSONPath.toPathArray(expr);
		if (exprList[0] === "$" && exprList.length > 1) exprList.shift();
		this._hasParentSelector = null;
		const result = this._trace(exprList, json, ["$"], currParent, currParentProperty, callback).filter(function(ea) {
			return ea && !ea.isParentSelector;
		});
		if (!result.length) return wrap ? [] : void 0;
		if (!wrap && result.length === 1 && !result[0].hasArrExpr) return this._getPreferredOutput(result[0]);
		return result.reduce((rslt, ea) => {
			const valOrPath = this._getPreferredOutput(ea);
			if (flatten && Array.isArray(valOrPath)) rslt = rslt.concat(valOrPath);
			else rslt.push(valOrPath);
			return rslt;
		}, []);
	};
	JSONPath.prototype._getPreferredOutput = function(ea) {
		const resultType = this.currResultType;
		switch (resultType) {
			case "all": {
				const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
				ea.pointer = JSONPath.toPointer(path);
				ea.path = typeof ea.path === "string" ? ea.path : JSONPath.toPathString(ea.path);
				return ea;
			}
			case "value":
			case "parent":
			case "parentProperty": return ea[resultType];
			case "path": return JSONPath.toPathString(ea[resultType]);
			case "pointer": return JSONPath.toPointer(ea.path);
			default: throw new TypeError("Unknown result type");
		}
	};
	JSONPath.prototype._handleCallback = function(fullRetObj, callback, type) {
		if (callback) {
			const preferredOutput = this._getPreferredOutput(fullRetObj);
			fullRetObj.path = typeof fullRetObj.path === "string" ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path);
			callback(preferredOutput, type, fullRetObj);
		}
	};
	/**
	*
	* @param {string} expr
	* @param {JSONObject} val
	* @param {string} path
	* @param {object|GenericArray} parent
	* @param {string} parentPropName
	* @param {JSONPathCallback} callback
	* @param {boolean} hasArrExpr
	* @param {boolean} literalPriority
	* @returns {ReturnObject|ReturnObject[]}
	*/
	JSONPath.prototype._trace = function(expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
		let retObj;
		if (!expr.length) {
			retObj = {
				path,
				value: val,
				parent,
				parentProperty: parentPropName,
				hasArrExpr
			};
			this._handleCallback(retObj, callback, "value");
			return retObj;
		}
		const loc = expr[0], x = expr.slice(1);
		const ret = [];
		/**
		*
		* @param {ReturnObject|ReturnObject[]} elems
		* @returns {void}
		*/
		function addRet(elems) {
			if (Array.isArray(elems)) elems.forEach((t) => {
				ret.push(t);
			});
			else ret.push(elems);
		}
		if ((typeof loc !== "string" || literalPriority) && val && Object.hasOwn(val, loc)) addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr));
		else if (loc === "*") this._walk(val, (m) => {
			addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));
		});
		else if (loc === "..") {
			addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));
			this._walk(val, (m) => {
				if (typeof val[m] === "object") addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));
			});
		} else if (loc === "^") {
			this._hasParentSelector = true;
			return {
				path: path.slice(0, -1),
				expr: x,
				isParentSelector: true
			};
		} else if (loc === "~") {
			retObj = {
				path: push(path, loc),
				value: parentPropName,
				parent,
				parentProperty: null
			};
			this._handleCallback(retObj, callback, "property");
			return retObj;
		} else if (loc === "$") addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));
		else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));
		else if (loc.indexOf("?(") === 0) {
			if (this.currEval === false) throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
			const safeLoc = loc.replace(/^\?\((.*?)\)$/u, "$1");
			const nested = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(safeLoc);
			if (nested) this._walk(val, (m) => {
				const npath = [nested[2]];
				const nvalue = nested[1] ? val[m][nested[1]] : val[m];
				if (this._trace(npath, nvalue, path, parent, parentPropName, callback, true).length > 0) addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
			});
			else this._walk(val, (m) => {
				if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
			});
		} else if (loc[0] === "(") {
			if (this.currEval === false) throw new Error("Eval [(expr)] prevented in JSONPath expression.");
			addRet(this._trace(unshift(this._eval(loc, val, path.at(-1), path.slice(0, -1), parent, parentPropName), x), val, path, parent, parentPropName, callback, hasArrExpr));
		} else if (loc[0] === "@") {
			let addType = false;
			const valueType = loc.slice(1, -2);
			switch (valueType) {
				case "scalar":
					if (!val || !["object", "function"].includes(typeof val)) addType = true;
					break;
				case "boolean":
				case "string":
				case "undefined":
				case "function":
					if (typeof val === valueType) addType = true;
					break;
				case "integer":
					if (Number.isFinite(val) && !(val % 1)) addType = true;
					break;
				case "number":
					if (Number.isFinite(val)) addType = true;
					break;
				case "nonFinite":
					if (typeof val === "number" && !Number.isFinite(val)) addType = true;
					break;
				case "object":
					if (val && typeof val === valueType) addType = true;
					break;
				case "array":
					if (Array.isArray(val)) addType = true;
					break;
				case "other":
					addType = this.currOtherTypeCallback(val, path, parent, parentPropName);
					break;
				case "null":
					if (val === null) addType = true;
					break;
				default: throw new TypeError("Unknown value type " + valueType);
			}
			if (addType) {
				retObj = {
					path,
					value: val,
					parent,
					parentProperty: parentPropName
				};
				this._handleCallback(retObj, callback, "value");
				return retObj;
			}
		} else if (loc[0] === "`" && val && Object.hasOwn(val, loc.slice(1))) {
			const locProp = loc.slice(1);
			addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));
		} else if (loc.includes(",")) {
			const parts = loc.split(",");
			for (const part of parts) addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));
		} else if (!literalPriority && val && Object.hasOwn(val, loc)) addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));
		if (this._hasParentSelector) for (let t = 0; t < ret.length; t++) {
			const rett = ret[t];
			if (rett && rett.isParentSelector) {
				const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
				if (Array.isArray(tmp)) {
					ret[t] = tmp[0];
					const tl = tmp.length;
					for (let tt = 1; tt < tl; tt++) {
						t++;
						ret.splice(t, 0, tmp[tt]);
					}
				} else ret[t] = tmp;
			}
		}
		return ret;
	};
	JSONPath.prototype._walk = function(val, f) {
		if (Array.isArray(val)) {
			const n = val.length;
			for (let i = 0; i < n; i++) f(i);
		} else if (val && typeof val === "object") Object.keys(val).forEach((m) => {
			f(m);
		});
	};
	JSONPath.prototype._slice = function(loc, expr, val, path, parent, parentPropName, callback) {
		if (!Array.isArray(val)) return;
		const len = val.length, parts = loc.split(":"), step = parts[2] && Number.parseInt(parts[2]) || 1;
		let start = parts[0] && Number.parseInt(parts[0]) || 0, end = parts[1] && Number.parseInt(parts[1]) || len;
		start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
		end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
		const ret = [];
		for (let i = start; i < end; i += step) this._trace(unshift(i, expr), val, path, parent, parentPropName, callback, true).forEach((t) => {
			ret.push(t);
		});
		return ret;
	};
	JSONPath.prototype._eval = function(code, _v, _vname, path, parent, parentPropName) {
		this.currSandbox._$_parentProperty = parentPropName;
		this.currSandbox._$_parent = parent;
		this.currSandbox._$_property = _vname;
		this.currSandbox._$_root = this.json;
		this.currSandbox._$_v = _v;
		const containsPath = code.includes("@path");
		if (containsPath) this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));
		const scriptCacheKey = this.currEval + "Script:" + code;
		if (!JSONPath.cache[scriptCacheKey]) {
			let script = code.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
			if (containsPath) script = script.replaceAll("@path", "_$_path");
			if (this.currEval === "safe" || this.currEval === true || this.currEval === void 0) JSONPath.cache[scriptCacheKey] = new this.safeVm.Script(script);
			else if (this.currEval === "native") JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
			else if (typeof this.currEval === "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
				const CurrEval = this.currEval;
				JSONPath.cache[scriptCacheKey] = new CurrEval(script);
			} else if (typeof this.currEval === "function") JSONPath.cache[scriptCacheKey] = { runInNewContext: (context) => this.currEval(script, context) };
			else throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
		}
		try {
			return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
		} catch (e) {
			if (this.ignoreEvalErrors) return false;
			throw new Error("jsonPath: " + e.message + ": " + code);
		}
	};
	JSONPath.cache = {};
	/**
	* @param {string[]} pathArr Array to convert
	* @returns {string} The path string
	*/
	JSONPath.toPathString = function(pathArr) {
		const x = pathArr, n = x.length;
		let p = "$";
		for (let i = 1; i < n; i++) if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) p += /^[0-9*]+$/u.test(x[i]) ? "[" + x[i] + "]" : "['" + x[i] + "']";
		return p;
	};
	/**
	* @param {string} pointer JSON Path
	* @returns {string} JSON Pointer
	*/
	JSONPath.toPointer = function(pointer) {
		const x = pointer, n = x.length;
		let p = "";
		for (let i = 1; i < n; i++) if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) p += "/" + x[i].toString().replaceAll("~", "~0").replaceAll("/", "~1");
		return p;
	};
	/**
	* @param {string} expr Expression to convert
	* @returns {string[]}
	*/
	JSONPath.toPathArray = function(expr) {
		const { cache } = JSONPath;
		if (cache[expr]) return cache[expr].concat();
		const subx = [];
		cache[expr] = expr.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function($0, $1) {
			return "[#" + (subx.push($1) - 1) + "]";
		}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function($0, prop) {
			return "['" + prop.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
		}).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function($0, ups) {
			return ";" + ups.split("").join(";") + ";";
		}).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "").split(";").map(function(exp) {
			const match = exp.match(/#(\d+)/u);
			return !match || !match[1] ? exp : subx[match[1]];
		});
		return cache[expr].concat();
	};
	JSONPath.prototype.safeVm = { Script: SafeScript };
	JSONPath.prototype.vm = vm.default;
	function filterJSONPath$1(body, path, result, join, formatted = false) {
		let items = JSONPath({
			path,
			json: JSON.parse(body)
		});
		if (items == null) return "";
		if (!Array.isArray(items)) {} else if (result === "first") items = items[0] ?? "";
		else if (result === "join") items = items.map((i) => objToStr(i, false)).join(join ?? "");
		return objToStr(items, formatted);
	}
	function objToStr(o, formatted = false) {
		if (Object.prototype.toString.call(o) === "[object Array]" || Object.prototype.toString.call(o) === "[object Object]") return formatted ? JSON.stringify(o, null, 2) : JSON.stringify(o);
		return String(o);
	}
	exports.filterJSONPath = filterJSONPath$1;
}) });

//#endregion
//#region ../template-function-xml/build/index.js
var require_build = /* @__PURE__ */ __commonJS$1({ "../template-function-xml/build/index.js": ((exports) => {
	var __create = Object.create;
	var __defProp = Object.defineProperty;
	var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
	var __getOwnPropNames = Object.getOwnPropertyNames;
	var __getProtoOf = Object.getPrototypeOf;
	var __hasOwnProp = Object.prototype.hasOwnProperty;
	var __commonJS = (cb, mod) => function() {
		return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
	};
	var __copyProps = (to, from, except, desc) => {
		if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$1 = 0, n = keys.length, key$1; i$1 < n; i$1++) {
			key$1 = keys[i$1];
			if (!__hasOwnProp.call(to, key$1) && key$1 !== except) __defProp(to, key$1, {
				get: ((k) => from[k]).bind(null, key$1),
				enumerable: !(desc = __getOwnPropDesc(from, key$1)) || desc.enumerable
			});
		}
		return to;
	};
	var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
		value: mod,
		enumerable: true
	}) : target, mod));
	var require_conventions = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/conventions.js": ((exports$1) => {
		/**
		* Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.
		*
		* Works with anything that has a `length` property and index access properties,
		* including NodeList.
		*
		* @param {T[] | { length: number; [number]: T }} list
		* @param {function (item: T, index: number, list:T[]):boolean} predicate
		* @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac
		* Allows injecting a custom implementation in tests (`Array.prototype` by default).
		* @returns {T | undefined}
		* @template {unknown} T
		* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
		* @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find
		*/
		function find$1(list, predicate, ac) {
			if (ac === void 0) ac = Array.prototype;
			if (list && typeof ac.find === "function") return ac.find.call(list, predicate);
			for (var i$1 = 0; i$1 < list.length; i$1++) if (hasOwn$2(list, i$1)) {
				var item = list[i$1];
				if (predicate.call(void 0, item, i$1, list)) return item;
			}
		}
		/**
		* "Shallow freezes" an object to render it immutable.
		* Uses `Object.freeze` if available,
		* otherwise the immutability is only in the type.
		*
		* Is used to create "enum like" objects.
		*
		* If `Object.getOwnPropertyDescriptors` is available,
		* a new object with all properties of object but without any prototype is created and returned
		* after freezing it.
		*
		* @param {T} object
		* The object to freeze.
		* @param {Pick<ObjectConstructor, 'create' | 'freeze' | 'getOwnPropertyDescriptors'>} [oc=Object]
		* `Object` by default,
		* allows to inject custom object constructor for tests.
		* @returns {Readonly<T>}
		* @template {Object} T
		* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
		* @prettierignore
		*/
		function freeze$1(object, oc) {
			if (oc === void 0) oc = Object;
			if (oc && typeof oc.getOwnPropertyDescriptors === "function") object = oc.create(null, oc.getOwnPropertyDescriptors(object));
			return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object;
		}
		/**
		* Implementation for `Object.hasOwn` but ES5 compatible.
		*
		* @param {any} object
		* @param {string | number} key
		* @returns {boolean}
		*/
		function hasOwn$2(object, key$1) {
			return Object.prototype.hasOwnProperty.call(object, key$1);
		}
		/**
		* Since xmldom can not rely on `Object.assign`,
		* it uses/provides a simplified version that is sufficient for its needs.
		*
		* @param {Object} target
		* @param {Object | null | undefined} source
		* @returns {Object}
		* The target with the merged/overridden properties.
		* @throws {TypeError}
		* If target is not an object.
		* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
		* @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
		*/
		function assign(target, source) {
			if (target === null || typeof target !== "object") throw new TypeError("target is not an object");
			for (var key$1 in source) if (hasOwn$2(source, key$1)) target[key$1] = source[key$1];
			return target;
		}
		/**
		* A number of attributes are boolean attributes.
		* The presence of a boolean attribute on an element represents the `true` value,
		* and the absence of the attribute represents the `false` value.
		*
		* If the attribute is present, its value must either be the empty string, or a value that is
		* an ASCII case-insensitive match for the attribute's canonical name,
		* with no leading or trailing whitespace.
		*
		* Note: The values `"true"` and `"false"` are not allowed on boolean attributes.
		* To represent a `false` value, the attribute has to be omitted altogether.
		*
		* @see https://html.spec.whatwg.org/#boolean-attributes
		* @see https://html.spec.whatwg.org/#attributes-3
		*/
		var HTML_BOOLEAN_ATTRIBUTES = freeze$1({
			allowfullscreen: true,
			async: true,
			autofocus: true,
			autoplay: true,
			checked: true,
			controls: true,
			default: true,
			defer: true,
			disabled: true,
			formnovalidate: true,
			hidden: true,
			ismap: true,
			itemscope: true,
			loop: true,
			multiple: true,
			muted: true,
			nomodule: true,
			novalidate: true,
			open: true,
			playsinline: true,
			readonly: true,
			required: true,
			reversed: true,
			selected: true
		});
		/**
		* Check if `name` is matching one of the HTML boolean attribute names.
		* This method doesn't check if such attributes are allowed in the context of the current
		* document/parsing.
		*
		* @param {string} name
		* @returns {boolean}
		* @see {@link HTML_BOOLEAN_ATTRIBUTES}
		* @see https://html.spec.whatwg.org/#boolean-attributes
		* @see https://html.spec.whatwg.org/#attributes-3
		*/
		function isHTMLBooleanAttribute(name$1) {
			return hasOwn$2(HTML_BOOLEAN_ATTRIBUTES, name$1.toLowerCase());
		}
		/**
		* Void elements only have a start tag; end tags must not be specified for void elements.
		* These elements should be written as self-closing like this: `<area />`.
		* This should not be confused with optional tags that HTML allows to omit the end tag for
		* (like `li`, `tr` and others), which can have content after them,
		* so they can not be written as self-closing.
		* xmldom does not have any logic for optional end tags cases,
		* and will report them as a warning.
		* Content that would go into the unopened element,
		* will instead be added as a sibling text node.
		*
		* @type {Readonly<{
		* 	area: boolean;
		* 	col: boolean;
		* 	img: boolean;
		* 	wbr: boolean;
		* 	link: boolean;
		* 	hr: boolean;
		* 	source: boolean;
		* 	br: boolean;
		* 	input: boolean;
		* 	param: boolean;
		* 	meta: boolean;
		* 	embed: boolean;
		* 	track: boolean;
		* 	base: boolean;
		* }>}
		* @see https://html.spec.whatwg.org/#void-elements
		* @see https://html.spec.whatwg.org/#optional-tags
		*/
		var HTML_VOID_ELEMENTS = freeze$1({
			area: true,
			base: true,
			br: true,
			col: true,
			embed: true,
			hr: true,
			img: true,
			input: true,
			link: true,
			meta: true,
			param: true,
			source: true,
			track: true,
			wbr: true
		});
		/**
		* Check if `tagName` is matching one of the HTML void element names.
		* This method doesn't check if such tags are allowed in the context of the current
		* document/parsing.
		*
		* @param {string} tagName
		* @returns {boolean}
		* @see {@link HTML_VOID_ELEMENTS}
		* @see https://html.spec.whatwg.org/#void-elements
		*/
		function isHTMLVoidElement$1(tagName) {
			return hasOwn$2(HTML_VOID_ELEMENTS, tagName.toLowerCase());
		}
		/**
		* Tag names that are raw text elements according to HTML spec.
		* The value denotes whether they are escapable or not.
		*
		* @see {@link isHTMLEscapableRawTextElement}
		* @see {@link isHTMLRawTextElement}
		* @see https://html.spec.whatwg.org/#raw-text-elements
		* @see https://html.spec.whatwg.org/#escapable-raw-text-elements
		*/
		var HTML_RAW_TEXT_ELEMENTS = freeze$1({
			script: false,
			style: false,
			textarea: true,
			title: true
		});
		/**
		* Check if `tagName` is matching one of the HTML raw text element names.
		* This method doesn't check if such tags are allowed in the context of the current
		* document/parsing.
		*
		* @param {string} tagName
		* @returns {boolean}
		* @see {@link isHTMLEscapableRawTextElement}
		* @see {@link HTML_RAW_TEXT_ELEMENTS}
		* @see https://html.spec.whatwg.org/#raw-text-elements
		* @see https://html.spec.whatwg.org/#escapable-raw-text-elements
		*/
		function isHTMLRawTextElement$2(tagName) {
			var key$1 = tagName.toLowerCase();
			return hasOwn$2(HTML_RAW_TEXT_ELEMENTS, key$1) && !HTML_RAW_TEXT_ELEMENTS[key$1];
		}
		/**
		* Check if `tagName` is matching one of the HTML escapable raw text element names.
		* This method doesn't check if such tags are allowed in the context of the current
		* document/parsing.
		*
		* @param {string} tagName
		* @returns {boolean}
		* @see {@link isHTMLRawTextElement}
		* @see {@link HTML_RAW_TEXT_ELEMENTS}
		* @see https://html.spec.whatwg.org/#raw-text-elements
		* @see https://html.spec.whatwg.org/#escapable-raw-text-elements
		*/
		function isHTMLEscapableRawTextElement$1(tagName) {
			var key$1 = tagName.toLowerCase();
			return hasOwn$2(HTML_RAW_TEXT_ELEMENTS, key$1) && HTML_RAW_TEXT_ELEMENTS[key$1];
		}
		/**
		* Only returns true if `value` matches MIME_TYPE.HTML, which indicates an HTML document.
		*
		* @param {string} mimeType
		* @returns {mimeType is 'text/html'}
		* @see https://www.iana.org/assignments/media-types/text/html
		* @see https://en.wikipedia.org/wiki/HTML
		* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString
		* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring
		*/
		function isHTMLMimeType$3(mimeType) {
			return mimeType === MIME_TYPE$2.HTML;
		}
		/**
		* For both the `text/html` and the `application/xhtml+xml` namespace the spec defines that the
		* HTML namespace is provided as the default.
		*
		* @param {string} mimeType
		* @returns {boolean}
		* @see https://dom.spec.whatwg.org/#dom-document-createelement
		* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument
		* @see https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
		*/
		function hasDefaultHTMLNamespace$2(mimeType) {
			return isHTMLMimeType$3(mimeType) || mimeType === MIME_TYPE$2.XML_XHTML_APPLICATION;
		}
		/**
		* All mime types that are allowed as input to `DOMParser.parseFromString`
		*
		* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02
		*      MDN
		* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype
		*      WHATWG HTML Spec
		* @see {@link DOMParser.prototype.parseFromString}
		*/
		var MIME_TYPE$2 = freeze$1({
			HTML: "text/html",
			XML_APPLICATION: "application/xml",
			XML_TEXT: "text/xml",
			XML_XHTML_APPLICATION: "application/xhtml+xml",
			XML_SVG_IMAGE: "image/svg+xml"
		});
		/**
		* @typedef {'application/xhtml+xml' | 'application/xml' | 'image/svg+xml' | 'text/html' | 'text/xml'}
		* MimeType
		*/
		/**
		* @type {MimeType[]}
		* @private
		* Basically `Object.values`, which is not available in ES5.
		*/
		var _MIME_TYPES = Object.keys(MIME_TYPE$2).map(function(key$1) {
			return MIME_TYPE$2[key$1];
		});
		/**
		* Only returns true if `mimeType` is one of the allowed values for
		* `DOMParser.parseFromString`.
		*
		* @param {string} mimeType
		* @returns {mimeType is 'application/xhtml+xml' | 'application/xml' | 'image/svg+xml' |  'text/html' | 'text/xml'}
		*
		*/
		function isValidMimeType$1(mimeType) {
			return _MIME_TYPES.indexOf(mimeType) > -1;
		}
		/**
		* Namespaces that are used in this code base.
		*
		* @see http://www.w3.org/TR/REC-xml-names
		*/
		var NAMESPACE$3 = freeze$1({
			HTML: "http://www.w3.org/1999/xhtml",
			SVG: "http://www.w3.org/2000/svg",
			XML: "http://www.w3.org/XML/1998/namespace",
			XMLNS: "http://www.w3.org/2000/xmlns/"
		});
		exports$1.assign = assign;
		exports$1.find = find$1;
		exports$1.freeze = freeze$1;
		exports$1.HTML_BOOLEAN_ATTRIBUTES = HTML_BOOLEAN_ATTRIBUTES;
		exports$1.HTML_RAW_TEXT_ELEMENTS = HTML_RAW_TEXT_ELEMENTS;
		exports$1.HTML_VOID_ELEMENTS = HTML_VOID_ELEMENTS;
		exports$1.hasDefaultHTMLNamespace = hasDefaultHTMLNamespace$2;
		exports$1.hasOwn = hasOwn$2;
		exports$1.isHTMLBooleanAttribute = isHTMLBooleanAttribute;
		exports$1.isHTMLRawTextElement = isHTMLRawTextElement$2;
		exports$1.isHTMLEscapableRawTextElement = isHTMLEscapableRawTextElement$1;
		exports$1.isHTMLMimeType = isHTMLMimeType$3;
		exports$1.isHTMLVoidElement = isHTMLVoidElement$1;
		exports$1.isValidMimeType = isValidMimeType$1;
		exports$1.MIME_TYPE = MIME_TYPE$2;
		exports$1.NAMESPACE = NAMESPACE$3;
	}) });
	var require_errors = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/errors.js": ((exports$1) => {
		var conventions$4 = require_conventions();
		function extendError(constructor, writableName) {
			constructor.prototype = Object.create(Error.prototype, {
				constructor: { value: constructor },
				name: {
					value: constructor.name,
					enumerable: true,
					writable: writableName
				}
			});
		}
		var DOMExceptionName$1 = conventions$4.freeze({
			Error: "Error",
			IndexSizeError: "IndexSizeError",
			DomstringSizeError: "DomstringSizeError",
			HierarchyRequestError: "HierarchyRequestError",
			WrongDocumentError: "WrongDocumentError",
			InvalidCharacterError: "InvalidCharacterError",
			NoDataAllowedError: "NoDataAllowedError",
			NoModificationAllowedError: "NoModificationAllowedError",
			NotFoundError: "NotFoundError",
			NotSupportedError: "NotSupportedError",
			InUseAttributeError: "InUseAttributeError",
			InvalidStateError: "InvalidStateError",
			SyntaxError: "SyntaxError",
			InvalidModificationError: "InvalidModificationError",
			NamespaceError: "NamespaceError",
			InvalidAccessError: "InvalidAccessError",
			ValidationError: "ValidationError",
			TypeMismatchError: "TypeMismatchError",
			SecurityError: "SecurityError",
			NetworkError: "NetworkError",
			AbortError: "AbortError",
			URLMismatchError: "URLMismatchError",
			QuotaExceededError: "QuotaExceededError",
			TimeoutError: "TimeoutError",
			InvalidNodeTypeError: "InvalidNodeTypeError",
			DataCloneError: "DataCloneError",
			EncodingError: "EncodingError",
			NotReadableError: "NotReadableError",
			UnknownError: "UnknownError",
			ConstraintError: "ConstraintError",
			DataError: "DataError",
			TransactionInactiveError: "TransactionInactiveError",
			ReadOnlyError: "ReadOnlyError",
			VersionError: "VersionError",
			OperationError: "OperationError",
			NotAllowedError: "NotAllowedError",
			OptOutError: "OptOutError"
		});
		var DOMExceptionNames = Object.keys(DOMExceptionName$1);
		function isValidDomExceptionCode(value) {
			return typeof value === "number" && value >= 1 && value <= 25;
		}
		function endsWithError(value) {
			return typeof value === "string" && value.substring(value.length - DOMExceptionName$1.Error.length) === DOMExceptionName$1.Error;
		}
		/**
		* DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation
		* is impossible to perform (either for logical reasons, because data is lost, or because the
		* implementation has become unstable). In general, DOM methods return specific error values in
		* ordinary processing situations, such as out-of-bound errors when using NodeList.
		*
		* Implementations should raise other exceptions under other circumstances. For example,
		* implementations should raise an implementation-dependent exception if a null argument is
		* passed when null was not expected.
		*
		* This implementation supports the following usages:
		* 1. according to the living standard (both arguments are optional):
		* ```
		* new DOMException("message (can be empty)", DOMExceptionNames.HierarchyRequestError)
		* ```
		* 2. according to previous xmldom implementation (only the first argument is required):
		* ```
		* new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "optional message")
		* ```
		* both result in the proper name being set.
		*
		* @class DOMException
		* @param {number | string} messageOrCode
		* The reason why an operation is not acceptable.
		* If it is a number, it is used to determine the `name`, see
		* {@link https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-258A00AF ExceptionCode}
		* @param {string | keyof typeof DOMExceptionName | Error} [nameOrMessage]
		* The `name` to use for the error.
		* If `messageOrCode` is a number, this arguments is used as the `message` instead.
		* @augments Error
		* @see https://webidl.spec.whatwg.org/#idl-DOMException
		* @see https://webidl.spec.whatwg.org/#dfn-error-names-table
		* @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-17189187
		* @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
		* @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
		*/
		function DOMException$2(messageOrCode, nameOrMessage) {
			if (isValidDomExceptionCode(messageOrCode)) {
				this.name = DOMExceptionNames[messageOrCode];
				this.message = nameOrMessage || "";
			} else {
				this.message = messageOrCode;
				this.name = endsWithError(nameOrMessage) ? nameOrMessage : DOMExceptionName$1.Error;
			}
			if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException$2);
		}
		extendError(DOMException$2, true);
		Object.defineProperties(DOMException$2.prototype, { code: {
			enumerable: true,
			get: function() {
				var code = DOMExceptionNames.indexOf(this.name);
				if (isValidDomExceptionCode(code)) return code;
				return 0;
			}
		} });
		var ExceptionCode = {
			INDEX_SIZE_ERR: 1,
			DOMSTRING_SIZE_ERR: 2,
			HIERARCHY_REQUEST_ERR: 3,
			WRONG_DOCUMENT_ERR: 4,
			INVALID_CHARACTER_ERR: 5,
			NO_DATA_ALLOWED_ERR: 6,
			NO_MODIFICATION_ALLOWED_ERR: 7,
			NOT_FOUND_ERR: 8,
			NOT_SUPPORTED_ERR: 9,
			INUSE_ATTRIBUTE_ERR: 10,
			INVALID_STATE_ERR: 11,
			SYNTAX_ERR: 12,
			INVALID_MODIFICATION_ERR: 13,
			NAMESPACE_ERR: 14,
			INVALID_ACCESS_ERR: 15,
			VALIDATION_ERR: 16,
			TYPE_MISMATCH_ERR: 17,
			SECURITY_ERR: 18,
			NETWORK_ERR: 19,
			ABORT_ERR: 20,
			URL_MISMATCH_ERR: 21,
			QUOTA_EXCEEDED_ERR: 22,
			TIMEOUT_ERR: 23,
			INVALID_NODE_TYPE_ERR: 24,
			DATA_CLONE_ERR: 25
		};
		var entries = Object.entries(ExceptionCode);
		for (var i = 0; i < entries.length; i++) {
			var key = entries[i][0];
			DOMException$2[key] = entries[i][1];
		}
		/**
		* Creates an error that will not be caught by XMLReader aka the SAX parser.
		*
		* @class
		* @param {string} message
		* @param {any} [locator]
		*/
		function ParseError$2(message, locator) {
			this.message = message;
			this.locator = locator;
			if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError$2);
		}
		extendError(ParseError$2);
		exports$1.DOMException = DOMException$2;
		exports$1.DOMExceptionName = DOMExceptionName$1;
		exports$1.ExceptionCode = ExceptionCode;
		exports$1.ParseError = ParseError$2;
	}) });
	var require_grammar = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/grammar.js": ((exports$1) => {
		/**
		* Detects relevant unicode support for regular expressions in the runtime.
		* Should the runtime not accepts the flag `u` or unicode ranges,
		* character classes without unicode handling will be used.
		*
		* @param {typeof RegExp} [RegExpImpl=RegExp]
		* For testing: the RegExp class.
		* @returns {boolean}
		* @see https://node.green/#ES2015-syntax-RegExp--y--and--u--flags
		*/
		function detectUnicodeSupport(RegExpImpl) {
			try {
				if (typeof RegExpImpl !== "function") RegExpImpl = RegExp;
				var match = new RegExpImpl("𝌆", "u").exec("𝌆");
				return !!match && match[0].length === 2;
			} catch (error) {}
			return false;
		}
		var UNICODE_SUPPORT = detectUnicodeSupport();
		/**
		* Removes `[`, `]` and any trailing quantifiers from the source of a RegExp.
		*
		* @param {RegExp} regexp
		*/
		function chars(regexp) {
			if (regexp.source[0] !== "[") throw new Error(regexp + " can not be used with chars");
			return regexp.source.slice(1, regexp.source.lastIndexOf("]"));
		}
		/**
		* Creates a new character list regular expression,
		* by removing `search` from the source of `regexp`.
		*
		* @param {RegExp} regexp
		* @param {string} search
		* The character(s) to remove.
		* @returns {RegExp}
		*/
		function chars_without(regexp, search) {
			if (regexp.source[0] !== "[") throw new Error("/" + regexp.source + "/ can not be used with chars_without");
			if (!search || typeof search !== "string") throw new Error(JSON.stringify(search) + " is not a valid search");
			if (regexp.source.indexOf(search) === -1) throw new Error("\"" + search + "\" is not is /" + regexp.source + "/");
			if (search === "-" && regexp.source.indexOf(search) !== 1) throw new Error("\"" + search + "\" is not at the first postion of /" + regexp.source + "/");
			return new RegExp(regexp.source.replace(search, ""), UNICODE_SUPPORT ? "u" : "");
		}
		/**
		* Combines and Regular expressions correctly by using `RegExp.source`.
		*
		* @param {...(RegExp | string)[]} args
		* @returns {RegExp}
		*/
		function reg(args) {
			var self = this;
			return new RegExp(Array.prototype.slice.call(arguments).map(function(part) {
				var isStr = typeof part === "string";
				if (isStr && self === void 0 && part === "|") throw new Error("use regg instead of reg to wrap expressions with `|`!");
				return isStr ? part : part.source;
			}).join(""), UNICODE_SUPPORT ? "mu" : "m");
		}
		/**
		* Like `reg` but wraps the expression in `(?:`,`)` to create a non tracking group.
		*
		* @param {...(RegExp | string)[]} args
		* @returns {RegExp}
		*/
		function regg(args) {
			if (arguments.length === 0) throw new Error("no parameters provided");
			return reg.apply(regg, ["(?:"].concat(Array.prototype.slice.call(arguments), [")"]));
		}
		/**
		* A character usually appearing in wrongly converted strings.
		*
		* @type {string}
		* @see https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character
		* @see https://nodejs.dev/en/api/v18/buffer/#buffers-and-character-encodings
		* @see https://www.unicode.org/faq/utf_bom.html#BOM
		* @readonly
		*/
		var UNICODE_REPLACEMENT_CHARACTER = "�";
		var Char = /[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;
		if (UNICODE_SUPPORT) Char = reg("[", chars(Char), "\\u{10000}-\\u{10FFFF}", "]");
		var InvalidChar = new RegExp("[^" + chars(Char) + "]", UNICODE_SUPPORT ? "u" : "");
		var _SChar = /[\x20\x09\x0D\x0A]/;
		var SChar_s = chars(_SChar);
		var S = reg(_SChar, "+");
		var S_OPT = reg(_SChar, "*");
		var NameStartChar = /[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
		if (UNICODE_SUPPORT) NameStartChar = reg("[", chars(NameStartChar), "\\u{10000}-\\u{10FFFF}", "]");
		var NameChar = reg("[", chars(NameStartChar), chars(/[-.0-9\xB7]/), chars(/[\u0300-\u036F\u203F-\u2040]/), "]");
		var Name = reg(NameStartChar, NameChar, "*");
		var Nmtoken = reg(NameChar, "+");
		var Reference = regg(reg("&", Name, ";"), "|", regg(/&#[0-9]+;|&#x[0-9a-fA-F]+;/));
		var PEReference = reg("%", Name, ";");
		var EntityValue = regg(reg("\"", regg(/[^%&"]/, "|", PEReference, "|", Reference), "*", "\""), "|", reg("'", regg(/[^%&']/, "|", PEReference, "|", Reference), "*", "'"));
		var AttValue = regg("\"", regg(/[^<&"]/, "|", Reference), "*", "\"", "|", "'", regg(/[^<&']/, "|", Reference), "*", "'");
		var NCName = reg(chars_without(NameStartChar, ":"), chars_without(NameChar, ":"), "*");
		/**
		https://www.w3.org/TR/xml-names/#ns-qualnames
		
		```
		[7] QName ::= PrefixedName | UnprefixedName
		=== (NCName ':' NCName) | NCName
		=== NCName (':' NCName)?
		[8] PrefixedName ::= Prefix ':' LocalPart
		=== NCName ':' NCName
		[9] UnprefixedName ::= LocalPart
		=== NCName
		[10] Prefix ::= NCName
		[11] LocalPart ::= NCName
		```
		*/
		var QName = reg(NCName, regg(":", NCName), "?");
		var QName_exact = reg("^", QName, "$");
		var QName_group = reg("(", QName, ")");
		var SystemLiteral = regg(/"[^"]*"|'[^']*'/);
		var PI = reg(/^<\?/, "(", Name, ")", regg(S, "(", Char, "*?)"), "?", /\?>/);
		var PubidChar = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/;
		var PubidLiteral = regg("\"", PubidChar, "*\"", "|", "'", chars_without(PubidChar, "'"), "*'");
		var COMMENT_START = "<!--";
		var COMMENT_END = "-->";
		var Comment$1 = reg(COMMENT_START, regg(chars_without(Char, "-"), "|", reg("-", chars_without(Char, "-"))), "*", COMMENT_END);
		var PCDATA = "#PCDATA";
		var contentspec = regg("EMPTY", "|", "ANY", "|", regg(reg(/\(/, S_OPT, PCDATA, regg(S_OPT, /\|/, S_OPT, QName), "*", S_OPT, /\)\*/), "|", reg(/\(/, S_OPT, PCDATA, S_OPT, /\)/)), "|", reg(/\([^>]+\)/, /[?*+]?/));
		var elementdecl = reg("<!ELEMENT", S, regg(QName, "|", PEReference), S, regg(contentspec, "|", PEReference), S_OPT, ">");
		var AttlistDecl = reg("<!ATTLIST", S, Name, regg(S, Name, S, regg(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, "|", regg(reg("NOTATION", S, /\(/, S_OPT, Name, regg(S_OPT, /\|/, S_OPT, Name), "*", S_OPT, /\)/), "|", reg(/\(/, S_OPT, Nmtoken, regg(S_OPT, /\|/, S_OPT, Nmtoken), "*", S_OPT, /\)/))), S, regg(/#REQUIRED|#IMPLIED/, "|", regg(regg("#FIXED", S), "?", AttValue))), "*", S_OPT, ">");
		var ABOUT_LEGACY_COMPAT = "about:legacy-compat";
		var ABOUT_LEGACY_COMPAT_SystemLiteral = regg("\"" + ABOUT_LEGACY_COMPAT + "\"", "|", "'" + ABOUT_LEGACY_COMPAT + "'");
		var SYSTEM = "SYSTEM";
		var PUBLIC = "PUBLIC";
		var ExternalID = regg(regg(SYSTEM, S, SystemLiteral), "|", regg(PUBLIC, S, PubidLiteral, S, SystemLiteral));
		var ExternalID_match = reg("^", regg(regg(SYSTEM, S, "(?<SystemLiteralOnly>", SystemLiteral, ")"), "|", regg(PUBLIC, S, "(?<PubidLiteral>", PubidLiteral, ")", S, "(?<SystemLiteral>", SystemLiteral, ")")));
		var PubidLiteral_match = reg("^", PubidLiteral, "$");
		var SystemLiteral_match = reg("^", SystemLiteral, "$");
		var EntityDef = regg(EntityValue, "|", regg(ExternalID, regg(S, "NDATA", S, Name), "?"));
		var ENTITY_DECL_START = "<!ENTITY";
		var EntityDecl = regg(reg(ENTITY_DECL_START, S, Name, S, EntityDef, S_OPT, ">"), "|", reg(ENTITY_DECL_START, S, "%", S, Name, S, regg(EntityValue, "|", ExternalID), S_OPT, ">"));
		var NotationDecl = reg("<!NOTATION", S, Name, S, regg(ExternalID, "|", reg(PUBLIC, S, PubidLiteral)), S_OPT, ">");
		var Eq = reg(S_OPT, "=", S_OPT);
		var VersionNum = /1[.]\d+/;
		var VersionInfo = reg(S, "version", Eq, regg("'", VersionNum, "'", "|", "\"", VersionNum, "\""));
		var EncName = /[A-Za-z][-A-Za-z0-9._]*/;
		var XMLDecl = reg(/^<\?xml/, VersionInfo, regg(S, "encoding", Eq, regg("\"", EncName, "\"", "|", "'", EncName, "'")), "?", regg(S, "standalone", Eq, regg("'", regg("yes", "|", "no"), "'", "|", "\"", regg("yes", "|", "no"), "\"")), "?", S_OPT, /\?>/);
		var DOCTYPE_DECL_START = "<!DOCTYPE";
		var CDATA_START = "<![CDATA[";
		var CDATA_END = "]]>";
		var CDSect = reg(/<!\[CDATA\[/, reg(Char, "*?", /\]\]>/));
		exports$1.chars = chars;
		exports$1.chars_without = chars_without;
		exports$1.detectUnicodeSupport = detectUnicodeSupport;
		exports$1.reg = reg;
		exports$1.regg = regg;
		exports$1.ABOUT_LEGACY_COMPAT = ABOUT_LEGACY_COMPAT;
		exports$1.ABOUT_LEGACY_COMPAT_SystemLiteral = ABOUT_LEGACY_COMPAT_SystemLiteral;
		exports$1.AttlistDecl = AttlistDecl;
		exports$1.CDATA_START = CDATA_START;
		exports$1.CDATA_END = CDATA_END;
		exports$1.CDSect = CDSect;
		exports$1.Char = Char;
		exports$1.Comment = Comment$1;
		exports$1.COMMENT_START = COMMENT_START;
		exports$1.COMMENT_END = COMMENT_END;
		exports$1.DOCTYPE_DECL_START = DOCTYPE_DECL_START;
		exports$1.elementdecl = elementdecl;
		exports$1.EntityDecl = EntityDecl;
		exports$1.EntityValue = EntityValue;
		exports$1.ExternalID = ExternalID;
		exports$1.ExternalID_match = ExternalID_match;
		exports$1.Name = Name;
		exports$1.NotationDecl = NotationDecl;
		exports$1.Reference = Reference;
		exports$1.PEReference = PEReference;
		exports$1.PI = PI;
		exports$1.PUBLIC = PUBLIC;
		exports$1.PubidLiteral = PubidLiteral;
		exports$1.PubidLiteral_match = PubidLiteral_match;
		exports$1.QName = QName;
		exports$1.QName_exact = QName_exact;
		exports$1.QName_group = QName_group;
		exports$1.S = S;
		exports$1.SChar_s = SChar_s;
		exports$1.S_OPT = S_OPT;
		exports$1.SYSTEM = SYSTEM;
		exports$1.SystemLiteral = SystemLiteral;
		exports$1.SystemLiteral_match = SystemLiteral_match;
		exports$1.InvalidChar = InvalidChar;
		exports$1.UNICODE_REPLACEMENT_CHARACTER = UNICODE_REPLACEMENT_CHARACTER;
		exports$1.UNICODE_SUPPORT = UNICODE_SUPPORT;
		exports$1.XMLDecl = XMLDecl;
	}) });
	var require_dom = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/dom.js": ((exports$1) => {
		var conventions$3 = require_conventions();
		var find = conventions$3.find;
		var hasDefaultHTMLNamespace$1 = conventions$3.hasDefaultHTMLNamespace;
		var hasOwn$1 = conventions$3.hasOwn;
		var isHTMLMimeType$2 = conventions$3.isHTMLMimeType;
		var isHTMLRawTextElement$1 = conventions$3.isHTMLRawTextElement;
		var isHTMLVoidElement = conventions$3.isHTMLVoidElement;
		var MIME_TYPE$1 = conventions$3.MIME_TYPE;
		var NAMESPACE$2 = conventions$3.NAMESPACE;
		/**
		* Private DOM Constructor symbol
		*
		* Internal symbol used for construction of all classes whose constructors should be private.
		* Currently used for checks in `Node`, `Document`, `Element`, `Attr`, `CharacterData`, `Text`, `Comment`,
		* `CDATASection`, `DocumentType`, `Notation`, `Entity`, `EntityReference`, `DocumentFragment`, `ProcessingInstruction`
		* so the constructor can't be used from outside the module.
		*/
		var PDC = Symbol();
		var errors$3 = require_errors();
		var DOMException$1 = errors$3.DOMException;
		var DOMExceptionName = errors$3.DOMExceptionName;
		var g$1 = require_grammar();
		/**
		* Checks if the given symbol equals the Private DOM Constructor symbol (PDC)
		* and throws an Illegal constructor exception when the symbols don't match.
		* This ensures that the constructor remains private and can't be used outside this module.
		*/
		function checkSymbol(symbol) {
			if (symbol !== PDC) throw new TypeError("Illegal constructor");
		}
		/**
		* A prerequisite for `[].filter`, to drop elements that are empty.
		*
		* @param {string} input
		* The string to be checked.
		* @returns {boolean}
		* Returns `true` if the input string is not empty, `false` otherwise.
		*/
		function notEmptyString(input) {
			return input !== "";
		}
		/**
		* Splits a string on ASCII whitespace characters (U+0009 TAB, U+000A LF, U+000C FF, U+000D CR,
		* U+0020 SPACE).
		* It follows the definition from the infra specification from WHATWG.
		*
		* @param {string} input
		* The string to be split.
		* @returns {string[]}
		* An array of the split strings. The array can be empty if the input string is empty or only
		* contains whitespace characters.
		* @see {@link https://infra.spec.whatwg.org/#split-on-ascii-whitespace}
		* @see {@link https://infra.spec.whatwg.org/#ascii-whitespace}
		*/
		function splitOnASCIIWhitespace(input) {
			return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
		}
		/**
		* Adds element as a key to current if it is not already present.
		*
		* @param {Record<string, boolean | undefined>} current
		* The current record object to which the element will be added as a key.
		* The object's keys are string types and values are either boolean or undefined.
		* @param {string} element
		* The string to be added as a key to the current record.
		* @returns {Record<string, boolean | undefined>}
		* The updated record object after the addition of the new element.
		*/
		function orderedSetReducer(current, element) {
			if (!hasOwn$1(current, element)) current[element] = true;
			return current;
		}
		/**
		* Converts a string into an ordered set by splitting the input on ASCII whitespace and
		* ensuring uniqueness of elements.
		* This follows the definition of an ordered set from the infra specification by WHATWG.
		*
		* @param {string} input
		* The input string to be transformed into an ordered set.
		* @returns {string[]}
		* An array of unique strings obtained from the input, preserving the original order.
		* The array can be empty if the input string is empty or only contains whitespace characters.
		* @see {@link https://infra.spec.whatwg.org/#ordered-set}
		*/
		function toOrderedSet(input) {
			if (!input) return [];
			var list = splitOnASCIIWhitespace(input);
			return Object.keys(list.reduce(orderedSetReducer, {}));
		}
		/**
		* Uses `list.indexOf` to implement a function that behaves like `Array.prototype.includes`.
		* This function is used in environments where `Array.prototype.includes` may not be available.
		*
		* @param {any[]} list
		* The array in which to search for the element.
		* @returns {function(any): boolean}
		* A function that accepts an element and returns a boolean indicating whether the element is
		* included in the provided list.
		*/
		function arrayIncludes(list) {
			return function(element) {
				return list && list.indexOf(element) !== -1;
			};
		}
		/**
		* Validates a qualified name based on the criteria provided in the DOM specification by
		* WHATWG.
		*
		* @param {string} qualifiedName
		* The qualified name to be validated.
		* @throws {DOMException}
		* With code {@link DOMException.INVALID_CHARACTER_ERR} if the qualified name contains an
		* invalid character.
		* @see {@link https://dom.spec.whatwg.org/#validate}
		*/
		function validateQualifiedName(qualifiedName) {
			if (!g$1.QName_exact.test(qualifiedName)) throw new DOMException$1(DOMException$1.INVALID_CHARACTER_ERR, "invalid character in qualified name \"" + qualifiedName + "\"");
		}
		/**
		* Validates a qualified name and the namespace associated with it,
		* based on the criteria provided in the DOM specification by WHATWG.
		*
		* @param {string | null} namespace
		* The namespace to be validated. It can be a string or null.
		* @param {string} qualifiedName
		* The qualified name to be validated.
		* @returns {[namespace: string | null, prefix: string | null, localName: string]}
		* Returns a tuple with the namespace,
		* prefix and local name of the qualified name.
		* @throws {DOMException}
		* Throws a DOMException if the qualified name or the namespace is not valid.
		* @see {@link https://dom.spec.whatwg.org/#validate-and-extract}
		*/
		function validateAndExtract(namespace, qualifiedName) {
			validateQualifiedName(qualifiedName);
			namespace = namespace || null;
			/**
			* @type {string | null}
			*/
			var prefix = null;
			var localName = qualifiedName;
			if (qualifiedName.indexOf(":") >= 0) {
				var splitResult = qualifiedName.split(":");
				prefix = splitResult[0];
				localName = splitResult[1];
			}
			if (prefix !== null && namespace === null) throw new DOMException$1(DOMException$1.NAMESPACE_ERR, "prefix is non-null and namespace is null");
			if (prefix === "xml" && namespace !== conventions$3.NAMESPACE.XML) throw new DOMException$1(DOMException$1.NAMESPACE_ERR, "prefix is \"xml\" and namespace is not the XML namespace");
			if ((prefix === "xmlns" || qualifiedName === "xmlns") && namespace !== conventions$3.NAMESPACE.XMLNS) throw new DOMException$1(DOMException$1.NAMESPACE_ERR, "either qualifiedName or prefix is \"xmlns\" and namespace is not the XMLNS namespace");
			if (namespace === conventions$3.NAMESPACE.XMLNS && prefix !== "xmlns" && qualifiedName !== "xmlns") throw new DOMException$1(DOMException$1.NAMESPACE_ERR, "namespace is the XMLNS namespace and neither qualifiedName nor prefix is \"xmlns\"");
			return [
				namespace,
				prefix,
				localName
			];
		}
		/**
		* Copies properties from one object to another.
		* It only copies the object's own (not inherited) properties.
		*
		* @param {Object} src
		* The source object from which properties are copied.
		* @param {Object} dest
		* The destination object to which properties are copied.
		*/
		function copy(src, dest) {
			for (var p in src) if (hasOwn$1(src, p)) dest[p] = src[p];
		}
		/**
		* Extends a class with the properties and methods of a super class.
		* It uses a form of prototypal inheritance, and establishes the `constructor` property
		* correctly(?).
		*
		* It is not clear to the current maintainers if this implementation is making sense,
		* since it creates an intermediate prototype function,
		* which all properties of `Super` are copied onto using `_copy`.
		*
		* @param {Object} Class
		* The class that is to be extended.
		* @param {Object} Super
		* The super class from which properties and methods are inherited.
		* @private
		*/
		function _extends(Class, Super) {
			var pt = Class.prototype;
			if (!(pt instanceof Super)) {
				function t() {}
				t.prototype = Super.prototype;
				t = new t();
				copy(pt, t);
				Class.prototype = pt = t;
			}
			if (pt.constructor != Class) {
				if (typeof Class != "function") console.error("unknown Class:" + Class);
				pt.constructor = Class;
			}
		}
		var NodeType = {};
		var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
		var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
		var TEXT_NODE = NodeType.TEXT_NODE = 3;
		var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
		var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
		var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
		var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
		var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
		var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
		var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
		var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
		var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
		var DocumentPosition = conventions$3.freeze({
			DOCUMENT_POSITION_DISCONNECTED: 1,
			DOCUMENT_POSITION_PRECEDING: 2,
			DOCUMENT_POSITION_FOLLOWING: 4,
			DOCUMENT_POSITION_CONTAINS: 8,
			DOCUMENT_POSITION_CONTAINED_BY: 16,
			DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32
		});
		/**
		* Finds the common ancestor in two parent chains.
		*
		* @param {Node[]} a
		* The first parent chain.
		* @param {Node[]} b
		* The second parent chain.
		* @returns {Node}
		* The common ancestor node if it exists. If there is no common ancestor, the function will
		* return `null`.
		*/
		function commonAncestor(a, b) {
			if (b.length < a.length) return commonAncestor(b, a);
			var c = null;
			for (var n in a) {
				if (a[n] !== b[n]) return c;
				c = a[n];
			}
			return c;
		}
		/**
		* Assigns a unique identifier to a document to ensure consistency while comparing unrelated
		* nodes.
		*
		* @param {Document} doc
		* The document to which a unique identifier is to be assigned.
		* @returns {string}
		* The unique identifier of the document. If the document already had a unique identifier, the
		* function will return the existing one.
		*/
		function docGUID(doc) {
			if (!doc.guid) doc.guid = Math.random();
			return doc.guid;
		}
		/**
		* The NodeList interface provides the abstraction of an ordered collection of nodes,
		* without defining or constraining how this collection is implemented.
		* NodeList objects in the DOM are live.
		* The items in the NodeList are accessible via an integral index, starting from 0.
		* You can also access the items of the NodeList with a `for...of` loop.
		*
		* @class NodeList
		* @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177
		* @constructs NodeList
		*/
		function NodeList() {}
		NodeList.prototype = {
			length: 0,
			item: function(index$1) {
				return index$1 >= 0 && index$1 < this.length ? this[index$1] : null;
			},
			toString: function(options) {
				var opts;
				if (typeof options === "function") opts = {
					requireWellFormed: false,
					splitCDATASections: true,
					nodeFilter: options
				};
				else if (!!options) opts = {
					requireWellFormed: !!options.requireWellFormed,
					splitCDATASections: options.splitCDATASections !== false,
					nodeFilter: options.nodeFilter || null
				};
				else opts = {
					requireWellFormed: false,
					splitCDATASections: true,
					nodeFilter: null
				};
				for (var buf = [], i$1 = 0; i$1 < this.length; i$1++) serializeToString(this[i$1], buf, null, opts);
				return buf.join("");
			},
			filter: function(predicate) {
				return Array.prototype.filter.call(this, predicate);
			},
			indexOf: function(item) {
				return Array.prototype.indexOf.call(this, item);
			}
		};
		NodeList.prototype[Symbol.iterator] = function() {
			var me = this;
			var index$1 = 0;
			return {
				next: function() {
					if (index$1 < me.length) return {
						value: me[index$1++],
						done: false
					};
					else return { done: true };
				},
				return: function() {
					return { done: true };
				}
			};
		};
		/**
		* Represents a live collection of nodes that is automatically updated when its associated
		* document changes.
		*
		* @class LiveNodeList
		* @param {Node} node
		* The associated node.
		* @param {function} refresh
		* The function to refresh the live node list.
		* @augments NodeList
		* @constructs LiveNodeList
		*/
		function LiveNodeList(node, refresh) {
			this._node = node;
			this._refresh = refresh;
			_updateLiveList(this);
		}
		/**
		* Updates the live node list.
		*
		* @param {LiveNodeList} list
		* The live node list to update.
		* @private
		*/
		function _updateLiveList(list) {
			var inc = list._node._inc || list._node.ownerDocument._inc;
			if (list._inc !== inc) {
				var ls = list._refresh(list._node);
				__set__(list, "length", ls.length);
				if (!list.$$length || ls.length < list.$$length) {
					for (var i$1 = ls.length; i$1 in list; i$1++) if (hasOwn$1(list, i$1)) delete list[i$1];
				}
				copy(ls, list);
				list._inc = inc;
			}
		}
		/**
		* Returns the node at position `index` in the LiveNodeList, or null if that is not a valid
		* index.
		*
		* @param {number} i
		* Index into the collection.
		* @returns {Node | null}
		* The node at position `index` in the LiveNodeList, or null if that is not a valid index.
		*/
		LiveNodeList.prototype.item = function(i$1) {
			_updateLiveList(this);
			return this[i$1] || null;
		};
		_extends(LiveNodeList, NodeList);
		/**
		* Objects implementing the NamedNodeMap interface are used to represent collections of nodes
		* that can be accessed by name.
		* Note that NamedNodeMap does not inherit from NodeList;
		* NamedNodeMaps are not maintained in any particular order.
		* Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal
		* index,
		* but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
		* and does not imply that the DOM specifies an order to these Nodes.
		* NamedNodeMap objects in the DOM are live.
		* used for attributes or DocumentType entities
		*
		* This implementation only supports property indices, but does not support named properties,
		* as specified in the living standard.
		*
		* @class NamedNodeMap
		* @see https://dom.spec.whatwg.org/#interface-namednodemap
		* @see https://webidl.spec.whatwg.org/#dfn-supported-property-names
		* @constructs NamedNodeMap
		*/
		function NamedNodeMap() {}
		/**
		* Returns the index of a node within the list.
		*
		* @param {Array} list
		* The list of nodes.
		* @param {Node} node
		* The node to find.
		* @returns {number}
		* The index of the node within the list, or -1 if not found.
		* @private
		*/
		function _findNodeIndex(list, node) {
			var i$1 = 0;
			while (i$1 < list.length) {
				if (list[i$1] === node) return i$1;
				i$1++;
			}
		}
		/**
		* Adds a new attribute to the list and updates the owner element of the attribute.
		*
		* @param {Element} el
		* The element which will become the owner of the new attribute.
		* @param {NamedNodeMap} list
		* The list to which the new attribute will be added.
		* @param {Attr} newAttr
		* The new attribute to be added.
		* @param {Attr} oldAttr
		* The old attribute to be replaced, or null if no attribute is to be replaced.
		* @returns {void}
		* @private
		*/
		function _addNamedNode(el, list, newAttr, oldAttr) {
			if (oldAttr) list[_findNodeIndex(list, oldAttr)] = newAttr;
			else {
				list[list.length] = newAttr;
				list.length++;
			}
			if (el) {
				newAttr.ownerElement = el;
				var doc = el.ownerDocument;
				if (doc) {
					oldAttr && _onRemoveAttribute(doc, el, oldAttr);
					_onAddAttribute(doc, el, newAttr);
				}
			}
		}
		/**
		* Removes an attribute from the list and updates the owner element of the attribute.
		*
		* @param {Element} el
		* The element which is the current owner of the attribute.
		* @param {NamedNodeMap} list
		* The list from which the attribute will be removed.
		* @param {Attr} attr
		* The attribute to be removed.
		* @returns {void}
		* @private
		*/
		function _removeNamedNode(el, list, attr) {
			var i$1 = _findNodeIndex(list, attr);
			if (i$1 >= 0) {
				var lastIndex = list.length - 1;
				while (i$1 <= lastIndex) list[i$1] = list[++i$1];
				list.length = lastIndex;
				if (el) {
					var doc = el.ownerDocument;
					if (doc) _onRemoveAttribute(doc, el, attr);
					attr.ownerElement = null;
				}
			}
		}
		NamedNodeMap.prototype = {
			length: 0,
			item: NodeList.prototype.item,
			getNamedItem: function(localName) {
				if (this._ownerElement && this._ownerElement._isInHTMLDocumentAndNamespace()) localName = localName.toLowerCase();
				var i$1 = 0;
				while (i$1 < this.length) {
					var attr = this[i$1];
					if (attr.nodeName === localName) return attr;
					i$1++;
				}
				return null;
			},
			setNamedItem: function(attr) {
				var el = attr.ownerElement;
				if (el && el !== this._ownerElement) throw new DOMException$1(DOMException$1.INUSE_ATTRIBUTE_ERR);
				var oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
				if (oldAttr === attr) return attr;
				_addNamedNode(this._ownerElement, this, attr, oldAttr);
				return oldAttr;
			},
			setNamedItemNS: function(attr) {
				return this.setNamedItem(attr);
			},
			removeNamedItem: function(localName) {
				var attr = this.getNamedItem(localName);
				if (!attr) throw new DOMException$1(DOMException$1.NOT_FOUND_ERR, localName);
				_removeNamedNode(this._ownerElement, this, attr);
				return attr;
			},
			removeNamedItemNS: function(namespaceURI, localName) {
				var attr = this.getNamedItemNS(namespaceURI, localName);
				if (!attr) throw new DOMException$1(DOMException$1.NOT_FOUND_ERR, namespaceURI ? namespaceURI + " : " + localName : localName);
				_removeNamedNode(this._ownerElement, this, attr);
				return attr;
			},
			getNamedItemNS: function(namespaceURI, localName) {
				if (!namespaceURI) namespaceURI = null;
				var i$1 = 0;
				while (i$1 < this.length) {
					var node = this[i$1];
					if (node.localName === localName && node.namespaceURI === namespaceURI) return node;
					i$1++;
				}
				return null;
			}
		};
		NamedNodeMap.prototype[Symbol.iterator] = function() {
			var me = this;
			var index$1 = 0;
			return {
				next: function() {
					if (index$1 < me.length) return {
						value: me[index$1++],
						done: false
					};
					else return { done: true };
				},
				return: function() {
					return { done: true };
				}
			};
		};
		/**
		* The DOMImplementation interface provides a number of methods for performing operations that
		* are independent of any particular instance of the document object model.
		*
		* The DOMImplementation interface represents an object providing methods which are not
		* dependent on any particular document.
		* Such an object is returned by the `Document.implementation` property.
		*
		* **The individual methods describe the differences compared to the specs**.
		*
		* @class DOMImplementation
		* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN
		* @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core
		*      (Initial)
		* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core
		* @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core
		* @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard
		* @constructs DOMImplementation
		*/
		function DOMImplementation$1() {}
		DOMImplementation$1.prototype = {
			hasFeature: function(feature, version) {
				return true;
			},
			createDocument: function(namespaceURI, qualifiedName, doctype) {
				var contentType = MIME_TYPE$1.XML_APPLICATION;
				if (namespaceURI === NAMESPACE$2.HTML) contentType = MIME_TYPE$1.XML_XHTML_APPLICATION;
				else if (namespaceURI === NAMESPACE$2.SVG) contentType = MIME_TYPE$1.XML_SVG_IMAGE;
				var doc = new Document(PDC, { contentType });
				doc.implementation = this;
				doc.childNodes = new NodeList();
				doc.doctype = doctype || null;
				if (doctype) doc.appendChild(doctype);
				if (qualifiedName) {
					var root = doc.createElementNS(namespaceURI, qualifiedName);
					doc.appendChild(root);
				}
				return doc;
			},
			createDocumentType: function(qualifiedName, publicId, systemId, internalSubset) {
				validateQualifiedName(qualifiedName);
				var node = new DocumentType(PDC);
				node.name = qualifiedName;
				node.nodeName = qualifiedName;
				node.publicId = publicId || "";
				node.systemId = systemId || "";
				node.internalSubset = internalSubset || "";
				node.childNodes = new NodeList();
				return node;
			},
			createHTMLDocument: function(title) {
				var doc = new Document(PDC, { contentType: MIME_TYPE$1.HTML });
				doc.implementation = this;
				doc.childNodes = new NodeList();
				if (title !== false) {
					doc.doctype = this.createDocumentType("html");
					doc.doctype.ownerDocument = doc;
					doc.appendChild(doc.doctype);
					var htmlNode = doc.createElement("html");
					doc.appendChild(htmlNode);
					var headNode = doc.createElement("head");
					htmlNode.appendChild(headNode);
					if (typeof title === "string") {
						var titleNode = doc.createElement("title");
						titleNode.appendChild(doc.createTextNode(title));
						headNode.appendChild(titleNode);
					}
					htmlNode.appendChild(doc.createElement("body"));
				}
				return doc;
			}
		};
		/**
		* The DOM Node interface is an abstract base class upon which many other DOM API objects are
		* based, thus letting those object types to be used similarly and often interchangeably. As an
		* abstract class, there is no such thing as a plain Node object. All objects that implement
		* Node functionality are based on one of its subclasses. Most notable are Document, Element,
		* and DocumentFragment.
		*
		* In addition, every kind of DOM node is represented by an interface based on Node. These
		* include Attr, CharacterData (which Text, Comment, CDATASection and ProcessingInstruction are
		* all based on), and DocumentType.
		*
		* In some cases, a particular feature of the base Node interface may not apply to one of its
		* child interfaces; in that case, the inheriting node may return null or throw an exception,
		* depending on circumstances. For example, attempting to add children to a node type that
		* cannot have children will throw an exception.
		*
		* **This behavior is slightly different from the in the specs**:
		* - unimplemented interfaces: `EventTarget`
		*
		* @class
		* @abstract
		* @param {Symbol} symbol
		* @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247
		* @see https://dom.spec.whatwg.org/#node
		* @prettierignore
		*/
		function Node(symbol) {
			checkSymbol(symbol);
		}
		Node.prototype = {
			firstChild: null,
			lastChild: null,
			previousSibling: null,
			nextSibling: null,
			parentNode: null,
			get parentElement() {
				return this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null;
			},
			childNodes: null,
			ownerDocument: null,
			nodeValue: null,
			namespaceURI: null,
			prefix: null,
			localName: null,
			baseURI: "about:blank",
			get isConnected() {
				var rootNode = this.getRootNode();
				return rootNode && rootNode.nodeType === rootNode.DOCUMENT_NODE;
			},
			contains: function(other) {
				if (!other) return false;
				var parent = other;
				do {
					if (this === parent) return true;
					parent = parent.parentNode;
				} while (parent);
				return false;
			},
			getRootNode: function(options) {
				var parent = this;
				do {
					if (!parent.parentNode) return parent;
					parent = parent.parentNode;
				} while (parent);
			},
			isEqualNode: function(otherNode) {
				if (!otherNode) return false;
				var stack = [{
					node: this,
					other: otherNode
				}];
				while (stack.length > 0) {
					var pair = stack.pop();
					var node = pair.node;
					var other = pair.other;
					if (node.nodeType !== other.nodeType) return false;
					switch (node.nodeType) {
						case node.DOCUMENT_TYPE_NODE:
							if (node.name !== other.name) return false;
							if (node.publicId !== other.publicId) return false;
							if (node.systemId !== other.systemId) return false;
							break;
						case node.ELEMENT_NODE:
							if (node.namespaceURI !== other.namespaceURI) return false;
							if (node.prefix !== other.prefix) return false;
							if (node.localName !== other.localName) return false;
							if (node.attributes.length !== other.attributes.length) return false;
							for (var i$1 = 0; i$1 < node.attributes.length; i$1++) {
								var attr = node.attributes.item(i$1);
								var otherAttr = other.getAttributeNodeNS(attr.namespaceURI, attr.localName);
								if (!otherAttr) return false;
								stack.push({
									node: attr,
									other: otherAttr
								});
							}
							break;
						case node.ATTRIBUTE_NODE:
							if (node.namespaceURI !== other.namespaceURI) return false;
							if (node.localName !== other.localName) return false;
							if (node.value !== other.value) return false;
							break;
						case node.PROCESSING_INSTRUCTION_NODE:
							if (node.target !== other.target || node.data !== other.data) return false;
							break;
						case node.TEXT_NODE:
						case node.CDATA_SECTION_NODE:
						case node.COMMENT_NODE:
							if (node.data !== other.data) return false;
							break;
					}
					if (node.childNodes.length !== other.childNodes.length) return false;
					for (var i$1 = node.childNodes.length - 1; i$1 >= 0; i$1--) stack.push({
						node: node.childNodes[i$1],
						other: other.childNodes[i$1]
					});
				}
				return true;
			},
			isSameNode: function(otherNode) {
				return this === otherNode;
			},
			insertBefore: function(newChild, refChild) {
				return _insertBefore(this, newChild, refChild);
			},
			replaceChild: function(newChild, oldChild) {
				_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
				if (oldChild) this.removeChild(oldChild);
			},
			removeChild: function(oldChild) {
				return _removeChild(this, oldChild);
			},
			appendChild: function(newChild) {
				return this.insertBefore(newChild, null);
			},
			hasChildNodes: function() {
				return this.firstChild != null;
			},
			cloneNode: function(deep) {
				return cloneNode(this.ownerDocument || this, this, deep);
			},
			normalize: function() {
				walkDOM(this, null, { enter: function(node) {
					var child = node.firstChild;
					while (child) {
						var next = child.nextSibling;
						if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
							node.removeChild(next);
							child.appendData(next.data);
						} else child = next;
					}
					return true;
				} });
			},
			isSupported: function(feature, version) {
				return this.ownerDocument.implementation.hasFeature(feature, version);
			},
			lookupPrefix: function(namespaceURI) {
				var el = this;
				while (el) {
					var map = el._nsMap;
					if (map) {
						for (var n in map) if (hasOwn$1(map, n) && map[n] === namespaceURI) return n;
					}
					el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
				}
				return null;
			},
			lookupNamespaceURI: function(prefix) {
				var el = this;
				while (el) {
					var map = el._nsMap;
					if (map) {
						if (hasOwn$1(map, prefix)) return map[prefix];
					}
					el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
				}
				return null;
			},
			isDefaultNamespace: function(namespaceURI) {
				return this.lookupPrefix(namespaceURI) == null;
			},
			compareDocumentPosition: function(other) {
				if (this === other) return 0;
				var node1 = other;
				var node2 = this;
				var attr1 = null;
				var attr2 = null;
				if (node1 instanceof Attr) {
					attr1 = node1;
					node1 = attr1.ownerElement;
				}
				if (node2 instanceof Attr) {
					attr2 = node2;
					node2 = attr2.ownerElement;
					if (attr1 && node1 && node2 === node1) for (var i$1 = 0, attr; attr = node2.attributes[i$1]; i$1++) {
						if (attr === attr1) return DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_PRECEDING;
						if (attr === attr2) return DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
					}
				}
				if (!node1 || !node2 || node2.ownerDocument !== node1.ownerDocument) return DocumentPosition.DOCUMENT_POSITION_DISCONNECTED + DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + (docGUID(node2.ownerDocument) > docGUID(node1.ownerDocument) ? DocumentPosition.DOCUMENT_POSITION_FOLLOWING : DocumentPosition.DOCUMENT_POSITION_PRECEDING);
				if (attr2 && node1 === node2) return DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING;
				if (attr1 && node1 === node2) return DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
				var chain1 = [];
				var ancestor1 = node1.parentNode;
				while (ancestor1) {
					if (!attr2 && ancestor1 === node2) return DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
					chain1.push(ancestor1);
					ancestor1 = ancestor1.parentNode;
				}
				chain1.reverse();
				var chain2 = [];
				var ancestor2 = node2.parentNode;
				while (ancestor2) {
					if (!attr1 && ancestor2 === node1) return DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING;
					chain2.push(ancestor2);
					ancestor2 = ancestor2.parentNode;
				}
				chain2.reverse();
				var ca = commonAncestor(chain1, chain2);
				for (var n in ca.childNodes) {
					var child = ca.childNodes[n];
					if (child === node2) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
					if (child === node1) return DocumentPosition.DOCUMENT_POSITION_PRECEDING;
					if (chain2.indexOf(child) >= 0) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;
					if (chain1.indexOf(child) >= 0) return DocumentPosition.DOCUMENT_POSITION_PRECEDING;
				}
				return 0;
			}
		};
		/**
		* Encodes special XML characters to their corresponding entities.
		*
		* @param {string} c
		* The character to be encoded.
		* @returns {string}
		* The encoded character.
		* @private
		*/
		function _xmlEncoder(c) {
			return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == "\"" && "&quot;" || "&#" + c.charCodeAt() + ";";
		}
		copy(NodeType, Node);
		copy(NodeType, Node.prototype);
		copy(DocumentPosition, Node);
		copy(DocumentPosition, Node.prototype);
		/**
		* Visits every node in the subtree rooted at `node` in depth-first pre-order.
		*
		* Delegates to {@link walkDOM} for traversal. The `callback` is called on each node;
		* if it returns a truthy value, traversal stops immediately.
		*
		* @param {Node} node
		* Root of the subtree to visit.
		* @param {function(Node): *} callback
		* Called for each node. A truthy return value stops traversal early.
		*/
		function _visitNode(node, callback) {
			walkDOM(node, null, { enter: function(n) {
				return callback(n) ? walkDOM.STOP : true;
			} });
		}
		/**
		* Depth-first pre/post-order DOM tree walker.
		*
		* Visits every node in the subtree rooted at `node`. For each node:
		*
		* 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
		* return value becomes the `context` passed to each child's `enter` call and to the matching
		* `exit` call.
		* 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
		* sibling traversal continues normally.
		* 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
		* further `enter` or `exit` calls are made.
		* 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
		* safely modify the node's own child list before the walker descends. Modifying siblings of
		* the current node or any other part of the tree produces unpredictable results: nodes already
		* queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
		* the current child list are never visited.
		* 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
		* been visited, passing the same `context` that `enter`
		* returned for that node.
		*
		* This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
		* deep trees.
		*
		* @param {Node} node
		* Root of the subtree to walk.
		* @param {*} context
		* Initial context value passed to the root node's `enter`.
		* @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
		* @returns {void | walkDOM.STOP}
		* @see ../docs/walk-dom.md.
		*/
		function walkDOM(node, context, callbacks) {
			var stack = [{
				node,
				context,
				phase: walkDOM.ENTER
			}];
			while (stack.length > 0) {
				var frame = stack.pop();
				if (frame.phase === walkDOM.ENTER) {
					var childContext = callbacks.enter(frame.node, frame.context);
					if (childContext === walkDOM.STOP) return walkDOM.STOP;
					stack.push({
						node: frame.node,
						context: childContext,
						phase: walkDOM.EXIT
					});
					if (childContext === null || childContext === void 0) continue;
					var child = frame.node.lastChild;
					while (child) {
						stack.push({
							node: child,
							context: childContext,
							phase: walkDOM.ENTER
						});
						child = child.previousSibling;
					}
				} else if (callbacks.exit) callbacks.exit(frame.node, frame.context);
			}
		}
		/**
		* Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
		* immediately.
		*
		* @type {symbol}
		*/
		walkDOM.STOP = Symbol("walkDOM.STOP");
		/**
		* Phase constant for a stack frame that has not yet been visited.
		* The `enter` callback is called and children are scheduled.
		*
		* @type {number}
		*/
		walkDOM.ENTER = 0;
		/**
		* Phase constant for a stack frame whose subtree has been fully visited.
		* The `exit` callback is called.
		*
		* @type {number}
		*/
		walkDOM.EXIT = 1;
		/**
		* @typedef DocumentOptions
		* @property {string} [contentType=MIME_TYPE.XML_APPLICATION]
		*/
		/**
		* The Document interface describes the common properties and methods for any kind of document.
		*
		* It should usually be created using `new DOMImplementation().createDocument(...)`
		* or `new DOMImplementation().createHTMLDocument(...)`.
		*
		* The constructor is considered a private API and offers to initially set the `contentType`
		* property via it's options parameter.
		*
		* @class
		* @param {Symbol} symbol
		* @param {DocumentOptions} [options]
		* @augments Node
		* @private
		* @see https://developer.mozilla.org/en-US/docs/Web/API/Document
		* @see https://dom.spec.whatwg.org/#interface-document
		*/
		function Document(symbol, options) {
			checkSymbol(symbol);
			var opt = options || {};
			this.ownerDocument = this;
			/**
			* The mime type of the document is determined at creation time and can not be modified.
			*
			* @type {string}
			* @see https://dom.spec.whatwg.org/#concept-document-content-type
			* @see {@link DOMImplementation}
			* @see {@link MIME_TYPE}
			* @readonly
			*/
			this.contentType = opt.contentType || MIME_TYPE$1.XML_APPLICATION;
			/**
			* @type {'html' | 'xml'}
			* @see https://dom.spec.whatwg.org/#concept-document-type
			* @see {@link DOMImplementation}
			* @readonly
			*/
			this.type = isHTMLMimeType$2(this.contentType) ? "html" : "xml";
		}
		/**
		* Updates the namespace mapping of an element when a new attribute is added.
		*
		* @param {Document} doc
		* The document that the element belongs to.
		* @param {Element} el
		* The element to which the attribute is being added.
		* @param {Attr} newAttr
		* The new attribute being added.
		* @private
		*/
		function _onAddAttribute(doc, el, newAttr) {
			doc && doc._inc++;
			if (newAttr.namespaceURI === NAMESPACE$2.XMLNS) el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
		}
		/**
		* Updates the namespace mapping of an element when an attribute is removed.
		*
		* @param {Document} doc
		* The document that the element belongs to.
		* @param {Element} el
		* The element from which the attribute is being removed.
		* @param {Attr} newAttr
		* The attribute being removed.
		* @param {boolean} remove
		* Indicates whether the attribute is to be removed.
		* @private
		*/
		function _onRemoveAttribute(doc, el, newAttr, remove) {
			doc && doc._inc++;
			if (newAttr.namespaceURI === NAMESPACE$2.XMLNS) delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
		}
		/**
		* Updates `parent.childNodes`, adjusting the indexed items and its `length`.
		* If `newChild` is provided and has no nextSibling, it will be appended.
		* Otherwise, it's assumed that an item has been removed or inserted,
		* and `parent.firstNode` and its `.nextSibling` to re-indexing all child nodes of `parent`.
		*
		* @param {Document} doc
		* The parent document of `el`.
		* @param {Node} parent
		* The parent node whose childNodes list needs to be updated.
		* @param {Node} [newChild]
		* The new child node to be appended. If not provided, the function assumes a node has been
		* removed.
		* @private
		*/
		function _onUpdateChild(doc, parent, newChild) {
			if (doc && doc._inc) {
				doc._inc++;
				var childNodes = parent.childNodes;
				if (newChild && !newChild.nextSibling) childNodes[childNodes.length++] = newChild;
				else {
					var child = parent.firstChild;
					var i$1 = 0;
					while (child) {
						childNodes[i$1++] = child;
						child = child.nextSibling;
					}
					childNodes.length = i$1;
					delete childNodes[childNodes.length];
				}
			}
		}
		/**
		* Removes the connections between `parentNode` and `child`
		* and any existing `child.previousSibling` or `child.nextSibling`.
		*
		* @param {Node} parentNode
		* The parent node from which the child node is to be removed.
		* @param {Node} child
		* The child node to be removed from the parentNode.
		* @returns {Node}
		* Returns the child node that was removed.
		* @throws {DOMException}
		* With code:
		* - {@link DOMException.NOT_FOUND_ERR} If the parentNode is not the parent of the child node.
		* @private
		* @see https://github.com/xmldom/xmldom/issues/135
		* @see https://github.com/xmldom/xmldom/issues/145
		*/
		function _removeChild(parentNode, child) {
			if (parentNode !== child.parentNode) throw new DOMException$1(DOMException$1.NOT_FOUND_ERR, "child's parent is not parent");
			var oldPreviousSibling = child.previousSibling;
			var oldNextSibling = child.nextSibling;
			if (oldPreviousSibling) oldPreviousSibling.nextSibling = oldNextSibling;
			else parentNode.firstChild = oldNextSibling;
			if (oldNextSibling) oldNextSibling.previousSibling = oldPreviousSibling;
			else parentNode.lastChild = oldPreviousSibling;
			_onUpdateChild(parentNode.ownerDocument, parentNode);
			child.parentNode = null;
			child.previousSibling = null;
			child.nextSibling = null;
			return child;
		}
		/**
		* Returns `true` if `node` can be a parent for insertion.
		*
		* @param {Node} node
		* @returns {boolean}
		*/
		function hasValidParentNodeType(node) {
			return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);
		}
		/**
		* Returns `true` if `node` can be inserted according to it's `nodeType`.
		*
		* @param {Node} node
		* @returns {boolean}
		*/
		function hasInsertableNodeType(node) {
			return node && (node.nodeType === Node.CDATA_SECTION_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.DOCUMENT_TYPE_NODE || node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE || node.nodeType === Node.TEXT_NODE);
		}
		/**
		* Returns true if `node` is a DOCTYPE node.
		*
		* @param {Node} node
		* @returns {boolean}
		*/
		function isDocTypeNode(node) {
			return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
		}
		/**
		* Returns true if the node is an element.
		*
		* @param {Node} node
		* @returns {boolean}
		*/
		function isElementNode(node) {
			return node && node.nodeType === Node.ELEMENT_NODE;
		}
		/**
		* Returns true if `node` is a text node.
		*
		* @param {Node} node
		* @returns {boolean}
		*/
		function isTextNode(node) {
			return node && node.nodeType === Node.TEXT_NODE;
		}
		/**
		* Check if en element node can be inserted before `child`, or at the end if child is falsy,
		* according to the presence and position of a doctype node on the same level.
		*
		* @param {Document} doc
		* The document node.
		* @param {Node} child
		* The node that would become the nextSibling if the element would be inserted.
		* @returns {boolean}
		* `true` if an element can be inserted before child.
		* @private
		*/
		function isElementInsertionPossible(doc, child) {
			var parentChildNodes = doc.childNodes || [];
			if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) return false;
			var docTypeNode = find(parentChildNodes, isDocTypeNode);
			return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
		}
		/**
		* Check if en element node can be inserted before `child`, or at the end if child is falsy,
		* according to the presence and position of a doctype node on the same level.
		*
		* @param {Node} doc
		* The document node.
		* @param {Node} child
		* The node that would become the nextSibling if the element would be inserted.
		* @returns {boolean}
		* `true` if an element can be inserted before child.
		* @private
		*/
		function isElementReplacementPossible(doc, child) {
			var parentChildNodes = doc.childNodes || [];
			function hasElementChildThatIsNotChild(node) {
				return isElementNode(node) && node !== child;
			}
			if (find(parentChildNodes, hasElementChildThatIsNotChild)) return false;
			var docTypeNode = find(parentChildNodes, isDocTypeNode);
			return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
		}
		/**
		* Asserts pre-insertion validity of a node into a parent before a child.
		* Throws errors for invalid node combinations that would result in an ill-formed DOM.
		*
		* @param {Node} parent
		* The parent node to insert `node` into.
		* @param {Node} node
		* The node to insert.
		* @param {Node | null} child
		* The node that should become the `nextSibling` of `node`. If null, no sibling is considered.
		* @throws {DOMException}
		* With code:
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If `parent` is not a Document,
		* DocumentFragment, or Element node.
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a host-including inclusive
		* ancestor of `parent`. (Currently not implemented)
		* - {@link DOMException.NOT_FOUND_ERR} If `child` is non-null and its `parent` is not
		* `parent`.
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is not a DocumentFragment,
		* DocumentType, Element, or CharacterData node.
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If either `node` is a Text node and `parent` is
		* a document, or if `node` is a doctype and `parent` is not a document.
		* @private
		* @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
		* @see https://dom.spec.whatwg.org/#concept-node-replace
		*/
		function assertPreInsertionValidity1to5(parent, node, child) {
			if (!hasValidParentNodeType(parent)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
			if (child && child.parentNode !== parent) throw new DOMException$1(DOMException$1.NOT_FOUND_ERR, "child not in parent");
			if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType);
		}
		/**
		* Asserts pre-insertion validity of a node into a document before a child.
		* Throws errors for invalid node combinations that would result in an ill-formed DOM.
		*
		* @param {Document} parent
		* The parent node to insert `node` into.
		* @param {Node} node
		* The node to insert.
		* @param {Node | undefined} child
		* The node that should become the `nextSibling` of `node`. If undefined, no sibling is
		* considered.
		* @returns {Node}
		* @throws {DOMException}
		* With code:
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentFragment with more than
		* one element child or has a Text node child.
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentFragment with one
		* element child and either `parent` has an element child, `child` is a doctype, or `child` is
		* non-null and a doctype is following `child`.
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is an Element and `parent` has an
		* element child, `child` is a doctype, or `child` is non-null and a doctype is following
		* `child`.
		* - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentType and `parent` has a
		* doctype child, `child` is non-null and an element is preceding `child`, or `child` is null
		* and `parent` has an element child.
		* @private
		* @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
		* @see https://dom.spec.whatwg.org/#concept-node-replace
		*/
		function assertPreInsertionValidityInDocument(parent, node, child) {
			var parentChildNodes = parent.childNodes || [];
			var nodeChildNodes = node.childNodes || [];
			if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
				var nodeChildElements = nodeChildNodes.filter(isElementNode);
				if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
				if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
			}
			if (isElementNode(node)) {
				if (!isElementInsertionPossible(parent, child)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
			}
			if (isDocTypeNode(node)) {
				if (find(parentChildNodes, isDocTypeNode)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
				var parentElementChild = find(parentChildNodes, isElementNode);
				if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
				if (!child && parentElementChild) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
			}
		}
		/**
		* @param {Document} parent
		* The parent node to insert `node` into.
		* @param {Node} node
		* The node to insert.
		* @param {Node | undefined} child
		* the node that should become the `nextSibling` of `node`
		* @returns {Node}
		* @throws {DOMException}
		* For several node combinations that would create a DOM that is not well-formed.
		* @throws {DOMException}
		* If `child` is provided but is not a child of `parent`.
		* @private
		* @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
		* @see https://dom.spec.whatwg.org/#concept-node-replace
		*/
		function assertPreReplacementValidityInDocument(parent, node, child) {
			var parentChildNodes = parent.childNodes || [];
			var nodeChildNodes = node.childNodes || [];
			if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
				var nodeChildElements = nodeChildNodes.filter(isElementNode);
				if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
				if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
			}
			if (isElementNode(node)) {
				if (!isElementReplacementPossible(parent, child)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
			}
			if (isDocTypeNode(node)) {
				function hasDoctypeChildThatIsNotChild(node$1) {
					return isDocTypeNode(node$1) && node$1 !== child;
				}
				if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
				var parentElementChild = find(parentChildNodes, isElementNode);
				if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) throw new DOMException$1(DOMException$1.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
			}
		}
		/**
		* Inserts a node into a parent node before a child node.
		*
		* @param {Node} parent
		* The parent node to insert the node into.
		* @param {Node} node
		* The node to insert into the parent.
		* @param {Node | null} child
		* The node that should become the next sibling of the node.
		* If null, the function inserts the node at the end of the children of the parent node.
		* @param {Function} [_inDocumentAssertion]
		* An optional function to check pre-insertion validity if parent is a document node.
		* Defaults to {@link assertPreInsertionValidityInDocument}
		* @returns {Node}
		* Returns the inserted node.
		* @throws {DOMException}
		* Throws a DOMException if inserting the node would result in a DOM tree that is not
		* well-formed. See {@link assertPreInsertionValidity1to5},
		* {@link assertPreInsertionValidityInDocument}.
		* @throws {DOMException}
		* Throws a DOMException if child is provided but is not a child of the parent. See
		* {@link Node.removeChild}
		* @private
		* @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
		*/
		function _insertBefore(parent, node, child, _inDocumentAssertion) {
			assertPreInsertionValidity1to5(parent, node, child);
			if (parent.nodeType === Node.DOCUMENT_NODE) (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
			var cp = node.parentNode;
			if (cp) cp.removeChild(node);
			if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
				var newFirst = node.firstChild;
				if (newFirst == null) return node;
				var newLast = node.lastChild;
			} else newFirst = newLast = node;
			var pre = child ? child.previousSibling : parent.lastChild;
			newFirst.previousSibling = pre;
			newLast.nextSibling = child;
			if (pre) pre.nextSibling = newFirst;
			else parent.firstChild = newFirst;
			if (child == null) parent.lastChild = newLast;
			else child.previousSibling = newLast;
			do
				newFirst.parentNode = parent;
			while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
			_onUpdateChild(parent.ownerDocument || parent, parent, node);
			if (node.nodeType == DOCUMENT_FRAGMENT_NODE) node.firstChild = node.lastChild = null;
			return node;
		}
		Document.prototype = {
			implementation: null,
			nodeName: "#document",
			nodeType: DOCUMENT_NODE,
			doctype: null,
			documentElement: null,
			_inc: 1,
			insertBefore: function(newChild, refChild) {
				if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
					var child = newChild.firstChild;
					while (child) {
						var next = child.nextSibling;
						this.insertBefore(child, refChild);
						child = next;
					}
					return newChild;
				}
				_insertBefore(this, newChild, refChild);
				newChild.ownerDocument = this;
				if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) this.documentElement = newChild;
				return newChild;
			},
			removeChild: function(oldChild) {
				var removed = _removeChild(this, oldChild);
				if (removed === this.documentElement) this.documentElement = null;
				return removed;
			},
			replaceChild: function(newChild, oldChild) {
				_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
				newChild.ownerDocument = this;
				if (oldChild) this.removeChild(oldChild);
				if (isElementNode(newChild)) this.documentElement = newChild;
			},
			importNode: function(importedNode, deep) {
				return importNode(this, importedNode, deep);
			},
			getElementById: function(id) {
				var rtv = null;
				_visitNode(this.documentElement, function(node) {
					if (node.nodeType == ELEMENT_NODE) {
						if (node.getAttribute("id") == id) {
							rtv = node;
							return true;
						}
					}
				});
				return rtv;
			},
			createElement: function(tagName) {
				var node = new Element(PDC);
				node.ownerDocument = this;
				if (this.type === "html") tagName = tagName.toLowerCase();
				if (hasDefaultHTMLNamespace$1(this.contentType)) node.namespaceURI = NAMESPACE$2.HTML;
				node.nodeName = tagName;
				node.tagName = tagName;
				node.localName = tagName;
				node.childNodes = new NodeList();
				var attrs = node.attributes = new NamedNodeMap();
				attrs._ownerElement = node;
				return node;
			},
			createDocumentFragment: function() {
				var node = new DocumentFragment(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				return node;
			},
			createTextNode: function(data) {
				var node = new Text(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				node.appendData(data);
				return node;
			},
			createComment: function(data) {
				var node = new Comment(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				node.appendData(data);
				return node;
			},
			createCDATASection: function(data) {
				if (data.indexOf("]]>") !== -1) throw new DOMException$1(DOMException$1.INVALID_CHARACTER_ERR, "data contains \"]]>\"");
				var node = new CDATASection(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				node.appendData(data);
				return node;
			},
			createProcessingInstruction: function(target, data) {
				var node = new ProcessingInstruction(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				node.nodeName = node.target = target;
				node.nodeValue = node.data = data;
				return node;
			},
			createAttribute: function(name$1) {
				if (!g$1.QName_exact.test(name$1)) throw new DOMException$1(DOMException$1.INVALID_CHARACTER_ERR, "invalid character in name \"" + name$1 + "\"");
				if (this.type === "html") name$1 = name$1.toLowerCase();
				return this._createAttribute(name$1);
			},
			_createAttribute: function(name$1) {
				var node = new Attr(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				node.name = name$1;
				node.nodeName = name$1;
				node.localName = name$1;
				node.specified = true;
				return node;
			},
			createEntityReference: function(name$1) {
				if (!g$1.Name.test(name$1)) throw new DOMException$1(DOMException$1.INVALID_CHARACTER_ERR, "not a valid xml name \"" + name$1 + "\"");
				if (this.type === "html") throw new DOMException$1("document is an html document", DOMExceptionName.NotSupportedError);
				var node = new EntityReference(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				node.nodeName = name$1;
				return node;
			},
			createElementNS: function(namespaceURI, qualifiedName) {
				var validated = validateAndExtract(namespaceURI, qualifiedName);
				var node = new Element(PDC);
				var attrs = node.attributes = new NamedNodeMap();
				node.childNodes = new NodeList();
				node.ownerDocument = this;
				node.nodeName = qualifiedName;
				node.tagName = qualifiedName;
				node.namespaceURI = validated[0];
				node.prefix = validated[1];
				node.localName = validated[2];
				attrs._ownerElement = node;
				return node;
			},
			createAttributeNS: function(namespaceURI, qualifiedName) {
				var validated = validateAndExtract(namespaceURI, qualifiedName);
				var node = new Attr(PDC);
				node.ownerDocument = this;
				node.childNodes = new NodeList();
				node.nodeName = qualifiedName;
				node.name = qualifiedName;
				node.specified = true;
				node.namespaceURI = validated[0];
				node.prefix = validated[1];
				node.localName = validated[2];
				return node;
			}
		};
		_extends(Document, Node);
		function Element(symbol) {
			checkSymbol(symbol);
			this._nsMap = Object.create(null);
		}
		Element.prototype = {
			nodeType: ELEMENT_NODE,
			attributes: null,
			getQualifiedName: function() {
				return this.prefix ? this.prefix + ":" + this.localName : this.localName;
			},
			_isInHTMLDocumentAndNamespace: function() {
				return this.ownerDocument.type === "html" && this.namespaceURI === NAMESPACE$2.HTML;
			},
			hasAttributes: function() {
				return !!(this.attributes && this.attributes.length);
			},
			hasAttribute: function(name$1) {
				return !!this.getAttributeNode(name$1);
			},
			getAttribute: function(name$1) {
				var attr = this.getAttributeNode(name$1);
				return attr ? attr.value : null;
			},
			getAttributeNode: function(name$1) {
				if (this._isInHTMLDocumentAndNamespace()) name$1 = name$1.toLowerCase();
				return this.attributes.getNamedItem(name$1);
			},
			setAttribute: function(name$1, value) {
				if (this._isInHTMLDocumentAndNamespace()) name$1 = name$1.toLowerCase();
				var attr = this.getAttributeNode(name$1);
				if (attr) attr.value = attr.nodeValue = "" + value;
				else {
					attr = this.ownerDocument._createAttribute(name$1);
					attr.value = attr.nodeValue = "" + value;
					this.setAttributeNode(attr);
				}
			},
			removeAttribute: function(name$1) {
				var attr = this.getAttributeNode(name$1);
				attr && this.removeAttributeNode(attr);
			},
			setAttributeNode: function(newAttr) {
				return this.attributes.setNamedItem(newAttr);
			},
			setAttributeNodeNS: function(newAttr) {
				return this.attributes.setNamedItemNS(newAttr);
			},
			removeAttributeNode: function(oldAttr) {
				return this.attributes.removeNamedItem(oldAttr.nodeName);
			},
			removeAttributeNS: function(namespaceURI, localName) {
				var old = this.getAttributeNodeNS(namespaceURI, localName);
				old && this.removeAttributeNode(old);
			},
			hasAttributeNS: function(namespaceURI, localName) {
				return this.getAttributeNodeNS(namespaceURI, localName) != null;
			},
			getAttributeNS: function(namespaceURI, localName) {
				var attr = this.getAttributeNodeNS(namespaceURI, localName);
				return attr ? attr.value : null;
			},
			setAttributeNS: function(namespaceURI, qualifiedName, value) {
				var localName = validateAndExtract(namespaceURI, qualifiedName)[2];
				var attr = this.getAttributeNodeNS(namespaceURI, localName);
				if (attr) attr.value = attr.nodeValue = "" + value;
				else {
					attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
					attr.value = attr.nodeValue = "" + value;
					this.setAttributeNode(attr);
				}
			},
			getAttributeNodeNS: function(namespaceURI, localName) {
				return this.attributes.getNamedItemNS(namespaceURI, localName);
			},
			getElementsByClassName: function(classNames) {
				var classNamesSet = toOrderedSet(classNames);
				return new LiveNodeList(this, function(base) {
					var ls = [];
					if (classNamesSet.length > 0) _visitNode(base, function(node) {
						if (node !== base && node.nodeType === ELEMENT_NODE) {
							var nodeClassNames = node.getAttribute("class");
							if (nodeClassNames) {
								var matches = classNames === nodeClassNames;
								if (!matches) {
									var nodeClassNamesSet = toOrderedSet(nodeClassNames);
									matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
								}
								if (matches) ls.push(node);
							}
						}
					});
					return ls;
				});
			},
			getElementsByTagName: function(qualifiedName) {
				var isHTMLDocument = (this.nodeType === DOCUMENT_NODE ? this : this.ownerDocument).type === "html";
				var lowerQualifiedName = qualifiedName.toLowerCase();
				return new LiveNodeList(this, function(base) {
					var ls = [];
					_visitNode(base, function(node) {
						if (node === base || node.nodeType !== ELEMENT_NODE) return;
						if (qualifiedName === "*") ls.push(node);
						else if (node.getQualifiedName() === (isHTMLDocument && node.namespaceURI === NAMESPACE$2.HTML ? lowerQualifiedName : qualifiedName)) ls.push(node);
					});
					return ls;
				});
			},
			getElementsByTagNameNS: function(namespaceURI, localName) {
				return new LiveNodeList(this, function(base) {
					var ls = [];
					_visitNode(base, function(node) {
						if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) ls.push(node);
					});
					return ls;
				});
			}
		};
		Document.prototype.getElementsByClassName = Element.prototype.getElementsByClassName;
		Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
		Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
		_extends(Element, Node);
		function Attr(symbol) {
			checkSymbol(symbol);
			this.namespaceURI = null;
			this.prefix = null;
			this.ownerElement = null;
		}
		Attr.prototype.nodeType = ATTRIBUTE_NODE;
		_extends(Attr, Node);
		function CharacterData(symbol) {
			checkSymbol(symbol);
		}
		CharacterData.prototype = {
			data: "",
			substringData: function(offset, count) {
				return this.data.substring(offset, offset + count);
			},
			appendData: function(text) {
				text = this.data + text;
				this.nodeValue = this.data = text;
				this.length = text.length;
			},
			insertData: function(offset, text) {
				this.replaceData(offset, 0, text);
			},
			deleteData: function(offset, count) {
				this.replaceData(offset, count, "");
			},
			replaceData: function(offset, count, text) {
				var start = this.data.substring(0, offset);
				var end = this.data.substring(offset + count);
				text = start + text + end;
				this.nodeValue = this.data = text;
				this.length = text.length;
			}
		};
		_extends(CharacterData, Node);
		function Text(symbol) {
			checkSymbol(symbol);
		}
		Text.prototype = {
			nodeName: "#text",
			nodeType: TEXT_NODE,
			splitText: function(offset) {
				var text = this.data;
				var newText = text.substring(offset);
				text = text.substring(0, offset);
				this.data = this.nodeValue = text;
				this.length = text.length;
				var newNode = this.ownerDocument.createTextNode(newText);
				if (this.parentNode) this.parentNode.insertBefore(newNode, this.nextSibling);
				return newNode;
			}
		};
		_extends(Text, CharacterData);
		function Comment(symbol) {
			checkSymbol(symbol);
		}
		Comment.prototype = {
			nodeName: "#comment",
			nodeType: COMMENT_NODE
		};
		_extends(Comment, CharacterData);
		function CDATASection(symbol) {
			checkSymbol(symbol);
		}
		CDATASection.prototype = {
			nodeName: "#cdata-section",
			nodeType: CDATA_SECTION_NODE
		};
		_extends(CDATASection, Text);
		/**
		* @class DocumentType
		* @augments Node
		* @property {string} publicId
		* The external subset public identifier, stored verbatim (including surrounding quotes).
		* Declared `readonly` by the WHATWG DOM spec; xmldom does not enforce this constraint —
		* direct property writes succeed and the written value is serialized verbatim.
		* When serialized with `requireWellFormed: true`, the serializer validates the value against
		* the XML `PubidLiteral` production and throws `InvalidStateError` if it does not match.
		* @property {string} systemId
		* The external subset system identifier, stored verbatim (including surrounding quotes).
		* Declared `readonly` by the WHATWG DOM spec; xmldom does not enforce this constraint —
		* direct property writes succeed and the written value is serialized verbatim.
		* When serialized with `requireWellFormed: true`, the serializer validates the value against
		* the XML `SystemLiteral` production and throws `InvalidStateError` if it does not match.
		* @property {string} internalSubset
		* The internal subset string (the raw content between `[` and `]`), or an empty string.
		* Declared `readonly` by the WHATWG DOM spec; xmldom does not enforce this constraint —
		* direct property writes succeed and the written value is serialized verbatim.
		* When serialized with `requireWellFormed: true`, the serializer throws `InvalidStateError`
		* if the value contains `"]>"`.
		* @see https://developer.mozilla.org/en-US/docs/Web/API/DocumentType MDN
		* @see https://dom.spec.whatwg.org/#interface-documenttype WHATWG DOM
		* @prettierignore
		*/
		function DocumentType(symbol) {
			checkSymbol(symbol);
		}
		DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
		_extends(DocumentType, Node);
		function Notation(symbol) {
			checkSymbol(symbol);
		}
		Notation.prototype.nodeType = NOTATION_NODE;
		_extends(Notation, Node);
		function Entity(symbol) {
			checkSymbol(symbol);
		}
		Entity.prototype.nodeType = ENTITY_NODE;
		_extends(Entity, Node);
		function EntityReference(symbol) {
			checkSymbol(symbol);
		}
		EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
		_extends(EntityReference, Node);
		function DocumentFragment(symbol) {
			checkSymbol(symbol);
		}
		DocumentFragment.prototype.nodeName = "#document-fragment";
		DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
		_extends(DocumentFragment, Node);
		function ProcessingInstruction(symbol) {
			checkSymbol(symbol);
		}
		ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
		_extends(ProcessingInstruction, CharacterData);
		function XMLSerializer() {}
		/**
		* Returns the result of serializing `node` to XML.
		*
		* When `options.requireWellFormed` is `true`, the serializer throws `InvalidStateError` for
		* content that would produce ill-formed XML (e.g. CDATASection data containing `"]]>"`, Text
		* data containing characters outside the XML Char production, or a Document with no
		* `documentElement`).
		*
		* When `options.splitCDATASections` is `false`, CDATASection data is emitted verbatim even
		* when it contains `"]]>"`. When `true` (the default), `"]]>"` sequences are split across
		* concatenated CDATA sections — this behavior is **deprecated** and will be removed in the
		* next breaking release. Callers should migrate to `{ requireWellFormed: true }`, which throws
		* `InvalidStateError` instead of transforming.
		*
		* __This implementation differs from the specification:__ - CDATASection serialization is not
		* specified by W3C DOM Parsing or WHATWG DOM Parsing (see
		* {@link https://github.com/w3c/DOM-Parsing/issues/38 w3c/DOM-Parsing#38}).
		* When `splitCDATASections` is `true` (the default), `"]]>"` sequences in CDATASection data
		* are split across concatenated CDATA sections — this mechanism is derived from DOM Level 3
		* Core and is **deprecated**. The split mechanics will be removed in the next breaking
		* release. Callers that rely on this behavior should migrate to `{ requireWellFormed: true }`.
		* - W3C DOM Parsing §3.2.1.1 requires well-formedness checks on Element `localName`s,
		* prefixes,
		* and attribute serialization (duplicate attributes, namespace declarations, attribute value
		* characters) when `requireWellFormed` is `true`. These checks are **not implemented** in this
		* release — see the tracking issue filed against the next breaking milestone.
		*
		* @param {Node} node
		* @param {Object | function} [options]
		* Options object, or a legacy nodeFilter function (backward compatible).
		* @param {boolean} [options.requireWellFormed=false]
		* When `true`, throws `InvalidStateError` for content that would produce ill-formed XML.
		* @param {boolean} [options.splitCDATASections=true]
		* When `true` (default), splits `"]]>"` sequences in CDATASection data across concatenated
		* CDATA sections. **Deprecated** — will be removed in the next breaking release.
		* @param {function} [options.nodeFilter]
		* A filter function applied to each node before serialization.
		* @returns {string}
		* @throws {DOMException}
		* With name `InvalidStateError` when `requireWellFormed` is `true` and any of the following
		* conditions hold:
		* - CDATASection data contains `"]]>"`
		* - Text data contains characters outside the XML Char production
		* - a Comment node's data contains `--` anywhere or ends with `-`
		* - a ProcessingInstruction's target contains `:` or is an ASCII case-insensitive match for
		* `"xml"`, or its data contains `?>` or characters outside the XML Char production
		* - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
		* production (W3C DOM Parsing §3.2.1.3; XML 1.0 production [12])
		* - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
		* production (W3C DOM Parsing §3.2.1.3; XML 1.0 production [11])
		* - a DocumentType's `internalSubset` contains `"]>"`
		* - the Document has no `documentElement`
		* @see https://developer.mozilla.org/docs/Web/API/XMLSerializer/serializeToString
		* @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
		* @see https://github.com/w3c/DOM-Parsing/issues/84
		* @prettierignore
		*/
		XMLSerializer.prototype.serializeToString = function(node, options) {
			return nodeSerializeToString.call(node, options);
		};
		Node.prototype.toString = nodeSerializeToString;
		function nodeSerializeToString(options) {
			var opts;
			if (typeof options === "function") opts = {
				requireWellFormed: false,
				splitCDATASections: true,
				nodeFilter: options
			};
			else if (options != null) opts = {
				requireWellFormed: !!options.requireWellFormed,
				splitCDATASections: options.splitCDATASections !== false,
				nodeFilter: options.nodeFilter || null
			};
			else opts = {
				requireWellFormed: false,
				splitCDATASections: true,
				nodeFilter: null
			};
			var buf = [];
			var refNode = this.nodeType === DOCUMENT_NODE && this.documentElement || this;
			var prefix = refNode.prefix;
			var uri = refNode.namespaceURI;
			if (uri && prefix == null) {
				var prefix = refNode.lookupPrefix(uri);
				if (prefix == null) var visibleNamespaces = [{
					namespace: uri,
					prefix: null
				}];
			}
			serializeToString(this, buf, visibleNamespaces, opts);
			return buf.join("");
		}
		function needNamespaceDefine(node, isHTML, visibleNamespaces) {
			var prefix = node.prefix || "";
			var uri = node.namespaceURI;
			if (!uri) return false;
			if (prefix === "xml" && uri === NAMESPACE$2.XML || uri === NAMESPACE$2.XMLNS) return false;
			var i$1 = visibleNamespaces.length;
			while (i$1--) {
				var ns = visibleNamespaces[i$1];
				if (ns.prefix === prefix) return ns.namespace !== uri;
			}
			return true;
		}
		/**
		* Literal whitespace other than space that appear in attribute values are serialized as
		* their entity references, so they will be preserved.
		* (In contrast to whitespace literals in the input which are normalized to spaces).
		*
		* Well-formed constraint: No < in Attribute Values:
		* > The replacement text of any entity referred to directly or indirectly
		* > in an attribute value must not contain a <.
		*
		* @see https://www.w3.org/TR/xml11/#CleanAttrVals
		* @see https://www.w3.org/TR/xml11/#NT-AttValue
		* @see https://www.w3.org/TR/xml11/#AVNormalize
		* @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
		* @prettierignore
		*/
		function addSerializedAttribute(buf, qualifiedName, value) {
			buf.push(" ", qualifiedName, "=\"", value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), "\"");
		}
		function serializeToString(node, buf, visibleNamespaces, opts) {
			if (!visibleNamespaces) visibleNamespaces = [];
			var nodeFilter = opts.nodeFilter;
			var requireWellFormed = opts.requireWellFormed;
			var splitCDATASections = opts.splitCDATASections;
			var isHTML = (node.nodeType === DOCUMENT_NODE ? node : node.ownerDocument).type === "html";
			walkDOM(node, { ns: visibleNamespaces }, {
				enter: function(n, ctx) {
					var namespaces = ctx.ns;
					if (nodeFilter) {
						n = nodeFilter(n);
						if (n) {
							if (typeof n == "string") {
								buf.push(n);
								return null;
							}
						} else return null;
					}
					switch (n.nodeType) {
						case ELEMENT_NODE:
							var attrs = n.attributes;
							var len = attrs.length;
							var nodeName = n.tagName;
							var prefixedNodeName = nodeName;
							if (!isHTML && !n.prefix && n.namespaceURI) {
								var defaultNS;
								for (var ai = 0; ai < attrs.length; ai++) if (attrs.item(ai).name === "xmlns") {
									defaultNS = attrs.item(ai).value;
									break;
								}
								if (!defaultNS) for (var nsi = namespaces.length - 1; nsi >= 0; nsi--) {
									var nsEntry = namespaces[nsi];
									if (nsEntry.prefix === "" && nsEntry.namespace === n.namespaceURI) {
										defaultNS = nsEntry.namespace;
										break;
									}
								}
								if (defaultNS !== n.namespaceURI) for (var nsi = namespaces.length - 1; nsi >= 0; nsi--) {
									var nsEntry = namespaces[nsi];
									if (nsEntry.namespace === n.namespaceURI) {
										if (nsEntry.prefix) prefixedNodeName = nsEntry.prefix + ":" + nodeName;
										break;
									}
								}
							}
							buf.push("<", prefixedNodeName);
							var childNamespaces = namespaces.slice();
							for (var i$1 = 0; i$1 < len; i$1++) {
								var attr = attrs.item(i$1);
								if (attr.prefix == "xmlns") childNamespaces.push({
									prefix: attr.localName,
									namespace: attr.value
								});
								else if (attr.nodeName == "xmlns") childNamespaces.push({
									prefix: "",
									namespace: attr.value
								});
							}
							for (var i$1 = 0; i$1 < len; i$1++) {
								var attr = attrs.item(i$1);
								if (needNamespaceDefine(attr, isHTML, childNamespaces)) {
									var attrPrefix = attr.prefix || "";
									var uri = attr.namespaceURI;
									addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri);
									childNamespaces.push({
										prefix: attrPrefix,
										namespace: uri
									});
								}
								var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
								if (filteredAttr) if (typeof filteredAttr === "string") buf.push(filteredAttr);
								else addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
							}
							if (nodeName === prefixedNodeName && needNamespaceDefine(n, isHTML, childNamespaces)) {
								var nodePrefix = n.prefix || "";
								var uri = n.namespaceURI;
								addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri);
								childNamespaces.push({
									prefix: nodePrefix,
									namespace: uri
								});
							}
							var canCloseTag = !n.firstChild;
							if (canCloseTag && (isHTML || n.namespaceURI === NAMESPACE$2.HTML)) canCloseTag = isHTMLVoidElement(nodeName);
							if (canCloseTag) {
								buf.push("/>");
								return null;
							}
							buf.push(">");
							if (isHTML && isHTMLRawTextElement$1(nodeName)) {
								var child = n.firstChild;
								while (child) {
									if (child.data) buf.push(child.data);
									else serializeToString(child, buf, childNamespaces.slice(), opts);
									child = child.nextSibling;
								}
								buf.push("</", prefixedNodeName, ">");
								return null;
							}
							return {
								ns: childNamespaces,
								tag: prefixedNodeName
							};
						case DOCUMENT_NODE:
						case DOCUMENT_FRAGMENT_NODE:
							if (requireWellFormed && n.nodeType === DOCUMENT_NODE && n.documentElement == null) throw new DOMException$1("The Document has no documentElement", DOMExceptionName.InvalidStateError);
							return { ns: namespaces };
						case ATTRIBUTE_NODE:
							addSerializedAttribute(buf, n.name, n.value);
							return null;
						case TEXT_NODE:
							if (requireWellFormed && g$1.InvalidChar.test(n.data)) throw new DOMException$1("The Text node data contains characters outside the XML Char production", DOMExceptionName.InvalidStateError);
							buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
							return null;
						case CDATA_SECTION_NODE:
							if (requireWellFormed && n.data.indexOf("]]>") !== -1) throw new DOMException$1("The CDATASection data contains \"]]>\"", DOMExceptionName.InvalidStateError);
							if (splitCDATASections) buf.push(g$1.CDATA_START, n.data.replace(/]]>/g, "]]]]><![CDATA[>"), g$1.CDATA_END);
							else buf.push(g$1.CDATA_START, n.data, g$1.CDATA_END);
							return null;
						case COMMENT_NODE:
							if (requireWellFormed) {
								if (g$1.InvalidChar.test(n.data)) throw new DOMException$1("The comment node data contains characters outside the XML Char production", DOMExceptionName.InvalidStateError);
								if (n.data.indexOf("--") !== -1 || n.data[n.data.length - 1] === "-") throw new DOMException$1("The comment node data contains \"--\" or ends with \"-\"", DOMExceptionName.InvalidStateError);
							}
							buf.push(g$1.COMMENT_START, n.data, g$1.COMMENT_END);
							return null;
						case DOCUMENT_TYPE_NODE:
							var pubid = n.publicId;
							var sysid = n.systemId;
							if (requireWellFormed) {
								if (pubid && !g$1.PubidLiteral_match.test(pubid)) throw new DOMException$1("DocumentType publicId is not a valid PubidLiteral", DOMExceptionName.InvalidStateError);
								if (sysid && sysid !== "." && !g$1.SystemLiteral_match.test(sysid)) throw new DOMException$1("DocumentType systemId is not a valid SystemLiteral", DOMExceptionName.InvalidStateError);
								if (n.internalSubset && n.internalSubset.indexOf("]>") !== -1) throw new DOMException$1("DocumentType internalSubset contains \"]>\"", DOMExceptionName.InvalidStateError);
							}
							buf.push(g$1.DOCTYPE_DECL_START, " ", n.name);
							if (pubid) {
								buf.push(" ", g$1.PUBLIC, " ", pubid);
								if (sysid && sysid !== ".") buf.push(" ", sysid);
							} else if (sysid && sysid !== ".") buf.push(" ", g$1.SYSTEM, " ", sysid);
							if (n.internalSubset) buf.push(" [", n.internalSubset, "]");
							buf.push(">");
							return null;
						case PROCESSING_INSTRUCTION_NODE:
							if (requireWellFormed) {
								if (n.target.indexOf(":") !== -1 || n.target.toLowerCase() === "xml") throw new DOMException$1("The ProcessingInstruction target is not well-formed", DOMExceptionName.InvalidStateError);
								if (g$1.InvalidChar.test(n.data)) throw new DOMException$1("The ProcessingInstruction data contains characters outside the XML Char production", DOMExceptionName.InvalidStateError);
								if (n.data.indexOf("?>") !== -1) throw new DOMException$1("The ProcessingInstruction data contains \"?>\"", DOMExceptionName.InvalidStateError);
							}
							buf.push("<?", n.target, " ", n.data, "?>");
							return null;
						case ENTITY_REFERENCE_NODE:
							buf.push("&", n.nodeName, ";");
							return null;
						default:
							buf.push("??", n.nodeName);
							return null;
					}
				},
				exit: function(n, childCtx) {
					if (childCtx && childCtx.tag) buf.push("</", childCtx.tag, ">");
				}
			});
		}
		/**
		* Imports a node from a different document into `doc`, creating a new copy.
		* Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
		* stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
		* Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
		* always forced to `true`
		* because an attribute's value lives in a child text node.
		*
		* @param {Document} doc
		* The document that will own the imported node.
		* @param {Node} node
		* The node to import.
		* @param {boolean} deep
		* If `true`, descendants are imported recursively.
		* @returns {Node}
		* The newly imported node, now owned by `doc`.
		*/
		function importNode(doc, node, deep) {
			var destRoot;
			walkDOM(node, null, { enter: function(srcNode, destParent) {
				var destNode = srcNode.cloneNode(false);
				destNode.ownerDocument = doc;
				destNode.parentNode = null;
				if (destParent === null) destRoot = destNode;
				else destParent.appendChild(destNode);
				return srcNode.nodeType === ATTRIBUTE_NODE || deep ? destNode : null;
			} });
			return destRoot;
		}
		/**
		* Creates a copy of a node from an existing one.
		*
		* @param {Document} doc
		* The Document object representing the document that the new node will belong to.
		* @param {Node} node
		* The node to clone.
		* @param {boolean} deep
		* If true, the contents of the node are recursively copied.
		* If false, only the node itself (and its attributes, if it is an element) are copied.
		* @returns {Node}
		* Returns the newly created copy of the node.
		* @throws {DOMException}
		* May throw a DOMException if operations within setAttributeNode or appendChild (which are
		* potentially invoked in this function) do not meet their specific constraints.
		*/
		function cloneNode(doc, node, deep) {
			var destRoot;
			walkDOM(node, null, { enter: function(srcNode, destParent) {
				var destNode = new srcNode.constructor(PDC);
				for (var n in srcNode) if (hasOwn$1(srcNode, n)) {
					var v = srcNode[n];
					if (typeof v != "object") {
						if (v != destNode[n]) destNode[n] = v;
					}
				}
				if (srcNode.childNodes) destNode.childNodes = new NodeList();
				destNode.ownerDocument = doc;
				var shouldDeep = deep;
				switch (destNode.nodeType) {
					case ELEMENT_NODE:
						var attrs = srcNode.attributes;
						var attrs2 = destNode.attributes = new NamedNodeMap();
						var len = attrs.length;
						attrs2._ownerElement = destNode;
						for (var i$1 = 0; i$1 < len; i$1++) destNode.setAttributeNode(cloneNode(doc, attrs.item(i$1), true));
						break;
					case ATTRIBUTE_NODE: shouldDeep = true;
				}
				if (destParent !== null) destParent.appendChild(destNode);
				else destRoot = destNode;
				return shouldDeep ? destNode : null;
			} });
			return destRoot;
		}
		function __set__(object, key$1, value) {
			object[key$1] = value;
		}
		function childrenRefresh(node) {
			var ls = [];
			var child = node.firstChild;
			while (child) {
				if (child.nodeType === ELEMENT_NODE) ls.push(child);
				child = child.nextSibling;
			}
			return ls;
		}
		try {
			if (Object.defineProperty) {
				Object.defineProperty(LiveNodeList.prototype, "length", { get: function() {
					_updateLiveList(this);
					return this.$$length;
				} });
				/**
				* The text content of this node and its descendants.
				*
				* For {@link Element} and {@link DocumentFragment} nodes, returns the concatenation of the
				* `nodeValue` of every descendant text node, excluding processing instruction and comment
				* nodes. For all other node types, returns `nodeValue`.
				*
				* Setting `textContent` on an element or document fragment replaces all child nodes with a
				* single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
				*
				* @type {string | null}
				* @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
				*/
				Object.defineProperty(Node.prototype, "textContent", {
					get: function() {
						if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
							var buf = [];
							walkDOM(this, null, { enter: function(n) {
								if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) return true;
								if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) return null;
								buf.push(n.nodeValue);
							} });
							return buf.join("");
						}
						return this.nodeValue;
					},
					set: function(data) {
						switch (this.nodeType) {
							case ELEMENT_NODE:
							case DOCUMENT_FRAGMENT_NODE:
								while (this.firstChild) this.removeChild(this.firstChild);
								if (data || String(data)) this.appendChild(this.ownerDocument.createTextNode(data));
								break;
							default:
								this.data = data;
								this.value = data;
								this.nodeValue = data;
						}
					}
				});
				Object.defineProperty(Element.prototype, "children", { get: function() {
					return new LiveNodeList(this, childrenRefresh);
				} });
				Object.defineProperty(Document.prototype, "children", { get: function() {
					return new LiveNodeList(this, childrenRefresh);
				} });
				Object.defineProperty(DocumentFragment.prototype, "children", { get: function() {
					return new LiveNodeList(this, childrenRefresh);
				} });
				__set__ = function(object, key$1, value) {
					object["$$" + key$1] = value;
				};
			}
		} catch (e) {}
		exports$1._updateLiveList = _updateLiveList;
		exports$1.Attr = Attr;
		exports$1.CDATASection = CDATASection;
		exports$1.CharacterData = CharacterData;
		exports$1.Comment = Comment;
		exports$1.Document = Document;
		exports$1.DocumentFragment = DocumentFragment;
		exports$1.DocumentType = DocumentType;
		exports$1.DOMImplementation = DOMImplementation$1;
		exports$1.Element = Element;
		exports$1.Entity = Entity;
		exports$1.EntityReference = EntityReference;
		exports$1.LiveNodeList = LiveNodeList;
		exports$1.NamedNodeMap = NamedNodeMap;
		exports$1.Node = Node;
		exports$1.NodeList = NodeList;
		exports$1.Notation = Notation;
		exports$1.Text = Text;
		exports$1.ProcessingInstruction = ProcessingInstruction;
		exports$1.walkDOM = walkDOM;
		exports$1.XMLSerializer = XMLSerializer;
	}) });
	var require_entities = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/entities.js": ((exports$1) => {
		var freeze = require_conventions().freeze;
		/**
		* The entities that are predefined in every XML document.
		*
		* @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
		* @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
		* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML
		*      Wikipedia
		*/
		exports$1.XML_ENTITIES = freeze({
			amp: "&",
			apos: "'",
			gt: ">",
			lt: "<",
			quot: "\""
		});
		/**
		* A map of all entities that are detected in an HTML document.
		* They contain all entries from `XML_ENTITIES`.
		*
		* @see {@link XML_ENTITIES}
		* @see {@link DOMParser.parseFromString}
		* @see {@link DOMImplementation.prototype.createHTMLDocument}
		* @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5)
		*      Spec
		* @see https://html.spec.whatwg.org/entities.json JSON
		* @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
		* @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
		* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML
		*      Wikipedia (HTML)
		* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML
		*      Wikpedia (XHTML)
		*/
		exports$1.HTML_ENTITIES = freeze({
			Aacute: "Á",
			aacute: "á",
			Abreve: "Ă",
			abreve: "ă",
			ac: "∾",
			acd: "∿",
			acE: "∾̳",
			Acirc: "Â",
			acirc: "â",
			acute: "´",
			Acy: "А",
			acy: "а",
			AElig: "Æ",
			aelig: "æ",
			af: "⁡",
			Afr: "𝔄",
			afr: "𝔞",
			Agrave: "À",
			agrave: "à",
			alefsym: "ℵ",
			aleph: "ℵ",
			Alpha: "Α",
			alpha: "α",
			Amacr: "Ā",
			amacr: "ā",
			amalg: "⨿",
			AMP: "&",
			amp: "&",
			And: "⩓",
			and: "∧",
			andand: "⩕",
			andd: "⩜",
			andslope: "⩘",
			andv: "⩚",
			ang: "∠",
			ange: "⦤",
			angle: "∠",
			angmsd: "∡",
			angmsdaa: "⦨",
			angmsdab: "⦩",
			angmsdac: "⦪",
			angmsdad: "⦫",
			angmsdae: "⦬",
			angmsdaf: "⦭",
			angmsdag: "⦮",
			angmsdah: "⦯",
			angrt: "∟",
			angrtvb: "⊾",
			angrtvbd: "⦝",
			angsph: "∢",
			angst: "Å",
			angzarr: "⍼",
			Aogon: "Ą",
			aogon: "ą",
			Aopf: "𝔸",
			aopf: "𝕒",
			ap: "≈",
			apacir: "⩯",
			apE: "⩰",
			ape: "≊",
			apid: "≋",
			apos: "'",
			ApplyFunction: "⁡",
			approx: "≈",
			approxeq: "≊",
			Aring: "Å",
			aring: "å",
			Ascr: "𝒜",
			ascr: "𝒶",
			Assign: "≔",
			ast: "*",
			asymp: "≈",
			asympeq: "≍",
			Atilde: "Ã",
			atilde: "ã",
			Auml: "Ä",
			auml: "ä",
			awconint: "∳",
			awint: "⨑",
			backcong: "≌",
			backepsilon: "϶",
			backprime: "‵",
			backsim: "∽",
			backsimeq: "⋍",
			Backslash: "∖",
			Barv: "⫧",
			barvee: "⊽",
			Barwed: "⌆",
			barwed: "⌅",
			barwedge: "⌅",
			bbrk: "⎵",
			bbrktbrk: "⎶",
			bcong: "≌",
			Bcy: "Б",
			bcy: "б",
			bdquo: "„",
			becaus: "∵",
			Because: "∵",
			because: "∵",
			bemptyv: "⦰",
			bepsi: "϶",
			bernou: "ℬ",
			Bernoullis: "ℬ",
			Beta: "Β",
			beta: "β",
			beth: "ℶ",
			between: "≬",
			Bfr: "𝔅",
			bfr: "𝔟",
			bigcap: "⋂",
			bigcirc: "◯",
			bigcup: "⋃",
			bigodot: "⨀",
			bigoplus: "⨁",
			bigotimes: "⨂",
			bigsqcup: "⨆",
			bigstar: "★",
			bigtriangledown: "▽",
			bigtriangleup: "△",
			biguplus: "⨄",
			bigvee: "⋁",
			bigwedge: "⋀",
			bkarow: "⤍",
			blacklozenge: "⧫",
			blacksquare: "▪",
			blacktriangle: "▴",
			blacktriangledown: "▾",
			blacktriangleleft: "◂",
			blacktriangleright: "▸",
			blank: "␣",
			blk12: "▒",
			blk14: "░",
			blk34: "▓",
			block: "█",
			bne: "=⃥",
			bnequiv: "≡⃥",
			bNot: "⫭",
			bnot: "⌐",
			Bopf: "𝔹",
			bopf: "𝕓",
			bot: "⊥",
			bottom: "⊥",
			bowtie: "⋈",
			boxbox: "⧉",
			boxDL: "╗",
			boxDl: "╖",
			boxdL: "╕",
			boxdl: "┐",
			boxDR: "╔",
			boxDr: "╓",
			boxdR: "╒",
			boxdr: "┌",
			boxH: "═",
			boxh: "─",
			boxHD: "╦",
			boxHd: "╤",
			boxhD: "╥",
			boxhd: "┬",
			boxHU: "╩",
			boxHu: "╧",
			boxhU: "╨",
			boxhu: "┴",
			boxminus: "⊟",
			boxplus: "⊞",
			boxtimes: "⊠",
			boxUL: "╝",
			boxUl: "╜",
			boxuL: "╛",
			boxul: "┘",
			boxUR: "╚",
			boxUr: "╙",
			boxuR: "╘",
			boxur: "└",
			boxV: "║",
			boxv: "│",
			boxVH: "╬",
			boxVh: "╫",
			boxvH: "╪",
			boxvh: "┼",
			boxVL: "╣",
			boxVl: "╢",
			boxvL: "╡",
			boxvl: "┤",
			boxVR: "╠",
			boxVr: "╟",
			boxvR: "╞",
			boxvr: "├",
			bprime: "‵",
			Breve: "˘",
			breve: "˘",
			brvbar: "¦",
			Bscr: "ℬ",
			bscr: "𝒷",
			bsemi: "⁏",
			bsim: "∽",
			bsime: "⋍",
			bsol: "\\",
			bsolb: "⧅",
			bsolhsub: "⟈",
			bull: "•",
			bullet: "•",
			bump: "≎",
			bumpE: "⪮",
			bumpe: "≏",
			Bumpeq: "≎",
			bumpeq: "≏",
			Cacute: "Ć",
			cacute: "ć",
			Cap: "⋒",
			cap: "∩",
			capand: "⩄",
			capbrcup: "⩉",
			capcap: "⩋",
			capcup: "⩇",
			capdot: "⩀",
			CapitalDifferentialD: "ⅅ",
			caps: "∩︀",
			caret: "⁁",
			caron: "ˇ",
			Cayleys: "ℭ",
			ccaps: "⩍",
			Ccaron: "Č",
			ccaron: "č",
			Ccedil: "Ç",
			ccedil: "ç",
			Ccirc: "Ĉ",
			ccirc: "ĉ",
			Cconint: "∰",
			ccups: "⩌",
			ccupssm: "⩐",
			Cdot: "Ċ",
			cdot: "ċ",
			cedil: "¸",
			Cedilla: "¸",
			cemptyv: "⦲",
			cent: "¢",
			CenterDot: "·",
			centerdot: "·",
			Cfr: "ℭ",
			cfr: "𝔠",
			CHcy: "Ч",
			chcy: "ч",
			check: "✓",
			checkmark: "✓",
			Chi: "Χ",
			chi: "χ",
			cir: "○",
			circ: "ˆ",
			circeq: "≗",
			circlearrowleft: "↺",
			circlearrowright: "↻",
			circledast: "⊛",
			circledcirc: "⊚",
			circleddash: "⊝",
			CircleDot: "⊙",
			circledR: "®",
			circledS: "Ⓢ",
			CircleMinus: "⊖",
			CirclePlus: "⊕",
			CircleTimes: "⊗",
			cirE: "⧃",
			cire: "≗",
			cirfnint: "⨐",
			cirmid: "⫯",
			cirscir: "⧂",
			ClockwiseContourIntegral: "∲",
			CloseCurlyDoubleQuote: "”",
			CloseCurlyQuote: "’",
			clubs: "♣",
			clubsuit: "♣",
			Colon: "∷",
			colon: ":",
			Colone: "⩴",
			colone: "≔",
			coloneq: "≔",
			comma: ",",
			commat: "@",
			comp: "∁",
			compfn: "∘",
			complement: "∁",
			complexes: "ℂ",
			cong: "≅",
			congdot: "⩭",
			Congruent: "≡",
			Conint: "∯",
			conint: "∮",
			ContourIntegral: "∮",
			Copf: "ℂ",
			copf: "𝕔",
			coprod: "∐",
			Coproduct: "∐",
			COPY: "©",
			copy: "©",
			copysr: "℗",
			CounterClockwiseContourIntegral: "∳",
			crarr: "↵",
			Cross: "⨯",
			cross: "✗",
			Cscr: "𝒞",
			cscr: "𝒸",
			csub: "⫏",
			csube: "⫑",
			csup: "⫐",
			csupe: "⫒",
			ctdot: "⋯",
			cudarrl: "⤸",
			cudarrr: "⤵",
			cuepr: "⋞",
			cuesc: "⋟",
			cularr: "↶",
			cularrp: "⤽",
			Cup: "⋓",
			cup: "∪",
			cupbrcap: "⩈",
			CupCap: "≍",
			cupcap: "⩆",
			cupcup: "⩊",
			cupdot: "⊍",
			cupor: "⩅",
			cups: "∪︀",
			curarr: "↷",
			curarrm: "⤼",
			curlyeqprec: "⋞",
			curlyeqsucc: "⋟",
			curlyvee: "⋎",
			curlywedge: "⋏",
			curren: "¤",
			curvearrowleft: "↶",
			curvearrowright: "↷",
			cuvee: "⋎",
			cuwed: "⋏",
			cwconint: "∲",
			cwint: "∱",
			cylcty: "⌭",
			Dagger: "‡",
			dagger: "†",
			daleth: "ℸ",
			Darr: "↡",
			dArr: "⇓",
			darr: "↓",
			dash: "‐",
			Dashv: "⫤",
			dashv: "⊣",
			dbkarow: "⤏",
			dblac: "˝",
			Dcaron: "Ď",
			dcaron: "ď",
			Dcy: "Д",
			dcy: "д",
			DD: "ⅅ",
			dd: "ⅆ",
			ddagger: "‡",
			ddarr: "⇊",
			DDotrahd: "⤑",
			ddotseq: "⩷",
			deg: "°",
			Del: "∇",
			Delta: "Δ",
			delta: "δ",
			demptyv: "⦱",
			dfisht: "⥿",
			Dfr: "𝔇",
			dfr: "𝔡",
			dHar: "⥥",
			dharl: "⇃",
			dharr: "⇂",
			DiacriticalAcute: "´",
			DiacriticalDot: "˙",
			DiacriticalDoubleAcute: "˝",
			DiacriticalGrave: "`",
			DiacriticalTilde: "˜",
			diam: "⋄",
			Diamond: "⋄",
			diamond: "⋄",
			diamondsuit: "♦",
			diams: "♦",
			die: "¨",
			DifferentialD: "ⅆ",
			digamma: "ϝ",
			disin: "⋲",
			div: "÷",
			divide: "÷",
			divideontimes: "⋇",
			divonx: "⋇",
			DJcy: "Ђ",
			djcy: "ђ",
			dlcorn: "⌞",
			dlcrop: "⌍",
			dollar: "$",
			Dopf: "𝔻",
			dopf: "𝕕",
			Dot: "¨",
			dot: "˙",
			DotDot: "⃜",
			doteq: "≐",
			doteqdot: "≑",
			DotEqual: "≐",
			dotminus: "∸",
			dotplus: "∔",
			dotsquare: "⊡",
			doublebarwedge: "⌆",
			DoubleContourIntegral: "∯",
			DoubleDot: "¨",
			DoubleDownArrow: "⇓",
			DoubleLeftArrow: "⇐",
			DoubleLeftRightArrow: "⇔",
			DoubleLeftTee: "⫤",
			DoubleLongLeftArrow: "⟸",
			DoubleLongLeftRightArrow: "⟺",
			DoubleLongRightArrow: "⟹",
			DoubleRightArrow: "⇒",
			DoubleRightTee: "⊨",
			DoubleUpArrow: "⇑",
			DoubleUpDownArrow: "⇕",
			DoubleVerticalBar: "∥",
			DownArrow: "↓",
			Downarrow: "⇓",
			downarrow: "↓",
			DownArrowBar: "⤓",
			DownArrowUpArrow: "⇵",
			DownBreve: "̑",
			downdownarrows: "⇊",
			downharpoonleft: "⇃",
			downharpoonright: "⇂",
			DownLeftRightVector: "⥐",
			DownLeftTeeVector: "⥞",
			DownLeftVector: "↽",
			DownLeftVectorBar: "⥖",
			DownRightTeeVector: "⥟",
			DownRightVector: "⇁",
			DownRightVectorBar: "⥗",
			DownTee: "⊤",
			DownTeeArrow: "↧",
			drbkarow: "⤐",
			drcorn: "⌟",
			drcrop: "⌌",
			Dscr: "𝒟",
			dscr: "𝒹",
			DScy: "Ѕ",
			dscy: "ѕ",
			dsol: "⧶",
			Dstrok: "Đ",
			dstrok: "đ",
			dtdot: "⋱",
			dtri: "▿",
			dtrif: "▾",
			duarr: "⇵",
			duhar: "⥯",
			dwangle: "⦦",
			DZcy: "Џ",
			dzcy: "џ",
			dzigrarr: "⟿",
			Eacute: "É",
			eacute: "é",
			easter: "⩮",
			Ecaron: "Ě",
			ecaron: "ě",
			ecir: "≖",
			Ecirc: "Ê",
			ecirc: "ê",
			ecolon: "≕",
			Ecy: "Э",
			ecy: "э",
			eDDot: "⩷",
			Edot: "Ė",
			eDot: "≑",
			edot: "ė",
			ee: "ⅇ",
			efDot: "≒",
			Efr: "𝔈",
			efr: "𝔢",
			eg: "⪚",
			Egrave: "È",
			egrave: "è",
			egs: "⪖",
			egsdot: "⪘",
			el: "⪙",
			Element: "∈",
			elinters: "⏧",
			ell: "ℓ",
			els: "⪕",
			elsdot: "⪗",
			Emacr: "Ē",
			emacr: "ē",
			empty: "∅",
			emptyset: "∅",
			EmptySmallSquare: "◻",
			emptyv: "∅",
			EmptyVerySmallSquare: "▫",
			emsp: " ",
			emsp13: " ",
			emsp14: " ",
			ENG: "Ŋ",
			eng: "ŋ",
			ensp: " ",
			Eogon: "Ę",
			eogon: "ę",
			Eopf: "𝔼",
			eopf: "𝕖",
			epar: "⋕",
			eparsl: "⧣",
			eplus: "⩱",
			epsi: "ε",
			Epsilon: "Ε",
			epsilon: "ε",
			epsiv: "ϵ",
			eqcirc: "≖",
			eqcolon: "≕",
			eqsim: "≂",
			eqslantgtr: "⪖",
			eqslantless: "⪕",
			Equal: "⩵",
			equals: "=",
			EqualTilde: "≂",
			equest: "≟",
			Equilibrium: "⇌",
			equiv: "≡",
			equivDD: "⩸",
			eqvparsl: "⧥",
			erarr: "⥱",
			erDot: "≓",
			Escr: "ℰ",
			escr: "ℯ",
			esdot: "≐",
			Esim: "⩳",
			esim: "≂",
			Eta: "Η",
			eta: "η",
			ETH: "Ð",
			eth: "ð",
			Euml: "Ë",
			euml: "ë",
			euro: "€",
			excl: "!",
			exist: "∃",
			Exists: "∃",
			expectation: "ℰ",
			ExponentialE: "ⅇ",
			exponentiale: "ⅇ",
			fallingdotseq: "≒",
			Fcy: "Ф",
			fcy: "ф",
			female: "♀",
			ffilig: "ﬃ",
			fflig: "ﬀ",
			ffllig: "ﬄ",
			Ffr: "𝔉",
			ffr: "𝔣",
			filig: "ﬁ",
			FilledSmallSquare: "◼",
			FilledVerySmallSquare: "▪",
			fjlig: "fj",
			flat: "♭",
			fllig: "ﬂ",
			fltns: "▱",
			fnof: "ƒ",
			Fopf: "𝔽",
			fopf: "𝕗",
			ForAll: "∀",
			forall: "∀",
			fork: "⋔",
			forkv: "⫙",
			Fouriertrf: "ℱ",
			fpartint: "⨍",
			frac12: "½",
			frac13: "⅓",
			frac14: "¼",
			frac15: "⅕",
			frac16: "⅙",
			frac18: "⅛",
			frac23: "⅔",
			frac25: "⅖",
			frac34: "¾",
			frac35: "⅗",
			frac38: "⅜",
			frac45: "⅘",
			frac56: "⅚",
			frac58: "⅝",
			frac78: "⅞",
			frasl: "⁄",
			frown: "⌢",
			Fscr: "ℱ",
			fscr: "𝒻",
			gacute: "ǵ",
			Gamma: "Γ",
			gamma: "γ",
			Gammad: "Ϝ",
			gammad: "ϝ",
			gap: "⪆",
			Gbreve: "Ğ",
			gbreve: "ğ",
			Gcedil: "Ģ",
			Gcirc: "Ĝ",
			gcirc: "ĝ",
			Gcy: "Г",
			gcy: "г",
			Gdot: "Ġ",
			gdot: "ġ",
			gE: "≧",
			ge: "≥",
			gEl: "⪌",
			gel: "⋛",
			geq: "≥",
			geqq: "≧",
			geqslant: "⩾",
			ges: "⩾",
			gescc: "⪩",
			gesdot: "⪀",
			gesdoto: "⪂",
			gesdotol: "⪄",
			gesl: "⋛︀",
			gesles: "⪔",
			Gfr: "𝔊",
			gfr: "𝔤",
			Gg: "⋙",
			gg: "≫",
			ggg: "⋙",
			gimel: "ℷ",
			GJcy: "Ѓ",
			gjcy: "ѓ",
			gl: "≷",
			gla: "⪥",
			glE: "⪒",
			glj: "⪤",
			gnap: "⪊",
			gnapprox: "⪊",
			gnE: "≩",
			gne: "⪈",
			gneq: "⪈",
			gneqq: "≩",
			gnsim: "⋧",
			Gopf: "𝔾",
			gopf: "𝕘",
			grave: "`",
			GreaterEqual: "≥",
			GreaterEqualLess: "⋛",
			GreaterFullEqual: "≧",
			GreaterGreater: "⪢",
			GreaterLess: "≷",
			GreaterSlantEqual: "⩾",
			GreaterTilde: "≳",
			Gscr: "𝒢",
			gscr: "ℊ",
			gsim: "≳",
			gsime: "⪎",
			gsiml: "⪐",
			Gt: "≫",
			GT: ">",
			gt: ">",
			gtcc: "⪧",
			gtcir: "⩺",
			gtdot: "⋗",
			gtlPar: "⦕",
			gtquest: "⩼",
			gtrapprox: "⪆",
			gtrarr: "⥸",
			gtrdot: "⋗",
			gtreqless: "⋛",
			gtreqqless: "⪌",
			gtrless: "≷",
			gtrsim: "≳",
			gvertneqq: "≩︀",
			gvnE: "≩︀",
			Hacek: "ˇ",
			hairsp: " ",
			half: "½",
			hamilt: "ℋ",
			HARDcy: "Ъ",
			hardcy: "ъ",
			hArr: "⇔",
			harr: "↔",
			harrcir: "⥈",
			harrw: "↭",
			Hat: "^",
			hbar: "ℏ",
			Hcirc: "Ĥ",
			hcirc: "ĥ",
			hearts: "♥",
			heartsuit: "♥",
			hellip: "…",
			hercon: "⊹",
			Hfr: "ℌ",
			hfr: "𝔥",
			HilbertSpace: "ℋ",
			hksearow: "⤥",
			hkswarow: "⤦",
			hoarr: "⇿",
			homtht: "∻",
			hookleftarrow: "↩",
			hookrightarrow: "↪",
			Hopf: "ℍ",
			hopf: "𝕙",
			horbar: "―",
			HorizontalLine: "─",
			Hscr: "ℋ",
			hscr: "𝒽",
			hslash: "ℏ",
			Hstrok: "Ħ",
			hstrok: "ħ",
			HumpDownHump: "≎",
			HumpEqual: "≏",
			hybull: "⁃",
			hyphen: "‐",
			Iacute: "Í",
			iacute: "í",
			ic: "⁣",
			Icirc: "Î",
			icirc: "î",
			Icy: "И",
			icy: "и",
			Idot: "İ",
			IEcy: "Е",
			iecy: "е",
			iexcl: "¡",
			iff: "⇔",
			Ifr: "ℑ",
			ifr: "𝔦",
			Igrave: "Ì",
			igrave: "ì",
			ii: "ⅈ",
			iiiint: "⨌",
			iiint: "∭",
			iinfin: "⧜",
			iiota: "℩",
			IJlig: "Ĳ",
			ijlig: "ĳ",
			Im: "ℑ",
			Imacr: "Ī",
			imacr: "ī",
			image: "ℑ",
			ImaginaryI: "ⅈ",
			imagline: "ℐ",
			imagpart: "ℑ",
			imath: "ı",
			imof: "⊷",
			imped: "Ƶ",
			Implies: "⇒",
			in: "∈",
			incare: "℅",
			infin: "∞",
			infintie: "⧝",
			inodot: "ı",
			Int: "∬",
			int: "∫",
			intcal: "⊺",
			integers: "ℤ",
			Integral: "∫",
			intercal: "⊺",
			Intersection: "⋂",
			intlarhk: "⨗",
			intprod: "⨼",
			InvisibleComma: "⁣",
			InvisibleTimes: "⁢",
			IOcy: "Ё",
			iocy: "ё",
			Iogon: "Į",
			iogon: "į",
			Iopf: "𝕀",
			iopf: "𝕚",
			Iota: "Ι",
			iota: "ι",
			iprod: "⨼",
			iquest: "¿",
			Iscr: "ℐ",
			iscr: "𝒾",
			isin: "∈",
			isindot: "⋵",
			isinE: "⋹",
			isins: "⋴",
			isinsv: "⋳",
			isinv: "∈",
			it: "⁢",
			Itilde: "Ĩ",
			itilde: "ĩ",
			Iukcy: "І",
			iukcy: "і",
			Iuml: "Ï",
			iuml: "ï",
			Jcirc: "Ĵ",
			jcirc: "ĵ",
			Jcy: "Й",
			jcy: "й",
			Jfr: "𝔍",
			jfr: "𝔧",
			jmath: "ȷ",
			Jopf: "𝕁",
			jopf: "𝕛",
			Jscr: "𝒥",
			jscr: "𝒿",
			Jsercy: "Ј",
			jsercy: "ј",
			Jukcy: "Є",
			jukcy: "є",
			Kappa: "Κ",
			kappa: "κ",
			kappav: "ϰ",
			Kcedil: "Ķ",
			kcedil: "ķ",
			Kcy: "К",
			kcy: "к",
			Kfr: "𝔎",
			kfr: "𝔨",
			kgreen: "ĸ",
			KHcy: "Х",
			khcy: "х",
			KJcy: "Ќ",
			kjcy: "ќ",
			Kopf: "𝕂",
			kopf: "𝕜",
			Kscr: "𝒦",
			kscr: "𝓀",
			lAarr: "⇚",
			Lacute: "Ĺ",
			lacute: "ĺ",
			laemptyv: "⦴",
			lagran: "ℒ",
			Lambda: "Λ",
			lambda: "λ",
			Lang: "⟪",
			lang: "⟨",
			langd: "⦑",
			langle: "⟨",
			lap: "⪅",
			Laplacetrf: "ℒ",
			laquo: "«",
			Larr: "↞",
			lArr: "⇐",
			larr: "←",
			larrb: "⇤",
			larrbfs: "⤟",
			larrfs: "⤝",
			larrhk: "↩",
			larrlp: "↫",
			larrpl: "⤹",
			larrsim: "⥳",
			larrtl: "↢",
			lat: "⪫",
			lAtail: "⤛",
			latail: "⤙",
			late: "⪭",
			lates: "⪭︀",
			lBarr: "⤎",
			lbarr: "⤌",
			lbbrk: "❲",
			lbrace: "{",
			lbrack: "[",
			lbrke: "⦋",
			lbrksld: "⦏",
			lbrkslu: "⦍",
			Lcaron: "Ľ",
			lcaron: "ľ",
			Lcedil: "Ļ",
			lcedil: "ļ",
			lceil: "⌈",
			lcub: "{",
			Lcy: "Л",
			lcy: "л",
			ldca: "⤶",
			ldquo: "“",
			ldquor: "„",
			ldrdhar: "⥧",
			ldrushar: "⥋",
			ldsh: "↲",
			lE: "≦",
			le: "≤",
			LeftAngleBracket: "⟨",
			LeftArrow: "←",
			Leftarrow: "⇐",
			leftarrow: "←",
			LeftArrowBar: "⇤",
			LeftArrowRightArrow: "⇆",
			leftarrowtail: "↢",
			LeftCeiling: "⌈",
			LeftDoubleBracket: "⟦",
			LeftDownTeeVector: "⥡",
			LeftDownVector: "⇃",
			LeftDownVectorBar: "⥙",
			LeftFloor: "⌊",
			leftharpoondown: "↽",
			leftharpoonup: "↼",
			leftleftarrows: "⇇",
			LeftRightArrow: "↔",
			Leftrightarrow: "⇔",
			leftrightarrow: "↔",
			leftrightarrows: "⇆",
			leftrightharpoons: "⇋",
			leftrightsquigarrow: "↭",
			LeftRightVector: "⥎",
			LeftTee: "⊣",
			LeftTeeArrow: "↤",
			LeftTeeVector: "⥚",
			leftthreetimes: "⋋",
			LeftTriangle: "⊲",
			LeftTriangleBar: "⧏",
			LeftTriangleEqual: "⊴",
			LeftUpDownVector: "⥑",
			LeftUpTeeVector: "⥠",
			LeftUpVector: "↿",
			LeftUpVectorBar: "⥘",
			LeftVector: "↼",
			LeftVectorBar: "⥒",
			lEg: "⪋",
			leg: "⋚",
			leq: "≤",
			leqq: "≦",
			leqslant: "⩽",
			les: "⩽",
			lescc: "⪨",
			lesdot: "⩿",
			lesdoto: "⪁",
			lesdotor: "⪃",
			lesg: "⋚︀",
			lesges: "⪓",
			lessapprox: "⪅",
			lessdot: "⋖",
			lesseqgtr: "⋚",
			lesseqqgtr: "⪋",
			LessEqualGreater: "⋚",
			LessFullEqual: "≦",
			LessGreater: "≶",
			lessgtr: "≶",
			LessLess: "⪡",
			lesssim: "≲",
			LessSlantEqual: "⩽",
			LessTilde: "≲",
			lfisht: "⥼",
			lfloor: "⌊",
			Lfr: "𝔏",
			lfr: "𝔩",
			lg: "≶",
			lgE: "⪑",
			lHar: "⥢",
			lhard: "↽",
			lharu: "↼",
			lharul: "⥪",
			lhblk: "▄",
			LJcy: "Љ",
			ljcy: "љ",
			Ll: "⋘",
			ll: "≪",
			llarr: "⇇",
			llcorner: "⌞",
			Lleftarrow: "⇚",
			llhard: "⥫",
			lltri: "◺",
			Lmidot: "Ŀ",
			lmidot: "ŀ",
			lmoust: "⎰",
			lmoustache: "⎰",
			lnap: "⪉",
			lnapprox: "⪉",
			lnE: "≨",
			lne: "⪇",
			lneq: "⪇",
			lneqq: "≨",
			lnsim: "⋦",
			loang: "⟬",
			loarr: "⇽",
			lobrk: "⟦",
			LongLeftArrow: "⟵",
			Longleftarrow: "⟸",
			longleftarrow: "⟵",
			LongLeftRightArrow: "⟷",
			Longleftrightarrow: "⟺",
			longleftrightarrow: "⟷",
			longmapsto: "⟼",
			LongRightArrow: "⟶",
			Longrightarrow: "⟹",
			longrightarrow: "⟶",
			looparrowleft: "↫",
			looparrowright: "↬",
			lopar: "⦅",
			Lopf: "𝕃",
			lopf: "𝕝",
			loplus: "⨭",
			lotimes: "⨴",
			lowast: "∗",
			lowbar: "_",
			LowerLeftArrow: "↙",
			LowerRightArrow: "↘",
			loz: "◊",
			lozenge: "◊",
			lozf: "⧫",
			lpar: "(",
			lparlt: "⦓",
			lrarr: "⇆",
			lrcorner: "⌟",
			lrhar: "⇋",
			lrhard: "⥭",
			lrm: "‎",
			lrtri: "⊿",
			lsaquo: "‹",
			Lscr: "ℒ",
			lscr: "𝓁",
			Lsh: "↰",
			lsh: "↰",
			lsim: "≲",
			lsime: "⪍",
			lsimg: "⪏",
			lsqb: "[",
			lsquo: "‘",
			lsquor: "‚",
			Lstrok: "Ł",
			lstrok: "ł",
			Lt: "≪",
			LT: "<",
			lt: "<",
			ltcc: "⪦",
			ltcir: "⩹",
			ltdot: "⋖",
			lthree: "⋋",
			ltimes: "⋉",
			ltlarr: "⥶",
			ltquest: "⩻",
			ltri: "◃",
			ltrie: "⊴",
			ltrif: "◂",
			ltrPar: "⦖",
			lurdshar: "⥊",
			luruhar: "⥦",
			lvertneqq: "≨︀",
			lvnE: "≨︀",
			macr: "¯",
			male: "♂",
			malt: "✠",
			maltese: "✠",
			Map: "⤅",
			map: "↦",
			mapsto: "↦",
			mapstodown: "↧",
			mapstoleft: "↤",
			mapstoup: "↥",
			marker: "▮",
			mcomma: "⨩",
			Mcy: "М",
			mcy: "м",
			mdash: "—",
			mDDot: "∺",
			measuredangle: "∡",
			MediumSpace: " ",
			Mellintrf: "ℳ",
			Mfr: "𝔐",
			mfr: "𝔪",
			mho: "℧",
			micro: "µ",
			mid: "∣",
			midast: "*",
			midcir: "⫰",
			middot: "·",
			minus: "−",
			minusb: "⊟",
			minusd: "∸",
			minusdu: "⨪",
			MinusPlus: "∓",
			mlcp: "⫛",
			mldr: "…",
			mnplus: "∓",
			models: "⊧",
			Mopf: "𝕄",
			mopf: "𝕞",
			mp: "∓",
			Mscr: "ℳ",
			mscr: "𝓂",
			mstpos: "∾",
			Mu: "Μ",
			mu: "μ",
			multimap: "⊸",
			mumap: "⊸",
			nabla: "∇",
			Nacute: "Ń",
			nacute: "ń",
			nang: "∠⃒",
			nap: "≉",
			napE: "⩰̸",
			napid: "≋̸",
			napos: "ŉ",
			napprox: "≉",
			natur: "♮",
			natural: "♮",
			naturals: "ℕ",
			nbsp: "\xA0",
			nbump: "≎̸",
			nbumpe: "≏̸",
			ncap: "⩃",
			Ncaron: "Ň",
			ncaron: "ň",
			Ncedil: "Ņ",
			ncedil: "ņ",
			ncong: "≇",
			ncongdot: "⩭̸",
			ncup: "⩂",
			Ncy: "Н",
			ncy: "н",
			ndash: "–",
			ne: "≠",
			nearhk: "⤤",
			neArr: "⇗",
			nearr: "↗",
			nearrow: "↗",
			nedot: "≐̸",
			NegativeMediumSpace: "​",
			NegativeThickSpace: "​",
			NegativeThinSpace: "​",
			NegativeVeryThinSpace: "​",
			nequiv: "≢",
			nesear: "⤨",
			nesim: "≂̸",
			NestedGreaterGreater: "≫",
			NestedLessLess: "≪",
			NewLine: "\n",
			nexist: "∄",
			nexists: "∄",
			Nfr: "𝔑",
			nfr: "𝔫",
			ngE: "≧̸",
			nge: "≱",
			ngeq: "≱",
			ngeqq: "≧̸",
			ngeqslant: "⩾̸",
			nges: "⩾̸",
			nGg: "⋙̸",
			ngsim: "≵",
			nGt: "≫⃒",
			ngt: "≯",
			ngtr: "≯",
			nGtv: "≫̸",
			nhArr: "⇎",
			nharr: "↮",
			nhpar: "⫲",
			ni: "∋",
			nis: "⋼",
			nisd: "⋺",
			niv: "∋",
			NJcy: "Њ",
			njcy: "њ",
			nlArr: "⇍",
			nlarr: "↚",
			nldr: "‥",
			nlE: "≦̸",
			nle: "≰",
			nLeftarrow: "⇍",
			nleftarrow: "↚",
			nLeftrightarrow: "⇎",
			nleftrightarrow: "↮",
			nleq: "≰",
			nleqq: "≦̸",
			nleqslant: "⩽̸",
			nles: "⩽̸",
			nless: "≮",
			nLl: "⋘̸",
			nlsim: "≴",
			nLt: "≪⃒",
			nlt: "≮",
			nltri: "⋪",
			nltrie: "⋬",
			nLtv: "≪̸",
			nmid: "∤",
			NoBreak: "⁠",
			NonBreakingSpace: "\xA0",
			Nopf: "ℕ",
			nopf: "𝕟",
			Not: "⫬",
			not: "¬",
			NotCongruent: "≢",
			NotCupCap: "≭",
			NotDoubleVerticalBar: "∦",
			NotElement: "∉",
			NotEqual: "≠",
			NotEqualTilde: "≂̸",
			NotExists: "∄",
			NotGreater: "≯",
			NotGreaterEqual: "≱",
			NotGreaterFullEqual: "≧̸",
			NotGreaterGreater: "≫̸",
			NotGreaterLess: "≹",
			NotGreaterSlantEqual: "⩾̸",
			NotGreaterTilde: "≵",
			NotHumpDownHump: "≎̸",
			NotHumpEqual: "≏̸",
			notin: "∉",
			notindot: "⋵̸",
			notinE: "⋹̸",
			notinva: "∉",
			notinvb: "⋷",
			notinvc: "⋶",
			NotLeftTriangle: "⋪",
			NotLeftTriangleBar: "⧏̸",
			NotLeftTriangleEqual: "⋬",
			NotLess: "≮",
			NotLessEqual: "≰",
			NotLessGreater: "≸",
			NotLessLess: "≪̸",
			NotLessSlantEqual: "⩽̸",
			NotLessTilde: "≴",
			NotNestedGreaterGreater: "⪢̸",
			NotNestedLessLess: "⪡̸",
			notni: "∌",
			notniva: "∌",
			notnivb: "⋾",
			notnivc: "⋽",
			NotPrecedes: "⊀",
			NotPrecedesEqual: "⪯̸",
			NotPrecedesSlantEqual: "⋠",
			NotReverseElement: "∌",
			NotRightTriangle: "⋫",
			NotRightTriangleBar: "⧐̸",
			NotRightTriangleEqual: "⋭",
			NotSquareSubset: "⊏̸",
			NotSquareSubsetEqual: "⋢",
			NotSquareSuperset: "⊐̸",
			NotSquareSupersetEqual: "⋣",
			NotSubset: "⊂⃒",
			NotSubsetEqual: "⊈",
			NotSucceeds: "⊁",
			NotSucceedsEqual: "⪰̸",
			NotSucceedsSlantEqual: "⋡",
			NotSucceedsTilde: "≿̸",
			NotSuperset: "⊃⃒",
			NotSupersetEqual: "⊉",
			NotTilde: "≁",
			NotTildeEqual: "≄",
			NotTildeFullEqual: "≇",
			NotTildeTilde: "≉",
			NotVerticalBar: "∤",
			npar: "∦",
			nparallel: "∦",
			nparsl: "⫽⃥",
			npart: "∂̸",
			npolint: "⨔",
			npr: "⊀",
			nprcue: "⋠",
			npre: "⪯̸",
			nprec: "⊀",
			npreceq: "⪯̸",
			nrArr: "⇏",
			nrarr: "↛",
			nrarrc: "⤳̸",
			nrarrw: "↝̸",
			nRightarrow: "⇏",
			nrightarrow: "↛",
			nrtri: "⋫",
			nrtrie: "⋭",
			nsc: "⊁",
			nsccue: "⋡",
			nsce: "⪰̸",
			Nscr: "𝒩",
			nscr: "𝓃",
			nshortmid: "∤",
			nshortparallel: "∦",
			nsim: "≁",
			nsime: "≄",
			nsimeq: "≄",
			nsmid: "∤",
			nspar: "∦",
			nsqsube: "⋢",
			nsqsupe: "⋣",
			nsub: "⊄",
			nsubE: "⫅̸",
			nsube: "⊈",
			nsubset: "⊂⃒",
			nsubseteq: "⊈",
			nsubseteqq: "⫅̸",
			nsucc: "⊁",
			nsucceq: "⪰̸",
			nsup: "⊅",
			nsupE: "⫆̸",
			nsupe: "⊉",
			nsupset: "⊃⃒",
			nsupseteq: "⊉",
			nsupseteqq: "⫆̸",
			ntgl: "≹",
			Ntilde: "Ñ",
			ntilde: "ñ",
			ntlg: "≸",
			ntriangleleft: "⋪",
			ntrianglelefteq: "⋬",
			ntriangleright: "⋫",
			ntrianglerighteq: "⋭",
			Nu: "Ν",
			nu: "ν",
			num: "#",
			numero: "№",
			numsp: " ",
			nvap: "≍⃒",
			nVDash: "⊯",
			nVdash: "⊮",
			nvDash: "⊭",
			nvdash: "⊬",
			nvge: "≥⃒",
			nvgt: ">⃒",
			nvHarr: "⤄",
			nvinfin: "⧞",
			nvlArr: "⤂",
			nvle: "≤⃒",
			nvlt: "<⃒",
			nvltrie: "⊴⃒",
			nvrArr: "⤃",
			nvrtrie: "⊵⃒",
			nvsim: "∼⃒",
			nwarhk: "⤣",
			nwArr: "⇖",
			nwarr: "↖",
			nwarrow: "↖",
			nwnear: "⤧",
			Oacute: "Ó",
			oacute: "ó",
			oast: "⊛",
			ocir: "⊚",
			Ocirc: "Ô",
			ocirc: "ô",
			Ocy: "О",
			ocy: "о",
			odash: "⊝",
			Odblac: "Ő",
			odblac: "ő",
			odiv: "⨸",
			odot: "⊙",
			odsold: "⦼",
			OElig: "Œ",
			oelig: "œ",
			ofcir: "⦿",
			Ofr: "𝔒",
			ofr: "𝔬",
			ogon: "˛",
			Ograve: "Ò",
			ograve: "ò",
			ogt: "⧁",
			ohbar: "⦵",
			ohm: "Ω",
			oint: "∮",
			olarr: "↺",
			olcir: "⦾",
			olcross: "⦻",
			oline: "‾",
			olt: "⧀",
			Omacr: "Ō",
			omacr: "ō",
			Omega: "Ω",
			omega: "ω",
			Omicron: "Ο",
			omicron: "ο",
			omid: "⦶",
			ominus: "⊖",
			Oopf: "𝕆",
			oopf: "𝕠",
			opar: "⦷",
			OpenCurlyDoubleQuote: "“",
			OpenCurlyQuote: "‘",
			operp: "⦹",
			oplus: "⊕",
			Or: "⩔",
			or: "∨",
			orarr: "↻",
			ord: "⩝",
			order: "ℴ",
			orderof: "ℴ",
			ordf: "ª",
			ordm: "º",
			origof: "⊶",
			oror: "⩖",
			orslope: "⩗",
			orv: "⩛",
			oS: "Ⓢ",
			Oscr: "𝒪",
			oscr: "ℴ",
			Oslash: "Ø",
			oslash: "ø",
			osol: "⊘",
			Otilde: "Õ",
			otilde: "õ",
			Otimes: "⨷",
			otimes: "⊗",
			otimesas: "⨶",
			Ouml: "Ö",
			ouml: "ö",
			ovbar: "⌽",
			OverBar: "‾",
			OverBrace: "⏞",
			OverBracket: "⎴",
			OverParenthesis: "⏜",
			par: "∥",
			para: "¶",
			parallel: "∥",
			parsim: "⫳",
			parsl: "⫽",
			part: "∂",
			PartialD: "∂",
			Pcy: "П",
			pcy: "п",
			percnt: "%",
			period: ".",
			permil: "‰",
			perp: "⊥",
			pertenk: "‱",
			Pfr: "𝔓",
			pfr: "𝔭",
			Phi: "Φ",
			phi: "φ",
			phiv: "ϕ",
			phmmat: "ℳ",
			phone: "☎",
			Pi: "Π",
			pi: "π",
			pitchfork: "⋔",
			piv: "ϖ",
			planck: "ℏ",
			planckh: "ℎ",
			plankv: "ℏ",
			plus: "+",
			plusacir: "⨣",
			plusb: "⊞",
			pluscir: "⨢",
			plusdo: "∔",
			plusdu: "⨥",
			pluse: "⩲",
			PlusMinus: "±",
			plusmn: "±",
			plussim: "⨦",
			plustwo: "⨧",
			pm: "±",
			Poincareplane: "ℌ",
			pointint: "⨕",
			Popf: "ℙ",
			popf: "𝕡",
			pound: "£",
			Pr: "⪻",
			pr: "≺",
			prap: "⪷",
			prcue: "≼",
			prE: "⪳",
			pre: "⪯",
			prec: "≺",
			precapprox: "⪷",
			preccurlyeq: "≼",
			Precedes: "≺",
			PrecedesEqual: "⪯",
			PrecedesSlantEqual: "≼",
			PrecedesTilde: "≾",
			preceq: "⪯",
			precnapprox: "⪹",
			precneqq: "⪵",
			precnsim: "⋨",
			precsim: "≾",
			Prime: "″",
			prime: "′",
			primes: "ℙ",
			prnap: "⪹",
			prnE: "⪵",
			prnsim: "⋨",
			prod: "∏",
			Product: "∏",
			profalar: "⌮",
			profline: "⌒",
			profsurf: "⌓",
			prop: "∝",
			Proportion: "∷",
			Proportional: "∝",
			propto: "∝",
			prsim: "≾",
			prurel: "⊰",
			Pscr: "𝒫",
			pscr: "𝓅",
			Psi: "Ψ",
			psi: "ψ",
			puncsp: " ",
			Qfr: "𝔔",
			qfr: "𝔮",
			qint: "⨌",
			Qopf: "ℚ",
			qopf: "𝕢",
			qprime: "⁗",
			Qscr: "𝒬",
			qscr: "𝓆",
			quaternions: "ℍ",
			quatint: "⨖",
			quest: "?",
			questeq: "≟",
			QUOT: "\"",
			quot: "\"",
			rAarr: "⇛",
			race: "∽̱",
			Racute: "Ŕ",
			racute: "ŕ",
			radic: "√",
			raemptyv: "⦳",
			Rang: "⟫",
			rang: "⟩",
			rangd: "⦒",
			range: "⦥",
			rangle: "⟩",
			raquo: "»",
			Rarr: "↠",
			rArr: "⇒",
			rarr: "→",
			rarrap: "⥵",
			rarrb: "⇥",
			rarrbfs: "⤠",
			rarrc: "⤳",
			rarrfs: "⤞",
			rarrhk: "↪",
			rarrlp: "↬",
			rarrpl: "⥅",
			rarrsim: "⥴",
			Rarrtl: "⤖",
			rarrtl: "↣",
			rarrw: "↝",
			rAtail: "⤜",
			ratail: "⤚",
			ratio: "∶",
			rationals: "ℚ",
			RBarr: "⤐",
			rBarr: "⤏",
			rbarr: "⤍",
			rbbrk: "❳",
			rbrace: "}",
			rbrack: "]",
			rbrke: "⦌",
			rbrksld: "⦎",
			rbrkslu: "⦐",
			Rcaron: "Ř",
			rcaron: "ř",
			Rcedil: "Ŗ",
			rcedil: "ŗ",
			rceil: "⌉",
			rcub: "}",
			Rcy: "Р",
			rcy: "р",
			rdca: "⤷",
			rdldhar: "⥩",
			rdquo: "”",
			rdquor: "”",
			rdsh: "↳",
			Re: "ℜ",
			real: "ℜ",
			realine: "ℛ",
			realpart: "ℜ",
			reals: "ℝ",
			rect: "▭",
			REG: "®",
			reg: "®",
			ReverseElement: "∋",
			ReverseEquilibrium: "⇋",
			ReverseUpEquilibrium: "⥯",
			rfisht: "⥽",
			rfloor: "⌋",
			Rfr: "ℜ",
			rfr: "𝔯",
			rHar: "⥤",
			rhard: "⇁",
			rharu: "⇀",
			rharul: "⥬",
			Rho: "Ρ",
			rho: "ρ",
			rhov: "ϱ",
			RightAngleBracket: "⟩",
			RightArrow: "→",
			Rightarrow: "⇒",
			rightarrow: "→",
			RightArrowBar: "⇥",
			RightArrowLeftArrow: "⇄",
			rightarrowtail: "↣",
			RightCeiling: "⌉",
			RightDoubleBracket: "⟧",
			RightDownTeeVector: "⥝",
			RightDownVector: "⇂",
			RightDownVectorBar: "⥕",
			RightFloor: "⌋",
			rightharpoondown: "⇁",
			rightharpoonup: "⇀",
			rightleftarrows: "⇄",
			rightleftharpoons: "⇌",
			rightrightarrows: "⇉",
			rightsquigarrow: "↝",
			RightTee: "⊢",
			RightTeeArrow: "↦",
			RightTeeVector: "⥛",
			rightthreetimes: "⋌",
			RightTriangle: "⊳",
			RightTriangleBar: "⧐",
			RightTriangleEqual: "⊵",
			RightUpDownVector: "⥏",
			RightUpTeeVector: "⥜",
			RightUpVector: "↾",
			RightUpVectorBar: "⥔",
			RightVector: "⇀",
			RightVectorBar: "⥓",
			ring: "˚",
			risingdotseq: "≓",
			rlarr: "⇄",
			rlhar: "⇌",
			rlm: "‏",
			rmoust: "⎱",
			rmoustache: "⎱",
			rnmid: "⫮",
			roang: "⟭",
			roarr: "⇾",
			robrk: "⟧",
			ropar: "⦆",
			Ropf: "ℝ",
			ropf: "𝕣",
			roplus: "⨮",
			rotimes: "⨵",
			RoundImplies: "⥰",
			rpar: ")",
			rpargt: "⦔",
			rppolint: "⨒",
			rrarr: "⇉",
			Rrightarrow: "⇛",
			rsaquo: "›",
			Rscr: "ℛ",
			rscr: "𝓇",
			Rsh: "↱",
			rsh: "↱",
			rsqb: "]",
			rsquo: "’",
			rsquor: "’",
			rthree: "⋌",
			rtimes: "⋊",
			rtri: "▹",
			rtrie: "⊵",
			rtrif: "▸",
			rtriltri: "⧎",
			RuleDelayed: "⧴",
			ruluhar: "⥨",
			rx: "℞",
			Sacute: "Ś",
			sacute: "ś",
			sbquo: "‚",
			Sc: "⪼",
			sc: "≻",
			scap: "⪸",
			Scaron: "Š",
			scaron: "š",
			sccue: "≽",
			scE: "⪴",
			sce: "⪰",
			Scedil: "Ş",
			scedil: "ş",
			Scirc: "Ŝ",
			scirc: "ŝ",
			scnap: "⪺",
			scnE: "⪶",
			scnsim: "⋩",
			scpolint: "⨓",
			scsim: "≿",
			Scy: "С",
			scy: "с",
			sdot: "⋅",
			sdotb: "⊡",
			sdote: "⩦",
			searhk: "⤥",
			seArr: "⇘",
			searr: "↘",
			searrow: "↘",
			sect: "§",
			semi: ";",
			seswar: "⤩",
			setminus: "∖",
			setmn: "∖",
			sext: "✶",
			Sfr: "𝔖",
			sfr: "𝔰",
			sfrown: "⌢",
			sharp: "♯",
			SHCHcy: "Щ",
			shchcy: "щ",
			SHcy: "Ш",
			shcy: "ш",
			ShortDownArrow: "↓",
			ShortLeftArrow: "←",
			shortmid: "∣",
			shortparallel: "∥",
			ShortRightArrow: "→",
			ShortUpArrow: "↑",
			shy: "­",
			Sigma: "Σ",
			sigma: "σ",
			sigmaf: "ς",
			sigmav: "ς",
			sim: "∼",
			simdot: "⩪",
			sime: "≃",
			simeq: "≃",
			simg: "⪞",
			simgE: "⪠",
			siml: "⪝",
			simlE: "⪟",
			simne: "≆",
			simplus: "⨤",
			simrarr: "⥲",
			slarr: "←",
			SmallCircle: "∘",
			smallsetminus: "∖",
			smashp: "⨳",
			smeparsl: "⧤",
			smid: "∣",
			smile: "⌣",
			smt: "⪪",
			smte: "⪬",
			smtes: "⪬︀",
			SOFTcy: "Ь",
			softcy: "ь",
			sol: "/",
			solb: "⧄",
			solbar: "⌿",
			Sopf: "𝕊",
			sopf: "𝕤",
			spades: "♠",
			spadesuit: "♠",
			spar: "∥",
			sqcap: "⊓",
			sqcaps: "⊓︀",
			sqcup: "⊔",
			sqcups: "⊔︀",
			Sqrt: "√",
			sqsub: "⊏",
			sqsube: "⊑",
			sqsubset: "⊏",
			sqsubseteq: "⊑",
			sqsup: "⊐",
			sqsupe: "⊒",
			sqsupset: "⊐",
			sqsupseteq: "⊒",
			squ: "□",
			Square: "□",
			square: "□",
			SquareIntersection: "⊓",
			SquareSubset: "⊏",
			SquareSubsetEqual: "⊑",
			SquareSuperset: "⊐",
			SquareSupersetEqual: "⊒",
			SquareUnion: "⊔",
			squarf: "▪",
			squf: "▪",
			srarr: "→",
			Sscr: "𝒮",
			sscr: "𝓈",
			ssetmn: "∖",
			ssmile: "⌣",
			sstarf: "⋆",
			Star: "⋆",
			star: "☆",
			starf: "★",
			straightepsilon: "ϵ",
			straightphi: "ϕ",
			strns: "¯",
			Sub: "⋐",
			sub: "⊂",
			subdot: "⪽",
			subE: "⫅",
			sube: "⊆",
			subedot: "⫃",
			submult: "⫁",
			subnE: "⫋",
			subne: "⊊",
			subplus: "⪿",
			subrarr: "⥹",
			Subset: "⋐",
			subset: "⊂",
			subseteq: "⊆",
			subseteqq: "⫅",
			SubsetEqual: "⊆",
			subsetneq: "⊊",
			subsetneqq: "⫋",
			subsim: "⫇",
			subsub: "⫕",
			subsup: "⫓",
			succ: "≻",
			succapprox: "⪸",
			succcurlyeq: "≽",
			Succeeds: "≻",
			SucceedsEqual: "⪰",
			SucceedsSlantEqual: "≽",
			SucceedsTilde: "≿",
			succeq: "⪰",
			succnapprox: "⪺",
			succneqq: "⪶",
			succnsim: "⋩",
			succsim: "≿",
			SuchThat: "∋",
			Sum: "∑",
			sum: "∑",
			sung: "♪",
			Sup: "⋑",
			sup: "⊃",
			sup1: "¹",
			sup2: "²",
			sup3: "³",
			supdot: "⪾",
			supdsub: "⫘",
			supE: "⫆",
			supe: "⊇",
			supedot: "⫄",
			Superset: "⊃",
			SupersetEqual: "⊇",
			suphsol: "⟉",
			suphsub: "⫗",
			suplarr: "⥻",
			supmult: "⫂",
			supnE: "⫌",
			supne: "⊋",
			supplus: "⫀",
			Supset: "⋑",
			supset: "⊃",
			supseteq: "⊇",
			supseteqq: "⫆",
			supsetneq: "⊋",
			supsetneqq: "⫌",
			supsim: "⫈",
			supsub: "⫔",
			supsup: "⫖",
			swarhk: "⤦",
			swArr: "⇙",
			swarr: "↙",
			swarrow: "↙",
			swnwar: "⤪",
			szlig: "ß",
			Tab: "	",
			target: "⌖",
			Tau: "Τ",
			tau: "τ",
			tbrk: "⎴",
			Tcaron: "Ť",
			tcaron: "ť",
			Tcedil: "Ţ",
			tcedil: "ţ",
			Tcy: "Т",
			tcy: "т",
			tdot: "⃛",
			telrec: "⌕",
			Tfr: "𝔗",
			tfr: "𝔱",
			there4: "∴",
			Therefore: "∴",
			therefore: "∴",
			Theta: "Θ",
			theta: "θ",
			thetasym: "ϑ",
			thetav: "ϑ",
			thickapprox: "≈",
			thicksim: "∼",
			ThickSpace: "  ",
			thinsp: " ",
			ThinSpace: " ",
			thkap: "≈",
			thksim: "∼",
			THORN: "Þ",
			thorn: "þ",
			Tilde: "∼",
			tilde: "˜",
			TildeEqual: "≃",
			TildeFullEqual: "≅",
			TildeTilde: "≈",
			times: "×",
			timesb: "⊠",
			timesbar: "⨱",
			timesd: "⨰",
			tint: "∭",
			toea: "⤨",
			top: "⊤",
			topbot: "⌶",
			topcir: "⫱",
			Topf: "𝕋",
			topf: "𝕥",
			topfork: "⫚",
			tosa: "⤩",
			tprime: "‴",
			TRADE: "™",
			trade: "™",
			triangle: "▵",
			triangledown: "▿",
			triangleleft: "◃",
			trianglelefteq: "⊴",
			triangleq: "≜",
			triangleright: "▹",
			trianglerighteq: "⊵",
			tridot: "◬",
			trie: "≜",
			triminus: "⨺",
			TripleDot: "⃛",
			triplus: "⨹",
			trisb: "⧍",
			tritime: "⨻",
			trpezium: "⏢",
			Tscr: "𝒯",
			tscr: "𝓉",
			TScy: "Ц",
			tscy: "ц",
			TSHcy: "Ћ",
			tshcy: "ћ",
			Tstrok: "Ŧ",
			tstrok: "ŧ",
			twixt: "≬",
			twoheadleftarrow: "↞",
			twoheadrightarrow: "↠",
			Uacute: "Ú",
			uacute: "ú",
			Uarr: "↟",
			uArr: "⇑",
			uarr: "↑",
			Uarrocir: "⥉",
			Ubrcy: "Ў",
			ubrcy: "ў",
			Ubreve: "Ŭ",
			ubreve: "ŭ",
			Ucirc: "Û",
			ucirc: "û",
			Ucy: "У",
			ucy: "у",
			udarr: "⇅",
			Udblac: "Ű",
			udblac: "ű",
			udhar: "⥮",
			ufisht: "⥾",
			Ufr: "𝔘",
			ufr: "𝔲",
			Ugrave: "Ù",
			ugrave: "ù",
			uHar: "⥣",
			uharl: "↿",
			uharr: "↾",
			uhblk: "▀",
			ulcorn: "⌜",
			ulcorner: "⌜",
			ulcrop: "⌏",
			ultri: "◸",
			Umacr: "Ū",
			umacr: "ū",
			uml: "¨",
			UnderBar: "_",
			UnderBrace: "⏟",
			UnderBracket: "⎵",
			UnderParenthesis: "⏝",
			Union: "⋃",
			UnionPlus: "⊎",
			Uogon: "Ų",
			uogon: "ų",
			Uopf: "𝕌",
			uopf: "𝕦",
			UpArrow: "↑",
			Uparrow: "⇑",
			uparrow: "↑",
			UpArrowBar: "⤒",
			UpArrowDownArrow: "⇅",
			UpDownArrow: "↕",
			Updownarrow: "⇕",
			updownarrow: "↕",
			UpEquilibrium: "⥮",
			upharpoonleft: "↿",
			upharpoonright: "↾",
			uplus: "⊎",
			UpperLeftArrow: "↖",
			UpperRightArrow: "↗",
			Upsi: "ϒ",
			upsi: "υ",
			upsih: "ϒ",
			Upsilon: "Υ",
			upsilon: "υ",
			UpTee: "⊥",
			UpTeeArrow: "↥",
			upuparrows: "⇈",
			urcorn: "⌝",
			urcorner: "⌝",
			urcrop: "⌎",
			Uring: "Ů",
			uring: "ů",
			urtri: "◹",
			Uscr: "𝒰",
			uscr: "𝓊",
			utdot: "⋰",
			Utilde: "Ũ",
			utilde: "ũ",
			utri: "▵",
			utrif: "▴",
			uuarr: "⇈",
			Uuml: "Ü",
			uuml: "ü",
			uwangle: "⦧",
			vangrt: "⦜",
			varepsilon: "ϵ",
			varkappa: "ϰ",
			varnothing: "∅",
			varphi: "ϕ",
			varpi: "ϖ",
			varpropto: "∝",
			vArr: "⇕",
			varr: "↕",
			varrho: "ϱ",
			varsigma: "ς",
			varsubsetneq: "⊊︀",
			varsubsetneqq: "⫋︀",
			varsupsetneq: "⊋︀",
			varsupsetneqq: "⫌︀",
			vartheta: "ϑ",
			vartriangleleft: "⊲",
			vartriangleright: "⊳",
			Vbar: "⫫",
			vBar: "⫨",
			vBarv: "⫩",
			Vcy: "В",
			vcy: "в",
			VDash: "⊫",
			Vdash: "⊩",
			vDash: "⊨",
			vdash: "⊢",
			Vdashl: "⫦",
			Vee: "⋁",
			vee: "∨",
			veebar: "⊻",
			veeeq: "≚",
			vellip: "⋮",
			Verbar: "‖",
			verbar: "|",
			Vert: "‖",
			vert: "|",
			VerticalBar: "∣",
			VerticalLine: "|",
			VerticalSeparator: "❘",
			VerticalTilde: "≀",
			VeryThinSpace: " ",
			Vfr: "𝔙",
			vfr: "𝔳",
			vltri: "⊲",
			vnsub: "⊂⃒",
			vnsup: "⊃⃒",
			Vopf: "𝕍",
			vopf: "𝕧",
			vprop: "∝",
			vrtri: "⊳",
			Vscr: "𝒱",
			vscr: "𝓋",
			vsubnE: "⫋︀",
			vsubne: "⊊︀",
			vsupnE: "⫌︀",
			vsupne: "⊋︀",
			Vvdash: "⊪",
			vzigzag: "⦚",
			Wcirc: "Ŵ",
			wcirc: "ŵ",
			wedbar: "⩟",
			Wedge: "⋀",
			wedge: "∧",
			wedgeq: "≙",
			weierp: "℘",
			Wfr: "𝔚",
			wfr: "𝔴",
			Wopf: "𝕎",
			wopf: "𝕨",
			wp: "℘",
			wr: "≀",
			wreath: "≀",
			Wscr: "𝒲",
			wscr: "𝓌",
			xcap: "⋂",
			xcirc: "◯",
			xcup: "⋃",
			xdtri: "▽",
			Xfr: "𝔛",
			xfr: "𝔵",
			xhArr: "⟺",
			xharr: "⟷",
			Xi: "Ξ",
			xi: "ξ",
			xlArr: "⟸",
			xlarr: "⟵",
			xmap: "⟼",
			xnis: "⋻",
			xodot: "⨀",
			Xopf: "𝕏",
			xopf: "𝕩",
			xoplus: "⨁",
			xotime: "⨂",
			xrArr: "⟹",
			xrarr: "⟶",
			Xscr: "𝒳",
			xscr: "𝓍",
			xsqcup: "⨆",
			xuplus: "⨄",
			xutri: "△",
			xvee: "⋁",
			xwedge: "⋀",
			Yacute: "Ý",
			yacute: "ý",
			YAcy: "Я",
			yacy: "я",
			Ycirc: "Ŷ",
			ycirc: "ŷ",
			Ycy: "Ы",
			ycy: "ы",
			yen: "¥",
			Yfr: "𝔜",
			yfr: "𝔶",
			YIcy: "Ї",
			yicy: "ї",
			Yopf: "𝕐",
			yopf: "𝕪",
			Yscr: "𝒴",
			yscr: "𝓎",
			YUcy: "Ю",
			yucy: "ю",
			Yuml: "Ÿ",
			yuml: "ÿ",
			Zacute: "Ź",
			zacute: "ź",
			Zcaron: "Ž",
			zcaron: "ž",
			Zcy: "З",
			zcy: "з",
			Zdot: "Ż",
			zdot: "ż",
			zeetrf: "ℨ",
			ZeroWidthSpace: "​",
			Zeta: "Ζ",
			zeta: "ζ",
			Zfr: "ℨ",
			zfr: "𝔷",
			ZHcy: "Ж",
			zhcy: "ж",
			zigrarr: "⇝",
			Zopf: "ℤ",
			zopf: "𝕫",
			Zscr: "𝒵",
			zscr: "𝓏",
			zwj: "‍",
			zwnj: "‌"
		});
		/**
		* @deprecated
		* Use `HTML_ENTITIES` instead.
		* @see {@link HTML_ENTITIES}
		*/
		exports$1.entityMap = exports$1.HTML_ENTITIES;
	}) });
	var require_sax = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/sax.js": ((exports$1) => {
		var conventions$2 = require_conventions();
		var g = require_grammar();
		var errors$2 = require_errors();
		var isHTMLEscapableRawTextElement = conventions$2.isHTMLEscapableRawTextElement;
		var isHTMLMimeType$1 = conventions$2.isHTMLMimeType;
		var isHTMLRawTextElement = conventions$2.isHTMLRawTextElement;
		var hasOwn = conventions$2.hasOwn;
		var NAMESPACE$1 = conventions$2.NAMESPACE;
		var ParseError$1 = errors$2.ParseError;
		var DOMException = errors$2.DOMException;
		var S_TAG = 0;
		var S_ATTR = 1;
		var S_ATTR_SPACE = 2;
		var S_EQ = 3;
		var S_ATTR_NOQUOT_VALUE = 4;
		var S_ATTR_END = 5;
		var S_TAG_SPACE = 6;
		var S_TAG_CLOSE = 7;
		function XMLReader$1() {}
		XMLReader$1.prototype = { parse: function(source, defaultNSMap, entityMap) {
			var domBuilder = this.domBuilder;
			domBuilder.startDocument();
			_copy(defaultNSMap, defaultNSMap = Object.create(null));
			parse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler);
			domBuilder.endDocument();
		} };
		/**
		* Detecting everything that might be a reference,
		* including those without ending `;`, since those are allowed in HTML.
		* The entityReplacer takes care of verifying and transforming each occurrence,
		* and reports to the errorHandler on those that are not OK,
		* depending on the context.
		*/
		var ENTITY_REG = /&#?\w+;?/g;
		function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
			var isHTML = isHTMLMimeType$1(domBuilder.mimeType);
			if (source.indexOf(g.UNICODE_REPLACEMENT_CHARACTER) >= 0) errorHandler.warning("Unicode replacement character detected, source encoding issues?");
			function fixedFromCharCode(code) {
				if (code > 65535) {
					code -= 65536;
					var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023);
					return String.fromCharCode(surrogate1, surrogate2);
				} else return String.fromCharCode(code);
			}
			function entityReplacer(a$1) {
				var complete = a$1[a$1.length - 1] === ";" ? a$1 : a$1 + ";";
				if (!isHTML && complete !== a$1) {
					errorHandler.error("EntityRef: expecting ;");
					return a$1;
				}
				var match = g.Reference.exec(complete);
				if (!match || match[0].length !== complete.length) {
					errorHandler.error("entity not matching Reference production: " + a$1);
					return a$1;
				}
				var k = complete.slice(1, -1);
				if (hasOwn(entityMap, k)) return entityMap[k];
				else if (k.charAt(0) === "#") return fixedFromCharCode(parseInt(k.substring(1).replace("x", "0x")));
				else {
					errorHandler.error("entity not found:" + a$1);
					return a$1;
				}
			}
			function appendText(end$1) {
				if (end$1 > start) {
					var xt = source.substring(start, end$1).replace(ENTITY_REG, entityReplacer);
					locator && position$1(start);
					domBuilder.characters(xt, 0, end$1 - start);
					start = end$1;
				}
			}
			var lineStart = 0;
			var lineEnd = 0;
			var linePattern = /\r\n?|\n|$/g;
			var locator = domBuilder.locator;
			function position$1(p, m) {
				while (p >= lineEnd && (m = linePattern.exec(source))) {
					lineStart = lineEnd;
					lineEnd = m.index + m[0].length;
					locator.lineNumber++;
				}
				locator.columnNumber = p - lineStart + 1;
			}
			var parseStack = [{ currentNSMap: defaultNSMapCopy }];
			var unclosedTags = [];
			var start = 0;
			while (true) {
				try {
					var tagStart = source.indexOf("<", start);
					if (tagStart < 0) {
						if (!isHTML && unclosedTags.length > 0) return errorHandler.fatalError("unclosed xml tag(s): " + unclosedTags.join(", "));
						if (!source.substring(start).match(/^\s*$/)) {
							var doc = domBuilder.doc;
							var text = doc.createTextNode(source.substring(start));
							if (doc.documentElement) return errorHandler.error("Extra content at the end of the document");
							doc.appendChild(text);
							domBuilder.currentElement = text;
						}
						return;
					}
					if (tagStart > start) {
						var fromSource = source.substring(start, tagStart);
						if (!isHTML && unclosedTags.length === 0) {
							fromSource = fromSource.replace(new RegExp(g.S_OPT.source, "g"), "");
							fromSource && errorHandler.error("Unexpected content outside root element: '" + fromSource + "'");
						}
						appendText(tagStart);
					}
					switch (source.charAt(tagStart + 1)) {
						case "/":
							var end = source.indexOf(">", tagStart + 2);
							var tagNameRaw = source.substring(tagStart + 2, end > 0 ? end : void 0);
							if (!tagNameRaw) return errorHandler.fatalError("end tag name missing");
							var tagNameMatch = end > 0 && g.reg("^", g.QName_group, g.S_OPT, "$").exec(tagNameRaw);
							if (!tagNameMatch) return errorHandler.fatalError("end tag name contains invalid characters: \"" + tagNameRaw + "\"");
							if (!domBuilder.currentElement && !domBuilder.doc.documentElement) return;
							var currentTagName = unclosedTags[unclosedTags.length - 1] || domBuilder.currentElement.tagName || domBuilder.doc.documentElement.tagName || "";
							if (currentTagName !== tagNameMatch[1]) {
								var tagNameLower = tagNameMatch[1].toLowerCase();
								if (!isHTML || currentTagName.toLowerCase() !== tagNameLower) return errorHandler.fatalError("Opening and ending tag mismatch: \"" + currentTagName + "\" != \"" + tagNameRaw + "\"");
							}
							var config = parseStack.pop();
							unclosedTags.pop();
							var localNSMap = config.localNSMap;
							domBuilder.endElement(config.uri, config.localName, currentTagName);
							if (localNSMap) {
								for (var prefix in localNSMap) if (hasOwn(localNSMap, prefix)) domBuilder.endPrefixMapping(prefix);
							}
							end++;
							break;
						case "?":
							locator && position$1(tagStart);
							end = parseProcessingInstruction(source, tagStart, domBuilder, errorHandler);
							break;
						case "!":
							locator && position$1(tagStart);
							end = parseDoctypeCommentOrCData(source, tagStart, domBuilder, errorHandler, isHTML);
							break;
						default:
							locator && position$1(tagStart);
							var el = new ElementAttributes();
							var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
							var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler, isHTML);
							var len = el.length;
							if (!el.closed) if (isHTML && conventions$2.isHTMLVoidElement(el.tagName)) el.closed = true;
							else unclosedTags.push(el.tagName);
							if (locator && len) {
								var locator2 = copyLocator(locator, {});
								for (var i$1 = 0; i$1 < len; i$1++) {
									var a = el[i$1];
									position$1(a.offset);
									a.locator = copyLocator(locator, {});
								}
								domBuilder.locator = locator2;
								if (appendElement$1(el, domBuilder, currentNSMap)) parseStack.push(el);
								domBuilder.locator = locator;
							} else if (appendElement$1(el, domBuilder, currentNSMap)) parseStack.push(el);
							if (isHTML && !el.closed) end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
							else end++;
					}
				} catch (e) {
					if (e instanceof ParseError$1) throw e;
					else if (e instanceof DOMException) throw new ParseError$1(e.name + ": " + e.message, domBuilder.locator, e);
					errorHandler.error("element parse error: " + e);
					end = -1;
				}
				if (end > start) start = end;
				else appendText(Math.max(tagStart, start) + 1);
			}
		}
		function copyLocator(f, t) {
			t.lineNumber = f.lineNumber;
			t.columnNumber = f.columnNumber;
			return t;
		}
		/**
		* @returns
		* end of the elementStartPart(end of elementEndPart for selfClosed el)
		* @see {@link #appendElement}
		*/
		function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler, isHTML) {
			/**
			* @param {string} qname
			* @param {string} value
			* @param {number} startIndex
			*/
			function addAttribute(qname, value$1, startIndex) {
				if (hasOwn(el.attributeNames, qname)) return errorHandler.fatalError("Attribute " + qname + " redefined");
				if (!isHTML && value$1.indexOf("<") >= 0) return errorHandler.fatalError("Unescaped '<' not allowed in attributes values");
				el.addValue(qname, value$1.replace(/[\t\n\r]/g, " ").replace(ENTITY_REG, entityReplacer), startIndex);
			}
			var attrName;
			var value;
			var p = ++start;
			var s = S_TAG;
			while (true) {
				var c = source.charAt(p);
				switch (c) {
					case "=":
						if (s === S_ATTR) {
							attrName = source.slice(start, p);
							s = S_EQ;
						} else if (s === S_ATTR_SPACE) s = S_EQ;
						else throw new Error("attribute equal must after attrName");
						break;
					case "'":
					case "\"":
						if (s === S_EQ || s === S_ATTR) {
							if (s === S_ATTR) {
								errorHandler.warning("attribute value must after \"=\"");
								attrName = source.slice(start, p);
							}
							start = p + 1;
							p = source.indexOf(c, start);
							if (p > 0) {
								value = source.slice(start, p);
								addAttribute(attrName, value, start - 1);
								s = S_ATTR_END;
							} else throw new Error("attribute value no end '" + c + "' match");
						} else if (s == S_ATTR_NOQUOT_VALUE) {
							value = source.slice(start, p);
							addAttribute(attrName, value, start);
							errorHandler.warning("attribute \"" + attrName + "\" missed start quot(" + c + ")!!");
							start = p + 1;
							s = S_ATTR_END;
						} else throw new Error("attribute value must after \"=\"");
						break;
					case "/":
						switch (s) {
							case S_TAG: el.setTagName(source.slice(start, p));
							case S_ATTR_END:
							case S_TAG_SPACE:
							case S_TAG_CLOSE:
								s = S_TAG_CLOSE;
								el.closed = true;
							case S_ATTR_NOQUOT_VALUE:
							case S_ATTR: break;
							case S_ATTR_SPACE:
								el.closed = true;
								break;
							default: throw new Error("attribute invalid close char('/')");
						}
						break;
					case "":
						errorHandler.error("unexpected end of input");
						if (s == S_TAG) el.setTagName(source.slice(start, p));
						return p;
					case ">":
						switch (s) {
							case S_TAG: el.setTagName(source.slice(start, p));
							case S_ATTR_END:
							case S_TAG_SPACE:
							case S_TAG_CLOSE: break;
							case S_ATTR_NOQUOT_VALUE:
							case S_ATTR:
								value = source.slice(start, p);
								if (value.slice(-1) === "/") {
									el.closed = true;
									value = value.slice(0, -1);
								}
							case S_ATTR_SPACE:
								if (s === S_ATTR_SPACE) value = attrName;
								if (s == S_ATTR_NOQUOT_VALUE) {
									errorHandler.warning("attribute \"" + value + "\" missed quot(\")!");
									addAttribute(attrName, value, start);
								} else {
									if (!isHTML) errorHandler.warning("attribute \"" + value + "\" missed value!! \"" + value + "\" instead!!");
									addAttribute(value, value, start);
								}
								break;
							case S_EQ: if (!isHTML) return errorHandler.fatalError("AttValue: ' or \" expected");
						}
						return p;
					case "": c = " ";
					default: if (c <= " ") switch (s) {
						case S_TAG:
							el.setTagName(source.slice(start, p));
							s = S_TAG_SPACE;
							break;
						case S_ATTR:
							attrName = source.slice(start, p);
							s = S_ATTR_SPACE;
							break;
						case S_ATTR_NOQUOT_VALUE:
							var value = source.slice(start, p);
							errorHandler.warning("attribute \"" + value + "\" missed quot(\")!!");
							addAttribute(attrName, value, start);
						case S_ATTR_END:
							s = S_TAG_SPACE;
							break;
					}
					else switch (s) {
						case S_ATTR_SPACE:
							if (!isHTML) errorHandler.warning("attribute \"" + attrName + "\" missed value!! \"" + attrName + "\" instead2!!");
							addAttribute(attrName, attrName, start);
							start = p;
							s = S_ATTR;
							break;
						case S_ATTR_END: errorHandler.warning("attribute space is required\"" + attrName + "\"!!");
						case S_TAG_SPACE:
							s = S_ATTR;
							start = p;
							break;
						case S_EQ:
							s = S_ATTR_NOQUOT_VALUE;
							start = p;
							break;
						case S_TAG_CLOSE: throw new Error("elements closed character '/' and '>' must be connected to");
					}
				}
				p++;
			}
		}
		/**
		* @returns
		* `true` if a new namespace has been defined.
		*/
		function appendElement$1(el, domBuilder, currentNSMap) {
			var tagName = el.tagName;
			var localNSMap = null;
			var i$1 = el.length;
			while (i$1--) {
				var a = el[i$1];
				var qName = a.qName;
				var value = a.value;
				var nsp = qName.indexOf(":");
				if (nsp > 0) {
					var prefix = a.prefix = qName.slice(0, nsp);
					var localName = qName.slice(nsp + 1);
					var nsPrefix = prefix === "xmlns" && localName;
				} else {
					localName = qName;
					prefix = null;
					nsPrefix = qName === "xmlns" && "";
				}
				a.localName = localName;
				if (nsPrefix !== false) {
					if (localNSMap == null) {
						localNSMap = Object.create(null);
						_copy(currentNSMap, currentNSMap = Object.create(null));
					}
					currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
					a.uri = NAMESPACE$1.XMLNS;
					domBuilder.startPrefixMapping(nsPrefix, value);
				}
			}
			var i$1 = el.length;
			while (i$1--) {
				a = el[i$1];
				if (a.prefix) {
					if (a.prefix === "xml") a.uri = NAMESPACE$1.XML;
					if (a.prefix !== "xmlns") a.uri = currentNSMap[a.prefix];
				}
			}
			var nsp = tagName.indexOf(":");
			if (nsp > 0) {
				prefix = el.prefix = tagName.slice(0, nsp);
				localName = el.localName = tagName.slice(nsp + 1);
			} else {
				prefix = null;
				localName = el.localName = tagName;
			}
			var ns = el.uri = currentNSMap[prefix || ""];
			domBuilder.startElement(ns, localName, tagName, el);
			if (el.closed) {
				domBuilder.endElement(ns, localName, tagName);
				if (localNSMap) {
					for (prefix in localNSMap) if (hasOwn(localNSMap, prefix)) domBuilder.endPrefixMapping(prefix);
				}
			} else {
				el.currentNSMap = currentNSMap;
				el.localNSMap = localNSMap;
				return true;
			}
		}
		function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
			var isEscapableRaw = isHTMLEscapableRawTextElement(tagName);
			if (isEscapableRaw || isHTMLRawTextElement(tagName)) {
				var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
				var text = source.substring(elStartEnd + 1, elEndStart);
				if (isEscapableRaw) text = text.replace(ENTITY_REG, entityReplacer);
				domBuilder.characters(text, 0, text.length);
				return elEndStart;
			}
			return elStartEnd + 1;
		}
		function _copy(source, target) {
			for (var n in source) if (hasOwn(source, n)) target[n] = source[n];
		}
		/**
		* @typedef ParseUtils
		* @property {function(relativeIndex: number?): string | undefined} char
		* Provides look ahead access to a singe character relative to the current index.
		* @property {function(): number} getIndex
		* Provides read-only access to the current index.
		* @property {function(reg: RegExp): string | null} getMatch
		* Applies the provided regular expression enforcing that it starts at the current index and
		* returns the complete matching string,
		* and moves the current index by the length of the matching string.
		* @property {function(): string} getSource
		* Provides read-only access to the complete source.
		* @property {function(places: number?): void} skip
		* moves the current index by places (defaults to 1)
		* @property {function(): number} skipBlanks
		* Moves the current index by the amount of white space that directly follows the current index
		* and returns the amount of whitespace chars skipped (0..n),
		* or -1 if the end of the source was reached.
		* @property {function(): string} substringFromIndex
		* creates a substring from the current index to the end of `source`
		* @property {function(compareWith: string): boolean} substringStartsWith
		* Checks if `source` contains `compareWith`, starting from the current index.
		* @property {function(compareWith: string): boolean} substringStartsWithCaseInsensitive
		* Checks if `source` contains `compareWith`, starting from the current index,
		* comparing the upper case of both sides.
		* @see {@link parseUtils}
		*/
		/**
		* A temporary scope for parsing and look ahead operations in `source`,
		* starting from index `start`.
		*
		* Some operations move the current index by a number of positions,
		* after which `getIndex` returns the new index.
		*
		* @param {string} source
		* @param {number} start
		* @returns {ParseUtils}
		*/
		function parseUtils(source, start) {
			var index$1 = start;
			function char(n) {
				n = n || 0;
				return source.charAt(index$1 + n);
			}
			function skip(n) {
				n = n || 1;
				index$1 += n;
			}
			function skipBlanks() {
				var blanks = 0;
				while (index$1 < source.length) {
					var c = char();
					if (c !== " " && c !== "\n" && c !== "	" && c !== "\r") return blanks;
					blanks++;
					skip();
				}
				return -1;
			}
			function substringFromIndex() {
				return source.substring(index$1);
			}
			function substringStartsWith(text) {
				return source.substring(index$1, index$1 + text.length) === text;
			}
			function substringStartsWithCaseInsensitive(text) {
				return source.substring(index$1, index$1 + text.length).toUpperCase() === text.toUpperCase();
			}
			function getMatch(args) {
				var match = g.reg("^", args).exec(substringFromIndex());
				if (match) {
					skip(match[0].length);
					return match[0];
				}
				return null;
			}
			return {
				char,
				getIndex: function() {
					return index$1;
				},
				getMatch,
				getSource: function() {
					return source;
				},
				skip,
				skipBlanks,
				substringFromIndex,
				substringStartsWith,
				substringStartsWithCaseInsensitive
			};
		}
		/**
		* @param {ParseUtils} p
		* @param {DOMHandler} errorHandler
		* @returns {string}
		*/
		function parseDoctypeInternalSubset(p, errorHandler) {
			/**
			* @param {ParseUtils} p
			* @param {DOMHandler} errorHandler
			* @returns {string}
			*/
			function parsePI(p$1, errorHandler$1) {
				var match = g.PI.exec(p$1.substringFromIndex());
				if (!match) return errorHandler$1.fatalError("processing instruction is not well-formed at position " + p$1.getIndex());
				if (match[1].toLowerCase() === "xml") return errorHandler$1.fatalError("xml declaration is only allowed at the start of the document, but found at position " + p$1.getIndex());
				p$1.skip(match[0].length);
				return match[0];
			}
			var source = p.getSource();
			if (p.char() === "[") {
				p.skip(1);
				var intSubsetStart = p.getIndex();
				while (p.getIndex() < source.length) {
					p.skipBlanks();
					if (p.char() === "]") {
						var internalSubset = source.substring(intSubsetStart, p.getIndex());
						p.skip(1);
						return internalSubset;
					}
					var current = null;
					if (p.char() === "<" && p.char(1) === "!") switch (p.char(2)) {
						case "E":
							if (p.char(3) === "L") current = p.getMatch(g.elementdecl);
							else if (p.char(3) === "N") current = p.getMatch(g.EntityDecl);
							break;
						case "A":
							current = p.getMatch(g.AttlistDecl);
							break;
						case "N":
							current = p.getMatch(g.NotationDecl);
							break;
						case "-":
							current = p.getMatch(g.Comment);
							break;
					}
					else if (p.char() === "<" && p.char(1) === "?") current = parsePI(p, errorHandler);
					else if (p.char() === "%") current = p.getMatch(g.PEReference);
					else return errorHandler.fatalError("Error detected in Markup declaration");
					if (!current) return errorHandler.fatalError("Error in internal subset at position " + p.getIndex());
				}
				return errorHandler.fatalError("doctype internal subset is not well-formed, missing ]");
			}
		}
		/**
		* Called when the parser encounters an element starting with '<!'.
		*
		* @param {string} source
		* The xml.
		* @param {number} start
		* the start index of the '<!'
		* @param {DOMHandler} domBuilder
		* @param {DOMHandler} errorHandler
		* @param {boolean} isHTML
		* @returns {number | never}
		* The end index of the element.
		* @throws {ParseError}
		* In case the element is not well-formed.
		*/
		function parseDoctypeCommentOrCData(source, start, domBuilder, errorHandler, isHTML) {
			var p = parseUtils(source, start);
			switch (isHTML ? p.char(2).toUpperCase() : p.char(2)) {
				case "-":
					var comment = p.getMatch(g.Comment);
					if (comment) {
						domBuilder.comment(comment, g.COMMENT_START.length, comment.length - g.COMMENT_START.length - g.COMMENT_END.length);
						return p.getIndex();
					} else return errorHandler.fatalError("comment is not well-formed at position " + p.getIndex());
				case "[":
					var cdata = p.getMatch(g.CDSect);
					if (cdata) {
						if (!isHTML && !domBuilder.currentElement) return errorHandler.fatalError("CDATA outside of element");
						domBuilder.startCDATA();
						domBuilder.characters(cdata, g.CDATA_START.length, cdata.length - g.CDATA_START.length - g.CDATA_END.length);
						domBuilder.endCDATA();
						return p.getIndex();
					} else return errorHandler.fatalError("Invalid CDATA starting at position " + start);
				case "D":
					if (domBuilder.doc && domBuilder.doc.documentElement) return errorHandler.fatalError("Doctype not allowed inside or after documentElement at position " + p.getIndex());
					if (isHTML ? !p.substringStartsWithCaseInsensitive(g.DOCTYPE_DECL_START) : !p.substringStartsWith(g.DOCTYPE_DECL_START)) return errorHandler.fatalError("Expected " + g.DOCTYPE_DECL_START + " at position " + p.getIndex());
					p.skip(g.DOCTYPE_DECL_START.length);
					if (p.skipBlanks() < 1) return errorHandler.fatalError("Expected whitespace after " + g.DOCTYPE_DECL_START + " at position " + p.getIndex());
					var doctype = {
						name: void 0,
						publicId: void 0,
						systemId: void 0,
						internalSubset: void 0
					};
					doctype.name = p.getMatch(g.Name);
					if (!doctype.name) return errorHandler.fatalError("doctype name missing or contains unexpected characters at position " + p.getIndex());
					if (isHTML && doctype.name.toLowerCase() !== "html") errorHandler.warning("Unexpected DOCTYPE in HTML document at position " + p.getIndex());
					p.skipBlanks();
					if (p.substringStartsWith(g.PUBLIC) || p.substringStartsWith(g.SYSTEM)) {
						var match = g.ExternalID_match.exec(p.substringFromIndex());
						if (!match) return errorHandler.fatalError("doctype external id is not well-formed at position " + p.getIndex());
						if (match.groups.SystemLiteralOnly !== void 0) doctype.systemId = match.groups.SystemLiteralOnly;
						else {
							doctype.systemId = match.groups.SystemLiteral;
							doctype.publicId = match.groups.PubidLiteral;
						}
						p.skip(match[0].length);
					} else if (isHTML && p.substringStartsWithCaseInsensitive(g.SYSTEM)) {
						p.skip(g.SYSTEM.length);
						if (p.skipBlanks() < 1) return errorHandler.fatalError("Expected whitespace after " + g.SYSTEM + " at position " + p.getIndex());
						doctype.systemId = p.getMatch(g.ABOUT_LEGACY_COMPAT_SystemLiteral);
						if (!doctype.systemId) return errorHandler.fatalError("Expected " + g.ABOUT_LEGACY_COMPAT + " in single or double quotes after " + g.SYSTEM + " at position " + p.getIndex());
					}
					if (isHTML && doctype.systemId && !g.ABOUT_LEGACY_COMPAT_SystemLiteral.test(doctype.systemId)) errorHandler.warning("Unexpected doctype.systemId in HTML document at position " + p.getIndex());
					if (!isHTML) {
						p.skipBlanks();
						doctype.internalSubset = parseDoctypeInternalSubset(p, errorHandler);
					}
					p.skipBlanks();
					if (p.char() !== ">") return errorHandler.fatalError("doctype not terminated with > at position " + p.getIndex());
					p.skip(1);
					domBuilder.startDTD(doctype.name, doctype.publicId, doctype.systemId, doctype.internalSubset);
					domBuilder.endDTD();
					return p.getIndex();
				default: return errorHandler.fatalError("Not well-formed XML starting with \"<!\" at position " + start);
			}
		}
		function parseProcessingInstruction(source, start, domBuilder, errorHandler) {
			var match = source.substring(start).match(g.PI);
			if (!match) return errorHandler.fatalError("Invalid processing instruction starting at position " + start);
			if (match[1].toLowerCase() === "xml") {
				if (start > 0) return errorHandler.fatalError("processing instruction at position " + start + " is an xml declaration which is only at the start of the document");
				if (!g.XMLDecl.test(source.substring(start))) return errorHandler.fatalError("xml declaration is not well-formed");
			}
			domBuilder.processingInstruction(match[1], match[2]);
			return start + match[0].length;
		}
		function ElementAttributes() {
			this.attributeNames = Object.create(null);
		}
		ElementAttributes.prototype = {
			setTagName: function(tagName) {
				if (!g.QName_exact.test(tagName)) throw new Error("invalid tagName:" + tagName);
				this.tagName = tagName;
			},
			addValue: function(qName, value, offset) {
				if (!g.QName_exact.test(qName)) throw new Error("invalid attribute:" + qName);
				this.attributeNames[qName] = this.length;
				this[this.length++] = {
					qName,
					value,
					offset
				};
			},
			length: 0,
			getLocalName: function(i$1) {
				return this[i$1].localName;
			},
			getLocator: function(i$1) {
				return this[i$1].locator;
			},
			getQName: function(i$1) {
				return this[i$1].qName;
			},
			getURI: function(i$1) {
				return this[i$1].uri;
			},
			getValue: function(i$1) {
				return this[i$1].value;
			}
		};
		exports$1.XMLReader = XMLReader$1;
		exports$1.parseUtils = parseUtils;
		exports$1.parseDoctypeCommentOrCData = parseDoctypeCommentOrCData;
	}) });
	var require_dom_parser = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/dom-parser.js": ((exports$1) => {
		var conventions$1 = require_conventions();
		var dom$1 = require_dom();
		var errors$1 = require_errors();
		var entities = require_entities();
		var sax = require_sax();
		var DOMImplementation = dom$1.DOMImplementation;
		var hasDefaultHTMLNamespace = conventions$1.hasDefaultHTMLNamespace;
		var isHTMLMimeType = conventions$1.isHTMLMimeType;
		var isValidMimeType = conventions$1.isValidMimeType;
		var MIME_TYPE = conventions$1.MIME_TYPE;
		var NAMESPACE = conventions$1.NAMESPACE;
		var ParseError = errors$1.ParseError;
		var XMLReader = sax.XMLReader;
		/**
		* Normalizes line ending according to <https://www.w3.org/TR/xml11/#sec-line-ends>,
		* including some Unicode "newline" characters:
		*
		* > XML parsed entities are often stored in computer files which,
		* > for editing convenience, are organized into lines.
		* > These lines are typically separated by some combination
		* > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).
		* >
		* > To simplify the tasks of applications, the XML processor must behave
		* > as if it normalized all line breaks in external parsed entities (including the document entity)
		* > on input, before parsing, by translating the following to a single #xA character:
		* >
		* > 1. the two-character sequence #xD #xA,
		* > 2. the two-character sequence #xD #x85,
		* > 3. the single character #x85,
		* > 4. the single character #x2028,
		* > 5. the single character #x2029,
		* > 6. any #xD character that is not immediately followed by #xA or #x85.
		*
		* @param {string} input
		* @returns {string}
		* @prettierignore
		*/
		function normalizeLineEndings(input) {
			return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028\u2029]/g, "\n");
		}
		/**
		* @typedef Locator
		* @property {number} [columnNumber]
		* @property {number} [lineNumber]
		*/
		/**
		* @typedef DOMParserOptions
		* @property {typeof assign} [assign]
		* The method to use instead of `conventions.assign`, which is used to copy values from
		* `options` before they are used for parsing.
		* @property {typeof DOMHandler} [domHandler]
		* For internal testing: The class for creating an instance for handling events from the SAX
		* parser.
		* *****Warning: By configuring a faulty implementation, the specified behavior can completely
		* be broken.*****.
		* @property {Function} [errorHandler]
		* DEPRECATED! use `onError` instead.
		* @property {function(level:ErrorLevel, message:string, context: DOMHandler):void}
		* [onError]
		* A function invoked for every error that occurs during parsing.
		*
		* If it is not provided, all errors are reported to `console.error`
		* and only `fatalError`s are thrown as a `ParseError`,
		* which prevents any further processing.
		* If the provided method throws, a `ParserError` is thrown,
		* which prevents any further processing.
		*
		* Be aware that many `warning`s are considered an error that prevents further processing in
		* most implementations.
		* @property {boolean} [locator=true]
		* Configures if the nodes created during parsing will have a `lineNumber` and a `columnNumber`
		* attribute describing their location in the XML string.
		* Default is true.
		* @property {(string) => string} [normalizeLineEndings]
		* used to replace line endings before parsing, defaults to exported `normalizeLineEndings`,
		* which normalizes line endings according to <https://www.w3.org/TR/xml11/#sec-line-ends>,
		* including some Unicode "newline" characters.
		* @property {Object} [xmlns]
		* The XML namespaces that should be assumed when parsing.
		* The default namespace can be provided by the key that is the empty string.
		* When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,
		* the default namespace that will be used,
		* will be overridden according to the specification.
		* @see {@link normalizeLineEndings}
		*/
		/**
		* The DOMParser interface provides the ability to parse XML or HTML source code from a string
		* into a DOM `Document`.
		*
		* ***xmldom is different from the spec in that it allows an `options` parameter,
		* to control the behavior***.
		*
		* @class
		* @param {DOMParserOptions} [options]
		* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
		* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
		*/
		function DOMParser$1(options) {
			options = options || {};
			if (options.locator === void 0) options.locator = true;
			/**
			* The method to use instead of `conventions.assign`, which is used to copy values from
			* `options`
			* before they are used for parsing.
			*
			* @type {conventions.assign}
			* @private
			* @see {@link conventions.assign}
			* @readonly
			*/
			this.assign = options.assign || conventions$1.assign;
			/**
			* For internal testing: The class for creating an instance for handling events from the SAX
			* parser.
			* *****Warning: By configuring a faulty implementation, the specified behavior can completely
			* be broken*****.
			*
			* @type {typeof DOMHandler}
			* @private
			* @readonly
			*/
			this.domHandler = options.domHandler || DOMHandler;
			/**
			* A function that is invoked for every error that occurs during parsing.
			*
			* If it is not provided, all errors are reported to `console.error`
			* and only `fatalError`s are thrown as a `ParseError`,
			* which prevents any further processing.
			* If the provided method throws, a `ParserError` is thrown,
			* which prevents any further processing.
			*
			* Be aware that many `warning`s are considered an error that prevents further processing in
			* most implementations.
			*
			* @type {function(level:ErrorLevel, message:string, context: DOMHandler):void}
			* @see {@link onErrorStopParsing}
			* @see {@link onWarningStopParsing}
			*/
			this.onError = options.onError || options.errorHandler;
			if (options.errorHandler && typeof options.errorHandler !== "function") throw new TypeError("errorHandler object is no longer supported, switch to onError!");
			else if (options.errorHandler) options.errorHandler("warning", "The `errorHandler` option has been deprecated, use `onError` instead!", this);
			/**
			* used to replace line endings before parsing, defaults to `normalizeLineEndings`
			*
			* @type {(string) => string}
			* @readonly
			*/
			this.normalizeLineEndings = options.normalizeLineEndings || normalizeLineEndings;
			/**
			* Configures if the nodes created during parsing will have a `lineNumber` and a
			* `columnNumber`
			* attribute describing their location in the XML string.
			* Default is true.
			*
			* @type {boolean}
			* @readonly
			*/
			this.locator = !!options.locator;
			/**
			* The default namespace can be provided by the key that is the empty string.
			* When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,
			* the default namespace that will be used,
			* will be overridden according to the specification.
			*
			* @type {Readonly<Object>}
			* @readonly
			*/
			this.xmlns = this.assign(Object.create(null), options.xmlns);
		}
		/**
		* Parses `source` using the options in the way configured by the `DOMParserOptions` of `this`
		* `DOMParser`. If `mimeType` is `text/html` an HTML `Document` is created,
		* otherwise an XML `Document` is created.
		*
		* __It behaves different from the description in the living standard__:
		* - Uses the `options` passed to the `DOMParser` constructor to modify the behavior.
		* - Any unexpected input is reported to `onError` with either a `warning`,
		* `error` or `fatalError` level.
		* - Any `fatalError` throws a `ParseError` which prevents further processing.
		* - Any error thrown by `onError` is converted to a `ParseError` which prevents further
		* processing - If no `Document` was created during parsing it is reported as a `fatalError`.
		* *****Warning: By configuring a faulty DOMHandler implementation,
		* the specified behavior can completely be broken*****.
		*
		* @param {string} source
		* The XML mime type only allows string input!
		* @param {string} [mimeType='application/xml']
		* the mimeType or contentType of the document to be created determines the `type` of document
		* created (XML or HTML)
		* @returns {Document}
		* The `Document` node.
		* @throws {ParseError}
		* for any `fatalError` or anything that is thrown by `onError`
		* @throws {TypeError}
		* for any invalid `mimeType`
		* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString
		* @see https://html.spec.whatwg.org/#dom-domparser-parsefromstring-dev
		*/
		DOMParser$1.prototype.parseFromString = function(source, mimeType) {
			if (!isValidMimeType(mimeType)) throw new TypeError("DOMParser.parseFromString: the provided mimeType \"" + mimeType + "\" is not valid.");
			var defaultNSMap = this.assign(Object.create(null), this.xmlns);
			var entityMap = entities.XML_ENTITIES;
			var defaultNamespace = defaultNSMap[""] || null;
			if (hasDefaultHTMLNamespace(mimeType)) {
				entityMap = entities.HTML_ENTITIES;
				defaultNamespace = NAMESPACE.HTML;
			} else if (mimeType === MIME_TYPE.XML_SVG_IMAGE) defaultNamespace = NAMESPACE.SVG;
			defaultNSMap[""] = defaultNamespace;
			defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
			var domBuilder = new this.domHandler({
				mimeType,
				defaultNamespace,
				onError: this.onError
			});
			var locator = this.locator ? {} : void 0;
			if (this.locator) domBuilder.setDocumentLocator(locator);
			var sax$1 = new XMLReader();
			sax$1.errorHandler = domBuilder;
			sax$1.domBuilder = domBuilder;
			if (!conventions$1.isHTMLMimeType(mimeType) && typeof source !== "string") sax$1.errorHandler.fatalError("source is not a string");
			sax$1.parse(this.normalizeLineEndings(String(source)), defaultNSMap, entityMap);
			if (!domBuilder.doc.documentElement) sax$1.errorHandler.fatalError("missing root element");
			return domBuilder.doc;
		};
		/**
		* @typedef DOMHandlerOptions
		* @property {string} [mimeType=MIME_TYPE.XML_APPLICATION]
		* @property {string | null} [defaultNamespace=null]
		*/
		/**
		* The class that is used to handle events from the SAX parser to create the related DOM
		* elements.
		*
		* Some methods are only implemented as an empty function,
		* since they are (at least currently) not relevant for xmldom.
		*
		* @class
		* @param {DOMHandlerOptions} [options]
		* @see http://www.saxproject.org/apidoc/org/xml/sax/ext/DefaultHandler2.html
		*/
		function DOMHandler(options) {
			var opt = options || {};
			/**
			* The mime type is used to determine if the DOM handler will create an XML or HTML document.
			* Only if it is set to `text/html` it will create an HTML document.
			* It defaults to MIME_TYPE.XML_APPLICATION.
			*
			* @type {string}
			* @see {@link MIME_TYPE}
			* @readonly
			*/
			this.mimeType = opt.mimeType || MIME_TYPE.XML_APPLICATION;
			/**
			* The namespace to use to create an XML document.
			* For the following reasons this is required:
			* - The SAX API for `startDocument` doesn't offer any way to pass a namespace,
			* since at that point there is no way for the parser to know what the default namespace from
			* the document will be.
			* - When creating using `DOMImplementation.createDocument` it is required to pass a
			* namespace,
			* to determine the correct `Document.contentType`, which should match `this.mimeType`.
			* - When parsing an XML document with the `application/xhtml+xml` mimeType,
			* the HTML namespace needs to be the default namespace.
			*
			* @type {string | null}
			* @private
			* @readonly
			*/
			this.defaultNamespace = opt.defaultNamespace || null;
			/**
			* @type {boolean}
			* @private
			*/
			this.cdata = false;
			/**
			* The last `Element` that was created by `startElement`.
			* `endElement` sets it to the `currentElement.parentNode`.
			*
			* Note: The sax parser currently sets it to white space text nodes between tags.
			*
			* @type {Element | Node | undefined}
			* @private
			*/
			this.currentElement = void 0;
			/**
			* The Document that is created as part of `startDocument`,
			* and returned by `DOMParser.parseFromString`.
			*
			* @type {Document | undefined}
			* @readonly
			*/
			this.doc = void 0;
			/**
			* The locator is stored as part of setDocumentLocator.
			* It is controlled and mutated by the SAX parser to store the current parsing position.
			* It is used by DOMHandler to set `columnNumber` and `lineNumber`
			* on the DOM nodes.
			*
			* @type {Readonly<Locator> | undefined}
			* @private
			* @readonly (the
			* sax parser currently sometimes set's it)
			*/
			this.locator = void 0;
			/**
			* @type {function (level:ErrorLevel ,message:string, context:DOMHandler):void}
			* @readonly
			*/
			this.onError = opt.onError;
		}
		function position(locator, node) {
			node.lineNumber = locator.lineNumber;
			node.columnNumber = locator.columnNumber;
		}
		DOMHandler.prototype = {
			startDocument: function() {
				var impl = new DOMImplementation();
				this.doc = isHTMLMimeType(this.mimeType) ? impl.createHTMLDocument(false) : impl.createDocument(this.defaultNamespace, "");
			},
			startElement: function(namespaceURI, localName, qName, attrs) {
				var doc = this.doc;
				var el = doc.createElementNS(namespaceURI, qName || localName);
				var len = attrs.length;
				appendElement(this, el);
				this.currentElement = el;
				this.locator && position(this.locator, el);
				for (var i$1 = 0; i$1 < len; i$1++) {
					var namespaceURI = attrs.getURI(i$1);
					var value = attrs.getValue(i$1);
					var qName = attrs.getQName(i$1);
					var attr = doc.createAttributeNS(namespaceURI, qName);
					this.locator && position(attrs.getLocator(i$1), attr);
					attr.value = attr.nodeValue = value;
					el.setAttributeNode(attr);
				}
			},
			endElement: function(namespaceURI, localName, qName) {
				this.currentElement = this.currentElement.parentNode;
			},
			startPrefixMapping: function(prefix, uri) {},
			endPrefixMapping: function(prefix) {},
			processingInstruction: function(target, data) {
				var ins = this.doc.createProcessingInstruction(target, data);
				this.locator && position(this.locator, ins);
				appendElement(this, ins);
			},
			ignorableWhitespace: function(ch, start, length) {},
			characters: function(chars$1, start, length) {
				chars$1 = _toString.apply(this, arguments);
				if (chars$1) {
					if (this.cdata) var charNode = this.doc.createCDATASection(chars$1);
					else var charNode = this.doc.createTextNode(chars$1);
					if (this.currentElement) this.currentElement.appendChild(charNode);
					else if (/^\s*$/.test(chars$1)) this.doc.appendChild(charNode);
					this.locator && position(this.locator, charNode);
				}
			},
			skippedEntity: function(name$1) {},
			endDocument: function() {
				this.doc.normalize();
			},
			setDocumentLocator: function(locator) {
				if (locator) locator.lineNumber = 0;
				this.locator = locator;
			},
			comment: function(chars$1, start, length) {
				chars$1 = _toString.apply(this, arguments);
				var comm = this.doc.createComment(chars$1);
				this.locator && position(this.locator, comm);
				appendElement(this, comm);
			},
			startCDATA: function() {
				this.cdata = true;
			},
			endCDATA: function() {
				this.cdata = false;
			},
			startDTD: function(name$1, publicId, systemId, internalSubset) {
				var impl = this.doc.implementation;
				if (impl && impl.createDocumentType) {
					var dt = impl.createDocumentType(name$1, publicId, systemId, internalSubset);
					this.locator && position(this.locator, dt);
					appendElement(this, dt);
					this.doc.doctype = dt;
				}
			},
			reportError: function(level, message) {
				if (typeof this.onError === "function") try {
					this.onError(level, message, this);
				} catch (e) {
					throw new ParseError("Reporting " + level + " \"" + message + "\" caused " + e, this.locator);
				}
				else console.error("[xmldom " + level + "]	" + message, _locator(this.locator));
			},
			warning: function(message) {
				this.reportError("warning", message);
			},
			error: function(message) {
				this.reportError("error", message);
			},
			fatalError: function(message) {
				this.reportError("fatalError", message);
				throw new ParseError(message, this.locator);
			}
		};
		function _locator(l) {
			if (l) return "\n@#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
		}
		function _toString(chars$1, start, length) {
			if (typeof chars$1 == "string") return chars$1.substr(start, length);
			else {
				if (chars$1.length >= start + length || start) return new java.lang.String(chars$1, start, length) + "";
				return chars$1;
			}
		}
		"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key$1) {
			DOMHandler.prototype[key$1] = function() {
				return null;
			};
		});
		function appendElement(handler, node) {
			if (!handler.currentElement) handler.doc.appendChild(node);
			else handler.currentElement.appendChild(node);
		}
		/**
		* A method that prevents any further parsing when an `error`
		* with level `error` is reported during parsing.
		*
		* @see {@link DOMParserOptions.onError}
		* @see {@link onWarningStopParsing}
		*/
		function onErrorStopParsing(level) {
			if (level === "error") throw "onErrorStopParsing";
		}
		/**
		* A method that prevents any further parsing when any `error` is reported during parsing.
		*
		* @see {@link DOMParserOptions.onError}
		* @see {@link onErrorStopParsing}
		*/
		function onWarningStopParsing() {
			throw "onWarningStopParsing";
		}
		exports$1.__DOMHandler = DOMHandler;
		exports$1.DOMParser = DOMParser$1;
		exports$1.normalizeLineEndings = normalizeLineEndings;
		exports$1.onErrorStopParsing = onErrorStopParsing;
		exports$1.onWarningStopParsing = onWarningStopParsing;
	}) });
	var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/@xmldom/xmldom/lib/index.js": ((exports$1) => {
		var conventions = require_conventions();
		exports$1.assign = conventions.assign;
		exports$1.hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;
		exports$1.isHTMLMimeType = conventions.isHTMLMimeType;
		exports$1.isValidMimeType = conventions.isValidMimeType;
		exports$1.MIME_TYPE = conventions.MIME_TYPE;
		exports$1.NAMESPACE = conventions.NAMESPACE;
		var errors = require_errors();
		exports$1.DOMException = errors.DOMException;
		exports$1.DOMExceptionName = errors.DOMExceptionName;
		exports$1.ExceptionCode = errors.ExceptionCode;
		exports$1.ParseError = errors.ParseError;
		var dom = require_dom();
		exports$1.Attr = dom.Attr;
		exports$1.CDATASection = dom.CDATASection;
		exports$1.CharacterData = dom.CharacterData;
		exports$1.Comment = dom.Comment;
		exports$1.Document = dom.Document;
		exports$1.DocumentFragment = dom.DocumentFragment;
		exports$1.DocumentType = dom.DocumentType;
		exports$1.DOMImplementation = dom.DOMImplementation;
		exports$1.Element = dom.Element;
		exports$1.Entity = dom.Entity;
		exports$1.EntityReference = dom.EntityReference;
		exports$1.LiveNodeList = dom.LiveNodeList;
		exports$1.NamedNodeMap = dom.NamedNodeMap;
		exports$1.Node = dom.Node;
		exports$1.NodeList = dom.NodeList;
		exports$1.Notation = dom.Notation;
		exports$1.ProcessingInstruction = dom.ProcessingInstruction;
		exports$1.Text = dom.Text;
		exports$1.XMLSerializer = dom.XMLSerializer;
		var domParser = require_dom_parser();
		exports$1.DOMParser = domParser.DOMParser;
		exports$1.normalizeLineEndings = domParser.normalizeLineEndings;
		exports$1.onErrorStopParsing = domParser.onErrorStopParsing;
		exports$1.onWarningStopParsing = domParser.onWarningStopParsing;
	}) });
	var require_xpath = /* @__PURE__ */ __commonJS({ "../../node_modules/xpath/xpath.js": ((exports$1) => {
		(function(exports$1$1) {
			var NAMESPACE_NODE_NODETYPE = "__namespace";
			var isNil = function(x) {
				return x === null || x === void 0;
			};
			var isValidNodeType = function(nodeType) {
				return nodeType === NAMESPACE_NODE_NODETYPE || Number.isInteger(nodeType) && nodeType >= 1 && nodeType <= 11;
			};
			var isNodeLike = function(value) {
				return value && isValidNodeType(value.nodeType) && typeof value.nodeName === "string";
			};
			function curry(func) {
				var slice = Array.prototype.slice, totalargs = func.length, partial = function(args, fn$2) {
					return function() {
						return fn$2.apply(this, args.concat(slice.call(arguments)));
					};
				}, fn$1 = function() {
					var args = slice.call(arguments);
					return args.length < totalargs ? partial(args, fn$1) : func.apply(this, slice.apply(arguments, [0, totalargs]));
				};
				return fn$1;
			}
			var forEach = function(f, xs) {
				for (var i$1 = 0; i$1 < xs.length; i$1 += 1) f(xs[i$1], i$1, xs);
			};
			var reduce = function(f, seed, xs) {
				var acc = seed;
				forEach(function(x, i$1) {
					acc = f(acc, x, i$1);
				}, xs);
				return acc;
			};
			var map = function(f, xs) {
				var mapped = new Array(xs.length);
				forEach(function(x, i$1) {
					mapped[i$1] = f(x);
				}, xs);
				return mapped;
			};
			var filter = function(f, xs) {
				var filtered = [];
				forEach(function(x, i$1) {
					if (f(x, i$1)) filtered.push(x);
				}, xs);
				return filtered;
			};
			var includes = function(values, value) {
				for (var i$1 = 0; i$1 < values.length; i$1 += 1) if (values[i$1] === value) return true;
				return false;
			};
			function always(value) {
				return function() {
					return value;
				};
			}
			function toString(x) {
				return x.toString();
			}
			var join = function(s, xs) {
				return xs.join(s);
			};
			var wrap = function(pref, suf, str) {
				return pref + str + suf;
			};
			var prototypeConcat = Array.prototype.concat;
			var sortNodes = function(nodes, reverse) {
				var ns = new XNodeSet();
				ns.addArray(nodes);
				var sorted = ns.toArray();
				return reverse ? sorted.reverse() : sorted;
			};
			var MAX_ARGUMENT_LENGTH = 32767;
			function flatten(arr) {
				var result = [];
				for (var start = 0; start < arr.length; start += MAX_ARGUMENT_LENGTH) {
					var chunk = arr.slice(start, start + MAX_ARGUMENT_LENGTH);
					result = prototypeConcat.apply(result, chunk);
				}
				return result;
			}
			function assign$1(target, varArgs) {
				var to = Object(target);
				for (var index$1 = 1; index$1 < arguments.length; index$1++) {
					var nextSource = arguments[index$1];
					if (nextSource != null) {
						for (var nextKey in nextSource) if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) to[nextKey] = nextSource[nextKey];
					}
				}
				return to;
			}
			var NodeTypes = {
				ELEMENT_NODE: 1,
				ATTRIBUTE_NODE: 2,
				TEXT_NODE: 3,
				CDATA_SECTION_NODE: 4,
				PROCESSING_INSTRUCTION_NODE: 7,
				COMMENT_NODE: 8,
				DOCUMENT_NODE: 9,
				DOCUMENT_TYPE_NODE: 10,
				DOCUMENT_FRAGMENT_NODE: 11,
				NAMESPACE_NODE: NAMESPACE_NODE_NODETYPE
			};
			XPathParser.prototype = /* @__PURE__ */ new Object();
			XPathParser.prototype.constructor = XPathParser;
			XPathParser.superclass = Object.prototype;
			function XPathParser() {
				this.init();
			}
			XPathParser.prototype.init = function() {
				this.reduceActions = [];
				this.reduceActions[3] = function(rhs) {
					return new OrOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[5] = function(rhs) {
					return new AndOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[7] = function(rhs) {
					return new EqualsOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[8] = function(rhs) {
					return new NotEqualOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[10] = function(rhs) {
					return new LessThanOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[11] = function(rhs) {
					return new GreaterThanOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[12] = function(rhs) {
					return new LessThanOrEqualOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[13] = function(rhs) {
					return new GreaterThanOrEqualOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[15] = function(rhs) {
					return new PlusOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[16] = function(rhs) {
					return new MinusOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[18] = function(rhs) {
					return new MultiplyOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[19] = function(rhs) {
					return new DivOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[20] = function(rhs) {
					return new ModOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[22] = function(rhs) {
					return new UnaryMinusOperation(rhs[1]);
				};
				this.reduceActions[24] = function(rhs) {
					return new BarOperation(rhs[0], rhs[2]);
				};
				this.reduceActions[25] = function(rhs) {
					return new PathExpr(void 0, void 0, rhs[0]);
				};
				this.reduceActions[27] = function(rhs) {
					rhs[0].locationPath = rhs[2];
					return rhs[0];
				};
				this.reduceActions[28] = function(rhs) {
					rhs[0].locationPath = rhs[2];
					rhs[0].locationPath.steps.unshift(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
					return rhs[0];
				};
				this.reduceActions[29] = function(rhs) {
					return new PathExpr(rhs[0], [], void 0);
				};
				this.reduceActions[30] = function(rhs) {
					if (Utilities.instance_of(rhs[0], PathExpr)) {
						if (rhs[0].filterPredicates == void 0) rhs[0].filterPredicates = [];
						rhs[0].filterPredicates.push(rhs[1]);
						return rhs[0];
					} else return new PathExpr(rhs[0], [rhs[1]], void 0);
				};
				this.reduceActions[32] = function(rhs) {
					return rhs[1];
				};
				this.reduceActions[33] = function(rhs) {
					return new XString(rhs[0]);
				};
				this.reduceActions[34] = function(rhs) {
					return new XNumber(rhs[0]);
				};
				this.reduceActions[36] = function(rhs) {
					return new FunctionCall(rhs[0], []);
				};
				this.reduceActions[37] = function(rhs) {
					return new FunctionCall(rhs[0], rhs[2]);
				};
				this.reduceActions[38] = function(rhs) {
					return [rhs[0]];
				};
				this.reduceActions[39] = function(rhs) {
					rhs[2].unshift(rhs[0]);
					return rhs[2];
				};
				this.reduceActions[43] = function(rhs) {
					return new LocationPath(true, []);
				};
				this.reduceActions[44] = function(rhs) {
					rhs[1].absolute = true;
					return rhs[1];
				};
				this.reduceActions[46] = function(rhs) {
					return new LocationPath(false, [rhs[0]]);
				};
				this.reduceActions[47] = function(rhs) {
					rhs[0].steps.push(rhs[2]);
					return rhs[0];
				};
				this.reduceActions[49] = function(rhs) {
					return new Step(rhs[0], rhs[1], []);
				};
				this.reduceActions[50] = function(rhs) {
					return new Step(Step.CHILD, rhs[0], []);
				};
				this.reduceActions[51] = function(rhs) {
					return new Step(rhs[0], rhs[1], rhs[2]);
				};
				this.reduceActions[52] = function(rhs) {
					return new Step(Step.CHILD, rhs[0], rhs[1]);
				};
				this.reduceActions[54] = function(rhs) {
					return [rhs[0]];
				};
				this.reduceActions[55] = function(rhs) {
					rhs[1].unshift(rhs[0]);
					return rhs[1];
				};
				this.reduceActions[56] = function(rhs) {
					if (rhs[0] == "ancestor") return Step.ANCESTOR;
					else if (rhs[0] == "ancestor-or-self") return Step.ANCESTORORSELF;
					else if (rhs[0] == "attribute") return Step.ATTRIBUTE;
					else if (rhs[0] == "child") return Step.CHILD;
					else if (rhs[0] == "descendant") return Step.DESCENDANT;
					else if (rhs[0] == "descendant-or-self") return Step.DESCENDANTORSELF;
					else if (rhs[0] == "following") return Step.FOLLOWING;
					else if (rhs[0] == "following-sibling") return Step.FOLLOWINGSIBLING;
					else if (rhs[0] == "namespace") return Step.NAMESPACE;
					else if (rhs[0] == "parent") return Step.PARENT;
					else if (rhs[0] == "preceding") return Step.PRECEDING;
					else if (rhs[0] == "preceding-sibling") return Step.PRECEDINGSIBLING;
					else if (rhs[0] == "self") return Step.SELF;
					return -1;
				};
				this.reduceActions[57] = function(rhs) {
					return Step.ATTRIBUTE;
				};
				this.reduceActions[59] = function(rhs) {
					if (rhs[0] == "comment") return NodeTest.commentTest;
					else if (rhs[0] == "text") return NodeTest.textTest;
					else if (rhs[0] == "processing-instruction") return NodeTest.anyPiTest;
					else if (rhs[0] == "node") return NodeTest.nodeTest;
					return new NodeTest(-1, void 0);
				};
				this.reduceActions[60] = function(rhs) {
					return new NodeTest.PITest(rhs[2]);
				};
				this.reduceActions[61] = function(rhs) {
					return rhs[1];
				};
				this.reduceActions[63] = function(rhs) {
					rhs[1].absolute = true;
					rhs[1].steps.unshift(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
					return rhs[1];
				};
				this.reduceActions[64] = function(rhs) {
					rhs[0].steps.push(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
					rhs[0].steps.push(rhs[2]);
					return rhs[0];
				};
				this.reduceActions[65] = function(rhs) {
					return new Step(Step.SELF, NodeTest.nodeTest, []);
				};
				this.reduceActions[66] = function(rhs) {
					return new Step(Step.PARENT, NodeTest.nodeTest, []);
				};
				this.reduceActions[67] = function(rhs) {
					return new VariableReference(rhs[1]);
				};
				this.reduceActions[68] = function(rhs) {
					return NodeTest.nameTestAny;
				};
				this.reduceActions[69] = function(rhs) {
					return new NodeTest.NameTestPrefixAny(rhs[0].split(":")[0]);
				};
				this.reduceActions[70] = function(rhs) {
					return new NodeTest.NameTestQName(rhs[0]);
				};
			};
			XPathParser.actionTable = [
				" s s        sssssssss    s ss  s  ss",
				"                 s                  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"                rrrrr               ",
				" s s        sssssssss    s ss  s  ss",
				"rs  rrrrrrrr s  sssssrrrrrr  rrs rs ",
				" s s        sssssssss    s ss  s  ss",
				"                            s       ",
				"                            s       ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"  s                                 ",
				"                            s       ",
				" s           s  sssss          s  s ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"a                                   ",
				"r       s                    rr  r  ",
				"r      sr                    rr  r  ",
				"r   s  rr            s       rr  r  ",
				"r   rssrr            rss     rr  r  ",
				"r   rrrrr            rrrss   rr  r  ",
				"r   rrrrrsss         rrrrr   rr  r  ",
				"r   rrrrrrrr         rrrrr   rr  r  ",
				"r   rrrrrrrr         rrrrrs  rr  r  ",
				"r   rrrrrrrr         rrrrrr  rr  r  ",
				"r   rrrrrrrr         rrrrrr  rr  r  ",
				"r  srrrrrrrr         rrrrrrs rr sr  ",
				"r  srrrrrrrr         rrrrrrs rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r   rrrrrrrr         rrrrrr  rr  r  ",
				"r   rrrrrrrr         rrrrrr  rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"                sssss               ",
				"r  rrrrrrrrr         rrrrrrr rr sr  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"                             s      ",
				"r  srrrrrrrr         rrrrrrs rr  r  ",
				"r   rrrrrrrr         rrrrr   rr  r  ",
				"              s                     ",
				"                             s      ",
				"                rrrrr               ",
				" s s        sssssssss    s sss s  ss",
				"r  srrrrrrrr         rrrrrrs rr  r  ",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s s        sssssssss      ss  s  ss",
				" s s        sssssssss    s ss  s  ss",
				" s           s  sssss          s  s ",
				" s           s  sssss          s  s ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				" s           s  sssss          s  s ",
				" s           s  sssss          s  s ",
				"r  rrrrrrrrr         rrrrrrr rr sr  ",
				"r  rrrrrrrrr         rrrrrrr rr sr  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"                             s      ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"                             rr     ",
				"                             s      ",
				"                             rs     ",
				"r      sr                    rr  r  ",
				"r   s  rr            s       rr  r  ",
				"r   rssrr            rss     rr  r  ",
				"r   rssrr            rss     rr  r  ",
				"r   rrrrr            rrrss   rr  r  ",
				"r   rrrrr            rrrss   rr  r  ",
				"r   rrrrr            rrrss   rr  r  ",
				"r   rrrrr            rrrss   rr  r  ",
				"r   rrrrrsss         rrrrr   rr  r  ",
				"r   rrrrrsss         rrrrr   rr  r  ",
				"r   rrrrrrrr         rrrrr   rr  r  ",
				"r   rrrrrrrr         rrrrr   rr  r  ",
				"r   rrrrrrrr         rrrrr   rr  r  ",
				"r   rrrrrrrr         rrrrrr  rr  r  ",
				"                                 r  ",
				"                                 s  ",
				"r  srrrrrrrr         rrrrrrs rr  r  ",
				"r  srrrrrrrr         rrrrrrs rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr  r  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				" s s        sssssssss    s ss  s  ss",
				"r  rrrrrrrrr         rrrrrrr rr rr  ",
				"                             r      "
			];
			XPathParser.actionTableNumber = [
				" 1 0        /.-,+*)('    & %$  #  \"!",
				"                 J                  ",
				"a  aaaaaaaaa         aaaaaaa aa  a  ",
				"                YYYYY               ",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				"K1  KKKKKKKK .  +*)('KKKKKK  KK# K\" ",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				"                            N       ",
				"                            O       ",
				"e  eeeeeeeee         eeeeeee ee ee  ",
				"f  fffffffff         fffffff ff ff  ",
				"d  ddddddddd         ddddddd dd dd  ",
				"B  BBBBBBBBB         BBBBBBB BB BB  ",
				"A  AAAAAAAAA         AAAAAAA AA AA  ",
				"  P                                 ",
				"                            Q       ",
				" 1           .  +*)('          #  \" ",
				"b  bbbbbbbbb         bbbbbbb bb  b  ",
				"                                    ",
				"!       S                    !!  !  ",
				"\"      T\"                    \"\"  \"  ",
				"$   V  $$            U       $$  $  ",
				"&   &ZY&&            &XW     &&  &  ",
				")   )))))            )))\\[   ))  )  ",
				".   ....._^]         .....   ..  .  ",
				"1   11111111         11111   11  1  ",
				"5   55555555         55555`  55  5  ",
				"7   77777777         777777  77  7  ",
				"9   99999999         999999  99  9  ",
				":  c::::::::         ::::::b :: a:  ",
				"I  fIIIIIIII         IIIIIIe II  I  ",
				"=  =========         ======= == ==  ",
				"?  ?????????         ??????? ?? ??  ",
				"C  CCCCCCCCC         CCCCCCC CC CC  ",
				"J   JJJJJJJJ         JJJJJJ  JJ  J  ",
				"M   MMMMMMMM         MMMMMM  MM  M  ",
				"N  NNNNNNNNN         NNNNNNN NN  N  ",
				"P  PPPPPPPPP         PPPPPPP PP  P  ",
				"                +*)('               ",
				"R  RRRRRRRRR         RRRRRRR RR aR  ",
				"U  UUUUUUUUU         UUUUUUU UU  U  ",
				"Z  ZZZZZZZZZ         ZZZZZZZ ZZ ZZ  ",
				"c  ccccccccc         ccccccc cc cc  ",
				"                             j      ",
				"L  fLLLLLLLL         LLLLLLe LL  L  ",
				"6   66666666         66666   66  6  ",
				"              k                     ",
				"                             l      ",
				"                XXXXX               ",
				" 1 0        /.-,+*)('    & %$m #  \"!",
				"_  f________         ______e __  _  ",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1 0        /.-,+*)('      %$  #  \"!",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				" 1           .  +*)('          #  \" ",
				" 1           .  +*)('          #  \" ",
				">  >>>>>>>>>         >>>>>>> >> >>  ",
				" 1           .  +*)('          #  \" ",
				" 1           .  +*)('          #  \" ",
				"Q  QQQQQQQQQ         QQQQQQQ QQ aQ  ",
				"V  VVVVVVVVV         VVVVVVV VV aV  ",
				"T  TTTTTTTTT         TTTTTTT TT  T  ",
				"@  @@@@@@@@@         @@@@@@@ @@ @@  ",
				"                                   ",
				"[  [[[[[[[[[         [[[[[[[ [[ [[  ",
				"D  DDDDDDDDD         DDDDDDD DD DD  ",
				"                             HH     ",
				"                                   ",
				"                             F     ",
				"#      T#                    ##  #  ",
				"%   V  %%            U       %%  %  ",
				"'   'ZY''            'XW     ''  '  ",
				"(   (ZY((            (XW     ((  (  ",
				"+   +++++            +++\\[   ++  +  ",
				"*   *****            ***\\[   **  *  ",
				"-   -----            ---\\[   --  -  ",
				",   ,,,,,            ,,,\\[   ,,  ,  ",
				"0   00000_^]         00000   00  0  ",
				"/   /////_^]         /////   //  /  ",
				"2   22222222         22222   22  2  ",
				"3   33333333         33333   33  3  ",
				"4   44444444         44444   44  4  ",
				"8   88888888         888888  88  8  ",
				"                                 ^  ",
				"                                   ",
				";  f;;;;;;;;         ;;;;;;e ;;  ;  ",
				"<  f<<<<<<<<         <<<<<<e <<  <  ",
				"O  OOOOOOOOO         OOOOOOO OO  O  ",
				"`  `````````         ``````` ``  `  ",
				"S  SSSSSSSSS         SSSSSSS SS  S  ",
				"W  WWWWWWWWW         WWWWWWW WW  W  ",
				"\\  \\\\\\\\\\\\\\\\\\         \\\\\\\\\\\\\\ \\\\ \\\\  ",
				"E  EEEEEEEEE         EEEEEEE EE EE  ",
				" 1 0        /.-,+*)('    & %$  #  \"!",
				"]  ]]]]]]]]]         ]]]]]]] ]] ]]  ",
				"                             G      "
			];
			XPathParser.gotoTable = [
				"3456789:;<=>?@ AB  CDEFGH IJ ",
				"                             ",
				"                             ",
				"                             ",
				"L456789:;<=>?@ AB  CDEFGH IJ ",
				"            M        EFGH IJ ",
				"       N;<=>?@ AB  CDEFGH IJ ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"            S        EFGH IJ ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"              e              ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                        h  J ",
				"              i          j   ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"o456789:;<=>?@ ABpqCDEFGH IJ ",
				"                             ",
				"  r6789:;<=>?@ AB  CDEFGH IJ ",
				"   s789:;<=>?@ AB  CDEFGH IJ ",
				"    t89:;<=>?@ AB  CDEFGH IJ ",
				"    u89:;<=>?@ AB  CDEFGH IJ ",
				"     v9:;<=>?@ AB  CDEFGH IJ ",
				"     w9:;<=>?@ AB  CDEFGH IJ ",
				"     x9:;<=>?@ AB  CDEFGH IJ ",
				"     y9:;<=>?@ AB  CDEFGH IJ ",
				"      z:;<=>?@ AB  CDEFGH IJ ",
				"      {:;<=>?@ AB  CDEFGH IJ ",
				"       |;<=>?@ AB  CDEFGH IJ ",
				"       };<=>?@ AB  CDEFGH IJ ",
				"       ~;<=>?@ AB  CDEFGH IJ ",
				"         =>?@ AB  CDEFGH IJ ",
				"456789:;<=>?@ AB  CDEFGH IJ",
				"                    EFGH IJ ",
				"                    EFGH IJ ",
				"                             ",
				"                      GH IJ ",
				"                      GH IJ ",
				"              i             ",
				"              i             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"                             ",
				"o456789:;<=>?@ ABqCDEFGH IJ ",
				"                             ",
				"                             "
			];
			XPathParser.productions = [
				[
					1,
					1,
					2
				],
				[
					2,
					1,
					3
				],
				[
					3,
					1,
					4
				],
				[
					3,
					3,
					3,
					-9,
					4
				],
				[
					4,
					1,
					5
				],
				[
					4,
					3,
					4,
					-8,
					5
				],
				[
					5,
					1,
					6
				],
				[
					5,
					3,
					5,
					-22,
					6
				],
				[
					5,
					3,
					5,
					-5,
					6
				],
				[
					6,
					1,
					7
				],
				[
					6,
					3,
					6,
					-23,
					7
				],
				[
					6,
					3,
					6,
					-24,
					7
				],
				[
					6,
					3,
					6,
					-6,
					7
				],
				[
					6,
					3,
					6,
					-7,
					7
				],
				[
					7,
					1,
					8
				],
				[
					7,
					3,
					7,
					-25,
					8
				],
				[
					7,
					3,
					7,
					-26,
					8
				],
				[
					8,
					1,
					9
				],
				[
					8,
					3,
					8,
					-12,
					9
				],
				[
					8,
					3,
					8,
					-11,
					9
				],
				[
					8,
					3,
					8,
					-10,
					9
				],
				[
					9,
					1,
					10
				],
				[
					9,
					2,
					-26,
					9
				],
				[
					10,
					1,
					11
				],
				[
					10,
					3,
					10,
					-27,
					11
				],
				[
					11,
					1,
					12
				],
				[
					11,
					1,
					13
				],
				[
					11,
					3,
					13,
					-28,
					14
				],
				[
					11,
					3,
					13,
					-4,
					14
				],
				[
					13,
					1,
					15
				],
				[
					13,
					2,
					13,
					16
				],
				[
					15,
					1,
					17
				],
				[
					15,
					3,
					-29,
					2,
					-30
				],
				[
					15,
					1,
					-15
				],
				[
					15,
					1,
					-16
				],
				[
					15,
					1,
					18
				],
				[
					18,
					3,
					-13,
					-29,
					-30
				],
				[
					18,
					4,
					-13,
					-29,
					19,
					-30
				],
				[
					19,
					1,
					20
				],
				[
					19,
					3,
					20,
					-31,
					19
				],
				[
					20,
					1,
					2
				],
				[
					12,
					1,
					14
				],
				[
					12,
					1,
					21
				],
				[
					21,
					1,
					-28
				],
				[
					21,
					2,
					-28,
					14
				],
				[
					21,
					1,
					22
				],
				[
					14,
					1,
					23
				],
				[
					14,
					3,
					14,
					-28,
					23
				],
				[
					14,
					1,
					24
				],
				[
					23,
					2,
					25,
					26
				],
				[
					23,
					1,
					26
				],
				[
					23,
					3,
					25,
					26,
					27
				],
				[
					23,
					2,
					26,
					27
				],
				[
					23,
					1,
					28
				],
				[
					27,
					1,
					16
				],
				[
					27,
					2,
					16,
					27
				],
				[
					25,
					2,
					-14,
					-3
				],
				[
					25,
					1,
					-32
				],
				[
					26,
					1,
					29
				],
				[
					26,
					3,
					-20,
					-29,
					-30
				],
				[
					26,
					4,
					-21,
					-29,
					-15,
					-30
				],
				[
					16,
					3,
					-33,
					30,
					-34
				],
				[
					30,
					1,
					2
				],
				[
					22,
					2,
					-4,
					14
				],
				[
					24,
					3,
					14,
					-4,
					23
				],
				[
					28,
					1,
					-35
				],
				[
					28,
					1,
					-2
				],
				[
					17,
					2,
					-36,
					-18
				],
				[
					29,
					1,
					-17
				],
				[
					29,
					1,
					-19
				],
				[
					29,
					1,
					-18
				]
			];
			XPathParser.DOUBLEDOT = 2;
			XPathParser.DOUBLECOLON = 3;
			XPathParser.DOUBLESLASH = 4;
			XPathParser.NOTEQUAL = 5;
			XPathParser.LESSTHANOREQUAL = 6;
			XPathParser.GREATERTHANOREQUAL = 7;
			XPathParser.AND = 8;
			XPathParser.OR = 9;
			XPathParser.MOD = 10;
			XPathParser.DIV = 11;
			XPathParser.MULTIPLYOPERATOR = 12;
			XPathParser.FUNCTIONNAME = 13;
			XPathParser.AXISNAME = 14;
			XPathParser.LITERAL = 15;
			XPathParser.NUMBER = 16;
			XPathParser.ASTERISKNAMETEST = 17;
			XPathParser.QNAME = 18;
			XPathParser.NCNAMECOLONASTERISK = 19;
			XPathParser.NODETYPE = 20;
			XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL = 21;
			XPathParser.EQUALS = 22;
			XPathParser.LESSTHAN = 23;
			XPathParser.GREATERTHAN = 24;
			XPathParser.PLUS = 25;
			XPathParser.MINUS = 26;
			XPathParser.BAR = 27;
			XPathParser.SLASH = 28;
			XPathParser.LEFTPARENTHESIS = 29;
			XPathParser.RIGHTPARENTHESIS = 30;
			XPathParser.COMMA = 31;
			XPathParser.AT = 32;
			XPathParser.LEFTBRACKET = 33;
			XPathParser.RIGHTBRACKET = 34;
			XPathParser.DOT = 35;
			XPathParser.DOLLAR = 36;
			XPathParser.prototype.tokenize = function(s1) {
				var types = [];
				var values = [];
				var s = s1 + "\0";
				var pos = 0;
				var c = s.charAt(pos++);
				while (1) {
					while (c == " " || c == "	" || c == "\r" || c == "\n") c = s.charAt(pos++);
					if (c == "\0" || pos >= s.length) break;
					if (c == "(") {
						types.push(XPathParser.LEFTPARENTHESIS);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == ")") {
						types.push(XPathParser.RIGHTPARENTHESIS);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "[") {
						types.push(XPathParser.LEFTBRACKET);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "]") {
						types.push(XPathParser.RIGHTBRACKET);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "@") {
						types.push(XPathParser.AT);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == ",") {
						types.push(XPathParser.COMMA);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "|") {
						types.push(XPathParser.BAR);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "+") {
						types.push(XPathParser.PLUS);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "-") {
						types.push(XPathParser.MINUS);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "=") {
						types.push(XPathParser.EQUALS);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == "$") {
						types.push(XPathParser.DOLLAR);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == ".") {
						c = s.charAt(pos++);
						if (c == ".") {
							types.push(XPathParser.DOUBLEDOT);
							values.push("..");
							c = s.charAt(pos++);
							continue;
						}
						if (c >= "0" && c <= "9") {
							var number = "." + c;
							c = s.charAt(pos++);
							while (c >= "0" && c <= "9") {
								number += c;
								c = s.charAt(pos++);
							}
							types.push(XPathParser.NUMBER);
							values.push(number);
							continue;
						}
						types.push(XPathParser.DOT);
						values.push(".");
						continue;
					}
					if (c == "'" || c == "\"") {
						var delimiter = c;
						var literal = "";
						while (pos < s.length && (c = s.charAt(pos)) !== delimiter) {
							literal += c;
							pos += 1;
						}
						if (c !== delimiter) throw XPathException.fromMessage("Unterminated string literal: " + delimiter + literal);
						pos += 1;
						types.push(XPathParser.LITERAL);
						values.push(literal);
						c = s.charAt(pos++);
						continue;
					}
					if (c >= "0" && c <= "9") {
						var number = c;
						c = s.charAt(pos++);
						while (c >= "0" && c <= "9") {
							number += c;
							c = s.charAt(pos++);
						}
						if (c == ".") {
							if (s.charAt(pos) >= "0" && s.charAt(pos) <= "9") {
								number += c;
								number += s.charAt(pos++);
								c = s.charAt(pos++);
								while (c >= "0" && c <= "9") {
									number += c;
									c = s.charAt(pos++);
								}
							}
						}
						types.push(XPathParser.NUMBER);
						values.push(number);
						continue;
					}
					if (c == "*") {
						if (types.length > 0) {
							var last = types[types.length - 1];
							if (last != XPathParser.AT && last != XPathParser.DOUBLECOLON && last != XPathParser.LEFTPARENTHESIS && last != XPathParser.LEFTBRACKET && last != XPathParser.AND && last != XPathParser.OR && last != XPathParser.MOD && last != XPathParser.DIV && last != XPathParser.MULTIPLYOPERATOR && last != XPathParser.SLASH && last != XPathParser.DOUBLESLASH && last != XPathParser.BAR && last != XPathParser.PLUS && last != XPathParser.MINUS && last != XPathParser.EQUALS && last != XPathParser.NOTEQUAL && last != XPathParser.LESSTHAN && last != XPathParser.LESSTHANOREQUAL && last != XPathParser.GREATERTHAN && last != XPathParser.GREATERTHANOREQUAL) {
								types.push(XPathParser.MULTIPLYOPERATOR);
								values.push(c);
								c = s.charAt(pos++);
								continue;
							}
						}
						types.push(XPathParser.ASTERISKNAMETEST);
						values.push(c);
						c = s.charAt(pos++);
						continue;
					}
					if (c == ":") {
						if (s.charAt(pos) == ":") {
							types.push(XPathParser.DOUBLECOLON);
							values.push("::");
							pos++;
							c = s.charAt(pos++);
							continue;
						}
					}
					if (c == "/") {
						c = s.charAt(pos++);
						if (c == "/") {
							types.push(XPathParser.DOUBLESLASH);
							values.push("//");
							c = s.charAt(pos++);
							continue;
						}
						types.push(XPathParser.SLASH);
						values.push("/");
						continue;
					}
					if (c == "!") {
						if (s.charAt(pos) == "=") {
							types.push(XPathParser.NOTEQUAL);
							values.push("!=");
							pos++;
							c = s.charAt(pos++);
							continue;
						}
					}
					if (c == "<") {
						if (s.charAt(pos) == "=") {
							types.push(XPathParser.LESSTHANOREQUAL);
							values.push("<=");
							pos++;
							c = s.charAt(pos++);
							continue;
						}
						types.push(XPathParser.LESSTHAN);
						values.push("<");
						c = s.charAt(pos++);
						continue;
					}
					if (c == ">") {
						if (s.charAt(pos) == "=") {
							types.push(XPathParser.GREATERTHANOREQUAL);
							values.push(">=");
							pos++;
							c = s.charAt(pos++);
							continue;
						}
						types.push(XPathParser.GREATERTHAN);
						values.push(">");
						c = s.charAt(pos++);
						continue;
					}
					if (c == "_" || Utilities.isLetter(c.charCodeAt(0))) {
						var name$1 = c;
						c = s.charAt(pos++);
						while (Utilities.isNCNameChar(c.charCodeAt(0))) {
							name$1 += c;
							c = s.charAt(pos++);
						}
						if (types.length > 0) {
							var last = types[types.length - 1];
							if (last != XPathParser.AT && last != XPathParser.DOUBLECOLON && last != XPathParser.LEFTPARENTHESIS && last != XPathParser.LEFTBRACKET && last != XPathParser.AND && last != XPathParser.OR && last != XPathParser.MOD && last != XPathParser.DIV && last != XPathParser.MULTIPLYOPERATOR && last != XPathParser.SLASH && last != XPathParser.DOUBLESLASH && last != XPathParser.BAR && last != XPathParser.PLUS && last != XPathParser.MINUS && last != XPathParser.EQUALS && last != XPathParser.NOTEQUAL && last != XPathParser.LESSTHAN && last != XPathParser.LESSTHANOREQUAL && last != XPathParser.GREATERTHAN && last != XPathParser.GREATERTHANOREQUAL) {
								if (name$1 == "and") {
									types.push(XPathParser.AND);
									values.push(name$1);
									continue;
								}
								if (name$1 == "or") {
									types.push(XPathParser.OR);
									values.push(name$1);
									continue;
								}
								if (name$1 == "mod") {
									types.push(XPathParser.MOD);
									values.push(name$1);
									continue;
								}
								if (name$1 == "div") {
									types.push(XPathParser.DIV);
									values.push(name$1);
									continue;
								}
							}
						}
						if (c == ":") {
							if (s.charAt(pos) == "*") {
								types.push(XPathParser.NCNAMECOLONASTERISK);
								values.push(name$1 + ":*");
								pos++;
								c = s.charAt(pos++);
								continue;
							}
							if (s.charAt(pos) == "_" || Utilities.isLetter(s.charCodeAt(pos))) {
								name$1 += ":";
								c = s.charAt(pos++);
								while (Utilities.isNCNameChar(c.charCodeAt(0))) {
									name$1 += c;
									c = s.charAt(pos++);
								}
								if (c == "(") {
									types.push(XPathParser.FUNCTIONNAME);
									values.push(name$1);
									continue;
								}
								types.push(XPathParser.QNAME);
								values.push(name$1);
								continue;
							}
							if (s.charAt(pos) == ":") {
								types.push(XPathParser.AXISNAME);
								values.push(name$1);
								continue;
							}
						}
						if (c == "(") {
							if (name$1 == "comment" || name$1 == "text" || name$1 == "node") {
								types.push(XPathParser.NODETYPE);
								values.push(name$1);
								continue;
							}
							if (name$1 == "processing-instruction") {
								if (s.charAt(pos) == ")") types.push(XPathParser.NODETYPE);
								else types.push(XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL);
								values.push(name$1);
								continue;
							}
							types.push(XPathParser.FUNCTIONNAME);
							values.push(name$1);
							continue;
						}
						types.push(XPathParser.QNAME);
						values.push(name$1);
						continue;
					}
					throw new Error("Unexpected character " + c);
				}
				types.push(1);
				values.push("[EOF]");
				return [types, values];
			};
			XPathParser.SHIFT = "s";
			XPathParser.REDUCE = "r";
			XPathParser.ACCEPT = "a";
			XPathParser.prototype.parse = function(s) {
				if (!s) throw new Error("XPath expression unspecified.");
				if (typeof s !== "string") throw new Error("XPath expression must be a string.");
				var types;
				var values;
				var res = this.tokenize(s);
				if (res == void 0) return;
				types = res[0];
				values = res[1];
				var tokenPos = 0;
				var state = [];
				var tokenType = [];
				var tokenValue = [];
				var s;
				var a;
				var t;
				state.push(0);
				tokenType.push(1);
				tokenValue.push("_S");
				a = types[tokenPos];
				t = values[tokenPos++];
				while (1) {
					s = state[state.length - 1];
					switch (XPathParser.actionTable[s].charAt(a - 1)) {
						case XPathParser.SHIFT:
							tokenType.push(-a);
							tokenValue.push(t);
							state.push(XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32);
							a = types[tokenPos];
							t = values[tokenPos++];
							break;
						case XPathParser.REDUCE:
							var num = XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][1];
							var rhs = [];
							for (var i$1 = 0; i$1 < num; i$1++) {
								tokenType.pop();
								rhs.unshift(tokenValue.pop());
								state.pop();
							}
							var s_ = state[state.length - 1];
							tokenType.push(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0]);
							if (this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32] == void 0) tokenValue.push(rhs[0]);
							else tokenValue.push(this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32](rhs));
							state.push(XPathParser.gotoTable[s_].charCodeAt(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0] - 2) - 33);
							break;
						case XPathParser.ACCEPT: return new XPath(tokenValue.pop());
						default: throw new Error("XPath parse error");
					}
				}
			};
			XPath.prototype = /* @__PURE__ */ new Object();
			XPath.prototype.constructor = XPath;
			XPath.superclass = Object.prototype;
			function XPath(e) {
				this.expression = e;
			}
			XPath.prototype.toString = function() {
				return this.expression.toString();
			};
			function setIfUnset(obj, prop, value) {
				if (!(prop in obj)) obj[prop] = value;
			}
			XPath.prototype.evaluate = function(c) {
				var node = c.expressionContextNode;
				if (!(isNil(node) || isNodeLike(node))) throw new Error("Context node does not appear to be a valid DOM node.");
				c.contextNode = c.expressionContextNode;
				c.contextSize = 1;
				c.contextPosition = 1;
				if (c.isHtml) {
					setIfUnset(c, "caseInsensitive", true);
					setIfUnset(c, "allowAnyNamespaceForNoPrefix", true);
				}
				setIfUnset(c, "caseInsensitive", false);
				return this.expression.evaluate(c);
			};
			XPath.XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
			XPath.XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/";
			Expression.prototype = /* @__PURE__ */ new Object();
			Expression.prototype.constructor = Expression;
			Expression.superclass = Object.prototype;
			function Expression() {}
			Expression.prototype.init = function() {};
			Expression.prototype.toString = function() {
				return "<Expression>";
			};
			Expression.prototype.evaluate = function(c) {
				throw new Error("Could not evaluate expression.");
			};
			UnaryOperation.prototype = new Expression();
			UnaryOperation.prototype.constructor = UnaryOperation;
			UnaryOperation.superclass = Expression.prototype;
			function UnaryOperation(rhs) {
				if (arguments.length > 0) this.init(rhs);
			}
			UnaryOperation.prototype.init = function(rhs) {
				this.rhs = rhs;
			};
			UnaryMinusOperation.prototype = new UnaryOperation();
			UnaryMinusOperation.prototype.constructor = UnaryMinusOperation;
			UnaryMinusOperation.superclass = UnaryOperation.prototype;
			function UnaryMinusOperation(rhs) {
				if (arguments.length > 0) this.init(rhs);
			}
			UnaryMinusOperation.prototype.init = function(rhs) {
				UnaryMinusOperation.superclass.init.call(this, rhs);
			};
			UnaryMinusOperation.prototype.evaluate = function(c) {
				return this.rhs.evaluate(c).number().negate();
			};
			UnaryMinusOperation.prototype.toString = function() {
				return "-" + this.rhs.toString();
			};
			BinaryOperation.prototype = new Expression();
			BinaryOperation.prototype.constructor = BinaryOperation;
			BinaryOperation.superclass = Expression.prototype;
			function BinaryOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			BinaryOperation.prototype.init = function(lhs, rhs) {
				this.lhs = lhs;
				this.rhs = rhs;
			};
			OrOperation.prototype = new BinaryOperation();
			OrOperation.prototype.constructor = OrOperation;
			OrOperation.superclass = BinaryOperation.prototype;
			function OrOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			OrOperation.prototype.init = function(lhs, rhs) {
				OrOperation.superclass.init.call(this, lhs, rhs);
			};
			OrOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " or " + this.rhs.toString() + ")";
			};
			OrOperation.prototype.evaluate = function(c) {
				var b = this.lhs.evaluate(c).bool();
				if (b.booleanValue()) return b;
				return this.rhs.evaluate(c).bool();
			};
			AndOperation.prototype = new BinaryOperation();
			AndOperation.prototype.constructor = AndOperation;
			AndOperation.superclass = BinaryOperation.prototype;
			function AndOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			AndOperation.prototype.init = function(lhs, rhs) {
				AndOperation.superclass.init.call(this, lhs, rhs);
			};
			AndOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " and " + this.rhs.toString() + ")";
			};
			AndOperation.prototype.evaluate = function(c) {
				var b = this.lhs.evaluate(c).bool();
				if (!b.booleanValue()) return b;
				return this.rhs.evaluate(c).bool();
			};
			EqualsOperation.prototype = new BinaryOperation();
			EqualsOperation.prototype.constructor = EqualsOperation;
			EqualsOperation.superclass = BinaryOperation.prototype;
			function EqualsOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			EqualsOperation.prototype.init = function(lhs, rhs) {
				EqualsOperation.superclass.init.call(this, lhs, rhs);
			};
			EqualsOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " = " + this.rhs.toString() + ")";
			};
			EqualsOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).equals(this.rhs.evaluate(c));
			};
			NotEqualOperation.prototype = new BinaryOperation();
			NotEqualOperation.prototype.constructor = NotEqualOperation;
			NotEqualOperation.superclass = BinaryOperation.prototype;
			function NotEqualOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			NotEqualOperation.prototype.init = function(lhs, rhs) {
				NotEqualOperation.superclass.init.call(this, lhs, rhs);
			};
			NotEqualOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")";
			};
			NotEqualOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c));
			};
			LessThanOperation.prototype = new BinaryOperation();
			LessThanOperation.prototype.constructor = LessThanOperation;
			LessThanOperation.superclass = BinaryOperation.prototype;
			function LessThanOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			LessThanOperation.prototype.init = function(lhs, rhs) {
				LessThanOperation.superclass.init.call(this, lhs, rhs);
			};
			LessThanOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c));
			};
			LessThanOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")";
			};
			GreaterThanOperation.prototype = new BinaryOperation();
			GreaterThanOperation.prototype.constructor = GreaterThanOperation;
			GreaterThanOperation.superclass = BinaryOperation.prototype;
			function GreaterThanOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			GreaterThanOperation.prototype.init = function(lhs, rhs) {
				GreaterThanOperation.superclass.init.call(this, lhs, rhs);
			};
			GreaterThanOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c));
			};
			GreaterThanOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")";
			};
			LessThanOrEqualOperation.prototype = new BinaryOperation();
			LessThanOrEqualOperation.prototype.constructor = LessThanOrEqualOperation;
			LessThanOrEqualOperation.superclass = BinaryOperation.prototype;
			function LessThanOrEqualOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			LessThanOrEqualOperation.prototype.init = function(lhs, rhs) {
				LessThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
			};
			LessThanOrEqualOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c));
			};
			LessThanOrEqualOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")";
			};
			GreaterThanOrEqualOperation.prototype = new BinaryOperation();
			GreaterThanOrEqualOperation.prototype.constructor = GreaterThanOrEqualOperation;
			GreaterThanOrEqualOperation.superclass = BinaryOperation.prototype;
			function GreaterThanOrEqualOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			GreaterThanOrEqualOperation.prototype.init = function(lhs, rhs) {
				GreaterThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
			};
			GreaterThanOrEqualOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c));
			};
			GreaterThanOrEqualOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")";
			};
			PlusOperation.prototype = new BinaryOperation();
			PlusOperation.prototype.constructor = PlusOperation;
			PlusOperation.superclass = BinaryOperation.prototype;
			function PlusOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			PlusOperation.prototype.init = function(lhs, rhs) {
				PlusOperation.superclass.init.call(this, lhs, rhs);
			};
			PlusOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number());
			};
			PlusOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")";
			};
			MinusOperation.prototype = new BinaryOperation();
			MinusOperation.prototype.constructor = MinusOperation;
			MinusOperation.superclass = BinaryOperation.prototype;
			function MinusOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			MinusOperation.prototype.init = function(lhs, rhs) {
				MinusOperation.superclass.init.call(this, lhs, rhs);
			};
			MinusOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number());
			};
			MinusOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")";
			};
			MultiplyOperation.prototype = new BinaryOperation();
			MultiplyOperation.prototype.constructor = MultiplyOperation;
			MultiplyOperation.superclass = BinaryOperation.prototype;
			function MultiplyOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			MultiplyOperation.prototype.init = function(lhs, rhs) {
				MultiplyOperation.superclass.init.call(this, lhs, rhs);
			};
			MultiplyOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number());
			};
			MultiplyOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")";
			};
			DivOperation.prototype = new BinaryOperation();
			DivOperation.prototype.constructor = DivOperation;
			DivOperation.superclass = BinaryOperation.prototype;
			function DivOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			DivOperation.prototype.init = function(lhs, rhs) {
				DivOperation.superclass.init.call(this, lhs, rhs);
			};
			DivOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number());
			};
			DivOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")";
			};
			ModOperation.prototype = new BinaryOperation();
			ModOperation.prototype.constructor = ModOperation;
			ModOperation.superclass = BinaryOperation.prototype;
			function ModOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			ModOperation.prototype.init = function(lhs, rhs) {
				ModOperation.superclass.init.call(this, lhs, rhs);
			};
			ModOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number());
			};
			ModOperation.prototype.toString = function() {
				return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")";
			};
			BarOperation.prototype = new BinaryOperation();
			BarOperation.prototype.constructor = BarOperation;
			BarOperation.superclass = BinaryOperation.prototype;
			function BarOperation(lhs, rhs) {
				if (arguments.length > 0) this.init(lhs, rhs);
			}
			BarOperation.prototype.init = function(lhs, rhs) {
				BarOperation.superclass.init.call(this, lhs, rhs);
			};
			BarOperation.prototype.evaluate = function(c) {
				return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset());
			};
			BarOperation.prototype.toString = function() {
				return map(toString, [this.lhs, this.rhs]).join(" | ");
			};
			PathExpr.prototype = new Expression();
			PathExpr.prototype.constructor = PathExpr;
			PathExpr.superclass = Expression.prototype;
			function PathExpr(filter$1, filterPreds, locpath) {
				if (arguments.length > 0) this.init(filter$1, filterPreds, locpath);
			}
			PathExpr.prototype.init = function(filter$1, filterPreds, locpath) {
				PathExpr.superclass.init.call(this);
				this.filter = filter$1;
				this.filterPredicates = filterPreds;
				this.locationPath = locpath;
			};
			/**
			* Returns the topmost node of the tree containing node
			*/
			function findRoot(node) {
				while (node && node.parentNode) node = node.parentNode;
				return node;
			}
			var applyPredicates = function(predicates, c, nodes, reverse) {
				if (predicates.length === 0) return nodes;
				var ctx = c.extend({});
				return reduce(function(inNodes, pred) {
					ctx.contextSize = inNodes.length;
					return filter(function(node, i$1) {
						ctx.contextNode = node;
						ctx.contextPosition = i$1 + 1;
						return PathExpr.predicateMatches(pred, ctx);
					}, inNodes);
				}, sortNodes(nodes, reverse), predicates);
			};
			PathExpr.getRoot = function(xpc, nodes) {
				var firstNode = nodes[0];
				if (firstNode && firstNode.nodeType === NodeTypes.DOCUMENT_NODE) return firstNode;
				if (xpc.virtualRoot) return xpc.virtualRoot;
				if (!firstNode) throw new Error("Context node not found when determining document root.");
				var ownerDoc = firstNode.ownerDocument;
				if (ownerDoc) return ownerDoc;
				var n = firstNode;
				while (n.parentNode != null) n = n.parentNode;
				return n;
			};
			var getPrefixForNamespaceNode = function(attrNode) {
				var nm = String(attrNode.name);
				if (nm === "xmlns") return "";
				if (nm.substring(0, 6) === "xmlns:") return nm.substring(6, nm.length);
				return null;
			};
			PathExpr.applyStep = function(step, xpc, node) {
				if (!node) throw new Error("Context node not found when evaluating XPath step: " + step);
				var newNodes = [];
				xpc.contextNode = node;
				switch (step.axis) {
					case Step.ANCESTOR:
						if (xpc.contextNode === xpc.virtualRoot) break;
						var m;
						if (xpc.contextNode.nodeType == NodeTypes.ATTRIBUTE_NODE) m = PathExpr.getOwnerElement(xpc.contextNode);
						else m = xpc.contextNode.parentNode;
						while (m != null) {
							if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
							if (m === xpc.virtualRoot) break;
							m = m.parentNode;
						}
						break;
					case Step.ANCESTORORSELF:
						for (var m = xpc.contextNode; m != null; m = m.nodeType == NodeTypes.ATTRIBUTE_NODE ? PathExpr.getOwnerElement(m) : m.parentNode) {
							if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
							if (m === xpc.virtualRoot) break;
						}
						break;
					case Step.ATTRIBUTE:
						var nnm = xpc.contextNode.attributes;
						if (nnm != null) for (var k = 0; k < nnm.length; k++) {
							var m = nnm.item(k);
							if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
						}
						break;
					case Step.CHILD:
						for (var m = xpc.contextNode.firstChild; m != null; m = m.nextSibling) if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
						break;
					case Step.DESCENDANT:
						var st = [xpc.contextNode.firstChild];
						while (st.length > 0) for (var m = st.pop(); m != null;) {
							if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
							if (m.firstChild != null) {
								st.push(m.nextSibling);
								m = m.firstChild;
							} else m = m.nextSibling;
						}
						break;
					case Step.DESCENDANTORSELF:
						if (step.nodeTest.matches(xpc.contextNode, xpc)) newNodes.push(xpc.contextNode);
						var st = [xpc.contextNode.firstChild];
						while (st.length > 0) for (var m = st.pop(); m != null;) {
							if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
							if (m.firstChild != null) {
								st.push(m.nextSibling);
								m = m.firstChild;
							} else m = m.nextSibling;
						}
						break;
					case Step.FOLLOWING:
						if (xpc.contextNode === xpc.virtualRoot) break;
						var st = [];
						if (xpc.contextNode.firstChild != null) st.unshift(xpc.contextNode.firstChild);
						else st.unshift(xpc.contextNode.nextSibling);
						for (var m = xpc.contextNode.parentNode; m != null && m.nodeType != NodeTypes.DOCUMENT_NODE && m !== xpc.virtualRoot; m = m.parentNode) st.unshift(m.nextSibling);
						do
							for (var m = st.pop(); m != null;) {
								if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
								if (m.firstChild != null) {
									st.push(m.nextSibling);
									m = m.firstChild;
								} else m = m.nextSibling;
							}
						while (st.length > 0);
						break;
					case Step.FOLLOWINGSIBLING:
						if (xpc.contextNode === xpc.virtualRoot) break;
						for (var m = xpc.contextNode.nextSibling; m != null; m = m.nextSibling) if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
						break;
					case Step.NAMESPACE:
						var nodes = {};
						if (xpc.contextNode.nodeType == NodeTypes.ELEMENT_NODE) {
							nodes["xml"] = new XPathNamespace("xml", null, XPath.XML_NAMESPACE_URI, xpc.contextNode);
							for (var m = xpc.contextNode; m != null && m.nodeType == NodeTypes.ELEMENT_NODE; m = m.parentNode) for (var k = 0; k < m.attributes.length; k++) {
								var attr = m.attributes.item(k);
								var pre = getPrefixForNamespaceNode(attr);
								if (pre != null && nodes[pre] == void 0) nodes[pre] = new XPathNamespace(pre, attr, attr.value, xpc.contextNode);
							}
							for (var pre in nodes) {
								var node = nodes[pre];
								if (step.nodeTest.matches(node, xpc)) newNodes.push(node);
							}
						}
						break;
					case Step.PARENT:
						m = null;
						if (xpc.contextNode !== xpc.virtualRoot) if (xpc.contextNode.nodeType == NodeTypes.ATTRIBUTE_NODE) m = PathExpr.getOwnerElement(xpc.contextNode);
						else m = xpc.contextNode.parentNode;
						if (m != null && step.nodeTest.matches(m, xpc)) newNodes.push(m);
						break;
					case Step.PRECEDING:
						var st;
						if (xpc.virtualRoot != null) st = [xpc.virtualRoot];
						else st = [findRoot(xpc.contextNode)];
						outer: while (st.length > 0) for (var m = st.pop(); m != null;) {
							if (m == xpc.contextNode) break outer;
							if (step.nodeTest.matches(m, xpc)) newNodes.unshift(m);
							if (m.firstChild != null) {
								st.push(m.nextSibling);
								m = m.firstChild;
							} else m = m.nextSibling;
						}
						break;
					case Step.PRECEDINGSIBLING:
						if (xpc.contextNode === xpc.virtualRoot) break;
						for (var m = xpc.contextNode.previousSibling; m != null; m = m.previousSibling) if (step.nodeTest.matches(m, xpc)) newNodes.push(m);
						break;
					case Step.SELF:
						if (step.nodeTest.matches(xpc.contextNode, xpc)) newNodes.push(xpc.contextNode);
						break;
					default:
				}
				return newNodes;
			};
			function applyStepWithPredicates(step, xpc, node) {
				return applyPredicates(step.predicates, xpc, PathExpr.applyStep(step, xpc, node), includes(REVERSE_AXES, step.axis));
			}
			function applyStepToNodes(context, nodes, step) {
				return flatten(map(applyStepWithPredicates.bind(null, step, context), nodes));
			}
			PathExpr.applySteps = function(steps, xpc, nodes) {
				return reduce(applyStepToNodes.bind(null, xpc), nodes, steps);
			};
			PathExpr.prototype.applyFilter = function(c, xpc) {
				if (!this.filter) return { nodes: [c.contextNode] };
				var ns = this.filter.evaluate(c);
				if (!Utilities.instance_of(ns, XNodeSet)) {
					if (this.filterPredicates != null && this.filterPredicates.length > 0 || this.locationPath != null) throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");
					return { nonNodes: ns };
				}
				return { nodes: applyPredicates(this.filterPredicates || [], xpc, ns.toUnsortedArray(), false) };
			};
			PathExpr.applyLocationPath = function(locationPath, xpc, nodes) {
				if (!locationPath) return nodes;
				var startNodes = locationPath.absolute ? [PathExpr.getRoot(xpc, nodes)] : nodes;
				return PathExpr.applySteps(locationPath.steps, xpc, startNodes);
			};
			PathExpr.prototype.evaluate = function(c) {
				var xpc = assign$1(new XPathContext(), c);
				var filterResult = this.applyFilter(c, xpc);
				if ("nonNodes" in filterResult) return filterResult.nonNodes;
				var ns = new XNodeSet();
				ns.addArray(PathExpr.applyLocationPath(this.locationPath, xpc, filterResult.nodes));
				return ns;
			};
			PathExpr.predicateMatches = function(pred, c) {
				var res = pred.evaluate(c);
				return Utilities.instance_of(res, XNumber) ? c.contextPosition === res.numberValue() : res.booleanValue();
			};
			PathExpr.predicateString = function(predicate) {
				return wrap("[", "]", predicate.toString());
			};
			PathExpr.predicatesString = function(predicates) {
				return join("", map(PathExpr.predicateString, predicates));
			};
			PathExpr.prototype.toString = function() {
				if (this.filter != void 0) {
					var filterStr = toString(this.filter);
					if (Utilities.instance_of(this.filter, XString)) return wrap("'", "'", filterStr);
					if (this.filterPredicates != void 0 && this.filterPredicates.length) return wrap("(", ")", filterStr) + PathExpr.predicatesString(this.filterPredicates);
					if (this.locationPath != void 0) return filterStr + (this.locationPath.absolute ? "" : "/") + toString(this.locationPath);
					return filterStr;
				}
				return toString(this.locationPath);
			};
			PathExpr.getOwnerElement = function(n) {
				if (n.ownerElement) return n.ownerElement;
				try {
					if (n.selectSingleNode) return n.selectSingleNode("..");
				} catch (e) {}
				var elts = (n.nodeType == NodeTypes.DOCUMENT_NODE ? n : n.ownerDocument).getElementsByTagName("*");
				for (var i$1 = 0; i$1 < elts.length; i$1++) {
					var elt = elts.item(i$1);
					var nnm = elt.attributes;
					for (var j = 0; j < nnm.length; j++) if (nnm.item(j) === n) return elt;
				}
				return null;
			};
			LocationPath.prototype = /* @__PURE__ */ new Object();
			LocationPath.prototype.constructor = LocationPath;
			LocationPath.superclass = Object.prototype;
			function LocationPath(abs, steps) {
				if (arguments.length > 0) this.init(abs, steps);
			}
			LocationPath.prototype.init = function(abs, steps) {
				this.absolute = abs;
				this.steps = steps;
			};
			LocationPath.prototype.toString = function() {
				return (this.absolute ? "/" : "") + map(toString, this.steps).join("/");
			};
			Step.prototype = /* @__PURE__ */ new Object();
			Step.prototype.constructor = Step;
			Step.superclass = Object.prototype;
			function Step(axis, nodetest, preds) {
				if (arguments.length > 0) this.init(axis, nodetest, preds);
			}
			Step.prototype.init = function(axis, nodetest, preds) {
				this.axis = axis;
				this.nodeTest = nodetest;
				this.predicates = preds;
			};
			Step.prototype.toString = function() {
				return Step.STEPNAMES[this.axis] + "::" + this.nodeTest.toString() + PathExpr.predicatesString(this.predicates);
			};
			Step.ANCESTOR = 0;
			Step.ANCESTORORSELF = 1;
			Step.ATTRIBUTE = 2;
			Step.CHILD = 3;
			Step.DESCENDANT = 4;
			Step.DESCENDANTORSELF = 5;
			Step.FOLLOWING = 6;
			Step.FOLLOWINGSIBLING = 7;
			Step.NAMESPACE = 8;
			Step.PARENT = 9;
			Step.PRECEDING = 10;
			Step.PRECEDINGSIBLING = 11;
			Step.SELF = 12;
			Step.STEPNAMES = reduce(function(acc, x) {
				return acc[x[0]] = x[1], acc;
			}, {}, [
				[Step.ANCESTOR, "ancestor"],
				[Step.ANCESTORORSELF, "ancestor-or-self"],
				[Step.ATTRIBUTE, "attribute"],
				[Step.CHILD, "child"],
				[Step.DESCENDANT, "descendant"],
				[Step.DESCENDANTORSELF, "descendant-or-self"],
				[Step.FOLLOWING, "following"],
				[Step.FOLLOWINGSIBLING, "following-sibling"],
				[Step.NAMESPACE, "namespace"],
				[Step.PARENT, "parent"],
				[Step.PRECEDING, "preceding"],
				[Step.PRECEDINGSIBLING, "preceding-sibling"],
				[Step.SELF, "self"]
			]);
			var REVERSE_AXES = [
				Step.ANCESTOR,
				Step.ANCESTORORSELF,
				Step.PARENT,
				Step.PRECEDING,
				Step.PRECEDINGSIBLING
			];
			NodeTest.prototype = /* @__PURE__ */ new Object();
			NodeTest.prototype.constructor = NodeTest;
			NodeTest.superclass = Object.prototype;
			function NodeTest(type, value) {
				if (arguments.length > 0) this.init(type, value);
			}
			NodeTest.prototype.init = function(type, value) {
				this.type = type;
				this.value = value;
			};
			NodeTest.prototype.toString = function() {
				return "<unknown nodetest type>";
			};
			NodeTest.prototype.matches = function(n, xpc) {
				console.warn("unknown node test type");
			};
			NodeTest.NAMETESTANY = 0;
			NodeTest.NAMETESTPREFIXANY = 1;
			NodeTest.NAMETESTQNAME = 2;
			NodeTest.COMMENT = 3;
			NodeTest.TEXT = 4;
			NodeTest.PI = 5;
			NodeTest.NODE = 6;
			NodeTest.isNodeType = function(types) {
				return function(node) {
					return includes(types, node.nodeType);
				};
			};
			NodeTest.makeNodeTestType = function(type, members, ctor) {
				var newType = ctor || function() {};
				newType.prototype = new NodeTest(type);
				newType.prototype.constructor = newType;
				assign$1(newType.prototype, members);
				return newType;
			};
			NodeTest.makeNodeTypeTest = function(type, nodeTypes, stringVal) {
				return new (NodeTest.makeNodeTestType(type, {
					matches: NodeTest.isNodeType(nodeTypes),
					toString: always(stringVal)
				}))();
			};
			NodeTest.hasPrefix = function(node) {
				return node.prefix || (node.nodeName || node.tagName).indexOf(":") !== -1;
			};
			NodeTest.isElementOrAttribute = NodeTest.isNodeType([1, 2]);
			NodeTest.nameSpaceMatches = function(prefix, xpc, n) {
				var nNamespace = n.namespaceURI || "";
				if (!prefix) return !nNamespace || xpc.allowAnyNamespaceForNoPrefix && !NodeTest.hasPrefix(n);
				var ns = xpc.namespaceResolver.getNamespace(prefix, xpc.expressionContextNode);
				if (ns == null) throw new Error("Cannot resolve QName " + prefix);
				return ns === nNamespace;
			};
			NodeTest.localNameMatches = function(localName, xpc, n) {
				var nLocalName = n.localName || n.nodeName;
				return xpc.caseInsensitive ? localName.toLowerCase() === nLocalName.toLowerCase() : localName === nLocalName;
			};
			NodeTest.NameTestPrefixAny = NodeTest.makeNodeTestType(NodeTest.NAMETESTPREFIXANY, {
				matches: function(n, xpc) {
					return NodeTest.isElementOrAttribute(n) && NodeTest.nameSpaceMatches(this.prefix, xpc, n);
				},
				toString: function() {
					return this.prefix + ":*";
				}
			}, function NameTestPrefixAny(prefix) {
				this.prefix = prefix;
			});
			NodeTest.NameTestQName = NodeTest.makeNodeTestType(NodeTest.NAMETESTQNAME, {
				matches: function(n, xpc) {
					return NodeTest.isNodeType([
						NodeTypes.ELEMENT_NODE,
						NodeTypes.ATTRIBUTE_NODE,
						NodeTypes.NAMESPACE_NODE
					])(n) && NodeTest.nameSpaceMatches(this.prefix, xpc, n) && NodeTest.localNameMatches(this.localName, xpc, n);
				},
				toString: function() {
					return this.name;
				}
			}, function NameTestQName(name$1) {
				var nameParts = name$1.split(":");
				this.name = name$1;
				this.prefix = nameParts.length > 1 ? nameParts[0] : null;
				this.localName = nameParts[nameParts.length > 1 ? 1 : 0];
			});
			NodeTest.PITest = NodeTest.makeNodeTestType(NodeTest.PI, {
				matches: function(n, xpc) {
					return NodeTest.isNodeType([NodeTypes.PROCESSING_INSTRUCTION_NODE])(n) && (n.target || n.nodeName) === this.name;
				},
				toString: function() {
					return wrap("processing-instruction(\"", "\")", this.name);
				}
			}, function(name$1) {
				this.name = name$1;
			});
			NodeTest.nameTestAny = NodeTest.makeNodeTypeTest(NodeTest.NAMETESTANY, [
				NodeTypes.ELEMENT_NODE,
				NodeTypes.ATTRIBUTE_NODE,
				NodeTypes.NAMESPACE_NODE
			], "*");
			NodeTest.textTest = NodeTest.makeNodeTypeTest(NodeTest.TEXT, [NodeTypes.TEXT_NODE, NodeTypes.CDATA_SECTION_NODE], "text()");
			NodeTest.commentTest = NodeTest.makeNodeTypeTest(NodeTest.COMMENT, [NodeTypes.COMMENT_NODE], "comment()");
			NodeTest.nodeTest = NodeTest.makeNodeTypeTest(NodeTest.NODE, [
				NodeTypes.ELEMENT_NODE,
				NodeTypes.ATTRIBUTE_NODE,
				NodeTypes.TEXT_NODE,
				NodeTypes.CDATA_SECTION_NODE,
				NodeTypes.PROCESSING_INSTRUCTION_NODE,
				NodeTypes.COMMENT_NODE,
				NodeTypes.DOCUMENT_NODE
			], "node()");
			NodeTest.anyPiTest = NodeTest.makeNodeTypeTest(NodeTest.PI, [NodeTypes.PROCESSING_INSTRUCTION_NODE], "processing-instruction()");
			VariableReference.prototype = new Expression();
			VariableReference.prototype.constructor = VariableReference;
			VariableReference.superclass = Expression.prototype;
			function VariableReference(v) {
				if (arguments.length > 0) this.init(v);
			}
			VariableReference.prototype.init = function(v) {
				this.variable = v;
			};
			VariableReference.prototype.toString = function() {
				return "$" + this.variable;
			};
			VariableReference.prototype.evaluate = function(c) {
				var parts = Utilities.resolveQName(this.variable, c.namespaceResolver, c.contextNode, false);
				if (parts[0] == null) throw new Error("Cannot resolve QName " + fn);
				var result = c.variableResolver.getVariable(parts[1], parts[0]);
				if (!result) throw XPathException.fromMessage("Undeclared variable: " + this.toString());
				return result;
			};
			FunctionCall.prototype = new Expression();
			FunctionCall.prototype.constructor = FunctionCall;
			FunctionCall.superclass = Expression.prototype;
			function FunctionCall(fn$1, args) {
				if (arguments.length > 0) this.init(fn$1, args);
			}
			FunctionCall.prototype.init = function(fn$1, args) {
				this.functionName = fn$1;
				this.arguments = args;
			};
			FunctionCall.prototype.toString = function() {
				var s = this.functionName + "(";
				for (var i$1 = 0; i$1 < this.arguments.length; i$1++) {
					if (i$1 > 0) s += ", ";
					s += this.arguments[i$1].toString();
				}
				return s + ")";
			};
			FunctionCall.prototype.evaluate = function(c) {
				var f = FunctionResolver.getFunctionFromContext(this.functionName, c);
				if (!f) throw new Error("Unknown function " + this.functionName);
				var a = [c].concat(this.arguments);
				return f.apply(c.functionResolver.thisArg, a);
			};
			var Operators = /* @__PURE__ */ new Object();
			Operators.equals = function(l, r) {
				return l.equals(r);
			};
			Operators.notequal = function(l, r) {
				return l.notequal(r);
			};
			Operators.lessthan = function(l, r) {
				return l.lessthan(r);
			};
			Operators.greaterthan = function(l, r) {
				return l.greaterthan(r);
			};
			Operators.lessthanorequal = function(l, r) {
				return l.lessthanorequal(r);
			};
			Operators.greaterthanorequal = function(l, r) {
				return l.greaterthanorequal(r);
			};
			XString.prototype = new Expression();
			XString.prototype.constructor = XString;
			XString.superclass = Expression.prototype;
			function XString(s) {
				if (arguments.length > 0) this.init(s);
			}
			XString.prototype.init = function(s) {
				this.str = String(s);
			};
			XString.prototype.toString = function() {
				return this.str;
			};
			XString.prototype.evaluate = function(c) {
				return this;
			};
			XString.prototype.string = function() {
				return this;
			};
			XString.prototype.number = function() {
				return new XNumber(this.str);
			};
			XString.prototype.bool = function() {
				return new XBoolean(this.str);
			};
			XString.prototype.nodeset = function() {
				throw new Error("Cannot convert string to nodeset");
			};
			XString.prototype.stringValue = function() {
				return this.str;
			};
			XString.prototype.numberValue = function() {
				return this.number().numberValue();
			};
			XString.prototype.booleanValue = function() {
				return this.bool().booleanValue();
			};
			XString.prototype.equals = function(r) {
				if (Utilities.instance_of(r, XBoolean)) return this.bool().equals(r);
				if (Utilities.instance_of(r, XNumber)) return this.number().equals(r);
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithString(this, Operators.equals);
				return new XBoolean(this.str == r.str);
			};
			XString.prototype.notequal = function(r) {
				if (Utilities.instance_of(r, XBoolean)) return this.bool().notequal(r);
				if (Utilities.instance_of(r, XNumber)) return this.number().notequal(r);
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithString(this, Operators.notequal);
				return new XBoolean(this.str != r.str);
			};
			XString.prototype.lessthan = function(r) {
				return this.number().lessthan(r);
			};
			XString.prototype.greaterthan = function(r) {
				return this.number().greaterthan(r);
			};
			XString.prototype.lessthanorequal = function(r) {
				return this.number().lessthanorequal(r);
			};
			XString.prototype.greaterthanorequal = function(r) {
				return this.number().greaterthanorequal(r);
			};
			XNumber.prototype = new Expression();
			XNumber.prototype.constructor = XNumber;
			XNumber.superclass = Expression.prototype;
			function XNumber(n) {
				if (arguments.length > 0) this.init(n);
			}
			XNumber.prototype.init = function(n) {
				this.num = typeof n === "string" ? this.parse(n) : Number(n);
			};
			XNumber.prototype.numberFormat = /^\s*-?[0-9]*\.?[0-9]+\s*$/;
			XNumber.prototype.parse = function(s) {
				return this.numberFormat.test(s) ? parseFloat(s) : NaN;
			};
			function padSmallNumber(numberStr) {
				var parts = numberStr.split("e-");
				var base = parts[0].replace(".", "");
				var exponent = Number(parts[1]);
				for (var i$1 = 0; i$1 < exponent - 1; i$1 += 1) base = "0" + base;
				return "0." + base;
			}
			function padLargeNumber(numberStr) {
				var parts = numberStr.split("e");
				var base = parts[0].replace(".", "");
				var zerosToAppend = Number(parts[1]) + 1 - base.length;
				for (var i$1 = 0; i$1 < zerosToAppend; i$1 += 1) base += "0";
				return base;
			}
			XNumber.prototype.toString = function() {
				var strValue = this.num.toString();
				if (strValue.indexOf("e-") !== -1) return padSmallNumber(strValue);
				if (strValue.indexOf("e") !== -1) return padLargeNumber(strValue);
				return strValue;
			};
			XNumber.prototype.evaluate = function(c) {
				return this;
			};
			XNumber.prototype.string = function() {
				return new XString(this.toString());
			};
			XNumber.prototype.number = function() {
				return this;
			};
			XNumber.prototype.bool = function() {
				return new XBoolean(this.num);
			};
			XNumber.prototype.nodeset = function() {
				throw new Error("Cannot convert number to nodeset");
			};
			XNumber.prototype.stringValue = function() {
				return this.string().stringValue();
			};
			XNumber.prototype.numberValue = function() {
				return this.num;
			};
			XNumber.prototype.booleanValue = function() {
				return this.bool().booleanValue();
			};
			XNumber.prototype.negate = function() {
				return new XNumber(-this.num);
			};
			XNumber.prototype.equals = function(r) {
				if (Utilities.instance_of(r, XBoolean)) return this.bool().equals(r);
				if (Utilities.instance_of(r, XString)) return this.equals(r.number());
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithNumber(this, Operators.equals);
				return new XBoolean(this.num == r.num);
			};
			XNumber.prototype.notequal = function(r) {
				if (Utilities.instance_of(r, XBoolean)) return this.bool().notequal(r);
				if (Utilities.instance_of(r, XString)) return this.notequal(r.number());
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithNumber(this, Operators.notequal);
				return new XBoolean(this.num != r.num);
			};
			XNumber.prototype.lessthan = function(r) {
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithNumber(this, Operators.greaterthan);
				if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) return this.lessthan(r.number());
				return new XBoolean(this.num < r.num);
			};
			XNumber.prototype.greaterthan = function(r) {
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithNumber(this, Operators.lessthan);
				if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) return this.greaterthan(r.number());
				return new XBoolean(this.num > r.num);
			};
			XNumber.prototype.lessthanorequal = function(r) {
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithNumber(this, Operators.greaterthanorequal);
				if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) return this.lessthanorequal(r.number());
				return new XBoolean(this.num <= r.num);
			};
			XNumber.prototype.greaterthanorequal = function(r) {
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithNumber(this, Operators.lessthanorequal);
				if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) return this.greaterthanorequal(r.number());
				return new XBoolean(this.num >= r.num);
			};
			XNumber.prototype.plus = function(r) {
				return new XNumber(this.num + r.num);
			};
			XNumber.prototype.minus = function(r) {
				return new XNumber(this.num - r.num);
			};
			XNumber.prototype.multiply = function(r) {
				return new XNumber(this.num * r.num);
			};
			XNumber.prototype.div = function(r) {
				return new XNumber(this.num / r.num);
			};
			XNumber.prototype.mod = function(r) {
				return new XNumber(this.num % r.num);
			};
			XBoolean.prototype = new Expression();
			XBoolean.prototype.constructor = XBoolean;
			XBoolean.superclass = Expression.prototype;
			function XBoolean(b) {
				if (arguments.length > 0) this.init(b);
			}
			XBoolean.prototype.init = function(b) {
				this.b = Boolean(b);
			};
			XBoolean.prototype.toString = function() {
				return this.b.toString();
			};
			XBoolean.prototype.evaluate = function(c) {
				return this;
			};
			XBoolean.prototype.string = function() {
				return new XString(this.b);
			};
			XBoolean.prototype.number = function() {
				return new XNumber(this.b);
			};
			XBoolean.prototype.bool = function() {
				return this;
			};
			XBoolean.prototype.nodeset = function() {
				throw new Error("Cannot convert boolean to nodeset");
			};
			XBoolean.prototype.stringValue = function() {
				return this.string().stringValue();
			};
			XBoolean.prototype.numberValue = function() {
				return this.number().numberValue();
			};
			XBoolean.prototype.booleanValue = function() {
				return this.b;
			};
			XBoolean.prototype.not = function() {
				return new XBoolean(!this.b);
			};
			XBoolean.prototype.equals = function(r) {
				if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) return this.equals(r.bool());
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithBoolean(this, Operators.equals);
				return new XBoolean(this.b == r.b);
			};
			XBoolean.prototype.notequal = function(r) {
				if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) return this.notequal(r.bool());
				if (Utilities.instance_of(r, XNodeSet)) return r.compareWithBoolean(this, Operators.notequal);
				return new XBoolean(this.b != r.b);
			};
			XBoolean.prototype.lessthan = function(r) {
				return this.number().lessthan(r);
			};
			XBoolean.prototype.greaterthan = function(r) {
				return this.number().greaterthan(r);
			};
			XBoolean.prototype.lessthanorequal = function(r) {
				return this.number().lessthanorequal(r);
			};
			XBoolean.prototype.greaterthanorequal = function(r) {
				return this.number().greaterthanorequal(r);
			};
			XBoolean.true_ = new XBoolean(true);
			XBoolean.false_ = new XBoolean(false);
			AVLTree.prototype = /* @__PURE__ */ new Object();
			AVLTree.prototype.constructor = AVLTree;
			AVLTree.superclass = Object.prototype;
			function AVLTree(n) {
				this.init(n);
			}
			AVLTree.prototype.init = function(n) {
				this.left = null;
				this.right = null;
				this.node = n;
				this.depth = 1;
			};
			AVLTree.prototype.balance = function() {
				var ldepth = this.left == null ? 0 : this.left.depth;
				var rdepth = this.right == null ? 0 : this.right.depth;
				if (ldepth > rdepth + 1) {
					if ((this.left.left == null ? 0 : this.left.left.depth) < (this.left.right == null ? 0 : this.left.right.depth)) this.left.rotateRR();
					this.rotateLL();
				} else if (ldepth + 1 < rdepth) {
					var rrdepth = this.right.right == null ? 0 : this.right.right.depth;
					if ((this.right.left == null ? 0 : this.right.left.depth) > rrdepth) this.right.rotateLL();
					this.rotateRR();
				}
			};
			AVLTree.prototype.rotateLL = function() {
				var nodeBefore = this.node;
				var rightBefore = this.right;
				this.node = this.left.node;
				this.right = this.left;
				this.left = this.left.left;
				this.right.left = this.right.right;
				this.right.right = rightBefore;
				this.right.node = nodeBefore;
				this.right.updateInNewLocation();
				this.updateInNewLocation();
			};
			AVLTree.prototype.rotateRR = function() {
				var nodeBefore = this.node;
				var leftBefore = this.left;
				this.node = this.right.node;
				this.left = this.right;
				this.right = this.right.right;
				this.left.right = this.left.left;
				this.left.left = leftBefore;
				this.left.node = nodeBefore;
				this.left.updateInNewLocation();
				this.updateInNewLocation();
			};
			AVLTree.prototype.updateInNewLocation = function() {
				this.getDepthFromChildren();
			};
			AVLTree.prototype.getDepthFromChildren = function() {
				this.depth = this.node == null ? 0 : 1;
				if (this.left != null) this.depth = this.left.depth + 1;
				if (this.right != null && this.depth <= this.right.depth) this.depth = this.right.depth + 1;
			};
			function nodeOrder(n1, n2) {
				if (n1 === n2) return 0;
				if (n1.compareDocumentPosition) {
					var cpos = n1.compareDocumentPosition(n2);
					if (cpos & 1) return 1;
					if (cpos & 10) return 1;
					if (cpos & 20) return -1;
					return 0;
				}
				var d1 = 0, d2 = 0;
				for (var m1 = n1; m1 != null; m1 = m1.parentNode || m1.ownerElement) d1++;
				for (var m2 = n2; m2 != null; m2 = m2.parentNode || m2.ownerElement) d2++;
				if (d1 > d2) {
					while (d1 > d2) {
						n1 = n1.parentNode || n1.ownerElement;
						d1--;
					}
					if (n1 === n2) return 1;
				} else if (d2 > d1) {
					while (d2 > d1) {
						n2 = n2.parentNode || n2.ownerElement;
						d2--;
					}
					if (n1 === n2) return -1;
				}
				var n1Par = n1.parentNode || n1.ownerElement, n2Par = n2.parentNode || n2.ownerElement;
				while (n1Par !== n2Par) {
					n1 = n1Par;
					n2 = n2Par;
					n1Par = n1.parentNode || n1.ownerElement;
					n2Par = n2.parentNode || n2.ownerElement;
				}
				var n1isAttr = isAttributeLike(n1);
				var n2isAttr = isAttributeLike(n2);
				if (n1isAttr && !n2isAttr) return -1;
				if (!n1isAttr && n2isAttr) return 1;
				if (n1.isXPathNamespace) {
					if (n1.nodeValue === XPath.XML_NAMESPACE_URI) return -1;
					if (!n2.isXPathNamespace) return -1;
					if (n2.nodeValue === XPath.XML_NAMESPACE_URI) return 1;
				} else if (n2.isXPathNamespace) return 1;
				if (n1Par) {
					var cn = n1isAttr ? n1Par.attributes : n1Par.childNodes;
					var len = cn.length;
					var n1Compare = n1.baseNode || n1;
					var n2Compare = n2.baseNode || n2;
					for (var i$1 = 0; i$1 < len; i$1 += 1) {
						var n = cn[i$1];
						if (n === n1Compare) return -1;
						if (n === n2Compare) return 1;
					}
				}
				throw new Error("Unexpected: could not determine node order");
			}
			AVLTree.prototype.add = function(n) {
				if (n === this.node) return false;
				var o = nodeOrder(n, this.node);
				var ret = false;
				if (o == -1) if (this.left == null) {
					this.left = new AVLTree(n);
					ret = true;
				} else {
					ret = this.left.add(n);
					if (ret) this.balance();
				}
				else if (o == 1) if (this.right == null) {
					this.right = new AVLTree(n);
					ret = true;
				} else {
					ret = this.right.add(n);
					if (ret) this.balance();
				}
				if (ret) this.getDepthFromChildren();
				return ret;
			};
			XNodeSet.prototype = new Expression();
			XNodeSet.prototype.constructor = XNodeSet;
			XNodeSet.superclass = Expression.prototype;
			function XNodeSet() {
				this.init();
			}
			XNodeSet.prototype.init = function() {
				this.tree = null;
				this.nodes = [];
				this.size = 0;
			};
			XNodeSet.prototype.toString = function() {
				var p = this.first();
				if (p == null) return "";
				return this.stringForNode(p);
			};
			XNodeSet.prototype.evaluate = function(c) {
				return this;
			};
			XNodeSet.prototype.string = function() {
				return new XString(this.toString());
			};
			XNodeSet.prototype.stringValue = function() {
				return this.toString();
			};
			XNodeSet.prototype.number = function() {
				return new XNumber(this.string());
			};
			XNodeSet.prototype.numberValue = function() {
				return Number(this.string());
			};
			XNodeSet.prototype.bool = function() {
				return new XBoolean(this.booleanValue());
			};
			XNodeSet.prototype.booleanValue = function() {
				return !!this.size;
			};
			XNodeSet.prototype.nodeset = function() {
				return this;
			};
			XNodeSet.prototype.stringForNode = function(n) {
				if (n.nodeType == NodeTypes.DOCUMENT_NODE || n.nodeType == NodeTypes.ELEMENT_NODE || n.nodeType === NodeTypes.DOCUMENT_FRAGMENT_NODE) return this.stringForContainerNode(n);
				if (n.nodeType === NodeTypes.ATTRIBUTE_NODE) return n.value || n.nodeValue;
				if (n.isNamespaceNode) return n.namespace;
				return n.nodeValue;
			};
			XNodeSet.prototype.stringForContainerNode = function(n) {
				var s = "";
				for (var n2 = n.firstChild; n2 != null; n2 = n2.nextSibling) {
					var nt = n2.nodeType;
					if (nt === 1 || nt === 3 || nt === 4 || nt === 9 || nt === 11) s += this.stringForNode(n2);
				}
				return s;
			};
			XNodeSet.prototype.buildTree = function() {
				if (!this.tree && this.nodes.length) {
					this.tree = new AVLTree(this.nodes[0]);
					for (var i$1 = 1; i$1 < this.nodes.length; i$1 += 1) this.tree.add(this.nodes[i$1]);
				}
				return this.tree;
			};
			XNodeSet.prototype.first = function() {
				var p = this.buildTree();
				if (p == null) return null;
				while (p.left != null) p = p.left;
				return p.node;
			};
			XNodeSet.prototype.add = function(n) {
				for (var i$1 = 0; i$1 < this.nodes.length; i$1 += 1) if (n === this.nodes[i$1]) return;
				this.tree = null;
				this.nodes.push(n);
				this.size += 1;
			};
			XNodeSet.prototype.addArray = function(ns) {
				var self = this;
				forEach(function(x) {
					self.add(x);
				}, ns);
			};
			/**
			* Returns an array of the node set's contents in document order
			*/
			XNodeSet.prototype.toArray = function() {
				var a = [];
				this.toArrayRec(this.buildTree(), a);
				return a;
			};
			XNodeSet.prototype.toArrayRec = function(t, a) {
				if (t != null) {
					this.toArrayRec(t.left, a);
					a.push(t.node);
					this.toArrayRec(t.right, a);
				}
			};
			/**
			* Returns an array of the node set's contents in arbitrary order
			*/
			XNodeSet.prototype.toUnsortedArray = function() {
				return this.nodes.slice();
			};
			XNodeSet.prototype.compareWithString = function(r, o) {
				var a = this.toUnsortedArray();
				for (var i$1 = 0; i$1 < a.length; i$1++) {
					var n = a[i$1];
					var res = o(new XString(this.stringForNode(n)), r);
					if (res.booleanValue()) return res;
				}
				return new XBoolean(false);
			};
			XNodeSet.prototype.compareWithNumber = function(r, o) {
				var a = this.toUnsortedArray();
				for (var i$1 = 0; i$1 < a.length; i$1++) {
					var n = a[i$1];
					var res = o(new XNumber(this.stringForNode(n)), r);
					if (res.booleanValue()) return res;
				}
				return new XBoolean(false);
			};
			XNodeSet.prototype.compareWithBoolean = function(r, o) {
				return o(this.bool(), r);
			};
			XNodeSet.prototype.compareWithNodeSet = function(r, o) {
				var arr = this.toUnsortedArray();
				var oInvert = function(lop, rop) {
					return o(rop, lop);
				};
				for (var i$1 = 0; i$1 < arr.length; i$1++) {
					var l = new XString(this.stringForNode(arr[i$1]));
					var res = r.compareWithString(l, oInvert);
					if (res.booleanValue()) return res;
				}
				return new XBoolean(false);
			};
			XNodeSet.compareWith = curry(function(o, r) {
				if (Utilities.instance_of(r, XString)) return this.compareWithString(r, o);
				if (Utilities.instance_of(r, XNumber)) return this.compareWithNumber(r, o);
				if (Utilities.instance_of(r, XBoolean)) return this.compareWithBoolean(r, o);
				return this.compareWithNodeSet(r, o);
			});
			XNodeSet.prototype.equals = XNodeSet.compareWith(Operators.equals);
			XNodeSet.prototype.notequal = XNodeSet.compareWith(Operators.notequal);
			XNodeSet.prototype.lessthan = XNodeSet.compareWith(Operators.lessthan);
			XNodeSet.prototype.greaterthan = XNodeSet.compareWith(Operators.greaterthan);
			XNodeSet.prototype.lessthanorequal = XNodeSet.compareWith(Operators.lessthanorequal);
			XNodeSet.prototype.greaterthanorequal = XNodeSet.compareWith(Operators.greaterthanorequal);
			XNodeSet.prototype.union = function(r) {
				var ns = new XNodeSet();
				ns.addArray(this.toUnsortedArray());
				ns.addArray(r.toUnsortedArray());
				return ns;
			};
			XPathNamespace.prototype = /* @__PURE__ */ new Object();
			XPathNamespace.prototype.constructor = XPathNamespace;
			XPathNamespace.superclass = Object.prototype;
			function XPathNamespace(pre, node, uri, p) {
				this.isXPathNamespace = true;
				this.baseNode = node;
				this.ownerDocument = p.ownerDocument;
				this.nodeName = pre;
				this.prefix = pre;
				this.localName = pre;
				this.namespaceURI = null;
				this.nodeValue = uri;
				this.ownerElement = p;
				this.nodeType = NodeTypes.NAMESPACE_NODE;
			}
			XPathNamespace.prototype.toString = function() {
				return "{ \"" + this.prefix + "\", \"" + this.namespaceURI + "\" }";
			};
			XPathContext.prototype = /* @__PURE__ */ new Object();
			XPathContext.prototype.constructor = XPathContext;
			XPathContext.superclass = Object.prototype;
			function XPathContext(vr, nr, fr) {
				this.variableResolver = vr != null ? vr : new VariableResolver();
				this.namespaceResolver = nr != null ? nr : new NamespaceResolver();
				this.functionResolver = fr != null ? fr : new FunctionResolver();
			}
			XPathContext.prototype.extend = function(newProps) {
				return assign$1(new XPathContext(), this, newProps);
			};
			VariableResolver.prototype = /* @__PURE__ */ new Object();
			VariableResolver.prototype.constructor = VariableResolver;
			VariableResolver.superclass = Object.prototype;
			function VariableResolver() {}
			VariableResolver.prototype.getVariable = function(ln, ns) {
				return null;
			};
			FunctionResolver.prototype = /* @__PURE__ */ new Object();
			FunctionResolver.prototype.constructor = FunctionResolver;
			FunctionResolver.superclass = Object.prototype;
			function FunctionResolver(thisArg) {
				this.thisArg = thisArg != null ? thisArg : Functions;
				this.functions = /* @__PURE__ */ new Object();
				this.addStandardFunctions();
			}
			FunctionResolver.prototype.addStandardFunctions = function() {
				this.functions["{}last"] = Functions.last;
				this.functions["{}position"] = Functions.position;
				this.functions["{}count"] = Functions.count;
				this.functions["{}id"] = Functions.id;
				this.functions["{}local-name"] = Functions.localName;
				this.functions["{}namespace-uri"] = Functions.namespaceURI;
				this.functions["{}name"] = Functions.name;
				this.functions["{}string"] = Functions.string;
				this.functions["{}concat"] = Functions.concat;
				this.functions["{}starts-with"] = Functions.startsWith;
				this.functions["{}contains"] = Functions.contains;
				this.functions["{}substring-before"] = Functions.substringBefore;
				this.functions["{}substring-after"] = Functions.substringAfter;
				this.functions["{}substring"] = Functions.substring;
				this.functions["{}string-length"] = Functions.stringLength;
				this.functions["{}normalize-space"] = Functions.normalizeSpace;
				this.functions["{}translate"] = Functions.translate;
				this.functions["{}boolean"] = Functions.boolean_;
				this.functions["{}not"] = Functions.not;
				this.functions["{}true"] = Functions.true_;
				this.functions["{}false"] = Functions.false_;
				this.functions["{}lang"] = Functions.lang;
				this.functions["{}number"] = Functions.number;
				this.functions["{}sum"] = Functions.sum;
				this.functions["{}floor"] = Functions.floor;
				this.functions["{}ceiling"] = Functions.ceiling;
				this.functions["{}round"] = Functions.round;
			};
			FunctionResolver.prototype.addFunction = function(ns, ln, f) {
				this.functions["{" + ns + "}" + ln] = f;
			};
			FunctionResolver.getFunctionFromContext = function(qName, context) {
				var parts = Utilities.resolveQName(qName, context.namespaceResolver, context.contextNode, false);
				if (parts[0] === null) throw new Error("Cannot resolve QName " + name);
				return context.functionResolver.getFunction(parts[1], parts[0]);
			};
			FunctionResolver.prototype.getFunction = function(localName, namespace) {
				return this.functions["{" + namespace + "}" + localName];
			};
			NamespaceResolver.prototype = /* @__PURE__ */ new Object();
			NamespaceResolver.prototype.constructor = NamespaceResolver;
			NamespaceResolver.superclass = Object.prototype;
			function NamespaceResolver() {}
			NamespaceResolver.prototype.getNamespace = function(prefix, n) {
				if (prefix == "xml") return XPath.XML_NAMESPACE_URI;
				else if (prefix == "xmlns") return XPath.XMLNS_NAMESPACE_URI;
				if (n.nodeType == NodeTypes.DOCUMENT_NODE) n = n.documentElement;
				else if (n.nodeType == NodeTypes.ATTRIBUTE_NODE) n = PathExpr.getOwnerElement(n);
				else if (n.nodeType != NodeTypes.ELEMENT_NODE) n = n.parentNode;
				while (n != null && n.nodeType == NodeTypes.ELEMENT_NODE) {
					var nnm = n.attributes;
					for (var i$1 = 0; i$1 < nnm.length; i$1++) {
						var a = nnm.item(i$1);
						var aname = a.name || a.nodeName;
						if (aname === "xmlns" && prefix === "" || aname === "xmlns:" + prefix) return String(a.value || a.nodeValue);
					}
					n = n.parentNode;
				}
				return null;
			};
			var Functions = /* @__PURE__ */ new Object();
			Functions.last = function(c) {
				if (arguments.length != 1) throw new Error("Function last expects ()");
				return new XNumber(c.contextSize);
			};
			Functions.position = function(c) {
				if (arguments.length != 1) throw new Error("Function position expects ()");
				return new XNumber(c.contextPosition);
			};
			Functions.count = function() {
				var c = arguments[0];
				var ns;
				if (arguments.length != 2 || !Utilities.instance_of(ns = arguments[1].evaluate(c), XNodeSet)) throw new Error("Function count expects (node-set)");
				return new XNumber(ns.size);
			};
			Functions.id = function() {
				var c = arguments[0];
				var id;
				if (arguments.length != 2) throw new Error("Function id expects (object)");
				id = arguments[1].evaluate(c);
				if (Utilities.instance_of(id, XNodeSet)) id = id.toArray().join(" ");
				else id = id.stringValue();
				var ids = id.split(/[\x0d\x0a\x09\x20]+/);
				var count = 0;
				var ns = new XNodeSet();
				var doc = c.contextNode.nodeType == NodeTypes.DOCUMENT_NODE ? c.contextNode : c.contextNode.ownerDocument;
				for (var i$1 = 0; i$1 < ids.length; i$1++) {
					var n;
					if (doc.getElementById) n = doc.getElementById(ids[i$1]);
					else n = Utilities.getElementById(doc, ids[i$1]);
					if (n != null) {
						ns.add(n);
						count++;
					}
				}
				return ns;
			};
			Functions.localName = function(c, eNode) {
				var n;
				if (arguments.length == 1) n = c.contextNode;
				else if (arguments.length == 2) n = eNode.evaluate(c).first();
				else throw new Error("Function local-name expects (node-set?)");
				if (n == null) return new XString("");
				return new XString(n.localName || n.baseName || n.target || n.nodeName || "");
			};
			Functions.namespaceURI = function() {
				var c = arguments[0];
				var n;
				if (arguments.length == 1) n = c.contextNode;
				else if (arguments.length == 2) n = arguments[1].evaluate(c).first();
				else throw new Error("Function namespace-uri expects (node-set?)");
				if (n == null) return new XString("");
				return new XString(n.namespaceURI || "");
			};
			Functions.name = function() {
				var c = arguments[0];
				var n;
				if (arguments.length == 1) n = c.contextNode;
				else if (arguments.length == 2) n = arguments[1].evaluate(c).first();
				else throw new Error("Function name expects (node-set?)");
				if (n == null) return new XString("");
				if (n.nodeType == NodeTypes.ELEMENT_NODE) return new XString(n.nodeName);
				else if (n.nodeType == NodeTypes.ATTRIBUTE_NODE) return new XString(n.name || n.nodeName);
				else if (n.nodeType === NodeTypes.PROCESSING_INSTRUCTION_NODE) return new XString(n.target || n.nodeName);
				else if (n.localName == null) return new XString("");
				else return new XString(n.localName);
			};
			Functions.string = function() {
				var c = arguments[0];
				if (arguments.length == 1) return new XString(XNodeSet.prototype.stringForNode(c.contextNode));
				else if (arguments.length == 2) return arguments[1].evaluate(c).string();
				throw new Error("Function string expects (object?)");
			};
			Functions.concat = function(c) {
				if (arguments.length < 3) throw new Error("Function concat expects (string, string[, string]*)");
				var s = "";
				for (var i$1 = 1; i$1 < arguments.length; i$1++) s += arguments[i$1].evaluate(c).stringValue();
				return new XString(s);
			};
			Functions.startsWith = function() {
				var c = arguments[0];
				if (arguments.length != 3) throw new Error("Function startsWith expects (string, string)");
				var s1 = arguments[1].evaluate(c).stringValue();
				var s2 = arguments[2].evaluate(c).stringValue();
				return new XBoolean(s1.substring(0, s2.length) == s2);
			};
			Functions.contains = function() {
				var c = arguments[0];
				if (arguments.length != 3) throw new Error("Function contains expects (string, string)");
				var s1 = arguments[1].evaluate(c).stringValue();
				var s2 = arguments[2].evaluate(c).stringValue();
				return new XBoolean(s1.indexOf(s2) !== -1);
			};
			Functions.substringBefore = function() {
				var c = arguments[0];
				if (arguments.length != 3) throw new Error("Function substring-before expects (string, string)");
				var s1 = arguments[1].evaluate(c).stringValue();
				var s2 = arguments[2].evaluate(c).stringValue();
				return new XString(s1.substring(0, s1.indexOf(s2)));
			};
			Functions.substringAfter = function() {
				var c = arguments[0];
				if (arguments.length != 3) throw new Error("Function substring-after expects (string, string)");
				var s1 = arguments[1].evaluate(c).stringValue();
				var s2 = arguments[2].evaluate(c).stringValue();
				if (s2.length == 0) return new XString(s1);
				var i$1 = s1.indexOf(s2);
				if (i$1 == -1) return new XString("");
				return new XString(s1.substring(i$1 + s2.length));
			};
			Functions.substring = function() {
				var c = arguments[0];
				if (!(arguments.length == 3 || arguments.length == 4)) throw new Error("Function substring expects (string, number, number?)");
				var s = arguments[1].evaluate(c).stringValue();
				var n1 = Math.round(arguments[2].evaluate(c).numberValue()) - 1;
				var n2 = arguments.length == 4 ? n1 + Math.round(arguments[3].evaluate(c).numberValue()) : void 0;
				return new XString(s.substring(n1, n2));
			};
			Functions.stringLength = function() {
				var c = arguments[0];
				var s;
				if (arguments.length == 1) s = XNodeSet.prototype.stringForNode(c.contextNode);
				else if (arguments.length == 2) s = arguments[1].evaluate(c).stringValue();
				else throw new Error("Function string-length expects (string?)");
				return new XNumber(s.length);
			};
			Functions.normalizeSpace = function() {
				var c = arguments[0];
				var s;
				if (arguments.length == 1) s = XNodeSet.prototype.stringForNode(c.contextNode);
				else if (arguments.length == 2) s = arguments[1].evaluate(c).stringValue();
				else throw new Error("Function normalize-space expects (string?)");
				var i$1 = 0;
				var j = s.length - 1;
				while (Utilities.isSpace(s.charCodeAt(j))) j--;
				var t = "";
				while (i$1 <= j && Utilities.isSpace(s.charCodeAt(i$1))) i$1++;
				while (i$1 <= j) if (Utilities.isSpace(s.charCodeAt(i$1))) {
					t += " ";
					while (i$1 <= j && Utilities.isSpace(s.charCodeAt(i$1))) i$1++;
				} else {
					t += s.charAt(i$1);
					i$1++;
				}
				return new XString(t);
			};
			Functions.translate = function(c, eValue, eFrom, eTo) {
				if (arguments.length != 4) throw new Error("Function translate expects (string, string, string)");
				var value = eValue.evaluate(c).stringValue();
				var from = eFrom.evaluate(c).stringValue();
				var to = eTo.evaluate(c).stringValue();
				var cMap = reduce(function(acc, ch, i$1) {
					if (!(ch in acc)) acc[ch] = i$1 > to.length ? "" : to[i$1];
					return acc;
				}, {}, from);
				return new XString(join("", map(function(ch) {
					return ch in cMap ? cMap[ch] : ch;
				}, value)));
			};
			Functions.boolean_ = function() {
				var c = arguments[0];
				if (arguments.length != 2) throw new Error("Function boolean expects (object)");
				return arguments[1].evaluate(c).bool();
			};
			Functions.not = function(c, eValue) {
				if (arguments.length != 2) throw new Error("Function not expects (object)");
				return eValue.evaluate(c).bool().not();
			};
			Functions.true_ = function() {
				if (arguments.length != 1) throw new Error("Function true expects ()");
				return XBoolean.true_;
			};
			Functions.false_ = function() {
				if (arguments.length != 1) throw new Error("Function false expects ()");
				return XBoolean.false_;
			};
			Functions.lang = function() {
				var c = arguments[0];
				if (arguments.length != 2) throw new Error("Function lang expects (string)");
				var lang;
				for (var n = c.contextNode; n != null && n.nodeType != NodeTypes.DOCUMENT_NODE; n = n.parentNode) {
					var a = n.getAttributeNS(XPath.XML_NAMESPACE_URI, "lang");
					if (a != null) {
						lang = String(a);
						break;
					}
				}
				if (lang == null) return XBoolean.false_;
				var s = arguments[1].evaluate(c).stringValue();
				return new XBoolean(lang.substring(0, s.length) == s && (lang.length == s.length || lang.charAt(s.length) == "-"));
			};
			Functions.number = function() {
				var c = arguments[0];
				if (!(arguments.length == 1 || arguments.length == 2)) throw new Error("Function number expects (object?)");
				if (arguments.length == 1) return new XNumber(XNodeSet.prototype.stringForNode(c.contextNode));
				return arguments[1].evaluate(c).number();
			};
			Functions.sum = function() {
				var c = arguments[0];
				var ns;
				if (arguments.length != 2 || !Utilities.instance_of(ns = arguments[1].evaluate(c), XNodeSet)) throw new Error("Function sum expects (node-set)");
				ns = ns.toUnsortedArray();
				var n = 0;
				for (var i$1 = 0; i$1 < ns.length; i$1++) n += new XNumber(XNodeSet.prototype.stringForNode(ns[i$1])).numberValue();
				return new XNumber(n);
			};
			Functions.floor = function() {
				var c = arguments[0];
				if (arguments.length != 2) throw new Error("Function floor expects (number)");
				return new XNumber(Math.floor(arguments[1].evaluate(c).numberValue()));
			};
			Functions.ceiling = function() {
				var c = arguments[0];
				if (arguments.length != 2) throw new Error("Function ceiling expects (number)");
				return new XNumber(Math.ceil(arguments[1].evaluate(c).numberValue()));
			};
			Functions.round = function() {
				var c = arguments[0];
				if (arguments.length != 2) throw new Error("Function round expects (number)");
				return new XNumber(Math.round(arguments[1].evaluate(c).numberValue()));
			};
			var Utilities = /* @__PURE__ */ new Object();
			var isAttributeLike = function(val) {
				return val && (val.nodeType === NodeTypes.ATTRIBUTE_NODE || val.ownerElement || val.isXPathNamespace);
			};
			Utilities.splitQName = function(qn) {
				var i$1 = qn.indexOf(":");
				if (i$1 == -1) return [null, qn];
				return [qn.substring(0, i$1), qn.substring(i$1 + 1)];
			};
			Utilities.resolveQName = function(qn, nr, n, useDefault) {
				var parts = Utilities.splitQName(qn);
				if (parts[0] != null) parts[0] = nr.getNamespace(parts[0], n);
				else if (useDefault) {
					parts[0] = nr.getNamespace("", n);
					if (parts[0] == null) parts[0] = "";
				} else parts[0] = "";
				return parts;
			};
			Utilities.isSpace = function(c) {
				return c == 9 || c == 13 || c == 10 || c == 32;
			};
			Utilities.isLetter = function(c) {
				return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 255 || c >= 256 && c <= 305 || c >= 308 && c <= 318 || c >= 321 && c <= 328 || c >= 330 && c <= 382 || c >= 384 && c <= 451 || c >= 461 && c <= 496 || c >= 500 && c <= 501 || c >= 506 && c <= 535 || c >= 592 && c <= 680 || c >= 699 && c <= 705 || c == 902 || c >= 904 && c <= 906 || c == 908 || c >= 910 && c <= 929 || c >= 931 && c <= 974 || c >= 976 && c <= 982 || c == 986 || c == 988 || c == 990 || c == 992 || c >= 994 && c <= 1011 || c >= 1025 && c <= 1036 || c >= 1038 && c <= 1103 || c >= 1105 && c <= 1116 || c >= 1118 && c <= 1153 || c >= 1168 && c <= 1220 || c >= 1223 && c <= 1224 || c >= 1227 && c <= 1228 || c >= 1232 && c <= 1259 || c >= 1262 && c <= 1269 || c >= 1272 && c <= 1273 || c >= 1329 && c <= 1366 || c == 1369 || c >= 1377 && c <= 1414 || c >= 1488 && c <= 1514 || c >= 1520 && c <= 1522 || c >= 1569 && c <= 1594 || c >= 1601 && c <= 1610 || c >= 1649 && c <= 1719 || c >= 1722 && c <= 1726 || c >= 1728 && c <= 1742 || c >= 1744 && c <= 1747 || c == 1749 || c >= 1765 && c <= 1766 || c >= 2309 && c <= 2361 || c == 2365 || c >= 2392 && c <= 2401 || c >= 2437 && c <= 2444 || c >= 2447 && c <= 2448 || c >= 2451 && c <= 2472 || c >= 2474 && c <= 2480 || c == 2482 || c >= 2486 && c <= 2489 || c >= 2524 && c <= 2525 || c >= 2527 && c <= 2529 || c >= 2544 && c <= 2545 || c >= 2565 && c <= 2570 || c >= 2575 && c <= 2576 || c >= 2579 && c <= 2600 || c >= 2602 && c <= 2608 || c >= 2610 && c <= 2611 || c >= 2613 && c <= 2614 || c >= 2616 && c <= 2617 || c >= 2649 && c <= 2652 || c == 2654 || c >= 2674 && c <= 2676 || c >= 2693 && c <= 2699 || c == 2701 || c >= 2703 && c <= 2705 || c >= 2707 && c <= 2728 || c >= 2730 && c <= 2736 || c >= 2738 && c <= 2739 || c >= 2741 && c <= 2745 || c == 2749 || c == 2784 || c >= 2821 && c <= 2828 || c >= 2831 && c <= 2832 || c >= 2835 && c <= 2856 || c >= 2858 && c <= 2864 || c >= 2866 && c <= 2867 || c >= 2870 && c <= 2873 || c == 2877 || c >= 2908 && c <= 2909 || c >= 2911 && c <= 2913 || c >= 2949 && c <= 2954 || c >= 2958 && c <= 2960 || c >= 2962 && c <= 2965 || c >= 2969 && c <= 2970 || c == 2972 || c >= 2974 && c <= 2975 || c >= 2979 && c <= 2980 || c >= 2984 && c <= 2986 || c >= 2990 && c <= 2997 || c >= 2999 && c <= 3001 || c >= 3077 && c <= 3084 || c >= 3086 && c <= 3088 || c >= 3090 && c <= 3112 || c >= 3114 && c <= 3123 || c >= 3125 && c <= 3129 || c >= 3168 && c <= 3169 || c >= 3205 && c <= 3212 || c >= 3214 && c <= 3216 || c >= 3218 && c <= 3240 || c >= 3242 && c <= 3251 || c >= 3253 && c <= 3257 || c == 3294 || c >= 3296 && c <= 3297 || c >= 3333 && c <= 3340 || c >= 3342 && c <= 3344 || c >= 3346 && c <= 3368 || c >= 3370 && c <= 3385 || c >= 3424 && c <= 3425 || c >= 3585 && c <= 3630 || c == 3632 || c >= 3634 && c <= 3635 || c >= 3648 && c <= 3653 || c >= 3713 && c <= 3714 || c == 3716 || c >= 3719 && c <= 3720 || c == 3722 || c == 3725 || c >= 3732 && c <= 3735 || c >= 3737 && c <= 3743 || c >= 3745 && c <= 3747 || c == 3749 || c == 3751 || c >= 3754 && c <= 3755 || c >= 3757 && c <= 3758 || c == 3760 || c >= 3762 && c <= 3763 || c == 3773 || c >= 3776 && c <= 3780 || c >= 3904 && c <= 3911 || c >= 3913 && c <= 3945 || c >= 4256 && c <= 4293 || c >= 4304 && c <= 4342 || c == 4352 || c >= 4354 && c <= 4355 || c >= 4357 && c <= 4359 || c == 4361 || c >= 4363 && c <= 4364 || c >= 4366 && c <= 4370 || c == 4412 || c == 4414 || c == 4416 || c == 4428 || c == 4430 || c == 4432 || c >= 4436 && c <= 4437 || c == 4441 || c >= 4447 && c <= 4449 || c == 4451 || c == 4453 || c == 4455 || c == 4457 || c >= 4461 && c <= 4462 || c >= 4466 && c <= 4467 || c == 4469 || c == 4510 || c == 4520 || c == 4523 || c >= 4526 && c <= 4527 || c >= 4535 && c <= 4536 || c == 4538 || c >= 4540 && c <= 4546 || c == 4587 || c == 4592 || c == 4601 || c >= 7680 && c <= 7835 || c >= 7840 && c <= 7929 || c >= 7936 && c <= 7957 || c >= 7960 && c <= 7965 || c >= 7968 && c <= 8005 || c >= 8008 && c <= 8013 || c >= 8016 && c <= 8023 || c == 8025 || c == 8027 || c == 8029 || c >= 8031 && c <= 8061 || c >= 8064 && c <= 8116 || c >= 8118 && c <= 8124 || c == 8126 || c >= 8130 && c <= 8132 || c >= 8134 && c <= 8140 || c >= 8144 && c <= 8147 || c >= 8150 && c <= 8155 || c >= 8160 && c <= 8172 || c >= 8178 && c <= 8180 || c >= 8182 && c <= 8188 || c == 8486 || c >= 8490 && c <= 8491 || c == 8494 || c >= 8576 && c <= 8578 || c >= 12353 && c <= 12436 || c >= 12449 && c <= 12538 || c >= 12549 && c <= 12588 || c >= 44032 && c <= 55203 || c >= 19968 && c <= 40869 || c == 12295 || c >= 12321 && c <= 12329;
			};
			Utilities.isNCNameChar = function(c) {
				return c >= 48 && c <= 57 || c >= 1632 && c <= 1641 || c >= 1776 && c <= 1785 || c >= 2406 && c <= 2415 || c >= 2534 && c <= 2543 || c >= 2662 && c <= 2671 || c >= 2790 && c <= 2799 || c >= 2918 && c <= 2927 || c >= 3047 && c <= 3055 || c >= 3174 && c <= 3183 || c >= 3302 && c <= 3311 || c >= 3430 && c <= 3439 || c >= 3664 && c <= 3673 || c >= 3792 && c <= 3801 || c >= 3872 && c <= 3881 || c == 46 || c == 45 || c == 95 || Utilities.isLetter(c) || c >= 768 && c <= 837 || c >= 864 && c <= 865 || c >= 1155 && c <= 1158 || c >= 1425 && c <= 1441 || c >= 1443 && c <= 1465 || c >= 1467 && c <= 1469 || c == 1471 || c >= 1473 && c <= 1474 || c == 1476 || c >= 1611 && c <= 1618 || c == 1648 || c >= 1750 && c <= 1756 || c >= 1757 && c <= 1759 || c >= 1760 && c <= 1764 || c >= 1767 && c <= 1768 || c >= 1770 && c <= 1773 || c >= 2305 && c <= 2307 || c == 2364 || c >= 2366 && c <= 2380 || c == 2381 || c >= 2385 && c <= 2388 || c >= 2402 && c <= 2403 || c >= 2433 && c <= 2435 || c == 2492 || c == 2494 || c == 2495 || c >= 2496 && c <= 2500 || c >= 2503 && c <= 2504 || c >= 2507 && c <= 2509 || c == 2519 || c >= 2530 && c <= 2531 || c == 2562 || c == 2620 || c == 2622 || c == 2623 || c >= 2624 && c <= 2626 || c >= 2631 && c <= 2632 || c >= 2635 && c <= 2637 || c >= 2672 && c <= 2673 || c >= 2689 && c <= 2691 || c == 2748 || c >= 2750 && c <= 2757 || c >= 2759 && c <= 2761 || c >= 2763 && c <= 2765 || c >= 2817 && c <= 2819 || c == 2876 || c >= 2878 && c <= 2883 || c >= 2887 && c <= 2888 || c >= 2891 && c <= 2893 || c >= 2902 && c <= 2903 || c >= 2946 && c <= 2947 || c >= 3006 && c <= 3010 || c >= 3014 && c <= 3016 || c >= 3018 && c <= 3021 || c == 3031 || c >= 3073 && c <= 3075 || c >= 3134 && c <= 3140 || c >= 3142 && c <= 3144 || c >= 3146 && c <= 3149 || c >= 3157 && c <= 3158 || c >= 3202 && c <= 3203 || c >= 3262 && c <= 3268 || c >= 3270 && c <= 3272 || c >= 3274 && c <= 3277 || c >= 3285 && c <= 3286 || c >= 3330 && c <= 3331 || c >= 3390 && c <= 3395 || c >= 3398 && c <= 3400 || c >= 3402 && c <= 3405 || c == 3415 || c == 3633 || c >= 3636 && c <= 3642 || c >= 3655 && c <= 3662 || c == 3761 || c >= 3764 && c <= 3769 || c >= 3771 && c <= 3772 || c >= 3784 && c <= 3789 || c >= 3864 && c <= 3865 || c == 3893 || c == 3895 || c == 3897 || c == 3902 || c == 3903 || c >= 3953 && c <= 3972 || c >= 3974 && c <= 3979 || c >= 3984 && c <= 3989 || c == 3991 || c >= 3993 && c <= 4013 || c >= 4017 && c <= 4023 || c == 4025 || c >= 8400 && c <= 8412 || c == 8417 || c >= 12330 && c <= 12335 || c == 12441 || c == 12442 || c == 183 || c == 720 || c == 721 || c == 903 || c == 1600 || c == 3654 || c == 3782 || c == 12293 || c >= 12337 && c <= 12341 || c >= 12445 && c <= 12446 || c >= 12540 && c <= 12542;
			};
			Utilities.coalesceText = function(n) {
				for (var m = n.firstChild; m != null; m = m.nextSibling) if (m.nodeType == NodeTypes.TEXT_NODE || m.nodeType == NodeTypes.CDATA_SECTION_NODE) {
					var s = m.nodeValue;
					var first = m;
					m = m.nextSibling;
					while (m != null && (m.nodeType == NodeTypes.TEXT_NODE || m.nodeType == NodeTypes.CDATA_SECTION_NODE)) {
						s += m.nodeValue;
						var del = m;
						m = m.nextSibling;
						del.parentNode.removeChild(del);
					}
					if (first.nodeType == NodeTypes.CDATA_SECTION_NODE) {
						var p = first.parentNode;
						if (first.nextSibling == null) {
							p.removeChild(first);
							p.appendChild(p.ownerDocument.createTextNode(s));
						} else {
							var next = first.nextSibling;
							p.removeChild(first);
							p.insertBefore(p.ownerDocument.createTextNode(s), next);
						}
					} else first.nodeValue = s;
					if (m == null) break;
				} else if (m.nodeType == NodeTypes.ELEMENT_NODE) Utilities.coalesceText(m);
			};
			Utilities.instance_of = function(o, c) {
				while (o != null) {
					if (o.constructor === c) return true;
					if (o === Object) return false;
					o = o.constructor.superclass;
				}
				return false;
			};
			Utilities.getElementById = function(n, id) {
				if (n.nodeType == NodeTypes.ELEMENT_NODE) {
					if (n.getAttribute("id") == id || n.getAttributeNS(null, "id") == id) return n;
				}
				for (var m = n.firstChild; m != null; m = m.nextSibling) {
					var res = Utilities.getElementById(m, id);
					if (res != null) return res;
				}
				return null;
			};
			var XPathException = (function() {
				function getMessage(code, exception) {
					var msg = exception ? ": " + exception.toString() : "";
					switch (code) {
						case XPathException$1.INVALID_EXPRESSION_ERR: return "Invalid expression" + msg;
						case XPathException$1.TYPE_ERR: return "Type error" + msg;
					}
					return null;
				}
				function XPathException$1(code, error, message) {
					var err = Error.call(this, getMessage(code, error) || message);
					err.code = code;
					err.exception = error;
					return err;
				}
				XPathException$1.prototype = Object.create(Error.prototype);
				XPathException$1.prototype.constructor = XPathException$1;
				XPathException$1.superclass = Error;
				XPathException$1.prototype.toString = function() {
					return this.message;
				};
				XPathException$1.fromMessage = function(message, error) {
					return new XPathException$1(null, error, message);
				};
				XPathException$1.INVALID_EXPRESSION_ERR = 51;
				XPathException$1.TYPE_ERR = 52;
				return XPathException$1;
			})();
			XPathExpression.prototype = {};
			XPathExpression.prototype.constructor = XPathExpression;
			XPathExpression.superclass = Object.prototype;
			function XPathExpression(e, r, p) {
				this.xpath = p.parse(e);
				this.context = new XPathContext();
				this.context.namespaceResolver = new XPathNSResolverWrapper(r);
			}
			XPathExpression.getOwnerDocument = function(n) {
				return n.nodeType === NodeTypes.DOCUMENT_NODE ? n : n.ownerDocument;
			};
			XPathExpression.detectHtmlDom = function(n) {
				if (!n) return false;
				var doc = XPathExpression.getOwnerDocument(n);
				try {
					return doc.implementation.hasFeature("HTML", "2.0");
				} catch (e) {
					return true;
				}
			};
			XPathExpression.prototype.evaluate = function(n, t, res) {
				this.context.expressionContextNode = n;
				this.context.caseInsensitive = XPathExpression.detectHtmlDom(n);
				return new XPathResult(this.xpath.evaluate(this.context), t);
			};
			XPathNSResolverWrapper.prototype = {};
			XPathNSResolverWrapper.prototype.constructor = XPathNSResolverWrapper;
			XPathNSResolverWrapper.superclass = Object.prototype;
			function XPathNSResolverWrapper(r) {
				this.xpathNSResolver = r;
			}
			XPathNSResolverWrapper.prototype.getNamespace = function(prefix, n) {
				if (this.xpathNSResolver == null) return null;
				return this.xpathNSResolver.lookupNamespaceURI(prefix);
			};
			NodeXPathNSResolver.prototype = {};
			NodeXPathNSResolver.prototype.constructor = NodeXPathNSResolver;
			NodeXPathNSResolver.superclass = Object.prototype;
			function NodeXPathNSResolver(n) {
				this.node = n;
				this.namespaceResolver = new NamespaceResolver();
			}
			NodeXPathNSResolver.prototype.lookupNamespaceURI = function(prefix) {
				return this.namespaceResolver.getNamespace(prefix, this.node);
			};
			XPathResult.prototype = {};
			XPathResult.prototype.constructor = XPathResult;
			XPathResult.superclass = Object.prototype;
			function XPathResult(v, t) {
				if (t == XPathResult.ANY_TYPE) {
					if (v.constructor === XString) t = XPathResult.STRING_TYPE;
					else if (v.constructor === XNumber) t = XPathResult.NUMBER_TYPE;
					else if (v.constructor === XBoolean) t = XPathResult.BOOLEAN_TYPE;
					else if (v.constructor === XNodeSet) t = XPathResult.UNORDERED_NODE_ITERATOR_TYPE;
				}
				this.resultType = t;
				switch (t) {
					case XPathResult.NUMBER_TYPE:
						this.numberValue = v.numberValue();
						return;
					case XPathResult.STRING_TYPE:
						this.stringValue = v.stringValue();
						return;
					case XPathResult.BOOLEAN_TYPE:
						this.booleanValue = v.booleanValue();
						return;
					case XPathResult.ANY_UNORDERED_NODE_TYPE:
					case XPathResult.FIRST_ORDERED_NODE_TYPE:
						if (v.constructor === XNodeSet) {
							this.singleNodeValue = v.first();
							return;
						}
						break;
					case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
					case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
						if (v.constructor === XNodeSet) {
							this.invalidIteratorState = false;
							this.nodes = v.toArray();
							this.iteratorIndex = 0;
							return;
						}
						break;
					case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
					case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
						if (v.constructor === XNodeSet) {
							this.nodes = v.toArray();
							this.snapshotLength = this.nodes.length;
							return;
						}
						break;
				}
				throw new XPathException(XPathException.TYPE_ERR);
			}
			XPathResult.prototype.iterateNext = function() {
				if (this.resultType != XPathResult.UNORDERED_NODE_ITERATOR_TYPE && this.resultType != XPathResult.ORDERED_NODE_ITERATOR_TYPE) throw new XPathException(XPathException.TYPE_ERR);
				return this.nodes[this.iteratorIndex++];
			};
			XPathResult.prototype.snapshotItem = function(i$1) {
				if (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE && this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) throw new XPathException(XPathException.TYPE_ERR);
				return this.nodes[i$1];
			};
			XPathResult.ANY_TYPE = 0;
			XPathResult.NUMBER_TYPE = 1;
			XPathResult.STRING_TYPE = 2;
			XPathResult.BOOLEAN_TYPE = 3;
			XPathResult.UNORDERED_NODE_ITERATOR_TYPE = 4;
			XPathResult.ORDERED_NODE_ITERATOR_TYPE = 5;
			XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE = 6;
			XPathResult.ORDERED_NODE_SNAPSHOT_TYPE = 7;
			XPathResult.ANY_UNORDERED_NODE_TYPE = 8;
			XPathResult.FIRST_ORDERED_NODE_TYPE = 9;
			function installDOM3XPathSupport(doc, p) {
				doc.createExpression = function(e, r) {
					try {
						return new XPathExpression(e, r, p);
					} catch (e$1) {
						throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, e$1);
					}
				};
				doc.createNSResolver = function(n) {
					return new NodeXPathNSResolver(n);
				};
				doc.evaluate = function(e, cn, r, t, res) {
					if (t < 0 || t > 9) throw {
						code: 0,
						toString: function() {
							return "Request type not supported";
						}
					};
					return doc.createExpression(e, r, p).evaluate(cn, t, res);
				};
			}
			try {
				var shouldInstall = true;
				try {
					if (document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("XPath", null)) shouldInstall = false;
				} catch (e) {}
				if (shouldInstall) installDOM3XPathSupport(document, new XPathParser());
			} catch (e) {}
			installDOM3XPathSupport(exports$1$1, new XPathParser());
			(function() {
				var parser = new XPathParser();
				var defaultNSResolver = new NamespaceResolver();
				var defaultFunctionResolver = new FunctionResolver();
				var defaultVariableResolver = new VariableResolver();
				function makeNSResolverFromFunction(func) {
					return { getNamespace: function(prefix, node) {
						return func(prefix, node) || defaultNSResolver.getNamespace(prefix, node);
					} };
				}
				function makeNSResolverFromObject(obj) {
					return makeNSResolverFromFunction(obj.getNamespace.bind(obj));
				}
				function makeNSResolverFromMap(map$1) {
					return makeNSResolverFromFunction(function(prefix) {
						return map$1[prefix];
					});
				}
				function makeNSResolver(resolver) {
					if (resolver && typeof resolver.getNamespace === "function") return makeNSResolverFromObject(resolver);
					if (typeof resolver === "function") return makeNSResolverFromFunction(resolver);
					if (typeof resolver === "object") return makeNSResolverFromMap(resolver);
					return defaultNSResolver;
				}
				/** Converts native JavaScript types to their XPath library equivalent */
				function convertValue(value) {
					if (value === null || typeof value === "undefined" || value instanceof XString || value instanceof XBoolean || value instanceof XNumber || value instanceof XNodeSet) return value;
					switch (typeof value) {
						case "string": return new XString(value);
						case "boolean": return new XBoolean(value);
						case "number": return new XNumber(value);
					}
					var ns = new XNodeSet();
					ns.addArray([].concat(value));
					return ns;
				}
				function makeEvaluator(func) {
					return function(context) {
						var args = Array.prototype.slice.call(arguments, 1).map(function(arg) {
							return arg.evaluate(context);
						});
						return convertValue(func.apply(this, [].concat(context, args)));
					};
				}
				function makeFunctionResolverFromFunction(func) {
					return { getFunction: function(name$1, namespace) {
						var found = func(name$1, namespace);
						if (found) return makeEvaluator(found);
						return defaultFunctionResolver.getFunction(name$1, namespace);
					} };
				}
				function makeFunctionResolverFromObject(obj) {
					return makeFunctionResolverFromFunction(obj.getFunction.bind(obj));
				}
				function makeFunctionResolverFromMap(map$1) {
					return makeFunctionResolverFromFunction(function(name$1) {
						return map$1[name$1];
					});
				}
				function makeFunctionResolver(resolver) {
					if (resolver && typeof resolver.getFunction === "function") return makeFunctionResolverFromObject(resolver);
					if (typeof resolver === "function") return makeFunctionResolverFromFunction(resolver);
					if (typeof resolver === "object") return makeFunctionResolverFromMap(resolver);
					return defaultFunctionResolver;
				}
				function makeVariableResolverFromFunction(func) {
					return { getVariable: function(name$1, namespace) {
						return convertValue(func(name$1, namespace));
					} };
				}
				function makeVariableResolver(resolver) {
					if (resolver) {
						if (typeof resolver.getVariable === "function") return makeVariableResolverFromFunction(resolver.getVariable.bind(resolver));
						if (typeof resolver === "function") return makeVariableResolverFromFunction(resolver);
						if (typeof resolver === "object") return makeVariableResolverFromFunction(function(name$1) {
							return resolver[name$1];
						});
					}
					return defaultVariableResolver;
				}
				function copyIfPresent(prop, dest, source) {
					if (prop in source) dest[prop] = source[prop];
				}
				function makeContext(options) {
					var context = new XPathContext();
					if (options) {
						context.namespaceResolver = makeNSResolver(options.namespaces);
						context.functionResolver = makeFunctionResolver(options.functions);
						context.variableResolver = makeVariableResolver(options.variables);
						context.expressionContextNode = options.node;
						copyIfPresent("allowAnyNamespaceForNoPrefix", context, options);
						copyIfPresent("isHtml", context, options);
					} else context.namespaceResolver = defaultNSResolver;
					return context;
				}
				function evaluate(parsedExpression, options) {
					var context = makeContext(options);
					return parsedExpression.evaluate(context);
				}
				var evaluatorPrototype = {
					evaluate: function(options) {
						return evaluate(this.expression, options);
					},
					evaluateNumber: function(options) {
						return this.evaluate(options).numberValue();
					},
					evaluateString: function(options) {
						return this.evaluate(options).stringValue();
					},
					evaluateBoolean: function(options) {
						return this.evaluate(options).booleanValue();
					},
					evaluateNodeSet: function(options) {
						return this.evaluate(options).nodeset();
					},
					select: function(options) {
						return this.evaluateNodeSet(options).toArray();
					},
					select1: function(options) {
						return this.select(options)[0];
					}
				};
				function parse$1(xpath$1) {
					var parsed = parser.parse(xpath$1);
					return Object.create(evaluatorPrototype, { expression: { value: parsed } });
				}
				exports$1$1.parse = parse$1;
			})();
			assign$1(exports$1$1, {
				XPath,
				XPathParser,
				XPathResult,
				Step,
				PathExpr,
				NodeTest,
				LocationPath,
				OrOperation,
				AndOperation,
				BarOperation,
				EqualsOperation,
				NotEqualOperation,
				LessThanOperation,
				GreaterThanOperation,
				LessThanOrEqualOperation,
				GreaterThanOrEqualOperation,
				PlusOperation,
				MinusOperation,
				MultiplyOperation,
				DivOperation,
				ModOperation,
				UnaryMinusOperation,
				FunctionCall,
				VariableReference,
				XPathContext,
				XNodeSet,
				XBoolean,
				XString,
				XNumber,
				NamespaceResolver,
				FunctionResolver,
				VariableResolver,
				Utilities
			});
			exports$1$1.select = function(e, doc, single) {
				return exports$1$1.selectWithResolver(e, doc, null, single);
			};
			exports$1$1.useNamespaces = function(mappings) {
				var resolver = {
					mappings: mappings || {},
					lookupNamespaceURI: function(prefix) {
						return this.mappings[prefix];
					}
				};
				return function(e, doc, single) {
					return exports$1$1.selectWithResolver(e, doc, resolver, single);
				};
			};
			exports$1$1.selectWithResolver = function(e, doc, resolver, single) {
				var expression = new XPathExpression(e, resolver, new XPathParser());
				var type = XPathResult.ANY_TYPE;
				var result = expression.evaluate(doc, type, null);
				if (result.resultType == XPathResult.STRING_TYPE) result = result.stringValue;
				else if (result.resultType == XPathResult.NUMBER_TYPE) result = result.numberValue;
				else if (result.resultType == XPathResult.BOOLEAN_TYPE) result = result.booleanValue;
				else {
					result = result.nodes;
					if (single) result = result[0];
				}
				return result;
			};
			exports$1$1.select1 = function(e, doc) {
				return exports$1$1.select(e, doc, true);
			};
			var isArrayOfNodes = function(value) {
				return Array.isArray(value) && value.every(isNodeLike);
			};
			var isNodeOfType = function(type) {
				return function(value) {
					return isNodeLike(value) && value.nodeType === type;
				};
			};
			assign$1(exports$1$1, {
				isNodeLike,
				isArrayOfNodes,
				isElement: isNodeOfType(NodeTypes.ELEMENT_NODE),
				isAttribute: isNodeOfType(NodeTypes.ATTRIBUTE_NODE),
				isTextNode: isNodeOfType(NodeTypes.TEXT_NODE),
				isCDATASection: isNodeOfType(NodeTypes.CDATA_SECTION_NODE),
				isProcessingInstruction: isNodeOfType(NodeTypes.PROCESSING_INSTRUCTION_NODE),
				isComment: isNodeOfType(NodeTypes.COMMENT_NODE),
				isDocumentNode: isNodeOfType(NodeTypes.DOCUMENT_NODE),
				isDocumentTypeNode: isNodeOfType(NodeTypes.DOCUMENT_TYPE_NODE),
				isDocumentFragment: isNodeOfType(NodeTypes.DOCUMENT_FRAGMENT_NODE)
			});
		})(typeof exports$1 === "undefined" ? {} : exports$1);
	}) });
	var import_lib = /* @__PURE__ */ __toESM(require_lib());
	var import_xpath = /* @__PURE__ */ __toESM(require_xpath());
	function filterXPath$1(body, path, result, join) {
		const doc = new import_lib.DOMParser().parseFromString(body, "text/xml");
		const items = import_xpath.default.select(path, doc, false);
		if (!Array.isArray(items)) return String(items);
		if (!Array.isArray(items) || result === "first") return items[0] != null ? String(items[0].firstChild ?? "") : "";
		if (result === "join") return items.map((item) => String(item.firstChild ?? "")).join(join ?? "");
		return String(items);
	}
	exports.filterXPath = filterXPath$1;
}) });

//#endregion
//#region src/index.ts
var import_build = /* @__PURE__ */ __toESM$2(require_build$1());
var import_build$1 = /* @__PURE__ */ __toESM$2(require_build());
const RETURN_FIRST = "first";
const RETURN_ALL = "all";
const RETURN_JOIN = "join";
const plugin = { templateFunctions: [
	{
		name: "request.body.raw",
		aliases: ["request.body"],
		args: [{
			name: "requestId",
			label: "Http Request",
			type: "http_request"
		}],
		async onRender(ctx, args) {
			const requestId = String(args.values.requestId ?? "n/a");
			const httpRequest = await ctx.httpRequest.getById({ id: requestId });
			if (httpRequest == null) return null;
			return String(await ctx.templates.render({
				data: httpRequest.body?.text ?? "",
				purpose: args.purpose
			}));
		}
	},
	{
		name: "request.body.path",
		previewArgs: ["path"],
		args: [
			{
				name: "requestId",
				label: "Http Request",
				type: "http_request"
			},
			{
				type: "h_stack",
				inputs: [{
					type: "select",
					name: "result",
					label: "Return Format",
					defaultValue: RETURN_FIRST,
					options: [
						{
							label: "First result",
							value: RETURN_FIRST
						},
						{
							label: "All results",
							value: RETURN_ALL
						},
						{
							label: "Join with separator",
							value: RETURN_JOIN
						}
					]
				}, {
					name: "join",
					type: "text",
					label: "Separator",
					optional: true,
					defaultValue: ", ",
					dynamic(_ctx, args) {
						return { hidden: args.values.result !== RETURN_JOIN };
					}
				}]
			},
			{
				type: "text",
				name: "path",
				label: "JSONPath or XPath",
				placeholder: "$.books[0].id or /books[0]/id",
				dynamic: async (ctx, args) => {
					const requestId = String(args.values.requestId ?? "n/a");
					const httpRequest = await ctx.httpRequest.getById({ id: requestId });
					if (httpRequest == null) return null;
					const contentType = httpRequest.headers.find((h) => h.name.toLowerCase() === "content-type")?.value.toLowerCase() ?? "";
					if (contentType.includes("xml") || contentType?.includes("html")) return {
						label: "XPath",
						placeholder: "/books[0]/id",
						description: "Enter an XPath expression used to filter the results"
					};
					return {
						label: "JSONPath",
						placeholder: "$.books[0].id",
						description: "Enter a JSONPath expression used to filter the results"
					};
				}
			}
		],
		async onRender(ctx, args) {
			const requestId = String(args.values.requestId ?? "n/a");
			const httpRequest = await ctx.httpRequest.getById({ id: requestId });
			if (httpRequest == null) return null;
			const body = httpRequest.body?.text ?? "";
			try {
				const result = args.values.result === RETURN_ALL ? "all" : args.values.result === RETURN_JOIN ? "join" : "first";
				return (0, import_build.filterJSONPath)(body, String(args.values.path || ""), result, args.values.join == null ? null : String(args.values.join));
			} catch {}
			try {
				const result = args.values.result === RETURN_ALL ? "all" : args.values.result === RETURN_JOIN ? "join" : "first";
				return (0, import_build$1.filterXPath)(body, String(args.values.path || ""), result, args.values.join == null ? null : String(args.values.join));
			} catch {}
			return null;
		}
	},
	{
		name: "request.header",
		description: "Read the value of a request header, by name",
		previewArgs: ["header"],
		args: [{
			name: "requestId",
			label: "Http Request",
			type: "http_request"
		}, {
			name: "header",
			label: "Header Name",
			type: "text",
			async dynamic(ctx, args) {
				if (typeof args.values.requestId !== "string") return null;
				const request = await ctx.httpRequest.getById({ id: args.values.requestId });
				if (request == null) return null;
				const validHeaders = request.headers.filter((h) => h.enabled !== false && h.name);
				return {
					placeholder: validHeaders[0]?.name,
					completionOptions: validHeaders.map((h) => ({
						label: h.name,
						type: "constant"
					}))
				};
			}
		}],
		async onRender(ctx, args) {
			const headerName = String(args.values.header ?? "");
			const requestId = String(args.values.requestId ?? "n/a");
			const httpRequest = await ctx.httpRequest.getById({ id: requestId });
			if (httpRequest == null) return null;
			const header = httpRequest.headers.find((h) => h.name.toLowerCase() === headerName.toLowerCase());
			return String(await ctx.templates.render({
				data: header?.value ?? "",
				purpose: args.purpose
			}));
		}
	},
	{
		name: "request.param",
		args: [{
			name: "requestId",
			label: "Http Request",
			type: "http_request"
		}, {
			name: "param",
			label: "Param Name",
			type: "text"
		}],
		async onRender(ctx, args) {
			const paramName = String(args.values.param ?? "");
			const requestId = String(args.values.requestId ?? "n/a");
			const httpRequest = await ctx.httpRequest.getById({ id: requestId });
			if (httpRequest == null) return null;
			const querystring = (await ctx.templates.render({
				data: httpRequest.url,
				purpose: args.purpose
			})).split("?")[1] ?? "";
			const foundParam = [...new URLSearchParams(querystring).entries().map(([name$1, value]) => ({
				name: name$1,
				value
			})).toArray(), ...httpRequest.urlParameters].filter((p) => p.enabled !== false).find((p) => p.name === paramName);
			return await ctx.templates.render({
				data: foundParam?.value ?? "",
				purpose: args.purpose
			});
		}
	},
	{
		name: "request.name",
		args: [{
			name: "requestId",
			label: "Http Request",
			type: "http_request"
		}],
		async onRender(ctx, args) {
			const requestId = String(args.values.requestId ?? "n/a");
			const httpRequest = await ctx.httpRequest.getById({ id: requestId });
			if (httpRequest == null) return null;
			return resolvedModelName(httpRequest);
		}
	}
] };
function resolvedModelName(r) {
	if (r == null) return "";
	if (!("url" in r) || r.model === "plugin") return "name" in r ? r.name : "";
	if ("name" in r && r.name) return r.name;
	const withoutVariables = r.url.replace(/\$\{\[\s*([^\]\s]+)\s*]}/g, "$1");
	if (withoutVariables.trim() === "") return r.model === "http_request" ? r.bodyType && r.bodyType === "graphql" ? "GraphQL Request" : "HTTP Request" : r.model === "websocket_request" ? "WebSocket Request" : "gRPC Request";
	if (r.model === "grpc_request" && r.service != null && r.method != null) return `${r.service.split(".").pop()}/${r.method}`;
	return withoutVariables.replace(/^(http|https|ws|wss):\/\//, "");
}

//#endregion
exports.plugin = plugin;
exports.resolvedModelName = resolvedModelName;