vue-files-preview-inno
Version:
A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.
5,055 lines • 260 kB
JavaScript
import { commonjsGlobal as rt, getDefaultExportFromCjs as Cn } from "../../../../_virtual/_commonjsHelpers.mjs";
import { __module as Rt } from "../../../../_virtual/index.mjs";
import { __require as Sn } from "../../../vue-demi/lib/index.mjs";
import Pn from "../../../../_virtual/_vue.mjs";
(function(zt, En) {
(function(Re, ze) {
zt.exports = ze(Sn(), Pn);
})(rt, function(Re, ze) {
var Nt = Object.defineProperty, It = Object.defineProperties, Mt = Object.getOwnPropertyDescriptors, nt = Object.getOwnPropertySymbols, Dt = Object.prototype.hasOwnProperty, Ot = Object.prototype.propertyIsEnumerable, at = (i, t, e) => t in i ? Nt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, ye = (i, t) => {
for (var e in t || (t = {})) Dt.call(t, e) && at(i, e, t[e]);
if (nt) for (var e of nt(t)) Ot.call(t, e) && at(i, e, t[e]);
return i;
}, Le = (i, t) => It(i, Mt(t)), ve = (i, t, e) => new Promise((r, n) => {
var a = (u) => {
try {
o(e.next(u));
} catch (m) {
n(m);
}
}, l = (u) => {
try {
o(e.throw(u));
} catch (m) {
n(m);
}
}, o = (u) => u.done ? r(u.value) : Promise.resolve(u.value).then(a, l);
o((e = e.apply(i, t)).next());
});
typeof window.setImmediate > "u" && (window.setImmediate = function(i, ...t) {
setTimeout(() => i(t));
});
var je = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof rt < "u" ? rt : typeof self < "u" ? self : {};
function Ft(i) {
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
}
function Ue(i) {
throw new Error('Could not dynamically require "' + i + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var st = { exports: {} };
/*!
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/
(function(i, t) {
(function(e) {
i.exports = e();
})(function() {
return function e(r, n, a) {
function l(m, k) {
if (!n[m]) {
if (!r[m]) {
var _ = typeof Ue == "function" && Ue;
if (!k && _) return _(m, !0);
if (o) return o(m, !0);
var w = new Error("Cannot find module '" + m + "'");
throw w.code = "MODULE_NOT_FOUND", w;
}
var d = n[m] = { exports: {} };
r[m][0].call(d.exports, function(v) {
var h = r[m][1][v];
return l(h || v);
}, d, d.exports, e, r, n, a);
}
return n[m].exports;
}
for (var o = typeof Ue == "function" && Ue, u = 0; u < a.length; u++) l(a[u]);
return l;
}({ 1: [function(e, r, n) {
var a = e("./utils"), l = e("./support"), o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
n.encode = function(u) {
for (var m, k, _, w, d, v, h, g = [], f = 0, y = u.length, C = y, E = a.getTypeOf(u) !== "string"; f < u.length; ) C = y - f, _ = E ? (m = u[f++], k = f < y ? u[f++] : 0, f < y ? u[f++] : 0) : (m = u.charCodeAt(f++), k = f < y ? u.charCodeAt(f++) : 0, f < y ? u.charCodeAt(f++) : 0), w = m >> 2, d = (3 & m) << 4 | k >> 4, v = 1 < C ? (15 & k) << 2 | _ >> 6 : 64, h = 2 < C ? 63 & _ : 64, g.push(o.charAt(w) + o.charAt(d) + o.charAt(v) + o.charAt(h));
return g.join("");
}, n.decode = function(u) {
var m, k, _, w, d, v, h = 0, g = 0, f = "data:";
if (u.substr(0, f.length) === f) throw new Error("Invalid base64 input, it looks like a data url.");
var y, C = 3 * (u = u.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
if (u.charAt(u.length - 1) === o.charAt(64) && C--, u.charAt(u.length - 2) === o.charAt(64) && C--, C % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
for (y = l.uint8array ? new Uint8Array(0 | C) : new Array(0 | C); h < u.length; ) m = o.indexOf(u.charAt(h++)) << 2 | (w = o.indexOf(u.charAt(h++))) >> 4, k = (15 & w) << 4 | (d = o.indexOf(u.charAt(h++))) >> 2, _ = (3 & d) << 6 | (v = o.indexOf(u.charAt(h++))), y[g++] = m, d !== 64 && (y[g++] = k), v !== 64 && (y[g++] = _);
return y;
};
}, { "./support": 30, "./utils": 32 }], 2: [function(e, r, n) {
var a = e("./external"), l = e("./stream/DataWorker"), o = e("./stream/Crc32Probe"), u = e("./stream/DataLengthProbe");
function m(k, _, w, d, v) {
this.compressedSize = k, this.uncompressedSize = _, this.crc32 = w, this.compression = d, this.compressedContent = v;
}
m.prototype = { getContentWorker: function() {
var k = new l(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")), _ = this;
return k.on("end", function() {
if (this.streamInfo.data_length !== _.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
}), k;
}, getCompressedWorker: function() {
return new l(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
} }, m.createWorkerFrom = function(k, _, w) {
return k.pipe(new o()).pipe(new u("uncompressedSize")).pipe(_.compressWorker(w)).pipe(new u("compressedSize")).withStreamInfo("compression", _);
}, r.exports = m;
}, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, r, n) {
var a = e("./stream/GenericWorker");
n.STORE = { magic: "\0\0", compressWorker: function() {
return new a("STORE compression");
}, uncompressWorker: function() {
return new a("STORE decompression");
} }, n.DEFLATE = e("./flate");
}, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, r, n) {
var a = e("./utils"), l = function() {
for (var o, u = [], m = 0; m < 256; m++) {
o = m;
for (var k = 0; k < 8; k++) o = 1 & o ? 3988292384 ^ o >>> 1 : o >>> 1;
u[m] = o;
}
return u;
}();
r.exports = function(o, u) {
return o !== void 0 && o.length ? a.getTypeOf(o) !== "string" ? function(m, k, _, w) {
var d = l, v = w + _;
m ^= -1;
for (var h = w; h < v; h++) m = m >>> 8 ^ d[255 & (m ^ k[h])];
return -1 ^ m;
}(0 | u, o, o.length, 0) : function(m, k, _, w) {
var d = l, v = w + _;
m ^= -1;
for (var h = w; h < v; h++) m = m >>> 8 ^ d[255 & (m ^ k.charCodeAt(h))];
return -1 ^ m;
}(0 | u, o, o.length, 0) : 0;
};
}, { "./utils": 32 }], 5: [function(e, r, n) {
n.base64 = !1, n.binary = !1, n.dir = !1, n.createFolders = !0, n.date = null, n.compression = null, n.compressionOptions = null, n.comment = null, n.unixPermissions = null, n.dosPermissions = null;
}, {}], 6: [function(e, r, n) {
var a = null;
a = typeof Promise < "u" ? Promise : e("lie"), r.exports = { Promise: a };
}, { lie: 37 }], 7: [function(e, r, n) {
var a = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Uint32Array < "u", l = e("pako"), o = e("./utils"), u = e("./stream/GenericWorker"), m = a ? "uint8array" : "array";
function k(_, w) {
u.call(this, "FlateWorker/" + _), this._pako = null, this._pakoAction = _, this._pakoOptions = w, this.meta = {};
}
n.magic = "\b\0", o.inherits(k, u), k.prototype.processChunk = function(_) {
this.meta = _.meta, this._pako === null && this._createPako(), this._pako.push(o.transformTo(m, _.data), !1);
}, k.prototype.flush = function() {
u.prototype.flush.call(this), this._pako === null && this._createPako(), this._pako.push([], !0);
}, k.prototype.cleanUp = function() {
u.prototype.cleanUp.call(this), this._pako = null;
}, k.prototype._createPako = function() {
this._pako = new l[this._pakoAction]({ raw: !0, level: this._pakoOptions.level || -1 });
var _ = this;
this._pako.onData = function(w) {
_.push({ data: w, meta: _.meta });
};
}, n.compressWorker = function(_) {
return new k("Deflate", _);
}, n.uncompressWorker = function() {
return new k("Inflate", {});
};
}, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, r, n) {
function a(d, v) {
var h, g = "";
for (h = 0; h < v; h++) g += String.fromCharCode(255 & d), d >>>= 8;
return g;
}
function l(d, v, h, g, f, y) {
var C, E, A = d.file, F = d.compression, M = y !== m.utf8encode, H = o.transformTo("string", y(A.name)), I = o.transformTo("string", m.utf8encode(A.name)), X = A.comment, Q = o.transformTo("string", y(X)), x = o.transformTo("string", m.utf8encode(X)), D = I.length !== A.name.length, c = x.length !== X.length, L = "", te = "", $ = "", re = A.dir, W = A.date, ee = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
v && !h || (ee.crc32 = d.crc32, ee.compressedSize = d.compressedSize, ee.uncompressedSize = d.uncompressedSize);
var z = 0;
v && (z |= 8), M || !D && !c || (z |= 2048);
var B = 0, Y = 0;
re && (B |= 16), f === "UNIX" ? (Y = 798, B |= function(V, fe) {
var be = V;
return V || (be = fe ? 16893 : 33204), (65535 & be) << 16;
}(A.unixPermissions, re)) : (Y = 20, B |= function(V) {
return 63 & (V || 0);
}(A.dosPermissions)), C = W.getUTCHours(), C <<= 6, C |= W.getUTCMinutes(), C <<= 5, C |= W.getUTCSeconds() / 2, E = W.getUTCFullYear() - 1980, E <<= 4, E |= W.getUTCMonth() + 1, E <<= 5, E |= W.getUTCDate(), D && (te = a(1, 1) + a(k(H), 4) + I, L += "up" + a(te.length, 2) + te), c && ($ = a(1, 1) + a(k(Q), 4) + x, L += "uc" + a($.length, 2) + $);
var q = "";
return q += `
\0`, q += a(z, 2), q += F.magic, q += a(C, 2), q += a(E, 2), q += a(ee.crc32, 4), q += a(ee.compressedSize, 4), q += a(ee.uncompressedSize, 4), q += a(H.length, 2), q += a(L.length, 2), { fileRecord: _.LOCAL_FILE_HEADER + q + H + L, dirRecord: _.CENTRAL_FILE_HEADER + a(Y, 2) + q + a(Q.length, 2) + "\0\0\0\0" + a(B, 4) + a(g, 4) + H + L + Q };
}
var o = e("../utils"), u = e("../stream/GenericWorker"), m = e("../utf8"), k = e("../crc32"), _ = e("../signature");
function w(d, v, h, g) {
u.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = v, this.zipPlatform = h, this.encodeFileName = g, this.streamFiles = d, this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
}
o.inherits(w, u), w.prototype.push = function(d) {
var v = d.meta.percent || 0, h = this.entriesCount, g = this._sources.length;
this.accumulate ? this.contentBuffer.push(d) : (this.bytesWritten += d.data.length, u.prototype.push.call(this, { data: d.data, meta: { currentFile: this.currentFile, percent: h ? (v + 100 * (h - g - 1)) / h : 100 } }));
}, w.prototype.openedSource = function(d) {
this.currentSourceOffset = this.bytesWritten, this.currentFile = d.file.name;
var v = this.streamFiles && !d.file.dir;
if (v) {
var h = l(d, v, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
this.push({ data: h.fileRecord, meta: { percent: 0 } });
} else this.accumulate = !0;
}, w.prototype.closedSource = function(d) {
this.accumulate = !1;
var v = this.streamFiles && !d.file.dir, h = l(d, v, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
if (this.dirRecords.push(h.dirRecord), v) this.push({ data: function(g) {
return _.DATA_DESCRIPTOR + a(g.crc32, 4) + a(g.compressedSize, 4) + a(g.uncompressedSize, 4);
}(d), meta: { percent: 100 } });
else for (this.push({ data: h.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
this.currentFile = null;
}, w.prototype.flush = function() {
for (var d = this.bytesWritten, v = 0; v < this.dirRecords.length; v++) this.push({ data: this.dirRecords[v], meta: { percent: 100 } });
var h = this.bytesWritten - d, g = function(f, y, C, E, A) {
var F = o.transformTo("string", A(E));
return _.CENTRAL_DIRECTORY_END + "\0\0\0\0" + a(f, 2) + a(f, 2) + a(y, 4) + a(C, 4) + a(F.length, 2) + F;
}(this.dirRecords.length, h, d, this.zipComment, this.encodeFileName);
this.push({ data: g, meta: { percent: 100 } });
}, w.prototype.prepareNextSource = function() {
this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
}, w.prototype.registerPrevious = function(d) {
this._sources.push(d);
var v = this;
return d.on("data", function(h) {
v.processChunk(h);
}), d.on("end", function() {
v.closedSource(v.previous.streamInfo), v._sources.length ? v.prepareNextSource() : v.end();
}), d.on("error", function(h) {
v.error(h);
}), this;
}, w.prototype.resume = function() {
return !!u.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), !0) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), !0));
}, w.prototype.error = function(d) {
var v = this._sources;
if (!u.prototype.error.call(this, d)) return !1;
for (var h = 0; h < v.length; h++) try {
v[h].error(d);
} catch {
}
return !0;
}, w.prototype.lock = function() {
u.prototype.lock.call(this);
for (var d = this._sources, v = 0; v < d.length; v++) d[v].lock();
}, r.exports = w;
}, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, r, n) {
var a = e("../compressions"), l = e("./ZipFileWorker");
n.generateWorker = function(o, u, m) {
var k = new l(u.streamFiles, m, u.platform, u.encodeFileName), _ = 0;
try {
o.forEach(function(w, d) {
_++;
var v = function(y, C) {
var E = y || C, A = a[E];
if (!A) throw new Error(E + " is not a valid compression method !");
return A;
}(d.options.compression, u.compression), h = d.options.compressionOptions || u.compressionOptions || {}, g = d.dir, f = d.date;
d._compressWorker(v, h).withStreamInfo("file", { name: w, dir: g, date: f, comment: d.comment || "", unixPermissions: d.unixPermissions, dosPermissions: d.dosPermissions }).pipe(k);
}), k.entriesCount = _;
} catch (w) {
k.error(w);
}
return k;
};
}, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, r, n) {
function a() {
if (!(this instanceof a)) return new a();
if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
var l = new a();
for (var o in this) typeof this[o] != "function" && (l[o] = this[o]);
return l;
};
}
(a.prototype = e("./object")).loadAsync = e("./load"), a.support = e("./support"), a.defaults = e("./defaults"), a.version = "3.10.1", a.loadAsync = function(l, o) {
return new a().loadAsync(l, o);
}, a.external = e("./external"), r.exports = a;
}, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, r, n) {
var a = e("./utils"), l = e("./external"), o = e("./utf8"), u = e("./zipEntries"), m = e("./stream/Crc32Probe"), k = e("./nodejsUtils");
function _(w) {
return new l.Promise(function(d, v) {
var h = w.decompressed.getContentWorker().pipe(new m());
h.on("error", function(g) {
v(g);
}).on("end", function() {
h.streamInfo.crc32 !== w.decompressed.crc32 ? v(new Error("Corrupted zip : CRC32 mismatch")) : d();
}).resume();
});
}
r.exports = function(w, d) {
var v = this;
return d = a.extend(d || {}, { base64: !1, checkCRC32: !1, optimizedBinaryString: !1, createFolders: !1, decodeFileName: o.utf8decode }), k.isNode && k.isStream(w) ? l.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : a.prepareContent("the loaded zip file", w, !0, d.optimizedBinaryString, d.base64).then(function(h) {
var g = new u(d);
return g.load(h), g;
}).then(function(h) {
var g = [l.Promise.resolve(h)], f = h.files;
if (d.checkCRC32) for (var y = 0; y < f.length; y++) g.push(_(f[y]));
return l.Promise.all(g);
}).then(function(h) {
for (var g = h.shift(), f = g.files, y = 0; y < f.length; y++) {
var C = f[y], E = C.fileNameStr, A = a.resolve(C.fileNameStr);
v.file(A, C.decompressed, { binary: !0, optimizedBinaryString: !0, date: C.date, dir: C.dir, comment: C.fileCommentStr.length ? C.fileCommentStr : null, unixPermissions: C.unixPermissions, dosPermissions: C.dosPermissions, createFolders: d.createFolders }), C.dir || (v.file(A).unsafeOriginalName = E);
}
return g.zipComment.length && (v.comment = g.zipComment), v;
});
};
}, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, r, n) {
var a = e("../utils"), l = e("../stream/GenericWorker");
function o(u, m) {
l.call(this, "Nodejs stream input adapter for " + u), this._upstreamEnded = !1, this._bindStream(m);
}
a.inherits(o, l), o.prototype._bindStream = function(u) {
var m = this;
(this._stream = u).pause(), u.on("data", function(k) {
m.push({ data: k, meta: { percent: 0 } });
}).on("error", function(k) {
m.isPaused ? this.generatedError = k : m.error(k);
}).on("end", function() {
m.isPaused ? m._upstreamEnded = !0 : m.end();
});
}, o.prototype.pause = function() {
return !!l.prototype.pause.call(this) && (this._stream.pause(), !0);
}, o.prototype.resume = function() {
return !!l.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), !0);
}, r.exports = o;
}, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, r, n) {
var a = e("readable-stream").Readable;
function l(o, u, m) {
a.call(this, u), this._helper = o;
var k = this;
o.on("data", function(_, w) {
k.push(_) || k._helper.pause(), m && m(w);
}).on("error", function(_) {
k.emit("error", _);
}).on("end", function() {
k.push(null);
});
}
e("../utils").inherits(l, a), l.prototype._read = function() {
this._helper.resume();
}, r.exports = l;
}, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, r, n) {
r.exports = { isNode: typeof Buffer < "u", newBufferFrom: function(a, l) {
if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(a, l);
if (typeof a == "number") throw new Error('The "data" argument must not be a number');
return new Buffer(a, l);
}, allocBuffer: function(a) {
if (Buffer.alloc) return Buffer.alloc(a);
var l = new Buffer(a);
return l.fill(0), l;
}, isBuffer: function(a) {
return Buffer.isBuffer(a);
}, isStream: function(a) {
return a && typeof a.on == "function" && typeof a.pause == "function" && typeof a.resume == "function";
} };
}, {}], 15: [function(e, r, n) {
function a(A, F, M) {
var H, I = o.getTypeOf(F), X = o.extend(M || {}, k);
X.date = X.date || /* @__PURE__ */ new Date(), X.compression !== null && (X.compression = X.compression.toUpperCase()), typeof X.unixPermissions == "string" && (X.unixPermissions = parseInt(X.unixPermissions, 8)), X.unixPermissions && 16384 & X.unixPermissions && (X.dir = !0), X.dosPermissions && 16 & X.dosPermissions && (X.dir = !0), X.dir && (A = f(A)), X.createFolders && (H = g(A)) && y.call(this, H, !0);
var Q = I === "string" && X.binary === !1 && X.base64 === !1;
M && M.binary !== void 0 || (X.binary = !Q), (F instanceof _ && F.uncompressedSize === 0 || X.dir || !F || F.length === 0) && (X.base64 = !1, X.binary = !0, F = "", X.compression = "STORE", I = "string");
var x = null;
x = F instanceof _ || F instanceof u ? F : v.isNode && v.isStream(F) ? new h(A, F) : o.prepareContent(A, F, X.binary, X.optimizedBinaryString, X.base64);
var D = new w(A, x, X);
this.files[A] = D;
}
var l = e("./utf8"), o = e("./utils"), u = e("./stream/GenericWorker"), m = e("./stream/StreamHelper"), k = e("./defaults"), _ = e("./compressedObject"), w = e("./zipObject"), d = e("./generate"), v = e("./nodejsUtils"), h = e("./nodejs/NodejsStreamInputAdapter"), g = function(A) {
A.slice(-1) === "/" && (A = A.substring(0, A.length - 1));
var F = A.lastIndexOf("/");
return 0 < F ? A.substring(0, F) : "";
}, f = function(A) {
return A.slice(-1) !== "/" && (A += "/"), A;
}, y = function(A, F) {
return F = F !== void 0 ? F : k.createFolders, A = f(A), this.files[A] || a.call(this, A, null, { dir: !0, createFolders: F }), this.files[A];
};
function C(A) {
return Object.prototype.toString.call(A) === "[object RegExp]";
}
var E = { load: function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, forEach: function(A) {
var F, M, H;
for (F in this.files) H = this.files[F], (M = F.slice(this.root.length, F.length)) && F.slice(0, this.root.length) === this.root && A(M, H);
}, filter: function(A) {
var F = [];
return this.forEach(function(M, H) {
A(M, H) && F.push(H);
}), F;
}, file: function(A, F, M) {
if (arguments.length !== 1) return A = this.root + A, a.call(this, A, F, M), this;
if (C(A)) {
var H = A;
return this.filter(function(X, Q) {
return !Q.dir && H.test(X);
});
}
var I = this.files[this.root + A];
return I && !I.dir ? I : null;
}, folder: function(A) {
if (!A) return this;
if (C(A)) return this.filter(function(I, X) {
return X.dir && A.test(I);
});
var F = this.root + A, M = y.call(this, F), H = this.clone();
return H.root = M.name, H;
}, remove: function(A) {
A = this.root + A;
var F = this.files[A];
if (F || (A.slice(-1) !== "/" && (A += "/"), F = this.files[A]), F && !F.dir) delete this.files[A];
else for (var M = this.filter(function(I, X) {
return X.name.slice(0, A.length) === A;
}), H = 0; H < M.length; H++) delete this.files[M[H].name];
return this;
}, generate: function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, generateInternalStream: function(A) {
var F, M = {};
try {
if ((M = o.extend(A || {}, { streamFiles: !1, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: l.utf8encode })).type = M.type.toLowerCase(), M.compression = M.compression.toUpperCase(), M.type === "binarystring" && (M.type = "string"), !M.type) throw new Error("No output type specified.");
o.checkSupport(M.type), M.platform !== "darwin" && M.platform !== "freebsd" && M.platform !== "linux" && M.platform !== "sunos" || (M.platform = "UNIX"), M.platform === "win32" && (M.platform = "DOS");
var H = M.comment || this.comment || "";
F = d.generateWorker(this, M, H);
} catch (I) {
(F = new u("error")).error(I);
}
return new m(F, M.type || "string", M.mimeType);
}, generateAsync: function(A, F) {
return this.generateInternalStream(A).accumulate(F);
}, generateNodeStream: function(A, F) {
return (A = A || {}).type || (A.type = "nodebuffer"), this.generateInternalStream(A).toNodejsStream(F);
} };
r.exports = E;
}, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, r, n) {
r.exports = e("stream");
}, { stream: void 0 }], 17: [function(e, r, n) {
var a = e("./DataReader");
function l(o) {
a.call(this, o);
for (var u = 0; u < this.data.length; u++) o[u] = 255 & o[u];
}
e("../utils").inherits(l, a), l.prototype.byteAt = function(o) {
return this.data[this.zero + o];
}, l.prototype.lastIndexOfSignature = function(o) {
for (var u = o.charCodeAt(0), m = o.charCodeAt(1), k = o.charCodeAt(2), _ = o.charCodeAt(3), w = this.length - 4; 0 <= w; --w) if (this.data[w] === u && this.data[w + 1] === m && this.data[w + 2] === k && this.data[w + 3] === _) return w - this.zero;
return -1;
}, l.prototype.readAndCheckSignature = function(o) {
var u = o.charCodeAt(0), m = o.charCodeAt(1), k = o.charCodeAt(2), _ = o.charCodeAt(3), w = this.readData(4);
return u === w[0] && m === w[1] && k === w[2] && _ === w[3];
}, l.prototype.readData = function(o) {
if (this.checkOffset(o), o === 0) return [];
var u = this.data.slice(this.zero + this.index, this.zero + this.index + o);
return this.index += o, u;
}, r.exports = l;
}, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, r, n) {
var a = e("../utils");
function l(o) {
this.data = o, this.length = o.length, this.index = 0, this.zero = 0;
}
l.prototype = { checkOffset: function(o) {
this.checkIndex(this.index + o);
}, checkIndex: function(o) {
if (this.length < this.zero + o || o < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + o + "). Corrupted zip ?");
}, setIndex: function(o) {
this.checkIndex(o), this.index = o;
}, skip: function(o) {
this.setIndex(this.index + o);
}, byteAt: function() {
}, readInt: function(o) {
var u, m = 0;
for (this.checkOffset(o), u = this.index + o - 1; u >= this.index; u--) m = (m << 8) + this.byteAt(u);
return this.index += o, m;
}, readString: function(o) {
return a.transformTo("string", this.readData(o));
}, readData: function() {
}, lastIndexOfSignature: function() {
}, readAndCheckSignature: function() {
}, readDate: function() {
var o = this.readInt(4);
return new Date(Date.UTC(1980 + (o >> 25 & 127), (o >> 21 & 15) - 1, o >> 16 & 31, o >> 11 & 31, o >> 5 & 63, (31 & o) << 1));
} }, r.exports = l;
}, { "../utils": 32 }], 19: [function(e, r, n) {
var a = e("./Uint8ArrayReader");
function l(o) {
a.call(this, o);
}
e("../utils").inherits(l, a), l.prototype.readData = function(o) {
this.checkOffset(o);
var u = this.data.slice(this.zero + this.index, this.zero + this.index + o);
return this.index += o, u;
}, r.exports = l;
}, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, r, n) {
var a = e("./DataReader");
function l(o) {
a.call(this, o);
}
e("../utils").inherits(l, a), l.prototype.byteAt = function(o) {
return this.data.charCodeAt(this.zero + o);
}, l.prototype.lastIndexOfSignature = function(o) {
return this.data.lastIndexOf(o) - this.zero;
}, l.prototype.readAndCheckSignature = function(o) {
return o === this.readData(4);
}, l.prototype.readData = function(o) {
this.checkOffset(o);
var u = this.data.slice(this.zero + this.index, this.zero + this.index + o);
return this.index += o, u;
}, r.exports = l;
}, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, r, n) {
var a = e("./ArrayReader");
function l(o) {
a.call(this, o);
}
e("../utils").inherits(l, a), l.prototype.readData = function(o) {
if (this.checkOffset(o), o === 0) return new Uint8Array(0);
var u = this.data.subarray(this.zero + this.index, this.zero + this.index + o);
return this.index += o, u;
}, r.exports = l;
}, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, r, n) {
var a = e("../utils"), l = e("../support"), o = e("./ArrayReader"), u = e("./StringReader"), m = e("./NodeBufferReader"), k = e("./Uint8ArrayReader");
r.exports = function(_) {
var w = a.getTypeOf(_);
return a.checkSupport(w), w !== "string" || l.uint8array ? w === "nodebuffer" ? new m(_) : l.uint8array ? new k(a.transformTo("uint8array", _)) : new o(a.transformTo("array", _)) : new u(_);
};
}, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, r, n) {
n.LOCAL_FILE_HEADER = "PK", n.CENTRAL_FILE_HEADER = "PK", n.CENTRAL_DIRECTORY_END = "PK", n.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", n.ZIP64_CENTRAL_DIRECTORY_END = "PK", n.DATA_DESCRIPTOR = "PK\x07\b";
}, {}], 24: [function(e, r, n) {
var a = e("./GenericWorker"), l = e("../utils");
function o(u) {
a.call(this, "ConvertWorker to " + u), this.destType = u;
}
l.inherits(o, a), o.prototype.processChunk = function(u) {
this.push({ data: l.transformTo(this.destType, u.data), meta: u.meta });
}, r.exports = o;
}, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, r, n) {
var a = e("./GenericWorker"), l = e("../crc32");
function o() {
a.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
}
e("../utils").inherits(o, a), o.prototype.processChunk = function(u) {
this.streamInfo.crc32 = l(u.data, this.streamInfo.crc32 || 0), this.push(u);
}, r.exports = o;
}, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, r, n) {
var a = e("../utils"), l = e("./GenericWorker");
function o(u) {
l.call(this, "DataLengthProbe for " + u), this.propName = u, this.withStreamInfo(u, 0);
}
a.inherits(o, l), o.prototype.processChunk = function(u) {
if (u) {
var m = this.streamInfo[this.propName] || 0;
this.streamInfo[this.propName] = m + u.data.length;
}
l.prototype.processChunk.call(this, u);
}, r.exports = o;
}, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, r, n) {
var a = e("../utils"), l = e("./GenericWorker");
function o(u) {
l.call(this, "DataWorker");
var m = this;
this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = !1, u.then(function(k) {
m.dataIsReady = !0, m.data = k, m.max = k && k.length || 0, m.type = a.getTypeOf(k), m.isPaused || m._tickAndRepeat();
}, function(k) {
m.error(k);
});
}
a.inherits(o, l), o.prototype.cleanUp = function() {
l.prototype.cleanUp.call(this), this.data = null;
}, o.prototype.resume = function() {
return !!l.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, a.delay(this._tickAndRepeat, [], this)), !0);
}, o.prototype._tickAndRepeat = function() {
this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (a.delay(this._tickAndRepeat, [], this), this._tickScheduled = !0));
}, o.prototype._tick = function() {
if (this.isPaused || this.isFinished) return !1;
var u = null, m = Math.min(this.max, this.index + 16384);
if (this.index >= this.max) return this.end();
switch (this.type) {
case "string":
u = this.data.substring(this.index, m);
break;
case "uint8array":
u = this.data.subarray(this.index, m);
break;
case "array":
case "nodebuffer":
u = this.data.slice(this.index, m);
}
return this.index = m, this.push({ data: u, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
}, r.exports = o;
}, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, r, n) {
function a(l) {
this.name = l || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = !0, this.isFinished = !1, this.isLocked = !1, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
}
a.prototype = { push: function(l) {
this.emit("data", l);
}, end: function() {
if (this.isFinished) return !1;
this.flush();
try {
this.emit("end"), this.cleanUp(), this.isFinished = !0;
} catch (l) {
this.emit("error", l);
}
return !0;
}, error: function(l) {
return !this.isFinished && (this.isPaused ? this.generatedError = l : (this.isFinished = !0, this.emit("error", l), this.previous && this.previous.error(l), this.cleanUp()), !0);
}, on: function(l, o) {
return this._listeners[l].push(o), this;
}, cleanUp: function() {
this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
}, emit: function(l, o) {
if (this._listeners[l]) for (var u = 0; u < this._listeners[l].length; u++) this._listeners[l][u].call(this, o);
}, pipe: function(l) {
return l.registerPrevious(this);
}, registerPrevious: function(l) {
if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
this.streamInfo = l.streamInfo, this.mergeStreamInfo(), this.previous = l;
var o = this;
return l.on("data", function(u) {
o.processChunk(u);
}), l.on("end", function() {
o.end();
}), l.on("error", function(u) {
o.error(u);
}), this;
}, pause: function() {
return !this.isPaused && !this.isFinished && (this.isPaused = !0, this.previous && this.previous.pause(), !0);
}, resume: function() {
if (!this.isPaused || this.isFinished) return !1;
var l = this.isPaused = !1;
return this.generatedError && (this.error(this.generatedError), l = !0), this.previous && this.previous.resume(), !l;
}, flush: function() {
}, processChunk: function(l) {
this.push(l);
}, withStreamInfo: function(l, o) {
return this.extraStreamInfo[l] = o, this.mergeStreamInfo(), this;
}, mergeStreamInfo: function() {
for (var l in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, l) && (this.streamInfo[l] = this.extraStreamInfo[l]);
}, lock: function() {
if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
this.isLocked = !0, this.previous && this.previous.lock();
}, toString: function() {
var l = "Worker " + this.name;
return this.previous ? this.previous + " -> " + l : l;
} }, r.exports = a;
}, {}], 29: [function(e, r, n) {
var a = e("../utils"), l = e("./ConvertWorker"), o = e("./GenericWorker"), u = e("../base64"), m = e("../support"), k = e("../external"), _ = null;
if (m.nodestream) try {
_ = e("../nodejs/NodejsStreamOutputAdapter");
} catch {
}
function w(v, h) {
return new k.Promise(function(g, f) {
var y = [], C = v._internalType, E = v._outputType, A = v._mimeType;
v.on("data", function(F, M) {
y.push(F), h && h(M);
}).on("error", function(F) {
y = [], f(F);
}).on("end", function() {
try {
var F = function(M, H, I) {
switch (M) {
case "blob":
return a.newBlob(a.transformTo("arraybuffer", H), I);
case "base64":
return u.encode(H);
default:
return a.transformTo(M, H);
}
}(E, function(M, H) {
var I, X = 0, Q = null, x = 0;
for (I = 0; I < H.length; I++) x += H[I].length;
switch (M) {
case "string":
return H.join("");
case "array":
return Array.prototype.concat.apply([], H);
case "uint8array":
for (Q = new Uint8Array(x), I = 0; I < H.length; I++) Q.set(H[I], X), X += H[I].length;
return Q;
case "nodebuffer":
return Buffer.concat(H);
default:
throw new Error("concat : unsupported type '" + M + "'");
}
}(C, y), A);
g(F);
} catch (M) {
f(M);
}
y = [];
}).resume();
});
}
function d(v, h, g) {
var f = h;
switch (h) {
case "blob":
case "arraybuffer":
f = "uint8array";
break;
case "base64":
f = "string";
}
try {
this._internalType = f, this._outputType = h, this._mimeType = g, a.checkSupport(f), this._worker = v.pipe(new l(f)), v.lock();
} catch (y) {
this._worker = new o("error"), this._worker.error(y);
}
}
d.prototype = { accumulate: function(v) {
return w(this, v);
}, on: function(v, h) {
var g = this;
return v === "data" ? this._worker.on(v, function(f) {
h.call(g, f.data, f.meta);
}) : this._worker.on(v, function() {
a.delay(h, arguments, g);
}), this;
}, resume: function() {
return a.delay(this._worker.resume, [], this._worker), this;
}, pause: function() {
return this._worker.pause(), this;
}, toNodejsStream: function(v) {
if (a.checkSupport("nodestream"), this._outputType !== "nodebuffer") throw new Error(this._outputType + " is not supported by this method");
return new _(this, { objectMode: this._outputType !== "nodebuffer" }, v);
} }, r.exports = d;
}, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, r, n) {
if (n.base64 = !0, n.array = !0, n.string = !0, n.arraybuffer = typeof ArrayBuffer < "u" && typeof Uint8Array < "u", n.nodebuffer = typeof Buffer < "u", n.uint8array = typeof Uint8Array < "u", typeof ArrayBuffer > "u") n.blob = !1;
else {
var a = new ArrayBuffer(0);
try {
n.blob = new Blob([a], { type: "application/zip" }).size === 0;
} catch {
try {
var l = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
l.append(a), n.blob = l.getBlob("application/zip").size === 0;
} catch {
n.blob = !1;
}
}
}
try {
n.nodestream = !!e("readable-stream").Readable;
} catch {
n.nodestream = !1;
}
}, { "readable-stream": 16 }], 31: [function(e, r, n) {
for (var a = e("./utils"), l = e("./support"), o = e("./nodejsUtils"), u = e("./stream/GenericWorker"), m = new Array(256), k = 0; k < 256; k++) m[k] = 252 <= k ? 6 : 248 <= k ? 5 : 240 <= k ? 4 : 224 <= k ? 3 : 192 <= k ? 2 : 1;
m[254] = m[254] = 1;
function _() {
u.call(this, "utf-8 decode"), this.leftOver = null;
}
function w() {
u.call(this, "utf-8 encode");
}
n.utf8encode = function(d) {
return l.nodebuffer ? o.newBufferFrom(d, "utf-8") : function(v) {
var h, g, f, y, C, E = v.length, A = 0;
for (y = 0; y < E; y++) (64512 & (g = v.charCodeAt(y))) == 55296 && y + 1 < E && (64512 & (f = v.charCodeAt(y + 1))) == 56320 && (g = 65536 + (g - 55296 << 10) + (f - 56320), y++), A += g < 128 ? 1 : g < 2048 ? 2 : g < 65536 ? 3 : 4;
for (h = l.uint8array ? new Uint8Array(A) : new Array(A), y = C = 0; C < A; y++) (64512 & (g = v.charCodeAt(y))) == 55296 && y + 1 < E && (64512 & (f = v.charCodeAt(y + 1))) == 56320 && (g = 65536 + (g - 55296 << 10) + (f - 56320), y++), g < 128 ? h[C++] = g : (g < 2048 ? h[C++] = 192 | g >>> 6 : (g < 65536 ? h[C++] = 224 | g >>> 12 : (h[C++] = 240 | g >>> 18, h[C++] = 128 | g >>> 12 & 63), h[C++] = 128 | g >>> 6 & 63), h[C++] = 128 | 63 & g);
return h;
}(d);
}, n.utf8decode = function(d) {
return l.nodebuffer ? a.transformTo("nodebuffer", d).toString("utf-8") : function(v) {
var h, g, f, y, C = v.length, E = new Array(2 * C);
for (h = g = 0; h < C; ) if ((f = v[h++]) < 128) E[g++] = f;
else if (4 < (y = m[f])) E[g++] = 65533, h += y - 1;
else {
for (f &= y === 2 ? 31 : y === 3 ? 15 : 7; 1 < y && h < C; ) f = f << 6 | 63 & v[h++], y--;
1 < y ? E[g++] = 65533 : f < 65536 ? E[g++] = f : (f -= 65536, E[g++] = 55296 | f >> 10 & 1023, E[g++] = 56320 | 1023 & f);
}
return E.length !== g && (E.subarray ? E = E.subarray(0, g) : E.length = g), a.applyFromCharCode(E);
}(d = a.transformTo(l.uint8array ? "uint8array" : "array", d));
}, a.inherits(_, u), _.prototype.processChunk = function(d) {
var v = a.transformTo(l.uint8array ? "uint8array" : "array", d.data);
if (this.leftOver && this.leftOver.length) {
if (l.uint8array) {
var h = v;
(v = new Uint8Array(h.length + this.leftOver.length)).set(this.leftOver, 0), v.set(h, this.leftOver.length);
} else v = this.leftOver.concat(v);
this.leftOver = null;
}
var g = function(y, C) {
var E;
for ((C = C || y.length) > y.length && (C = y.length), E = C - 1; 0 <= E && (192 & y[E]) == 128; ) E--;
return E < 0 || E === 0 ? C : E + m[y[E]] > C ? E : C;
}(v), f = v;
g !== v.length && (l.uint8array ? (f = v.subarray(0, g), this.leftOver = v.subarray(g, v.length)) : (f = v.slice(0, g), this.leftOver = v.slice(g, v.length))), this.push({ data: n.utf8decode(f), meta: d.meta });
}, _.prototype.flush = function() {
this.leftOver && this.leftOver.length && (this.push({ data: n.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
}, n.Utf8DecodeWorker = _, a.inherits(w, u), w.prototype.processChunk = function(d) {
this.push({ data: n.utf8encode(d.data), meta: d.meta });
}, n.Utf8EncodeWorker = w;
}, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, r, n) {
var a = e("./support"), l = e("./base64"), o = e("./nodejsUtils"), u = e("./external");
function m(h) {
return h;
}
function k(h, g) {
for (var f = 0; f < h.length; ++f) g[f] = 255 & h.charCodeAt(f);
return g;
}
e("setimmediate"), n.newBlob = function(h, g) {
n.checkSupport("blob");
try {
return new Blob([h], { type: g });
} catch {
try {
var f = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
return f.append(h), f.getBlob(g);
} catch {
throw new Error("Bug : can't construct the Blob.");
}
}
};
var _ = { stringifyByChunk: function(h, g, f) {
var y = [], C = 0, E = h.length;
if (E <= f) return String.fromCharCode.apply(null, h);
for (; C < E; ) g === "array" || g === "nodebuffer" ? y.push(String.fromCharCode.apply(null, h.slice(C, Math.min(C + f, E)))) : y.push(String.fromCharCode.apply(null, h.subarray(C, Math.min(C + f, E)))), C += f;
return y.join("");
}, stringifyByChar: function(h) {
for (var g = "", f = 0; f < h.length; f++) g += String.fromCharCode(h[f]);
return g;
}, applyCanBeUsed: { uint8array: function() {
try {
return a.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
} catch {
return !1;
}
}(), nodebuffer: function() {
try {
return a.nodebuffer && String.fromCharCode.apply(null, o.allocBuffer(1)).length === 1;
} catch {
return !1;
}
}() } };
function w(h) {
var g = 65536, f = n.getTypeOf(h), y = !0;
if (f === "uint8array" ? y = _.applyCanBeUsed.uint8array : f === "nodebuffer" && (y = _.applyCanBeUsed.nodebuffer), y) for (; 1 < g; ) try {
return _.stringifyByChunk(h, f, g);
} catch {
g = Math.floor(g / 2);
}
return _.stringifyByChar(h);
}
function d(h, g) {
for (var f = 0; f < h.length; f++) g[f] = h[f];
return g;
}
n.applyFromCharCode = w;
var v = {};
v.string = { string: m, array: function(h) {
return k(h, new Array(h.length));
}, arraybuffer: function(h) {
return v.string.uint8array(h).buffer;
}, uint8array: function(h) {
return k(h, new Uint8Array(h.length));
}, nodebuffer: function(h) {
return k(h, o.allocBuffer(h.length));
} }, v.array = { string: w, array: m, arraybuffer: function(h) {
return new Uint8Array(h).buffer;
}, uint8array: function(h) {
return new Uint8Array(h);
}, nodebuffer: function(h) {
return o.newBufferFrom(h);
} }, v.arraybuffer = { string: function(h) {
return w(new Uint8Array(h));
}, array: function(h) {
return d(new Uint8Array(h), new Array(h.byteLength));
}, arraybuffer: m, uint8array: function(h) {
return new Uint8Array(h);
}, nodebuffer: function(h) {
return o.newBufferFrom(new Uint8Array(h));
} }, v.uint8array = { string: w, array: function(h) {
return d(h, new Array(h.length));
}, arraybuffer: function(h) {
return h.buffer;
}, uint8array: m, nodebuffer: function(h) {
return o.newBufferFrom(h);
} }, v.nodebuffer = { string: w, array: function(h) {
return d(h, new Array(h.length));
}, arraybuffer: function(h) {
return v.nodebuffer.uint8array(h).buffer;
}, uint8array: function(h) {
return d(h, new Uint8Array(h.length));
}, nodebuffer: m }, n.transformTo = function(h, g) {
if (g = g || "", !h) return g;
n.checkSupport(h);
var f = n.getTypeOf(g);
return v[f][h](g);
}, n.resolve = function(h) {
for (var g = h.split("/"), f = [], y = 0; y < g.length; y++) {
var C = g[y];
C === "." || C === "" && y !== 0 && y !== g.length - 1 || (C === ".." ? f.pop() : f.push(C));
}
return f.join("/");
}, n.getTypeOf = function(h) {
return typeof h == "string" ? "string" : Object.prototype.toString.call(h) === "[object Array]" ? "array" : a.nodebuffer && o.isBuffer(h) ? "nodebuffer" : a.uint8array && h instanceof Uint8Array ? "uint8array" : a.arraybuffer && h instanceof ArrayBuffer ? "arraybuffer" : void 0;
}, n.checkSupport = function(h) {
if (!a[h.toLowerCase()]) throw new Error(h + " is not supported by this platform");
}, n.MAX_VALUE_16BITS = 65535, n.MAX_VALUE_32BITS = -1, n.pretty = function(h) {
var g, f, y = "";
for (f = 0; f < (h || "").length; f++) y += "\\x" + ((g = h.charCodeAt(f)) < 16 ? "0" : "") + g.toString(16).toUpperCase();
return y;
}, n.delay = function(h, g, f) {
setImmediate(function() {
h.apply(f || null, g || []);
});
}, n.inherits = function(h, g) {
function f() {
}
f.prototype = g.prototype, h.prototype = new f();
}, n.extend = function() {
var h, g, f = {};
for (h = 0; h < arguments.length; h++) for (g in arguments[h]) Object.prototype.hasOwnProperty.call(arguments[h], g) && f[g] === void 0 && (f[g] = arguments[h][g]);
return f;
}, n.prepareContent = function(h, g, f, y, C) {
return u.Promise.resolve(g).then(function(E) {
return a.blob && (E instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(E)) !== -1) && typeof FileReader < "u" ? new u.Promise(function(A, F) {
var M = new FileReader();
M.onload = function(H) {
A(H.target.result);
}, M.onerror = function(H) {
F(H.target.error);
}, M.readAsArrayBuffer(E);
}) : E;
}).then(function(E) {
var A = n.getTypeOf(E);
return A ? (A === "arraybuffer" ? E = n.transformTo("uint8array", E) : A === "string" && (C ? E = l.decode(E) : f && y !== !0 && (E = function(F) {
return k(F, a.uint8array ? new Uint8Array(F.length) : new Array(F.length));
}(E))), E) : u.Promise.reject(new Error("Can't read the data of '" + h + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
});
};
}, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, r, n) {
var a = e("./reader/readerFor"), l = e("./utils"), o = e("./signature"), u = e("./zipEntry"), m = e("./support");
function k(_) {
this.files = [], this.loadOptions = _;
}
k.prototype = { checkSignature: function(_) {
if (!this.reader.readAndCheckSignature(_)) {
this.reader.index -= 4;
var w = this.reader.readString(4);
throw new Error("Corrupted zip or bug: unexpected signature (" + l.pretty(w) + ", expected " + l.pretty(_) + ")");
}
}, isSignature: function(_, w) {
var d = this.reader.index;
this.reader.setIndex(_);
var v = this.reader.readString(4) === w;
return this.reader.setIndex(d), v;
}, readBlockEndOfCentral: function() {
this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2);
var _ = this.reader.readData(this.zipCommentLength), w = m.uint8array ? "uint8array" : "array", d = l.transformTo(w, _);
this.zipComment = this.loadOptions.decodeFileName(d);
}, readBlockZip64EndOfCentral: function() {
this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {};
for (var _, w, d, v = this.zip64EndOfCentralSize - 44; 0 < v; ) _ = this.reader.readInt(2), w = this.reader.readInt(4), d = this.reader.readData(w), this.zip64ExtensibleData[_] = { id: _, length: w, value: d };
}, readBlockZip64EndOfCentralLocator: function() {
if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported");
}, readLocalFiles: function() {
var _, w;
for (_ = 0; _ < this.files.length; _++) w = this.files[_], this.reader.setIndex(w.localHeaderOffset), this.checkSignature(o.LOCAL_FILE_HEADER), w.readLocalPart(this.reader), w.handleUTF8(), w.processAttributes();
}, readCentralDir: function() {
var _;
for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER); ) (_ = new u({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(_);
if (this.centralDirRecords !== this.files.length && this.centralDirRecords !== 0 && this.files.length === 0) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
}, readEndOfCentral: function() {
var _ = this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);
if (_ < 0) throw this.isSignature(0, o.LOCAL_FILE_HEADER) ? new Error("Corrupted zip: can't find end of central directory") : new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");
this.reader.setIndex(_);
var w = _;
if (this.checkSignature(o.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === l.MAX_VALUE_16BITS || this.diskWithCentralDirStart === l.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === l.MAX_VALUE_16BITS || this.centralDirRecords === l.MAX_VALUE_16BITS || this.centralDirSize === l.MAX_VALUE_32BITS || this.centralDirOffset === l.MAX_VALUE_32BITS) {
if (this.zip64 = !0, (_ = this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
if (this.reader.setIndex(_), this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, o.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
}
var d = this.centralDirOffset + this.centralDirSize;
this.zip64 && (d += 20, d += 12 + this.zip64EndOfCentralSize);
var v = w - d;
if (0 < v) this.isSignature(w, o.CENTRAL_FILE_HEADER) || (this.reader.zero = v);
else if (v < 0) throw new Error("Corrupted zip: missing " + Math.abs(v) + " bytes.");
}, prepareReader: function(_) {
this.reader = a(_);
}, load: function(_) {
this.prepareReader(_), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
} }, r.exports = k;
}, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, r, n) {
var a = e("./reader/readerFor"), l = e("./utils"), o = e("./compressedObject"), u = e("./crc32"), m = e("./utf8"), k = e("./compressions"), _ = e("./support");
function w(d, v) {
this.options = d, this.loadOptions = v;
}
w.prototype = { isEncrypted: function() {
return (1 & this.bitFlag) == 1;
}, useUTF8: function() {
return (2048 & this.bitFlag) == 2048;
}, readLocalPart: function(d) {
var v, h;
if (d.skip(22), this.fileNameLength = d.readInt(2), h = d.readInt(2), this.fileName = d.readData(this.fileNameLength), d.skip(h), this.compressedSize === -1 || this.uncompressedSize === -1) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
if ((v = function(g) {
for (var f in k) if (Object.prototype.hasOwnProperty.call(k, f) && k[f].magic === g) return k[f];
return null;
}(this.compressionMethod)) === null) throw new Error("Corrupted zip : compression " + l.pretty(this.compressionMethod) + " unknown (inner file : " + l.transformTo("string", this.fileName) + ")");
this.decompressed = new o(this.compressedSize, this.uncompressedSize, this.crc32, v, d.readData(this.compressedSize));
}, readCentralPart: function(d) {
this.versionMadeBy = d.readInt(2), d.skip(2), this.bitFlag = d.readInt(2), this.compressionMethod = d.readString(2), this.date = d.readDate(), this.crc32 = d.readInt(4), this.compressedSize = d.readInt(4), this.uncompressedSize = d.readInt(4);
var v = d.readInt(2);
if (this.extraFieldsLength = d.readInt(2), this.fileCommentLength = d.readInt(2), this.diskNumberStart = d.readInt(2), this.internalFileAttributes = d.readInt(2), this.externalFileAttributes = d.readInt(4), this.localHeaderOffset = d.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
d.skip(v), this.readExtraFields(d), this.parseZIP64ExtraField(d), this.fileComment = d.readData(this.fileCommentLength);
}, processAttributes: function() {
this.unixPermissions = null, this.dosPermissions = null;
var d = this.versionMadeBy >> 8;
this.dir = !!(16 & this.externalFileAttributes), d == 0 && (this.dosPermissions = 63 & this.externalFileAttributes), d == 3 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || this.fileNameStr.slice(-1) !== "/" || (this.dir = !0);
}, parseZIP64ExtraField: function() {
if (this.extraFields[1]) {
var d = a(this.extraFields[1].value);
this.uncompressedSize === l.MAX_VALUE_32BITS && (this.uncompressedSize = d.readInt(8)), this.compressedSize === l.MAX_VALUE_32BITS && (this.compressedSize = d.readInt(8)), this.localHeaderOffset === l.MAX_VALUE_32BITS && (this.localHeaderOffset = d.readInt(8)), this.diskNumberStart === l.MAX_VALUE_32BITS && (this.diskNumberStart = d.readInt(4));
}
}, readExtraFields: function(d) {
var v, h, g, f = d.index + this.extraFieldsLength;
for (this.extraFields || (this.extraFields = {}); d.index + 4 < f; ) v = d.readInt(2), h = d.readInt(2), g = d.readData(h), this.extraFields[v] = { id: v, length: h, value: g };
d.setIndex(f);
}, handleUTF8: function() {
var d = _.uint8array ? "uint8array" : "array";
if (this.useUTF8()) this.fileNameStr = m.utf8decode(this.fileName), this.fileCommentStr = m.utf8decode(this.fileComment);
else {
var v = this.findExtraFieldUnicodePath();
if (v !== null) this.fileNameStr = v;
else {
var h = l.transformTo(d, this.fileName);
this.fileNameStr = this.loadOptions.decodeFileName(h);
}
var g = this.findExtraFieldUnicodeComment();
if (g !== null) this.fileCommentStr = g;
else {
var f = l.transformTo(d, this.fileComment);
this.fileCommentStr = this.loadOptions.decodeFileName(f);
}
}
}, findExtraFieldUnicodePath: function() {
var d = this.extraFields[28789];
if (d) {
var v = a(d.value);
return v.readInt(1) !== 1 || u(this.fileName) !== v.readInt(4) ? null : m.utf8decode(v.readData(d.length - 5));
}
return null;
}, findExtraFieldUnicodeComment: function() {
var d = this.extraFields[25461];
if (d) {
var v = a(d.value);
return v.readInt(1) !== 1 || u(this.fileComment) !== v.readInt(4) ? null : m.utf8decode(v.readData(d.length - 5));
}
return null;
} }, r.exports = w;
}, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, r, n) {
function a(v, h, g) {
this.name = v, this.dir = g.dir, this.date = g.date, this.comment = g.comment, this.unixPermissions = g.unixPermissions, this.dosPermissions = g.dosPermissions, this._data = h, this._dataBinary = g.binary, this.options = { compression: g.compression, compressionOptions: g.compressionOptions };
}
var l = e("./stream/StreamHelper"), o = e("./stream/DataWorker"), u = e("./utf8"), m = e("./compressedObject"), k = e("./stream/GenericWorker");
a.prototype = { internalStream: function(v) {
var h = null, g = "string";
try {
if (!v) throw new Error("No output type specified.");
var f = (g = v.toLowerCase()) === "string" || g === "text";
g !== "binarystring" && g !== "text" || (g = "string"), h = this._decompressWorker();
var y = !this._dataBinary;
y && !f && (h = h.pipe(new u.Utf8EncodeWorker())), !y && f && (h = h.pipe(new u.Utf8DecodeWorker()));
} catch (C) {
(h = new k("error")).error(C);
}
return new l(h, g, "");
}, async: function(v, h) {
return this.internalStream(v).accumulate(h);
}, nodeStream: function(v, h) {
return this.internalStream(v || "nodebuffer").toNodejsStream(h);
}, _compressWorker: function(v, h) {
if (this._data instanceof m && this._data.compression.magic === v.magic) return this._data.getCompressedWorker();
var g = this._decompressWorker();
return this._dataBinary || (g = g.pipe(new u.Utf8EncodeWorker())), m.createWorkerFrom(g, v, h);
}, _decompressWorker: function() {
return this._data instanceof m ? this._data.getContentWorker() : this._data instanceof k ? this._data : new o(this._data);
} };
for (var _ = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], w = function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, d = 0; d < _.length; d++) a.prototype[_[d]] = w;
r.exports = a;
}, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, r, n) {
(function(a) {
var l, o, u = a.MutationObserver || a.WebKitMutationObserver;
if (u) {
var m = 0, k = new u(v), _ = a.document.createTextNode("");
k.observe(_, { characterData: !0 }), l = function() {
_.data = m = ++m % 2;
};
} else if (a.setImmediate || a.MessageChannel === void 0) l = "document" in a && "onreadystatechange" in a.document.createElement("script") ? function() {
var h = a.document.createElement("script");
h.onreadystatechange = function() {
v(), h.onreadystatechange = null, h.parentNode.removeChild(h), h = null;
}, a.document.documentElement.appendChild(h);
} : function() {
setTimeout(v, 0);
};
else {
var w = new a.MessageChannel();
w.port1.onmessage = v, l = function() {
w.port2.postMessage(0);
};
}
var d = [];
function v() {
var h, g;
o = !0;
for (var f = d.length; f; ) {
for (g = d, d = [], h = -1; ++h < f; ) g[h]();
f = d.length;
}
o = !1;
}
r.exports = function(h) {
d.push(h) !== 1 || o || l();
};
}).call(this, typeof je < "u" ? je : typeof self < "u" ? self : typeof window < "u" ? window : {});
}, {}], 37: [function(e, r, n) {
var a = e("immediate");
function l() {
}
var o = {}, u = ["REJECTED"], m = ["FULFILLED"], k = ["PENDING"];
function _(f) {
if (typeof f != "function") throw new TypeError("resolver must be a function");
this.state = k, this.queue = [], this.outcome = void 0, f !== l && h(this, f);
}
function w(f, y, C) {
this.promise = f, typeof y == "function" && (this.onFulfilled = y, this.callFulfilled = this.otherCallFulfilled), typeof C == "function" && (this.onRejected = C, this.callRejected = this.otherCallRejected);
}
function d(f, y, C) {
a(function() {
var E;
try {
E = y(C);
} catch (A) {
return o.reject(f, A);
}
E === f ? o.reject(f, new TypeError("Cannot resolve promise with itself")) : o.resolve(f, E);
});
}
function v(f) {
var y = f && f.then;
if (f && (typeof f == "object" || typeof f == "function") && typeof y == "function") return function() {
y.apply(f, arguments);
};
}
function h(f, y) {
var C = !1;
function E(M) {
C || (C = !0, o.reject(f, M));
}
function A(M) {
C || (C = !0, o.resolve(f, M));
}
var F = g(function() {
y(A, E);
});
F.status === "error" && E(F.value);
}
function g(f, y) {
var C = {};
try {
C.value = f(y), C.status = "success";
} catch (E) {
C.status = "error", C.value = E;
}
return C;
}
(r.exports = _).prototype.finally = function(f) {
if (typeof f != "function") return this;
var y = this.constructor;
return this.then(function(C) {
return y.resolve(f()).then(function() {
return C;
});
}, function(C) {
return y.resolve(f()).then(function() {
throw C;
});
});
}, _.prototype.catch = function(f) {
return this.then(null, f);
}, _.prototype.then = function(f, y) {
if (typeof f != "function" && this.state === m || typeof y != "function" && this.state === u) return this;
var C = new this.constructor(l);
return this.state !== k ? d(C, this.state === m ? f : y, this.outcome) : this.queue.push(new w(C, f, y)), C;
}, w.prototype.callFulfilled = function(f) {
o.resolve(this.promise, f);
}, w.prototype.otherCallFulfilled = function(f) {
d(this.promise, this.onFulfilled, f);
}, w.prototype.callRejected = function(f) {
o.reject(this.promise, f);
}, w.prototype.otherCallRejected = function(f) {
d(this.promise, this.onRejected, f);
}, o.resolve = function(f, y) {
var C = g(v, y);
if (C.status === "error") return o.reject(f, C.value);
var E = C.value;
if (E) h(f, E);
else {
f.state = m, f.outcome = y;
for (var A = -1, F = f.queue.length; ++A < F; ) f.queue[A].callFulfilled(y);
}
return f;
}, o.reject = function(f, y) {
f.state = u, f.outcome = y;
for (var C = -1, E = f.queue.length; ++C < E; ) f.queue[C].callRejected(y);
return f;
}, _.resolve = function(f) {
return f instanceof this ? f : o.resolve(new this(l), f);
}, _.reject = function(f) {
var y = new this(l);
return o.reject(y, f);
}, _.all = function(f) {
var y = this;
if (Object.prototype.toString.call(f) !== "[object Array]") return this.reject(new TypeError("must be an array"));
var C = f.length, E = !1;
if (!C) return this.resolve([]);
for (var A = new Array(C), F = 0, M = -1, H = new this(l); ++M < C; ) I(f[M], M);
return H;
function I(X, Q) {
y.resolve(X).then(function(x) {
A[Q] = x, ++F !== C || E || (E = !0, o.resolve(H, A));
}, function(x) {
E || (E = !0, o.reject(H, x));
});
}
}, _.race = function(f) {
var y = this;
if (Object.prototype.toString.call(f) !== "[object Array]") return this.reject(new TypeError("must be an array"));
var C = f.length, E = !1;
if (!C) return this.resolve([]);
for (var A = -1, F = new this(l); ++A < C; ) M = f[A], y.resolve(M).then(function(H) {
E || (E = !0, o.resolve(F, H));
}, function(H) {
E || (E = !0, o.reject(F, H));
});
var M;
return F;
};
}, { immediate: 36 }], 38: [function(e, r, n) {
var a = {};
(0, e("./lib/utils/common").assign)(a, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), r.exports = a;
}, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, r, n) {
var a = e("./zlib/deflate"), l = e("./utils/common"), o = e("./utils/strings"), u = e("./zlib/messages"), m = e("./zlib/zstream"), k = Object.prototype.toString, _ = 0, w = -1, d = 0, v = 8;
function h(f) {
if (!(this instanceof h)) return new h(f);
this.options = l.assign({ level: w, method: v, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: d, to: "" }, f || {});
var y = this.options;
y.raw && 0 < y.windowBits ? y.windowBits = -y.windowBits : y.gzip && 0 < y.windowBits && y.windowBits < 16 && (y.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new m(), this.strm.avail_out = 0;
var C = a.deflateInit2(this.strm, y.level, y.method, y.windowBits, y.memLevel, y.strategy);
if (C !== _) throw new Error(u[C]);
if (y.header && a.deflateSetHeader(this.strm, y.header), y.dictionary) {
var E;
if (E = typeof y.dictionary == "string" ? o.string2buf(y.dictionary) : k.call(y.dictionary) === "[object ArrayBuffer]" ? new Uint8Array(y.dictionary) : y.dictionary, (C = a.deflateSetDictionary(this.strm, E)) !== _) throw new Error(u[C]);
this._dict_set = !0;
}
}
function g(f, y) {
var C = new h(y);
if (C.push(f, !0), C.err) throw C.msg || u[C.err];
return C.result;
}
h.prototype.push = function(f, y) {
var C, E, A = this.strm, F = this.options.chunkSize;
if (this.ended) return !1;
E = y === ~~y ? y : y === !0 ? 4 : 0, typeof f == "string" ? A.input = o.string2buf(f) : k.call(f) === "[object ArrayBuffer]" ? A.input = new Uint8Array(f) : A.input = f, A.next_in = 0, A.avail_in = A.input.length;
do {
if (A.avail_out === 0 && (A.output = new l.Buf8(F), A.next_out = 0, A.avail_out = F), (C = a.deflate(A, E)) !== 1 && C !== _) return this.onEnd(C), !(this.ended = !0);
A.avail_out !== 0 && (A.avail_in !== 0 || E !== 4 && E !== 2) || (this.options.to === "string" ? this.onData(o.buf2binstring(l.shrinkBuf(A.output, A.next_out))) : this.onData(l.shrinkBuf(A.output, A.next_out)));
} while ((0 < A.avail_in || A.avail_out === 0) && C !== 1);
return E === 4 ? (C = a.deflateEnd(this.strm), this.onEnd(C), this.ended = !0, C === _) : E !== 2 || (this.onEnd(_), !(A.avail_out = 0));
}, h.prototype.onData = function(f) {
this.chunks.push(f);
}, h.prototype.onEnd = function(f) {
f === _ && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = l.flattenChunks(this.chunks)), this.chunks = [], this.err = f, this.msg = this.strm.msg;
}, n.Deflate = h, n.deflate = g, n.deflateRaw = function(f, y) {
return (y = y || {}).raw = !0, g(f, y);
}, n.gzip = function(f, y) {
return (y = y || {}).gzip = !0, g(f, y);
};
}, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, r, n) {
var a = e("./zlib/inflate"), l = e("./utils/common"), o = e("./utils/strings"), u = e("./zlib/constants"), m = e("./zlib/messages"), k = e("./zlib/zstream"), _ = e("./zlib/gzheader"), w = Object.prototype.toString;
function d(h) {
if (!(this instanceof d)) return new d(h);
this.options = l.assign({ chunkSize: 16384, windowBits: 0, to: "" }, h || {});
var g = this.options;
g.raw && 0 <= g.windowBits && g.windowBits < 16 && (g.windowBits = -g.windowBits, g.windowBits === 0 && (g.windowBits = -15)), !(0 <= g.windowBits && g.windowBits < 16) || h && h.windowBits || (g.windowBits += 32), 15 < g.windowBits && g.windowBits < 48 && !(15 & g.windowBits) && (g.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new k(), this.strm.avail_out = 0;
var f = a.inflateInit2(this.strm, g.windowBits);
if (f !== u.Z_OK) throw new Error(m[f]);
this.header = new _(), a.inflateGetHeader(this.strm, this.header);
}
function v(h, g) {
var f = new d(g);
if (f.push(h, !0), f.err) throw f.msg || m[f.err];
return f.result;
}
d.prototype.push = function(h, g) {
var f, y, C, E, A, F, M = this.strm, H = this.options.chunkSize, I = this.options.dictionary, X = !1;
if (this.ended) return !1;
y = g === ~~g ? g : g === !0 ? u.Z_FINISH : u.Z_NO_FLUSH, typeof h == "string" ? M.input = o.binstring2buf(h) : w.call(h) === "[object ArrayBuffer]" ? M.input = new Uint8Array(h) : M.input = h, M.next_in = 0, M.avail_in = M.input.length;
do {
if (M.avail_out === 0 && (M.output = new l.Buf8(H), M.next_out = 0, M.avail_out = H), (f = a.inflate(M, u.Z_NO_FLUSH)) === u.Z_NEED_DICT && I && (F = typeof I == "string" ? o.string2buf(I) : w.call(I) === "[object ArrayBuffer]" ? new Uint8Array(I) : I, f = a.inflateSetDictionary(this.strm, F)), f === u.Z_BUF_ERROR && X === !0 && (f = u.Z_OK, X = !1), f !== u.Z_STREAM_END && f !== u.Z_OK) return this.onEnd(f), !(this.ended = !0);
M.next_out && (M.avail_out !== 0 && f !== u.Z_STREAM_END && (M.avail_in !== 0 || y !== u.Z_FINISH && y !== u.Z_SYNC_FLUSH) || (this.options.to === "string" ? (C = o.utf8border(M.output, M.next_out), E = M.next_out - C, A = o.buf2string(M.output, C), M.next_out = E, M.avail_out = H - E, E && l.arraySet(M.output, M.output, C, E, 0), this.onData(A)) : this.onData(l.shrinkBuf(M.output, M.next_out)))), M.avail_in === 0 && M.avail_out === 0 && (X = !0);
} while ((0 < M.avail_in || M.avail_out === 0) && f !== u.Z_STREAM_END);
return f === u.Z_STREAM_END && (y = u.Z_FINISH), y === u.Z_FINISH ? (f = a.inflateEnd(this.strm), this.onEnd(f), this.ended = !0, f === u.Z_OK) : y !== u.Z_SYNC_FLUSH || (this.onEnd(u.Z_OK), !(M.avail_out = 0));
}, d.prototype.onData = function(h) {
this.chunks.push(h);
}, d.prototype.onEnd = function(h) {
h === u.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = l.flattenChunks(this.chunks)), this.chunks = [], this.err = h, this.msg = this.strm.msg;
}, n.Inflate = d, n.inflate = v, n.inflateRaw = function(h, g) {
return (g = g || {}).raw = !0, v(h, g);
}, n.ungzip = v;
}, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, r, n) {
var a = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
n.assign = function(u) {
for (var m = Array.prototype.slice.call(arguments, 1); m.length; ) {
var k = m.shift();
if (k) {
if (typeof k != "object") throw new TypeError(k + "must be non-object");
for (var _ in k) k.hasOwnProperty(_) && (u[_] = k[_]);
}
}
return u;
}, n.shrinkBuf = function(u, m) {
return u.length === m ? u : u.subarray ? u.subarray(0, m) : (u.length = m, u);
};
var l = { arraySet: function(u, m, k, _, w) {
if (m.subarray && u.subarray) u.set(m.subarray(k, k + _), w);
else for (var d = 0; d < _; d++) u[w + d] = m[k + d];
}, flattenChunks: function(u) {
var m, k, _, w, d, v;
for (m = _ = 0, k = u.length; m < k; m++) _ += u[m].length;
for (v = new Uint8Array(_), m = w = 0, k = u.length; m < k; m++) d = u[m], v.set(d, w), w += d.length;
return v;
} }, o = { arraySet: function(u, m, k, _, w) {
for (var d = 0; d < _; d++) u[w + d] = m[k + d];
}, flattenChunks: function(u) {
return [].concat.apply([], u);
} };
n.setTyped = function(u) {
u ? (n.Buf8 = Uint8Array, n.Buf16 = Uint16Array, n.Buf32 = Int32Array, n.assign(n, l)) : (n.Buf8 = Array, n.Buf16 = Array, n.Buf32 = Array, n.assign(n, o));
}, n.setTyped(a);
}, {}], 42: [function(e, r, n) {
var a = e("./common"), l = !0, o = !0;
try {
String.fromCharCode.apply(null, [0]);
} catch {
l = !1;
}
try {
String.fromCharCode.apply(null, new Uint8Array(1));
} catch {
o = !1;
}
for (var u = new a.Buf8(256), m = 0; m < 256; m++) u[m] = 252 <= m ? 6 : 248 <= m ? 5 : 240 <= m ? 4 : 224 <= m ? 3 : 192 <= m ? 2 : 1;
function k(_, w) {
if (w < 65537 && (_.subarray && o || !_.subarray && l)) return String.fromCharCode.apply(null, a.shrinkBuf(_, w));
for (var d = "", v = 0; v < w; v++) d += String.fromCharCode(_[v]);
return d;
}
u[254] = u[254] = 1, n.string2buf = function(_) {
var w, d, v, h, g, f = _.length, y = 0;
for (h = 0; h < f; h++) (64512 & (d = _.charCodeAt(h))) == 55296 && h + 1 < f && (64512 & (v = _.charCodeAt(h + 1))) == 56320 && (d = 65536 + (d - 55296 << 10) + (v - 56320), h++), y += d < 128 ? 1 : d < 2048 ? 2 : d < 65536 ? 3 : 4;
for (w = new a.Buf8(y), h = g = 0; g < y; h++) (64512 & (d = _.charCodeAt(h))) == 55296 && h + 1 < f && (64512 & (v = _.charCodeAt(h + 1))) == 56320 && (d = 65536 + (d - 55296 << 10) + (v - 56320), h++), d < 128 ? w[g++] = d : (d < 2048 ? w[g++] = 192 | d >>> 6 : (d < 65536 ? w[g++] = 224 | d >>> 12 : (w[g++] = 240 | d >>> 18, w[g++] = 128 | d >>> 12 & 63), w[g++] = 128 | d >>> 6 & 63), w[g++] = 128 | 63 & d);
return w;
}, n.buf2binstring = function(_) {
return k(_, _.length);
}, n.binstring2buf = function(_) {
for (var w = new a.Buf8(_.length), d = 0, v = w.length; d < v; d++) w[d] = _.charCodeAt(d);
return w;
}, n.buf2string = function(_, w) {
var d, v, h, g, f = w || _.length, y = new Array(2 * f);
for (d = v = 0; d < f; ) if ((h = _[d++]) < 128) y[v++] = h;
else if (4 < (g = u[h])) y[v++] = 65533, d += g - 1;
else {
for (h &= g === 2 ? 31 : g === 3 ? 15 : 7; 1 < g && d < f; ) h = h << 6 | 63 & _[d++], g--;
1 < g ? y[v++] = 65533 : h < 65536 ? y[v++] = h : (h -= 65536, y[v++] = 55296 | h >> 10 & 1023, y[v++] = 56320 | 1023 & h);
}
return k(y, v);
}, n.utf8border = function(_, w) {
var d;
for ((w = w || _.length) > _.length && (w = _.length), d = w - 1; 0 <= d && (192 & _[d]) == 128; ) d--;
return d < 0 || d === 0 ? w : d + u[_[d]] > w ? d : w;
};
}, { "./common": 41 }], 43: [function(e, r, n) {
r.exports = function(a, l, o, u) {
for (var m = 65535 & a | 0, k = a >>> 16 & 65535 | 0, _ = 0; o !== 0; ) {
for (o -= _ = 2e3 < o ? 2e3 : o; k = k + (m = m + l[u++] | 0) | 0, --_; ) ;
m %= 65521, k %= 65521;
}
return m | k << 16 | 0;
};
}, {}], 44: [function(e, r, n) {
r.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
}, {}], 45: [function(e, r, n) {
var a = function() {
for (var l, o = [], u = 0; u < 256; u++) {
l = u;
for (var m = 0; m < 8; m++) l = 1 & l ? 3988292384 ^ l >>> 1 : l >>> 1;
o[u] = l;
}
return o;
}();
r.exports = function(l, o, u, m) {
var k = a, _ = m + u;
l ^= -1;
for (var w = m; w < _; w++) l = l >>> 8 ^ k[255 & (l ^ o[w])];
return -1 ^ l;
};
}, {}], 46: [function(e, r, n) {
var a, l = e("../utils/common"), o = e("./trees"), u = e("./adler32"), m = e("./crc32"), k = e("./messages"), _ = 0, w = 4, d = 0, v = -2, h = -1, g = 4, f = 2, y = 8, C = 9, E = 286, A = 30, F = 19, M = 2 * E + 1, H = 15, I = 3, X = 258, Q = X + I + 1, x = 42, D = 113, c = 1, L = 2, te = 3, $ = 4;
function re(s, O) {
return s.msg = k[O], O;
}
function W(s) {
return (s << 1) - (4 < s ? 9 : 0);
}
function ee(s) {
for (var O = s.length; 0 <= --O; ) s[O] = 0;
}
function z(s) {
var O = s.state, N = O.pending;
N > s.avail_out && (N = s.avail_out), N !== 0 && (l.arraySet(s.output, O.pending_buf, O.pending_out, N, s.next_out), s.next_out += N, O.pending_out += N, s.total_out += N, s.avail_out -= N, O.pending -= N, O.pending === 0 && (O.pending_out = 0));
}
function B(s, O) {
o._tr_flush_block(s, 0 <= s.block_start ? s.block_start : -1, s.strstart - s.block_start, O), s.block_start = s.strstart, z(s.strm);
}
function Y(s, O) {
s.pending_buf[s.pending++] = O;
}
function q(s, O) {
s.pending_buf[s.pending++] = O >>> 8 & 255, s.pending_buf[s.pending++] = 255 & O;
}
function V(s, O) {
var N, b, p = s.max_chain_length, S = s.strstart, j = s.prev_length, U = s.nice_match, T = s.strstart > s.w_size - Q ? s.strstart - (s.w_size - Q) : 0, Z = s.window, K = s.w_mask, G = s.prev, J = s.strstart + X, oe = Z[S + j - 1], se = Z[S + j];
s.prev_length >= s.good_match && (p >>= 2), U > s.lookahead && (U = s.lookahead);
do
if (Z[(N = O) + j] === se && Z[N + j - 1] === oe && Z[N] === Z[S] && Z[++N] === Z[S + 1]) {
S += 2, N++;
do
;
while (Z[++S] === Z[++N] && Z[++S] === Z[++N] && Z[++S] === Z[++N] && Z[++S] === Z[++N] && Z[++S] === Z[++N] && Z[++S] === Z[++N] && Z[++S] === Z[++N] && Z[++S] === Z[++N] && S < J);
if (b = X - (J - S), S = J - X, j < b) {
if (s.match_start = O, U <= (j = b)) break;
oe = Z[S + j - 1], se = Z[S + j];
}
}
while ((O = G[O & K]) > T && --p != 0);
return j <= s.lookahead ? j : s.lookahead;
}
function fe(s) {
var O, N, b, p, S, j, U, T, Z, K, G = s.w_size;
do {
if (p = s.window_size - s.lookahead - s.strstart, s.strstart >= G + (G - Q)) {
for (l.arraySet(s.window, s.window, G, G, 0), s.match_start -= G, s.strstart -= G, s.block_start -= G, O = N = s.hash_size; b = s.head[--O], s.head[O] = G <= b ? b - G : 0, --N; ) ;
for (O = N = G; b = s.prev[--O], s.prev[O] = G <= b ? b - G : 0, --N; ) ;
p += G;
}
if (s.strm.avail_in === 0) break;
if (j = s.strm, U = s.window, T = s.strstart + s.lookahead, Z = p, K = void 0, K = j.avail_in, Z < K && (K = Z), N = K === 0 ? 0 : (j.avail_in -= K, l.arraySet(U, j.input, j.next_in, K, T), j.state.wrap === 1 ? j.adler = u(j.adler, U, K, T) : j.state.wrap === 2 && (j.adler = m(j.adler, U, K, T)), j.next_in += K, j.total_in += K, K), s.lookahead += N, s.lookahead + s.insert >= I) for (S = s.strstart - s.insert, s.ins_h = s.window[S], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[S + 1]) & s.hash_mask; s.insert && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[S + I - 1]) & s.hash_mask, s.prev[S & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = S, S++, s.insert--, !(s.lookahead + s.insert < I)); ) ;
} while (s.lookahead < Q && s.strm.avail_in !== 0);
}
function be(s, O) {
for (var N, b; ; ) {
if (s.lookahead < Q) {
if (fe(s), s.lookahead < Q && O === _) return c;
if (s.lookahead === 0) break;
}
if (N = 0, s.lookahead >= I && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + I - 1]) & s.hash_mask, N = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart), N !== 0 && s.strstart - N <= s.w_size - Q && (s.match_length = V(s, N)), s.match_length >= I) if (b = o._tr_tally(s, s.strstart - s.match_start, s.match_length - I), s.lookahead -= s.match_length, s.match_length <= s.max_lazy_match && s.lookahead >= I) {
for (s.match_length--; s.strstart++, s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + I - 1]) & s.hash_mask, N = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart, --s.match_length != 0; ) ;
s.strstart++;
} else s.strstart += s.match_length, s.match_length = 0, s.ins_h = s.window[s.strstart], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask;
else b = o._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, s.strstart++;
if (b && (B(s, !1), s.strm.avail_out === 0)) return c;
}
return s.insert = s.strstart < I - 1 ? s.strstart : I - 1, O === w ? (B(s, !0), s.strm.avail_out === 0 ? te : $) : s.last_lit && (B(s, !1), s.strm.avail_out === 0) ? c : L;
}
function ae(s, O) {
for (var N, b, p; ; ) {
if (s.lookahead < Q) {
if (fe(s), s.lookahead < Q && O === _) return c;
if (s.lookahead === 0) break;
}
if (N = 0, s.lookahead >= I && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + I - 1]) & s.hash_mask, N = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart), s.prev_length = s.match_length, s.prev_match = s.match_start, s.match_length = I - 1, N !== 0 && s.prev_length < s.max_lazy_match && s.strstart - N <= s.w_size - Q && (s.match_length = V(s, N), s.match_length <= 5 && (s.strategy === 1 || s.match_length === I && 4096 < s.strstart - s.match_start) && (s.match_length = I - 1)), s.prev_length >= I && s.match_length <= s.prev_length) {
for (p = s.strstart + s.lookahead - I, b = o._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - I), s.lookahead -= s.prev_length - 1, s.prev_length -= 2; ++s.strstart <= p && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + I - 1]) & s.hash_mask, N = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart), --s.prev_length != 0; ) ;
if (s.match_available = 0, s.match_length = I - 1, s.strstart++, b && (B(s, !1), s.strm.avail_out === 0)) return c;
} else if (s.match_available) {
if ((b = o._tr_tally(s, 0, s.window[s.strstart - 1])) && B(s, !1), s.strstart++, s.lookahead--, s.strm.avail_out === 0) return c;
} else s.match_available = 1, s.strstart++, s.lookahead--;
}
return s.match_available && (b = o._tr_tally(s, 0, s.window[s.strstart - 1]), s.match_available = 0), s.insert = s.strstart < I - 1 ? s.strstart : I - 1, O === w ? (B(s, !0), s.strm.avail_out === 0 ? te : $) : s.last_lit && (B(s, !1), s.strm.avail_out === 0) ? c : L;
}
function ie(s, O, N, b, p) {
this.good_length = s, this.max_lazy = O, this.nice_length = N, this.max_chain = b, this.func = p;
}
function ge() {
this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = y, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new l.Buf16(2 * M), this.dyn_dtree = new l.Buf16(2 * (2 * A + 1)), this.bl_tree = new l.Buf16(2 * (2 * F + 1)), ee(this.dyn_ltree), ee(this.dyn_dtree), ee(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new l.Buf16(H + 1), this.heap = new l.Buf16(2 * E + 1), ee(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new l.Buf16(2 * E + 1), ee(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
}
function me(s) {
var O;
return s && s.state ? (s.total_in = s.total_out = 0, s.data_type = f, (O = s.state).pending = 0, O.pending_out = 0, O.wrap < 0 && (O.wrap = -O.wrap), O.status = O.wrap ? x : D, s.adler = O.wrap === 2 ? 0 : 1, O.last_flush = _, o._tr_init(O), d) : re(s, v);
}
function xe(s) {
var O = me(s);
return O === d && function(N) {
N.window_size = 2 * N.w_size, ee(N.head), N.max_lazy_match = a[N.level].max_lazy, N.good_match = a[N.level].good_length, N.nice_match = a[N.level].nice_length, N.max_chain_length = a[N.level].max_chain, N.strstart = 0, N.block_start = 0, N.lookahead = 0, N.insert = 0, N.match_length = N.prev_length = I - 1, N.match_available = 0, N.ins_h = 0;
}(s.state), O;
}
function we(s, O, N, b, p, S) {
if (!s) return v;
var j = 1;
if (O === h && (O = 6), b < 0 ? (j = 0, b = -b) : 15 < b && (j = 2, b -= 16), p < 1 || C < p || N !== y || b < 8 || 15 < b || O < 0 || 9 < O || S < 0 || g < S) return re(s, v);
b === 8 && (b = 9);
var U = new ge();
return (s.state = U).strm = s, U.wrap = j, U.gzhead = null, U.w_bits = b, U.w_size = 1 << U.w_bits, U.w_mask = U.w_size - 1, U.hash_bits = p + 7, U.hash_size = 1 << U.hash_bits, U.hash_mask = U.hash_size - 1, U.hash_shift = ~~((U.hash_bits + I - 1) / I), U.window = new l.Buf8(2 * U.w_size), U.head = new l.Buf16(U.hash_size), U.prev = new l.Buf16(U.w_size), U.lit_bufsize = 1 << p + 6, U.pending_buf_size = 4 * U.lit_bufsize, U.pending_buf = new l.Buf8(U.pending_buf_size), U.d_buf = 1 * U.lit_bufsize, U.l_buf = 3 * U.lit_bufsize, U.level = O, U.strategy = S, U.method = N, xe(s);
}
a = [new ie(0, 0, 0, 0, function(s, O) {
var N = 65535;
for (N > s.pending_buf_size - 5 && (N = s.pending_buf_size - 5); ; ) {
if (s.lookahead <= 1) {
if (fe(s), s.lookahead === 0 && O === _) return c;
if (s.lookahead === 0) break;
}
s.strstart += s.lookahead, s.lookahead = 0;
var b = s.block_start + N;
if ((s.strstart === 0 || s.strstart >= b) && (s.lookahead = s.strstart - b, s.strstart = b, B(s, !1), s.strm.avail_out === 0) || s.strstart - s.block_start >= s.w_size - Q && (B(s, !1), s.strm.avail_out === 0)) return c;
}
return s.insert = 0, O === w ? (B(s, !0), s.strm.avail_out === 0 ? te : $) : (s.strstart > s.block_start && (B(s, !1), s.strm.avail_out), c);
}), new ie(4, 4, 8, 4, be), new ie(4, 5, 16, 8, be), new ie(4, 6, 32, 32, be), new ie(4, 4, 16, 16, ae), new ie(8, 16, 32, 32, ae), new ie(8, 16, 128, 128, ae), new ie(8, 32, 128, 256, ae), new ie(32, 128, 258, 1024, ae), new ie(32, 258, 258, 4096, ae)], n.deflateInit = function(s, O) {
return we(s, O, y, 15, 8, 0);
}, n.deflateInit2 = we, n.deflateReset = xe, n.deflateResetKeep = me, n.deflateSetHeader = function(s, O) {
return s && s.state ? s.state.wrap !== 2 ? v : (s.state.gzhead = O, d) : v;
}, n.deflate = function(s, O) {
var N, b, p, S;
if (!s || !s.state || 5 < O || O < 0) return s ? re(s, v) : v;
if (b = s.state, !s.output || !s.input && s.avail_in !== 0 || b.status === 666 && O !== w) return re(s, s.avail_out === 0 ? -5 : v);
if (b.strm = s, N = b.last_flush, b.last_flush = O, b.status === x) if (b.wrap === 2) s.adler = 0, Y(b, 31), Y(b, 139), Y(b, 8), b.gzhead ? (Y(b, (b.gzhead.text ? 1 : 0) + (b.gzhead.hcrc ? 2 : 0) + (b.gzhead.extra ? 4 : 0) + (b.gzhead.name ? 8 : 0) + (b.gzhead.comment ? 16 : 0)), Y(b, 255 & b.gzhead.time), Y(b, b.gzhead.time >> 8 & 255), Y(b, b.gzhead.time >> 16 & 255), Y(b, b.gzhead.time >> 24 & 255), Y(b, b.level === 9 ? 2 : 2 <= b.strategy || b.level < 2 ? 4 : 0), Y(b, 255 & b.gzhead.os), b.gzhead.extra && b.gzhead.extra.length && (Y(b, 255 & b.gzhead.extra.length), Y(b, b.gzhead.extra.length >> 8 & 255)), b.gzhead.hcrc && (s.adler = m(s.adler, b.pending_buf, b.pending, 0)), b.gzindex = 0, b.status = 69) : (Y(b, 0), Y(b, 0), Y(b, 0), Y(b, 0), Y(b, 0), Y(b, b.level === 9 ? 2 : 2 <= b.strategy || b.level < 2 ? 4 : 0), Y(b, 3), b.status = D);
else {
var j = y + (b.w_bits - 8 << 4) << 8;
j |= (2 <= b.strategy || b.level < 2 ? 0 : b.level < 6 ? 1 : b.level === 6 ? 2 : 3) << 6, b.strstart !== 0 && (j |= 32), j += 31 - j % 31, b.status = D, q(b, j), b.strstart !== 0 && (q(b, s.adler >>> 16), q(b, 65535 & s.adler)), s.adler = 1;
}
if (b.status === 69) if (b.gzhead.extra) {
for (p = b.pending; b.gzindex < (65535 & b.gzhead.extra.length) && (b.pending !== b.pending_buf_size || (b.gzhead.hcrc && b.pending > p && (s.adler = m(s.adler, b.pending_buf, b.pending - p, p)), z(s), p = b.pending, b.pending !== b.pending_buf_size)); ) Y(b, 255 & b.gzhead.extra[b.gzindex]), b.gzindex++;
b.gzhead.hcrc && b.pending > p && (s.adler = m(s.adler, b.pending_buf, b.pending - p, p)), b.gzindex === b.gzhead.extra.length && (b.gzindex = 0, b.status = 73);
} else b.status = 73;
if (b.status === 73) if (b.gzhead.name) {
p = b.pending;
do {
if (b.pending === b.pending_buf_size && (b.gzhead.hcrc && b.pending > p && (s.adler = m(s.adler, b.pending_buf, b.pending - p, p)), z(s), p = b.pending, b.pending === b.pending_buf_size)) {
S = 1;
break;
}
S = b.gzindex < b.gzhead.name.length ? 255 & b.gzhead.name.charCodeAt(b.gzindex++) : 0, Y(b, S);
} while (S !== 0);
b.gzhead.hcrc && b.pending > p && (s.adler = m(s.adler, b.pending_buf, b.pending - p, p)), S === 0 && (b.gzindex = 0, b.status = 91);
} else b.status = 91;
if (b.status === 91) if (b.gzhead.comment) {
p = b.pending;
do {
if (b.pending === b.pending_buf_size && (b.gzhead.hcrc && b.pending > p && (s.adler = m(s.adler, b.pending_buf, b.pending - p, p)), z(s), p = b.pending, b.pending === b.pending_buf_size)) {
S = 1;
break;
}
S = b.gzindex < b.gzhead.comment.length ? 255 & b.gzhead.comment.charCodeAt(b.gzindex++) : 0, Y(b, S);
} while (S !== 0);
b.gzhead.hcrc && b.pending > p && (s.adler = m(s.adler, b.pending_buf, b.pending - p, p)), S === 0 && (b.status = 103);
} else b.status = 103;
if (b.status === 103 && (b.gzhead.hcrc ? (b.pending + 2 > b.pending_buf_size && z(s), b.pending + 2 <= b.pending_buf_size && (Y(b, 255 & s.adler), Y(b, s.adler >> 8 & 255), s.adler = 0, b.status = D)) : b.status = D), b.pending !== 0) {
if (z(s), s.avail_out === 0) return b.last_flush = -1, d;
} else if (s.avail_in === 0 && W(O) <= W(N) && O !== w) return re(s, -5);
if (b.status === 666 && s.avail_in !== 0) return re(s, -5);
if (s.avail_in !== 0 || b.lookahead !== 0 || O !== _ && b.status !== 666) {
var U = b.strategy === 2 ? function(T, Z) {
for (var K; ; ) {
if (T.lookahead === 0 && (fe(T), T.lookahead === 0)) {
if (Z === _) return c;
break;
}
if (T.match_length = 0, K = o._tr_tally(T, 0, T.window[T.strstart]), T.lookahead--, T.strstart++, K && (B(T, !1), T.strm.avail_out === 0)) return c;
}
return T.insert = 0, Z === w ? (B(T, !0), T.strm.avail_out === 0 ? te : $) : T.last_lit && (B(T, !1), T.strm.avail_out === 0) ? c : L;
}(b, O) : b.strategy === 3 ? function(T, Z) {
for (var K, G, J, oe, se = T.window; ; ) {
if (T.lookahead <= X) {
if (fe(T), T.lookahead <= X && Z === _) return c;
if (T.lookahead === 0) break;
}
if (T.match_length = 0, T.lookahead >= I && 0 < T.strstart && (G = se[J = T.strstart - 1]) === se[++J] && G === se[++J] && G === se[++J]) {
oe = T.strstart + X;
do
;
while (G === se[++J] && G === se[++J] && G === se[++J] && G === se[++J] && G === se[++J] && G === se[++J] && G === se[++J] && G === se[++J] && J < oe);
T.match_length = X - (oe - J), T.match_length > T.lookahead && (T.match_length = T.lookahead);
}
if (T.match_length >= I ? (K = o._tr_tally(T, 1, T.match_length - I), T.lookahead -= T.match_length, T.strstart += T.match_length, T.match_length = 0) : (K = o._tr_tally(T, 0, T.window[T.strstart]), T.lookahead--, T.strstart++), K && (B(T, !1), T.strm.avail_out === 0)) return c;
}
return T.insert = 0, Z === w ? (B(T, !0), T.strm.avail_out === 0 ? te : $) : T.last_lit && (B(T, !1), T.strm.avail_out === 0) ? c : L;
}(b, O) : a[b.level].func(b, O);
if (U !== te && U !== $ || (b.status = 666), U === c || U === te) return s.avail_out === 0 && (b.last_flush = -1), d;
if (U === L && (O === 1 ? o._tr_align(b) : O !== 5 && (o._tr_stored_block(b, 0, 0, !1), O === 3 && (ee(b.head), b.lookahead === 0 && (b.strstart = 0, b.block_start = 0, b.insert = 0))), z(s), s.avail_out === 0)) return b.last_flush = -1, d;
}
return O !== w ? d : b.wrap <= 0 ? 1 : (b.wrap === 2 ? (Y(b, 255 & s.adler), Y(b, s.adler >> 8 & 255), Y(b, s.adler >> 16 & 255), Y(b, s.adler >> 24 & 255), Y(b, 255 & s.total_in), Y(b, s.total_in >> 8 & 255), Y(b, s.total_in >> 16 & 255), Y(b, s.total_in >> 24 & 255)) : (q(b, s.adler >>> 16), q(b, 65535 & s.adler)), z(s), 0 < b.wrap && (b.wrap = -b.wrap), b.pending !== 0 ? d : 1);
}, n.deflateEnd = function(s) {
var O;
return s && s.state ? (O = s.state.status) !== x && O !== 69 && O !== 73 && O !== 91 && O !== 103 && O !== D && O !== 666 ? re(s, v) : (s.state = null, O === D ? re(s, -3) : d) : v;
}, n.deflateSetDictionary = function(s, O) {
var N, b, p, S, j, U, T, Z, K = O.length;
if (!s || !s.state || (S = (N = s.state).wrap) === 2 || S === 1 && N.status !== x || N.lookahead) return v;
for (S === 1 && (s.adler = u(s.adler, O, K, 0)), N.wrap = 0, K >= N.w_size && (S === 0 && (ee(N.head), N.strstart = 0, N.block_start = 0, N.insert = 0), Z = new l.Buf8(N.w_size), l.arraySet(Z, O, K - N.w_size, N.w_size, 0), O = Z, K = N.w_size), j = s.avail_in, U = s.next_in, T = s.input, s.avail_in = K, s.next_in = 0, s.input = O, fe(N); N.lookahead >= I; ) {
for (b = N.strstart, p = N.lookahead - (I - 1); N.ins_h = (N.ins_h << N.hash_shift ^ N.window[b + I - 1]) & N.hash_mask, N.prev[b & N.w_mask] = N.head[N.ins_h], N.head[N.ins_h] = b, b++, --p; ) ;
N.strstart = b, N.lookahead = I - 1, fe(N);
}
return N.strstart += N.lookahead, N.block_start = N.strstart, N.insert = N.lookahead, N.lookahead = 0, N.match_length = N.prev_length = I - 1, N.match_available = 0, s.next_in = U, s.input = T, s.avail_in = j, N.wrap = S, d;
}, n.deflateInfo = "pako deflate (from Nodeca project)";
}, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, r, n) {
r.exports = function() {
this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
};
}, {}], 48: [function(e, r, n) {
r.exports = function(a, l) {
var o, u, m, k, _, w, d, v, h, g, f, y, C, E, A, F, M, H, I, X, Q, x, D, c, L;
o = a.state, u = a.next_in, c = a.input, m = u + (a.avail_in - 5), k = a.next_out, L = a.output, _ = k - (l - a.avail_out), w = k + (a.avail_out - 257), d = o.dmax, v = o.wsize, h = o.whave, g = o.wnext, f = o.window, y = o.hold, C = o.bits, E = o.lencode, A = o.distcode, F = (1 << o.lenbits) - 1, M = (1 << o.distbits) - 1;
e: do {
C < 15 && (y += c[u++] << C, C += 8, y += c[u++] << C, C += 8), H = E[y & F];
t: for (; ; ) {
if (y >>>= I = H >>> 24, C -= I, (I = H >>> 16 & 255) === 0) L[k++] = 65535 & H;
else {
if (!(16 & I)) {
if (!(64 & I)) {
H = E[(65535 & H) + (y & (1 << I) - 1)];
continue t;
}
if (32 & I) {
o.mode = 12;
break e;
}
a.msg = "invalid literal/length code", o.mode = 30;
break e;
}
X = 65535 & H, (I &= 15) && (C < I && (y += c[u++] << C, C += 8), X += y & (1 << I) - 1, y >>>= I, C -= I), C < 15 && (y += c[u++] << C, C += 8, y += c[u++] << C, C += 8), H = A[y & M];
r: for (; ; ) {
if (y >>>= I = H >>> 24, C -= I, !(16 & (I = H >>> 16 & 255))) {
if (!(64 & I)) {
H = A[(65535 & H) + (y & (1 << I) - 1)];
continue r;
}
a.msg = "invalid distance code", o.mode = 30;
break e;
}
if (Q = 65535 & H, C < (I &= 15) && (y += c[u++] << C, (C += 8) < I && (y += c[u++] << C, C += 8)), d < (Q += y & (1 << I) - 1)) {
a.msg = "invalid distance too far back", o.mode = 30;
break e;
}
if (y >>>= I, C -= I, (I = k - _) < Q) {
if (h < (I = Q - I) && o.sane) {
a.msg = "invalid distance too far back", o.mode = 30;
break e;
}
if (D = f, (x = 0) === g) {
if (x += v - I, I < X) {
for (X -= I; L[k++] = f[x++], --I; ) ;
x = k - Q, D = L;
}
} else if (g < I) {
if (x += v + g - I, (I -= g) < X) {
for (X -= I; L[k++] = f[x++], --I; ) ;
if (x = 0, g < X) {
for (X -= I = g; L[k++] = f[x++], --I; ) ;
x = k - Q, D = L;
}
}
} else if (x += g - I, I < X) {
for (X -= I; L[k++] = f[x++], --I; ) ;
x = k - Q, D = L;
}
for (; 2 < X; ) L[k++] = D[x++], L[k++] = D[x++], L[k++] = D[x++], X -= 3;
X && (L[k++] = D[x++], 1 < X && (L[k++] = D[x++]));
} else {
for (x = k - Q; L[k++] = L[x++], L[k++] = L[x++], L[k++] = L[x++], 2 < (X -= 3); ) ;
X && (L[k++] = L[x++], 1 < X && (L[k++] = L[x++]));
}
break;
}
}
break;
}
} while (u < m && k < w);
u -= X = C >> 3, y &= (1 << (C -= X << 3)) - 1, a.next_in = u, a.next_out = k, a.avail_in = u < m ? m - u + 5 : 5 - (u - m), a.avail_out = k < w ? w - k + 257 : 257 - (k - w), o.hold = y, o.bits = C;
};
}, {}], 49: [function(e, r, n) {
var a = e("../utils/common"), l = e("./adler32"), o = e("./crc32"), u = e("./inffast"), m = e("./inftrees"), k = 1, _ = 2, w = 0, d = -2, v = 1, h = 852, g = 592;
function f(x) {
return (x >>> 24 & 255) + (x >>> 8 & 65280) + ((65280 & x) << 8) + ((255 & x) << 24);
}
function y() {
this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new a.Buf16(320), this.work = new a.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
}
function C(x) {
var D;
return x && x.state ? (D = x.state, x.total_in = x.total_out = D.total = 0, x.msg = "", D.wrap && (x.adler = 1 & D.wrap), D.mode = v, D.last = 0, D.havedict = 0, D.dmax = 32768, D.head = null, D.hold = 0, D.bits = 0, D.lencode = D.lendyn = new a.Buf32(h), D.distcode = D.distdyn = new a.Buf32(g), D.sane = 1, D.back = -1, w) : d;
}
function E(x) {
var D;
return x && x.state ? ((D = x.state).wsize = 0, D.whave = 0, D.wnext = 0, C(x)) : d;
}
function A(x, D) {
var c, L;
return x && x.state ? (L = x.state, D < 0 ? (c = 0, D = -D) : (c = 1 + (D >> 4), D < 48 && (D &= 15)), D && (D < 8 || 15 < D) ? d : (L.window !== null && L.wbits !== D && (L.window = null), L.wrap = c, L.wbits = D, E(x))) : d;
}
function F(x, D) {
var c, L;
return x ? (L = new y(), (x.state = L).window = null, (c = A(x, D)) !== w && (x.state = null), c) : d;
}
var M, H, I = !0;
function X(x) {
if (I) {
var D;
for (M = new a.Buf32(512), H = new a.Buf32(32), D = 0; D < 144; ) x.lens[D++] = 8;
for (; D < 256; ) x.lens[D++] = 9;
for (; D < 280; ) x.lens[D++] = 7;
for (; D < 288; ) x.lens[D++] = 8;
for (m(k, x.lens, 0, 288, M, 0, x.work, { bits: 9 }), D = 0; D < 32; ) x.lens[D++] = 5;
m(_, x.lens, 0, 32, H, 0, x.work, { bits: 5 }), I = !1;
}
x.lencode = M, x.lenbits = 9, x.distcode = H, x.distbits = 5;
}
function Q(x, D, c, L) {
var te, $ = x.state;
return $.window === null && ($.wsize = 1 << $.wbits, $.wnext = 0, $.whave = 0, $.window = new a.Buf8($.wsize)), L >= $.wsize ? (a.arraySet($.window, D, c - $.wsize, $.wsize, 0), $.wnext = 0, $.whave = $.wsize) : (L < (te = $.wsize - $.wnext) && (te = L), a.arraySet($.window, D, c - L, te, $.wnext), (L -= te) ? (a.arraySet($.window, D, c - L, L, 0), $.wnext = L, $.whave = $.wsize) : ($.wnext += te, $.wnext === $.wsize && ($.wnext = 0), $.whave < $.wsize && ($.whave += te))), 0;
}
n.inflateReset = E, n.inflateReset2 = A, n.inflateResetKeep = C, n.inflateInit = function(x) {
return F(x, 15);
}, n.inflateInit2 = F, n.inflate = function(x, D) {
var c, L, te, $, re, W, ee, z, B, Y, q, V, fe, be, ae, ie, ge, me, xe, we, s, O, N, b, p = 0, S = new a.Buf8(4), j = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
if (!x || !x.state || !x.output || !x.input && x.avail_in !== 0) return d;
(c = x.state).mode === 12 && (c.mode = 13), re = x.next_out, te = x.output, ee = x.avail_out, $ = x.next_in, L = x.input, W = x.avail_in, z = c.hold, B = c.bits, Y = W, q = ee, O = w;
e: for (; ; ) switch (c.mode) {
case v:
if (c.wrap === 0) {
c.mode = 13;
break;
}
for (; B < 16; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (2 & c.wrap && z === 35615) {
S[c.check = 0] = 255 & z, S[1] = z >>> 8 & 255, c.check = o(c.check, S, 2, 0), B = z = 0, c.mode = 2;
break;
}
if (c.flags = 0, c.head && (c.head.done = !1), !(1 & c.wrap) || (((255 & z) << 8) + (z >> 8)) % 31) {
x.msg = "incorrect header check", c.mode = 30;
break;
}
if ((15 & z) != 8) {
x.msg = "unknown compression method", c.mode = 30;
break;
}
if (B -= 4, s = 8 + (15 & (z >>>= 4)), c.wbits === 0) c.wbits = s;
else if (s > c.wbits) {
x.msg = "invalid window size", c.mode = 30;
break;
}
c.dmax = 1 << s, x.adler = c.check = 1, c.mode = 512 & z ? 10 : 12, B = z = 0;
break;
case 2:
for (; B < 16; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (c.flags = z, (255 & c.flags) != 8) {
x.msg = "unknown compression method", c.mode = 30;
break;
}
if (57344 & c.flags) {
x.msg = "unknown header flags set", c.mode = 30;
break;
}
c.head && (c.head.text = z >> 8 & 1), 512 & c.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, c.check = o(c.check, S, 2, 0)), B = z = 0, c.mode = 3;
case 3:
for (; B < 32; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
c.head && (c.head.time = z), 512 & c.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, S[2] = z >>> 16 & 255, S[3] = z >>> 24 & 255, c.check = o(c.check, S, 4, 0)), B = z = 0, c.mode = 4;
case 4:
for (; B < 16; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
c.head && (c.head.xflags = 255 & z, c.head.os = z >> 8), 512 & c.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, c.check = o(c.check, S, 2, 0)), B = z = 0, c.mode = 5;
case 5:
if (1024 & c.flags) {
for (; B < 16; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
c.length = z, c.head && (c.head.extra_len = z), 512 & c.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, c.check = o(c.check, S, 2, 0)), B = z = 0;
} else c.head && (c.head.extra = null);
c.mode = 6;
case 6:
if (1024 & c.flags && (W < (V = c.length) && (V = W), V && (c.head && (s = c.head.extra_len - c.length, c.head.extra || (c.head.extra = new Array(c.head.extra_len)), a.arraySet(c.head.extra, L, $, V, s)), 512 & c.flags && (c.check = o(c.check, L, V, $)), W -= V, $ += V, c.length -= V), c.length)) break e;
c.length = 0, c.mode = 7;
case 7:
if (2048 & c.flags) {
if (W === 0) break e;
for (V = 0; s = L[$ + V++], c.head && s && c.length < 65536 && (c.head.name += String.fromCharCode(s)), s && V < W; ) ;
if (512 & c.flags && (c.check = o(c.check, L, V, $)), W -= V, $ += V, s) break e;
} else c.head && (c.head.name = null);
c.length = 0, c.mode = 8;
case 8:
if (4096 & c.flags) {
if (W === 0) break e;
for (V = 0; s = L[$ + V++], c.head && s && c.length < 65536 && (c.head.comment += String.fromCharCode(s)), s && V < W; ) ;
if (512 & c.flags && (c.check = o(c.check, L, V, $)), W -= V, $ += V, s) break e;
} else c.head && (c.head.comment = null);
c.mode = 9;
case 9:
if (512 & c.flags) {
for (; B < 16; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (z !== (65535 & c.check)) {
x.msg = "header crc mismatch", c.mode = 30;
break;
}
B = z = 0;
}
c.head && (c.head.hcrc = c.flags >> 9 & 1, c.head.done = !0), x.adler = c.check = 0, c.mode = 12;
break;
case 10:
for (; B < 32; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
x.adler = c.check = f(z), B = z = 0, c.mode = 11;
case 11:
if (c.havedict === 0) return x.next_out = re, x.avail_out = ee, x.next_in = $, x.avail_in = W, c.hold = z, c.bits = B, 2;
x.adler = c.check = 1, c.mode = 12;
case 12:
if (D === 5 || D === 6) break e;
case 13:
if (c.last) {
z >>>= 7 & B, B -= 7 & B, c.mode = 27;
break;
}
for (; B < 3; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
switch (c.last = 1 & z, B -= 1, 3 & (z >>>= 1)) {
case 0:
c.mode = 14;
break;
case 1:
if (X(c), c.mode = 20, D !== 6) break;
z >>>= 2, B -= 2;
break e;
case 2:
c.mode = 17;
break;
case 3:
x.msg = "invalid block type", c.mode = 30;
}
z >>>= 2, B -= 2;
break;
case 14:
for (z >>>= 7 & B, B -= 7 & B; B < 32; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if ((65535 & z) != (z >>> 16 ^ 65535)) {
x.msg = "invalid stored block lengths", c.mode = 30;
break;
}
if (c.length = 65535 & z, B = z = 0, c.mode = 15, D === 6) break e;
case 15:
c.mode = 16;
case 16:
if (V = c.length) {
if (W < V && (V = W), ee < V && (V = ee), V === 0) break e;
a.arraySet(te, L, $, V, re), W -= V, $ += V, ee -= V, re += V, c.length -= V;
break;
}
c.mode = 12;
break;
case 17:
for (; B < 14; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (c.nlen = 257 + (31 & z), z >>>= 5, B -= 5, c.ndist = 1 + (31 & z), z >>>= 5, B -= 5, c.ncode = 4 + (15 & z), z >>>= 4, B -= 4, 286 < c.nlen || 30 < c.ndist) {
x.msg = "too many length or distance symbols", c.mode = 30;
break;
}
c.have = 0, c.mode = 18;
case 18:
for (; c.have < c.ncode; ) {
for (; B < 3; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
c.lens[j[c.have++]] = 7 & z, z >>>= 3, B -= 3;
}
for (; c.have < 19; ) c.lens[j[c.have++]] = 0;
if (c.lencode = c.lendyn, c.lenbits = 7, N = { bits: c.lenbits }, O = m(0, c.lens, 0, 19, c.lencode, 0, c.work, N), c.lenbits = N.bits, O) {
x.msg = "invalid code lengths set", c.mode = 30;
break;
}
c.have = 0, c.mode = 19;
case 19:
for (; c.have < c.nlen + c.ndist; ) {
for (; ie = (p = c.lencode[z & (1 << c.lenbits) - 1]) >>> 16 & 255, ge = 65535 & p, !((ae = p >>> 24) <= B); ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (ge < 16) z >>>= ae, B -= ae, c.lens[c.have++] = ge;
else {
if (ge === 16) {
for (b = ae + 2; B < b; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (z >>>= ae, B -= ae, c.have === 0) {
x.msg = "invalid bit length repeat", c.mode = 30;
break;
}
s = c.lens[c.have - 1], V = 3 + (3 & z), z >>>= 2, B -= 2;
} else if (ge === 17) {
for (b = ae + 3; B < b; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
B -= ae, s = 0, V = 3 + (7 & (z >>>= ae)), z >>>= 3, B -= 3;
} else {
for (b = ae + 7; B < b; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
B -= ae, s = 0, V = 11 + (127 & (z >>>= ae)), z >>>= 7, B -= 7;
}
if (c.have + V > c.nlen + c.ndist) {
x.msg = "invalid bit length repeat", c.mode = 30;
break;
}
for (; V--; ) c.lens[c.have++] = s;
}
}
if (c.mode === 30) break;
if (c.lens[256] === 0) {
x.msg = "invalid code -- missing end-of-block", c.mode = 30;
break;
}
if (c.lenbits = 9, N = { bits: c.lenbits }, O = m(k, c.lens, 0, c.nlen, c.lencode, 0, c.work, N), c.lenbits = N.bits, O) {
x.msg = "invalid literal/lengths set", c.mode = 30;
break;
}
if (c.distbits = 6, c.distcode = c.distdyn, N = { bits: c.distbits }, O = m(_, c.lens, c.nlen, c.ndist, c.distcode, 0, c.work, N), c.distbits = N.bits, O) {
x.msg = "invalid distances set", c.mode = 30;
break;
}
if (c.mode = 20, D === 6) break e;
case 20:
c.mode = 21;
case 21:
if (6 <= W && 258 <= ee) {
x.next_out = re, x.avail_out = ee, x.next_in = $, x.avail_in = W, c.hold = z, c.bits = B, u(x, q), re = x.next_out, te = x.output, ee = x.avail_out, $ = x.next_in, L = x.input, W = x.avail_in, z = c.hold, B = c.bits, c.mode === 12 && (c.back = -1);
break;
}
for (c.back = 0; ie = (p = c.lencode[z & (1 << c.lenbits) - 1]) >>> 16 & 255, ge = 65535 & p, !((ae = p >>> 24) <= B); ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (ie && !(240 & ie)) {
for (me = ae, xe = ie, we = ge; ie = (p = c.lencode[we + ((z & (1 << me + xe) - 1) >> me)]) >>> 16 & 255, ge = 65535 & p, !(me + (ae = p >>> 24) <= B); ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
z >>>= me, B -= me, c.back += me;
}
if (z >>>= ae, B -= ae, c.back += ae, c.length = ge, ie === 0) {
c.mode = 26;
break;
}
if (32 & ie) {
c.back = -1, c.mode = 12;
break;
}
if (64 & ie) {
x.msg = "invalid literal/length code", c.mode = 30;
break;
}
c.extra = 15 & ie, c.mode = 22;
case 22:
if (c.extra) {
for (b = c.extra; B < b; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
c.length += z & (1 << c.extra) - 1, z >>>= c.extra, B -= c.extra, c.back += c.extra;
}
c.was = c.length, c.mode = 23;
case 23:
for (; ie = (p = c.distcode[z & (1 << c.distbits) - 1]) >>> 16 & 255, ge = 65535 & p, !((ae = p >>> 24) <= B); ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (!(240 & ie)) {
for (me = ae, xe = ie, we = ge; ie = (p = c.distcode[we + ((z & (1 << me + xe) - 1) >> me)]) >>> 16 & 255, ge = 65535 & p, !(me + (ae = p >>> 24) <= B); ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
z >>>= me, B -= me, c.back += me;
}
if (z >>>= ae, B -= ae, c.back += ae, 64 & ie) {
x.msg = "invalid distance code", c.mode = 30;
break;
}
c.offset = ge, c.extra = 15 & ie, c.mode = 24;
case 24:
if (c.extra) {
for (b = c.extra; B < b; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
c.offset += z & (1 << c.extra) - 1, z >>>= c.extra, B -= c.extra, c.back += c.extra;
}
if (c.offset > c.dmax) {
x.msg = "invalid distance too far back", c.mode = 30;
break;
}
c.mode = 25;
case 25:
if (ee === 0) break e;
if (V = q - ee, c.offset > V) {
if ((V = c.offset - V) > c.whave && c.sane) {
x.msg = "invalid distance too far back", c.mode = 30;
break;
}
fe = V > c.wnext ? (V -= c.wnext, c.wsize - V) : c.wnext - V, V > c.length && (V = c.length), be = c.window;
} else be = te, fe = re - c.offset, V = c.length;
for (ee < V && (V = ee), ee -= V, c.length -= V; te[re++] = be[fe++], --V; ) ;
c.length === 0 && (c.mode = 21);
break;
case 26:
if (ee === 0) break e;
te[re++] = c.length, ee--, c.mode = 21;
break;
case 27:
if (c.wrap) {
for (; B < 32; ) {
if (W === 0) break e;
W--, z |= L[$++] << B, B += 8;
}
if (q -= ee, x.total_out += q, c.total += q, q && (x.adler = c.check = c.flags ? o(c.check, te, q, re - q) : l(c.check, te, q, re - q)), q = ee, (c.flags ? z : f(z)) !== c.check) {
x.msg = "incorrect data check", c.mode = 30;
break;
}
B = z = 0;
}
c.mode = 28;
case 28:
if (c.wrap && c.flags) {
for (; B < 32; ) {
if (W === 0) break e;
W--, z += L[$++] << B, B += 8;
}
if (z !== (4294967295 & c.total)) {
x.msg = "incorrect length check", c.mode = 30;
break;
}
B = z = 0;
}
c.mode = 29;
case 29:
O = 1;
break e;
case 30:
O = -3;
break e;
case 31:
return -4;
case 32:
default:
return d;
}
return x.next_out = re, x.avail_out = ee, x.next_in = $, x.avail_in = W, c.hold = z, c.bits = B, (c.wsize || q !== x.avail_out && c.mode < 30 && (c.mode < 27 || D !== 4)) && Q(x, x.output, x.next_out, q - x.avail_out) ? (c.mode = 31, -4) : (Y -= x.avail_in, q -= x.avail_out, x.total_in += Y, x.total_out += q, c.total += q, c.wrap && q && (x.adler = c.check = c.flags ? o(c.check, te, q, x.next_out - q) : l(c.check, te, q, x.next_out - q)), x.data_type = c.bits + (c.last ? 64 : 0) + (c.mode === 12 ? 128 : 0) + (c.mode === 20 || c.mode === 15 ? 256 : 0), (Y == 0 && q === 0 || D === 4) && O === w && (O = -5), O);
}, n.inflateEnd = function(x) {
if (!x || !x.state) return d;
var D = x.state;
return D.window && (D.window = null), x.state = null, w;
}, n.inflateGetHeader = function(x, D) {
var c;
return x && x.state && 2 & (c = x.state).wrap ? ((c.head = D).done = !1, w) : d;
}, n.inflateSetDictionary = function(x, D) {
var c, L = D.length;
return x && x.state ? (c = x.state).wrap !== 0 && c.mode !== 11 ? d : c.mode === 11 && l(1, D, L, 0) !== c.check ? -3 : Q(x, D, L, L) ? (c.mode = 31, -4) : (c.havedict = 1, w) : d;
}, n.inflateInfo = "pako inflate (from Nodeca project)";
}, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, r, n) {
var a = e("../utils/common"), l = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], o = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], u = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], m = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
r.exports = function(k, _, w, d, v, h, g, f) {
var y, C, E, A, F, M, H, I, X, Q = f.bits, x = 0, D = 0, c = 0, L = 0, te = 0, $ = 0, re = 0, W = 0, ee = 0, z = 0, B = null, Y = 0, q = new a.Buf16(16), V = new a.Buf16(16), fe = null, be = 0;
for (x = 0; x <= 15; x++) q[x] = 0;
for (D = 0; D < d; D++) q[_[w + D]]++;
for (te = Q, L = 15; 1 <= L && q[L] === 0; L--) ;
if (L < te && (te = L), L === 0) return v[h++] = 20971520, v[h++] = 20971520, f.bits = 1, 0;
for (c = 1; c < L && q[c] === 0; c++) ;
for (te < c && (te = c), x = W = 1; x <= 15; x++) if (W <<= 1, (W -= q[x]) < 0) return -1;
if (0 < W && (k === 0 || L !== 1)) return -1;
for (V[1] = 0, x = 1; x < 15; x++) V[x + 1] = V[x] + q[x];
for (D = 0; D < d; D++) _[w + D] !== 0 && (g[V[_[w + D]]++] = D);
if (M = k === 0 ? (B = fe = g, 19) : k === 1 ? (B = l, Y -= 257, fe = o, be -= 257, 256) : (B = u, fe = m, -1), x = c, F = h, re = D = z = 0, E = -1, A = (ee = 1 << ($ = te)) - 1, k === 1 && 852 < ee || k === 2 && 592 < ee) return 1;
for (; ; ) {
for (H = x - re, X = g[D] < M ? (I = 0, g[D]) : g[D] > M ? (I = fe[be + g[D]], B[Y + g[D]]) : (I = 96, 0), y = 1 << x - re, c = C = 1 << $; v[F + (z >> re) + (C -= y)] = H << 24 | I << 16 | X | 0, C !== 0; ) ;
for (y = 1 << x - 1; z & y; ) y >>= 1;
if (y !== 0 ? (z &= y - 1, z += y) : z = 0, D++, --q[x] == 0) {
if (x === L) break;
x = _[w + g[D]];
}
if (te < x && (z & A) !== E) {
for (re === 0 && (re = te), F += c, W = 1 << ($ = x - re); $ + re < L && !((W -= q[$ + re]) <= 0); ) $++, W <<= 1;
if (ee += 1 << $, k === 1 && 852 < ee || k === 2 && 592 < ee) return 1;
v[E = z & A] = te << 24 | $ << 16 | F - h | 0;
}
}
return z !== 0 && (v[F + z] = x - re << 24 | 64 << 16 | 0), f.bits = te, 0;
};
}, { "../utils/common": 41 }], 51: [function(e, r, n) {
r.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" };
}, {}], 52: [function(e, r, n) {
var a = e("../utils/common"), l = 0, o = 1;
function u(p) {
for (var S = p.length; 0 <= --S; ) p[S] = 0;
}
var m = 0, k = 29, _ = 256, w = _ + 1 + k, d = 30, v = 19, h = 2 * w + 1, g = 15, f = 16, y = 7, C = 256, E = 16, A = 17, F = 18, M = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], H = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], I = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], X = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], Q = new Array(2 * (w + 2));
u(Q);
var x = new Array(2 * d);
u(x);
var D = new Array(512);
u(D);
var c = new Array(256);
u(c);
var L = new Array(k);
u(L);
var te, $, re, W = new Array(d);
function ee(p, S, j, U, T) {
this.static_tree = p, this.extra_bits = S, this.extra_base = j, this.elems = U, this.max_length = T, this.has_stree = p && p.length;
}
function z(p, S) {
this.dyn_tree = p, this.max_code = 0, this.stat_desc = S;
}
function B(p) {
return p < 256 ? D[p] : D[256 + (p >>> 7)];
}
function Y(p, S) {
p.pending_buf[p.pending++] = 255 & S, p.pending_buf[p.pending++] = S >>> 8 & 255;
}
function q(p, S, j) {
p.bi_valid > f - j ? (p.bi_buf |= S << p.bi_valid & 65535, Y(p, p.bi_buf), p.bi_buf = S >> f - p.bi_valid, p.bi_valid += j - f) : (p.bi_buf |= S << p.bi_valid & 65535, p.bi_valid += j);
}
function V(p, S, j) {
q(p, j[2 * S], j[2 * S + 1]);
}
function fe(p, S) {
for (var j = 0; j |= 1 & p, p >>>= 1, j <<= 1, 0 < --S; ) ;
return j >>> 1;
}
function be(p, S, j) {
var U, T, Z = new Array(g + 1), K = 0;
for (U = 1; U <= g; U++) Z[U] = K = K + j[U - 1] << 1;
for (T = 0; T <= S; T++) {
var G = p[2 * T + 1];
G !== 0 && (p[2 * T] = fe(Z[G]++, G));
}
}
function ae(p) {
var S;
for (S = 0; S < w; S++) p.dyn_ltree[2 * S] = 0;
for (S = 0; S < d; S++) p.dyn_dtree[2 * S] = 0;
for (S = 0; S < v; S++) p.bl_tree[2 * S] = 0;
p.dyn_ltree[2 * C] = 1, p.opt_len = p.static_len = 0, p.last_lit = p.matches = 0;
}
function ie(p) {
8 < p.bi_valid ? Y(p, p.bi_buf) : 0 < p.bi_valid && (p.pending_buf[p.pending++] = p.bi_buf), p.bi_buf = 0, p.bi_valid = 0;
}
function ge(p, S, j, U) {
var T = 2 * S, Z = 2 * j;
return p[T] < p[Z] || p[T] === p[Z] && U[S] <= U[j];
}
function me(p, S, j) {
for (var U = p.heap[j], T = j << 1; T <= p.heap_len && (T < p.heap_len && ge(S, p.heap[T + 1], p.heap[T], p.depth) && T++, !ge(S, U, p.heap[T], p.depth)); ) p.heap[j] = p.heap[T], j = T, T <<= 1;
p.heap[j] = U;
}
function xe(p, S, j) {
var U, T, Z, K, G = 0;
if (p.last_lit !== 0) for (; U = p.pending_buf[p.d_buf + 2 * G] << 8 | p.pending_buf[p.d_buf + 2 * G + 1], T = p.pending_buf[p.l_buf + G], G++, U === 0 ? V(p, T, S) : (V(p, (Z = c[T]) + _ + 1, S), (K = M[Z]) !== 0 && q(p, T -= L[Z], K), V(p, Z = B(--U), j), (K = H[Z]) !== 0 && q(p, U -= W[Z], K)), G < p.last_lit; ) ;
V(p, C, S);
}
function we(p, S) {
var j, U, T, Z = S.dyn_tree, K = S.stat_desc.static_tree, G = S.stat_desc.has_stree, J = S.stat_desc.elems, oe = -1;
for (p.heap_len = 0, p.heap_max = h, j = 0; j < J; j++) Z[2 * j] !== 0 ? (p.heap[++p.heap_len] = oe = j, p.depth[j] = 0) : Z[2 * j + 1] = 0;
for (; p.heap_len < 2; ) Z[2 * (T = p.heap[++p.heap_len] = oe < 2 ? ++oe : 0)] = 1, p.depth[T] = 0, p.opt_len--, G && (p.static_len -= K[2 * T + 1]);
for (S.max_code = oe, j = p.heap_len >> 1; 1 <= j; j--) me(p, Z, j);
for (T = J; j = p.heap[1], p.heap[1] = p.heap[p.heap_len--], me(p, Z, 1), U = p.heap[1], p.heap[--p.heap_max] = j, p.heap[--p.heap_max] = U, Z[2 * T] = Z[2 * j] + Z[2 * U], p.depth[T] = (p.depth[j] >= p.depth[U] ? p.depth[j] : p.depth[U]) + 1, Z[2 * j + 1] = Z[2 * U + 1] = T, p.heap[1] = T++, me(p, Z, 1), 2 <= p.heap_len; ) ;
p.heap[--p.heap_max] = p.heap[1], function(se, _e) {
var De, Ce, Oe, pe, Ge, tt, Se = _e.dyn_tree, Tt = _e.max_code, _n = _e.stat_desc.static_tree, wn = _e.stat_desc.has_stree, xn = _e.stat_desc.extra_bits, Bt = _e.stat_desc.extra_base, Fe = _e.stat_desc.max_length, Ve = 0;
for (pe = 0; pe <= g; pe++) se.bl_count[pe] = 0;
for (Se[2 * se.heap[se.heap_max] + 1] = 0, De = se.heap_max + 1; De < h; De++) Fe < (pe = Se[2 * Se[2 * (Ce = se.heap[De]) + 1] + 1] + 1) && (pe = Fe, Ve++), Se[2 * Ce + 1] = pe, Tt < Ce || (se.bl_count[pe]++, Ge = 0, Bt <= Ce && (Ge = xn[Ce - Bt]), tt = Se[2 * Ce], se.opt_len += tt * (pe + Ge), wn && (se.static_len += tt * (_n[2 * Ce + 1] + Ge)));
if (Ve !== 0) {
do {
for (pe = Fe - 1; se.bl_count[pe] === 0; ) pe--;
se.bl_count[pe]--, se.bl_count[pe + 1] += 2, se.bl_count[Fe]--, Ve -= 2;
} while (0 < Ve);
for (pe = Fe; pe !== 0; pe--) for (Ce = se.bl_count[pe]; Ce !== 0; ) Tt < (Oe = se.heap[--De]) || (Se[2 * Oe + 1] !== pe && (se.opt_len += (pe - Se[2 * Oe + 1]) * Se[2 * Oe], Se[2 * Oe + 1] = pe), Ce--);
}
}(p, S), be(Z, oe, p.bl_count);
}
function s(p, S, j) {
var U, T, Z = -1, K = S[1], G = 0, J = 7, oe = 4;
for (K === 0 && (J = 138, oe = 3), S[2 * (j + 1) + 1] = 65535, U = 0; U <= j; U++) T = K, K = S[2 * (U + 1) + 1], ++G < J && T === K || (G < oe ? p.bl_tree[2 * T] += G : T !== 0 ? (T !== Z && p.bl_tree[2 * T]++, p.bl_tree[2 * E]++) : G <= 10 ? p.bl_tree[2 * A]++ : p.bl_tree[2 * F]++, Z = T, oe = (G = 0) === K ? (J = 138, 3) : T === K ? (J = 6, 3) : (J = 7, 4));
}
function O(p, S, j) {
var U, T, Z = -1, K = S[1], G = 0, J = 7, oe = 4;
for (K === 0 && (J = 138, oe = 3), U = 0; U <= j; U++) if (T = K, K = S[2 * (U + 1) + 1], !(++G < J && T === K)) {
if (G < oe) for (; V(p, T, p.bl_tree), --G != 0; ) ;
else T !== 0 ? (T !== Z && (V(p, T, p.bl_tree), G--), V(p, E, p.bl_tree), q(p, G - 3, 2)) : G <= 10 ? (V(p, A, p.bl_tree), q(p, G - 3, 3)) : (V(p, F, p.bl_tree), q(p, G - 11, 7));
Z = T, oe = (G = 0) === K ? (J = 138, 3) : T === K ? (J = 6, 3) : (J = 7, 4);
}
}
u(W);
var N = !1;
function b(p, S, j, U) {
q(p, (m << 1) + (U ? 1 : 0), 3), function(T, Z, K, G) {
ie(T), Y(T, K), Y(T, ~K), a.arraySet(T.pending_buf, T.window, Z, K, T.pending), T.pending += K;
}(p, S, j);
}
n._tr_init = function(p) {
N || (function() {
var S, j, U, T, Z, K = new Array(g + 1);
for (T = U = 0; T < k - 1; T++) for (L[T] = U, S = 0; S < 1 << M[T]; S++) c[U++] = T;
for (c[U - 1] = T, T = Z = 0; T < 16; T++) for (W[T] = Z, S = 0; S < 1 << H[T]; S++) D[Z++] = T;
for (Z >>= 7; T < d; T++) for (W[T] = Z << 7, S = 0; S < 1 << H[T] - 7; S++) D[256 + Z++] = T;
for (j = 0; j <= g; j++) K[j] = 0;
for (S = 0; S <= 143; ) Q[2 * S + 1] = 8, S++, K[8]++;
for (; S <= 255; ) Q[2 * S + 1] = 9, S++, K[9]++;
for (; S <= 279; ) Q[2 * S + 1] = 7, S++, K[7]++;
for (; S <= 287; ) Q[2 * S + 1] = 8, S++, K[8]++;
for (be(Q, w + 1, K), S = 0; S < d; S++) x[2 * S + 1] = 5, x[2 * S] = fe(S, 5);
te = new ee(Q, M, _ + 1, w, g), $ = new ee(x, H, 0, d, g), re = new ee(new Array(0), I, 0, v, y);
}(), N = !0), p.l_desc = new z(p.dyn_ltree, te), p.d_desc = new z(p.dyn_dtree, $), p.bl_desc = new z(p.bl_tree, re), p.bi_buf = 0, p.bi_valid = 0, ae(p);
}, n._tr_stored_block = b, n._tr_flush_block = function(p, S, j, U) {
var T, Z, K = 0;
0 < p.level ? (p.strm.data_type === 2 && (p.strm.data_type = function(G) {
var J, oe = 4093624447;
for (J = 0; J <= 31; J++, oe >>>= 1) if (1 & oe && G.dyn_ltree[2 * J] !== 0) return l;
if (G.dyn_ltree[18] !== 0 || G.dyn_ltree[20] !== 0 || G.dyn_ltree[26] !== 0) return o;
for (J = 32; J < _; J++) if (G.dyn_ltree[2 * J] !== 0) return o;
return l;
}(p)), we(p, p.l_desc), we(p, p.d_desc), K = function(G) {
var J;
for (s(G, G.dyn_ltree, G.l_desc.max_code), s(G, G.dyn_dtree, G.d_desc.max_code), we(G, G.bl_desc), J = v - 1; 3 <= J && G.bl_tree[2 * X[J] + 1] === 0; J--) ;
return G.opt_len += 3 * (J + 1) + 5 + 5 + 4, J;
}(p), T = p.opt_len + 3 + 7 >>> 3, (Z = p.static_len + 3 + 7 >>> 3) <= T && (T = Z)) : T = Z = j + 5, j + 4 <= T && S !== -1 ? b(p, S, j, U) : p.strategy === 4 || Z === T ? (q(p, 2 + (U ? 1 : 0), 3), xe(p, Q, x)) : (q(p, 4 + (U ? 1 : 0), 3), function(G, J, oe, se) {
var _e;
for (q(G, J - 257, 5), q(G, oe - 1, 5), q(G, se - 4, 4), _e = 0; _e < se; _e++) q(G, G.bl_tree[2 * X[_e] + 1], 3);
O(G, G.dyn_ltree, J - 1), O(G, G.dyn_dtree, oe - 1);
}(p, p.l_desc.max_code + 1, p.d_desc.max_code + 1, K + 1), xe(p, p.dyn_ltree, p.dyn_dtree)), ae(p), U && ie(p);
}, n._tr_tally = function(p, S, j) {
return p.pending_buf[p.d_buf + 2 * p.last_lit] = S >>> 8 & 255, p.pending_buf[p.d_buf + 2 * p.last_lit + 1] = 255 & S, p.pending_buf[p.l_buf + p.last_lit] = 255 & j, p.last_lit++, S === 0 ? p.dyn_ltree[2 * j]++ : (p.matches++, S--, p.dyn_ltree[2 * (c[j] + _ + 1)]++, p.dyn_dtree[2 * B(S)]++), p.last_lit === p.lit_bufsize - 1;
}, n._tr_align = function(p) {
q(p, 2, 3), V(p, C, Q), function(S) {
S.bi_valid === 16 ? (Y(S, S.bi_buf), S.bi_buf = 0, S.bi_valid = 0) : 8 <= S.bi_valid && (S.pending_buf[S.pending++] = 255 & S.bi_buf, S.bi_buf >>= 8, S.bi_valid -= 8);
}(p);
};
}, { "../utils/common": 41 }], 53: [function(e, r, n) {
r.exports = function() {
this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
};
}, {}], 54: [function(e, r, n) {
(function(a) {
(function(l, o) {
if (!l.setImmediate) {
var u, m, k, _, w = 1, d = {}, v = !1, h = l.document, g = Object.getPrototypeOf && Object.getPrototypeOf(l);
g = g && g.setTimeout ? g : l, u = {}.toString.call(l.process) === "[object process]" ? function(E) {
process.nextTick(function() {
y(E);
});
} : function() {
if (l.postMessage && !l.importScripts) {
var E = !0, A = l.onmessage;
return l.onmessage = function() {
E = !1;
}, l.postMessage("", "*"), l.onmessage = A, E;
}
}() ? (_ = "setImmediate$" + Math.random() + "$", l.addEventListener ? l.addEventListener("message", C, !1) : l.attachEvent("onmessage", C), function(E) {
l.postMessage(_ + E, "*");
}) : l.MessageChannel ? ((k = new MessageChannel()).port1.onmessage = function(E) {
y(E.data);
}, function(E) {
k.port2.postMessage(E);
}) : h && "onreadystatechange" in h.createElement("script") ? (m = h.documentElement, function(E) {
var A = h.createElement("script");
A.onreadystatechange = function() {
y(E), A.onreadystatechange = null, m.removeChild(A), A = null;
}, m.appendChild(A);
}) : function(E) {
setTimeout(y, 0, E);
}, g.setImmediate = function(E) {
typeof E != "function" && (E = new Function("" + E));
for (var A = new Array(arguments.length - 1), F = 0; F < A.length; F++) A[F] = arguments[F + 1];
var M = { callback: E, args: A };
return d[w] = M, u(w), w++;
}, g.clearImmediate = f;
}
function f(E) {
delete d[E];
}
function y(E) {
if (v) setTimeout(y, 0, E);
else {
var A = d[E];
if (A) {
v = !0;
try {
(function(F) {
var M = F.callback, H = F.args;
switch (H.length) {
case 0:
M();
break;
case 1:
M(H[0]);
break;
case 2:
M(H[0], H[1]);
break;
case 3:
M(H[0], H[1], H[2]);
break;
default:
M.apply(o, H);
}
})(A);
} finally {
f(E), v = !1;
}
}
}
}
function C(E) {
E.source === l && typeof E.data == "string" && E.data.indexOf(_) === 0 && y(+E.data.slice(_.length));
}
})(typeof self > "u" ? a === void 0 ? this : a : self);
}).call(this, typeof je < "u" ? je : typeof self < "u" ? self : typeof window < "u" ? window : {});
}, {}] }, {}, [10])(10);
});
})(st);
var Lt = st.exports;
const jt = Ft(Lt);
var he;
(function(i) {
i.OfficeDocument = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", i.FontTable = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", i.Image = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", i.Numbering = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", i.Styles = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", i.StylesWithEffects = "http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects", i.Theme = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", i.Settings = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", i.WebSettings = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", i.Hyperlink = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", i.Footnotes = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", i.Endnotes = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", i.Footer = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", i.Header = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", i.ExtendedProperties = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", i.CoreProperties = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", i.CustomProperties = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/custom-properties", i.Comments = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", i.CommentsExtended = "http://schemas.microsoft.com/office/2011/relationships/commentsExtended";
})(he || (he = {}));
function Ut(i, t) {
return t.elements(i).map((e) => ({ id: t.attr(e, "Id"), type: t.attr(e, "Type"), target: t.attr(e, "Target"), targetMode: t.attr(e, "TargetMode") }));
}
const it = { wordml: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" }, de = { Dxa: { mul: 0.05, unit: "pt" }, Emu: { mul: 1 / 12700, unit: "pt" }, FontSize: { mul: 0.5, unit: "pt" }, Border: { mul: 0.125, unit: "pt" }, Point: { mul: 1, unit: "pt" }, Percent: { mul: 0.02, unit: "%" } };
function ot(i, t = de.Dxa) {
return i == null || /.+(p[xt]|[%])$/.test(i) ? i : `${(parseInt(i) * t.mul).toFixed(2)}${t.unit}`;
}
function $t(i, t = !1) {
switch (i) {
case "1":
return !0;
case "0":
return !1;
case "on":
return !0;
case "off":
return !1;
case "true":
return !0;
case "false":
return !1;
default:
return t;
}
}
function lt(i, t, e) {
if (i.namespaceURI != it.wordml) return !1;
switch (i.localName) {
case "color":
t.color = e.attr(i, "val");
break;
case "sz":
t.fontSize = e.lengthAttr(i, "val", de.FontSize);
break;
default:
return !1;
}
return !0;
}
function Ht(i, t = !1) {
t && (i = i.replace(/<[?].*[?]>/, "")), i = Zt(i);
const e = new DOMParser().parseFromString(i, "application/xml"), r = Wt(e);
if (r) throw new Error(r);
return e;
}
function Wt(i) {
var t;
return (t = i.getElementsByTagName("parsererror")[0]) == null ? void 0 : t.textContent;
}
function Zt(i) {
return i.charCodeAt(0) === 65279 ? i.substring(1) : i;
}
function Xt(i) {
return new XMLSerializer().serializeToString(i);
}
class ct {
elements(t, e = null) {
const r = [];
for (let n = 0, a = t.childNodes.length; n < a; n++) {
let l = t.childNodes.item(n);
l.nodeType == 1 && (e == null || l.localName == e) && r.push(l);
}
return r;
}
element(t, e) {
for (let r = 0, n = t.childNodes.length; r < n; r++) {
let a = t.childNodes.item(r);
if (a.nodeType == 1 && a.localName == e) return a;
}
return null;
}
elementAttr(t, e, r) {
var n = this.element(t, e);
return n ? this.attr(n, r) : void 0;
}
attrs(t) {
return Array.from(t.attributes);
}
attr(t, e) {
for (let r = 0, n = t.attributes.length; r < n; r++) {
let a = t.attributes.item(r);
if (a.localName == e) return a.value;
}
return null;
}
intAttr(t, e, r = null) {
var n = this.attr(t, e);
return n ? parseInt(n) : r;
}
hexAttr(t, e, r = null) {
var n = this.attr(t, e);
return n ? parseInt(n, 16) : r;
}
floatAttr(t, e, r = null) {
var n = this.attr(t, e);
return n ? parseFloat(n) : r;
}
boolAttr(t, e, r = null) {
return $t(this.attr(t, e), r);
}
lengthAttr(t, e, r = de.Dxa) {
return ot(this.attr(t, e), r);
}
}
const P = new ct();
class ke {
constructor(t, e) {
this._package = t, this.path = e;
}
load() {
return ve(this, null, function* () {
this.rels = yield this._package.loadRelationships(this.path);
const t = yield this._package.load(this.path), e = this._package.parseXmlDocument(t);
this._package.options.keepOrigin && (this._xmlDocument = e), this.parseXml(e.firstElementChild);
});
}
save() {
this._package.update(this.path, Xt(this._xmlDocument));
}
parseXml(t) {
}
}
const Gt = { embedRegular: "regular", embedBold: "bold", embedItalic: "italic", embedBoldItalic: "boldItalic" };
function Vt(i, t) {
return t.elements(i).map((e) => qt(e, t));
}
function qt(i, t) {
let e = { name: t.attr(i, "name"), embedFontRefs: [] };
for (let r of t.elements(i)) switch (r.localName) {
case "family":
e.family = t.attr(r, "val");
break;
case "altName":
e.altName = t.attr(r, "val");
break;
case "embedRegular":
case "embedBold":
case "embedItalic":
case "embedBoldItalic":
e.embedFontRefs.push(Kt(r, t));
break;
}
return e;
}
function Kt(i, t) {
return { id: t.attr(i, "id"), key: t.attr(i, "fontKey"), type: Gt[i.localName] };
}
class Jt extends ke {
parseXml(t) {
this.fonts = Vt(t, this._package.xmlParser);
}
}
function Yt(i) {
return i == null ? void 0 : i.replace(/[ .]+/g, "-").replace(/[&]+/g, "and").toLowerCase();
}
function $e(i) {
let t = i.lastIndexOf("/") + 1, e = t == 0 ? "" : i.substring(0, t), r = t == 0 ? i : i.substring(t);
return [e, r];
}
function qe(i, t) {
try {
const e = "http://docx/";
return new URL(i, e + t).toString().substring(e.length);
} catch {
return `${t}${i}`;
}
}
function Pe(i, t) {
return i.reduce((e, r) => (e[t(r)] = r, e), {});
}
function Qt(i) {
return new Promise((t, e) => {
const r = new FileReader();
r.onloadend = () => t(r.result), r.onerror = () => e(), r.readAsDataURL(i);
});
}
function Ke(i) {
return i && typeof i == "object" && !Array.isArray(i);
}
function er(i) {
return typeof i == "string" || i instanceof String;
}
function He(i, ...t) {
var e;
if (!t.length) return i;
const r = t.shift();
if (Ke(i) && Ke(r)) for (const n in r) if (Ke(r[n])) {
const a = (e = i[n]) != null ? e : i[n] = {};
He(a, r[n]);
} else i[n] = r[n];
return He(i, ...t);
}
function Ne(i) {
return Array.isArray(i) ? i : [i];
}
class Je {
constructor(t, e) {
this._zip = t, this.options = e, this.xmlParser = new ct();
}
get(t) {
var e;
const r = tr(t);
return (e = this._zip.files[r]) != null ? e : this._zip.files[r.replace(/\//g, "\\")];
}
update(t, e) {
this._zip.file(t, e);
}
static load(t, e) {
return ve(this, null, function* () {
const r = yield jt.loadAsync(t);
return new Je(r, e);
});
}
save(t = "blob") {
return this._zip.generateAsync({ type: t });
}
load(t, e = "string") {
var r, n;
return (n = (r = this.get(t)) == null ? void 0 : r.async(e)) != null ? n : Promise.resolve(null);
}
loadRelationships(t = null) {
return ve(this, null, function* () {
let e = "_rels/.rels";
if (t != null) {
const [n, a] = $e(t);
e = `${n}_rels/${a}.rels`;
}
const r = yield this.load(e);
return r ? Ut(this.parseXmlDocument(r).firstElementChild, this.xmlParser) : null;
});
}
parseXmlDocument(t) {
return Ht(t, this.options.trimXmlDeclaration);
}
}
function tr(i) {
return i.startsWith("/") ? i.substr(1) : i;
}
class rr extends ke {
constructor(t, e, r) {
super(t, e), this._documentParser = r;
}
parseXml(t) {
this.body = this._documentParser.parseDocumentFile(t);
}
}
function We(i, t) {
return { type: t.attr(i, "val"), color: t.attr(i, "color"), size: t.lengthAttr(i, "sz", de.Border), offset: t.lengthAttr(i, "space", de.Point), frame: t.boolAttr(i, "frame"), shadow: t.boolAttr(i, "shadow") };
}
function nr(i, t) {
var e = {};
for (let r of t.elements(i)) switch (r.localName) {
case "left":
e.left = We(r, t);
break;
case "top":
e.top = We(r, t);
break;
case "right":
e.right = We(r, t);
break;
case "bottom":
e.bottom = We(r, t);
break;
}
return e;
}
var ut;
(function(i) {
i.Continuous = "continuous", i.NextPage = "nextPage", i.NextColumn = "nextColumn", i.EvenPage = "evenPage", i.OddPage = "oddPage";
})(ut || (ut = {}));
function ht(i, t = P) {
var e, r, n = {};
for (let a of t.elements(i)) switch (a.localName) {
case "pgSz":
n.pageSize = { width: t.lengthAttr(a, "w"), height: t.lengthAttr(a, "h"), orientation: t.attr(a, "orient") };
break;
case "type":
n.type = t.attr(a, "val");
break;
case "pgMar":
n.pageMargins = { left: t.lengthAttr(a, "left"), right: t.lengthAttr(a, "right"), top: t.lengthAttr(a, "top"), bottom: t.lengthAttr(a, "bottom"), header: t.lengthAttr(a, "header"), footer: t.lengthAttr(a, "footer"), gutter: t.lengthAttr(a, "gutter") };
break;
case "cols":
n.columns = ar(a, t);
break;
case "headerReference":
((e = n.headerRefs) != null ? e : n.headerRefs = []).push(dt(a, t));
break;
case "footerReference":
((r = n.footerRefs) != null ? r : n.footerRefs = []).push(dt(a, t));
break;
case "titlePg":
n.titlePage = t.boolAttr(a, "val", !0);
break;
case "pgBorders":
n.pageBorders = nr(a, t);
break;
case "pgNumType":
n.pageNumber = sr(a, t);
break;
}
return n;
}
function ar(i, t) {
return { numberOfColumns: t.intAttr(i, "num"), space: t.lengthAttr(i, "space"), separator: t.boolAttr(i, "sep"), equalWidth: t.boolAttr(i, "equalWidth", !0), columns: t.elements(i, "col").map((e) => ({ width: t.lengthAttr(e, "w"), space: t.lengthAttr(e, "space") })) };
}
function sr(i, t) {
return { chapSep: t.attr(i, "chapSep"), chapStyle: t.attr(i, "chapStyle"), format: t.attr(i, "fmt"), start: t.intAttr(i, "start") };
}
function dt(i, t) {
return { id: t.attr(i, "id"), type: t.attr(i, "type") };
}
function ir(i, t) {
return { before: t.lengthAttr(i, "before"), after: t.lengthAttr(i, "after"), line: t.intAttr(i, "line"), lineRule: t.attr(i, "lineRule") };
}
function Ye(i, t) {
let e = {};
for (let r of t.elements(i)) or(r, e, t);
return e;
}
function or(i, t, e) {
return !!lt(i, t, e);
}
function ft(i, t) {
let e = {};
for (let r of t.elements(i)) mt(r, e, t);
return e;
}
function mt(i, t, e) {
if (i.namespaceURI != it.wordml) return !1;
if (lt(i, t, e)) return !0;
switch (i.localName) {
case "tabs":
t.tabs = lr(i, e);
break;
case "sectPr":
t.sectionProps = ht(i, e);
break;
case "numPr":
t.numbering = cr(i, e);
break;
case "spacing":
return t.lineSpacing = ir(i, e), !1;
case "textAlignment":
return t.textAlignment = e.attr(i, "val"), !1;
case "keepLines":
t.keepLines = e.boolAttr(i, "val", !0);
break;
case "keepNext":
t.keepNext = e.boolAttr(i, "val", !0);
break;
case "pageBreakBefore":
t.pageBreakBefore = e.boolAttr(i, "val", !0);
break;
case "outlineLvl":
t.outlineLevel = e.intAttr(i, "val");
break;
case "pStyle":
t.styleName = e.attr(i, "val");
break;
case "rPr":
t.runProps = Ye(i, e);
break;
default:
return !1;
}
return !0;
}
function lr(i, t) {
return t.elements(i, "tab").map((e) => ({ position: t.lengthAttr(e, "pos"), leader: t.attr(e, "leader"), style: t.attr(e, "val") }));
}
function cr(i, t) {
var e = {};
for (let r of t.elements(i)) switch (r.localName) {
case "numId":
e.id = t.attr(r, "val");
break;
case "ilvl":
e.level = t.intAttr(r, "val");
break;
}
return e;
}
function ur(i, t) {
let e = { numberings: [], abstractNumberings: [], bulletPictures: [] };
for (let r of t.elements(i)) switch (r.localName) {
case "num":
e.numberings.push(hr(r, t));
break;
case "abstractNum":
e.abstractNumberings.push(dr(r, t));
break;
case "numPicBullet":
e.bulletPictures.push(mr(r, t));
break;
}
return e;
}
function hr(i, t) {
let e = { id: t.attr(i, "numId"), overrides: [] };
for (let r of t.elements(i)) switch (r.localName) {
case "abstractNumId":
e.abstractId = t.attr(r, "val");
break;
case "lvlOverride":
e.overrides.push(fr(r, t));
break;
}
return e;
}
function dr(i, t) {
let e = { id: t.attr(i, "abstractNumId"), levels: [] };
for (let r of t.elements(i)) switch (r.localName) {
case "name":
e.name = t.attr(r, "val");
break;
case "multiLevelType":
e.multiLevelType = t.attr(r, "val");
break;
case "numStyleLink":
e.numberingStyleLink = t.attr(r, "val");
break;
case "styleLink":
e.styleLink = t.attr(r, "val");
break;
case "lvl":
e.levels.push(pt(r, t));
break;
}
return e;
}
function pt(i, t) {
let e = { level: t.intAttr(i, "ilvl") };
for (let r of t.elements(i)) switch (r.localName) {
case "start":
e.start = t.attr(r, "val");
break;
case "lvlRestart":
e.restart = t.intAttr(r, "val");
break;
case "numFmt":
e.format = t.attr(r, "val");
break;
case "lvlText":
e.text = t.attr(r, "val");
break;
case "lvlJc":
e.justification = t.attr(r, "val");
break;
case "lvlPicBulletId":
e.bulletPictureId = t.attr(r, "val");
break;
case "pStyle":
e.paragraphStyle = t.attr(r, "val");
break;
case "pPr":
e.paragraphProps = ft(r, t);
break;
case "rPr":
e.runProps = Ye(r, t);
break;
}
return e;
}
function fr(i, t) {
let e = { level: t.intAttr(i, "ilvl") };
for (let r of t.elements(i)) switch (r.localName) {
case "startOverride":
e.start = t.intAttr(r, "val");
break;
case "lvl":
e.numberingLevel = pt(r, t);
break;
}
return e;
}
function mr(i, t) {
var e = t.element(i, "pict"), r = e && t.element(e, "shape"), n = r && t.element(r, "imagedata");
return n ? { id: t.attr(i, "numPicBulletId"), referenceId: t.attr(n, "id"), style: t.attr(r, "style") } : null;
}
class pr extends ke {
constructor(t, e, r) {
super(t, e), this._documentParser = r;
}
parseXml(t) {
Object.assign(this, ur(t, this._package.xmlParser)), this.domNumberings = this._documentParser.parseNumberingFile(t);
}
}
class gr extends ke {
constructor(t, e, r) {
super(t, e), this._documentParser = r;
}
parseXml(t) {
this.styles = this._documentParser.parseStylesFile(t);
}
}
var R;
(function(i) {
i.Document = "document", i.Paragraph = "paragraph", i.Run = "run", i.Break = "break", i.NoBreakHyphen = "noBreakHyphen", i.Table = "table", i.Row = "row", i.Cell = "cell", i.Hyperlink = "hyperlink", i.SmartTag = "smartTag", i.Drawing = "drawing", i.Image = "image", i.Text = "text", i.Tab = "tab", i.Symbol = "symbol", i.BookmarkStart = "bookmarkStart", i.BookmarkEnd = "bookmarkEnd", i.Footer = "footer", i.Header = "header", i.FootnoteReference = "footnoteReference", i.EndnoteReference = "endnoteReference", i.Footnote = "footnote", i.Endnote = "endnote", i.SimpleField = "simpleField", i.ComplexField = "complexField", i.Instruction = "instruction", i.VmlPicture = "vmlPicture", i.MmlMath = "mmlMath", i.MmlMathParagraph = "mmlMathParagraph", i.MmlFraction = "mmlFraction", i.MmlFunction = "mmlFunction", i.MmlFunctionName = "mmlFunctionName", i.MmlNumerator = "mmlNumerator", i.MmlDenominator = "mmlDenominator", i.MmlRadical = "mmlRadical", i.MmlBase = "mmlBase", i.MmlDegree = "mmlDegree", i.MmlSuperscript = "mmlSuperscript", i.MmlSubscript = "mmlSubscript", i.MmlPreSubSuper = "mmlPreSubSuper", i.MmlSubArgument = "mmlSubArgument", i.MmlSuperArgument = "mmlSuperArgument", i.MmlNary = "mmlNary", i.MmlDelimiter = "mmlDelimiter", i.MmlRun = "mmlRun", i.MmlEquationArray = "mmlEquationArray", i.MmlLimit = "mmlLimit", i.MmlLimitLower = "mmlLimitLower", i.MmlMatrix = "mmlMatrix", i.MmlMatrixRow = "mmlMatrixRow", i.MmlBox = "mmlBox", i.MmlBar = "mmlBar", i.MmlGroupChar = "mmlGroupChar", i.VmlElement = "vmlElement", i.Inserted = "inserted", i.Deleted = "deleted", i.DeletedText = "deletedText", i.Comment = "comment", i.CommentReference = "commentReference", i.CommentRangeStart = "commentRangeStart", i.CommentRangeEnd = "commentRangeEnd";
})(R || (R = {}));
class Ae {
constructor() {
this.children = [], this.cssStyle = {};
}
}
class br extends Ae {
constructor() {
super(...arguments), this.type = R.Header;
}
}
class yr extends Ae {
constructor() {
super(...arguments), this.type = R.Footer;
}
}
class gt extends ke {
constructor(t, e, r) {
super(t, e), this._documentParser = r;
}
parseXml(t) {
this.rootElement = this.createRootElement(), this.rootElement.children = this._documentParser.parseBodyElements(t);
}
}
class vr extends gt {
createRootElement() {
return new br();
}
}
class kr extends gt {
createRootElement() {
return new yr();
}
}
function _r(i, t) {
const e = {};
for (let r of t.elements(i)) switch (r.localName) {
case "Template":
e.template = r.textContent;
break;
case "Pages":
e.pages = Ie(r.textContent);
break;
case "Words":
e.words = Ie(r.textContent);
break;
case "Characters":
e.characters = Ie(r.textContent);
break;
case "Application":
e.application = r.textContent;
break;
case "Lines":
e.lines = Ie(r.textContent);
break;
case "Paragraphs":
e.paragraphs = Ie(r.textContent);
break;
case "Company":
e.company = r.textContent;
break;
case "AppVersion":
e.appVersion = r.textContent;
break;
}
return e;
}
function Ie(i) {
if (typeof i < "u") return parseInt(i);
}
class wr extends ke {
parseXml(t) {
this.props = _r(t, this._package.xmlParser);
}
}
function xr(i, t) {
const e = {};
for (let r of t.elements(i)) switch (r.localName) {
case "title":
e.title = r.textContent;
break;
case "description":
e.description = r.textContent;
break;
case "subject":
e.subject = r.textContent;
break;
case "creator":
e.creator = r.textContent;
break;
case "keywords":
e.keywords = r.textContent;
break;
case "language":
e.language = r.textContent;
break;
case "lastModifiedBy":
e.lastModifiedBy = r.textContent;
break;
case "revision":
r.textContent && (e.revision = parseInt(r.textContent));
break;
}
return e;
}
class Cr extends ke {
parseXml(t) {
this.props = xr(t, this._package.xmlParser);
}
}
class Sr {
}
function Pr(i, t) {
var e = new Sr(), r = t.element(i, "themeElements");
for (let n of t.elements(r)) switch (n.localName) {
case "clrScheme":
e.colorScheme = Ar(n, t);
break;
case "fontScheme":
e.fontScheme = Er(n, t);
break;
}
return e;
}
function Ar(i, t) {
var e = { name: t.attr(i, "name"), colors: {} };
for (let a of t.elements(i)) {
var r = t.element(a, "srgbClr"), n = t.element(a, "sysClr");
r ? e.colors[a.localName] = t.attr(r, "val") : n && (e.colors[a.localName] = t.attr(n, "lastClr"));
}
return e;
}
function Er(i, t) {
var e = { name: t.attr(i, "name") };
for (let r of t.elements(i)) switch (r.localName) {
case "majorFont":
e.majorFont = bt(r, t);
break;
case "minorFont":
e.minorFont = bt(r, t);
break;
}
return e;
}
function bt(i, t) {
return { latinTypeface: t.elementAttr(i, "latin", "typeface"), eaTypeface: t.elementAttr(i, "ea", "typeface"), csTypeface: t.elementAttr(i, "cs", "typeface") };
}
class Tr extends ke {
constructor(t, e) {
super(t, e);
}
parseXml(t) {
this.theme = Pr(t, this._package.xmlParser);
}
}
class yt {
}
class Br extends yt {
constructor() {
super(...arguments), this.type = R.Footnote;
}
}
class Rr extends yt {
constructor() {
super(...arguments), this.type = R.Endnote;
}
}
class vt extends ke {
constructor(t, e, r) {
super(t, e), this._documentParser = r;
}
}
class zr extends vt {
constructor(t, e, r) {
super(t, e, r);
}
parseXml(t) {
this.notes = this._documentParser.parseNotes(t, "footnote", Br);
}
}
class Nr extends vt {
constructor(t, e, r) {
super(t, e, r);
}
parseXml(t) {
this.notes = this._documentParser.parseNotes(t, "endnote", Rr);
}
}
function Ir(i, t) {
var e = {};
for (let r of t.elements(i)) switch (r.localName) {
case "defaultTabStop":
e.defaultTabStop = t.lengthAttr(r, "val");
break;
case "footnotePr":
e.footnoteProps = kt(r, t);
break;
case "endnotePr":
e.endnoteProps = kt(r, t);
break;
case "autoHyphenation":
e.autoHyphenation = t.boolAttr(r, "val");
break;
}
return e;
}
function kt(i, t) {
var e = { defaultNoteIds: [] };
for (let r of t.elements(i)) switch (r.localName) {
case "numFmt":
e.nummeringFormat = t.attr(r, "val");
break;
case "footnote":
case "endnote":
e.defaultNoteIds.push(t.attr(r, "id"));
break;
}
return e;
}
class Mr extends ke {
constructor(t, e) {
super(t, e);
}
parseXml(t) {
this.settings = Ir(t, this._package.xmlParser);
}
}
function Dr(i, t) {
return t.elements(i, "property").map((e) => {
const r = e.firstChild;
return { formatId: t.attr(e, "fmtid"), name: t.attr(e, "name"), type: r.nodeName, value: r.textContent };
});
}
class Or extends ke {
parseXml(t) {
this.props = Dr(t, this._package.xmlParser);
}
}
class Fr extends ke {
constructor(t, e, r) {
super(t, e), this._documentParser = r;
}
parseXml(t) {
this.comments = this._documentParser.parseComments(t), this.commentMap = Pe(this.comments, (e) => e.id);
}
}
class Lr extends ke {
constructor(t, e) {
super(t, e), this.comments = [];
}
parseXml(t) {
const e = this._package.xmlParser;
for (let r of e.elements(t, "commentEx")) this.comments.push({ paraId: e.attr(r, "paraId"), paraIdParent: e.attr(r, "paraIdParent"), done: e.boolAttr(r, "done") });
this.commentMap = Pe(this.comments, (r) => r.paraId);
}
}
const jr = [{ type: he.OfficeDocument, target: "word/document.xml" }, { type: he.ExtendedProperties, target: "docProps/app.xml" }, { type: he.CoreProperties, target: "docProps/core.xml" }, { type: he.CustomProperties, target: "docProps/custom.xml" }];
class Qe {
constructor() {
this.parts = [], this.partsMap = {};
}
static load(t, e, r) {
return ve(this, null, function* () {
var n = new Qe();
return n._options = r, n._parser = e, n._package = yield Je.load(t, r), n.rels = yield n._package.loadRelationships(), yield Promise.all(jr.map((a) => {
var l;
const o = (l = n.rels.find((u) => u.type === a.type)) != null ? l : a;
return n.loadRelationshipPart(o.target, o.type);
})), n;
});
}
save(t = "blob") {
return this._package.save(t);
}
loadRelationshipPart(t, e) {
return ve(this, null, function* () {
var r;
if (this.partsMap[t]) return this.partsMap[t];
if (!this._package.get(t)) return null;
let n = null;
switch (e) {
case he.OfficeDocument:
this.documentPart = n = new rr(this._package, t, this._parser);
break;
case he.FontTable:
this.fontTablePart = n = new Jt(this._package, t);
break;
case he.Numbering:
this.numberingPart = n = new pr(this._package, t, this._parser);
break;
case he.Styles:
this.stylesPart = n = new gr(this._package, t, this._parser);
break;
case he.Theme:
this.themePart = n = new Tr(this._package, t);
break;
case he.Footnotes:
this.footnotesPart = n = new zr(this._package, t, this._parser);
break;
case he.Endnotes:
this.endnotesPart = n = new Nr(this._package, t, this._parser);
break;
case he.Footer:
n = new kr(this._package, t, this._parser);
break;
case he.Header:
n = new vr(this._package, t, this._parser);
break;
case he.CoreProperties:
this.corePropsPart = n = new Cr(this._package, t);
break;
case he.ExtendedProperties:
this.extendedPropsPart = n = new wr(this._package, t);
break;
case he.CustomProperties:
n = new Or(this._package, t);
break;
case he.Settings:
this.settingsPart = n = new Mr(this._package, t);
break;
case he.Comments:
this.commentsPart = n = new Fr(this._package, t, this._parser);
break;
case he.CommentsExtended:
this.commentsExtendedPart = n = new Lr(this._package, t);
break;
}
if (n == null) return Promise.resolve(null);
if (this.partsMap[t] = n, this.parts.push(n), yield n.load(), ((r = n.rels) == null ? void 0 : r.length) > 0) {
const [a] = $e(n.path);
yield Promise.all(n.rels.map((l) => this.loadRelationshipPart(qe(l.target, a), l.type)));
}
return n;
});
}
loadDocumentImage(t, e) {
return ve(this, null, function* () {
const r = yield this.loadResource(e ?? this.documentPart, t, "blob");
return this.blobToURL(r);
});
}
loadNumberingImage(t) {
return ve(this, null, function* () {
const e = yield this.loadResource(this.numberingPart, t, "blob");
return this.blobToURL(e);
});
}
loadFont(t, e) {
return ve(this, null, function* () {
const r = yield this.loadResource(this.fontTablePart, t, "uint8array");
return r && this.blobToURL(new Blob([Ur(r, e)]));
});
}
blobToURL(t) {
return t ? this._options.useBase64URL ? Qt(t) : URL.createObjectURL(t) : null;
}
findPartByRelId(t, e = null) {
var r, n = ((r = e.rels) != null ? r : this.rels).find((l) => l.id == t);
const a = e ? $e(e.path)[0] : "";
return n ? this.partsMap[qe(n.target, a)] : null;
}
getPathById(t, e) {
const r = t.rels.find((a) => a.id == e), [n] = $e(t.path);
return r ? qe(r.target, n) : null;
}
loadResource(t, e, r) {
const n = this.getPathById(t, e);
return n ? this._package.load(n, r) : Promise.resolve(null);
}
}
function Ur(i, t) {
const e = t.replace(/{|}|-/g, ""), r = new Array(16);
for (let n = 0; n < 16; n++) r[16 - n - 1] = parseInt(e.substr(n * 2, 2), 16);
for (let n = 0; n < 32; n++) i[n] = i[n] ^ r[n % 16];
return i;
}
function $r(i, t) {
return { type: R.BookmarkStart, id: t.attr(i, "id"), name: t.attr(i, "name"), colFirst: t.intAttr(i, "colFirst"), colLast: t.intAttr(i, "colLast") };
}
function Hr(i, t) {
return { type: R.BookmarkEnd, id: t.attr(i, "id") };
}
class Wr extends Ae {
constructor() {
super(...arguments), this.type = R.VmlElement, this.attrs = {};
}
}
function _t(i, t) {
var e = new Wr();
switch (i.localName) {
case "rect":
e.tagName = "rect", Object.assign(e.attrs, { width: "100%", height: "100%" });
break;
case "oval":
e.tagName = "ellipse", Object.assign(e.attrs, { cx: "50%", cy: "50%", rx: "50%", ry: "50%" });
break;
case "line":
e.tagName = "line";
break;
case "shape":
e.tagName = "g";
break;
case "textbox":
e.tagName = "foreignObject", Object.assign(e.attrs, { width: "100%", height: "100%" });
break;
default:
return null;
}
for (const r of P.attrs(i)) switch (r.localName) {
case "style":
e.cssStyleText = r.value;
break;
case "fillcolor":
e.attrs.fill = r.value;
break;
case "from":
const [n, a] = wt(r.value);
Object.assign(e.attrs, { x1: n, y1: a });
break;
case "to":
const [l, o] = wt(r.value);
Object.assign(e.attrs, { x2: l, y2: o });
break;
}
for (const r of P.elements(i)) switch (r.localName) {
case "stroke":
Object.assign(e.attrs, Zr(r));
break;
case "fill":
Object.assign(e.attrs, Xr());
break;
case "imagedata":
e.tagName = "image", Object.assign(e.attrs, { width: "100%", height: "100%" }), e.imageHref = { id: P.attr(r, "id"), title: P.attr(r, "title") };
break;
case "txbxContent":
e.children.push(...t.parseBodyElements(r));
break;
default:
const n = _t(r, t);
n && e.children.push(n);
break;
}
return e;
}
function Zr(i) {
var t;
return { stroke: P.attr(i, "color"), "stroke-width": (t = P.lengthAttr(i, "weight", de.Emu)) != null ? t : "1px" };
}
function Xr(i) {
return {};
}
function wt(i) {
return i.split(",");
}
class Gr extends Ae {
constructor() {
super(...arguments), this.type = R.Comment;
}
}
class Vr extends Ae {
constructor(t) {
super(), this.id = t, this.type = R.CommentReference;
}
}
class qr extends Ae {
constructor(t) {
super(), this.id = t, this.type = R.CommentRangeStart;
}
}
class Kr extends Ae {
constructor(t) {
super(), this.id = t, this.type = R.CommentRangeEnd;
}
}
var Ze = { shd: "inherit", color: "black", borderColor: "black", highlight: "transparent" };
const Jr = [], xt = { oMath: R.MmlMath, oMathPara: R.MmlMathParagraph, f: R.MmlFraction, func: R.MmlFunction, fName: R.MmlFunctionName, num: R.MmlNumerator, den: R.MmlDenominator, rad: R.MmlRadical, deg: R.MmlDegree, e: R.MmlBase, sSup: R.MmlSuperscript, sSub: R.MmlSubscript, sPre: R.MmlPreSubSuper, sup: R.MmlSuperArgument, sub: R.MmlSubArgument, d: R.MmlDelimiter, nary: R.MmlNary, eqArr: R.MmlEquationArray, lim: R.MmlLimit, limLow: R.MmlLimitLower, m: R.MmlMatrix, mr: R.MmlMatrixRow, box: R.MmlBox, bar: R.MmlBar, groupChr: R.MmlGroupChar };
class Yr {
constructor(t) {
this.options = ye({ ignoreWidth: !1, debug: !1 }, t);
}
parseNotes(t, e, r) {
var n = [];
for (let a of P.elements(t, e)) {
const l = new r();
l.id = P.attr(a, "id"), l.noteType = P.attr(a, "type"), l.children = this.parseBodyElements(a), n.push(l);
}
return n;
}
parseComments(t) {
var e = [];
for (let r of P.elements(t, "comment")) {
const n = new Gr();
n.id = P.attr(r, "id"), n.author = P.attr(r, "author"), n.initials = P.attr(r, "initials"), n.date = P.attr(r, "date"), n.children = this.parseBodyElements(r), e.push(n);
}
return e;
}
parseDocumentFile(t) {
var e = P.element(t, "body"), r = P.element(t, "background"), n = P.element(e, "sectPr");
return { type: R.Document, children: this.parseBodyElements(e), props: n ? ht(n, P) : {}, cssStyle: r ? this.parseBackground(r) : {} };
}
parseBackground(t) {
var e = {}, r = ue.colorAttr(t, "color");
return r && (e["background-color"] = r), e;
}
parseBodyElements(t) {
var e = [];
for (let r of P.elements(t)) switch (r.localName) {
case "p":
e.push(this.parseParagraph(r));
break;
case "tbl":
e.push(this.parseTable(r));
break;
case "sdt":
e.push(...this.parseSdt(r, (n) => this.parseBodyElements(n)));
break;
}
return e;
}
parseStylesFile(t) {
var e = [];
return ue.foreach(t, (r) => {
switch (r.localName) {
case "style":
e.push(this.parseStyle(r));
break;
case "docDefaults":
e.push(this.parseDefaultStyles(r));
break;
}
}), e;
}
parseDefaultStyles(t) {
var e = { id: null, name: null, target: null, basedOn: null, styles: [] };
return ue.foreach(t, (r) => {
switch (r.localName) {
case "rPrDefault":
var n = P.element(r, "rPr");
n && e.styles.push({ target: "span", values: this.parseDefaultProperties(n, {}) });
break;
case "pPrDefault":
var a = P.element(r, "pPr");
a && e.styles.push({ target: "p", values: this.parseDefaultProperties(a, {}) });
break;
}
}), e;
}
parseStyle(t) {
var e = { id: P.attr(t, "styleId"), isDefault: P.boolAttr(t, "default"), name: null, target: null, basedOn: null, styles: [], linked: null };
switch (P.attr(t, "type")) {
case "paragraph":
e.target = "p";
break;
case "table":
e.target = "table";
break;
case "character":
e.target = "span";
break;
}
return ue.foreach(t, (r) => {
switch (r.localName) {
case "basedOn":
e.basedOn = P.attr(r, "val");
break;
case "name":
e.name = P.attr(r, "val");
break;
case "link":
e.linked = P.attr(r, "val");
break;
case "next":
e.next = P.attr(r, "val");
break;
case "aliases":
e.aliases = P.attr(r, "val").split(",");
break;
case "pPr":
e.styles.push({ target: "p", values: this.parseDefaultProperties(r, {}) }), e.paragraphProps = ft(r, P);
break;
case "rPr":
e.styles.push({ target: "span", values: this.parseDefaultProperties(r, {}) }), e.runProps = Ye(r, P);
break;
case "tblPr":
case "tcPr":
e.styles.push({ target: "td", values: this.parseDefaultProperties(r, {}) });
break;
case "tblStylePr":
for (let n of this.parseTableStyle(r)) e.styles.push(n);
break;
case "rsid":
case "qFormat":
case "hidden":
case "semiHidden":
case "unhideWhenUsed":
case "autoRedefine":
case "uiPriority":
break;
default:
this.options.debug && console.warn(`DOCX: Unknown style element: ${r.localName}`);
}
}), e;
}
parseTableStyle(t) {
var e = [], r = P.attr(t, "type"), n = "", a = "";
switch (r) {
case "firstRow":
a = ".first-row", n = "tr.first-row td";
break;
case "lastRow":
a = ".last-row", n = "tr.last-row td";
break;
case "firstCol":
a = ".first-col", n = "td.first-col";
break;
case "lastCol":
a = ".last-col", n = "td.last-col";
break;
case "band1Vert":
a = ":not(.no-vband)", n = "td.odd-col";
break;
case "band2Vert":
a = ":not(.no-vband)", n = "td.even-col";
break;
case "band1Horz":
a = ":not(.no-hband)", n = "tr.odd-row";
break;
case "band2Horz":
a = ":not(.no-hband)", n = "tr.even-row";
break;
default:
return [];
}
return ue.foreach(t, (l) => {
switch (l.localName) {
case "pPr":
e.push({ target: `${n} p`, mod: a, values: this.parseDefaultProperties(l, {}) });
break;
case "rPr":
e.push({ target: `${n} span`, mod: a, values: this.parseDefaultProperties(l, {}) });
break;
case "tblPr":
case "tcPr":
e.push({ target: n, mod: a, values: this.parseDefaultProperties(l, {}) });
break;
}
}), e;
}
parseNumberingFile(t) {
var e = [], r = {}, n = [];
return ue.foreach(t, (a) => {
switch (a.localName) {
case "abstractNum":
this.parseAbstractNumbering(a, n).forEach((u) => e.push(u));
break;
case "numPicBullet":
n.push(this.parseNumberingPicBullet(a));
break;
case "num":
var l = P.attr(a, "numId"), o = P.elementAttr(a, "abstractNumId", "val");
r[o] = l;
break;
}
}), e.forEach((a) => a.id = r[a.id]), e;
}
parseNumberingPicBullet(t) {
var e = P.element(t, "pict"), r = e && P.element(e, "shape"), n = r && P.element(r, "imagedata");
return n ? { id: P.intAttr(t, "numPicBulletId"), src: P.attr(n, "id"), style: P.attr(r, "style") } : null;
}
parseAbstractNumbering(t, e) {
var r = [], n = P.attr(t, "abstractNumId");
return ue.foreach(t, (a) => {
switch (a.localName) {
case "lvl":
r.push(this.parseNumberingLevel(n, a, e));
break;
}
}), r;
}
parseNumberingLevel(t, e, r) {
var n = { id: t, level: P.intAttr(e, "ilvl"), start: 1, pStyleName: void 0, pStyle: {}, rStyle: {}, suff: "tab" };
return ue.foreach(e, (a) => {
switch (a.localName) {
case "start":
n.start = P.intAttr(a, "val");
break;
case "pPr":
this.parseDefaultProperties(a, n.pStyle);
break;
case "rPr":
this.parseDefaultProperties(a, n.rStyle);
break;
case "lvlPicBulletId":
var l = P.intAttr(a, "val");
n.bullet = r.find((o) => (o == null ? void 0 : o.id) == l);
break;
case "lvlText":
n.levelText = P.attr(a, "val");
break;
case "pStyle":
n.pStyleName = P.attr(a, "val");
break;
case "numFmt":
n.format = P.attr(a, "val");
break;
case "suff":
n.suff = P.attr(a, "val");
break;
}
}), n;
}
parseSdt(t, e) {
const r = P.element(t, "sdtContent");
return r ? e(r) : [];
}
parseInserted(t, e) {
var r, n;
return { type: R.Inserted, children: (n = (r = e(t)) == null ? void 0 : r.children) != null ? n : [] };
}
parseDeleted(t, e) {
var r, n;
return { type: R.Deleted, children: (n = (r = e(t)) == null ? void 0 : r.children) != null ? n : [] };
}
parseParagraph(t) {
var e = { type: R.Paragraph, children: [] };
for (let r of P.elements(t)) switch (r.localName) {
case "pPr":
this.parseParagraphProperties(r, e);
break;
case "r":
e.children.push(this.parseRun(r, e));
break;
case "hyperlink":
e.children.push(this.parseHyperlink(r, e));
break;
case "smartTag":
e.children.push(this.parseSmartTag(r, e));
break;
case "bookmarkStart":
e.children.push($r(r, P));
break;
case "bookmarkEnd":
e.children.push(Hr(r, P));
break;
case "commentRangeStart":
e.children.push(new qr(P.attr(r, "id")));
break;
case "commentRangeEnd":
e.children.push(new Kr(P.attr(r, "id")));
break;
case "oMath":
case "oMathPara":
e.children.push(this.parseMathElement(r));
break;
case "sdt":
e.children.push(...this.parseSdt(r, (n) => this.parseParagraph(n).children));
break;
case "ins":
e.children.push(this.parseInserted(r, (n) => this.parseParagraph(n)));
break;
case "del":
e.children.push(this.parseDeleted(r, (n) => this.parseParagraph(n)));
break;
}
return e;
}
parseParagraphProperties(t, e) {
this.parseDefaultProperties(t, e.cssStyle = {}, null, (r) => {
if (mt(r, e, P)) return !0;
switch (r.localName) {
case "pStyle":
e.styleName = P.attr(r, "val");
break;
case "cnfStyle":
e.className = le.classNameOfCnfStyle(r);
break;
case "framePr":
this.parseFrame(r, e);
break;
case "rPr":
break;
default:
return !1;
}
return !0;
});
}
parseFrame(t, e) {
var r = P.attr(t, "dropCap");
r == "drop" && (e.cssStyle.float = "left");
}
parseHyperlink(t, e) {
var r = { type: R.Hyperlink, parent: e, children: [] }, n = P.attr(t, "anchor"), a = P.attr(t, "id");
return n && (r.href = "#" + n), a && (r.id = a), ue.foreach(t, (l) => {
switch (l.localName) {
case "r":
r.children.push(this.parseRun(l, r));
break;
}
}), r;
}
parseSmartTag(t, e) {
var r = { type: R.SmartTag, parent: e, children: [] }, n = P.attr(t, "uri"), a = P.attr(t, "element");
return n && (r.uri = n), a && (r.element = a), ue.foreach(t, (l) => {
switch (l.localName) {
case "r":
r.children.push(this.parseRun(l, r));
break;
}
}), r;
}
parseRun(t, e) {
var r = { type: R.Run, parent: e, children: [] };
return ue.foreach(t, (n) => {
switch (n = this.checkAlternateContent(n), n.localName) {
case "t":
r.children.push({ type: R.Text, text: n.textContent });
break;
case "delText":
r.children.push({ type: R.DeletedText, text: n.textContent });
break;
case "commentReference":
r.children.push(new Vr(P.attr(n, "id")));
break;
case "fldSimple":
r.children.push({ type: R.SimpleField, instruction: P.attr(n, "instr"), lock: P.boolAttr(n, "lock", !1), dirty: P.boolAttr(n, "dirty", !1) });
break;
case "instrText":
r.fieldRun = !0, r.children.push({ type: R.Instruction, text: n.textContent });
break;
case "fldChar":
r.fieldRun = !0, r.children.push({ type: R.ComplexField, charType: P.attr(n, "fldCharType"), lock: P.boolAttr(n, "lock", !1), dirty: P.boolAttr(n, "dirty", !1) });
break;
case "noBreakHyphen":
r.children.push({ type: R.NoBreakHyphen });
break;
case "br":
r.children.push({ type: R.Break, break: P.attr(n, "type") || "textWrapping" });
break;
case "lastRenderedPageBreak":
r.children.push({ type: R.Break, break: "lastRenderedPageBreak" });
break;
case "sym":
r.children.push({ type: R.Symbol, font: P.attr(n, "font"), char: P.attr(n, "char") });
break;
case "tab":
r.children.push({ type: R.Tab });
break;
case "footnoteReference":
r.children.push({ type: R.FootnoteReference, id: P.attr(n, "id") });
break;
case "endnoteReference":
r.children.push({ type: R.EndnoteReference, id: P.attr(n, "id") });
break;
case "drawing":
let a = this.parseDrawing(n);
a && (r.children = [a]);
break;
case "pict":
r.children.push(this.parseVmlPicture(n));
break;
case "rPr":
this.parseRunProperties(n, r);
break;
}
}), r;
}
parseMathElement(t) {
const e = `${t.localName}Pr`, r = { type: xt[t.localName], children: [] };
for (const a of P.elements(t)) if (xt[a.localName]) r.children.push(this.parseMathElement(a));
else if (a.localName == "r") {
var n = this.parseRun(a);
n.type = R.MmlRun, r.children.push(n);
} else a.localName == e && (r.props = this.parseMathProperies(a));
return r;
}
parseMathProperies(t) {
const e = {};
for (const r of P.elements(t)) switch (r.localName) {
case "chr":
e.char = P.attr(r, "val");
break;
case "vertJc":
e.verticalJustification = P.attr(r, "val");
break;
case "pos":
e.position = P.attr(r, "val");
break;
case "degHide":
e.hideDegree = P.boolAttr(r, "val");
break;
case "begChr":
e.beginChar = P.attr(r, "val");
break;
case "endChr":
e.endChar = P.attr(r, "val");
break;
}
return e;
}
parseRunProperties(t, e) {
this.parseDefaultProperties(t, e.cssStyle = {}, null, (r) => {
switch (r.localName) {
case "rStyle":
e.styleName = P.attr(r, "val");
break;
case "vertAlign":
e.verticalAlign = le.valueOfVertAlign(r, !0);
break;
default:
return !1;
}
return !0;
});
}
parseVmlPicture(t) {
const e = { type: R.VmlPicture, children: [] };
for (const r of P.elements(t)) {
const n = _t(r, this);
n && e.children.push(n);
}
return e;
}
checkAlternateContent(t) {
var e;
if (t.localName != "AlternateContent") return t;
var r = P.element(t, "Choice");
if (r) {
var n = P.attr(r, "Requires"), a = t.lookupNamespaceURI(n);
if (Jr.includes(a)) return r.firstElementChild;
}
return (e = P.element(t, "Fallback")) == null ? void 0 : e.firstElementChild;
}
parseDrawing(t) {
for (var e of P.elements(t)) switch (e.localName) {
case "inline":
case "anchor":
return this.parseDrawingWrapper(e);
}
}
parseDrawingWrapper(t) {
var e, r = { type: R.Drawing, children: [], cssStyle: {} }, n = t.localName == "anchor";
let a = null, l = P.boolAttr(t, "simplePos");
P.boolAttr(t, "behindDoc");
let o = { relative: "page", align: "left", offset: "0" }, u = { relative: "page", align: "top", offset: "0" };
for (var m of P.elements(t)) switch (m.localName) {
case "simplePos":
l && (o.offset = P.lengthAttr(m, "x", de.Emu), u.offset = P.lengthAttr(m, "y", de.Emu));
break;
case "extent":
r.cssStyle.width = P.lengthAttr(m, "cx", de.Emu), r.cssStyle.height = P.lengthAttr(m, "cy", de.Emu);
break;
case "positionH":
case "positionV":
if (!l) {
let d = m.localName == "positionH" ? o : u;
var k = P.element(m, "align"), _ = P.element(m, "posOffset");
d.relative = (e = P.attr(m, "relativeFrom")) != null ? e : d.relative, k && (d.align = k.textContent), _ && (d.offset = ue.sizeValue(_, de.Emu));
}
break;
case "wrapTopAndBottom":
a = "wrapTopAndBottom";
break;
case "wrapNone":
a = "wrapNone";
break;
case "graphic":
var w = this.parseGraphic(m);
w && r.children.push(w);
break;
}
return a == "wrapTopAndBottom" ? (r.cssStyle.display = "block", o.align && (r.cssStyle["text-align"] = o.align, r.cssStyle.width = "100%")) : a == "wrapNone" ? (r.cssStyle.display = "block", r.cssStyle.position = "relative", r.cssStyle.width = "0px", r.cssStyle.height = "0px", o.offset && (r.cssStyle.left = o.offset), u.offset && (r.cssStyle.top = u.offset)) : n && (o.align == "left" || o.align == "right") && (r.cssStyle.float = o.align), r;
}
parseGraphic(t) {
var e = P.element(t, "graphicData");
for (let r of P.elements(e)) switch (r.localName) {
case "pic":
return this.parsePicture(r);
}
return null;
}
parsePicture(t) {
var e = { type: R.Image, src: "", cssStyle: {} }, r = P.element(t, "blipFill"), n = P.element(r, "blip");
e.src = P.attr(n, "embed");
var a = P.element(t, "spPr"), l = P.element(a, "xfrm");
e.cssStyle.position = "relative";
for (var o of P.elements(l)) switch (o.localName) {
case "ext":
e.cssStyle.width = P.lengthAttr(o, "cx", de.Emu), e.cssStyle.height = P.lengthAttr(o, "cy", de.Emu);
break;
case "off":
e.cssStyle.left = P.lengthAttr(o, "x", de.Emu), e.cssStyle.top = P.lengthAttr(o, "y", de.Emu);
break;
}
return e;
}
parseTable(t) {
var e = { type: R.Table, children: [] };
return ue.foreach(t, (r) => {
switch (r.localName) {
case "tr":
e.children.push(this.parseTableRow(r));
break;
case "tblGrid":
e.columns = this.parseTableColumns(r);
break;
case "tblPr":
this.parseTableProperties(r, e);
break;
}
}), e;
}
parseTableColumns(t) {
var e = [];
return ue.foreach(t, (r) => {
switch (r.localName) {
case "gridCol":
e.push({ width: P.lengthAttr(r, "w") });
break;
}
}), e;
}
parseTableProperties(t, e) {
switch (e.cssStyle = {}, e.cellStyle = {}, this.parseDefaultProperties(t, e.cssStyle, e.cellStyle, (r) => {
switch (r.localName) {
case "tblStyle":
e.styleName = P.attr(r, "val");
break;
case "tblLook":
e.className = le.classNameOftblLook(r);
break;
case "tblpPr":
this.parseTablePosition(r, e);
break;
case "tblStyleColBandSize":
e.colBandSize = P.intAttr(r, "val");
break;
case "tblStyleRowBandSize":
e.rowBandSize = P.intAttr(r, "val");
break;
default:
return !1;
}
return !0;
}), e.cssStyle["text-align"]) {
case "center":
delete e.cssStyle["text-align"], e.cssStyle["margin-left"] = "auto", e.cssStyle["margin-right"] = "auto";
break;
case "right":
delete e.cssStyle["text-align"], e.cssStyle["margin-left"] = "auto";
break;
}
}
parseTablePosition(t, e) {
var r = P.lengthAttr(t, "topFromText"), n = P.lengthAttr(t, "bottomFromText"), a = P.lengthAttr(t, "rightFromText"), l = P.lengthAttr(t, "leftFromText");
e.cssStyle.float = "left", e.cssStyle["margin-bottom"] = le.addSize(e.cssStyle["margin-bottom"], n), e.cssStyle["margin-left"] = le.addSize(e.cssStyle["margin-left"], l), e.cssStyle["margin-right"] = le.addSize(e.cssStyle["margin-right"], a), e.cssStyle["margin-top"] = le.addSize(e.cssStyle["margin-top"], r);
}
parseTableRow(t) {
var e = { type: R.Row, children: [] };
return ue.foreach(t, (r) => {
switch (r.localName) {
case "tc":
e.children.push(this.parseTableCell(r));
break;
case "trPr":
this.parseTableRowProperties(r, e);
break;
}
}), e;
}
parseTableRowProperties(t, e) {
e.cssStyle = this.parseDefaultProperties(t, {}, null, (r) => {
switch (r.localName) {
case "cnfStyle":
e.className = le.classNameOfCnfStyle(r);
break;
case "tblHeader":
e.isHeader = P.boolAttr(r, "val");
break;
default:
return !1;
}
return !0;
});
}
parseTableCell(t) {
var e = { type: R.Cell, children: [] };
return ue.foreach(t, (r) => {
switch (r.localName) {
case "tbl":
e.children.push(this.parseTable(r));
break;
case "p":
e.children.push(this.parseParagraph(r));
break;
case "tcPr":
this.parseTableCellProperties(r, e);
break;
}
}), e;
}
parseTableCellProperties(t, e) {
e.cssStyle = this.parseDefaultProperties(t, {}, null, (r) => {
var n;
switch (r.localName) {
case "gridSpan":
e.span = P.intAttr(r, "val", null);
break;
case "vMerge":
e.verticalMerge = (n = P.attr(r, "val")) != null ? n : "continue";
break;
case "cnfStyle":
e.className = le.classNameOfCnfStyle(r);
break;
default:
return !1;
}
return !0;
});
}
parseDefaultProperties(t, e = null, r = null, n = null) {
return e = e || {}, ue.foreach(t, (a) => {
if (!(n != null && n(a))) switch (a.localName) {
case "jc":
e["text-align"] = le.valueOfJc(a);
break;
case "textAlignment":
e["vertical-align"] = le.valueOfTextAlignment(a);
break;
case "color":
e.color = ue.colorAttr(a, "val", null, Ze.color);
break;
case "sz":
e["font-size"] = e["min-height"] = P.lengthAttr(a, "val", de.FontSize);
break;
case "shd":
e["background-color"] = ue.colorAttr(a, "fill", null, Ze.shd);
break;
case "highlight":
e["background-color"] = ue.colorAttr(a, "val", null, Ze.highlight);
break;
case "vertAlign":
break;
case "position":
e.verticalAlign = P.lengthAttr(a, "val", de.FontSize);
break;
case "tcW":
if (this.options.ignoreWidth) break;
case "tblW":
e.width = le.valueOfSize(a, "w");
break;
case "trHeight":
this.parseTrHeight(a, e);
break;
case "strike":
e["text-decoration"] = P.boolAttr(a, "val", !0) ? "line-through" : "none";
break;
case "b":
e["font-weight"] = P.boolAttr(a, "val", !0) ? "bold" : "normal";
break;
case "i":
e["font-style"] = P.boolAttr(a, "val", !0) ? "italic" : "normal";
break;
case "caps":
e["text-transform"] = P.boolAttr(a, "val", !0) ? "uppercase" : "none";
break;
case "smallCaps":
e["font-variant"] = P.boolAttr(a, "val", !0) ? "small-caps" : "none";
break;
case "u":
this.parseUnderline(a, e);
break;
case "ind":
case "tblInd":
this.parseIndentation(a, e);
break;
case "rFonts":
this.parseFont(a, e);
break;
case "tblBorders":
this.parseBorderProperties(a, r || e);
break;
case "tblCellSpacing":
e["border-spacing"] = le.valueOfMargin(a), e["border-collapse"] = "separate";
break;
case "pBdr":
this.parseBorderProperties(a, e);
break;
case "bdr":
e.border = le.valueOfBorder(a);
break;
case "tcBorders":
this.parseBorderProperties(a, e);
break;
case "vanish":
P.boolAttr(a, "val", !0) && (e.display = "none");
break;
case "kern":
break;
case "noWrap":
break;
case "tblCellMar":
case "tcMar":
this.parseMarginProperties(a, r || e);
break;
case "tblLayout":
e["table-layout"] = le.valueOfTblLayout(a);
break;
case "vAlign":
e["vertical-align"] = le.valueOfTextAlignment(a);
break;
case "spacing":
t.localName == "pPr" && this.parseSpacing(a, e);
break;
case "wordWrap":
P.boolAttr(a, "val") && (e["overflow-wrap"] = "break-word");
break;
case "suppressAutoHyphens":
e.hyphens = P.boolAttr(a, "val", !0) ? "none" : "auto";
break;
case "lang":
e.$lang = P.attr(a, "val");
break;
case "bCs":
case "iCs":
case "szCs":
case "tabs":
case "outlineLvl":
case "contextualSpacing":
case "tblStyleColBandSize":
case "tblStyleRowBandSize":
case "webHidden":
case "pageBreakBefore":
case "suppressLineNumbers":
case "keepLines":
case "keepNext":
case "widowControl":
case "bidi":
case "rtl":
case "noProof":
break;
default:
this.options.debug && console.warn(`DOCX: Unknown document element: ${t.localName}.${a.localName}`);
break;
}
}), e;
}
parseUnderline(t, e) {
var r = P.attr(t, "val");
if (r != null) {
switch (r) {
case "dash":
case "dashDotDotHeavy":
case "dashDotHeavy":
case "dashedHeavy":
case "dashLong":
case "dashLongHeavy":
case "dotDash":
case "dotDotDash":
e["text-decoration"] = "underline dashed";
break;
case "dotted":
case "dottedHeavy":
e["text-decoration"] = "underline dotted";
break;
case "double":
e["text-decoration"] = "underline double";
break;
case "single":
case "thick":
e["text-decoration"] = "underline";
break;
case "wave":
case "wavyDouble":
case "wavyHeavy":
e["text-decoration"] = "underline wavy";
break;
case "words":
e["text-decoration"] = "underline";
break;
case "none":
e["text-decoration"] = "none";
break;
}
var n = ue.colorAttr(t, "color");
n && (e["text-decoration-color"] = n);
}
}
parseFont(t, e) {
var r = P.attr(t, "ascii"), n = le.themeValue(t, "asciiTheme"), a = [r, n].filter((l) => l).join(", ");
a.length > 0 && (e["font-family"] = a);
}
parseIndentation(t, e) {
var r = P.lengthAttr(t, "firstLine"), n = P.lengthAttr(t, "hanging"), a = P.lengthAttr(t, "left"), l = P.lengthAttr(t, "start"), o = P.lengthAttr(t, "right"), u = P.lengthAttr(t, "end");
r && (e["text-indent"] = r), n && (e["text-indent"] = `-${n}`), (a || l) && (e["margin-left"] = a || l), (o || u) && (e["margin-right"] = o || u);
}
parseSpacing(t, e) {
var r = P.lengthAttr(t, "before"), n = P.lengthAttr(t, "after"), a = P.intAttr(t, "line", null), l = P.attr(t, "lineRule");
if (r && (e["margin-top"] = r), n && (e["margin-bottom"] = n), a !== null) switch (l) {
case "auto":
e["line-height"] = `${(a / 240).toFixed(2)}`;
break;
case "atLeast":
e["line-height"] = `calc(100% + ${a / 20}pt)`;
break;
default:
e["line-height"] = e["min-height"] = `${a / 20}pt`;
break;
}
}
parseMarginProperties(t, e) {
ue.foreach(t, (r) => {
switch (r.localName) {
case "left":
e["padding-left"] = le.valueOfMargin(r);
break;
case "right":
e["padding-right"] = le.valueOfMargin(r);
break;
case "top":
e["padding-top"] = le.valueOfMargin(r);
break;
case "bottom":
e["padding-bottom"] = le.valueOfMargin(r);
break;
}
});
}
parseTrHeight(t, e) {
switch (P.attr(t, "hRule")) {
case "exact":
e.height = P.lengthAttr(t, "val");
break;
case "atLeast":
default:
e.height = P.lengthAttr(t, "val");
break;
}
}
parseBorderProperties(t, e) {
ue.foreach(t, (r) => {
switch (r.localName) {
case "start":
case "left":
e["border-left"] = le.valueOfBorder(r);
break;
case "end":
case "right":
e["border-right"] = le.valueOfBorder(r);
break;
case "top":
e["border-top"] = le.valueOfBorder(r);
break;
case "bottom":
e["border-bottom"] = le.valueOfBorder(r);
break;
}
});
}
}
const Qr = ["black", "blue", "cyan", "darkBlue", "darkCyan", "darkGray", "darkGreen", "darkMagenta", "darkRed", "darkYellow", "green", "lightGray", "magenta", "none", "red", "white", "yellow"];
class ue {
static foreach(t, e) {
for (var r = 0; r < t.childNodes.length; r++) {
let n = t.childNodes[r];
n.nodeType == Node.ELEMENT_NODE && e(n);
}
}
static colorAttr(t, e, r = null, n = "black") {
var a = P.attr(t, e);
if (a) return a == "auto" ? n : Qr.includes(a) ? a : `#${a}`;
var l = P.attr(t, "themeColor");
return l ? `var(--docx-${l}-color)` : r;
}
static sizeValue(t, e = de.Dxa) {
return ot(t.textContent, e);
}
}
class le {
static themeValue(t, e) {
var r = P.attr(t, e);
return r ? `var(--docx-${r}-font)` : null;
}
static valueOfSize(t, e) {
var r = de.Dxa;
switch (P.attr(t, "type")) {
case "dxa":
break;
case "pct":
r = de.Percent;
break;
case "auto":
return "auto";
}
return P.lengthAttr(t, e, r);
}
static valueOfMargin(t) {
return P.lengthAttr(t, "w");
}
static valueOfBorder(t) {
var e = P.attr(t, "val");
if (e == "nil") return "none";
var r = ue.colorAttr(t, "color"), n = P.lengthAttr(t, "sz", de.Border);
return `${n} solid ${r == "auto" ? Ze.borderColor : r}`;
}
static valueOfTblLayout(t) {
var e = P.attr(t, "val");
return e == "fixed" ? "fixed" : "auto";
}
static classNameOfCnfStyle(t) {
const e = P.attr(t, "val");
return ["first-row", "last-row", "first-col", "last-col", "odd-col", "even-col", "odd-row", "even-row", "ne-cell", "nw-cell", "se-cell", "sw-cell"].filter((r, n) => e[n] == "1").join(" ");
}
static valueOfJc(t) {
var e = P.attr(t, "val");
switch (e) {
case "start":
case "left":
return "left";
case "center":
return "center";
case "end":
case "right":
return "right";
case "both":
return "justify";
}
return e;
}
static valueOfVertAlign(t, e = !1) {
var r = P.attr(t, "val");
switch (r) {
case "subscript":
return "sub";
case "superscript":
return e ? "sup" : "super";
}
return e ? null : r;
}
static valueOfTextAlignment(t) {
var e = P.attr(t, "val");
switch (e) {
case "auto":
case "baseline":
return "baseline";
case "top":
return "top";
case "center":
return "middle";
case "bottom":
return "bottom";
}
return e;
}
static addSize(t, e) {
return t == null ? e : e == null ? t : `calc(${t} + ${e})`;
}
static classNameOftblLook(t) {
const e = P.hexAttr(t, "val", 0);
let r = "";
return (P.boolAttr(t, "firstRow") || e & 32) && (r += " first-row"), (P.boolAttr(t, "lastRow") || e & 64) && (r += " last-row"), (P.boolAttr(t, "firstColumn") || e & 128) && (r += " first-col"), (P.boolAttr(t, "lastColumn") || e & 256) && (r += " last-col"), (P.boolAttr(t, "noHBand") || e & 512) && (r += " no-hband"), (P.boolAttr(t, "noVBand") || e & 1024) && (r += " no-vband"), r.trim();
}
}
const Ct = { pos: 0, leader: "none", style: "left" }, en = 50;
function tn(i = document.body) {
const t = document.createElement("div");
t.style.width = "100pt", i.appendChild(t);
const e = 100 / t.offsetWidth;
return i.removeChild(t), e;
}
function rn(i, t, e, r = 72 / 96) {
const n = i.closest("p"), a = i.getBoundingClientRect(), l = n.getBoundingClientRect(), o = getComputedStyle(n), u = (t == null ? void 0 : t.length) > 0 ? t.map((y) => ({ pos: St(y.position), leader: y.leader, style: y.style })).sort((y, C) => y.pos - C.pos) : [Ct], m = u[u.length - 1], k = l.width * r, _ = St(e);
let w = m.pos + _;
if (w < k) for (; w < k && u.length < en; w += _) u.push(Le(ye({}, Ct), { pos: w }));
const d = parseFloat(o.marginLeft), v = l.left + d, h = (a.left - v) * r, g = u.find((y) => y.style != "clear" && y.pos > h);
if (g == null) return;
let f = 1;
if (g.style == "right" || g.style == "center") {
const y = Array.from(n.querySelectorAll(`.${i.className}`)), C = y.indexOf(i) + 1, E = document.createRange();
E.setStart(i, 1), C < y.length ? E.setEndBefore(y[C]) : E.setEndAfter(n);
const A = g.style == "center" ? 0.5 : 1, F = E.getBoundingClientRect(), M = F.left + A * F.width - (l.left - d);
f = g.pos - M * r;
} else f = g.pos - h;
switch (i.innerHTML = " ", i.style.textDecoration = "inherit", i.style.wordSpacing = `${f.toFixed(0)}pt`, g.leader) {
case "dot":
case "middleDot":
i.style.textDecoration = "underline", i.style.textDecorationStyle = "dotted";
break;
case "hyphen":
case "heavy":
case "underscore":
i.style.textDecoration = "underline";
break;
}
}
function St(i) {
return parseFloat(i);
}
const ne = { svg: "http://www.w3.org/2000/svg", mathML: "http://www.w3.org/1998/Math/MathML" };
class nn {
constructor(t) {
this.htmlDocument = t, this.className = "docx", this.styleMap = {}, this.currentPart = null, this.tableVerticalMerges = [], this.currentVerticalMerge = null, this.tableCellPositions = [], this.currentCellPosition = null, this.footnoteMap = {}, this.endnoteMap = {}, this.currentEndnoteIds = [], this.usedHederFooterParts = [], this.currentTabs = [], this.tabsTimeout = 0, this.commentMap = {}, this.tasks = [], this.postRenderTasks = [], this.createElement = Ee;
}
render(t, e, r = null, n) {
var a;
this.document = t, this.options = n, this.className = n.className, this.rootSelector = n.inWrapper ? `.${this.className}-wrapper` : ":root", this.styleMap = null, this.tasks = [], this.options.renderComments && globalThis.Highlight && (this.commentHighlight = new Highlight()), r = r || e, At(r), At(e), Me(r, "docxjs library predefined styles"), r.appendChild(this.renderDefaultStyle()), t.themePart && (Me(r, "docxjs document theme values"), this.renderTheme(t.themePart, r)), t.stylesPart != null && (this.styleMap = this.processStyles(t.stylesPart.styles), Me(r, "docxjs document styles"), r.appendChild(this.renderStyles(t.stylesPart.styles))), t.numberingPart && (this.prodessNumberings(t.numberingPart.domNumberings), Me(r, "docxjs document numbering styles"), r.appendChild(this.renderNumbering(t.numberingPart.domNumberings, r))), t.footnotesPart && (this.footnoteMap = Pe(t.footnotesPart.notes, (o) => o.id)), t.endnotesPart && (this.endnoteMap = Pe(t.endnotesPart.notes, (o) => o.id)), t.settingsPart && (this.defaultTabSize = (a = t.settingsPart.settings) == null ? void 0 : a.defaultTabStop), !n.ignoreFonts && t.fontTablePart && this.renderFontTable(t.fontTablePart, r);
var l = this.renderSections(t.documentPart.body);
this.options.inWrapper ? e.appendChild(this.renderWrapper(l)) : et(e, l), this.commentHighlight && n.renderComments && CSS.highlights.set(`${this.className}-comments`, this.commentHighlight), this.refreshTabStops(), this.postRenderTasks.forEach((o) => o());
}
renderTheme(t, e) {
var r, n;
const a = {}, l = (r = t.theme) == null ? void 0 : r.fontScheme;
l && (l.majorFont && (a["--docx-majorHAnsi-font"] = l.majorFont.latinTypeface), l.minorFont && (a["--docx-minorHAnsi-font"] = l.minorFont.latinTypeface));
const o = (n = t.theme) == null ? void 0 : n.colorScheme;
if (o) for (let [m, k] of Object.entries(o.colors)) a[`--docx-${m}-color`] = `#${k}`;
const u = this.styleToString(`.${this.className}`, a);
e.appendChild(Te(u));
}
renderFontTable(t, e) {
for (let r of t.fonts) for (let n of r.embedFontRefs) this.tasks.push(this.document.loadFont(n.id, n.key).then((a) => {
const l = { "font-family": r.name, src: `url(${a})` };
(n.type == "bold" || n.type == "boldItalic") && (l["font-weight"] = "bold"), (n.type == "italic" || n.type == "boldItalic") && (l["font-style"] = "italic"), Me(e, `docxjs ${r.name} font`);
const o = this.styleToString("@font-face", l);
e.appendChild(Te(o)), this.refreshTabStops();
}));
}
processStyleName(t) {
return t ? `${this.className}_${Yt(t)}` : this.className;
}
processStyles(t) {
const e = Pe(t.filter((n) => n.id != null), (n) => n.id);
for (const n of t.filter((a) => a.basedOn)) {
var r = e[n.basedOn];
if (r) {
n.paragraphProps = He(n.paragraphProps, r.paragraphProps), n.runProps = He(n.runProps, r.runProps);
for (const a of r.styles) {
const l = n.styles.find((o) => o.target == a.target);
l ? this.copyStyleProperties(a.values, l.values) : n.styles.push(Le(ye({}, a), { values: ye({}, a.values) }));
}
} else this.options.debug && console.warn(`Can't find base style ${n.basedOn}`);
}
for (let n of t) n.cssName = this.processStyleName(n.id);
return e;
}
prodessNumberings(t) {
var e;
for (let r of t.filter((n) => n.pStyleName)) {
const n = this.findStyle(r.pStyleName);
(e = n == null ? void 0 : n.paragraphProps) != null && e.numbering && (n.paragraphProps.numbering.level = r.level);
}
}
processElement(t) {
if (t.children) for (var e of t.children) e.parent = t, e.type == R.Table ? this.processTable(e) : this.processElement(e);
}
processTable(t) {
for (var e of t.children) for (var r of e.children) r.cssStyle = this.copyStyleProperties(t.cellStyle, r.cssStyle, ["border-left", "border-right", "border-top", "border-bottom", "padding-left", "padding-right", "padding-top", "padding-bottom"]), this.processElement(r);
}
copyStyleProperties(t, e, r = null) {
if (!t) return e;
e == null && (e = {}), r == null && (r = Object.getOwnPropertyNames(t));
for (var n of r) t.hasOwnProperty(n) && !e.hasOwnProperty(n) && (e[n] = t[n]);
return e;
}
createPageElement(t, e) {
var r = this.createElement("section", { className: t });
return e && (e.pageMargins && (r.style.paddingLeft = e.pageMargins.left, r.style.paddingRight = e.pageMargins.right, r.style.paddingTop = e.pageMargins.top, r.style.paddingBottom = e.pageMargins.bottom), e.pageSize && (this.options.ignoreWidth || (r.style.width = e.pageSize.width), this.options.ignoreHeight || (r.style.minHeight = e.pageSize.height))), r;
}
createSectionContent(t) {
var e = this.createElement("article");
return t.columns && t.columns.numberOfColumns && (e.style.columnCount = `${t.columns.numberOfColumns}`, e.style.columnGap = t.columns.space, t.columns.separator && (e.style.columnRule = "1px solid black")), e;
}
renderSections(t) {
const e = [];
this.processElement(t);
const r = this.splitBySection(t.children, t.props), n = this.groupByPageBreaks(r);
let a = null;
for (let o = 0, u = n.length; o < u; o++) {
this.currentFootnoteIds = [];
let m = n[o][0].sectProps;
const k = this.createPageElement(this.className, m);
this.renderStyleValues(t.cssStyle, k), this.options.renderHeaders && this.renderHeaderFooter(m.headerRefs, m, e.length, a != m, k);
for (const _ of n[o]) {
var l = this.createSectionContent(_.sectProps);
this.renderElements(_.elements, l), k.appendChild(l), m = _.sectProps;
}
this.options.renderFootnotes && this.renderNotes(this.currentFootnoteIds, this.footnoteMap, k), this.options.renderEndnotes && o == u - 1 && this.renderNotes(this.currentEndnoteIds, this.endnoteMap, k), this.options.renderFooters && this.renderHeaderFooter(m.footerRefs, m, e.length, a != m, k), e.push(k), a = m;
}
return e;
}
renderHeaderFooter(t, e, r, n, a) {
var l, o;
if (t) {
var u = (o = (l = e.titlePage && n ? t.find((k) => k.type == "first") : null) != null ? l : r % 2 == 1 ? t.find((k) => k.type == "even") : null) != null ? o : t.find((k) => k.type == "default"), m = u && this.document.findPartByRelId(u.id, this.document.documentPart);
if (m) {
this.currentPart = m, this.usedHederFooterParts.includes(m.path) || (this.processElement(m.rootElement), this.usedHederFooterParts.push(m.path));
const [k] = this.renderElements([m.rootElement], a);
e != null && e.pageMargins && (m.rootElement.type === R.Header ? (k.style.marginTop = `calc(${e.pageMargins.header} - ${e.pageMargins.top})`, k.style.minHeight = `calc(${e.pageMargins.top} - ${e.pageMargins.header})`) : m.rootElement.type === R.Footer && (k.style.marginBottom = `calc(${e.pageMargins.footer} - ${e.pageMargins.bottom})`, k.style.minHeight = `calc(${e.pageMargins.bottom} - ${e.pageMargins.footer})`)), this.currentPart = null;
}
}
}
isPageBreakElement(t) {
return t.type != R.Break ? !1 : t.break == "lastRenderedPageBreak" ? !this.options.ignoreLastRenderedPageBreak : t.break == "page";
}
isPageBreakSection(t, e) {
var r, n, a, l, o, u;
return !t || !e ? !1 : ((r = t.pageSize) == null ? void 0 : r.orientation) != ((n = e.pageSize) == null ? void 0 : n.orientation) || ((a = t.pageSize) == null ? void 0 : a.width) != ((l = e.pageSize) == null ? void 0 : l.width) || ((o = t.pageSize) == null ? void 0 : o.height) != ((u = e.pageSize) == null ? void 0 : u.height);
}
splitBySection(t, e) {
var r, n = { sectProps: null, elements: [], pageBreak: !1 }, a = [n];
for (let w of t) {
if (w.type == R.Paragraph) {
const d = this.findStyle(w.styleName);
(r = d == null ? void 0 : d.paragraphProps) != null && r.pageBreakBefore && (n.sectProps = l, n.pageBreak = !0, n = { sectProps: null, elements: [], pageBreak: !1 }, a.push(n));
}
if (n.elements.push(w), w.type == R.Paragraph) {
const d = w;
var l = d.sectionProps, o = -1, u = -1;
if (this.options.breakPages && d.children && (o = d.children.findIndex((v) => {
var h, g;
return u = (g = (h = v.children) == null ? void 0 : h.findIndex(this.isPageBreakElement.bind(this))) != null ? g : -1, u != -1;
})), (l || o != -1) && (n.sectProps = l, n.pageBreak = o != -1, n = { sectProps: null, elements: [], pageBreak: !1 }, a.push(n)), o != -1) {
let v = d.children[o], h = u < v.children.length - 1;
if (o < d.children.length - 1 || h) {
var m = w.children, k = Le(ye({}, w), { children: m.slice(o) });
if (w.children = m.slice(0, o), n.elements.push(k), h) {
let g = v.children, f = Le(ye({}, v), { children: g.slice(0, u) });
w.children.push(f), v.children = g.slice(u);
}
}
}
}
}
let _ = null;
for (let w = a.length - 1; w >= 0; w--) a[w].sectProps == null ? a[w].sectProps = _ ?? e : _ = a[w].sectProps;
return a;
}
groupByPageBreaks(t) {
let e = [], r;
const n = [e];
for (let a of t) e.push(a), (this.options.ignoreLastRenderedPageBreak || a.pageBreak || this.isPageBreakSection(r, a.sectProps)) && n.push(e = []), r = a.sectProps;
return n.filter((a) => a.length > 0);
}
renderWrapper(t) {
return this.createElement("div", { className: `${this.className}-wrapper` }, t);
}
renderDefaultStyle() {
var t = this.className, e = `
.${t}-wrapper { background: gray; padding: 30px; padding-bottom: 0px; display: flex; flex-flow: column; align-items: center; }
.${t}-wrapper>section.${t} { background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); margin-bottom: 30px; }
.${t} { color: black; hyphens: auto; text-underline-position: from-font; }
section.${t} { box-sizing: border-box; display: flex; flex-flow: column nowrap; position: relative; overflow: hidden; }
section.${t}>article { margin-bottom: auto; z-index: 1; }
section.${t}>footer { z-index: 1; }
.${t} table { border-collapse: collapse; }
.${t} table td, .${t} table th { vertical-align: top; }
.${t} p { margin: 0pt; min-height: 1em; }
.${t} span { white-space: pre-wrap; overflow-wrap: break-word; }
.${t} a { color: inherit; text-decoration: inherit; }
.${t} svg { fill: transparent; }
`;
return this.options.renderComments && (e += `
.${t}-comment-ref { cursor: default; }
.${t}-comment-popover { display: none; z-index: 1000; padding: 0.5rem; background: white; position: absolute; box-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.25); width: 30ch; }
.${t}-comment-ref:hover~.${t}-comment-popover { display: block; }
.${t}-comment-author,.${t}-comment-date { font-size: 0.875rem; color: #888; }
`), Te(e);
}
renderNumbering(t, e) {
var r = "", n = [];
for (var a of t) {
var l = `p.${this.numberingClass(a.id, a.level)}`, o = "none";
if (a.bullet) {
let u = `--${this.className}-${a.bullet.src}`.toLowerCase();
r += this.styleToString(`${l}:before`, { content: "' '", display: "inline-block", background: `var(${u})` }, a.bullet.style), this.tasks.push(this.document.loadNumberingImage(a.bullet.src).then((m) => {
var k = `${this.rootSelector} { ${u}: url(${m}) }`;
e.appendChild(Te(k));
}));
} else if (a.levelText) {
let u = this.numberingCounter(a.id, a.level);
const m = u + " " + (a.start - 1);
a.level > 0 && (r += this.styleToString(`p.${this.numberingClass(a.id, a.level - 1)}`, { "counter-reset": m })), n.push(m), r += this.styleToString(`${l}:before`, ye({ content: this.levelTextToContent(a.levelText, a.suff, a.id, this.numFormatToCssValue(a.format)), "counter-increment": u }, a.rStyle));
} else o = this.numFormatToCssValue(a.format);
r += this.styleToString(l, ye({ display: "list-item", "list-style-position": "inside", "list-style-type": o }, a.pStyle));
}
return n.length > 0 && (r += this.styleToString(this.rootSelector, { "counter-reset": n.join(" ") })), Te(r);
}
renderStyles(t) {
var e, r = "";
const n = this.styleMap, a = Pe(t.filter((m) => m.isDefault), (m) => m.target);
for (const m of t) {
var l = m.styles;
if (m.linked) {
var o = m.linked && n[m.linked];
o ? l = l.concat(o.styles) : this.options.debug && console.warn(`Can't find linked style ${m.linked}`);
}
for (const k of l) {
var u = `${(e = m.target) != null ? e : ""}.${m.cssName}`;
m.target != k.target && (u += ` ${k.target}`), a[m.target] == m && (u = `.${this.className} ${m.target}, ` + u), r += this.styleToString(u, k.values);
}
}
return Te(r);
}
renderNotes(t, e, r) {
var n = t.map((l) => e[l]).filter((l) => l);
if (n.length > 0) {
var a = this.createElement("ol", null, this.renderElements(n));
r.appendChild(a);
}
}
renderElement(t) {
switch (t.type) {
case R.Paragraph:
return this.renderParagraph(t);
case R.BookmarkStart:
return this.renderBookmarkStart(t);
case R.BookmarkEnd:
return null;
case R.Run:
return this.renderRun(t);
case R.Table:
return this.renderTable(t);
case R.Row:
return this.renderTableRow(t);
case R.Cell:
return this.renderTableCell(t);
case R.Hyperlink:
return this.renderHyperlink(t);
case R.SmartTag:
return this.renderSmartTag(t);
case R.Drawing:
return this.renderDrawing(t);
case R.Image:
return this.renderImage(t);
case R.Text:
return this.renderText(t);
case R.Text:
return this.renderText(t);
case R.DeletedText:
return this.renderDeletedText(t);
case R.Tab:
return this.renderTab(t);
case R.Symbol:
return this.renderSymbol(t);
case R.Break:
return this.renderBreak(t);
case R.Footer:
return this.renderContainer(t, "footer");
case R.Header:
return this.renderContainer(t, "header");
case R.Footnote:
case R.Endnote:
return this.renderContainer(t, "li");
case R.FootnoteReference:
return this.renderFootnoteReference(t);
case R.EndnoteReference:
return this.renderEndnoteReference(t);
case R.NoBreakHyphen:
return this.createElement("wbr");
case R.VmlPicture:
return this.renderVmlPicture(t);
case R.VmlElement:
return this.renderVmlElement(t);
case R.MmlMath:
return this.renderContainerNS(t, ne.mathML, "math", { xmlns: ne.mathML });
case R.MmlMathParagraph:
return this.renderContainer(t, "span");
case R.MmlFraction:
return this.renderContainerNS(t, ne.mathML, "mfrac");
case R.MmlBase:
return this.renderContainerNS(t, ne.mathML, t.parent.type == R.MmlMatrixRow ? "mtd" : "mrow");
case R.MmlNumerator:
case R.MmlDenominator:
case R.MmlFunction:
case R.MmlLimit:
case R.MmlBox:
return this.renderContainerNS(t, ne.mathML, "mrow");
case R.MmlGroupChar:
return this.renderMmlGroupChar(t);
case R.MmlLimitLower:
return this.renderContainerNS(t, ne.mathML, "munder");
case R.MmlMatrix:
return this.renderContainerNS(t, ne.mathML, "mtable");
case R.MmlMatrixRow:
return this.renderContainerNS(t, ne.mathML, "mtr");
case R.MmlRadical:
return this.renderMmlRadical(t);
case R.MmlSuperscript:
return this.renderContainerNS(t, ne.mathML, "msup");
case R.MmlSubscript:
return this.renderContainerNS(t, ne.mathML, "msub");
case R.MmlDegree:
case R.MmlSuperArgument:
case R.MmlSubArgument:
return this.renderContainerNS(t, ne.mathML, "mn");
case R.MmlFunctionName:
return this.renderContainerNS(t, ne.mathML, "ms");
case R.MmlDelimiter:
return this.renderMmlDelimiter(t);
case R.MmlRun:
return this.renderMmlRun(t);
case R.MmlNary:
return this.renderMmlNary(t);
case R.MmlPreSubSuper:
return this.renderMmlPreSubSuper(t);
case R.MmlBar:
return this.renderMmlBar(t);
case R.MmlEquationArray:
return this.renderMllList(t);
case R.Inserted:
return this.renderInserted(t);
case R.Deleted:
return this.renderDeleted(t);
case R.CommentRangeStart:
return this.renderCommentRangeStart(t);
case R.CommentRangeEnd:
return this.renderCommentRangeEnd(t);
case R.CommentReference:
return this.renderCommentReference(t);
}
return null;
}
renderChildren(t, e) {
return this.renderElements(t.children, e);
}
renderElements(t, e) {
if (t == null) return null;
var r = t.flatMap((n) => this.renderElement(n)).filter((n) => n != null);
return e && et(e, r), r;
}
renderContainer(t, e, r) {
return this.createElement(e, r, this.renderChildren(t));
}
renderContainerNS(t, e, r, n) {
return ce(e, r, n, this.renderChildren(t));
}
renderParagraph(t) {
var e, r, n, a = this.createElement("p");
const l = this.findStyle(t.styleName);
t.tabs != null || (t.tabs = (e = l == null ? void 0 : l.paragraphProps) == null ? void 0 : e.tabs), this.renderClass(t, a), this.renderChildren(t, a), this.renderStyleValues(t.cssStyle, a), this.renderCommonProperties(a.style, t);
const o = (n = t.numbering) != null ? n : (r = l == null ? void 0 : l.paragraphProps) == null ? void 0 : r.numbering;
return o && a.classList.add(this.numberingClass(o.id, o.level)), a;
}
renderRunProperties(t, e) {
this.renderCommonProperties(t, e);
}
renderCommonProperties(t, e) {
e != null && (e.color && (t.color = e.color), e.fontSize && (t["font-size"] = e.fontSize));
}
renderHyperlink(t) {
var e = this.createElement("a");
if (this.renderChildren(t, e), this.renderStyleValues(t.cssStyle, e), t.href) e.href = t.href;
else if (t.id) {
const r = this.document.documentPart.rels.find((n) => n.id == t.id && n.targetMode === "External");
e.href = r == null ? void 0 : r.target;
}
return e;
}
renderSmartTag(t) {
var e = this.createElement("span");
return this.renderChildren(t, e), e;
}
renderCommentRangeStart(t) {
var e;
if (!this.options.renderComments) return null;
const r = new Range();
(e = this.commentHighlight) == null || e.add(r);
const n = this.htmlDocument.createComment(`start of comment #${t.id}`);
return this.later(() => r.setStart(n, 0)), this.commentMap[t.id] = r, n;
}
renderCommentRangeEnd(t) {
if (!this.options.renderComments) return null;
const e = this.commentMap[t.id], r = this.htmlDocument.createComment(`end of comment #${t.id}`);
return this.later(() => e == null ? void 0 : e.setEnd(r, 0)), r;
}
renderCommentReference(t) {
var e;
if (!this.options.renderComments) return null;
var r = (e = this.document.commentsPart) == null ? void 0 : e.commentMap[t.id];
if (!r) return null;
const n = new DocumentFragment(), a = Ee("span", { className: `${this.className}-comment-ref` }, ["💬"]), l = Ee("div", { className: `${this.className}-comment-popover` });
return this.renderCommentContent(r, l), n.appendChild(this.htmlDocument.createComment(`comment #${r.id} by ${r.author} on ${r.date}`)), n.appendChild(a), n.appendChild(l), n;
}
renderCommentContent(t, e) {
e.appendChild(Ee("div", { className: `${this.className}-comment-author` }, [t.author])), e.appendChild(Ee("div", { className: `${this.className}-comment-date` }, [new Date(t.date).toLocaleString()])), this.renderChildren(t, e);
}
renderDrawing(t) {
var e = this.createElement("div");
return e.style.display = "inline-block", e.style.position = "relative", e.style.textIndent = "0px", this.renderChildren(t, e), this.renderStyleValues(t.cssStyle, e), e;
}
renderImage(t) {
let e = this.createElement("img");
return this.renderStyleValues(t.cssStyle, e), this.document && this.tasks.push(this.document.loadDocumentImage(t.src, this.currentPart).then((r) => {
e.src = r;
})), e;
}
renderText(t) {
return this.htmlDocument.createTextNode(t.text);
}
renderDeletedText(t) {
return this.options.renderEndnotes ? this.htmlDocument.createTextNode(t.text) : null;
}
renderBreak(t) {
return t.break == "textWrapping" ? this.createElement("br") : null;
}
renderInserted(t) {
return this.options.renderChanges ? this.renderContainer(t, "ins") : this.renderChildren(t);
}
renderDeleted(t) {
return this.options.renderChanges ? this.renderContainer(t, "del") : null;
}
renderSymbol(t) {
var e = this.createElement("span");
return e.style.fontFamily = t.font, e.innerHTML = `&#x${t.char};`, e;
}
renderFootnoteReference(t) {
var e = this.createElement("sup");
return this.currentFootnoteIds.push(t.id), e.textContent = `${this.currentFootnoteIds.length}`, e;
}
renderEndnoteReference(t) {
var e = this.createElement("sup");
return this.currentEndnoteIds.push(t.id), e.textContent = `${this.currentEndnoteIds.length}`, e;
}
renderTab(t) {
var e, r = this.createElement("span");
if (r.innerHTML = " ", this.options.experimental) {
r.className = this.tabStopClass();
var n = (e = an(t, R.Paragraph)) == null ? void 0 : e.tabs;
this.currentTabs.push({ stops: n, span: r });
}
return r;
}
renderBookmarkStart(t) {
var e = this.createElement("span");
return e.id = t.name, e;
}
renderRun(t) {
if (t.fieldRun) return null;
const e = this.createElement("span");
if (t.id && (e.id = t.id), this.renderClass(t, e), this.renderStyleValues(t.cssStyle, e), t.verticalAlign) {
const r = this.createElement(t.verticalAlign);
this.renderChildren(t, r), e.appendChild(r);
} else this.renderChildren(t, e);
return e;
}
renderTable(t) {
let e = this.createElement("table");
return this.tableCellPositions.push(this.currentCellPosition), this.tableVerticalMerges.push(this.currentVerticalMerge), this.currentVerticalMerge = {}, this.currentCellPosition = { col: 0, row: 0 }, t.columns && e.appendChild(this.renderTableColumns(t.columns)), this.renderClass(t, e), this.renderChildren(t, e), this.renderStyleValues(t.cssStyle, e), this.currentVerticalMerge = this.tableVerticalMerges.pop(), this.currentCellPosition = this.tableCellPositions.pop(), e;
}
renderTableColumns(t) {
let e = this.createElement("colgroup");
for (let r of t) {
let n = this.createElement("col");
r.width && (n.style.width = r.width), e.appendChild(n);
}
return e;
}
renderTableRow(t) {
let e = this.createElement("tr");
return this.currentCellPosition.col = 0, this.renderClass(t, e), this.renderChildren(t, e), this.renderStyleValues(t.cssStyle, e), this.currentCellPosition.row++, e;
}
renderTableCell(t) {
let e = this.createElement("td");
const r = this.currentCellPosition.col;
return t.verticalMerge ? t.verticalMerge == "restart" ? (this.currentVerticalMerge[r] = e, e.rowSpan = 1) : this.currentVerticalMerge[r] && (this.currentVerticalMerge[r].rowSpan += 1, e.style.display = "none") : this.currentVerticalMerge[r] = null, this.renderClass(t, e), this.renderChildren(t, e), this.renderStyleValues(t.cssStyle, e), t.span && (e.colSpan = t.span), this.currentCellPosition.col += e.colSpan, e;
}
renderVmlPicture(t) {
var e = Ee("div");
return this.renderChildren(t, e), e;
}
renderVmlElement(t) {
var e, r, n = Pt("svg");
n.setAttribute("style", t.cssStyleText);
const a = this.renderVmlChildElement(t);
return (e = t.imageHref) != null && e.id && this.tasks.push((r = this.document) == null ? void 0 : r.loadDocumentImage(t.imageHref.id, this.currentPart).then((l) => a.setAttribute("href", l))), n.appendChild(a), requestAnimationFrame(() => {
const l = n.firstElementChild.getBBox();
n.setAttribute("width", `${Math.ceil(l.x + l.width)}`), n.setAttribute("height", `${Math.ceil(l.y + l.height)}`);
}), n;
}
renderVmlChildElement(t) {
const e = Pt(t.tagName);
Object.entries(t.attrs).forEach(([r, n]) => e.setAttribute(r, n));
for (let r of t.children) r.type == R.VmlElement ? e.appendChild(this.renderVmlChildElement(r)) : e.appendChild(...Ne(this.renderElement(r)));
return e;
}
renderMmlRadical(t) {
var e;
const r = t.children.find((a) => a.type == R.MmlBase);
if ((e = t.props) != null && e.hideDegree) return ce(ne.mathML, "msqrt", null, this.renderElements([r]));
const n = t.children.find((a) => a.type == R.MmlDegree);
return ce(ne.mathML, "mroot", null, this.renderElements([r, n]));
}
renderMmlDelimiter(t) {
var e, r;
const n = [];
return n.push(ce(ne.mathML, "mo", null, [(e = t.props.beginChar) != null ? e : "("])), n.push(...this.renderElements(t.children)), n.push(ce(ne.mathML, "mo", null, [(r = t.props.endChar) != null ? r : ")"])), ce(ne.mathML, "mrow", null, n);
}
renderMmlNary(t) {
var e, r;
const n = [], a = Pe(t.children, (_) => _.type), l = a[R.MmlSuperArgument], o = a[R.MmlSubArgument], u = l ? ce(ne.mathML, "mo", null, Ne(this.renderElement(l))) : null, m = o ? ce(ne.mathML, "mo", null, Ne(this.renderElement(o))) : null, k = ce(ne.mathML, "mo", null, [(r = (e = t.props) == null ? void 0 : e.char) != null ? r : "∫"]);
return u || m ? n.push(ce(ne.mathML, "munderover", null, [k, m, u])) : u ? n.push(ce(ne.mathML, "mover", null, [k, u])) : m ? n.push(ce(ne.mathML, "munder", null, [k, m])) : n.push(k), n.push(...this.renderElements(a[R.MmlBase].children)), ce(ne.mathML, "mrow", null, n);
}
renderMmlPreSubSuper(t) {
const e = [], r = Pe(t.children, (m) => m.type), n = r[R.MmlSuperArgument], a = r[R.MmlSubArgument], l = n ? ce(ne.mathML, "mo", null, Ne(this.renderElement(n))) : null, o = a ? ce(ne.mathML, "mo", null, Ne(this.renderElement(a))) : null, u = ce(ne.mathML, "mo", null);
return e.push(ce(ne.mathML, "msubsup", null, [u, o, l])), e.push(...this.renderElements(r[R.MmlBase].children)), ce(ne.mathML, "mrow", null, e);
}
renderMmlGroupChar(t) {
const e = t.props.verticalJustification === "bot" ? "mover" : "munder", r = this.renderContainerNS(t, ne.mathML, e);
return t.props.char && r.appendChild(ce(ne.mathML, "mo", null, [t.props.char])), r;
}
renderMmlBar(t) {
const e = this.renderContainerNS(t, ne.mathML, "mrow");
switch (t.props.position) {
case "top":
e.style.textDecoration = "overline";
break;
case "bottom":
e.style.textDecoration = "underline";
break;
}
return e;
}
renderMmlRun(t) {
const e = ce(ne.mathML, "ms");
return this.renderClass(t, e), this.renderStyleValues(t.cssStyle, e), this.renderChildren(t, e), e;
}
renderMllList(t) {
const e = ce(ne.mathML, "mtable");
this.renderClass(t, e), this.renderStyleValues(t.cssStyle, e), this.renderChildren(t);
for (let r of this.renderChildren(t)) e.appendChild(ce(ne.mathML, "mtr", null, [ce(ne.mathML, "mtd", null, [r])]));
return e;
}
renderStyleValues(t, e) {
for (let r in t) r.startsWith("$") ? e.setAttribute(r.slice(1), t[r]) : e.style[r] = t[r];
}
renderClass(t, e) {
t.className && (e.className = t.className), t.styleName && e.classList.add(this.processStyleName(t.styleName));
}
findStyle(t) {
var e;
return t && ((e = this.styleMap) == null ? void 0 : e[t]);
}
numberingClass(t, e) {
return `${this.className}-num-${t}-${e}`;
}
tabStopClass() {
return `${this.className}-tab-stop`;
}
styleToString(t, e, r = null) {
let n = `${t} {\r
`;
for (const a in e) a.startsWith("$") || (n += ` ${a}: ${e[a]};\r
`);
return r && (n += r), n + `}\r
`;
}
numberingCounter(t, e) {
return `${this.className}-num-${t}-${e}`;
}
levelTextToContent(t, e, r, n) {
var a;
const l = { tab: "\\9", space: "\\a0" };
var o = t.replace(/%\d*/g, (u) => {
let m = parseInt(u.substring(1), 10) - 1;
return `"counter(${this.numberingCounter(r, m)}, ${n})"`;
});
return `"${o}${(a = l[e]) != null ? a : ""}"`;
}
numFormatToCssValue(t) {
var e, r = { none: "none", bullet: "disc", decimal: "decimal", lowerLetter: "lower-alpha", upperLetter: "upper-alpha", lowerRoman: "lower-roman", upperRoman: "upper-roman", decimalZero: "decimal-leading-zero", aiueo: "katakana", aiueoFullWidth: "katakana", chineseCounting: "simp-chinese-informal", chineseCountingThousand: "simp-chinese-informal", chineseLegalSimplified: "simp-chinese-formal", chosung: "hangul-consonant", ideographDigital: "cjk-ideographic", ideographTraditional: "cjk-heavenly-stem", ideographLegalTraditional: "trad-chinese-formal", ideographZodiac: "cjk-earthly-branch", iroha: "katakana-iroha", irohaFullWidth: "katakana-iroha", japaneseCounting: "japanese-informal", japaneseDigitalTenThousand: "cjk-decimal", japaneseLegal: "japanese-formal", thaiNumbers: "thai", koreanCounting: "korean-hangul-formal", koreanDigital: "korean-hangul-formal", koreanDigital2: "korean-hanja-informal", hebrew1: "hebrew", hebrew2: "hebrew", hindiNumbers: "devanagari", ganada: "hangul", taiwaneseCounting: "cjk-ideographic", taiwaneseCountingThousand: "cjk-ideographic", taiwaneseDigital: "cjk-decimal" };
return (e = r[t]) != null ? e : t;
}
refreshTabStops() {
this.options.experimental && (clearTimeout(this.tabsTimeout), this.tabsTimeout = setTimeout(() => {
const t = tn();
for (let e of this.currentTabs) rn(e.span, e.stops, this.defaultTabSize, t);
}, 500));
}
later(t) {
this.postRenderTasks.push(t);
}
}
function Ee(i, t, e) {
return ce(void 0, i, t, e);
}
function Pt(i, t, e) {
return ce(ne.svg, i, t, e);
}
function ce(i, t, e, r) {
var n = i ? document.createElementNS(i, t) : document.createElement(t);
return Object.assign(n, e), r && et(n, r), n;
}
function At(i) {
i.innerHTML = "";
}
function et(i, t) {
t.forEach((e) => i.appendChild(er(e) ? document.createTextNode(e) : e));
}
function Te(i) {
return Ee("style", { innerHTML: i });
}
function Me(i, t) {
i.appendChild(document.createComment(t));
}
function an(i, t) {
for (var e = i.parent; e != null && e.type != t; ) e = e.parent;
return e;
}
const Et = { ignoreHeight: !1, ignoreWidth: !1, ignoreFonts: !1, breakPages: !0, debug: !1, experimental: !1, className: "docx", inWrapper: !0, trimXmlDeclaration: !0, ignoreLastRenderedPageBreak: !0, renderHeaders: !0, renderFooters: !0, renderFootnotes: !0, renderEndnotes: !0, useBase64URL: !1, renderChanges: !1, renderComments: !1 };
function sn(i, t) {
const e = ye(ye({}, Et), t);
return Qe.load(i, new Yr(e), e);
}
function on(i, t, e, r) {
return ve(this, null, function* () {
const n = ye(ye({}, Et), r), a = new nn(window.document);
return a.render(i, t, e, n), Promise.allSettled(a.tasks);
});
}
function ln(i, t, e, r) {
return ve(this, null, function* () {
const n = yield sn(i, r);
return yield on(n, t, e, r), n;
});
}
const cn = { ignoreLastRenderedPageBreak: !1 };
function un(i, t = {}) {
return typeof i == "string" ? hn(i, t) : Promise.resolve(i);
}
function hn(i, t) {
return fetch(i, t).then((e) => e.status !== 200 ? Promise.reject(e) : e);
}
function dn(i) {
return ve(this, null, function* () {
let t;
return i instanceof Blob ? t = i : i instanceof Response ? t = yield i.blob() : i instanceof ArrayBuffer && (t = new Blob([i])), t;
});
}
function fn(i, t, e = {}) {
if (!i) return t.innerHTML = "", Promise.resolve();
let r;
return i instanceof Blob ? r = i : i instanceof Response ? r = i.blob() : i instanceof ArrayBuffer && (r = new Blob([i])), ln(r, t, t, ye(ye({}, cn), e));
}
const Be = { getData: un, render: fn, getBlob: dn };
function mn(i, t) {
return ve(this, null, function* () {
t && (t instanceof ArrayBuffer && (t = new Blob([t])), pn(i, URL.createObjectURL(t)));
});
}
function pn(i, t) {
let e = document.createElement("a");
e.download = i, e.style.display = "none", e.href = t, document.body.appendChild(e), e.click(), document.body.removeChild(e);
}
const gn = (i, t) => {
const e = i.__vccOpts || i;
for (const [r, n] of t) e[r] = n;
return e;
}, bn = Re.defineComponent({ name: "VueOfficeDocx", props: { src: [String, ArrayBuffer, Blob], requestOptions: { type: Object, default: () => ({}) }, options: { type: Object, default: () => ({}) } }, emits: ["rendered", "error"], setup(i, { emit: t }) {
const e = Re.ref(null);
let r = null;
function n() {
let l = e.value;
Be.getData(i.src, i.requestOptions).then((o) => ve(this, null, function* () {
r = yield Be.getBlob(o), Be.render(r, l, i.options).then(() => {
t("rendered");
}).catch((u) => {
Be.render("", l, i.options), t("error", u);
});
})).catch((o) => {
Be.render("", l, i.options), t("error", o);
});
}
Re.onMounted(() => {
i.src && n();
}), Re.watch(() => i.src, () => {
i.src ? n() : Be.render("", e.value, i.options).then(() => {
t("rendered");
});
});
function a(l) {
mn(l || `vue-office-docx-${(/* @__PURE__ */ new Date()).getTime()}.docx`, r);
}
return { rootRef: e, save: a };
} }), yn = { class: "vue-office-docx" }, vn = { class: "vue-office-docx-main", ref: "rootRef" };
function kn(i, t, e, r, n, a) {
return ze.openBlock(), ze.createElementBlock("div", yn, [ze.createElementVNode("div", vn, null, 512)]);
}
const Xe = gn(bn, [["render", kn]]);
return Xe.install = function(i) {
i.component(Xe.name, Xe);
}, Xe;
});
})(Rt);
var An = Rt.exports;
const Nn = /* @__PURE__ */ Cn(An);
export {
Nn as default
};
//# sourceMappingURL=index.mjs.map