module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1); /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { "use strict"; var builder, defaults, parser, processors, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; defaults = __webpack_require__(2); builder = __webpack_require__(3); parser = __webpack_require__(26); processors = __webpack_require__(60); exports.defaults = defaults.defaults; exports.processors = processors; exports.ValidationError = (function(superClass) { extend(ValidationError, superClass); function ValidationError(message) { this.message = message; } return ValidationError; })(Error); exports.Builder = builder.Builder; exports.Parser = parser.Parser; exports.parseString = parser.parseString; }).call(this); /***/ }), /* 2 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.7 (function() { exports.defaults = { "0.1": { explicitCharkey: false, trim: true, normalize: true, normalizeTags: false, attrkey: "@", charkey: "#", explicitArray: false, ignoreAttrs: false, mergeAttrs: false, explicitRoot: false, validator: null, xmlns: false, explicitChildren: false, childkey: '@@', charsAsChildren: false, includeWhiteChars: false, async: false, strict: true, attrNameProcessors: null, attrValueProcessors: null, tagNameProcessors: null, valueProcessors: null, emptyTag: '' }, "0.2": { explicitCharkey: false, trim: false, normalize: false, normalizeTags: false, attrkey: "$", charkey: "_", explicitArray: true, ignoreAttrs: false, mergeAttrs: false, explicitRoot: true, validator: null, xmlns: false, explicitChildren: false, preserveChildrenOrder: false, childkey: '$$', charsAsChildren: false, includeWhiteChars: false, async: false, strict: true, attrNameProcessors: null, attrValueProcessors: null, tagNameProcessors: null, valueProcessors: null, rootName: 'root', xmldec: { 'version': '1.0', 'encoding': 'UTF-8', 'standalone': true }, doctype: null, renderOpts: { 'pretty': true, 'indent': ' ', 'newline': '\n' }, headless: false, chunkSize: 10000, emptyTag: '', cdata: false } }; }).call(this); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { "use strict"; var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, hasProp = {}.hasOwnProperty; builder = __webpack_require__(4); defaults = __webpack_require__(2).defaults; requiresCDATA = function(entry) { return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0); }; wrapCDATA = function(entry) { return ""; }; escapeCDATA = function(entry) { return entry.replace(']]>', ']]]]>'); }; exports.Builder = (function() { function Builder(opts) { var key, ref, value; this.options = {}; ref = defaults["0.2"]; for (key in ref) { if (!hasProp.call(ref, key)) continue; value = ref[key]; this.options[key] = value; } for (key in opts) { if (!hasProp.call(opts, key)) continue; value = opts[key]; this.options[key] = value; } } Builder.prototype.buildObject = function(rootObj) { var attrkey, charkey, render, rootElement, rootName; attrkey = this.options.attrkey; charkey = this.options.charkey; if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) { rootName = Object.keys(rootObj)[0]; rootObj = rootObj[rootName]; } else { rootName = this.options.rootName; } render = (function(_this) { return function(element, obj) { var attr, child, entry, index, key, value; if (typeof obj !== 'object') { if (_this.options.cdata && requiresCDATA(obj)) { element.raw(wrapCDATA(obj)); } else { element.txt(obj); } } else if (Array.isArray(obj)) { for (index in obj) { if (!hasProp.call(obj, index)) continue; child = obj[index]; for (key in child) { entry = child[key]; element = render(element.ele(key), entry).up(); } } } else { for (key in obj) { if (!hasProp.call(obj, key)) continue; child = obj[key]; if (key === attrkey) { if (typeof child === "object") { for (attr in child) { value = child[attr]; element = element.att(attr, value); } } } else if (key === charkey) { if (_this.options.cdata && requiresCDATA(child)) { element = element.raw(wrapCDATA(child)); } else { element = element.txt(child); } } else if (Array.isArray(child)) { for (index in child) { if (!hasProp.call(child, index)) continue; entry = child[index]; if (typeof entry === 'string') { if (_this.options.cdata && requiresCDATA(entry)) { element = element.ele(key).raw(wrapCDATA(entry)).up(); } else { element = element.ele(key, entry).up(); } } else { element = render(element.ele(key), entry).up(); } } } else if (typeof child === "object") { element = render(element.ele(key), child).up(); } else { if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) { element = element.ele(key).raw(wrapCDATA(child)).up(); } else { if (child == null) { child = ''; } element = element.ele(key, child.toString()).up(); } } } } return element; }; })(this); rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, { headless: this.options.headless, allowSurrogateChars: this.options.allowSurrogateChars }); return render(rootElement, rootObj).end(this.options.renderOpts); }; return Builder; })(); }).call(this); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref; ref = __webpack_require__(5), assign = ref.assign, isFunction = ref.isFunction; XMLDocument = __webpack_require__(6); XMLDocumentCB = __webpack_require__(24); XMLStringWriter = __webpack_require__(22); XMLStreamWriter = __webpack_require__(25); module.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.doctype(options); } } return root; }; module.exports.begin = function(options, onData, onEnd) { var ref1; if (isFunction(options)) { ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1]; options = {}; } if (onData) { return new XMLDocumentCB(options, onData, onEnd); } else { return new XMLDocument(options); } }; module.exports.stringWriter = function(options) { return new XMLStringWriter(options); }; module.exports.streamWriter = function(stream, options) { return new XMLStreamWriter(stream, options); }; }).call(this); /***/ }), /* 5 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.7 (function() { var assign, isArray, isEmpty, isFunction, isObject, isPlainObject, slice = [].slice, hasProp = {}.hasOwnProperty; assign = function() { var i, key, len, source, sources, target; target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : []; 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)); }; module.exports.assign = assign; module.exports.isFunction = isFunction; module.exports.isObject = isObject; module.exports.isArray = isArray; module.exports.isEmpty = isEmpty; module.exports.isPlainObject = isPlainObject; }).call(this); /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; isPlainObject = __webpack_require__(5).isPlainObject; XMLNode = __webpack_require__(7); XMLStringifier = __webpack_require__(21); XMLStringWriter = __webpack_require__(22); module.exports = XMLDocument = (function(superClass) { extend(XMLDocument, superClass); function XMLDocument(options) { XMLDocument.__super__.constructor.call(this, null); options || (options = {}); if (!options.writer) { options.writer = new XMLStringWriter(); } this.options = options; this.stringify = new XMLStringifier(options); this.isDocument = true; } XMLDocument.prototype.end = function(writer) { var writerOptions; if (!writer) { writer = this.options.writer; } else if (isPlainObject(writer)) { writerOptions = writer; writer = this.options.writer.set(writerOptions); } return writer.document(this); }; XMLDocument.prototype.toString = function(options) { return this.options.writer.set(options).document(this); }; return XMLDocument; })(XMLNode); }).call(this); /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, isEmpty, isFunction, isObject, ref, hasProp = {}.hasOwnProperty; ref = __webpack_require__(5), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty; XMLElement = null; XMLCData = null; XMLComment = null; XMLDeclaration = null; XMLDocType = null; XMLRaw = null; XMLText = null; XMLProcessingInstruction = null; module.exports = XMLNode = (function() { function XMLNode(parent) { this.parent = parent; if (this.parent) { this.options = this.parent.options; this.stringify = this.parent.stringify; } this.children = []; if (!XMLElement) { XMLElement = __webpack_require__(8); XMLCData = __webpack_require__(10); XMLComment = __webpack_require__(11); XMLDeclaration = __webpack_require__(12); XMLDocType = __webpack_require__(13); XMLRaw = __webpack_require__(18); XMLText = __webpack_require__(19); XMLProcessingInstruction = __webpack_require__(20); } } XMLNode.prototype.element = function(name, attributes, text) { var childNode, item, j, k, key, lastChild, len, len1, ref1, val; lastChild = null; if (attributes == null) { attributes = {}; } attributes = attributes.valueOf(); if (!isObject(attributes)) { ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; } if (name != null) { name = name.valueOf(); } 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 ((isObject(val)) && (isEmpty(val))) { val = null; } 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)) { for (k = 0, len1 = val.length; k < len1; k++) { item = val[k]; childNode = {}; childNode[key] = item; lastChild = this.element(childNode); } } else if (isObject(val)) { lastChild = this.element(key); lastChild.element(val); } else { lastChild = this.element(key, val); } } } 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); } return lastChild; }; XMLNode.prototype.insertBefore = function(name, attributes, text) { var child, i, removed; if (this.isRoot) { throw new Error("Cannot insert elements at root level"); } 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; }; XMLNode.prototype.insertAfter = function(name, attributes, text) { var child, i, removed; if (this.isRoot) { throw new Error("Cannot insert elements at root level"); } 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; }; XMLNode.prototype.remove = function() { var i, ref1; if (this.isRoot) { throw new Error("Cannot remove the root element"); } i = this.parent.children.indexOf(this); [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1; return this.parent; }; XMLNode.prototype.node = function(name, attributes, text) { var child, ref1; if (name != null) { name = name.valueOf(); } attributes || (attributes = {}); attributes = attributes.valueOf(); if (!isObject(attributes)) { ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; } child = new XMLElement(this, name, attributes); if (text != null) { child.text(text); } this.children.push(child); return child; }; XMLNode.prototype.text = function(value) { var child; child = new XMLText(this, value); this.children.push(child); return this; }; XMLNode.prototype.cdata = function(value) { var child; child = new XMLCData(this, value); this.children.push(child); return this; }; XMLNode.prototype.comment = function(value) { var child; child = new XMLComment(this, value); this.children.push(child); return this; }; XMLNode.prototype.commentBefore = function(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; }; XMLNode.prototype.commentAfter = function(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; }; XMLNode.prototype.raw = function(value) { var child; child = new XMLRaw(this, value); this.children.push(child); return this; }; XMLNode.prototype.instruction = function(target, value) { var insTarget, insValue, instruction, j, len; if (target != null) { target = target.valueOf(); } if (value != null) { value = value.valueOf(); } 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; }; XMLNode.prototype.instructionBefore = function(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; }; XMLNode.prototype.instructionAfter = function(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; }; XMLNode.prototype.declaration = function(version, encoding, standalone) { var doc, xmldec; doc = this.document(); xmldec = new XMLDeclaration(doc, version, encoding, standalone); if (doc.children[0] instanceof XMLDeclaration) { doc.children[0] = xmldec; } else { doc.children.unshift(xmldec); } return doc.root() || doc; }; XMLNode.prototype.doctype = function(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 instanceof XMLDocType) { 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; }; XMLNode.prototype.up = function() { 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; }; XMLNode.prototype.root = function() { var node; node = this; while (node) { if (node.isDocument) { return node.rootObject; } else if (node.isRoot) { return node; } else { node = node.parent; } } }; XMLNode.prototype.document = function() { var node; node = this; while (node) { if (node.isDocument) { return node; } else { node = node.parent; } } }; XMLNode.prototype.end = function(options) { return this.document().end(options); }; XMLNode.prototype.prev = function() { var i; i = this.parent.children.indexOf(this); if (i < 1) { throw new Error("Already at the first node"); } return this.parent.children[i - 1]; }; XMLNode.prototype.next = function() { 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"); } return this.parent.children[i + 1]; }; XMLNode.prototype.importDocument = function(doc) { var clonedRoot; clonedRoot = doc.root().clone(); clonedRoot.parent = this; clonedRoot.isRoot = false; this.children.push(clonedRoot); return this; }; XMLNode.prototype.ele = function(name, attributes, text) { return this.element(name, attributes, text); }; XMLNode.prototype.nod = function(name, attributes, text) { return this.node(name, attributes, text); }; XMLNode.prototype.txt = function(value) { return this.text(value); }; XMLNode.prototype.dat = function(value) { return this.cdata(value); }; XMLNode.prototype.com = function(value) { return this.comment(value); }; XMLNode.prototype.ins = function(target, value) { return this.instruction(target, value); }; XMLNode.prototype.doc = function() { return this.document(); }; XMLNode.prototype.dec = function(version, encoding, standalone) { return this.declaration(version, encoding, standalone); }; XMLNode.prototype.dtd = function(pubID, sysID) { return this.doctype(pubID, sysID); }; XMLNode.prototype.e = function(name, attributes, text) { return this.element(name, attributes, text); }; XMLNode.prototype.n = function(name, attributes, text) { return this.node(name, attributes, text); }; XMLNode.prototype.t = function(value) { return this.text(value); }; XMLNode.prototype.d = function(value) { return this.cdata(value); }; XMLNode.prototype.c = function(value) { return this.comment(value); }; XMLNode.prototype.r = function(value) { return this.raw(value); }; XMLNode.prototype.i = function(target, value) { return this.instruction(target, value); }; XMLNode.prototype.u = function() { return this.up(); }; XMLNode.prototype.importXMLBuilder = function(doc) { return this.importDocument(doc); }; return XMLNode; })(); }).call(this); /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLAttribute, XMLElement, XMLNode, isFunction, isObject, ref, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; ref = __webpack_require__(5), isObject = ref.isObject, isFunction = ref.isFunction; XMLNode = __webpack_require__(7); XMLAttribute = __webpack_require__(9); module.exports = XMLElement = (function(superClass) { extend(XMLElement, superClass); function XMLElement(parent, name, attributes) { XMLElement.__super__.constructor.call(this, parent); if (name == null) { throw new Error("Missing element name"); } this.name = this.stringify.eleName(name); this.attributes = {}; if (attributes != null) { this.attribute(attributes); } if (parent.isDocument) { this.isRoot = true; this.documentObject = parent; parent.rootObject = this; } } XMLElement.prototype.clone = function() { var att, attName, clonedSelf, ref1; clonedSelf = Object.create(this); if (clonedSelf.isRoot) { clonedSelf.documentObject = null; } clonedSelf.attributes = {}; ref1 = this.attributes; for (attName in ref1) { if (!hasProp.call(ref1, attName)) continue; att = ref1[attName]; clonedSelf.attributes[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; }; XMLElement.prototype.attribute = function(name, value) { var attName, attValue; if (name != null) { name = name.valueOf(); } 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.skipNullAttributes || (value != null)) { this.attributes[name] = new XMLAttribute(this, name, value); } } return this; }; XMLElement.prototype.removeAttribute = function(name) { var attName, i, len; if (name == null) { throw new Error("Missing attribute name"); } name = name.valueOf(); if (Array.isArray(name)) { for (i = 0, len = name.length; i < len; i++) { attName = name[i]; delete this.attributes[attName]; } } else { delete this.attributes[name]; } return this; }; XMLElement.prototype.toString = function(options) { return this.options.writer.set(options).element(this); }; XMLElement.prototype.att = function(name, value) { return this.attribute(name, value); }; XMLElement.prototype.a = function(name, value) { return this.attribute(name, value); }; return XMLElement; })(XMLNode); }).call(this); /***/ }), /* 9 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.7 (function() { var XMLAttribute; module.exports = XMLAttribute = (function() { function XMLAttribute(parent, name, value) { this.options = parent.options; this.stringify = parent.stringify; if (name == null) { throw new Error("Missing attribute name of element " + parent.name); } if (value == null) { throw new Error("Missing attribute value for attribute " + name + " of element " + parent.name); } this.name = this.stringify.attName(name); this.value = this.stringify.attValue(value); } XMLAttribute.prototype.clone = function() { return Object.create(this); }; XMLAttribute.prototype.toString = function(options) { return this.options.writer.set(options).attribute(this); }; return XMLAttribute; })(); }).call(this); /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLCData, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLCData = (function(superClass) { extend(XMLCData, superClass); function XMLCData(parent, text) { XMLCData.__super__.constructor.call(this, parent); if (text == null) { throw new Error("Missing CDATA text"); } this.text = this.stringify.cdata(text); } XMLCData.prototype.clone = function() { return Object.create(this); }; XMLCData.prototype.toString = function(options) { return this.options.writer.set(options).cdata(this); }; return XMLCData; })(XMLNode); }).call(this); /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLComment, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLComment = (function(superClass) { extend(XMLComment, superClass); function XMLComment(parent, text) { XMLComment.__super__.constructor.call(this, parent); if (text == null) { throw new Error("Missing comment text"); } this.text = this.stringify.comment(text); } XMLComment.prototype.clone = function() { return Object.create(this); }; XMLComment.prototype.toString = function(options) { return this.options.writer.set(options).comment(this); }; return XMLComment; })(XMLNode); }).call(this); /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDeclaration, XMLNode, isObject, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; isObject = __webpack_require__(5).isObject; XMLNode = __webpack_require__(7); module.exports = XMLDeclaration = (function(superClass) { extend(XMLDeclaration, superClass); function XMLDeclaration(parent, version, encoding, standalone) { var ref; XMLDeclaration.__super__.constructor.call(this, parent); if (isObject(version)) { ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone; } if (!version) { version = '1.0'; } this.version = this.stringify.xmlVersion(version); if (encoding != null) { this.encoding = this.stringify.xmlEncoding(encoding); } if (standalone != null) { this.standalone = this.stringify.xmlStandalone(standalone); } } XMLDeclaration.prototype.toString = function(options) { return this.options.writer.set(options).declaration(this); }; return XMLDeclaration; })(XMLNode); }).call(this); /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, isObject, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; isObject = __webpack_require__(5).isObject; XMLNode = __webpack_require__(7); XMLDTDAttList = __webpack_require__(14); XMLDTDEntity = __webpack_require__(15); XMLDTDElement = __webpack_require__(16); XMLDTDNotation = __webpack_require__(17); module.exports = XMLDocType = (function(superClass) { extend(XMLDocType, superClass); function XMLDocType(parent, pubID, sysID) { var ref, ref1; XMLDocType.__super__.constructor.call(this, parent); this.documentObject = parent; if (isObject(pubID)) { ref = pubID, pubID = ref.pubID, sysID = ref.sysID; } if (sysID == null) { ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1]; } if (pubID != null) { this.pubID = this.stringify.dtdPubID(pubID); } if (sysID != null) { this.sysID = this.stringify.dtdSysID(sysID); } } XMLDocType.prototype.element = function(name, value) { var child; child = new XMLDTDElement(this, name, value); this.children.push(child); return this; }; XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { var child; child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); this.children.push(child); return this; }; XMLDocType.prototype.entity = function(name, value) { var child; child = new XMLDTDEntity(this, false, name, value); this.children.push(child); return this; }; XMLDocType.prototype.pEntity = function(name, value) { var child; child = new XMLDTDEntity(this, true, name, value); this.children.push(child); return this; }; XMLDocType.prototype.notation = function(name, value) { var child; child = new XMLDTDNotation(this, name, value); this.children.push(child); return this; }; XMLDocType.prototype.toString = function(options) { return this.options.writer.set(options).docType(this); }; XMLDocType.prototype.ele = function(name, value) { return this.element(name, value); }; XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue); }; XMLDocType.prototype.ent = function(name, value) { return this.entity(name, value); }; XMLDocType.prototype.pent = function(name, value) { return this.pEntity(name, value); }; XMLDocType.prototype.not = function(name, value) { return this.notation(name, value); }; XMLDocType.prototype.up = function() { return this.root() || this.documentObject; }; return XMLDocType; })(XMLNode); }).call(this); /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDTDAttList, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLDTDAttList = (function(superClass) { extend(XMLDTDAttList, superClass); function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) { XMLDTDAttList.__super__.constructor.call(this, parent); if (elementName == null) { throw new Error("Missing DTD element name"); } if (attributeName == null) { throw new Error("Missing DTD attribute name"); } if (!attributeType) { throw new Error("Missing DTD attribute type"); } if (!defaultValueType) { throw new Error("Missing DTD attribute default"); } 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"); } if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) { throw new Error("Default value only applies to #FIXED or #DEFAULT"); } this.elementName = this.stringify.eleName(elementName); this.attributeName = this.stringify.attName(attributeName); this.attributeType = this.stringify.dtdAttType(attributeType); this.defaultValue = this.stringify.dtdAttDefault(defaultValue); this.defaultValueType = defaultValueType; } XMLDTDAttList.prototype.toString = function(options) { return this.options.writer.set(options).dtdAttList(this); }; return XMLDTDAttList; })(XMLNode); }).call(this); /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDTDEntity, XMLNode, isObject, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; isObject = __webpack_require__(5).isObject; XMLNode = __webpack_require__(7); module.exports = XMLDTDEntity = (function(superClass) { extend(XMLDTDEntity, superClass); function XMLDTDEntity(parent, pe, name, value) { XMLDTDEntity.__super__.constructor.call(this, parent); if (name == null) { throw new Error("Missing entity name"); } if (value == null) { throw new Error("Missing entity value"); } this.pe = !!pe; this.name = this.stringify.eleName(name); if (!isObject(value)) { this.value = this.stringify.dtdEntityValue(value); } else { if (!value.pubID && !value.sysID) { throw new Error("Public and/or system identifiers are required for an external entity"); } if (value.pubID && !value.sysID) { throw new Error("System identifier is required for a public external entity"); } 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"); } } } XMLDTDEntity.prototype.toString = function(options) { return this.options.writer.set(options).dtdEntity(this); }; return XMLDTDEntity; })(XMLNode); }).call(this); /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDTDElement, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLDTDElement = (function(superClass) { extend(XMLDTDElement, superClass); function XMLDTDElement(parent, name, value) { XMLDTDElement.__super__.constructor.call(this, parent); if (name == null) { throw new Error("Missing DTD element name"); } if (!value) { value = '(#PCDATA)'; } if (Array.isArray(value)) { value = '(' + value.join(',') + ')'; } this.name = this.stringify.eleName(name); this.value = this.stringify.dtdElementValue(value); } XMLDTDElement.prototype.toString = function(options) { return this.options.writer.set(options).dtdElement(this); }; return XMLDTDElement; })(XMLNode); }).call(this); /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLDTDNotation, XMLNode, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLDTDNotation = (function(superClass) { extend(XMLDTDNotation, superClass); function XMLDTDNotation(parent, name, value) { XMLDTDNotation.__super__.constructor.call(this, parent); if (name == null) { throw new Error("Missing notation name"); } if (!value.pubID && !value.sysID) { throw new Error("Public or system identifiers are required for an external entity"); } this.name = this.stringify.eleName(name); if (value.pubID != null) { this.pubID = this.stringify.dtdPubID(value.pubID); } if (value.sysID != null) { this.sysID = this.stringify.dtdSysID(value.sysID); } } XMLDTDNotation.prototype.toString = function(options) { return this.options.writer.set(options).dtdNotation(this); }; return XMLDTDNotation; })(XMLNode); }).call(this); /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLNode, XMLRaw, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLRaw = (function(superClass) { extend(XMLRaw, superClass); function XMLRaw(parent, text) { XMLRaw.__super__.constructor.call(this, parent); if (text == null) { throw new Error("Missing raw text"); } this.value = this.stringify.raw(text); } XMLRaw.prototype.clone = function() { return Object.create(this); }; XMLRaw.prototype.toString = function(options) { return this.options.writer.set(options).raw(this); }; return XMLRaw; })(XMLNode); }).call(this); /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLNode, XMLText, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLText = (function(superClass) { extend(XMLText, superClass); function XMLText(parent, text) { XMLText.__super__.constructor.call(this, parent); if (text == null) { throw new Error("Missing element text"); } this.value = this.stringify.eleText(text); } XMLText.prototype.clone = function() { return Object.create(this); }; XMLText.prototype.toString = function(options) { return this.options.writer.set(options).text(this); }; return XMLText; })(XMLNode); }).call(this); /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLNode, XMLProcessingInstruction, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLNode = __webpack_require__(7); module.exports = XMLProcessingInstruction = (function(superClass) { extend(XMLProcessingInstruction, superClass); function XMLProcessingInstruction(parent, target, value) { XMLProcessingInstruction.__super__.constructor.call(this, parent); if (target == null) { throw new Error("Missing instruction target"); } this.target = this.stringify.insTarget(target); if (value) { this.value = this.stringify.insValue(value); } } XMLProcessingInstruction.prototype.clone = function() { return Object.create(this); }; XMLProcessingInstruction.prototype.toString = function(options) { return this.options.writer.set(options).processingInstruction(this); }; return XMLProcessingInstruction; })(XMLNode); }).call(this); /***/ }), /* 21 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.7 (function() { var XMLStringifier, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, hasProp = {}.hasOwnProperty; module.exports = XMLStringifier = (function() { function XMLStringifier(options) { this.assertLegalChar = bind(this.assertLegalChar, this); var key, ref, value; options || (options = {}); this.noDoubleEncoding = options.noDoubleEncoding; ref = options.stringify || {}; for (key in ref) { if (!hasProp.call(ref, key)) continue; value = ref[key]; this[key] = value; } } XMLStringifier.prototype.eleName = function(val) { val = '' + val || ''; return this.assertLegalChar(val); }; XMLStringifier.prototype.eleText = function(val) { val = '' + val || ''; return this.assertLegalChar(this.elEscape(val)); }; XMLStringifier.prototype.cdata = function(val) { val = '' + val || ''; val = val.replace(']]>', ']]]]>'); return this.assertLegalChar(val); }; XMLStringifier.prototype.comment = function(val) { val = '' + val || ''; if (val.match(/--/)) { throw new Error("Comment text cannot contain double-hypen: " + val); } return this.assertLegalChar(val); }; XMLStringifier.prototype.raw = function(val) { return '' + val || ''; }; XMLStringifier.prototype.attName = function(val) { return val = '' + val || ''; }; XMLStringifier.prototype.attValue = function(val) { val = '' + val || ''; return this.attEscape(val); }; XMLStringifier.prototype.insTarget = function(val) { return '' + val || ''; }; XMLStringifier.prototype.insValue = function(val) { val = '' + val || ''; if (val.match(/\?>/)) { throw new Error("Invalid processing instruction value: " + val); } return val; }; XMLStringifier.prototype.xmlVersion = function(val) { val = '' + val || ''; if (!val.match(/1\.[0-9]+/)) { throw new Error("Invalid version number: " + val); } return val; }; XMLStringifier.prototype.xmlEncoding = function(val) { val = '' + val || ''; if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) { throw new Error("Invalid encoding: " + val); } return val; }; XMLStringifier.prototype.xmlStandalone = function(val) { if (val) { return "yes"; } else { return "no"; } }; XMLStringifier.prototype.dtdPubID = function(val) { return '' + val || ''; }; XMLStringifier.prototype.dtdSysID = function(val) { return '' + val || ''; }; XMLStringifier.prototype.dtdElementValue = function(val) { return '' + val || ''; }; XMLStringifier.prototype.dtdAttType = function(val) { return '' + val || ''; }; XMLStringifier.prototype.dtdAttDefault = function(val) { if (val != null) { return '' + val || ''; } else { return val; } }; XMLStringifier.prototype.dtdEntityValue = function(val) { return '' + val || ''; }; XMLStringifier.prototype.dtdNData = function(val) { return '' + val || ''; }; XMLStringifier.prototype.convertAttKey = '@'; XMLStringifier.prototype.convertPIKey = '?'; XMLStringifier.prototype.convertTextKey = '#text'; XMLStringifier.prototype.convertCDataKey = '#cdata'; XMLStringifier.prototype.convertCommentKey = '#comment'; XMLStringifier.prototype.convertRawKey = '#raw'; XMLStringifier.prototype.assertLegalChar = function(str) { var res; res = str.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/); if (res) { throw new Error("Invalid character in string: " + str + " at index " + res.index); } return str; }; XMLStringifier.prototype.elEscape = function(str) { var ampregex; ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; return str.replace(ampregex, '&').replace(//g, '>').replace(/\r/g, ' '); }; XMLStringifier.prototype.attEscape = function(str) { var ampregex; ampregex = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g; return str.replace(ampregex, '&').replace(/' + this.newline; }; XMLStringWriter.prototype.comment = function(node, level) { return this.space(level) + '' + this.newline; }; XMLStringWriter.prototype.declaration = function(node, level) { var r; r = this.space(level); r += ''; r += this.newline; return r; }; XMLStringWriter.prototype.docType = function(node, level) { var child, i, len, r, ref; level || (level = 0); r = this.space(level); r += ' 0) { r += ' ['; r += this.newline; ref = node.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; r += (function() { switch (false) { case !(child instanceof XMLDTDAttList): return this.dtdAttList(child, level + 1); case !(child instanceof XMLDTDElement): return this.dtdElement(child, level + 1); case !(child instanceof XMLDTDEntity): return this.dtdEntity(child, level + 1); case !(child instanceof XMLDTDNotation): return this.dtdNotation(child, level + 1); case !(child instanceof XMLCData): return this.cdata(child, level + 1); case !(child instanceof XMLComment): return this.comment(child, level + 1); case !(child instanceof XMLProcessingInstruction): return this.processingInstruction(child, level + 1); default: throw new Error("Unknown DTD node type: " + child.constructor.name); } }).call(this); } r += ']'; } r += this.spacebeforeslash + '>'; r += this.newline; return r; }; XMLStringWriter.prototype.element = function(node, level) { var att, child, i, j, len, len1, name, r, ref, ref1, ref2, space, textispresentwasset; level || (level = 0); textispresentwasset = false; if (this.textispresent) { this.newline = ''; this.pretty = false; } else { this.newline = this.newlinedefault; this.pretty = this.prettydefault; } space = this.space(level); r = ''; r += space + '<' + node.name; ref = node.attributes; for (name in ref) { if (!hasProp.call(ref, name)) continue; att = ref[name]; r += this.attribute(att); } if (node.children.length === 0 || node.children.every(function(e) { return e.value === ''; })) { if (this.allowEmpty) { r += '>' + this.newline; } else { r += this.spacebeforeslash + '/>' + this.newline; } } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) { r += '>'; r += node.children[0].value; r += '' + this.newline; } else { if (this.dontprettytextnodes) { ref1 = node.children; for (i = 0, len = ref1.length; i < len; i++) { child = ref1[i]; if (child.value != null) { this.textispresent++; textispresentwasset = true; break; } } } if (this.textispresent) { this.newline = ''; this.pretty = false; space = this.space(level); } r += '>' + this.newline; ref2 = node.children; for (j = 0, len1 = ref2.length; j < len1; j++) { child = ref2[j]; r += (function() { switch (false) { case !(child instanceof XMLCData): return this.cdata(child, level + 1); case !(child instanceof XMLComment): return this.comment(child, level + 1); case !(child instanceof XMLElement): return this.element(child, level + 1); case !(child instanceof XMLRaw): return this.raw(child, level + 1); case !(child instanceof XMLText): return this.text(child, level + 1); case !(child instanceof XMLProcessingInstruction): return this.processingInstruction(child, level + 1); default: throw new Error("Unknown XML node type: " + child.constructor.name); } }).call(this); } if (textispresentwasset) { this.textispresent--; } if (!this.textispresent) { this.newline = this.newlinedefault; this.pretty = this.prettydefault; } r += space + '' + this.newline; } return r; }; XMLStringWriter.prototype.processingInstruction = function(node, level) { var r; r = this.space(level) + '' + this.newline; return r; }; XMLStringWriter.prototype.raw = function(node, level) { return this.space(level) + node.value + this.newline; }; XMLStringWriter.prototype.text = function(node, level) { return this.space(level) + node.value + this.newline; }; XMLStringWriter.prototype.dtdAttList = function(node, level) { var r; r = this.space(level) + '' + this.newline; return r; }; XMLStringWriter.prototype.dtdElement = function(node, level) { return this.space(level) + '' + this.newline; }; XMLStringWriter.prototype.dtdEntity = function(node, level) { var r; r = this.space(level) + '' + this.newline; return r; }; XMLStringWriter.prototype.dtdNotation = function(node, level) { var r; r = this.space(level) + '' + this.newline; return r; }; XMLStringWriter.prototype.openNode = function(node, level) { var att, name, r, ref; level || (level = 0); if (node instanceof XMLElement) { r = this.space(level) + '<' + node.name; ref = node.attributes; for (name in ref) { if (!hasProp.call(ref, name)) continue; att = ref[name]; r += this.attribute(att); } r += (node.children ? '>' : '/>') + this.newline; return r; } else { r = this.space(level) + '') + this.newline; return r; } }; XMLStringWriter.prototype.closeNode = function(node, level) { level || (level = 0); switch (false) { case !(node instanceof XMLElement): return this.space(level) + '' + this.newline; case !(node instanceof XMLDocType): return this.space(level) + ']>' + this.newline; } }; return XMLStringWriter; })(XMLWriterBase); }).call(this); /***/ }), /* 23 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.7 (function() { var XMLWriterBase, hasProp = {}.hasOwnProperty; module.exports = XMLWriterBase = (function() { function XMLWriterBase(options) { var key, ref, ref1, ref2, ref3, ref4, ref5, ref6, value; options || (options = {}); this.pretty = options.pretty || false; this.allowEmpty = (ref = options.allowEmpty) != null ? ref : false; if (this.pretty) { this.indent = (ref1 = options.indent) != null ? ref1 : ' '; this.newline = (ref2 = options.newline) != null ? ref2 : '\n'; this.offset = (ref3 = options.offset) != null ? ref3 : 0; this.dontprettytextnodes = (ref4 = options.dontprettytextnodes) != null ? ref4 : 0; } else { this.indent = ''; this.newline = ''; this.offset = 0; this.dontprettytextnodes = 0; } this.spacebeforeslash = (ref5 = options.spacebeforeslash) != null ? ref5 : ''; if (this.spacebeforeslash === true) { this.spacebeforeslash = ' '; } this.newlinedefault = this.newline; this.prettydefault = this.pretty; ref6 = options.writer || {}; for (key in ref6) { if (!hasProp.call(ref6, key)) continue; value = ref6[key]; this[key] = value; } } XMLWriterBase.prototype.set = function(options) { var key, ref, value; options || (options = {}); if ("pretty" in options) { this.pretty = options.pretty; } if ("allowEmpty" in options) { this.allowEmpty = options.allowEmpty; } if (this.pretty) { this.indent = "indent" in options ? options.indent : ' '; this.newline = "newline" in options ? options.newline : '\n'; this.offset = "offset" in options ? options.offset : 0; this.dontprettytextnodes = "dontprettytextnodes" in options ? options.dontprettytextnodes : 0; } else { this.indent = ''; this.newline = ''; this.offset = 0; this.dontprettytextnodes = 0; } this.spacebeforeslash = "spacebeforeslash" in options ? options.spacebeforeslash : ''; if (this.spacebeforeslash === true) { this.spacebeforeslash = ' '; } this.newlinedefault = this.newline; this.prettydefault = this.pretty; ref = options.writer || {}; for (key in ref) { if (!hasProp.call(ref, key)) continue; value = ref[key]; this[key] = value; } return this; }; XMLWriterBase.prototype.space = function(level) { var indent; if (this.pretty) { indent = (level || 0) + this.offset + 1; if (indent > 0) { return new Array(indent).join(this.indent); } else { return ''; } } else { return ''; } }; return XMLWriterBase; })(); }).call(this); /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, isFunction, isObject, isPlainObject, ref, hasProp = {}.hasOwnProperty; ref = __webpack_require__(5), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject; XMLElement = __webpack_require__(8); XMLCData = __webpack_require__(10); XMLComment = __webpack_require__(11); XMLRaw = __webpack_require__(18); XMLText = __webpack_require__(19); XMLProcessingInstruction = __webpack_require__(20); XMLDeclaration = __webpack_require__(12); XMLDocType = __webpack_require__(13); XMLDTDAttList = __webpack_require__(14); XMLDTDEntity = __webpack_require__(15); XMLDTDElement = __webpack_require__(16); XMLDTDNotation = __webpack_require__(17); XMLAttribute = __webpack_require__(9); XMLStringifier = __webpack_require__(21); XMLStringWriter = __webpack_require__(22); module.exports = XMLDocumentCB = (function() { function XMLDocumentCB(options, onData, onEnd) { var writerOptions; options || (options = {}); if (!options.writer) { options.writer = new XMLStringWriter(options); } else if (isPlainObject(options.writer)) { writerOptions = options.writer; options.writer = new XMLStringWriter(writerOptions); } this.options = options; this.writer = options.writer; 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; } XMLDocumentCB.prototype.node = function(name, attributes, text) { var ref1; 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.openCurrent(); name = name.valueOf(); if (attributes == null) { attributes = {}; } attributes = attributes.valueOf(); if (!isObject(attributes)) { ref1 = [attributes, text], text = ref1[0], attributes = ref1[1]; } 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; }; XMLDocumentCB.prototype.element = function(name, attributes, text) { if (this.currentNode && this.currentNode instanceof XMLDocType) { return this.dtdElement.apply(this, arguments); } else { return this.node(name, attributes, text); } }; XMLDocumentCB.prototype.attribute = function(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"); } if (name != null) { name = name.valueOf(); } 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.skipNullAttributes || (value != null)) { this.currentNode.attributes[name] = new XMLAttribute(this, name, value); } } return this; }; XMLDocumentCB.prototype.text = function(value) { var node; this.openCurrent(); node = new XMLText(this, value); this.onData(this.writer.text(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.cdata = function(value) { var node; this.openCurrent(); node = new XMLCData(this, value); this.onData(this.writer.cdata(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.comment = function(value) { var node; this.openCurrent(); node = new XMLComment(this, value); this.onData(this.writer.comment(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.raw = function(value) { var node; this.openCurrent(); node = new XMLRaw(this, value); this.onData(this.writer.raw(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.instruction = function(target, value) { var i, insTarget, insValue, len, node; this.openCurrent(); if (target != null) { target = target.valueOf(); } if (value != null) { value = value.valueOf(); } 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.currentLevel + 1)); } return this; }; XMLDocumentCB.prototype.declaration = function(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.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.doctype = function(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; }; XMLDocumentCB.prototype.dtdElement = function(name, value) { var node; this.openCurrent(); node = new XMLDTDElement(this, name, value); this.onData(this.writer.dtdElement(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.attList = function(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.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.entity = function(name, value) { var node; this.openCurrent(); node = new XMLDTDEntity(this, false, name, value); this.onData(this.writer.dtdEntity(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.pEntity = function(name, value) { var node; this.openCurrent(); node = new XMLDTDEntity(this, true, name, value); this.onData(this.writer.dtdEntity(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.notation = function(name, value) { var node; this.openCurrent(); node = new XMLDTDNotation(this, name, value); this.onData(this.writer.dtdNotation(node, this.currentLevel + 1)); return this; }; XMLDocumentCB.prototype.up = function() { 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; }; XMLDocumentCB.prototype.end = function() { while (this.currentLevel >= 0) { this.up(); } return this.onEnd(); }; XMLDocumentCB.prototype.openCurrent = function() { if (this.currentNode) { this.currentNode.children = true; return this.openNode(this.currentNode); } }; XMLDocumentCB.prototype.openNode = function(node) { if (!node.isOpen) { if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) { this.root = node; } this.onData(this.writer.openNode(node, this.currentLevel)); return node.isOpen = true; } }; XMLDocumentCB.prototype.closeNode = function(node) { if (!node.isClosed) { this.onData(this.writer.closeNode(node, this.currentLevel)); return node.isClosed = true; } }; XMLDocumentCB.prototype.onData = function(chunk) { this.documentStarted = true; return this.onDataCallback(chunk); }; XMLDocumentCB.prototype.onEnd = function() { this.documentCompleted = true; return this.onEndCallback(); }; XMLDocumentCB.prototype.ele = function() { return this.element.apply(this, arguments); }; XMLDocumentCB.prototype.nod = function(name, attributes, text) { return this.node(name, attributes, text); }; XMLDocumentCB.prototype.txt = function(value) { return this.text(value); }; XMLDocumentCB.prototype.dat = function(value) { return this.cdata(value); }; XMLDocumentCB.prototype.com = function(value) { return this.comment(value); }; XMLDocumentCB.prototype.ins = function(target, value) { return this.instruction(target, value); }; XMLDocumentCB.prototype.dec = function(version, encoding, standalone) { return this.declaration(version, encoding, standalone); }; XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) { return this.doctype(root, pubID, sysID); }; XMLDocumentCB.prototype.e = function(name, attributes, text) { return this.element(name, attributes, text); }; XMLDocumentCB.prototype.n = function(name, attributes, text) { return this.node(name, attributes, text); }; XMLDocumentCB.prototype.t = function(value) { return this.text(value); }; XMLDocumentCB.prototype.d = function(value) { return this.cdata(value); }; XMLDocumentCB.prototype.c = function(value) { return this.comment(value); }; XMLDocumentCB.prototype.r = function(value) { return this.raw(value); }; XMLDocumentCB.prototype.i = function(target, value) { return this.instruction(target, value); }; XMLDocumentCB.prototype.att = function() { if (this.currentNode && this.currentNode instanceof XMLDocType) { return this.attList.apply(this, arguments); } else { return this.attribute.apply(this, arguments); } }; XMLDocumentCB.prototype.a = function() { if (this.currentNode && this.currentNode instanceof XMLDocType) { return this.attList.apply(this, arguments); } else { return this.attribute.apply(this, arguments); } }; XMLDocumentCB.prototype.ent = function(name, value) { return this.entity(name, value); }; XMLDocumentCB.prototype.pent = function(name, value) { return this.pEntity(name, value); }; XMLDocumentCB.prototype.not = function(name, value) { return this.notation(name, value); }; return XMLDocumentCB; })(); }).call(this); /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; XMLDeclaration = __webpack_require__(12); XMLDocType = __webpack_require__(13); XMLCData = __webpack_require__(10); XMLComment = __webpack_require__(11); XMLElement = __webpack_require__(8); XMLRaw = __webpack_require__(18); XMLText = __webpack_require__(19); XMLProcessingInstruction = __webpack_require__(20); XMLDTDAttList = __webpack_require__(14); XMLDTDElement = __webpack_require__(16); XMLDTDEntity = __webpack_require__(15); XMLDTDNotation = __webpack_require__(17); XMLWriterBase = __webpack_require__(23); module.exports = XMLStreamWriter = (function(superClass) { extend(XMLStreamWriter, superClass); function XMLStreamWriter(stream, options) { XMLStreamWriter.__super__.constructor.call(this, options); this.stream = stream; } XMLStreamWriter.prototype.document = function(doc) { var child, i, j, len, len1, ref, ref1, results; ref = doc.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; child.isLastRootNode = false; } doc.children[doc.children.length - 1].isLastRootNode = true; ref1 = doc.children; results = []; for (j = 0, len1 = ref1.length; j < len1; j++) { child = ref1[j]; switch (false) { case !(child instanceof XMLDeclaration): results.push(this.declaration(child)); break; case !(child instanceof XMLDocType): results.push(this.docType(child)); break; case !(child instanceof XMLComment): results.push(this.comment(child)); break; case !(child instanceof XMLProcessingInstruction): results.push(this.processingInstruction(child)); break; default: results.push(this.element(child)); } } return results; }; XMLStreamWriter.prototype.attribute = function(att) { return this.stream.write(' ' + att.name + '="' + att.value + '"'); }; XMLStreamWriter.prototype.cdata = function(node, level) { return this.stream.write(this.space(level) + '' + this.endline(node)); }; XMLStreamWriter.prototype.comment = function(node, level) { return this.stream.write(this.space(level) + '' + this.endline(node)); }; XMLStreamWriter.prototype.declaration = function(node, level) { this.stream.write(this.space(level)); this.stream.write(''); return this.stream.write(this.endline(node)); }; XMLStreamWriter.prototype.docType = function(node, level) { var child, i, len, ref; level || (level = 0); this.stream.write(this.space(level)); this.stream.write(' 0) { this.stream.write(' ['); this.stream.write(this.endline(node)); ref = node.children; for (i = 0, len = ref.length; i < len; i++) { child = ref[i]; switch (false) { case !(child instanceof XMLDTDAttList): this.dtdAttList(child, level + 1); break; case !(child instanceof XMLDTDElement): this.dtdElement(child, level + 1); break; case !(child instanceof XMLDTDEntity): this.dtdEntity(child, level + 1); break; case !(child instanceof XMLDTDNotation): this.dtdNotation(child, level + 1); break; case !(child instanceof XMLCData): this.cdata(child, level + 1); break; case !(child instanceof XMLComment): this.comment(child, level + 1); break; case !(child instanceof XMLProcessingInstruction): this.processingInstruction(child, level + 1); break; default: throw new Error("Unknown DTD node type: " + child.constructor.name); } } this.stream.write(']'); } this.stream.write(this.spacebeforeslash + '>'); return this.stream.write(this.endline(node)); }; XMLStreamWriter.prototype.element = function(node, level) { var att, child, i, len, name, ref, ref1, space; level || (level = 0); space = this.space(level); this.stream.write(space + '<' + node.name); ref = node.attributes; for (name in ref) { if (!hasProp.call(ref, name)) continue; att = ref[name]; this.attribute(att); } if (node.children.length === 0 || node.children.every(function(e) { return e.value === ''; })) { if (this.allowEmpty) { this.stream.write('>'); } else { this.stream.write(this.spacebeforeslash + '/>'); } } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) { this.stream.write('>'); this.stream.write(node.children[0].value); this.stream.write(''); } else { this.stream.write('>' + this.newline); ref1 = node.children; for (i = 0, len = ref1.length; i < len; i++) { child = ref1[i]; switch (false) { case !(child instanceof XMLCData): this.cdata(child, level + 1); break; case !(child instanceof XMLComment): this.comment(child, level + 1); break; case !(child instanceof XMLElement): this.element(child, level + 1); break; case !(child instanceof XMLRaw): this.raw(child, level + 1); break; case !(child instanceof XMLText): this.text(child, level + 1); break; case !(child instanceof XMLProcessingInstruction): this.processingInstruction(child, level + 1); break; default: throw new Error("Unknown XML node type: " + child.constructor.name); } } this.stream.write(space + ''); } return this.stream.write(this.endline(node)); }; XMLStreamWriter.prototype.processingInstruction = function(node, level) { this.stream.write(this.space(level) + '' + this.endline(node)); }; XMLStreamWriter.prototype.raw = function(node, level) { return this.stream.write(this.space(level) + node.value + this.endline(node)); }; XMLStreamWriter.prototype.text = function(node, level) { return this.stream.write(this.space(level) + node.value + this.endline(node)); }; XMLStreamWriter.prototype.dtdAttList = function(node, level) { this.stream.write(this.space(level) + '' + this.endline(node)); }; XMLStreamWriter.prototype.dtdElement = function(node, level) { this.stream.write(this.space(level) + '' + this.endline(node)); }; XMLStreamWriter.prototype.dtdEntity = function(node, level) { this.stream.write(this.space(level) + '' + this.endline(node)); }; XMLStreamWriter.prototype.dtdNotation = function(node, level) { this.stream.write(this.space(level) + '' + this.endline(node)); }; XMLStreamWriter.prototype.endline = function(node) { if (!node.isLastRootNode) { return this.newline; } else { return ''; } }; return XMLStreamWriter; })(XMLWriterBase); }).call(this); /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.7 (function() { "use strict"; var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; sax = __webpack_require__(27); events = __webpack_require__(33); bom = __webpack_require__(59); processors = __webpack_require__(60); setImmediate = __webpack_require__(48).setImmediate; defaults = __webpack_require__(2).defaults; isEmpty = function(thing) { return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0; }; processItem = function(processors, item, key) { var i, len, process; for (i = 0, len = processors.length; i < len; i++) { process = processors[i]; item = process(item, key); } return item; }; exports.Parser = (function(superClass) { extend(Parser, superClass); function Parser(opts) { this.parseString = bind(this.parseString, this); this.reset = bind(this.reset, this); this.assignOrPush = bind(this.assignOrPush, this); this.processAsync = bind(this.processAsync, this); var key, ref, value; if (!(this instanceof exports.Parser)) { return new exports.Parser(opts); } this.options = {}; ref = defaults["0.2"]; for (key in ref) { if (!hasProp.call(ref, key)) continue; value = ref[key]; this.options[key] = value; } for (key in opts) { if (!hasProp.call(opts, key)) continue; value = opts[key]; this.options[key] = value; } if (this.options.xmlns) { this.options.xmlnskey = this.options.attrkey + "ns"; } if (this.options.normalizeTags) { if (!this.options.tagNameProcessors) { this.options.tagNameProcessors = []; } this.options.tagNameProcessors.unshift(processors.normalize); } this.reset(); } Parser.prototype.processAsync = function() { var chunk, err; try { if (this.remaining.length <= this.options.chunkSize) { chunk = this.remaining; this.remaining = ''; this.saxParser = this.saxParser.write(chunk); return this.saxParser.close(); } else { chunk = this.remaining.substr(0, this.options.chunkSize); this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length); this.saxParser = this.saxParser.write(chunk); return setImmediate(this.processAsync); } } catch (error1) { err = error1; if (!this.saxParser.errThrown) { this.saxParser.errThrown = true; return this.emit(err); } } }; Parser.prototype.assignOrPush = function(obj, key, newValue) { if (!(key in obj)) { if (!this.options.explicitArray) { return obj[key] = newValue; } else { return obj[key] = [newValue]; } } else { if (!(obj[key] instanceof Array)) { obj[key] = [obj[key]]; } return obj[key].push(newValue); } }; Parser.prototype.reset = function() { var attrkey, charkey, ontext, stack; this.removeAllListeners(); this.saxParser = sax.parser(this.options.strict, { trim: false, normalize: false, xmlns: this.options.xmlns }); this.saxParser.errThrown = false; this.saxParser.onerror = (function(_this) { return function(error) { _this.saxParser.resume(); if (!_this.saxParser.errThrown) { _this.saxParser.errThrown = true; return _this.emit("error", error); } }; })(this); this.saxParser.onend = (function(_this) { return function() { if (!_this.saxParser.ended) { _this.saxParser.ended = true; return _this.emit("end", _this.resultObject); } }; })(this); this.saxParser.ended = false; this.EXPLICIT_CHARKEY = this.options.explicitCharkey; this.resultObject = null; stack = []; attrkey = this.options.attrkey; charkey = this.options.charkey; this.saxParser.onopentag = (function(_this) { return function(node) { var key, newValue, obj, processedKey, ref; obj = {}; obj[charkey] = ""; if (!_this.options.ignoreAttrs) { ref = node.attributes; for (key in ref) { if (!hasProp.call(ref, key)) continue; if (!(attrkey in obj) && !_this.options.mergeAttrs) { obj[attrkey] = {}; } newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key]; processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key; if (_this.options.mergeAttrs) { _this.assignOrPush(obj, processedKey, newValue); } else { obj[attrkey][processedKey] = newValue; } } } obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name; if (_this.options.xmlns) { obj[_this.options.xmlnskey] = { uri: node.uri, local: node.local }; } return stack.push(obj); }; })(this); this.saxParser.onclosetag = (function(_this) { return function() { var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath; obj = stack.pop(); nodeName = obj["#name"]; if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) { delete obj["#name"]; } if (obj.cdata === true) { cdata = obj.cdata; delete obj.cdata; } s = stack[stack.length - 1]; if (obj[charkey].match(/^\s*$/) && !cdata) { emptyStr = obj[charkey]; delete obj[charkey]; } else { if (_this.options.trim) { obj[charkey] = obj[charkey].trim(); } if (_this.options.normalize) { obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim(); } obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey]; if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { obj = obj[charkey]; } } if (isEmpty(obj)) { obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; } if (_this.options.validator != null) { xpath = "/" + ((function() { var i, len, results; results = []; for (i = 0, len = stack.length; i < len; i++) { node = stack[i]; results.push(node["#name"]); } return results; })()).concat(nodeName).join("/"); (function() { var err; try { return obj = _this.options.validator(xpath, s && s[nodeName], obj); } catch (error1) { err = error1; return _this.emit("error", err); } })(); } if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') { if (!_this.options.preserveChildrenOrder) { node = {}; if (_this.options.attrkey in obj) { node[_this.options.attrkey] = obj[_this.options.attrkey]; delete obj[_this.options.attrkey]; } if (!_this.options.charsAsChildren && _this.options.charkey in obj) { node[_this.options.charkey] = obj[_this.options.charkey]; delete obj[_this.options.charkey]; } if (Object.getOwnPropertyNames(obj).length > 0) { node[_this.options.childkey] = obj; } obj = node; } else if (s) { s[_this.options.childkey] = s[_this.options.childkey] || []; objClone = {}; for (key in obj) { if (!hasProp.call(obj, key)) continue; objClone[key] = obj[key]; } s[_this.options.childkey].push(objClone); delete obj["#name"]; if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) { obj = obj[charkey]; } } } if (stack.length > 0) { return _this.assignOrPush(s, nodeName, obj); } else { if (_this.options.explicitRoot) { old = obj; obj = {}; obj[nodeName] = old; } _this.resultObject = obj; _this.saxParser.ended = true; return _this.emit("end", _this.resultObject); } }; })(this); ontext = (function(_this) { return function(text) { var charChild, s; s = stack[stack.length - 1]; if (s) { s[charkey] += text; if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) { s[_this.options.childkey] = s[_this.options.childkey] || []; charChild = { '#name': '__text__' }; charChild[charkey] = text; if (_this.options.normalize) { charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim(); } s[_this.options.childkey].push(charChild); } return s; } }; })(this); this.saxParser.ontext = ontext; return this.saxParser.oncdata = (function(_this) { return function(text) { var s; s = ontext(text); if (s) { return s.cdata = true; } }; })(this); }; Parser.prototype.parseString = function(str, cb) { var err; if ((cb != null) && typeof cb === "function") { this.on("end", function(result) { this.reset(); return cb(null, result); }); this.on("error", function(err) { this.reset(); return cb(err); }); } try { str = str.toString(); if (str.trim() === '') { this.emit("end", null); return true; } str = bom.stripBOM(str); if (this.options.async) { this.remaining = str; setImmediate(this.processAsync); return this.saxParser; } return this.saxParser.write(str).close(); } catch (error1) { err = error1; if (!(this.saxParser.errThrown || this.saxParser.ended)) { this.emit('error', err); return this.saxParser.errThrown = true; } else if (this.saxParser.ended) { throw err; } } }; return Parser; })(events.EventEmitter); exports.parseString = function(str, a, b) { var cb, options, parser; if (b != null) { if (typeof b === 'function') { cb = b; } if (typeof a === 'object') { options = a; } } else { if (typeof a === 'function') { cb = a; } options = {}; } parser = new exports.Parser(options); return parser.parseString(str, cb); }; }).call(this); /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {;(function (sax) { // wrapper for non-node envs sax.parser = function (strict, opt) { return new SAXParser(strict, opt) } sax.SAXParser = SAXParser sax.SAXStream = SAXStream sax.createStream = createStream // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns. // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)), // since that's the earliest that a buffer overrun could occur. This way, checks are // as rare as required, but as often as necessary to ensure never crossing this bound. // Furthermore, buffers are only tested at most once per write(), so passing a very // large string into write() might have undesirable effects, but this is manageable by // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme // edge case, result in creating at most one complete copy of the string passed in. // Set to Infinity to have unlimited buffers. sax.MAX_BUFFER_LENGTH = 64 * 1024 var buffers = [ 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype', 'procInstName', 'procInstBody', 'entity', 'attribName', 'attribValue', 'cdata', 'script' ] sax.EVENTS = [ 'text', 'processinginstruction', 'sgmldeclaration', 'doctype', 'comment', 'opentagstart', 'attribute', 'opentag', 'closetag', 'opencdata', 'cdata', 'closecdata', 'error', 'end', 'ready', 'script', 'opennamespace', 'closenamespace' ] function SAXParser (strict, opt) { if (!(this instanceof SAXParser)) { return new SAXParser(strict, opt) } var parser = this clearBuffers(parser) parser.q = parser.c = '' parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH parser.opt = opt || {} parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase' parser.tags = [] parser.closed = parser.closedRoot = parser.sawRoot = false parser.tag = parser.error = null parser.strict = !!strict parser.noscript = !!(strict || parser.opt.noscript) parser.state = S.BEGIN parser.strictEntities = parser.opt.strictEntities parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES) parser.attribList = [] // namespaces form a prototype chain. // it always points at the current tag, // which protos to its parent tag. if (parser.opt.xmlns) { parser.ns = Object.create(rootNS) } // mostly just for error reporting parser.trackPosition = parser.opt.position !== false if (parser.trackPosition) { parser.position = parser.line = parser.column = 0 } emit(parser, 'onready') } if (!Object.create) { Object.create = function (o) { function F () {} F.prototype = o var newf = new F() return newf } } if (!Object.keys) { Object.keys = function (o) { var a = [] for (var i in o) if (o.hasOwnProperty(i)) a.push(i) return a } } function checkBufferLength (parser) { var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10) var maxActual = 0 for (var i = 0, l = buffers.length; i < l; i++) { var len = parser[buffers[i]].length if (len > maxAllowed) { // Text/cdata nodes can get big, and since they're buffered, // we can get here under normal conditions. // Avoid issues by emitting the text node now, // so at least it won't get any bigger. switch (buffers[i]) { case 'textNode': closeText(parser) break case 'cdata': emitNode(parser, 'oncdata', parser.cdata) parser.cdata = '' break case 'script': emitNode(parser, 'onscript', parser.script) parser.script = '' break default: error(parser, 'Max buffer length exceeded: ' + buffers[i]) } } maxActual = Math.max(maxActual, len) } // schedule the next check for the earliest possible buffer overrun. var m = sax.MAX_BUFFER_LENGTH - maxActual parser.bufferCheckPosition = m + parser.position } function clearBuffers (parser) { for (var i = 0, l = buffers.length; i < l; i++) { parser[buffers[i]] = '' } } function flushBuffers (parser) { closeText(parser) if (parser.cdata !== '') { emitNode(parser, 'oncdata', parser.cdata) parser.cdata = '' } if (parser.script !== '') { emitNode(parser, 'onscript', parser.script) parser.script = '' } } SAXParser.prototype = { end: function () { end(this) }, write: write, resume: function () { this.error = null; return this }, close: function () { return this.write(null) }, flush: function () { flushBuffers(this) } } var Stream try { Stream = __webpack_require__(32).Stream } catch (ex) { Stream = function () {} } var streamWraps = sax.EVENTS.filter(function (ev) { return ev !== 'error' && ev !== 'end' }) function createStream (strict, opt) { return new SAXStream(strict, opt) } function SAXStream (strict, opt) { if (!(this instanceof SAXStream)) { return new SAXStream(strict, opt) } Stream.apply(this) this._parser = new SAXParser(strict, opt) this.writable = true this.readable = true var me = this this._parser.onend = function () { me.emit('end') } this._parser.onerror = function (er) { me.emit('error', er) // if didn't throw, then means error was handled. // go ahead and clear error, so we can write again. me._parser.error = null } this._decoder = null streamWraps.forEach(function (ev) { Object.defineProperty(me, 'on' + ev, { get: function () { return me._parser['on' + ev] }, set: function (h) { if (!h) { me.removeAllListeners(ev) me._parser['on' + ev] = h return h } me.on(ev, h) }, enumerable: true, configurable: false }) }) } SAXStream.prototype = Object.create(Stream.prototype, { constructor: { value: SAXStream } }) SAXStream.prototype.write = function (data) { if (typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function' && Buffer.isBuffer(data)) { if (!this._decoder) { var SD = __webpack_require__(58).StringDecoder this._decoder = new SD('utf8') } data = this._decoder.write(data) } this._parser.write(data.toString()) this.emit('data', data) return true } SAXStream.prototype.end = function (chunk) { if (chunk && chunk.length) { this.write(chunk) } this._parser.end() return true } SAXStream.prototype.on = function (ev, handler) { var me = this if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) { me._parser['on' + ev] = function () { var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments) args.splice(0, 0, ev) me.emit.apply(me, args) } } return Stream.prototype.on.call(me, ev, handler) } // character classes and tokens var whitespace = '\r\n\t ' // this really needs to be replaced with character classes. // XML allows all manner of ridiculous numbers and digits. var number = '0124356789' var letter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' // (Letter | "_" | ":") var quote = '\'"' var attribEnd = whitespace + '>' var CDATA = '[CDATA[' var DOCTYPE = 'DOCTYPE' var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace' var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/' var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE } // turn all the string character sets into character class objects. whitespace = charClass(whitespace) number = charClass(number) letter = charClass(letter) // http://www.w3.org/TR/REC-xml/#NT-NameStartChar // This implementation works on strings, a single character at a time // as such, it cannot ever support astral-plane characters (10000-EFFFF) // without a significant breaking change to either this parser, or the // JavaScript language. Implementation of an emoji-capable xml parser // is left as an exercise for the reader. var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/ var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/ var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/ quote = charClass(quote) attribEnd = charClass(attribEnd) function charClass (str) { return str.split('').reduce(function (s, c) { s[c] = true return s }, {}) } function isRegExp (c) { return Object.prototype.toString.call(c) === '[object RegExp]' } function is (charclass, c) { return isRegExp(charclass) ? !!c.match(charclass) : charclass[c] } function not (charclass, c) { return !is(charclass, c) } var S = 0 sax.STATE = { BEGIN: S++, // leading byte order mark or whitespace BEGIN_WHITESPACE: S++, // leading whitespace TEXT: S++, // general stuff TEXT_ENTITY: S++, // & and such. OPEN_WAKA: S++, // < SGML_DECL: S++, // SCRIPT: S++, //