From b08e6f70df0d3fad4356af1968d95c2ad6909fb5 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Tue, 27 Aug 2019 15:26:37 +0200 Subject: [PATCH] fix external lib jdito warnings --- .../getDocxDocument_serverProcess/process.js | 662 +++++++++++------- 1 file changed, 395 insertions(+), 267 deletions(-) diff --git a/process/getDocxDocument_serverProcess/process.js b/process/getDocxDocument_serverProcess/process.js index 12ab4e172f..44b9ff0378 100644 --- a/process/getDocxDocument_serverProcess/process.js +++ b/process/getDocxDocument_serverProcess/process.js @@ -107,7 +107,7 @@ function _getAutoNewLineModule() /* - * do NOT TOUCH the following code. these are js-libraries + * do NOT TOUCH the following code. these are js-libraries (modified to remove all jdito warnings) */ @@ -149,8 +149,59 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN */ function initJsZip() { -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ -'use strict'; +(function (f) { + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f() + } else if (typeof define === "function" && define.amd) { + define([], f) + } else { + var g; + if (typeof window !== "undefined") { + g = window + } else if (typeof global !== "undefined") { + g = global + } else if (typeof self !== "undefined") { + g = self + } else { + g = this + } + g.JSZip = f() + } +})(function () { + var define, + module, + exports; + return (function e(t, n, r) { + function s(o, u) { + if (!n[o]) { + if (!t[o]) { + var a1 = typeof require == "function" && require; + if (!u && a1) + return a1(o, !0); + if (i1) + return i1(o, !0); + var f = new Error("Cannot find module '" + o + "'"); + throw f.code = "MODULE_NOT_FOUND", + f + } + var l = n[o] = { + exports: {} + }; + t[o][0].call(l.exports, function (e) { + var n = t[o][1][e]; + return s(n ? n : e) + }, l, l.exports, e, t, n, r) + } + return n[o].exports + } + var i1 = typeof require == "function" && require; + for (var o = 0; o < r.length; o++) + s(r[o]); + return s + })({ + 1: [function (require, module, exports) +{ + var DataReader = require('./dataReader'); function ArrayReader(data) { @@ -196,14 +247,14 @@ ArrayReader.prototype.readData = function(size) { if(size === 0) { return []; } - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + var res = this.data.slice(this.zero + this.index, this.zero + this.index + size); this.index += size; - return result; + return res; }; module.exports = ArrayReader; },{"./dataReader":6}],2:[function(require,module,exports){ -'use strict'; + // private property var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; @@ -275,7 +326,7 @@ exports.decode = function(input, utf8) { }; },{}],3:[function(require,module,exports){ -'use strict'; + function CompressedObject() { this.compressedSize = 0; this.uncompressedSize = 0; @@ -305,7 +356,7 @@ CompressedObject.prototype = { module.exports = CompressedObject; },{}],4:[function(require,module,exports){ -'use strict'; + exports.STORE = { magic: "\x00\x00", compress: function(content, compressionOptions) { @@ -320,7 +371,7 @@ exports.STORE = { exports.DEFLATE = require('./flate'); },{"./flate":9}],5:[function(require,module,exports){ -'use strict'; + var utils = require('./utils'); @@ -424,7 +475,7 @@ module.exports = function crc32(input, crc) { // vim: set shiftwidth=4 softtabstop=4: },{"./utils":22}],6:[function(require,module,exports){ -'use strict'; + var utils = require('./utils'); function DataReader(data) { @@ -483,14 +534,14 @@ DataReader.prototype = { * @return {number} the corresponding number. */ readInt: function(size) { - var result = 0, + var res = 0, i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { - result = (result << 8) + this.byteAt(i); + res = (res << 8) + this.byteAt(i); } this.index += size; - return result; + return res; }, /** * Get the next string with a given byte size. @@ -534,7 +585,7 @@ DataReader.prototype = { module.exports = DataReader; },{"./utils":22}],7:[function(require,module,exports){ -'use strict'; + exports.base64 = false; exports.binary = false; exports.dir = false; @@ -547,11 +598,11 @@ exports.unixPermissions = null; exports.dosPermissions = null; },{}],8:[function(require,module,exports){ -'use strict'; + var utils = require('./utils'); /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.string2binary = function(str) { @@ -559,7 +610,7 @@ exports.string2binary = function(str) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.string2Uint8Array = function(str) { @@ -567,7 +618,7 @@ exports.string2Uint8Array = function(str) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.uint8Array2String = function(array) { @@ -575,7 +626,7 @@ exports.uint8Array2String = function(array) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.string2Blob = function(str) { @@ -584,7 +635,7 @@ exports.string2Blob = function(str) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.arrayBuffer2Blob = function(buffer) { @@ -592,7 +643,7 @@ exports.arrayBuffer2Blob = function(buffer) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.transformTo = function(outputType, input) { @@ -600,7 +651,7 @@ exports.transformTo = function(outputType, input) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.getTypeOf = function(input) { @@ -608,7 +659,7 @@ exports.getTypeOf = function(input) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.checkSupport = function(type) { @@ -616,20 +667,20 @@ exports.checkSupport = function(type) { }; /** - * @deprecated + * * This value will be removed in a future version without replacement. */ exports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS; /** - * @deprecated + * * This value will be removed in a future version without replacement. */ exports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.pretty = function(str) { @@ -637,7 +688,7 @@ exports.pretty = function(str) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.findCompression = function(compressionMethod) { @@ -645,7 +696,7 @@ exports.findCompression = function(compressionMethod) { }; /** - * @deprecated + * * This function will be removed in a future version without replacement. */ exports.isRegExp = function (object) { @@ -654,7 +705,7 @@ exports.isRegExp = function (object) { },{"./utils":22}],9:[function(require,module,exports){ -'use strict'; + var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); var pako = require("pako"); @@ -672,7 +723,7 @@ exports.uncompress = function(input) { }; },{"pako":25}],10:[function(require,module,exports){ -'use strict'; + var base64 = require('./base64'); @@ -721,6 +772,7 @@ function JSZip(data, options) { } return newObj; }; + return undefined } JSZip.prototype = require('./object'); JSZip.prototype.load = require('./load'); @@ -728,21 +780,21 @@ JSZip.support = require('./support'); JSZip.defaults = require('./defaults'); /** - * @deprecated + * * This namespace will be removed in a future version without replacement. */ JSZip.utils = require('./deprecatedPublicUtils'); JSZip.base64 = { /** - * @deprecated + * * This method will be removed in a future version without replacement. */ encode : function(input) { return base64.encode(input); }, /** - * @deprecated + * * This method will be removed in a future version without replacement. */ decode : function(input) { @@ -753,7 +805,7 @@ JSZip.compressions = require('./compressions'); module.exports = JSZip; },{"./base64":2,"./compressions":4,"./defaults":7,"./deprecatedPublicUtils":8,"./load":11,"./object":14,"./support":18}],11:[function(require,module,exports){ -'use strict'; + var base64 = require('./base64'); var utf8 = require('./utf8'); var utils = require('./utils'); @@ -795,7 +847,7 @@ module.exports = function(data, options) { },{"./base64":2,"./utf8":21,"./utils":22,"./zipEntries":23}],12:[function(require,module,exports){ (function (Buffer){ -'use strict'; + module.exports = function(data, encoding){ return new Buffer(data, encoding); }; @@ -805,7 +857,7 @@ module.exports.test = function(b){ }).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) },{}],13:[function(require,module,exports){ -'use strict'; + var Uint8ArrayReader = require('./uint8ArrayReader'); function NodeBufferReader(data) { @@ -821,14 +873,14 @@ NodeBufferReader.prototype = new Uint8ArrayReader(); */ NodeBufferReader.prototype.readData = function(size) { this.checkOffset(size); - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + var res = this.data.slice(this.zero + this.index, this.zero + this.index + size); this.index += size; - return result; + return res; }; module.exports = NodeBufferReader; },{"./uint8ArrayReader":19}],14:[function(require,module,exports){ -'use strict'; + var support = require('./support'); var utils = require('./utils'); var crc32 = require('./crc32'); @@ -873,19 +925,19 @@ var getRawData = function(file) { * @return {String|ArrayBuffer|Uint8Array|Buffer} the data. */ var getBinaryData = function(file) { - var result = getRawData(file), - type = utils.getTypeOf(result); + var res = getRawData(file), + type = utils.getTypeOf(res); if (type === "string") { if (!file.options.binary) { // unicode text ! // unicode string => binary string is a painful process, check if we can avoid it. if (support.nodebuffer) { - return nodeBuffer(result, "utf-8"); + return nodeBuffer(res, "utf-8"); } } return file.asBinary(); } - return result; + return res; }; /** @@ -894,28 +946,28 @@ var getBinaryData = function(file) { * @return {String} the string representing this._data. */ var dataToString = function(asUTF8) { - var result = getRawData(this); - if (result === null || typeof result === "undefined") { + var res = getRawData(this); + if (res === null || typeof result === "undefined") { return ""; } // if the data is a base64 string, we decode it before checking the encoding ! if (this.options.base64) { - result = base64.decode(result); + res = base64.decode(res); } if (asUTF8 && this.options.binary) { // JSZip.prototype.utf8decode supports arrays as input // skip to array => string step, utf8decode will do it. - result = out.utf8decode(result); + res = out.utf8decode(res); } else { // no utf8 transformation, do the array => string step. - result = utils.transformTo("string", result); + res = utils.transformTo("string", res); } if (!asUTF8 && !this.options.binary) { - result = utils.transformTo("string", out.utf8encode(result)); + res = utils.transformTo("string", out.utf8encode(res)); } - return result; + return res; }; /** * A simple object representing a file in the zip file. @@ -966,16 +1018,16 @@ ZipObject.prototype = { * @return {Buffer} the content as a Buffer. */ asNodeBuffer: function() { - var result = getBinaryData(this); - return utils.transformTo("nodebuffer", result); + var res = getBinaryData(this); + return utils.transformTo("nodebuffer", res); }, /** * Returns the content as an Uint8Array. * @return {Uint8Array} the content as an Uint8Array. */ asUint8Array: function() { - var result = getBinaryData(this); - return utils.transformTo("uint8array", result); + var res = getBinaryData(this); + return utils.transformTo("uint8array", res); }, /** * Returns the content as an ArrayBuffer. @@ -1152,26 +1204,26 @@ var folderAdd = function(name, createFolders) { * @return {JSZip.CompressedObject} the compressed result. */ var generateCompressedObjectFrom = function(file, compression, compressionOptions) { - var result = new CompressedObject(), + var res = new CompressedObject(), content; // the data has not been decompressed, we might reuse things ! if (file._data instanceof CompressedObject) { - result.uncompressedSize = file._data.uncompressedSize; - result.crc32 = file._data.crc32; + res.uncompressedSize = file._data.uncompressedSize; + res.crc32 = file._data.crc32; - if (result.uncompressedSize === 0 || file.dir) { + if (res.uncompressedSize === 0 || file.dir) { compression = compressions['STORE']; - result.compressedContent = ""; - result.crc32 = 0; + res.compressedContent = ""; + res.crc32 = 0; } else if (file._data.compressionMethod === compression.magic) { - result.compressedContent = file._data.getCompressedContent(); + res.compressedContent = file._data.getCompressedContent(); } else { content = file._data.getContent(); // need to decompress / recompress - result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); + res.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); } } else { @@ -1181,15 +1233,15 @@ var generateCompressedObjectFrom = function(file, compression, compressionOption compression = compressions['STORE']; content = ""; } - result.uncompressedSize = content.length; - result.crc32 = crc32(content); - result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); + res.uncompressedSize = content.length; + res.crc32 = crc32(content); + res.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions); } - result.compressedSize = result.compressedContent.length; - result.compressionMethod = compression.magic; + res.compressedSize = res.compressedContent.length; + res.compressionMethod = compression.magic; - return result; + return res; }; @@ -1212,15 +1264,15 @@ var generateCompressedObjectFrom = function(file, compression, compressionOption */ var generateUnixExternalFileAttr = function (unixPermissions, isDir) { - var result = unixPermissions; + var res = unixPermissions; if (!unixPermissions) { // I can't use octal values in strict mode, hence the hexa. // 040775 => 0x41fd // 0100664 => 0x81b4 - result = isDir ? 0x41fd : 0x81b4; + res = isDir ? 0x41fd : 0x81b4; } - return (result & 0xFFFF) << 16; + return (res & 0xFFFF) << 16; }; /** @@ -1269,7 +1321,7 @@ var generateZipParts = function(name, file, compressedObject, offset, platform, extraFields = "", unicodePathExtraField = "", unicodeCommentExtraField = "", - dir, date; + dir, date1; // handle the deprecated options.dir @@ -1281,9 +1333,9 @@ var generateZipParts = function(name, file, compressedObject, offset, platform, // handle the deprecated options.date if(file._initialMetadata.date !== file.date) { - date = file.date; + date1 = file.date; } else { - date = o.date; + date1 = o.date; } var extFileAttr = 0; @@ -1305,17 +1357,17 @@ var generateZipParts = function(name, file, compressedObject, offset, platform, // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html - dosTime = date.getHours(); + dosTime = date1.getHours(); dosTime = dosTime << 6; - dosTime = dosTime | date.getMinutes(); + dosTime = dosTime | date1.getMinutes(); dosTime = dosTime << 5; - dosTime = dosTime | date.getSeconds() / 2; + dosTime = dosTime | date1.getSeconds() / 2; - dosDate = date.getFullYear() - 1980; + dosDate = date1.getFullYear() - 1980; dosDate = dosDate << 4; - dosDate = dosDate | (date.getMonth() + 1); + dosDate = dosDate | (date1.getMonth() + 1); dosDate = dosDate << 5; - dosDate = dosDate | date.getDate(); + dosDate = dosDate | date1.getDate(); if (useUTF8ForFileName) { // set the unicode path extra field. unzip needs at least one extra @@ -1442,7 +1494,7 @@ var out = { * @return {Array} An array of matching elements. */ filter: function(search) { - var result = [], + var res = [], filename, relativePath, file, fileClone; for (filename in this.files) { if (!this.files.hasOwnProperty(filename)) { @@ -1454,10 +1506,10 @@ var out = { relativePath = filename.slice(this.root.length, filename.length); if (filename.slice(0, this.root.length) === this.root && // the file is in the current root search(relativePath, fileClone)) { // and the file matches the function - result.push(fileClone); + res.push(fileClone); } } - return result; + return res; }, /** @@ -1674,7 +1726,6 @@ var out = { }, /** - * @deprecated * This method will be removed in a future version without replacement. */ crc32: function (input, crc) { @@ -1682,7 +1733,6 @@ var out = { }, /** - * @deprecated * This method will be removed in a future version without replacement. */ utf8encode: function (string) { @@ -1690,7 +1740,6 @@ var out = { }, /** - * @deprecated * This method will be removed in a future version without replacement. */ utf8decode: function (input) { @@ -1700,7 +1749,7 @@ var out = { module.exports = out; },{"./base64":2,"./compressedObject":3,"./compressions":4,"./crc32":5,"./defaults":7,"./nodeBuffer":12,"./signature":15,"./stringWriter":17,"./support":18,"./uint8ArrayWriter":20,"./utf8":21,"./utils":22}],15:[function(require,module,exports){ -'use strict'; + exports.LOCAL_FILE_HEADER = "PK\x03\x04"; exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; @@ -1709,7 +1758,7 @@ exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; exports.DATA_DESCRIPTOR = "PK\x07\x08"; },{}],16:[function(require,module,exports){ -'use strict'; + var DataReader = require('./dataReader'); var utils = require('./utils'); @@ -1741,14 +1790,14 @@ StringReader.prototype.lastIndexOfSignature = function(sig) { StringReader.prototype.readData = function(size) { this.checkOffset(size); // this will work because the constructor applied the "& 0xff" mask. - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + var res = this.data.slice(this.zero + this.index, this.zero + this.index + size); this.index += size; - return result; + return res; }; module.exports = StringReader; },{"./dataReader":6,"./utils":22}],17:[function(require,module,exports){ -'use strict'; + var utils = require('./utils'); @@ -1781,7 +1830,7 @@ module.exports = StringWriter; },{"./utils":22}],18:[function(require,module,exports){ (function (Buffer){ -'use strict'; + exports.base64 = true; exports.array = true; exports.string = true; @@ -1818,7 +1867,7 @@ else { }).call(this,(typeof Buffer !== "undefined" ? Buffer : undefined)) },{}],19:[function(require,module,exports){ -'use strict'; + var ArrayReader = require('./arrayReader'); function Uint8ArrayReader(data) { @@ -1839,14 +1888,14 @@ Uint8ArrayReader.prototype.readData = function(size) { // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. return new Uint8Array(0); } - var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); + var res = this.data.subarray(this.zero + this.index, this.zero + this.index + size); this.index += size; - return result; + return res; }; module.exports = Uint8ArrayReader; },{"./arrayReader":1}],20:[function(require,module,exports){ -'use strict'; + var utils = require('./utils'); @@ -1884,7 +1933,7 @@ Uint8ArrayWriter.prototype = { module.exports = Uint8ArrayWriter; },{"./utils":22}],21:[function(require,module,exports){ -'use strict'; + var utils = require('./utils'); var support = require('./support'); @@ -2077,23 +2126,23 @@ exports.utf8decode = function utf8decode(buf) { // Chrome prefers to work with "small" chunks of data // for the method buf2string. // Firefox and Chrome has their own shortcut, IE doesn't seem to really care. - var result = [], k = 0, len = buf.length, chunk = 65536; + var res = [], k = 0, len = buf.length, chunk = 65536; while (k < len) { var nextBoundary = utf8border(buf, Math.min(k + chunk, len)); if (support.uint8array) { - result.push(buf2string(buf.subarray(k, nextBoundary))); + res.push(buf2string(buf.subarray(k, nextBoundary))); } else { - result.push(buf2string(buf.slice(k, nextBoundary))); + res.push(buf2string(buf.slice(k, nextBoundary))); } k = nextBoundary; } - return result.join(""); + return res.join(""); }; // vim: set shiftwidth=4 softtabstop=4: },{"./nodeBuffer":12,"./support":18,"./utils":22}],22:[function(require,module,exports){ -'use strict'; + var support = require('./support'); var compressions = require('./compressions'); var nodeBuffer = require('./nodeBuffer'); @@ -2103,11 +2152,11 @@ var nodeBuffer = require('./nodeBuffer'); * @return {String} the binary string. */ exports.string2binary = function(str) { - var result = ""; + var res = ""; for (var i = 0; i < str.length; i++) { - result += String.fromCharCode(str.charCodeAt(i) & 0xff); + res += String.fromCharCode(str.charCodeAt(i) & 0xff); } - return result; + return res; }; exports.arrayBuffer2Blob = function(buffer, mimeType) { exports.checkSupport("blob"); @@ -2175,7 +2224,7 @@ function arrayLikeToString(array) { // // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 var chunk = 65536; - var result = [], + var res = [], len = array.length, type = exports.getTypeOf(array), k = 0, @@ -2205,10 +2254,10 @@ function arrayLikeToString(array) { while (k < len && chunk > 1) { try { if (type === "array" || type === "nodebuffer") { - result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); + res.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); } else { - result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); + res.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); } k += chunk; } @@ -2216,7 +2265,7 @@ function arrayLikeToString(array) { chunk = Math.floor(chunk / 2); } } - return result.join(""); + return res.join(""); } exports.applyFromCharCode = arrayLikeToString; @@ -2336,8 +2385,8 @@ exports.transformTo = function(outputType, input) { } exports.checkSupport(outputType); var inputType = exports.getTypeOf(input); - var result = transform[inputType][outputType](input); - return result; + var res = transform[inputType][outputType](input); + return res; }; /** @@ -2362,6 +2411,7 @@ exports.getTypeOf = function(input) { if (support.arraybuffer && input instanceof ArrayBuffer) { return "arraybuffer"; } + return undefined; }; /** @@ -2425,21 +2475,21 @@ exports.isRegExp = function (object) { * @param {...Object} var_args All objects to merge. * @return {Object} a new object with the data of the others. */ -exports.extend = function() { - var result = {}, i, attr; +exports.extend = function(var_args) { + var res = {}, i, attr; for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers for (attr in arguments[i]) { - if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { - result[attr] = arguments[i][attr]; + if (arguments[i].hasOwnProperty(attr) && typeof res[attr] === "undefined") { + res[attr] = arguments[i][attr]; } } } - return result; + return res; }; },{"./compressions":4,"./nodeBuffer":12,"./support":18}],23:[function(require,module,exports){ -'use strict'; + var StringReader = require('./stringReader'); var NodeBufferReader = require('./nodeBufferReader'); var Uint8ArrayReader = require('./uint8ArrayReader'); @@ -2485,9 +2535,9 @@ ZipEntries.prototype = { var currentIndex = this.reader.index; this.reader.setIndex(askedIndex); var signature = this.reader.readString(4); - var result = signature === expectedSignature; + var res = signature === expectedSignature; this.reader.setIndex(currentIndex); - return result; + return res; }, /** * Read the end of the central directory. @@ -2721,7 +2771,7 @@ ZipEntries.prototype = { module.exports = ZipEntries; },{"./arrayReader":1,"./nodeBufferReader":13,"./object":14,"./signature":15,"./stringReader":16,"./support":18,"./uint8ArrayReader":19,"./utils":22,"./zipEntry":24}],24:[function(require,module,exports){ -'use strict'; + var StringReader = require('./stringReader'); var utils = require('./utils'); var CompressedObject = require('./compressedObject'); @@ -3043,7 +3093,7 @@ module.exports = ZipEntry; },{"./compressedObject":3,"./object":14,"./stringReader":16,"./support":18,"./utils":22}],25:[function(require,module,exports){ // Top level file is just a mixin of submodules & constants -'use strict'; + var assign = require('./lib/utils/common').assign; @@ -3058,7 +3108,7 @@ assign(pako, deflate, inflate, constants); module.exports = pako; },{"./lib/deflate":26,"./lib/inflate":27,"./lib/utils/common":28,"./lib/zlib/constants":31}],26:[function(require,module,exports){ -'use strict'; + var zlib_deflate = require('./zlib/deflate'); @@ -3245,6 +3295,8 @@ function Deflate(options) { this._dict_set = true; } + + return undefined; } /** @@ -3460,7 +3512,7 @@ exports.deflateRaw = deflateRaw; exports.gzip = gzip; },{"./utils/common":28,"./utils/strings":29,"./zlib/deflate":33,"./zlib/messages":38,"./zlib/zstream":40}],27:[function(require,module,exports){ -'use strict'; + var zlib_inflate = require('./zlib/inflate'); @@ -3606,6 +3658,7 @@ function Inflate(options) { this.header = new GZheader(); zlib_inflate.inflateGetHeader(this.strm, this.header); + return undefined; } /** @@ -3880,7 +3933,7 @@ exports.inflateRaw = inflateRaw; exports.ungzip = inflate; },{"./utils/common":28,"./utils/strings":29,"./zlib/constants":31,"./zlib/gzheader":34,"./zlib/inflate":36,"./zlib/messages":38,"./zlib/zstream":40}],28:[function(require,module,exports){ -'use strict'; + var TYPED_OK = (typeof Uint8Array !== 'undefined') && @@ -3931,7 +3984,7 @@ var fnTyped = { }, // Join array of chunks to single array. flattenChunks: function (chunks) { - var i, l, len, pos, chunk, result; + var i, l, len, pos, chunk, res; // calculate data length len = 0; @@ -3940,15 +3993,15 @@ var fnTyped = { } // join chunks - result = new Uint8Array(len); + res = new Uint8Array(len); pos = 0; for (i = 0, l = chunks.length; i < l; i++) { chunk = chunks[i]; - result.set(chunk, pos); + res.set(chunk, pos); pos += chunk.length; } - return result; + return res; } }; @@ -3985,7 +4038,7 @@ exports.setTyped(TYPED_OK); },{}],29:[function(require,module,exports){ // String encode/decode helpers -'use strict'; + var utils = require('./common'); @@ -4076,11 +4129,11 @@ function buf2binstring(buf, len) { } } - var result = ''; + var res = ''; for (var i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); + res += String.fromCharCode(buf[i]); } - return result; + return res; } @@ -4171,7 +4224,7 @@ exports.utf8border = function (buf, max) { }; },{"./common":28}],30:[function(require,module,exports){ -'use strict'; + // Note: adler32 takes 12% for level 0 and 2% for level 6. // It doesn't worth to make additional optimizationa as in original. @@ -4205,7 +4258,7 @@ function adler32(adler, buf, len, pos) { module.exports = adler32; },{}],31:[function(require,module,exports){ -'use strict'; + module.exports = { @@ -4257,7 +4310,7 @@ module.exports = { }; },{}],32:[function(require,module,exports){ -'use strict'; + // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables @@ -4300,7 +4353,7 @@ function crc32(crc, buf, len, pos) { module.exports = crc32; },{}],33:[function(require,module,exports){ -'use strict'; + var utils = require('../utils/common'); var trees = require('./trees'); @@ -6157,7 +6210,7 @@ exports.deflateTune = deflateTune; */ },{"../utils/common":28,"./adler32":30,"./crc32":32,"./messages":38,"./trees":39}],34:[function(require,module,exports){ -'use strict'; + function GZheader() { @@ -6199,7 +6252,7 @@ function GZheader() { module.exports = GZheader; },{}],35:[function(require,module,exports){ -'use strict'; + // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ @@ -6527,7 +6580,7 @@ module.exports = function inflate_fast(strm, start) { }; },{}],36:[function(require,module,exports){ -'use strict'; + var utils = require('../utils/common'); @@ -8067,7 +8120,7 @@ exports.inflateUndermine = inflateUndermine; */ },{"../utils/common":28,"./adler32":30,"./crc32":32,"./inffast":35,"./inftrees":37}],37:[function(require,module,exports){ -'use strict'; + var utils = require('../utils/common'); @@ -8396,7 +8449,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta }; },{"../utils/common":28}],38:[function(require,module,exports){ -'use strict'; + module.exports = { 2: 'need dictionary', /* Z_NEED_DICT 2 */ @@ -8411,7 +8464,7 @@ module.exports = { }; },{}],39:[function(require,module,exports){ -'use strict'; + var utils = require('../utils/common'); @@ -9615,7 +9668,7 @@ exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; },{"../utils/common":28}],40:[function(require,module,exports){ -'use strict'; + function ZStream() { @@ -9647,7 +9700,7 @@ module.exports = ZStream; },{}]},{},[10])(10) }); -}; +} //templater @@ -9669,8 +9722,58 @@ function initTemplater() { initJsZip(); -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Docxtemplater = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ -"use strict"; +(function (f) { + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f() + } else if (typeof define === "function" && define.amd) { + define([], f) + } else { + var g; + if (typeof window !== "undefined") { + g = window + } else if (typeof global !== "undefined") { + g = global + } else if (typeof self !== "undefined") { + g = self + } else { + g = this + } + g.Docxtemplater = f() + } +})(function () { + var define, + module, + exports; + return (function e(t, n, r) { + function s(o, u) { + if (!n[o]) { + if (!t[o]) { + var a1 = typeof require == "function" && require; + if (!u && a1) + return a1(o, !0); + if (i1) + return i1(o, !0); + var f = new Error("Cannot find module '" + o + "'"); + throw f.code = "MODULE_NOT_FOUND", + f + } + var l = n[o] = { + exports: {} + }; + t[o][0].call(l.exports, function (e) { + var n = t[o][1][e]; + return s(n ? n : e) + }, l, l.exports, e, t, n, r) + } + return n[o].exports + } + var i1 = typeof require == "function" && require; + for (var o = 0; o < r.length; o++) + s(r[o]); + return s + })({ + 1: [function (require, module, exports) +{ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -9723,8 +9826,8 @@ DocUtils.mergeObjects = function () { }; DocUtils.xml2str = function (xmlNode) { - var a = new XMLSerializer(); - return a.serializeToString(xmlNode); + var a1 = new XMLSerializer(); + return a1.serializeToString(xmlNode); }; DocUtils.decodeUtf8 = function (s) { @@ -9799,9 +9902,9 @@ DocUtils.cloneDeep = function (obj) { }; DocUtils.concatArrays = function (arrays) { - return arrays.reduce(function (result, array) { - Array.prototype.push.apply(result, array); - return result; + return arrays.reduce(function (res, array) { + Array.prototype.push.apply(res, array); + return res; }, []); }; @@ -9848,6 +9951,7 @@ DocUtils.getRight = function (parsed, element, index) { } } throwXmlTagNotFound({ position: "right", element: element, parsed: parsed, index: index }); + return undefined; }; DocUtils.getLeft = function (parsed, element, index) { @@ -9858,11 +9962,12 @@ DocUtils.getLeft = function (parsed, element, index) { } } throwXmlTagNotFound({ position: "left", element: element, parsed: parsed, index: index }); + return undefined; }; module.exports = DocUtils; },{"./errors":2,"./memoize":5,"xmldom":19}],2:[function(require,module,exports){ -"use strict"; + function XTError(message) { this.name = "GenericError"; @@ -9900,7 +10005,7 @@ module.exports = { XTScopeParserError: XTScopeParserError }; },{}],3:[function(require,module,exports){ -"use strict"; + var loopModule = require("./modules/loop"); var spacePreserveModule = require("./modules/space-preserve"); @@ -9945,7 +10050,7 @@ module.exports = { pptx: PptXFileTypeConfig }; },{"./modules/expand-pair-trait":8,"./modules/loop":9,"./modules/rawxml":10,"./modules/render":11,"./modules/space-preserve":12}],4:[function(require,module,exports){ -"use strict"; + var Errors = require("./errors"); var DocUtils = require("./doc-utils"); @@ -10013,11 +10118,11 @@ function tagMatcher(content, textMatchArray, othersMatchArray) { tag = _getTag.tag, position = _getTag.position; - var text = allMatches[tag]; - if (text == null) { + var text1 = allMatches[tag]; + if (text1 == null) { continue; } - totalMatches.push({ type: "tag", position: position, text: text, offset: offset, value: tagText }); + totalMatches.push({ type: "tag", position: position, text: text1, offset: offset, value: tagText }); } return totalMatches; @@ -10188,7 +10293,7 @@ module.exports = { } }; },{"./doc-utils":1,"./errors":2}],5:[function(require,module,exports){ -"use strict"; + function memoize(func) { var stringifyJson = JSON.stringify, @@ -10202,7 +10307,7 @@ function memoize(func) { module.exports = memoize; },{}],6:[function(require,module,exports){ -"use strict"; + function getMinFromArrays(arrays, state) { var minIndex = -1; @@ -10246,7 +10351,7 @@ module.exports = function (arrays) { return resultArray; }; },{}],7:[function(require,module,exports){ -"use strict"; + function emptyFun() {} function identity(i) { @@ -10273,7 +10378,7 @@ module.exports = function (module) { return module; }; },{}],8:[function(require,module,exports){ -"use strict"; + var traitName = "expandPair"; var mergeSort = require("../mergesort"); @@ -10344,6 +10449,7 @@ function getPairs(traits) { } var part = firstTrait.part; throwUnmatchedLoopException({ part: part, location: part.location }); + return undefined; } var expandPairTrait = { @@ -10404,7 +10510,7 @@ module.exports = function () { return wrapper(expandPairTrait); }; },{"../doc-utils":1,"../errors":2,"../mergesort":6,"../module-wrapper":7,"../traits":16}],9:[function(require,module,exports){ -"use strict"; + var DocUtils = require("../doc-utils"); var dashInnerRegex = /^-([^\s]+)\s(.+)$/; @@ -10435,7 +10541,7 @@ var loopModule = { }, getTraits: function getTraits(traitName, parsed) { if (traitName !== "expandPair") { - return; + return undefined; } return parsed.reduce(function (tags, part, offset) { @@ -10467,7 +10573,7 @@ module.exports = function () { return wrapper(loopModule); }; },{"../doc-utils":1,"../module-wrapper":7}],10:[function(require,module,exports){ -"use strict"; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -10558,7 +10664,7 @@ module.exports = function () { return wrapper(new RawXmlModule()); }; },{"../doc-utils":1,"../errors":2,"../module-wrapper":7}],11:[function(require,module,exports){ -"use strict"; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -10602,7 +10708,7 @@ module.exports = function () { return wrapper(new Render()); }; },{"../module-wrapper":7}],12:[function(require,module,exports){ -"use strict"; + var wrapper = require("../module-wrapper"); var spacePreserve = { @@ -10610,7 +10716,7 @@ var spacePreserve = { postparse: function postparse(parsed) { var chunk = []; var inChunk = false; - var result = parsed.reduce(function (parsed, part) { + var res = parsed.reduce(function (parsed, part) { if (part.type === "tag" && part.position === "start" && part.text && part.value === "<w:t>") { inChunk = true; } @@ -10629,15 +10735,15 @@ var spacePreserve = { } return parsed; }, []); - Array.prototype.push.apply(result, chunk); - return result; + Array.prototype.push.apply(res, chunk); + return res; } }; module.exports = function () { return wrapper(spacePreserve); }; },{"../module-wrapper":7}],13:[function(require,module,exports){ -"use strict"; + var DocUtils = require("./doc-utils"); @@ -10703,7 +10809,7 @@ var parser = { module.exports = parser; },{"./doc-utils":1}],14:[function(require,module,exports){ -"use strict"; + var ScopeManager = require("./scope-manager"); var DocUtils = require("./doc-utils"); @@ -10747,7 +10853,7 @@ function render(options) { module.exports = render; },{"./doc-utils":1,"./scope-manager":15}],15:[function(require,module,exports){ -"use strict"; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -10796,7 +10902,7 @@ var ScopeManager = function () { scope = value[i]; this.functorIfInverted(!inverted, functor, scope); } - return; + return undefined; } if (type === "[object Object]") { return this.functorIfInverted(!inverted, functor, value); @@ -10804,6 +10910,7 @@ var ScopeManager = function () { if (value === true) { return this.functorIfInverted(!inverted, functor, currentValue); } + return undefined; } }, { key: "getValue", @@ -10812,7 +10919,7 @@ var ScopeManager = function () { this.num = num == null ? this.scopeList.length - 1 : num; var err = void 0; var parser = void 0; - var result = void 0; + var res = void 0; var scope = this.scopeList[this.num]; try { parser = this.parser(tag); @@ -10827,7 +10934,7 @@ var ScopeManager = function () { throw err; } try { - result = parser.get(scope, { num: this.num, scopeList: this.scopeList }); + res = parser.get(scope, { num: this.num, scopeList: this.scopeList }); } catch (error) { err = new Errors.XTScopeParserError("Scope parser execution failed"); err.properties = { @@ -10839,10 +10946,10 @@ var ScopeManager = function () { }; throw err; } - if (result == null && this.num > 0) { + if (res == null && this.num > 0) { return this.getValue(tag, this.num - 1); } - return result; + return res; } }, { key: "createSubScopeManager", @@ -10874,7 +10981,7 @@ ScopeManager.createBaseScopeManager = function (_ref) { module.exports = ScopeManager; },{"./errors":2}],16:[function(require,module,exports){ -"use strict"; + var DocUtils = require("./doc-utils"); var Errors = require("./errors"); @@ -10920,22 +11027,22 @@ function getListXmlElements(parts) { return part.value; }); - var result = []; + var res = []; for (var i = 0, tag; i < tags.length; i++) { tag = tags[i]; // closing tag if (tag[1] === "/") { - if (lastTagIsOpenTag(result, tag)) { - result.pop(); + if (lastTagIsOpenTag(res, tag)) { + res.pop(); } else { - result = addTag(result, tag); + res = addTag(res, tag); } } else if (tag[tag.length - 1] !== "/") { - result = addTag(result, tag); + res = addTag(res, tag); } } - return result; + return res; } function getExpandToDefault(parts) { @@ -10995,7 +11102,7 @@ module.exports = { getExpandToDefault: getExpandToDefault }; },{"./doc-utils":1,"./errors":2}],17:[function(require,module,exports){ -"use strict"; + // res class responsibility is to parse the XML. var DocUtils = require("./doc-utils"); @@ -11073,7 +11180,7 @@ module.exports = function (content, tagsXmlArray) { return DocUtils.cloneDeep(memoized(content, tagsXmlArray)); }; },{"./doc-utils":1,"./memoize":5}],18:[function(require,module,exports){ -"use strict"; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -11089,10 +11196,10 @@ var _render = require("./render.js"); function _getFullText(content, tagsXmlArray) { var matcher = xmlMatcher(content, tagsXmlArray); - var result = matcher.matches.map(function (match) { + var res = matcher.matches.map(function (match) { return match.array[2]; }); - return DocUtils.wordToUtf8(DocUtils.convertSpaces(result.join(""))); + return DocUtils.wordToUtf8(DocUtils.convertSpaces(res.join(""))); } module.exports = function () { @@ -11266,9 +11373,9 @@ DOMHandler.prototype = { this.doc.documentURI = this.locator.systemId; } }, - startElement:function(namespaceURI, localName, qName, attrs) { + startElement:function(namespaceURI1, localName, qName1, attrs) { var doc = this.doc; - var el = doc.createElementNS(namespaceURI, qName||localName); + var el = doc.createElementNS(namespaceURI1, qName1||localName); var len = attrs.length; appendElement(this, el); this.currentElement = el; @@ -11304,10 +11411,11 @@ DOMHandler.prototype = { chars = _toString.apply(this,arguments) //console.log(chars) if(chars){ + var charNode if (this.cdata) { - var charNode = this.doc.createCDATASection(chars); + charNode = this.doc.createCDATASection(chars); } else { - var charNode = this.doc.createTextNode(chars); + charNode = this.doc.createTextNode(chars); } if(this.currentElement){ this.currentElement.appendChild(charNode); @@ -11371,6 +11479,7 @@ function _locator(l){ if(l){ return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' } + return undefined; } function _toString(chars,start,length){ if(typeof chars == 'string'){ @@ -11458,7 +11567,7 @@ function _extends(Class,Super){ pt.__proto__ = ppt; } if(!(pt instanceof Super)){ - function t(){}; + function t(){} t.prototype = Super.prototype; t = new t(); copy(pt,t); @@ -11520,7 +11629,7 @@ function DOMException(code, message) { error.code = code; if(message) this.message = this.message + ": " + message; return error; -}; +} DOMException.prototype = Error.prototype; copy(ExceptionCode,DOMException) /** @@ -11529,7 +11638,7 @@ copy(ExceptionCode,DOMException) * The items in the NodeList are accessible via an integral index, starting from 0. */ function NodeList() { -}; +} NodeList.prototype = { /** * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. @@ -11582,13 +11691,14 @@ _extends(LiveNodeList,NodeList); * used for attributes or DocumentType entities */ function NamedNodeMap() { -}; +} function _findNodeIndex(list,node){ var i = list.length; while(i--){ if(list[i] === node){return i} } + return undefined; } function _addNamedNode(el,list,newAttr,oldAttr){ @@ -11642,6 +11752,7 @@ NamedNodeMap.prototype = { return attr; } } + return undefined; }, setNamedItem: function(attr) { var el = attr.ownerElement; @@ -11699,7 +11810,7 @@ function DOMImplementation(/* Object */ features) { this._features = features[feature]; } } -}; +} DOMImplementation.prototype = { hasFeature: function(/* string */ feature, /* string */ version) { @@ -11748,7 +11859,7 @@ DOMImplementation.prototype = { */ function Node() { -}; +} Node.prototype = { firstChild : null, @@ -11859,6 +11970,7 @@ copy(NodeType,Node); copy(NodeType,Node.prototype); /** + * @param node * @param callback return true for continue,false for break * @return boolean true: break visit; */ @@ -11871,6 +11983,7 @@ function _visitNode(node,callback){ if(_visitNode(node,callback)){return true} }while(node=node.nextSibling) } + return undefined; } @@ -11982,12 +12095,13 @@ function _insertBefore(parentNode,newChild,nextChild){ } function _appendSingleChild(parentNode,newChild){ var cp = newChild.parentNode; + var pre if(cp){ - var pre = parentNode.lastChild; + pre = parentNode.lastChild; cp.removeChild(newChild);//remove and update - var pre = parentNode.lastChild; + pre = parentNode.lastChild; } - var pre = parentNode.lastChild; + pre = parentNode.lastChild; newChild.parentNode = parentNode; newChild.previousSibling = pre; newChild.nextSibling = null; @@ -12045,6 +12159,7 @@ Document.prototype = { return true; } } + return undefined; }) return rtv; }, @@ -12150,7 +12265,7 @@ _extends(Document,Node); function Element() { this._nsMap = {}; -}; +} Element.prototype = { nodeType : ELEMENT_NODE, hasAttribute : function(name){ @@ -12243,13 +12358,13 @@ Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNa _extends(Element,Node); function Attr() { -}; +} Attr.prototype.nodeType = ATTRIBUTE_NODE; _extends(Attr,Node); function CharacterData() { -}; +} CharacterData.prototype = { data : '', substringData : function(offset, count) { @@ -12280,16 +12395,16 @@ CharacterData.prototype = { } _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 text1 = this.data; + var newText = text1.substring(offset); + text1 = text1.substring(0, offset); + this.data = this.nodeValue = text1; + this.length = text1.length; var newNode = this.ownerDocument.createTextNode(newText); if(this.parentNode){ this.parentNode.insertBefore(newNode, this.nextSibling); @@ -12299,7 +12414,7 @@ Text.prototype = { } _extends(Text,CharacterData); function Comment() { -}; +} Comment.prototype = { nodeName : "#comment", nodeType : COMMENT_NODE @@ -12307,7 +12422,7 @@ Comment.prototype = { _extends(Comment,CharacterData); function CDATASection() { -}; +} CDATASection.prototype = { nodeName : "#cdata-section", nodeType : CDATA_SECTION_NODE @@ -12316,27 +12431,27 @@ _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); @@ -12359,7 +12474,7 @@ function nodeSerializeToString(isHtml,nodeFilter){ if(uri && prefix == null){ //console.log(prefix) - var prefix = refNode.lookupPrefix(uri); + prefix = refNode.lookupPrefix(uri); if(prefix == null){ //isHTML = true; var visibleNamespaces=[ @@ -12407,14 +12522,14 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ if(node){ if(typeof node == 'string'){ buf.push(node); - return; + return undefined; } }else{ - return; + return undefined; } //buf.sort.apply(attrs, attributeSorter); } - switch(node.nodeType){ + switch(node.nodeType){ case ELEMENT_NODE: if (!visibleNamespaces) visibleNamespaces = []; var startVisibleNamespaces = visibleNamespaces.length; @@ -12422,7 +12537,11 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ var len = attrs.length; var child = node.firstChild; var nodeName = node.tagName; - + var attr; + var prefix; + var uri; + var ns; + isHTML = (htmlns === node.namespaceURI) ||isHTML buf.push('<',nodeName); @@ -12430,19 +12549,19 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ for(var i=0;i<len;i++){ // add namespaces for attributes - var attr = attrs.item(i); + 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); + for(i=0;i<len;i++){ + attr = attrs.item(i); if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) { - var prefix = attr.prefix||''; - var uri = attr.namespaceURI; - var ns = prefix ? ' xmlns:' + prefix : " xmlns"; + prefix = attr.prefix||''; + uri = attr.namespaceURI; + ns = prefix ? ' xmlns:' + prefix : " xmlns"; buf.push(ns, '="' , uri , '"'); visibleNamespaces.push({ prefix: prefix, namespace:uri }); } @@ -12450,9 +12569,9 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ } // add namespace for current node if (needNamespaceDefine(node,isHTML, visibleNamespaces)) { - var prefix = node.prefix||''; - var uri = node.namespaceURI; - var ns = prefix ? ' xmlns:' + prefix : " xmlns"; + prefix = node.prefix||''; + uri = node.namespaceURI; + ns = prefix ? ' xmlns:' + prefix : " xmlns"; buf.push(ns, '="' , uri , '"'); visibleNamespaces.push({ prefix: prefix, namespace:uri }); } @@ -12482,15 +12601,15 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ } // remove added visible namespaces //visibleNamespaces.length = startVisibleNamespaces; - return; + return undefined; case DOCUMENT_NODE: case DOCUMENT_FRAGMENT_NODE: - var child = node.firstChild; + child = node.firstChild; while(child){ serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces); child = child.nextSibling; } - return; + return undefined; case ATTRIBUTE_NODE: return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"'); case TEXT_NODE: @@ -12518,7 +12637,7 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ } buf.push(">"); } - return; + return undefined; case PROCESSING_INSTRUCTION_NODE: return buf.push( "<?",node.target," ",node.data,"?>"); case ENTITY_REFERENCE_NODE: @@ -12528,6 +12647,7 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){ default: buf.push('??',node.nodeName); } + return undefined; } function importNode(doc,node,deep){ var node2; @@ -12600,7 +12720,7 @@ function cloneNode(doc,node,deep){ for(var i=0;i<len;i++){ node2.setAttributeNode(cloneNode(doc,attrs.item(i),true)); } - break;; + break; case ATTRIBUTE_NODE: deep = true; } @@ -12765,15 +12885,17 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ var parseStack = [{currentNSMap:defaultNSMapCopy}] var closeMap = {}; var start = 0; + var end; + 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; + var text1 = doc.createTextNode(source.substr(start)); + doc.appendChild(text1); + domBuilder.currentElement = text1; } return; } @@ -12782,7 +12904,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ } switch(source.charAt(tagStart+1)){ case '/': - var end = source.indexOf('>',tagStart+3); + end = source.indexOf('>',tagStart+3); var tagName = source.substring(tagStart+2,end); var config = parseStack.pop(); if(end<0){ @@ -12831,7 +12953,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ var el = new ElementAttributes(); var currentNSMap = parseStack[parseStack.length-1].currentNSMap; //elStartEnd - var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler); + end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler); var len = el.length; @@ -12845,9 +12967,9 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ var locator2 = copyLocator(locator,{}); //try{//attribute position fixed for(var i = 0;i<len;i++){ - var a = el[i]; - position(a.offset); - a.locator = copyLocator(locator,{}); + var a1 = el[i]; + position(a1.offset); + a1.locator = copyLocator(locator,{}); } //}catch(e){console.error('@@@@@'+e)} domBuilder.locator = locator2 @@ -13017,7 +13139,7 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error s = S_ATTR_SPACE; break; case S_ATTR_NOQUOT_VALUE: - var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); + value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); errorHandler.warning('attribute "'+value+'" missed quot(")!!'); el.add(attrName,value,start) case S_ATTR_END: @@ -13071,15 +13193,18 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error function appendElement(el,domBuilder,currentNSMap){ var tagName = el.tagName; var localNSMap = null; + var nsp; + var prefix; + //var currentNSMap = parseStack[parseStack.length-1].currentNSMap; var i = el.length; while(i--){ - var a = el[i]; - var qName = a.qName; - var value = a.value; - var nsp = qName.indexOf(':'); + var a1 = el[i]; + var qName = a1.qName; + var value = a1.value; + nsp = qName.indexOf(':'); if(nsp>0){ - var prefix = a.prefix = qName.slice(0,nsp); + prefix = a1.prefix = qName.slice(0,nsp); var localName = qName.slice(nsp+1); var nsPrefix = prefix === 'xmlns' && localName }else{ @@ -13088,7 +13213,7 @@ function appendElement(el,domBuilder,currentNSMap){ nsPrefix = qName === 'xmlns' && '' } //can not set prefix,because prefix !== '' - a.localName = localName ; + a1.localName = localName ; //prefix == null for no ns prefix attribute if(nsPrefix !== false){//hack!! if(localNSMap == null){ @@ -13098,25 +13223,25 @@ function appendElement(el,domBuilder,currentNSMap){ //console.log(currentNSMap,1) } currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; - a.uri = 'http://www.w3.org/2000/xmlns/' + a1.uri = 'http://www.w3.org/2000/xmlns/' domBuilder.startPrefixMapping(nsPrefix, value) } } - var i = el.length; + i = el.length; while(i--){ - a = el[i]; - var prefix = a.prefix; + a1 = el[i]; + prefix = a1.prefix; if(prefix){//no prefix attribute has no namespace if(prefix === 'xml'){ - a.uri = 'http://www.w3.org/XML/1998/namespace'; + a1.uri = 'http://www.w3.org/XML/1998/namespace'; }if(prefix !== 'xmlns'){ - a.uri = currentNSMap[prefix || ''] + a1.uri = currentNSMap[prefix || ''] //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} } } } - var nsp = tagName.indexOf(':'); + nsp = tagName.indexOf(':'); if(nsp>0){ prefix = el.prefix = tagName.slice(0,nsp); localName = el.localName = tagName.slice(nsp+1); @@ -13142,22 +13267,23 @@ function appendElement(el,domBuilder,currentNSMap){ //parseStack.push(el); return true; } + return undefined; } function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ if(/^(?:script|textarea)$/i.test(tagName)){ var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd); - var text = source.substring(elStartEnd+1,elEndStart); - if(/[&<]/.test(text)){ + var text1 = source.substring(elStartEnd+1,elEndStart); + if(/[&<]/.test(text1)){ if(/^script$/i.test(tagName)){ //if(!/\]\]>/.test(text)){ //lexHandler.startCDATA(); - domBuilder.characters(text,0,text.length); + domBuilder.characters(text1,0,text1.length); //lexHandler.endCDATA(); return elEndStart; //} }//}else{//text area - text = text.replace(/&#?\w+;/g,entityReplacer); - domBuilder.characters(text,0,text.length); + text1 = text1.replace(/&#?\w+;/g,entityReplacer); + domBuilder.characters(text1,0,text1.length); return elEndStart; //} @@ -13184,10 +13310,11 @@ function _copy(source,target){ } function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!' var next= source.charAt(start+2) + var end; switch(next){ case '-': if(source.charAt(start + 3) === '-'){ - var end = source.indexOf('-->',start+4); + end = source.indexOf('-->',start+4); //append comment source.substring(4,end)//<!-- if(end>start){ domBuilder.comment(source,start+4,end-start-4); @@ -13202,7 +13329,7 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!' } default: if(source.substr(start+3,6) == 'CDATA['){ - var end = source.indexOf(']]>',start+9); + end = source.indexOf(']]>',start+9); domBuilder.startCDATA(); domBuilder.characters(source,start+9,end-start-9); domBuilder.endCDATA() @@ -13290,7 +13417,7 @@ function _set_proto_(thiz,parent){ } if(!(_set_proto_({},_set_proto_.prototype) instanceof _set_proto_)){ _set_proto_ = function(thiz,parent){ - function p(){}; + function p(){} p.prototype = parent; p = new p(); for(parent in thiz){ @@ -13310,13 +13437,14 @@ function split(source,start){ buf.push(match); if(match[1])return buf; } + return undefined; } exports.XMLReader = XMLReader; },{}],"/src/js/docxtemplater.js":[function(require,module,exports){ -"use strict"; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -- GitLab