/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/plist/lib/xmldom/entities.js var require_entities = __commonJS({ "node_modules/plist/lib/xmldom/entities.js"(exports) { exports.entityMap = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'", Agrave: "\xC0", Aacute: "\xC1", Acirc: "\xC2", Atilde: "\xC3", Auml: "\xC4", Aring: "\xC5", AElig: "\xC6", Ccedil: "\xC7", Egrave: "\xC8", Eacute: "\xC9", Ecirc: "\xCA", Euml: "\xCB", Igrave: "\xCC", Iacute: "\xCD", Icirc: "\xCE", Iuml: "\xCF", ETH: "\xD0", Ntilde: "\xD1", Ograve: "\xD2", Oacute: "\xD3", Ocirc: "\xD4", Otilde: "\xD5", Ouml: "\xD6", Oslash: "\xD8", Ugrave: "\xD9", Uacute: "\xDA", Ucirc: "\xDB", Uuml: "\xDC", Yacute: "\xDD", THORN: "\xDE", szlig: "\xDF", agrave: "\xE0", aacute: "\xE1", acirc: "\xE2", atilde: "\xE3", auml: "\xE4", aring: "\xE5", aelig: "\xE6", ccedil: "\xE7", egrave: "\xE8", eacute: "\xE9", ecirc: "\xEA", euml: "\xEB", igrave: "\xEC", iacute: "\xED", icirc: "\xEE", iuml: "\xEF", eth: "\xF0", ntilde: "\xF1", ograve: "\xF2", oacute: "\xF3", ocirc: "\xF4", otilde: "\xF5", ouml: "\xF6", oslash: "\xF8", ugrave: "\xF9", uacute: "\xFA", ucirc: "\xFB", uuml: "\xFC", yacute: "\xFD", thorn: "\xFE", yuml: "\xFF", nbsp: "\xA0", iexcl: "\xA1", cent: "\xA2", pound: "\xA3", curren: "\xA4", yen: "\xA5", brvbar: "\xA6", sect: "\xA7", uml: "\xA8", copy: "\xA9", ordf: "\xAA", laquo: "\xAB", not: "\xAC", shy: "\xAD\xAD", reg: "\xAE", macr: "\xAF", deg: "\xB0", plusmn: "\xB1", sup2: "\xB2", sup3: "\xB3", acute: "\xB4", micro: "\xB5", para: "\xB6", middot: "\xB7", cedil: "\xB8", sup1: "\xB9", ordm: "\xBA", raquo: "\xBB", frac14: "\xBC", frac12: "\xBD", frac34: "\xBE", iquest: "\xBF", times: "\xD7", divide: "\xF7", forall: "\u2200", part: "\u2202", exist: "\u2203", empty: "\u2205", nabla: "\u2207", isin: "\u2208", notin: "\u2209", ni: "\u220B", prod: "\u220F", sum: "\u2211", minus: "\u2212", lowast: "\u2217", radic: "\u221A", prop: "\u221D", infin: "\u221E", ang: "\u2220", and: "\u2227", or: "\u2228", cap: "\u2229", cup: "\u222A", "int": "\u222B", there4: "\u2234", sim: "\u223C", cong: "\u2245", asymp: "\u2248", ne: "\u2260", equiv: "\u2261", le: "\u2264", ge: "\u2265", sub: "\u2282", sup: "\u2283", nsub: "\u2284", sube: "\u2286", supe: "\u2287", oplus: "\u2295", otimes: "\u2297", perp: "\u22A5", sdot: "\u22C5", Alpha: "\u0391", Beta: "\u0392", Gamma: "\u0393", Delta: "\u0394", Epsilon: "\u0395", Zeta: "\u0396", Eta: "\u0397", Theta: "\u0398", Iota: "\u0399", Kappa: "\u039A", Lambda: "\u039B", Mu: "\u039C", Nu: "\u039D", Xi: "\u039E", Omicron: "\u039F", Pi: "\u03A0", Rho: "\u03A1", Sigma: "\u03A3", Tau: "\u03A4", Upsilon: "\u03A5", Phi: "\u03A6", Chi: "\u03A7", Psi: "\u03A8", Omega: "\u03A9", alpha: "\u03B1", beta: "\u03B2", gamma: "\u03B3", delta: "\u03B4", epsilon: "\u03B5", zeta: "\u03B6", eta: "\u03B7", theta: "\u03B8", iota: "\u03B9", kappa: "\u03BA", lambda: "\u03BB", mu: "\u03BC", nu: "\u03BD", xi: "\u03BE", omicron: "\u03BF", pi: "\u03C0", rho: "\u03C1", sigmaf: "\u03C2", sigma: "\u03C3", tau: "\u03C4", upsilon: "\u03C5", phi: "\u03C6", chi: "\u03C7", psi: "\u03C8", omega: "\u03C9", thetasym: "\u03D1", upsih: "\u03D2", piv: "\u03D6", OElig: "\u0152", oelig: "\u0153", Scaron: "\u0160", scaron: "\u0161", Yuml: "\u0178", fnof: "\u0192", circ: "\u02C6", tilde: "\u02DC", ensp: "\u2002", emsp: "\u2003", thinsp: "\u2009", zwnj: "\u200C", zwj: "\u200D", lrm: "\u200E", rlm: "\u200F", ndash: "\u2013", mdash: "\u2014", lsquo: "\u2018", rsquo: "\u2019", sbquo: "\u201A", ldquo: "\u201C", rdquo: "\u201D", bdquo: "\u201E", dagger: "\u2020", Dagger: "\u2021", bull: "\u2022", hellip: "\u2026", permil: "\u2030", prime: "\u2032", Prime: "\u2033", lsaquo: "\u2039", rsaquo: "\u203A", oline: "\u203E", euro: "\u20AC", trade: "\u2122", larr: "\u2190", uarr: "\u2191", rarr: "\u2192", darr: "\u2193", harr: "\u2194", crarr: "\u21B5", lceil: "\u2308", rceil: "\u2309", lfloor: "\u230A", rfloor: "\u230B", loz: "\u25CA", spades: "\u2660", clubs: "\u2663", hearts: "\u2665", diams: "\u2666" }; } }); // node_modules/plist/lib/xmldom/sax.js var require_sax = __commonJS({ "node_modules/plist/lib/xmldom/sax.js"(exports) { var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"); var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$"); 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 ParseError(message, locator) { this.message = message; this.locator = locator; if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError); } ParseError.prototype = new Error(); ParseError.prototype.name = ParseError.name; function XMLReader() { } XMLReader.prototype = { parse: function(source, defaultNSMap, entityMap) { var domBuilder = this.domBuilder; domBuilder.startDocument(); _copy(defaultNSMap, defaultNSMap = {}); parse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler); domBuilder.endDocument(); } }; function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) { 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(a2) { var k = a2.slice(1, -1); if (k in entityMap) { return entityMap[k]; } else if (k.charAt(0) === "#") { return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x"))); } else { errorHandler.error("entity not found:" + a2); return a2; } } function appendText(end2) { if (end2 > start) { var xt = source.substring(start, end2).replace(/&#?\w+;/g, entityReplacer); locator && position(start); domBuilder.characters(xt, 0, end2 - start); start = end2; } } function position(p, m) { while (p >= lineEnd && (m = linePattern.exec(source))) { lineStart = m.index; lineEnd = lineStart + m[0].length; locator.lineNumber++; } locator.columnNumber = p - lineStart + 1; } var lineStart = 0; var lineEnd = 0; var linePattern = /.*(?:\r\n?|\n)|.*$/g; var locator = domBuilder.locator; var parseStack = [{ currentNSMap: defaultNSMapCopy }]; var closeMap = {}; var start = 0; while (true) { try { var tagStart = source.indexOf("<", start); if (tagStart < 0) { if (!source.substr(start).match(/^\s*$/)) { var doc = domBuilder.doc; var text = doc.createTextNode(source.substr(start)); doc.appendChild(text); domBuilder.currentElement = text; } return; } if (tagStart > start) { appendText(tagStart); } switch (source.charAt(tagStart + 1)) { case "/": var end = source.indexOf(">", tagStart + 3); var tagName = source.substring(tagStart + 2, end); var config = parseStack.pop(); if (end < 0) { tagName = source.substring(tagStart + 2).replace(/[\s<].*/, ""); errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName); end = tagStart + 1 + tagName.length; } else if (tagName.match(/\s start) { start = end; } else { appendText(Math.max(tagStart, start) + 1); } } } function copyLocator(f, t) { t.lineNumber = f.lineNumber; t.columnNumber = f.columnNumber; return t; } function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) { function addAttribute(qname, value2, startIndex) { if (qname in el.attributeNames) errorHandler.fatalError("Attribute " + qname + " redefined"); el.addValue(qname, value2, 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).replace(/&#?\w+;/g, entityReplacer); 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).replace(/&#?\w+;/g, entityReplacer); 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: case S_ATTR_SPACE: 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.replace(/&#?\w+;/g, entityReplacer), start); } else { if (currentNSMap[""] !== "http://www.w3.org/1999/xhtml" || !value.match(/^(?:disabled|checked|selected)$/i)) { errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!'); } addAttribute(value, value, start); } break; case S_EQ: throw new Error("attribute value missed!!"); } return p; case "\x80": 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).replace(/&#?\w+;/g, entityReplacer); 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: var tagName = el.tagName; if (currentNSMap[""] !== "http://www.w3.org/1999/xhtml" || !attrName.match(/^(?:disabled|checked|selected)$/i)) { 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++; } } function appendElement(el, domBuilder, currentNSMap) { var tagName = el.tagName; var localNSMap = null; var i = el.length; while (i--) { var a = el[i]; 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 = {}; _copy(currentNSMap, currentNSMap = {}); } currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; a.uri = "http://www.w3.org/2000/xmlns/"; domBuilder.startPrefixMapping(nsPrefix, value); } } var i = el.length; while (i--) { a = el[i]; var prefix = a.prefix; if (prefix) { if (prefix === "xml") { a.uri = "http://www.w3.org/XML/1998/namespace"; } if (prefix !== "xmlns") { a.uri = currentNSMap[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) { domBuilder.endPrefixMapping(prefix); } } } else { el.currentNSMap = currentNSMap; el.localNSMap = localNSMap; return true; } } function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) { if (/^(?:script|textarea)$/i.test(tagName)) { var elEndStart = source.indexOf("", elStartEnd); var text = source.substring(elStartEnd + 1, elEndStart); if (/[&<]/.test(text)) { if (/^script$/i.test(tagName)) { domBuilder.characters(text, 0, text.length); return elEndStart; } text = text.replace(/&#?\w+;/g, entityReplacer); domBuilder.characters(text, 0, text.length); return elEndStart; } } return elStartEnd + 1; } function fixSelfClosed(source, elStartEnd, tagName, closeMap) { var pos = closeMap[tagName]; if (pos == null) { pos = source.lastIndexOf(""); if (pos < elStartEnd) { pos = source.lastIndexOf("", start + 4); if (end > start) { domBuilder.comment(source, start + 4, end - start - 4); return end + 3; } else { errorHandler.error("Unclosed comment"); return -1; } } else { return -1; } default: if (source.substr(start + 3, 6) == "CDATA[") { var end = source.indexOf("]]>", start + 9); domBuilder.startCDATA(); domBuilder.characters(source, start + 9, end - start - 9); domBuilder.endCDATA(); return end + 3; } var matchs = split(source, start); var len = matchs.length; if (len > 1 && /!doctype/i.test(matchs[0][0])) { var name = matchs[1][0]; var pubid = false; var sysid = false; if (len > 3) { if (/^public$/i.test(matchs[2][0])) { pubid = matchs[3][0]; sysid = len > 4 && matchs[4][0]; } else if (/^system$/i.test(matchs[2][0])) { sysid = matchs[3][0]; } } var lastMatch = matchs[len - 1]; domBuilder.startDTD(name, pubid, sysid); domBuilder.endDTD(); return lastMatch.index + lastMatch[0].length; } } return -1; } function parseInstruction(source, start, domBuilder) { var end = source.indexOf("?>", start); if (end) { var match = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); if (match) { var len = match[0].length; domBuilder.processingInstruction(match[1], match[2]); return end + 2; } else { return -1; } } return -1; } function ElementAttributes() { this.attributeNames = {}; } ElementAttributes.prototype = { setTagName: function(tagName) { if (!tagNamePattern.test(tagName)) { throw new Error("invalid tagName:" + tagName); } this.tagName = tagName; }, addValue: function(qName, value, offset) { if (!tagNamePattern.test(qName)) { throw new Error("invalid attribute:" + qName); } this.attributeNames[qName] = this.length; this[this.length++] = { qName, value, offset }; }, length: 0, getLocalName: function(i) { return this[i].localName; }, getLocator: function(i) { return this[i].locator; }, getQName: function(i) { return this[i].qName; }, getURI: function(i) { return this[i].uri; }, getValue: function(i) { return this[i].value; } }; function split(source, start) { var match; var buf = []; var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; reg.lastIndex = start; reg.exec(source); while (match = reg.exec(source)) { buf.push(match); if (match[1]) return buf; } } exports.XMLReader = XMLReader; exports.ParseError = ParseError; } }); // node_modules/plist/lib/xmldom/dom.js var require_dom = __commonJS({ "node_modules/plist/lib/xmldom/dom.js"(exports) { function copy(src, dest) { for (var p in src) { dest[p] = src[p]; } } function _extends(Class, Super) { var pt = Class.prototype; if (!(pt instanceof Super)) { let t2 = function() { }; var t = t2; ; t2.prototype = Super.prototype; t2 = new t2(); copy(pt, t2); Class.prototype = pt = t2; } if (pt.constructor != Class) { if (typeof Class != "function") { console.error("unknow Class:" + Class); } pt.constructor = Class; } } var htmlns = "http://www.w3.org/1999/xhtml"; 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 ExceptionCode = {}; var ExceptionMessage = {}; var INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1); var DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2); var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3); var WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4); var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5); var NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6); var NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7); var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8); var NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9); var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10); var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11); var SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12); var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13); var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14); var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15); function DOMException(code, message) { if (message instanceof Error) { var error = message; } else { error = this; Error.call(this, ExceptionMessage[code]); this.message = ExceptionMessage[code]; if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException); } error.code = code; if (message) this.message = this.message + ": " + message; return error; } DOMException.prototype = Error.prototype; copy(ExceptionCode, DOMException); function NodeList() { } NodeList.prototype = { length: 0, item: function(index) { return this[index] || null; }, toString: function(isHTML, nodeFilter) { for (var buf = [], i = 0; i < this.length; i++) { serializeToString(this[i], buf, isHTML, nodeFilter); } return buf.join(""); } }; function LiveNodeList(node, refresh) { this._node = node; this._refresh = refresh; _updateLiveList(this); } 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); copy(ls, list); list._inc = inc; } } LiveNodeList.prototype.item = function(i) { _updateLiveList(this); return this[i]; }; _extends(LiveNodeList, NodeList); function NamedNodeMap() { } function _findNodeIndex(list, node) { var i = list.length; while (i--) { if (list[i] === node) { return i; } } } function _addNamedNode(el, list, newAttr, oldAttr) { if (oldAttr) { list[_findNodeIndex(list, oldAttr)] = newAttr; } else { list[list.length++] = newAttr; } if (el) { newAttr.ownerElement = el; var doc = el.ownerDocument; if (doc) { oldAttr && _onRemoveAttribute(doc, el, oldAttr); _onAddAttribute(doc, el, newAttr); } } } function _removeNamedNode(el, list, attr) { var i = _findNodeIndex(list, attr); if (i >= 0) { var lastIndex = list.length - 1; while (i < lastIndex) { list[i] = list[++i]; } list.length = lastIndex; if (el) { var doc = el.ownerDocument; if (doc) { _onRemoveAttribute(doc, el, attr); attr.ownerElement = null; } } } else { throw DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr)); } } NamedNodeMap.prototype = { length: 0, item: NodeList.prototype.item, getNamedItem: function(key) { var i = this.length; while (i--) { var attr = this[i]; if (attr.nodeName == key) { return attr; } } }, setNamedItem: function(attr) { var el = attr.ownerElement; if (el && el != this._ownerElement) { throw new DOMException(INUSE_ATTRIBUTE_ERR); } var oldAttr = this.getNamedItem(attr.nodeName); _addNamedNode(this._ownerElement, this, attr, oldAttr); return oldAttr; }, setNamedItemNS: function(attr) { var el = attr.ownerElement, oldAttr; if (el && el != this._ownerElement) { throw new DOMException(INUSE_ATTRIBUTE_ERR); } oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName); _addNamedNode(this._ownerElement, this, attr, oldAttr); return oldAttr; }, removeNamedItem: function(key) { var attr = this.getNamedItem(key); _removeNamedNode(this._ownerElement, this, attr); return attr; }, removeNamedItemNS: function(namespaceURI, localName) { var attr = this.getNamedItemNS(namespaceURI, localName); _removeNamedNode(this._ownerElement, this, attr); return attr; }, getNamedItemNS: function(namespaceURI, localName) { var i = this.length; while (i--) { var node = this[i]; if (node.localName == localName && node.namespaceURI == namespaceURI) { return node; } } return null; } }; function DOMImplementation(features) { this._features = {}; if (features) { for (var feature in features) { this._features = features[feature]; } } } DOMImplementation.prototype = { hasFeature: function(feature, version) { var versions = this._features[feature.toLowerCase()]; if (versions && (!version || version in versions)) { return true; } else { return false; } }, createDocument: function(namespaceURI, qualifiedName, doctype) { var doc = new Document(); doc.implementation = this; doc.childNodes = new NodeList(); doc.doctype = doctype; if (doctype) { doc.appendChild(doctype); } if (qualifiedName) { var root = doc.createElementNS(namespaceURI, qualifiedName); doc.appendChild(root); } return doc; }, createDocumentType: function(qualifiedName, publicId, systemId) { var node = new DocumentType(); node.name = qualifiedName; node.nodeName = qualifiedName; node.publicId = publicId; node.systemId = systemId; return node; } }; function Node() { } Node.prototype = { firstChild: null, lastChild: null, previousSibling: null, nextSibling: null, attributes: null, parentNode: null, childNodes: null, ownerDocument: null, nodeValue: null, namespaceURI: null, prefix: null, localName: null, insertBefore: function(newChild, refChild) { return _insertBefore(this, newChild, refChild); }, replaceChild: function(newChild, oldChild) { this.insertBefore(newChild, oldChild); 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() { var child = this.firstChild; while (child) { var next = child.nextSibling; if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) { this.removeChild(next); child.appendData(next.data); } else { child.normalize(); child = next; } } }, isSupported: function(feature, version) { return this.ownerDocument.implementation.hasFeature(feature, version); }, hasAttributes: function() { return this.attributes.length > 0; }, lookupPrefix: function(namespaceURI) { var el = this; while (el) { var map = el._nsMap; if (map) { for (var n in map) { if (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 (prefix in map) { return map[prefix]; } } el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode; } return null; }, isDefaultNamespace: function(namespaceURI) { var prefix = this.lookupPrefix(namespaceURI); return prefix == null; } }; function _xmlEncoder(c) { return c == "<" && "<" || c == ">" && ">" || c == "&" && "&" || c == '"' && """ || "&#" + c.charCodeAt() + ";"; } copy(NodeType, Node); copy(NodeType, Node.prototype); function _visitNode(node, callback) { if (callback(node)) { return true; } if (node = node.firstChild) { do { if (_visitNode(node, callback)) { return true; } } while (node = node.nextSibling); } } function Document() { } function _onAddAttribute(doc, el, newAttr) { doc && doc._inc++; var ns = newAttr.namespaceURI; if (ns == "http://www.w3.org/2000/xmlns/") { el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value; } } function _onRemoveAttribute(doc, el, newAttr, remove) { doc && doc._inc++; var ns = newAttr.namespaceURI; if (ns == "http://www.w3.org/2000/xmlns/") { delete el._nsMap[newAttr.prefix ? newAttr.localName : ""]; } } function _onUpdateChild(doc, el, newChild) { if (doc && doc._inc) { doc._inc++; var cs = el.childNodes; if (newChild) { cs[cs.length++] = newChild; } else { var child = el.firstChild; var i = 0; while (child) { cs[i++] = child; child = child.nextSibling; } cs.length = i; } } } function _removeChild(parentNode, child) { var previous = child.previousSibling; var next = child.nextSibling; if (previous) { previous.nextSibling = next; } else { parentNode.firstChild = next; } if (next) { next.previousSibling = previous; } else { parentNode.lastChild = previous; } _onUpdateChild(parentNode.ownerDocument, parentNode); return child; } function _insertBefore(parentNode, newChild, nextChild) { var cp = newChild.parentNode; if (cp) { cp.removeChild(newChild); } if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) { var newFirst = newChild.firstChild; if (newFirst == null) { return newChild; } var newLast = newChild.lastChild; } else { newFirst = newLast = newChild; } var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild; newFirst.previousSibling = pre; newLast.nextSibling = nextChild; if (pre) { pre.nextSibling = newFirst; } else { parentNode.firstChild = newFirst; } if (nextChild == null) { parentNode.lastChild = newLast; } else { nextChild.previousSibling = newLast; } do { newFirst.parentNode = parentNode; } while (newFirst !== newLast && (newFirst = newFirst.nextSibling)); _onUpdateChild(parentNode.ownerDocument || parentNode, parentNode); if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) { newChild.firstChild = newChild.lastChild = null; } return newChild; } function _appendSingleChild(parentNode, newChild) { var cp = newChild.parentNode; if (cp) { var pre = parentNode.lastChild; cp.removeChild(newChild); var pre = parentNode.lastChild; } var pre = parentNode.lastChild; newChild.parentNode = parentNode; newChild.previousSibling = pre; newChild.nextSibling = null; if (pre) { pre.nextSibling = newChild; } else { parentNode.firstChild = newChild; } parentNode.lastChild = newChild; _onUpdateChild(parentNode.ownerDocument, parentNode, newChild); return newChild; } Document.prototype = { 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; } if (this.documentElement == null && newChild.nodeType == ELEMENT_NODE) { this.documentElement = newChild; } return _insertBefore(this, newChild, refChild), newChild.ownerDocument = this, newChild; }, removeChild: function(oldChild) { if (this.documentElement == oldChild) { this.documentElement = null; } return _removeChild(this, oldChild); }, 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; }, getElementsByClassName: function(className) { var pattern = new RegExp("(^|\\s)" + className + "(\\s|$)"); return new LiveNodeList(this, function(base) { var ls = []; _visitNode(base.documentElement, function(node) { if (node !== base && node.nodeType == ELEMENT_NODE) { if (pattern.test(node.getAttribute("class"))) { ls.push(node); } } }); return ls; }); }, createElement: function(tagName) { var node = new Element(); node.ownerDocument = this; node.nodeName = tagName; node.tagName = tagName; node.childNodes = new NodeList(); var attrs = node.attributes = new NamedNodeMap(); attrs._ownerElement = node; return node; }, createDocumentFragment: function() { var node = new DocumentFragment(); node.ownerDocument = this; node.childNodes = new NodeList(); return node; }, createTextNode: function(data) { var node = new Text(); node.ownerDocument = this; node.appendData(data); return node; }, createComment: function(data) { var node = new Comment(); node.ownerDocument = this; node.appendData(data); return node; }, createCDATASection: function(data) { var node = new CDATASection(); node.ownerDocument = this; node.appendData(data); return node; }, createProcessingInstruction: function(target, data) { var node = new ProcessingInstruction(); node.ownerDocument = this; node.tagName = node.target = target; node.nodeValue = node.data = data; return node; }, createAttribute: function(name) { var node = new Attr(); node.ownerDocument = this; node.name = name; node.nodeName = name; node.localName = name; node.specified = true; return node; }, createEntityReference: function(name) { var node = new EntityReference(); node.ownerDocument = this; node.nodeName = name; return node; }, createElementNS: function(namespaceURI, qualifiedName) { var node = new Element(); var pl = qualifiedName.split(":"); var attrs = node.attributes = new NamedNodeMap(); node.childNodes = new NodeList(); node.ownerDocument = this; node.nodeName = qualifiedName; node.tagName = qualifiedName; node.namespaceURI = namespaceURI; if (pl.length == 2) { node.prefix = pl[0]; node.localName = pl[1]; } else { node.localName = qualifiedName; } attrs._ownerElement = node; return node; }, createAttributeNS: function(namespaceURI, qualifiedName) { var node = new Attr(); var pl = qualifiedName.split(":"); node.ownerDocument = this; node.nodeName = qualifiedName; node.name = qualifiedName; node.namespaceURI = namespaceURI; node.specified = true; if (pl.length == 2) { node.prefix = pl[0]; node.localName = pl[1]; } else { node.localName = qualifiedName; } return node; } }; _extends(Document, Node); function Element() { this._nsMap = {}; } Element.prototype = { nodeType: ELEMENT_NODE, hasAttribute: function(name) { return this.getAttributeNode(name) != null; }, getAttribute: function(name) { var attr = this.getAttributeNode(name); return attr && attr.value || ""; }, getAttributeNode: function(name) { return this.attributes.getNamedItem(name); }, setAttribute: function(name, value) { var attr = this.ownerDocument.createAttribute(name); attr.value = attr.nodeValue = "" + value; this.setAttributeNode(attr); }, removeAttribute: function(name) { var attr = this.getAttributeNode(name); attr && this.removeAttributeNode(attr); }, appendChild: function(newChild) { if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) { return this.insertBefore(newChild, null); } else { return _appendSingleChild(this, newChild); } }, 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 || ""; }, setAttributeNS: function(namespaceURI, qualifiedName, value) { var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName); attr.value = attr.nodeValue = "" + value; this.setAttributeNode(attr); }, getAttributeNodeNS: function(namespaceURI, localName) { return this.attributes.getNamedItemNS(namespaceURI, localName); }, getElementsByTagName: function(tagName) { return new LiveNodeList(this, function(base) { var ls = []; _visitNode(base, function(node) { if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) { 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.getElementsByTagName = Element.prototype.getElementsByTagName; Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS; _extends(Element, Node); function Attr() { } Attr.prototype.nodeType = ATTRIBUTE_NODE; _extends(Attr, Node); function CharacterData() { } 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); }, appendChild: function(newChild) { throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]); }, 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() { } 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() { } Comment.prototype = { nodeName: "#comment", nodeType: COMMENT_NODE }; _extends(Comment, CharacterData); function CDATASection() { } CDATASection.prototype = { nodeName: "#cdata-section", nodeType: CDATA_SECTION_NODE }; _extends(CDATASection, CharacterData); function DocumentType() { } DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; _extends(DocumentType, Node); function Notation() { } Notation.prototype.nodeType = NOTATION_NODE; _extends(Notation, Node); function Entity() { } Entity.prototype.nodeType = ENTITY_NODE; _extends(Entity, Node); function EntityReference() { } EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; _extends(EntityReference, Node); function DocumentFragment() { } DocumentFragment.prototype.nodeName = "#document-fragment"; DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; _extends(DocumentFragment, Node); function ProcessingInstruction() { } ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE; _extends(ProcessingInstruction, Node); function XMLSerializer() { } XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) { return nodeSerializeToString.call(node, isHtml, nodeFilter); }; Node.prototype.toString = nodeSerializeToString; function nodeSerializeToString(isHtml, nodeFilter) { var buf = []; var refNode = this.nodeType == 9 && 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, isHtml, nodeFilter, visibleNamespaces); return buf.join(""); } function needNamespaceDefine(node, isHTML, visibleNamespaces) { var prefix = node.prefix || ""; var uri = node.namespaceURI; if (!prefix && !uri) { return false; } if (prefix === "xml" && uri === "http://www.w3.org/XML/1998/namespace" || uri == "http://www.w3.org/2000/xmlns/") { return false; } var i = visibleNamespaces.length; while (i--) { var ns = visibleNamespaces[i]; if (ns.prefix == prefix) { return ns.namespace != uri; } } return true; } function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) { if (nodeFilter) { node = nodeFilter(node); if (node) { if (typeof node == "string") { buf.push(node); return; } } else { return; } } switch (node.nodeType) { case ELEMENT_NODE: if (!visibleNamespaces) visibleNamespaces = []; var startVisibleNamespaces = visibleNamespaces.length; var attrs = node.attributes; var len = attrs.length; var child = node.firstChild; var nodeName = node.tagName; isHTML = htmlns === node.namespaceURI || isHTML; buf.push("<", nodeName); for (var i = 0; i < len; i++) { var attr = attrs.item(i); if (attr.prefix == "xmlns") { visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value }); } else if (attr.nodeName == "xmlns") { visibleNamespaces.push({ prefix: "", namespace: attr.value }); } } for (var i = 0; i < len; i++) { var attr = attrs.item(i); if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) { var prefix = attr.prefix || ""; var uri = attr.namespaceURI; var ns = prefix ? " xmlns:" + prefix : " xmlns"; buf.push(ns, '="', uri, '"'); visibleNamespaces.push({ prefix, namespace: uri }); } serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces); } if (needNamespaceDefine(node, isHTML, visibleNamespaces)) { var prefix = node.prefix || ""; var uri = node.namespaceURI; if (uri) { var ns = prefix ? " xmlns:" + prefix : " xmlns"; buf.push(ns, '="', uri, '"'); visibleNamespaces.push({ prefix, namespace: uri }); } } if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) { buf.push(">"); if (isHTML && /^script$/i.test(nodeName)) { while (child) { if (child.data) { buf.push(child.data); } else { serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces); } child = child.nextSibling; } } else { while (child) { serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces); child = child.nextSibling; } } buf.push(""); } else { buf.push("/>"); } return; case DOCUMENT_NODE: case DOCUMENT_FRAGMENT_NODE: var child = node.firstChild; while (child) { serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces); child = child.nextSibling; } return; case ATTRIBUTE_NODE: return buf.push(" ", node.name, '="', node.value.replace(/[<&"]/g, _xmlEncoder), '"'); case TEXT_NODE: return buf.push(node.data.replace(/[<&]/g, _xmlEncoder).replace(/]]>/g, "]]>")); case CDATA_SECTION_NODE: return buf.push(""); case COMMENT_NODE: return buf.push(""); case DOCUMENT_TYPE_NODE: var pubid = node.publicId; var sysid = node.systemId; buf.push(""); } else if (sysid && sysid != ".") { buf.push(" SYSTEM ", sysid, ">"); } else { var sub = node.internalSubset; if (sub) { buf.push(" [", sub, "]"); } buf.push(">"); } return; case PROCESSING_INSTRUCTION_NODE: return buf.push(""); case ENTITY_REFERENCE_NODE: return buf.push("&", node.nodeName, ";"); default: buf.push("??", node.nodeName); } } function importNode(doc, node, deep) { var node2; switch (node.nodeType) { case ELEMENT_NODE: node2 = node.cloneNode(false); node2.ownerDocument = doc; case DOCUMENT_FRAGMENT_NODE: break; case ATTRIBUTE_NODE: deep = true; break; } if (!node2) { node2 = node.cloneNode(false); } node2.ownerDocument = doc; node2.parentNode = null; if (deep) { var child = node.firstChild; while (child) { node2.appendChild(importNode(doc, child, deep)); child = child.nextSibling; } } return node2; } function cloneNode(doc, node, deep) { var node2 = new node.constructor(); for (var n in node) { var v = node[n]; if (typeof v != "object") { if (v != node2[n]) { node2[n] = v; } } } if (node.childNodes) { node2.childNodes = new NodeList(); } node2.ownerDocument = doc; switch (node2.nodeType) { case ELEMENT_NODE: var attrs = node.attributes; var attrs2 = node2.attributes = new NamedNodeMap(); var len = attrs.length; attrs2._ownerElement = node2; for (var i = 0; i < len; i++) { node2.setAttributeNode(cloneNode(doc, attrs.item(i), true)); } break; ; case ATTRIBUTE_NODE: deep = true; } if (deep) { var child = node.firstChild; while (child) { node2.appendChild(cloneNode(doc, child, deep)); child = child.nextSibling; } } return node2; } function __set__(object, key, value) { object[key] = value; } try { if (Object.defineProperty) { let getTextContent2 = function(node) { switch (node.nodeType) { case ELEMENT_NODE: case DOCUMENT_FRAGMENT_NODE: var buf = []; node = node.firstChild; while (node) { if (node.nodeType !== 7 && node.nodeType !== 8) { buf.push(getTextContent2(node)); } node = node.nextSibling; } return buf.join(""); default: return node.nodeValue; } }; getTextContent = getTextContent2; Object.defineProperty(LiveNodeList.prototype, "length", { get: function() { _updateLiveList(this); return this.$$length; } }); Object.defineProperty(Node.prototype, "textContent", { get: function() { return getTextContent2(this); }, 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; } } }); __set__ = function(object, key, value) { object["$$" + key] = value; }; } } catch (e) { } var getTextContent; exports.Node = Node; exports.DOMException = DOMException; exports.DOMImplementation = DOMImplementation; exports.XMLSerializer = XMLSerializer; } }); // node_modules/plist/lib/xmldom/dom-parser.js var require_dom_parser = __commonJS({ "node_modules/plist/lib/xmldom/dom-parser.js"(exports) { function DOMParser(options) { this.options = options || { locator: {} }; } DOMParser.prototype.parseFromString = function(source, mimeType) { var options = this.options; var sax2 = new XMLReader(); var domBuilder = options.domBuilder || new DOMHandler(); var errorHandler = options.errorHandler; var locator = options.locator; var defaultNSMap = options.xmlns || {}; var isHTML = /\/x?html?$/.test(mimeType); var entityMap = isHTML ? htmlEntity.entityMap : { "lt": "<", "gt": ">", "amp": "&", "quot": '"', "apos": "'" }; if (locator) { domBuilder.setDocumentLocator(locator); } sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator); sax2.domBuilder = options.domBuilder || domBuilder; if (isHTML) { defaultNSMap[""] = "http://www.w3.org/1999/xhtml"; } defaultNSMap.xml = defaultNSMap.xml || "http://www.w3.org/XML/1998/namespace"; if (source && typeof source === "string") { sax2.parse(source, defaultNSMap, entityMap); } else { sax2.errorHandler.error("invalid doc source"); } return domBuilder.doc; }; function buildErrorHandler(errorImpl, domBuilder, locator) { if (!errorImpl) { if (domBuilder instanceof DOMHandler) { return domBuilder; } errorImpl = domBuilder; } var errorHandler = {}; var isCallback = errorImpl instanceof Function; locator = locator || {}; function build(key) { var fn = errorImpl[key]; if (!fn && isCallback) { fn = errorImpl.length == 2 ? function(msg) { errorImpl(key, msg); } : errorImpl; } errorHandler[key] = fn && function(msg) { fn("[xmldom " + key + "] " + msg + _locator(locator)); } || function() { }; } build("warning"); build("error"); build("fatalError"); return errorHandler; } function DOMHandler() { this.cdata = false; } function position(locator, node) { node.lineNumber = locator.lineNumber; node.columnNumber = locator.columnNumber; } DOMHandler.prototype = { startDocument: function() { this.doc = new DOMImplementation().createDocument(null, null, null); if (this.locator) { this.doc.documentURI = this.locator.systemId; } }, 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 = 0; i < len; i++) { var namespaceURI = attrs.getURI(i); var value = attrs.getValue(i); var qName = attrs.getQName(i); var attr = doc.createAttributeNS(namespaceURI, qName); this.locator && position(attrs.getLocator(i), attr); attr.value = attr.nodeValue = value; el.setAttributeNode(attr); } }, endElement: function(namespaceURI, localName, qName) { var current = this.currentElement; var tagName = current.tagName; this.currentElement = current.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, start, length) { chars = _toString.apply(this, arguments); if (chars) { if (this.cdata) { var charNode = this.doc.createCDATASection(chars); } else { var charNode = this.doc.createTextNode(chars); } if (this.currentElement) { this.currentElement.appendChild(charNode); } else if (/^\s*$/.test(chars)) { this.doc.appendChild(charNode); } this.locator && position(this.locator, charNode); } }, skippedEntity: function(name) { }, endDocument: function() { this.doc.normalize(); }, setDocumentLocator: function(locator) { if (this.locator = locator) { locator.lineNumber = 0; } }, comment: function(chars, start, length) { chars = _toString.apply(this, arguments); var comm = this.doc.createComment(chars); this.locator && position(this.locator, comm); appendElement(this, comm); }, startCDATA: function() { this.cdata = true; }, endCDATA: function() { this.cdata = false; }, startDTD: function(name, publicId, systemId) { var impl = this.doc.implementation; if (impl && impl.createDocumentType) { var dt = impl.createDocumentType(name, publicId, systemId); this.locator && position(this.locator, dt); appendElement(this, dt); } }, warning: function(error) { console.warn("[xmldom warning] " + error, _locator(this.locator)); }, error: function(error) { console.error("[xmldom error] " + error, _locator(this.locator)); }, fatalError: function(error) { throw new ParseError(error, this.locator); } }; function _locator(l) { if (l) { return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]"; } } function _toString(chars, start, length) { if (typeof chars == "string") { return chars.substr(start, length); } else { if (chars.length >= start + length || start) { return new java.lang.String(chars, start, length) + ""; } return chars; } } "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) { DOMHandler.prototype[key] = function() { return null; }; }); function appendElement(hander, node) { if (!hander.currentElement) { hander.doc.appendChild(node); } else { hander.currentElement.appendChild(node); } } var htmlEntity = require_entities(); var sax = require_sax(); var XMLReader = sax.XMLReader; var ParseError = sax.ParseError; var DOMImplementation = exports.DOMImplementation = require_dom().DOMImplementation; exports.XMLSerializer = require_dom().XMLSerializer; exports.DOMParser = DOMParser; exports.__DOMHandler = DOMHandler; } }); // node_modules/plist/lib/parse.js var require_parse = __commonJS({ "node_modules/plist/lib/parse.js"(exports) { var DOMParser = require_dom_parser().DOMParser; exports.parse = parse; var TEXT_NODE = 3; var CDATA_NODE = 4; var COMMENT_NODE = 8; function shouldIgnoreNode(node) { return node.nodeType === TEXT_NODE || node.nodeType === COMMENT_NODE || node.nodeType === CDATA_NODE; } function isEmptyNode(node) { if (!node.childNodes || node.childNodes.length === 0) { return true; } else { return false; } } function invariant(test, message) { if (!test) { throw new Error(message); } } function parse(xml) { var doc = new DOMParser().parseFromString(xml); invariant(doc.documentElement.nodeName === "plist", "malformed document. First element should be "); var plist2 = parsePlistXML(doc.documentElement); if (plist2.length == 1) plist2 = plist2[0]; return plist2; } function parsePlistXML(node) { var i, new_obj, key, val, new_arr, res, counter, type; if (!node) return null; if (node.nodeName === "plist") { new_arr = []; if (isEmptyNode(node)) { return new_arr; } for (i = 0; i < node.childNodes.length; i++) { if (!shouldIgnoreNode(node.childNodes[i])) { new_arr.push(parsePlistXML(node.childNodes[i])); } } return new_arr; } else if (node.nodeName === "dict") { new_obj = {}; key = null; counter = 0; if (isEmptyNode(node)) { return new_obj; } for (i = 0; i < node.childNodes.length; i++) { if (shouldIgnoreNode(node.childNodes[i])) continue; if (counter % 2 === 0) { invariant(node.childNodes[i].nodeName === "key", "Missing key while parsing ."); key = parsePlistXML(node.childNodes[i]); } else { invariant(node.childNodes[i].nodeName !== "key", 'Unexpected key "' + parsePlistXML(node.childNodes[i]) + '" while parsing .'); new_obj[key] = parsePlistXML(node.childNodes[i]); } counter += 1; } if (counter % 2 === 1) { new_obj[key] = ""; } return new_obj; } else if (node.nodeName === "array") { new_arr = []; if (isEmptyNode(node)) { return new_arr; } for (i = 0; i < node.childNodes.length; i++) { if (!shouldIgnoreNode(node.childNodes[i])) { res = parsePlistXML(node.childNodes[i]); if (res != null) new_arr.push(res); } } return new_arr; } else if (node.nodeName === "#text") { } else if (node.nodeName === "key") { if (isEmptyNode(node)) { return ""; } invariant(node.childNodes[0].nodeValue !== "__proto__", "__proto__ keys can lead to prototype pollution. More details on CVE-2022-22912"); return node.childNodes[0].nodeValue; } else if (node.nodeName === "string") { res = ""; if (isEmptyNode(node)) { return res; } for (i = 0; i < node.childNodes.length; i++) { var type = node.childNodes[i].nodeType; if (type === TEXT_NODE || type === CDATA_NODE) { res += node.childNodes[i].nodeValue; } } return res; } else if (node.nodeName === "integer") { invariant(!isEmptyNode(node), 'Cannot parse "" as integer.'); return parseInt(node.childNodes[0].nodeValue, 10); } else if (node.nodeName === "real") { invariant(!isEmptyNode(node), 'Cannot parse "" as real.'); res = ""; for (i = 0; i < node.childNodes.length; i++) { if (node.childNodes[i].nodeType === TEXT_NODE) { res += node.childNodes[i].nodeValue; } } return parseFloat(res); } else if (node.nodeName === "data") { res = ""; if (isEmptyNode(node)) { return Buffer.from(res, "base64"); } for (i = 0; i < node.childNodes.length; i++) { if (node.childNodes[i].nodeType === TEXT_NODE) { res += node.childNodes[i].nodeValue.replace(/\s+/g, ""); } } return Buffer.from(res, "base64"); } else if (node.nodeName === "date") { invariant(!isEmptyNode(node), 'Cannot parse "" as Date.'); return new Date(node.childNodes[0].nodeValue); } else if (node.nodeName === "null") { return null; } else if (node.nodeName === "true") { return true; } else if (node.nodeName === "false") { return false; } else { throw new Error("Invalid PLIST tag " + node.nodeName); } } } }); // node_modules/base64-js/index.js var require_base64_js = __commonJS({ "node_modules/base64-js/index.js"(exports) { "use strict"; exports.byteLength = byteLength; exports.toByteArray = toByteArray; exports.fromByteArray = fromByteArray; var lookup = []; var revLookup = []; var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; for (i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i]; revLookup[code.charCodeAt(i)] = i; } var i; var len; revLookup["-".charCodeAt(0)] = 62; revLookup["_".charCodeAt(0)] = 63; function getLens(b64) { var len2 = b64.length; if (len2 % 4 > 0) { throw new Error("Invalid string. Length must be a multiple of 4"); } var validLen = b64.indexOf("="); if (validLen === -1) validLen = len2; var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4; return [validLen, placeHoldersLen]; } function byteLength(b64) { var lens = getLens(b64); var validLen = lens[0]; var placeHoldersLen = lens[1]; return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; } function _byteLength(b64, validLen, placeHoldersLen) { return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; } function toByteArray(b64) { var tmp; var lens = getLens(b64); var validLen = lens[0]; var placeHoldersLen = lens[1]; var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); var curByte = 0; var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen; var i2; for (i2 = 0; i2 < len2; i2 += 4) { tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)]; arr[curByte++] = tmp >> 16 & 255; arr[curByte++] = tmp >> 8 & 255; arr[curByte++] = tmp & 255; } if (placeHoldersLen === 2) { tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4; arr[curByte++] = tmp & 255; } if (placeHoldersLen === 1) { tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2; arr[curByte++] = tmp >> 8 & 255; arr[curByte++] = tmp & 255; } return arr; } function tripletToBase64(num) { return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63]; } function encodeChunk(uint8, start, end) { var tmp; var output = []; for (var i2 = start; i2 < end; i2 += 3) { tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255); output.push(tripletToBase64(tmp)); } return output.join(""); } function fromByteArray(uint8) { var tmp; var len2 = uint8.length; var extraBytes = len2 % 3; var parts = []; var maxChunkLength = 16383; for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) { parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength)); } if (extraBytes === 1) { tmp = uint8[len2 - 1]; parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="); } else if (extraBytes === 2) { tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1]; parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="); } return parts.join(""); } } }); // node_modules/xmlbuilder/lib/Utility.js var require_Utility = __commonJS({ "node_modules/xmlbuilder/lib/Utility.js"(exports, module2) { (function() { var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject, hasProp = {}.hasOwnProperty; assign = function(target, ...sources) { var i, key, len, source; if (isFunction(Object.assign)) { Object.assign.apply(null, arguments); } else { for (i = 0, len = sources.length; i < len; i++) { source = sources[i]; if (source != null) { for (key in source) { if (!hasProp.call(source, key)) continue; target[key] = source[key]; } } } } return target; }; isFunction = function(val) { return !!val && Object.prototype.toString.call(val) === "[object Function]"; }; isObject = function(val) { var ref; return !!val && ((ref = typeof val) === "function" || ref === "object"); }; isArray = function(val) { if (isFunction(Array.isArray)) { return Array.isArray(val); } else { return Object.prototype.toString.call(val) === "[object Array]"; } }; isEmpty = function(val) { var key; if (isArray(val)) { return !val.length; } else { for (key in val) { if (!hasProp.call(val, key)) continue; return false; } return true; } }; isPlainObject = function(val) { var ctor, proto; return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && typeof ctor === "function" && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object); }; getValue = function(obj) { if (isFunction(obj.valueOf)) { return obj.valueOf(); } else { return obj; } }; module2.exports.assign = assign; module2.exports.isFunction = isFunction; module2.exports.isObject = isObject; module2.exports.isArray = isArray; module2.exports.isEmpty = isEmpty; module2.exports.isPlainObject = isPlainObject; module2.exports.getValue = getValue; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDOMImplementation.js var require_XMLDOMImplementation = __commonJS({ "node_modules/xmlbuilder/lib/XMLDOMImplementation.js"(exports, module2) { (function() { var XMLDOMImplementation; module2.exports = XMLDOMImplementation = class XMLDOMImplementation { hasFeature(feature, version) { return true; } createDocumentType(qualifiedName, publicId, systemId) { throw new Error("This DOM method is not implemented."); } createDocument(namespaceURI, qualifiedName, doctype) { throw new Error("This DOM method is not implemented."); } createHTMLDocument(title) { throw new Error("This DOM method is not implemented."); } getFeature(feature, version) { throw new Error("This DOM method is not implemented."); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js var require_XMLDOMErrorHandler = __commonJS({ "node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js"(exports, module2) { (function() { var XMLDOMErrorHandler; module2.exports = XMLDOMErrorHandler = class XMLDOMErrorHandler { constructor() { } handleError(error) { throw new Error(error); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDOMStringList.js var require_XMLDOMStringList = __commonJS({ "node_modules/xmlbuilder/lib/XMLDOMStringList.js"(exports, module2) { (function() { var XMLDOMStringList; module2.exports = XMLDOMStringList = function() { class XMLDOMStringList2 { constructor(arr) { this.arr = arr || []; } item(index) { return this.arr[index] || null; } contains(str) { return this.arr.indexOf(str) !== -1; } } ; Object.defineProperty(XMLDOMStringList2.prototype, "length", { get: function() { return this.arr.length; } }); return XMLDOMStringList2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDOMConfiguration.js var require_XMLDOMConfiguration = __commonJS({ "node_modules/xmlbuilder/lib/XMLDOMConfiguration.js"(exports, module2) { (function() { var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList; XMLDOMErrorHandler = require_XMLDOMErrorHandler(); XMLDOMStringList = require_XMLDOMStringList(); module2.exports = XMLDOMConfiguration = function() { class XMLDOMConfiguration2 { constructor() { var clonedSelf; this.defaultParams = { "canonical-form": false, "cdata-sections": false, "comments": false, "datatype-normalization": false, "element-content-whitespace": true, "entities": true, "error-handler": new XMLDOMErrorHandler(), "infoset": true, "validate-if-schema": false, "namespaces": true, "namespace-declarations": true, "normalize-characters": false, "schema-location": "", "schema-type": "", "split-cdata-sections": true, "validate": false, "well-formed": true }; this.params = clonedSelf = Object.create(this.defaultParams); } getParameter(name) { if (this.params.hasOwnProperty(name)) { return this.params[name]; } else { return null; } } canSetParameter(name, value) { return true; } setParameter(name, value) { if (value != null) { return this.params[name] = value; } else { return delete this.params[name]; } } } ; Object.defineProperty(XMLDOMConfiguration2.prototype, "parameterNames", { get: function() { return new XMLDOMStringList(Object.keys(this.defaultParams)); } }); return XMLDOMConfiguration2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/NodeType.js var require_NodeType = __commonJS({ "node_modules/xmlbuilder/lib/NodeType.js"(exports, module2) { (function() { module2.exports = { Element: 1, Attribute: 2, Text: 3, CData: 4, EntityReference: 5, EntityDeclaration: 6, ProcessingInstruction: 7, Comment: 8, Document: 9, DocType: 10, DocumentFragment: 11, NotationDeclaration: 12, Declaration: 201, Raw: 202, AttributeDeclaration: 203, ElementDeclaration: 204, Dummy: 205 }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLAttribute.js var require_XMLAttribute = __commonJS({ "node_modules/xmlbuilder/lib/XMLAttribute.js"(exports, module2) { (function() { var NodeType, XMLAttribute, XMLNode; NodeType = require_NodeType(); XMLNode = require_XMLNode(); module2.exports = XMLAttribute = function() { class XMLAttribute2 { constructor(parent, name, value) { this.parent = parent; if (this.parent) { this.options = this.parent.options; this.stringify = this.parent.stringify; } if (name == null) { throw new Error("Missing attribute name. " + this.debugInfo(name)); } this.name = this.stringify.name(name); this.value = this.stringify.attValue(value); this.type = NodeType.Attribute; this.isId = false; this.schemaTypeInfo = null; } clone() { return Object.create(this); } toString(options) { return this.options.writer.attribute(this, this.options.writer.filterOptions(options)); } debugInfo(name) { name = name || this.name; if (name == null) { return "parent: <" + this.parent.name + ">"; } else { return "attribute: {" + name + "}, parent: <" + this.parent.name + ">"; } } isEqualNode(node) { if (node.namespaceURI !== this.namespaceURI) { return false; } if (node.prefix !== this.prefix) { return false; } if (node.localName !== this.localName) { return false; } if (node.value !== this.value) { return false; } return true; } } ; Object.defineProperty(XMLAttribute2.prototype, "nodeType", { get: function() { return this.type; } }); Object.defineProperty(XMLAttribute2.prototype, "ownerElement", { get: function() { return this.parent; } }); Object.defineProperty(XMLAttribute2.prototype, "textContent", { get: function() { return this.value; }, set: function(value) { return this.value = value || ""; } }); Object.defineProperty(XMLAttribute2.prototype, "namespaceURI", { get: function() { return ""; } }); Object.defineProperty(XMLAttribute2.prototype, "prefix", { get: function() { return ""; } }); Object.defineProperty(XMLAttribute2.prototype, "localName", { get: function() { return this.name; } }); Object.defineProperty(XMLAttribute2.prototype, "specified", { get: function() { return true; } }); return XMLAttribute2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLNamedNodeMap.js var require_XMLNamedNodeMap = __commonJS({ "node_modules/xmlbuilder/lib/XMLNamedNodeMap.js"(exports, module2) { (function() { var XMLNamedNodeMap; module2.exports = XMLNamedNodeMap = function() { class XMLNamedNodeMap2 { constructor(nodes) { this.nodes = nodes; } clone() { return this.nodes = null; } getNamedItem(name) { return this.nodes[name]; } setNamedItem(node) { var oldNode; oldNode = this.nodes[node.nodeName]; this.nodes[node.nodeName] = node; return oldNode || null; } removeNamedItem(name) { var oldNode; oldNode = this.nodes[name]; delete this.nodes[name]; return oldNode || null; } item(index) { return this.nodes[Object.keys(this.nodes)[index]] || null; } getNamedItemNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented."); } setNamedItemNS(node) { throw new Error("This DOM method is not implemented."); } removeNamedItemNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented."); } } ; Object.defineProperty(XMLNamedNodeMap2.prototype, "length", { get: function() { return Object.keys(this.nodes).length || 0; } }); return XMLNamedNodeMap2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLElement.js var require_XMLElement = __commonJS({ "node_modules/xmlbuilder/lib/XMLElement.js"(exports, module2) { (function() { var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, hasProp = {}.hasOwnProperty; ({ isObject, isFunction, getValue } = require_Utility()); XMLNode = require_XMLNode(); NodeType = require_NodeType(); XMLAttribute = require_XMLAttribute(); XMLNamedNodeMap = require_XMLNamedNodeMap(); module2.exports = XMLElement = function() { class XMLElement2 extends XMLNode { constructor(parent, name, attributes) { var child, j, len, ref; super(parent); if (name == null) { throw new Error("Missing element name. " + this.debugInfo()); } this.name = this.stringify.name(name); this.type = NodeType.Element; this.attribs = {}; this.schemaTypeInfo = null; if (attributes != null) { this.attribute(attributes); } if (parent.type === NodeType.Document) { this.isRoot = true; this.documentObject = parent; parent.rootObject = this; if (parent.children) { ref = parent.children; for (j = 0, len = ref.length; j < len; j++) { child = ref[j]; if (child.type === NodeType.DocType) { child.name = this.name; break; } } } } } clone() { var att, attName, clonedSelf, ref; clonedSelf = Object.create(this); if (clonedSelf.isRoot) { clonedSelf.documentObject = null; } clonedSelf.attribs = {}; ref = this.attribs; for (attName in ref) { if (!hasProp.call(ref, attName)) continue; att = ref[attName]; clonedSelf.attribs[attName] = att.clone(); } clonedSelf.children = []; this.children.forEach(function(child) { var clonedChild; clonedChild = child.clone(); clonedChild.parent = clonedSelf; return clonedSelf.children.push(clonedChild); }); return clonedSelf; } attribute(name, value) { var attName, attValue; if (name != null) { name = getValue(name); } if (isObject(name)) { for (attName in name) { if (!hasProp.call(name, attName)) continue; attValue = name[attName]; this.attribute(attName, attValue); } } else { if (isFunction(value)) { value = value.apply(); } if (this.options.keepNullAttributes && value == null) { this.attribs[name] = new XMLAttribute(this, name, ""); } else if (value != null) { this.attribs[name] = new XMLAttribute(this, name, value); } } return this; } removeAttribute(name) { var attName, j, len; if (name == null) { throw new Error("Missing attribute name. " + this.debugInfo()); } name = getValue(name); if (Array.isArray(name)) { for (j = 0, len = name.length; j < len; j++) { attName = name[j]; delete this.attribs[attName]; } } else { delete this.attribs[name]; } return this; } toString(options) { return this.options.writer.element(this, this.options.writer.filterOptions(options)); } att(name, value) { return this.attribute(name, value); } a(name, value) { return this.attribute(name, value); } getAttribute(name) { if (this.attribs.hasOwnProperty(name)) { return this.attribs[name].value; } else { return null; } } setAttribute(name, value) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getAttributeNode(name) { if (this.attribs.hasOwnProperty(name)) { return this.attribs[name]; } else { return null; } } setAttributeNode(newAttr) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } removeAttributeNode(oldAttr) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByTagName(name) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getAttributeNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } setAttributeNS(namespaceURI, qualifiedName, value) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } removeAttributeNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getAttributeNodeNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } setAttributeNodeNS(newAttr) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByTagNameNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } hasAttribute(name) { return this.attribs.hasOwnProperty(name); } hasAttributeNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } setIdAttribute(name, isId) { if (this.attribs.hasOwnProperty(name)) { return this.attribs[name].isId; } else { return isId; } } setIdAttributeNS(namespaceURI, localName, isId) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } setIdAttributeNode(idAttr, isId) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByTagName(tagname) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByTagNameNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByClassName(classNames) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } isEqualNode(node) { var i, j, ref; if (!super.isEqualNode(node)) { return false; } if (node.namespaceURI !== this.namespaceURI) { return false; } if (node.prefix !== this.prefix) { return false; } if (node.localName !== this.localName) { return false; } if (node.attribs.length !== this.attribs.length) { return false; } for (i = j = 0, ref = this.attribs.length - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) { if (!this.attribs[i].isEqualNode(node.attribs[i])) { return false; } } return true; } } ; Object.defineProperty(XMLElement2.prototype, "tagName", { get: function() { return this.name; } }); Object.defineProperty(XMLElement2.prototype, "namespaceURI", { get: function() { return ""; } }); Object.defineProperty(XMLElement2.prototype, "prefix", { get: function() { return ""; } }); Object.defineProperty(XMLElement2.prototype, "localName", { get: function() { return this.name; } }); Object.defineProperty(XMLElement2.prototype, "id", { get: function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); Object.defineProperty(XMLElement2.prototype, "className", { get: function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); Object.defineProperty(XMLElement2.prototype, "classList", { get: function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); Object.defineProperty(XMLElement2.prototype, "attributes", { get: function() { if (!this.attributeMap || !this.attributeMap.nodes) { this.attributeMap = new XMLNamedNodeMap(this.attribs); } return this.attributeMap; } }); return XMLElement2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLCharacterData.js var require_XMLCharacterData = __commonJS({ "node_modules/xmlbuilder/lib/XMLCharacterData.js"(exports, module2) { (function() { var XMLCharacterData, XMLNode; XMLNode = require_XMLNode(); module2.exports = XMLCharacterData = function() { class XMLCharacterData2 extends XMLNode { constructor(parent) { super(parent); this.value = ""; } clone() { return Object.create(this); } substringData(offset, count) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } appendData(arg) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } insertData(offset, arg) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } deleteData(offset, count) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } replaceData(offset, count, arg) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } isEqualNode(node) { if (!super.isEqualNode(node)) { return false; } if (node.data !== this.data) { return false; } return true; } } ; Object.defineProperty(XMLCharacterData2.prototype, "data", { get: function() { return this.value; }, set: function(value) { return this.value = value || ""; } }); Object.defineProperty(XMLCharacterData2.prototype, "length", { get: function() { return this.value.length; } }); Object.defineProperty(XMLCharacterData2.prototype, "textContent", { get: function() { return this.value; }, set: function(value) { return this.value = value || ""; } }); return XMLCharacterData2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLCData.js var require_XMLCData = __commonJS({ "node_modules/xmlbuilder/lib/XMLCData.js"(exports, module2) { (function() { var NodeType, XMLCData, XMLCharacterData; NodeType = require_NodeType(); XMLCharacterData = require_XMLCharacterData(); module2.exports = XMLCData = class XMLCData extends XMLCharacterData { constructor(parent, text) { super(parent); if (text == null) { throw new Error("Missing CDATA text. " + this.debugInfo()); } this.name = "#cdata-section"; this.type = NodeType.CData; this.value = this.stringify.cdata(text); } clone() { return Object.create(this); } toString(options) { return this.options.writer.cdata(this, this.options.writer.filterOptions(options)); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLComment.js var require_XMLComment = __commonJS({ "node_modules/xmlbuilder/lib/XMLComment.js"(exports, module2) { (function() { var NodeType, XMLCharacterData, XMLComment; NodeType = require_NodeType(); XMLCharacterData = require_XMLCharacterData(); module2.exports = XMLComment = class XMLComment extends XMLCharacterData { constructor(parent, text) { super(parent); if (text == null) { throw new Error("Missing comment text. " + this.debugInfo()); } this.name = "#comment"; this.type = NodeType.Comment; this.value = this.stringify.comment(text); } clone() { return Object.create(this); } toString(options) { return this.options.writer.comment(this, this.options.writer.filterOptions(options)); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDeclaration.js var require_XMLDeclaration = __commonJS({ "node_modules/xmlbuilder/lib/XMLDeclaration.js"(exports, module2) { (function() { var NodeType, XMLDeclaration, XMLNode, isObject; ({ isObject } = require_Utility()); XMLNode = require_XMLNode(); NodeType = require_NodeType(); module2.exports = XMLDeclaration = class XMLDeclaration extends XMLNode { constructor(parent, version, encoding, standalone) { super(parent); if (isObject(version)) { ({ version, encoding, standalone } = version); } if (!version) { version = "1.0"; } this.type = NodeType.Declaration; this.version = this.stringify.xmlVersion(version); if (encoding != null) { this.encoding = this.stringify.xmlEncoding(encoding); } if (standalone != null) { this.standalone = this.stringify.xmlStandalone(standalone); } } toString(options) { return this.options.writer.declaration(this, this.options.writer.filterOptions(options)); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDTDAttList.js var require_XMLDTDAttList = __commonJS({ "node_modules/xmlbuilder/lib/XMLDTDAttList.js"(exports, module2) { (function() { var NodeType, XMLDTDAttList, XMLNode; XMLNode = require_XMLNode(); NodeType = require_NodeType(); module2.exports = XMLDTDAttList = class XMLDTDAttList extends XMLNode { constructor(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { super(parent); if (elementName == null) { throw new Error("Missing DTD element name. " + this.debugInfo()); } if (attributeName == null) { throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName)); } if (!attributeType) { throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName)); } if (!defaultValueType) { throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName)); } if (defaultValueType.indexOf("#") !== 0) { defaultValueType = "#" + defaultValueType; } if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) { throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName)); } if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName)); } this.elementName = this.stringify.name(elementName); this.type = NodeType.AttributeDeclaration; this.attributeName = this.stringify.name(attributeName); this.attributeType = this.stringify.dtdAttType(attributeType); if (defaultValue) { this.defaultValue = this.stringify.dtdAttDefault(defaultValue); } this.defaultValueType = defaultValueType; } toString(options) { return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options)); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDTDEntity.js var require_XMLDTDEntity = __commonJS({ "node_modules/xmlbuilder/lib/XMLDTDEntity.js"(exports, module2) { (function() { var NodeType, XMLDTDEntity, XMLNode, isObject; ({ isObject } = require_Utility()); XMLNode = require_XMLNode(); NodeType = require_NodeType(); module2.exports = XMLDTDEntity = function() { class XMLDTDEntity2 extends XMLNode { constructor(parent, pe, name, value) { super(parent); if (name == null) { throw new Error("Missing DTD entity name. " + this.debugInfo(name)); } if (value == null) { throw new Error("Missing DTD entity value. " + this.debugInfo(name)); } this.pe = !!pe; this.name = this.stringify.name(name); this.type = NodeType.EntityDeclaration; if (!isObject(value)) { this.value = this.stringify.dtdEntityValue(value); this.internal = true; } else { if (!value.pubID && !value.sysID) { throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name)); } if (value.pubID && !value.sysID) { throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name)); } this.internal = false; if (value.pubID != null) { this.pubID = this.stringify.dtdPubID(value.pubID); } if (value.sysID != null) { this.sysID = this.stringify.dtdSysID(value.sysID); } if (value.nData != null) { this.nData = this.stringify.dtdNData(value.nData); } if (this.pe && this.nData) { throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name)); } } } toString(options) { return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options)); } } ; Object.defineProperty(XMLDTDEntity2.prototype, "publicId", { get: function() { return this.pubID; } }); Object.defineProperty(XMLDTDEntity2.prototype, "systemId", { get: function() { return this.sysID; } }); Object.defineProperty(XMLDTDEntity2.prototype, "notationName", { get: function() { return this.nData || null; } }); Object.defineProperty(XMLDTDEntity2.prototype, "inputEncoding", { get: function() { return null; } }); Object.defineProperty(XMLDTDEntity2.prototype, "xmlEncoding", { get: function() { return null; } }); Object.defineProperty(XMLDTDEntity2.prototype, "xmlVersion", { get: function() { return null; } }); return XMLDTDEntity2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDTDElement.js var require_XMLDTDElement = __commonJS({ "node_modules/xmlbuilder/lib/XMLDTDElement.js"(exports, module2) { (function() { var NodeType, XMLDTDElement, XMLNode; XMLNode = require_XMLNode(); NodeType = require_NodeType(); module2.exports = XMLDTDElement = class XMLDTDElement extends XMLNode { constructor(parent, name, value) { super(parent); if (name == null) { throw new Error("Missing DTD element name. " + this.debugInfo()); } if (!value) { value = "(#PCDATA)"; } if (Array.isArray(value)) { value = "(" + value.join(",") + ")"; } this.name = this.stringify.name(name); this.type = NodeType.ElementDeclaration; this.value = this.stringify.dtdElementValue(value); } toString(options) { return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options)); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDTDNotation.js var require_XMLDTDNotation = __commonJS({ "node_modules/xmlbuilder/lib/XMLDTDNotation.js"(exports, module2) { (function() { var NodeType, XMLDTDNotation, XMLNode; XMLNode = require_XMLNode(); NodeType = require_NodeType(); module2.exports = XMLDTDNotation = function() { class XMLDTDNotation2 extends XMLNode { constructor(parent, name, value) { super(parent); if (name == null) { throw new Error("Missing DTD notation name. " + this.debugInfo(name)); } if (!value.pubID && !value.sysID) { throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name)); } this.name = this.stringify.name(name); this.type = NodeType.NotationDeclaration; if (value.pubID != null) { this.pubID = this.stringify.dtdPubID(value.pubID); } if (value.sysID != null) { this.sysID = this.stringify.dtdSysID(value.sysID); } } toString(options) { return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options)); } } ; Object.defineProperty(XMLDTDNotation2.prototype, "publicId", { get: function() { return this.pubID; } }); Object.defineProperty(XMLDTDNotation2.prototype, "systemId", { get: function() { return this.sysID; } }); return XMLDTDNotation2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDocType.js var require_XMLDocType = __commonJS({ "node_modules/xmlbuilder/lib/XMLDocType.js"(exports, module2) { (function() { var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject; ({ isObject } = require_Utility()); XMLNode = require_XMLNode(); NodeType = require_NodeType(); XMLDTDAttList = require_XMLDTDAttList(); XMLDTDEntity = require_XMLDTDEntity(); XMLDTDElement = require_XMLDTDElement(); XMLDTDNotation = require_XMLDTDNotation(); XMLNamedNodeMap = require_XMLNamedNodeMap(); module2.exports = XMLDocType = function() { class XMLDocType2 extends XMLNode { constructor(parent, pubID, sysID) { var child, i, len, ref; super(parent); this.type = NodeType.DocType; if (parent.children) { ref = parent.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; if (child.type === NodeType.Element) { this.name = child.name; break; } } } this.documentObject = parent; if (isObject(pubID)) { ({ pubID, sysID } = pubID); } if (sysID == null) { [sysID, pubID] = [pubID, sysID]; } if (pubID != null) { this.pubID = this.stringify.dtdPubID(pubID); } if (sysID != null) { this.sysID = this.stringify.dtdSysID(sysID); } } element(name, value) { var child; child = new XMLDTDElement(this, name, value); this.children.push(child); return this; } attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) { var child; child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); this.children.push(child); return this; } entity(name, value) { var child; child = new XMLDTDEntity(this, false, name, value); this.children.push(child); return this; } pEntity(name, value) { var child; child = new XMLDTDEntity(this, true, name, value); this.children.push(child); return this; } notation(name, value) { var child; child = new XMLDTDNotation(this, name, value); this.children.push(child); return this; } toString(options) { return this.options.writer.docType(this, this.options.writer.filterOptions(options)); } ele(name, value) { return this.element(name, value); } att(elementName, attributeName, attributeType, defaultValueType, defaultValue) { return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); } ent(name, value) { return this.entity(name, value); } pent(name, value) { return this.pEntity(name, value); } not(name, value) { return this.notation(name, value); } up() { return this.root() || this.documentObject; } isEqualNode(node) { if (!super.isEqualNode(node)) { return false; } if (node.name !== this.name) { return false; } if (node.publicId !== this.publicId) { return false; } if (node.systemId !== this.systemId) { return false; } return true; } } ; Object.defineProperty(XMLDocType2.prototype, "entities", { get: function() { var child, i, len, nodes, ref; nodes = {}; ref = this.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; if (child.type === NodeType.EntityDeclaration && !child.pe) { nodes[child.name] = child; } } return new XMLNamedNodeMap(nodes); } }); Object.defineProperty(XMLDocType2.prototype, "notations", { get: function() { var child, i, len, nodes, ref; nodes = {}; ref = this.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; if (child.type === NodeType.NotationDeclaration) { nodes[child.name] = child; } } return new XMLNamedNodeMap(nodes); } }); Object.defineProperty(XMLDocType2.prototype, "publicId", { get: function() { return this.pubID; } }); Object.defineProperty(XMLDocType2.prototype, "systemId", { get: function() { return this.sysID; } }); Object.defineProperty(XMLDocType2.prototype, "internalSubset", { get: function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); return XMLDocType2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLRaw.js var require_XMLRaw = __commonJS({ "node_modules/xmlbuilder/lib/XMLRaw.js"(exports, module2) { (function() { var NodeType, XMLNode, XMLRaw; NodeType = require_NodeType(); XMLNode = require_XMLNode(); module2.exports = XMLRaw = class XMLRaw extends XMLNode { constructor(parent, text) { super(parent); if (text == null) { throw new Error("Missing raw text. " + this.debugInfo()); } this.type = NodeType.Raw; this.value = this.stringify.raw(text); } clone() { return Object.create(this); } toString(options) { return this.options.writer.raw(this, this.options.writer.filterOptions(options)); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLText.js var require_XMLText = __commonJS({ "node_modules/xmlbuilder/lib/XMLText.js"(exports, module2) { (function() { var NodeType, XMLCharacterData, XMLText; NodeType = require_NodeType(); XMLCharacterData = require_XMLCharacterData(); module2.exports = XMLText = function() { class XMLText2 extends XMLCharacterData { constructor(parent, text) { super(parent); if (text == null) { throw new Error("Missing element text. " + this.debugInfo()); } this.name = "#text"; this.type = NodeType.Text; this.value = this.stringify.text(text); } clone() { return Object.create(this); } toString(options) { return this.options.writer.text(this, this.options.writer.filterOptions(options)); } splitText(offset) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } replaceWholeText(content) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } } ; Object.defineProperty(XMLText2.prototype, "isElementContentWhitespace", { get: function() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); Object.defineProperty(XMLText2.prototype, "wholeText", { get: function() { var next, prev, str; str = ""; prev = this.previousSibling; while (prev) { str = prev.data + str; prev = prev.previousSibling; } str += this.data; next = this.nextSibling; while (next) { str = str + next.data; next = next.nextSibling; } return str; } }); return XMLText2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLProcessingInstruction.js var require_XMLProcessingInstruction = __commonJS({ "node_modules/xmlbuilder/lib/XMLProcessingInstruction.js"(exports, module2) { (function() { var NodeType, XMLCharacterData, XMLProcessingInstruction; NodeType = require_NodeType(); XMLCharacterData = require_XMLCharacterData(); module2.exports = XMLProcessingInstruction = class XMLProcessingInstruction extends XMLCharacterData { constructor(parent, target, value) { super(parent); if (target == null) { throw new Error("Missing instruction target. " + this.debugInfo()); } this.type = NodeType.ProcessingInstruction; this.target = this.stringify.insTarget(target); this.name = this.target; if (value) { this.value = this.stringify.insValue(value); } } clone() { return Object.create(this); } toString(options) { return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options)); } isEqualNode(node) { if (!super.isEqualNode(node)) { return false; } if (node.target !== this.target) { return false; } return true; } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDummy.js var require_XMLDummy = __commonJS({ "node_modules/xmlbuilder/lib/XMLDummy.js"(exports, module2) { (function() { var NodeType, XMLDummy, XMLNode; XMLNode = require_XMLNode(); NodeType = require_NodeType(); module2.exports = XMLDummy = class XMLDummy extends XMLNode { constructor(parent) { super(parent); this.type = NodeType.Dummy; } clone() { return Object.create(this); } toString(options) { return ""; } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLNodeList.js var require_XMLNodeList = __commonJS({ "node_modules/xmlbuilder/lib/XMLNodeList.js"(exports, module2) { (function() { var XMLNodeList; module2.exports = XMLNodeList = function() { class XMLNodeList2 { constructor(nodes) { this.nodes = nodes; } clone() { return this.nodes = null; } item(index) { return this.nodes[index] || null; } } ; Object.defineProperty(XMLNodeList2.prototype, "length", { get: function() { return this.nodes.length || 0; } }); return XMLNodeList2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/DocumentPosition.js var require_DocumentPosition = __commonJS({ "node_modules/xmlbuilder/lib/DocumentPosition.js"(exports, module2) { (function() { module2.exports = { Disconnected: 1, Preceding: 2, Following: 4, Contains: 8, ContainedBy: 16, ImplementationSpecific: 32 }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLNode.js var require_XMLNode = __commonJS({ "node_modules/xmlbuilder/lib/XMLNode.js"(exports, module2) { (function() { var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, hasProp = {}.hasOwnProperty, splice = [].splice; ({ isObject, isFunction, isEmpty, getValue } = require_Utility()); XMLElement = null; XMLCData = null; XMLComment = null; XMLDeclaration = null; XMLDocType = null; XMLRaw = null; XMLText = null; XMLProcessingInstruction = null; XMLDummy = null; NodeType = null; XMLNodeList = null; XMLNamedNodeMap = null; DocumentPosition = null; module2.exports = XMLNode = function() { class XMLNode2 { constructor(parent1) { this.parent = parent1; if (this.parent) { this.options = this.parent.options; this.stringify = this.parent.stringify; } this.value = null; this.children = []; this.baseURI = null; if (!XMLElement) { XMLElement = require_XMLElement(); XMLCData = require_XMLCData(); XMLComment = require_XMLComment(); XMLDeclaration = require_XMLDeclaration(); XMLDocType = require_XMLDocType(); XMLRaw = require_XMLRaw(); XMLText = require_XMLText(); XMLProcessingInstruction = require_XMLProcessingInstruction(); XMLDummy = require_XMLDummy(); NodeType = require_NodeType(); XMLNodeList = require_XMLNodeList(); XMLNamedNodeMap = require_XMLNamedNodeMap(); DocumentPosition = require_DocumentPosition(); } } setParent(parent) { var child, j, len, ref1, results; this.parent = parent; if (parent) { this.options = parent.options; this.stringify = parent.stringify; } ref1 = this.children; results = []; for (j = 0, len = ref1.length; j < len; j++) { child = ref1[j]; results.push(child.setParent(this)); } return results; } element(name, attributes, text) { var childNode, item, j, k, key, lastChild, len, len1, val; lastChild = null; if (attributes === null && text == null) { [attributes, text] = [{}, null]; } if (attributes == null) { attributes = {}; } attributes = getValue(attributes); if (!isObject(attributes)) { [text, attributes] = [attributes, text]; } if (name != null) { name = getValue(name); } if (Array.isArray(name)) { for (j = 0, len = name.length; j < len; j++) { item = name[j]; lastChild = this.element(item); } } else if (isFunction(name)) { lastChild = this.element(name.apply()); } else if (isObject(name)) { for (key in name) { if (!hasProp.call(name, key)) continue; val = name[key]; if (isFunction(val)) { val = val.apply(); } if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) { lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val); } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) { lastChild = this.dummy(); } else if (isObject(val) && isEmpty(val)) { lastChild = this.element(key); } else if (!this.options.keepNullNodes && val == null) { lastChild = this.dummy(); } else if (!this.options.separateArrayItems && Array.isArray(val)) { for (k = 0, len1 = val.length; k < len1; k++) { item = val[k]; childNode = {}; childNode[key] = item; lastChild = this.element(childNode); } } else if (isObject(val)) { if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) { lastChild = this.element(val); } else { lastChild = this.element(key); lastChild.element(val); } } else { lastChild = this.element(key, val); } } } else if (!this.options.keepNullNodes && text === null) { lastChild = this.dummy(); } else { if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) { lastChild = this.text(text); } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) { lastChild = this.cdata(text); } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) { lastChild = this.comment(text); } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) { lastChild = this.raw(text); } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) { lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text); } else { lastChild = this.node(name, attributes, text); } } if (lastChild == null) { throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo()); } return lastChild; } insertBefore(name, attributes, text) { var child, i, newChild, refChild, removed; if (name != null ? name.type : void 0) { newChild = name; refChild = attributes; newChild.setParent(this); if (refChild) { i = children.indexOf(refChild); removed = children.splice(i); children.push(newChild); Array.prototype.push.apply(children, removed); } else { children.push(newChild); } return newChild; } else { if (this.isRoot) { throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); } i = this.parent.children.indexOf(this); removed = this.parent.children.splice(i); child = this.parent.element(name, attributes, text); Array.prototype.push.apply(this.parent.children, removed); return child; } } insertAfter(name, attributes, text) { var child, i, removed; if (this.isRoot) { throw new Error("Cannot insert elements at root level. " + this.debugInfo(name)); } i = this.parent.children.indexOf(this); removed = this.parent.children.splice(i + 1); child = this.parent.element(name, attributes, text); Array.prototype.push.apply(this.parent.children, removed); return child; } remove() { var i, ref1; if (this.isRoot) { throw new Error("Cannot remove the root element. " + this.debugInfo()); } i = this.parent.children.indexOf(this); splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1; return this.parent; } node(name, attributes, text) { var child; if (name != null) { name = getValue(name); } attributes || (attributes = {}); attributes = getValue(attributes); if (!isObject(attributes)) { [text, attributes] = [attributes, text]; } child = new XMLElement(this, name, attributes); if (text != null) { child.text(text); } this.children.push(child); return child; } text(value) { var child; if (isObject(value)) { this.element(value); } child = new XMLText(this, value); this.children.push(child); return this; } cdata(value) { var child; child = new XMLCData(this, value); this.children.push(child); return this; } comment(value) { var child; child = new XMLComment(this, value); this.children.push(child); return this; } commentBefore(value) { var child, i, removed; i = this.parent.children.indexOf(this); removed = this.parent.children.splice(i); child = this.parent.comment(value); Array.prototype.push.apply(this.parent.children, removed); return this; } commentAfter(value) { var child, i, removed; i = this.parent.children.indexOf(this); removed = this.parent.children.splice(i + 1); child = this.parent.comment(value); Array.prototype.push.apply(this.parent.children, removed); return this; } raw(value) { var child; child = new XMLRaw(this, value); this.children.push(child); return this; } dummy() { var child; child = new XMLDummy(this); return child; } instruction(target, value) { var insTarget, insValue, instruction, j, len; if (target != null) { target = getValue(target); } if (value != null) { value = getValue(value); } if (Array.isArray(target)) { for (j = 0, len = target.length; j < len; j++) { insTarget = target[j]; this.instruction(insTarget); } } else if (isObject(target)) { for (insTarget in target) { if (!hasProp.call(target, insTarget)) continue; insValue = target[insTarget]; this.instruction(insTarget, insValue); } } else { if (isFunction(value)) { value = value.apply(); } instruction = new XMLProcessingInstruction(this, target, value); this.children.push(instruction); } return this; } instructionBefore(target, value) { var child, i, removed; i = this.parent.children.indexOf(this); removed = this.parent.children.splice(i); child = this.parent.instruction(target, value); Array.prototype.push.apply(this.parent.children, removed); return this; } instructionAfter(target, value) { var child, i, removed; i = this.parent.children.indexOf(this); removed = this.parent.children.splice(i + 1); child = this.parent.instruction(target, value); Array.prototype.push.apply(this.parent.children, removed); return this; } declaration(version, encoding, standalone) { var doc, xmldec; doc = this.document(); xmldec = new XMLDeclaration(doc, version, encoding, standalone); if (doc.children.length === 0) { doc.children.unshift(xmldec); } else if (doc.children[0].type === NodeType.Declaration) { doc.children[0] = xmldec; } else { doc.children.unshift(xmldec); } return doc.root() || doc; } dtd(pubID, sysID) { var child, doc, doctype, i, j, k, len, len1, ref1, ref2; doc = this.document(); doctype = new XMLDocType(doc, pubID, sysID); ref1 = doc.children; for (i = j = 0, len = ref1.length; j < len; i = ++j) { child = ref1[i]; if (child.type === NodeType.DocType) { doc.children[i] = doctype; return doctype; } } ref2 = doc.children; for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) { child = ref2[i]; if (child.isRoot) { doc.children.splice(i, 0, doctype); return doctype; } } doc.children.push(doctype); return doctype; } up() { if (this.isRoot) { throw new Error("The root node has no parent. Use doc() if you need to get the document object."); } return this.parent; } root() { var node; node = this; while (node) { if (node.type === NodeType.Document) { return node.rootObject; } else if (node.isRoot) { return node; } else { node = node.parent; } } } document() { var node; node = this; while (node) { if (node.type === NodeType.Document) { return node; } else { node = node.parent; } } } end(options) { return this.document().end(options); } prev() { var i; i = this.parent.children.indexOf(this); if (i < 1) { throw new Error("Already at the first node. " + this.debugInfo()); } return this.parent.children[i - 1]; } next() { var i; i = this.parent.children.indexOf(this); if (i === -1 || i === this.parent.children.length - 1) { throw new Error("Already at the last node. " + this.debugInfo()); } return this.parent.children[i + 1]; } importDocument(doc) { var child, clonedRoot, j, len, ref1; clonedRoot = doc.root().clone(); clonedRoot.parent = this; clonedRoot.isRoot = false; this.children.push(clonedRoot); if (this.type === NodeType.Document) { clonedRoot.isRoot = true; clonedRoot.documentObject = this; this.rootObject = clonedRoot; if (this.children) { ref1 = this.children; for (j = 0, len = ref1.length; j < len; j++) { child = ref1[j]; if (child.type === NodeType.DocType) { child.name = clonedRoot.name; break; } } } } return this; } debugInfo(name) { var ref1, ref2; name = name || this.name; if (name == null && !((ref1 = this.parent) != null ? ref1.name : void 0)) { return ""; } else if (name == null) { return "parent: <" + this.parent.name + ">"; } else if (!((ref2 = this.parent) != null ? ref2.name : void 0)) { return "node: <" + name + ">"; } else { return "node: <" + name + ">, parent: <" + this.parent.name + ">"; } } ele(name, attributes, text) { return this.element(name, attributes, text); } nod(name, attributes, text) { return this.node(name, attributes, text); } txt(value) { return this.text(value); } dat(value) { return this.cdata(value); } com(value) { return this.comment(value); } ins(target, value) { return this.instruction(target, value); } doc() { return this.document(); } dec(version, encoding, standalone) { return this.declaration(version, encoding, standalone); } e(name, attributes, text) { return this.element(name, attributes, text); } n(name, attributes, text) { return this.node(name, attributes, text); } t(value) { return this.text(value); } d(value) { return this.cdata(value); } c(value) { return this.comment(value); } r(value) { return this.raw(value); } i(target, value) { return this.instruction(target, value); } u() { return this.up(); } importXMLBuilder(doc) { return this.importDocument(doc); } attribute(name, value) { throw new Error("attribute() applies to element nodes only."); } att(name, value) { return this.attribute(name, value); } a(name, value) { return this.attribute(name, value); } removeAttribute(name) { throw new Error("attribute() applies to element nodes only."); } replaceChild(newChild, oldChild) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } removeChild(oldChild) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } appendChild(newChild) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } hasChildNodes() { return this.children.length !== 0; } cloneNode(deep) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } normalize() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } isSupported(feature, version) { return true; } hasAttributes() { return this.attribs.length !== 0; } compareDocumentPosition(other) { var ref, res; ref = this; if (ref === other) { return 0; } else if (this.document() !== other.document()) { res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific; if (Math.random() < 0.5) { res |= DocumentPosition.Preceding; } else { res |= DocumentPosition.Following; } return res; } else if (ref.isAncestor(other)) { return DocumentPosition.Contains | DocumentPosition.Preceding; } else if (ref.isDescendant(other)) { return DocumentPosition.Contains | DocumentPosition.Following; } else if (ref.isPreceding(other)) { return DocumentPosition.Preceding; } else { return DocumentPosition.Following; } } isSameNode(other) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } lookupPrefix(namespaceURI) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } isDefaultNamespace(namespaceURI) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } lookupNamespaceURI(prefix) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } isEqualNode(node) { var i, j, ref1; if (node.nodeType !== this.nodeType) { return false; } if (node.children.length !== this.children.length) { return false; } for (i = j = 0, ref1 = this.children.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) { if (!this.children[i].isEqualNode(node.children[i])) { return false; } } return true; } getFeature(feature, version) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } setUserData(key, data, handler) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getUserData(key) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } contains(other) { if (!other) { return false; } return other === this || this.isDescendant(other); } isDescendant(node) { var child, isDescendantChild, j, len, ref1; ref1 = this.children; for (j = 0, len = ref1.length; j < len; j++) { child = ref1[j]; if (node === child) { return true; } isDescendantChild = child.isDescendant(node); if (isDescendantChild) { return true; } } return false; } isAncestor(node) { return node.isDescendant(this); } isPreceding(node) { var nodePos, thisPos; nodePos = this.treePosition(node); thisPos = this.treePosition(this); if (nodePos === -1 || thisPos === -1) { return false; } else { return nodePos < thisPos; } } isFollowing(node) { var nodePos, thisPos; nodePos = this.treePosition(node); thisPos = this.treePosition(this); if (nodePos === -1 || thisPos === -1) { return false; } else { return nodePos > thisPos; } } treePosition(node) { var found, pos; pos = 0; found = false; this.foreachTreeNode(this.document(), function(childNode) { pos++; if (!found && childNode === node) { return found = true; } }); if (found) { return pos; } else { return -1; } } foreachTreeNode(node, func) { var child, j, len, ref1, res; node || (node = this.document()); ref1 = node.children; for (j = 0, len = ref1.length; j < len; j++) { child = ref1[j]; if (res = func(child)) { return res; } else { res = this.foreachTreeNode(child, func); if (res) { return res; } } } } } ; Object.defineProperty(XMLNode2.prototype, "nodeName", { get: function() { return this.name; } }); Object.defineProperty(XMLNode2.prototype, "nodeType", { get: function() { return this.type; } }); Object.defineProperty(XMLNode2.prototype, "nodeValue", { get: function() { return this.value; } }); Object.defineProperty(XMLNode2.prototype, "parentNode", { get: function() { return this.parent; } }); Object.defineProperty(XMLNode2.prototype, "childNodes", { get: function() { if (!this.childNodeList || !this.childNodeList.nodes) { this.childNodeList = new XMLNodeList(this.children); } return this.childNodeList; } }); Object.defineProperty(XMLNode2.prototype, "firstChild", { get: function() { return this.children[0] || null; } }); Object.defineProperty(XMLNode2.prototype, "lastChild", { get: function() { return this.children[this.children.length - 1] || null; } }); Object.defineProperty(XMLNode2.prototype, "previousSibling", { get: function() { var i; i = this.parent.children.indexOf(this); return this.parent.children[i - 1] || null; } }); Object.defineProperty(XMLNode2.prototype, "nextSibling", { get: function() { var i; i = this.parent.children.indexOf(this); return this.parent.children[i + 1] || null; } }); Object.defineProperty(XMLNode2.prototype, "ownerDocument", { get: function() { return this.document() || null; } }); Object.defineProperty(XMLNode2.prototype, "textContent", { get: function() { var child, j, len, ref1, str; if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) { str = ""; ref1 = this.children; for (j = 0, len = ref1.length; j < len; j++) { child = ref1[j]; if (child.textContent) { str += child.textContent; } } return str; } else { return null; } }, set: function(value) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } }); return XMLNode2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLStringifier.js var require_XMLStringifier = __commonJS({ "node_modules/xmlbuilder/lib/XMLStringifier.js"(exports, module2) { (function() { var XMLStringifier, hasProp = {}.hasOwnProperty; module2.exports = XMLStringifier = function() { class XMLStringifier2 { constructor(options) { var key, ref, value; this.assertLegalChar = this.assertLegalChar.bind(this); this.assertLegalName = this.assertLegalName.bind(this); options || (options = {}); this.options = options; if (!this.options.version) { this.options.version = "1.0"; } ref = options.stringify || {}; for (key in ref) { if (!hasProp.call(ref, key)) continue; value = ref[key]; this[key] = value; } } name(val) { if (this.options.noValidation) { return val; } return this.assertLegalName("" + val || ""); } text(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar(this.textEscape("" + val || "")); } cdata(val) { if (this.options.noValidation) { return val; } val = "" + val || ""; val = val.replace("]]>", "]]]]>"); return this.assertLegalChar(val); } comment(val) { if (this.options.noValidation) { return val; } val = "" + val || ""; if (val.match(/--/)) { throw new Error("Comment text cannot contain double-hypen: " + val); } return this.assertLegalChar(val); } raw(val) { if (this.options.noValidation) { return val; } return "" + val || ""; } attValue(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar(this.attEscape(val = "" + val || "")); } insTarget(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } insValue(val) { if (this.options.noValidation) { return val; } val = "" + val || ""; if (val.match(/\?>/)) { throw new Error("Invalid processing instruction value: " + val); } return this.assertLegalChar(val); } xmlVersion(val) { if (this.options.noValidation) { return val; } val = "" + val || ""; if (!val.match(/1\.[0-9]+/)) { throw new Error("Invalid version number: " + val); } return val; } xmlEncoding(val) { if (this.options.noValidation) { return val; } val = "" + val || ""; if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { throw new Error("Invalid encoding: " + val); } return this.assertLegalChar(val); } xmlStandalone(val) { if (this.options.noValidation) { return val; } if (val) { return "yes"; } else { return "no"; } } dtdPubID(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } dtdSysID(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } dtdElementValue(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } dtdAttType(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } dtdAttDefault(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } dtdEntityValue(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } dtdNData(val) { if (this.options.noValidation) { return val; } return this.assertLegalChar("" + val || ""); } assertLegalChar(str) { var regex, res; if (this.options.noValidation) { return str; } if (this.options.version === "1.0") { regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g; if (this.options.invalidCharReplacement !== void 0) { str = str.replace(regex, this.options.invalidCharReplacement); } else if (res = str.match(regex)) { throw new Error(`Invalid character in string: ${str} at index ${res.index}`); } } else if (this.options.version === "1.1") { regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g; if (this.options.invalidCharReplacement !== void 0) { str = str.replace(regex, this.options.invalidCharReplacement); } else if (res = str.match(regex)) { throw new Error(`Invalid character in string: ${str} at index ${res.index}`); } } return str; } assertLegalName(str) { var regex; if (this.options.noValidation) { return str; } str = this.assertLegalChar(str); regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/; if (!str.match(regex)) { throw new Error(`Invalid character in name: ${str}`); } return str; } textEscape(str) { var ampregex; if (this.options.noValidation) { return str; } ampregex = this.options.noDoubleEncoding ? /(?!&(lt|gt|amp|apos|quot);)&/g : /&/g; return str.replace(ampregex, "&").replace(//g, ">").replace(/\r/g, " "); } attEscape(str) { var ampregex; if (this.options.noValidation) { return str; } ampregex = this.options.noDoubleEncoding ? /(?!&(lt|gt|amp|apos|quot);)&/g : /&/g; return str.replace(ampregex, "&").replace(/ 0) { return new Array(indentLevel).join(options.indent); } } return ""; } endline(node, options, level) { if (!options.pretty || options.suppressPrettyCount) { return ""; } else { return options.newline; } } attribute(att, options, level) { var r; this.openAttribute(att, options, level); if (options.pretty && options.width > 0) { r = att.name + '="' + att.value + '"'; } else { r = " " + att.name + '="' + att.value + '"'; } this.closeAttribute(att, options, level); return r; } cdata(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "" + this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } comment(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "" + this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } declaration(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + ""; r += this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } docType(node, options, level) { var child, i, len1, r, ref; level || (level = 0); this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level); r += " 0) { r += " ["; r += this.endline(node, options, level); options.state = WriterState.InsideTag; ref = node.children; for (i = 0, len1 = ref.length; i < len1; i++) { child = ref[i]; r += this.writeChildNode(child, options, level + 1); } options.state = WriterState.CloseTag; r += "]"; } options.state = WriterState.CloseTag; r += options.spaceBeforeSlash + ">"; r += this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } element(node, options, level) { var att, attLen, child, childNodeCount, firstChildNode, i, j, len, len1, len2, name, prettySuppressed, r, ratt, ref, ref1, ref2, ref3, rline; level || (level = 0); prettySuppressed = false; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "<" + node.name; if (options.pretty && options.width > 0) { len = r.length; ref = node.attribs; for (name in ref) { if (!hasProp.call(ref, name)) continue; att = ref[name]; ratt = this.attribute(att, options, level); attLen = ratt.length; if (len + attLen > options.width) { rline = this.indent(node, options, level + 1) + ratt; r += this.endline(node, options, level) + rline; len = rline.length; } else { rline = " " + ratt; r += rline; len += rline.length; } } } else { ref1 = node.attribs; for (name in ref1) { if (!hasProp.call(ref1, name)) continue; att = ref1[name]; r += this.attribute(att, options, level); } } childNodeCount = node.children.length; firstChildNode = childNodeCount === 0 ? null : node.children[0]; if (childNodeCount === 0 || node.children.every(function(e) { return (e.type === NodeType.Text || e.type === NodeType.Raw || e.type === NodeType.CData) && e.value === ""; })) { if (options.allowEmpty) { r += ">"; options.state = WriterState.CloseTag; r += "" + this.endline(node, options, level); } else { options.state = WriterState.CloseTag; r += options.spaceBeforeSlash + "/>" + this.endline(node, options, level); } } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw || firstChildNode.type === NodeType.CData) && firstChildNode.value != null) { r += ">"; options.state = WriterState.InsideTag; options.suppressPrettyCount++; prettySuppressed = true; r += this.writeChildNode(firstChildNode, options, level + 1); options.suppressPrettyCount--; prettySuppressed = false; options.state = WriterState.CloseTag; r += "" + this.endline(node, options, level); } else { if (options.dontPrettyTextNodes) { ref2 = node.children; for (i = 0, len1 = ref2.length; i < len1; i++) { child = ref2[i]; if ((child.type === NodeType.Text || child.type === NodeType.Raw || child.type === NodeType.CData) && child.value != null) { options.suppressPrettyCount++; prettySuppressed = true; break; } } } r += ">" + this.endline(node, options, level); options.state = WriterState.InsideTag; ref3 = node.children; for (j = 0, len2 = ref3.length; j < len2; j++) { child = ref3[j]; r += this.writeChildNode(child, options, level + 1); } options.state = WriterState.CloseTag; r += this.indent(node, options, level) + ""; if (prettySuppressed) { options.suppressPrettyCount--; } r += this.endline(node, options, level); options.state = WriterState.None; } this.closeNode(node, options, level); return r; } writeChildNode(node, options, level) { switch (node.type) { case NodeType.CData: return this.cdata(node, options, level); case NodeType.Comment: return this.comment(node, options, level); case NodeType.Element: return this.element(node, options, level); case NodeType.Raw: return this.raw(node, options, level); case NodeType.Text: return this.text(node, options, level); case NodeType.ProcessingInstruction: return this.processingInstruction(node, options, level); case NodeType.Dummy: return ""; case NodeType.Declaration: return this.declaration(node, options, level); case NodeType.DocType: return this.docType(node, options, level); case NodeType.AttributeDeclaration: return this.dtdAttList(node, options, level); case NodeType.ElementDeclaration: return this.dtdElement(node, options, level); case NodeType.EntityDeclaration: return this.dtdEntity(node, options, level); case NodeType.NotationDeclaration: return this.dtdNotation(node, options, level); default: throw new Error("Unknown XML node type: " + node.constructor.name); } } processingInstruction(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + ""; r += this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } raw(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level); options.state = WriterState.InsideTag; r += node.value; options.state = WriterState.CloseTag; r += this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } text(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level); options.state = WriterState.InsideTag; r += node.value; options.state = WriterState.CloseTag; r += this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } dtdAttList(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "" + this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } dtdElement(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "" + this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } dtdEntity(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "" + this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } dtdNotation(node, options, level) { var r; this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "" + this.endline(node, options, level); options.state = WriterState.None; this.closeNode(node, options, level); return r; } openNode(node, options, level) { } closeNode(node, options, level) { } openAttribute(att, options, level) { } closeAttribute(att, options, level) { } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLStringWriter.js var require_XMLStringWriter = __commonJS({ "node_modules/xmlbuilder/lib/XMLStringWriter.js"(exports, module2) { (function() { var XMLStringWriter, XMLWriterBase; XMLWriterBase = require_XMLWriterBase(); module2.exports = XMLStringWriter = class XMLStringWriter extends XMLWriterBase { constructor(options) { super(options); } document(doc, options) { var child, i, len, r, ref; options = this.filterOptions(options); r = ""; ref = doc.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; r += this.writeChildNode(child, options, 0); } if (options.pretty && r.slice(-options.newline.length) === options.newline) { r = r.slice(0, -options.newline.length); } return r; } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDocument.js var require_XMLDocument = __commonJS({ "node_modules/xmlbuilder/lib/XMLDocument.js"(exports, module2) { (function() { var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject; ({ isPlainObject } = require_Utility()); XMLDOMImplementation = require_XMLDOMImplementation(); XMLDOMConfiguration = require_XMLDOMConfiguration(); XMLNode = require_XMLNode(); NodeType = require_NodeType(); XMLStringifier = require_XMLStringifier(); XMLStringWriter = require_XMLStringWriter(); module2.exports = XMLDocument = function() { class XMLDocument2 extends XMLNode { constructor(options) { super(null); this.name = "#document"; this.type = NodeType.Document; this.documentURI = null; this.domConfig = new XMLDOMConfiguration(); options || (options = {}); if (!options.writer) { options.writer = new XMLStringWriter(); } this.options = options; this.stringify = new XMLStringifier(options); } end(writer) { var writerOptions; writerOptions = {}; if (!writer) { writer = this.options.writer; } else if (isPlainObject(writer)) { writerOptions = writer; writer = this.options.writer; } return writer.document(this, writer.filterOptions(writerOptions)); } toString(options) { return this.options.writer.document(this, this.options.writer.filterOptions(options)); } createElement(tagName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createDocumentFragment() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createTextNode(data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createComment(data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createCDATASection(data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createProcessingInstruction(target, data) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createAttribute(name) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createEntityReference(name) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByTagName(tagname) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } importNode(importedNode, deep) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createElementNS(namespaceURI, qualifiedName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createAttributeNS(namespaceURI, qualifiedName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByTagNameNS(namespaceURI, localName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementById(elementId) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } adoptNode(source) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } normalizeDocument() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } renameNode(node, namespaceURI, qualifiedName) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } getElementsByClassName(classNames) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createEvent(eventInterface) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createRange() { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createNodeIterator(root, whatToShow, filter) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } createTreeWalker(root, whatToShow, filter) { throw new Error("This DOM method is not implemented." + this.debugInfo()); } } ; Object.defineProperty(XMLDocument2.prototype, "implementation", { value: new XMLDOMImplementation() }); Object.defineProperty(XMLDocument2.prototype, "doctype", { get: function() { var child, i, len, ref; ref = this.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; if (child.type === NodeType.DocType) { return child; } } return null; } }); Object.defineProperty(XMLDocument2.prototype, "documentElement", { get: function() { return this.rootObject || null; } }); Object.defineProperty(XMLDocument2.prototype, "inputEncoding", { get: function() { return null; } }); Object.defineProperty(XMLDocument2.prototype, "strictErrorChecking", { get: function() { return false; } }); Object.defineProperty(XMLDocument2.prototype, "xmlEncoding", { get: function() { if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { return this.children[0].encoding; } else { return null; } } }); Object.defineProperty(XMLDocument2.prototype, "xmlStandalone", { get: function() { if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { return this.children[0].standalone === "yes"; } else { return false; } } }); Object.defineProperty(XMLDocument2.prototype, "xmlVersion", { get: function() { if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) { return this.children[0].version; } else { return "1.0"; } } }); Object.defineProperty(XMLDocument2.prototype, "URL", { get: function() { return this.documentURI; } }); Object.defineProperty(XMLDocument2.prototype, "origin", { get: function() { return null; } }); Object.defineProperty(XMLDocument2.prototype, "compatMode", { get: function() { return null; } }); Object.defineProperty(XMLDocument2.prototype, "characterSet", { get: function() { return null; } }); Object.defineProperty(XMLDocument2.prototype, "contentType", { get: function() { return null; } }); return XMLDocument2; }.call(this); }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLDocumentCB.js var require_XMLDocumentCB = __commonJS({ "node_modules/xmlbuilder/lib/XMLDocumentCB.js"(exports, module2) { (function() { var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, hasProp = {}.hasOwnProperty; ({ isObject, isFunction, isPlainObject, getValue } = require_Utility()); NodeType = require_NodeType(); XMLDocument = require_XMLDocument(); XMLElement = require_XMLElement(); XMLCData = require_XMLCData(); XMLComment = require_XMLComment(); XMLRaw = require_XMLRaw(); XMLText = require_XMLText(); XMLProcessingInstruction = require_XMLProcessingInstruction(); XMLDeclaration = require_XMLDeclaration(); XMLDocType = require_XMLDocType(); XMLDTDAttList = require_XMLDTDAttList(); XMLDTDEntity = require_XMLDTDEntity(); XMLDTDElement = require_XMLDTDElement(); XMLDTDNotation = require_XMLDTDNotation(); XMLAttribute = require_XMLAttribute(); XMLStringifier = require_XMLStringifier(); XMLStringWriter = require_XMLStringWriter(); WriterState = require_WriterState(); module2.exports = XMLDocumentCB = class XMLDocumentCB { constructor(options, onData, onEnd) { var writerOptions; this.name = "?xml"; this.type = NodeType.Document; options || (options = {}); writerOptions = {}; if (!options.writer) { options.writer = new XMLStringWriter(); } else if (isPlainObject(options.writer)) { writerOptions = options.writer; options.writer = new XMLStringWriter(); } this.options = options; this.writer = options.writer; this.writerOptions = this.writer.filterOptions(writerOptions); this.stringify = new XMLStringifier(options); this.onDataCallback = onData || function() { }; this.onEndCallback = onEnd || function() { }; this.currentNode = null; this.currentLevel = -1; this.openTags = {}; this.documentStarted = false; this.documentCompleted = false; this.root = null; } createChildNode(node) { var att, attName, attributes, child, i, len, ref, ref1; switch (node.type) { case NodeType.CData: this.cdata(node.value); break; case NodeType.Comment: this.comment(node.value); break; case NodeType.Element: attributes = {}; ref = node.attribs; for (attName in ref) { if (!hasProp.call(ref, attName)) continue; att = ref[attName]; attributes[attName] = att.value; } this.node(node.name, attributes); break; case NodeType.Dummy: this.dummy(); break; case NodeType.Raw: this.raw(node.value); break; case NodeType.Text: this.text(node.value); break; case NodeType.ProcessingInstruction: this.instruction(node.target, node.value); break; default: throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name); } ref1 = node.children; for (i = 0, len = ref1.length; i < len; i++) { child = ref1[i]; this.createChildNode(child); if (child.type === NodeType.Element) { this.up(); } } return this; } dummy() { return this; } node(name, attributes, text) { if (name == null) { throw new Error("Missing node name."); } if (this.root && this.currentLevel === -1) { throw new Error("Document can only have one root node. " + this.debugInfo(name)); } this.openCurrent(); name = getValue(name); if (attributes == null) { attributes = {}; } attributes = getValue(attributes); if (!isObject(attributes)) { [text, attributes] = [attributes, text]; } this.currentNode = new XMLElement(this, name, attributes); this.currentNode.children = false; this.currentLevel++; this.openTags[this.currentLevel] = this.currentNode; if (text != null) { this.text(text); } return this; } element(name, attributes, text) { var child, i, len, oldValidationFlag, ref, root; if (this.currentNode && this.currentNode.type === NodeType.DocType) { this.dtdElement(...arguments); } else { if (Array.isArray(name) || isObject(name) || isFunction(name)) { oldValidationFlag = this.options.noValidation; this.options.noValidation = true; root = new XMLDocument(this.options).element("TEMP_ROOT"); root.element(name); this.options.noValidation = oldValidationFlag; ref = root.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; this.createChildNode(child); if (child.type === NodeType.Element) { this.up(); } } } else { this.node(name, attributes, text); } } return this; } attribute(name, value) { var attName, attValue; if (!this.currentNode || this.currentNode.children) { throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name)); } if (name != null) { name = getValue(name); } if (isObject(name)) { for (attName in name) { if (!hasProp.call(name, attName)) continue; attValue = name[attName]; this.attribute(attName, attValue); } } else { if (isFunction(value)) { value = value.apply(); } if (this.options.keepNullAttributes && value == null) { this.currentNode.attribs[name] = new XMLAttribute(this, name, ""); } else if (value != null) { this.currentNode.attribs[name] = new XMLAttribute(this, name, value); } } return this; } text(value) { var node; this.openCurrent(); node = new XMLText(this, value); this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } cdata(value) { var node; this.openCurrent(); node = new XMLCData(this, value); this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } comment(value) { var node; this.openCurrent(); node = new XMLComment(this, value); this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } raw(value) { var node; this.openCurrent(); node = new XMLRaw(this, value); this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } instruction(target, value) { var i, insTarget, insValue, len, node; this.openCurrent(); if (target != null) { target = getValue(target); } if (value != null) { value = getValue(value); } if (Array.isArray(target)) { for (i = 0, len = target.length; i < len; i++) { insTarget = target[i]; this.instruction(insTarget); } } else if (isObject(target)) { for (insTarget in target) { if (!hasProp.call(target, insTarget)) continue; insValue = target[insTarget]; this.instruction(insTarget, insValue); } } else { if (isFunction(value)) { value = value.apply(); } node = new XMLProcessingInstruction(this, target, value); this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); } return this; } declaration(version, encoding, standalone) { var node; this.openCurrent(); if (this.documentStarted) { throw new Error("declaration() must be the first node."); } node = new XMLDeclaration(this, version, encoding, standalone); this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } doctype(root, pubID, sysID) { this.openCurrent(); if (root == null) { throw new Error("Missing root node name."); } if (this.root) { throw new Error("dtd() must come before the root node."); } this.currentNode = new XMLDocType(this, pubID, sysID); this.currentNode.rootNodeName = root; this.currentNode.children = false; this.currentLevel++; this.openTags[this.currentLevel] = this.currentNode; return this; } dtdElement(name, value) { var node; this.openCurrent(); node = new XMLDTDElement(this, name, value); this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } attList(elementName, attributeName, attributeType, defaultValueType, defaultValue) { var node; this.openCurrent(); node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } entity(name, value) { var node; this.openCurrent(); node = new XMLDTDEntity(this, false, name, value); this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } pEntity(name, value) { var node; this.openCurrent(); node = new XMLDTDEntity(this, true, name, value); this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } notation(name, value) { var node; this.openCurrent(); node = new XMLDTDNotation(this, name, value); this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1); return this; } up() { if (this.currentLevel < 0) { throw new Error("The document node has no parent."); } if (this.currentNode) { if (this.currentNode.children) { this.closeNode(this.currentNode); } else { this.openNode(this.currentNode); } this.currentNode = null; } else { this.closeNode(this.openTags[this.currentLevel]); } delete this.openTags[this.currentLevel]; this.currentLevel--; return this; } end() { while (this.currentLevel >= 0) { this.up(); } return this.onEnd(); } openCurrent() { if (this.currentNode) { this.currentNode.children = true; return this.openNode(this.currentNode); } } openNode(node) { var att, chunk, name, ref; if (!node.isOpen) { if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) { this.root = node; } chunk = ""; if (node.type === NodeType.Element) { this.writerOptions.state = WriterState.OpenTag; chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + "<" + node.name; ref = node.attribs; for (name in ref) { if (!hasProp.call(ref, name)) continue; att = ref[name]; chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel); } chunk += (node.children ? ">" : "/>") + this.writer.endline(node, this.writerOptions, this.currentLevel); this.writerOptions.state = WriterState.InsideTag; } else { this.writerOptions.state = WriterState.OpenTag; chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ""; } chunk += this.writer.endline(node, this.writerOptions, this.currentLevel); } this.onData(chunk, this.currentLevel); return node.isOpen = true; } } closeNode(node) { var chunk; if (!node.isClosed) { chunk = ""; this.writerOptions.state = WriterState.CloseTag; if (node.type === NodeType.Element) { chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + "" + this.writer.endline(node, this.writerOptions, this.currentLevel); } else { chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + "]>" + this.writer.endline(node, this.writerOptions, this.currentLevel); } this.writerOptions.state = WriterState.None; this.onData(chunk, this.currentLevel); return node.isClosed = true; } } onData(chunk, level) { this.documentStarted = true; return this.onDataCallback(chunk, level + 1); } onEnd() { this.documentCompleted = true; return this.onEndCallback(); } debugInfo(name) { if (name == null) { return ""; } else { return "node: <" + name + ">"; } } ele() { return this.element(...arguments); } nod(name, attributes, text) { return this.node(name, attributes, text); } txt(value) { return this.text(value); } dat(value) { return this.cdata(value); } com(value) { return this.comment(value); } ins(target, value) { return this.instruction(target, value); } dec(version, encoding, standalone) { return this.declaration(version, encoding, standalone); } dtd(root, pubID, sysID) { return this.doctype(root, pubID, sysID); } e(name, attributes, text) { return this.element(name, attributes, text); } n(name, attributes, text) { return this.node(name, attributes, text); } t(value) { return this.text(value); } d(value) { return this.cdata(value); } c(value) { return this.comment(value); } r(value) { return this.raw(value); } i(target, value) { return this.instruction(target, value); } att() { if (this.currentNode && this.currentNode.type === NodeType.DocType) { return this.attList(...arguments); } else { return this.attribute(...arguments); } } a() { if (this.currentNode && this.currentNode.type === NodeType.DocType) { return this.attList(...arguments); } else { return this.attribute(...arguments); } } ent(name, value) { return this.entity(name, value); } pent(name, value) { return this.pEntity(name, value); } not(name, value) { return this.notation(name, value); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/XMLStreamWriter.js var require_XMLStreamWriter = __commonJS({ "node_modules/xmlbuilder/lib/XMLStreamWriter.js"(exports, module2) { (function() { var NodeType, WriterState, XMLStreamWriter, XMLWriterBase, hasProp = {}.hasOwnProperty; NodeType = require_NodeType(); XMLWriterBase = require_XMLWriterBase(); WriterState = require_WriterState(); module2.exports = XMLStreamWriter = class XMLStreamWriter extends XMLWriterBase { constructor(stream, options) { super(options); this.stream = stream; } endline(node, options, level) { if (node.isLastRootNode && options.state === WriterState.CloseTag) { return ""; } else { return super.endline(node, options, level); } } document(doc, options) { var child, i, j, k, len1, len2, ref, ref1, results; ref = doc.children; for (i = j = 0, len1 = ref.length; j < len1; i = ++j) { child = ref[i]; child.isLastRootNode = i === doc.children.length - 1; } options = this.filterOptions(options); ref1 = doc.children; results = []; for (k = 0, len2 = ref1.length; k < len2; k++) { child = ref1[k]; results.push(this.writeChildNode(child, options, 0)); } return results; } cdata(node, options, level) { return this.stream.write(super.cdata(node, options, level)); } comment(node, options, level) { return this.stream.write(super.comment(node, options, level)); } declaration(node, options, level) { return this.stream.write(super.declaration(node, options, level)); } docType(node, options, level) { var child, j, len1, ref; level || (level = 0); this.openNode(node, options, level); options.state = WriterState.OpenTag; this.stream.write(this.indent(node, options, level)); this.stream.write(" 0) { this.stream.write(" ["); this.stream.write(this.endline(node, options, level)); options.state = WriterState.InsideTag; ref = node.children; for (j = 0, len1 = ref.length; j < len1; j++) { child = ref[j]; this.writeChildNode(child, options, level + 1); } options.state = WriterState.CloseTag; this.stream.write("]"); } options.state = WriterState.CloseTag; this.stream.write(options.spaceBeforeSlash + ">"); this.stream.write(this.endline(node, options, level)); options.state = WriterState.None; return this.closeNode(node, options, level); } element(node, options, level) { var att, attLen, child, childNodeCount, firstChildNode, j, len, len1, name, prettySuppressed, r, ratt, ref, ref1, ref2, rline; level || (level = 0); this.openNode(node, options, level); options.state = WriterState.OpenTag; r = this.indent(node, options, level) + "<" + node.name; if (options.pretty && options.width > 0) { len = r.length; ref = node.attribs; for (name in ref) { if (!hasProp.call(ref, name)) continue; att = ref[name]; ratt = this.attribute(att, options, level); attLen = ratt.length; if (len + attLen > options.width) { rline = this.indent(node, options, level + 1) + ratt; r += this.endline(node, options, level) + rline; len = rline.length; } else { rline = " " + ratt; r += rline; len += rline.length; } } } else { ref1 = node.attribs; for (name in ref1) { if (!hasProp.call(ref1, name)) continue; att = ref1[name]; r += this.attribute(att, options, level); } } this.stream.write(r); childNodeCount = node.children.length; firstChildNode = childNodeCount === 0 ? null : node.children[0]; if (childNodeCount === 0 || node.children.every(function(e) { return (e.type === NodeType.Text || e.type === NodeType.Raw || e.type === NodeType.CData) && e.value === ""; })) { if (options.allowEmpty) { this.stream.write(">"); options.state = WriterState.CloseTag; this.stream.write(""); } else { options.state = WriterState.CloseTag; this.stream.write(options.spaceBeforeSlash + "/>"); } } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw || firstChildNode.type === NodeType.CData) && firstChildNode.value != null) { this.stream.write(">"); options.state = WriterState.InsideTag; options.suppressPrettyCount++; prettySuppressed = true; this.writeChildNode(firstChildNode, options, level + 1); options.suppressPrettyCount--; prettySuppressed = false; options.state = WriterState.CloseTag; this.stream.write(""); } else { this.stream.write(">" + this.endline(node, options, level)); options.state = WriterState.InsideTag; ref2 = node.children; for (j = 0, len1 = ref2.length; j < len1; j++) { child = ref2[j]; this.writeChildNode(child, options, level + 1); } options.state = WriterState.CloseTag; this.stream.write(this.indent(node, options, level) + ""); } this.stream.write(this.endline(node, options, level)); options.state = WriterState.None; return this.closeNode(node, options, level); } processingInstruction(node, options, level) { return this.stream.write(super.processingInstruction(node, options, level)); } raw(node, options, level) { return this.stream.write(super.raw(node, options, level)); } text(node, options, level) { return this.stream.write(super.text(node, options, level)); } dtdAttList(node, options, level) { return this.stream.write(super.dtdAttList(node, options, level)); } dtdElement(node, options, level) { return this.stream.write(super.dtdElement(node, options, level)); } dtdEntity(node, options, level) { return this.stream.write(super.dtdEntity(node, options, level)); } dtdNotation(node, options, level) { return this.stream.write(super.dtdNotation(node, options, level)); } }; }).call(exports); } }); // node_modules/xmlbuilder/lib/index.js var require_lib = __commonJS({ "node_modules/xmlbuilder/lib/index.js"(exports, module2) { (function() { var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction; ({ assign, isFunction } = require_Utility()); XMLDOMImplementation = require_XMLDOMImplementation(); XMLDocument = require_XMLDocument(); XMLDocumentCB = require_XMLDocumentCB(); XMLStringWriter = require_XMLStringWriter(); XMLStreamWriter = require_XMLStreamWriter(); NodeType = require_NodeType(); WriterState = require_WriterState(); module2.exports.create = function(name, xmldec, doctype, options) { var doc, root; if (name == null) { throw new Error("Root element needs a name."); } options = assign({}, xmldec, doctype, options); doc = new XMLDocument(options); root = doc.element(name); if (!options.headless) { doc.declaration(options); if (options.pubID != null || options.sysID != null) { doc.dtd(options); } } return root; }; module2.exports.begin = function(options, onData, onEnd) { if (isFunction(options)) { [onData, onEnd] = [options, onData]; options = {}; } if (onData) { return new XMLDocumentCB(options, onData, onEnd); } else { return new XMLDocument(options); } }; module2.exports.stringWriter = function(options) { return new XMLStringWriter(options); }; module2.exports.streamWriter = function(stream, options) { return new XMLStreamWriter(stream, options); }; module2.exports.implementation = new XMLDOMImplementation(); module2.exports.nodeType = NodeType; module2.exports.writerState = WriterState; }).call(exports); } }); // node_modules/plist/lib/build.js var require_build = __commonJS({ "node_modules/plist/lib/build.js"(exports) { var base64 = require_base64_js(); var xmlbuilder = require_lib(); exports.build = build; function ISODateString(d) { function pad(n) { return n < 10 ? "0" + n : n; } return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "Z"; } var toString = Object.prototype.toString; function type(obj) { var m = toString.call(obj).match(/\[object (.*)\]/); return m ? m[1] : m; } function build(obj, opts) { var XMLHDR = { version: "1.0", encoding: "UTF-8" }; var XMLDTD = { pubid: "-//Apple//DTD PLIST 1.0//EN", sysid: "http://www.apple.com/DTDs/PropertyList-1.0.dtd" }; var doc = xmlbuilder.create("plist"); doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone); doc.dtd(XMLDTD.pubid, XMLDTD.sysid); doc.att("version", "1.0"); walk_obj(obj, doc); if (!opts) opts = {}; opts.pretty = opts.pretty !== false; return doc.end(opts); } function walk_obj(next, next_child) { var tag_type, i, prop; var name = type(next); if (name == "Undefined") { return; } else if (Array.isArray(next)) { next_child = next_child.ele("array"); for (i = 0; i < next.length; i++) { walk_obj(next[i], next_child); } } else if (Buffer.isBuffer(next)) { next_child.ele("data").raw(next.toString("base64")); } else if (name == "Object") { next_child = next_child.ele("dict"); for (prop in next) { if (next.hasOwnProperty(prop)) { next_child.ele("key").txt(prop); walk_obj(next[prop], next_child); } } } else if (name == "Number") { tag_type = next % 1 === 0 ? "integer" : "real"; next_child.ele(tag_type).txt(next.toString()); } else if (name == "Date") { next_child.ele("date").txt(ISODateString(new Date(next))); } else if (name == "Boolean") { next_child.ele(next ? "true" : "false"); } else if (name == "String") { next_child.ele("string").txt(next); } else if (name == "ArrayBuffer") { next_child.ele("data").raw(base64.fromByteArray(next)); } else if (next && next.buffer && type(next.buffer) == "ArrayBuffer") { next_child.ele("data").raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child)); } else if (name === "Null") { next_child.ele("null").txt(""); } } } }); // node_modules/plist/index.js var require_plist = __commonJS({ "node_modules/plist/index.js"(exports) { var parserFunctions = require_parse(); Object.keys(parserFunctions).forEach(function(k) { exports[k] = parserFunctions[k]; }); var builderFunctions = require_build(); Object.keys(builderFunctions).forEach(function(k) { exports[k] = builderFunctions[k]; }); } }); // main.ts var main_exports = {}; __export(main_exports, { default: () => MacTagPlugin }); module.exports = __toCommonJS(main_exports); var import_obsidian = require("obsidian"); var import_child_process = require("child_process"); var plist = require_plist(); var MacTagPlugin = class extends import_obsidian.Plugin { async onload() { this.addCommand({ id: "write-macos-tag", name: "Write Mac OS tags", editorCallback: (editor, view) => { this.writeTags(view.file); } }); this.addCommand({ id: "write-macos-tag-folder", name: "Write Mac OS tags for current folder", editorCallback: (editor, view) => { view.file.parent.children.forEach((file) => { if (file instanceof import_obsidian.TFile) { this.writeTags(file); } }); } }); } onunload() { } writeTags(file) { const fileWithPath = `${this.app.vault.adapter.basePath}/${file.path}`; const plTags = plist.build(this.getTags(file)); (0, import_child_process.exec)(`xattr -w com.apple.metadata:_kMDItemUserTags '${plTags}' '${fileWithPath}'`, (error, stdout, stderr) => { if (error) { console.log(`error: ${error.message}`); return; } if (stderr) { console.log(`stderr: ${stderr}`); return; } }); } getTags(file) { const tags = []; const metadata = this.app.metadataCache.getFileCache(file); if (metadata == null ? void 0 : metadata.tags) { metadata.tags.forEach(function(value) { tags.push(value.tag); }); } if (metadata == null ? void 0 : metadata.frontmatter) { if (metadata.frontmatter.tags) { const frontmattertags = typeof metadata.frontmatter.tags === "string" ? [metadata.frontmatter.tags] : metadata.frontmatter.tags; frontmattertags.forEach(function(value) { tags.push(value); }); } } return tags.map((s) => s.replace("#", "")); } };