{ canvas: t2 }); case "img": return this.set({ img: t2 }); default: return this.error("Unknown source type."); } }); }, s2.prototype.to = function(t2) { switch (t2) { case "container": return this.toContainer(); case "canvas": return this.toCanvas(); case "img": return this.toImg(); case "pdf": return this.toPdf(); default: return this.error("Invalid target."); } }, s2.prototype.toContainer = function() { return this.thenList([function() { return this.prop.src || this.error("Cannot duplicate - no source HTML."); }, function() { return this.prop.pageSize || this.setPageSize(); }]).then(function() { var t2 = { position: "relative", display: "inline-block", width: ("number" != typeof this.opt.width || isNaN(this.opt.width) || "number" != typeof this.opt.windowWidth || isNaN(this.opt.windowWidth) ? Math.max(this.prop.src.clientWidth, this.prop.src.scrollWidth, this.prop.src.offsetWidth) : this.opt.windowWidth) + "px", left: 0, right: 0, top: 0, margin: "auto", backgroundColor: this.opt.backgroundColor }, e2 = function t3(e3, r2) { for (var n2 = 3 === e3.nodeType ? document.createTextNode(e3.nodeValue) : e3.cloneNode(false), i3 = e3.firstChild; i3; i3 = i3.nextSibling) true !== r2 && 1 === i3.nodeType && "SCRIPT" === i3.nodeName || n2.appendChild(t3(i3, r2)); return 1 === e3.nodeType && ("CANVAS" === e3.nodeName ? (n2.width = e3.width, n2.height = e3.height, n2.getContext("2d").drawImage(e3, 0, 0)) : "TEXTAREA" !== e3.nodeName && "SELECT" !== e3.nodeName || (n2.value = e3.value), n2.addEventListener("load", function() { n2.scrollTop = e3.scrollTop, n2.scrollLeft = e3.scrollLeft; }, true)), n2; }(this.prop.src, this.opt.html2canvas.javascriptEnabled); "BODY" === e2.tagName && (t2.height = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight) + "px"), this.prop.overlay = o2("div", { className: "html2pdf__overlay", style: { position: "fixed", overflow: "hidden", zIndex: 1e3, left: "-100000px", right: 0, bottom: 0, top: 0 } }), this.prop.container = o2("div", { className: "html2pdf__container", style: t2 }), this.prop.container.appendChild(e2), this.prop.container.firstChild.appendChild(o2("div", { style: { clear: "both", border: "0 none transparent", margin: 0, padding: 0, height: 0 } })), this.prop.container.style.float = "none", this.prop.overlay.appendChild(this.prop.container), document.body.appendChild(this.prop.overlay), this.prop.container.firstChild.style.position = "relative", this.prop.container.height = Math.max(this.prop.container.firstChild.clientHeight, this.prop.container.firstChild.scrollHeight, this.prop.container.firstChild.offsetHeight) + "px"; }); }, s2.prototype.toCanvas = function() { var t2 = [function() { return document.body.contains(this.prop.container) || this.toContainer(); }]; return this.thenList(t2).then(r).then(function(t3) { var e2 = Object.assign({}, this.opt.html2canvas); return delete e2.onrendered, t3(this.prop.container, e2); }).then(function(t3) { (this.opt.html2canvas.onrendered || function() { })(t3), this.prop.canvas = t3, document.body.removeChild(this.prop.overlay); }); }, s2.prototype.toContext2d = function() { var t2 = [function() { return document.body.contains(this.prop.container) || this.toContainer(); }]; return this.thenList(t2).then(r).then(function(t3) { var e2 = this.opt.jsPDF, r2 = this.opt.fontFaces, n2 = "number" != typeof this.opt.width || isNaN(this.opt.width) || "number" != typeof this.opt.windowWidth || isNaN(this.opt.windowWidth) ? 1 : this.opt.width / this.opt.windowWidth, i3 = Object.assign({ async: true, allowTaint: true, scale: n2, scrollX: this.opt.scrollX || 0, scrollY: this.opt.scrollY || 0, backgroundColor: "#ffffff", imageTimeout: 15e3, logging: true, proxy: null, removeContainer: true, foreignObjectRendering: false, useCORS: false }, this.opt.html2canvas); if (delete i3.onrendered, e2.context2d.autoPaging = void 0 === this.opt.autoPaging || this.opt.autoPaging, e2.context2d.posX = this.opt.x, e2.context2d.posY = this.opt.y, e2.context2d.margin = this.opt.margin, e2.context2d.fontFaces = r2, r2) for (var a3 = 0; a3 < r2.length; ++a3) { var o3 = r2[a3], s3 = o3.src.find(function(t4) { return "truetype" === t4.format; }); s3 && e2.addFont(s3.url, o3.ref.name, o3.ref.style); } return i3.windowHeight = i3.windowHeight || 0, i3.windowHeight = 0 == i3.windowHeight ? Math.max(this.prop.container.clientHeight, this.prop.container.scrollHeight, this.prop.container.offsetHeight) : i3.windowHeight, e2.context2d.save(true), t3(this.prop.container, i3); }).then(function(t3) { this.opt.jsPDF.context2d.restore(true), (this.opt.html2canvas.onrendered || function() { })(t3), this.prop.canvas = t3, document.body.removeChild(this.prop.overlay); }); }, s2.prototype.toImg = function() { return this.thenList([function() { return this.prop.canvas || this.toCanvas(); }]).then(function() { var t2 = this.prop.canvas.toDataURL("image/" + this.opt.image.type, this.opt.image.quality); this.prop.img = document.createElement("img"), this.prop.img.src = t2; }); }, s2.prototype.toPdf = function() { return this.thenList([function() { return this.toContext2d(); }]).then(function() { this.prop.pdf = this.prop.pdf || this.opt.jsPDF; }); }, s2.prototype.output = function(t2, e2, r2) { return "img" === (r2 = r2 || "pdf").toLowerCase() || "image" === r2.toLowerCase() ? this.outputImg(t2, e2) : this.outputPdf(t2, e2); }, s2.prototype.outputPdf = function(t2, e2) { return this.thenList([function() { return this.prop.pdf || this.toPdf(); }]).then(function() { return this.prop.pdf.output(t2, e2); }); }, s2.prototype.outputImg = function(t2) { return this.thenList([function() { return this.prop.img || this.toImg(); }]).then(function() { switch (t2) { case void 0: case "img": return this.prop.img; case "datauristring": case "dataurlstring": return this.prop.img.src; case "datauri": case "dataurl": return document.location.href = this.prop.img.src; default: throw 'Image output type "' + t2 + '" is not supported.'; } }); }, s2.prototype.save = function(t2) { return this.thenList([function() { return this.prop.pdf || this.toPdf(); }]).set(t2 ? { filename: t2 } : null).then(function() { this.prop.pdf.save(this.opt.filename); }); }, s2.prototype.doCallback = function() { return this.thenList([function() { return this.prop.pdf || this.toPdf(); }]).then(function() { this.prop.callback(this.prop.pdf); }); }, s2.prototype.set = function(t2) { if ("object" !== a2(t2)) return this; var e2 = Object.keys(t2 || {}).map(function(e3) { if (e3 in s2.template.prop) return function() { this.prop[e3] = t2[e3]; }; switch (e3) { case "margin": return this.setMargin.bind(this, t2.margin); case "jsPDF": return function() { return this.opt.jsPDF = t2.jsPDF, this.setPageSize(); }; case "pageSize": return this.setPageSize.bind(this, t2.pageSize); default: return function() { this.opt[e3] = t2[e3]; }; } }, this); return this.then(function() { return this.thenList(e2); }); }, s2.prototype.get = function(t2, e2) { return this.then(function() { var r2 = t2 in s2.template.prop ? this.prop[t2] : this.opt[t2]; return e2 ? e2(r2) : r2; }); }, s2.prototype.setMargin = function(t2) { return this.then(function() { switch (a2(t2)) { case "number": t2 = [t2, t2, t2, t2]; case "array": if (2 === t2.length && (t2 = [t2[0], t2[1], t2[0], t2[1]]), 4 === t2.length) break; default: return this.error("Invalid margin array."); } this.opt.margin = t2; }).then(this.setPageSize); }, s2.prototype.setPageSize = function(t2) { function e2(t3, e3) { return Math.floor(t3 * e3 / 72 * 96); } return this.then(function() { (t2 = t2 || E.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner") || (t2.inner = { width: t2.width - this.opt.margin[1] - this.opt.margin[3], height: t2.height - this.opt.margin[0] - this.opt.margin[2] }, t2.inner.px = { width: e2(t2.inner.width, t2.k), height: e2(t2.inner.height, t2.k) }, t2.inner.ratio = t2.inner.height / t2.inner.width), this.prop.pageSize = t2; }); }, s2.prototype.setProgress = function(t2, e2, r2, n2) { return null != t2 && (this.progress.val = t2), null != e2 && (this.progress.state = e2), null != r2 && (this.progress.n = r2), null != n2 && (this.progress.stack = n2), this.progress.ratio = this.progress.val / this.progress.state, this; }, s2.prototype.updateProgress = function(t2, e2, r2, n2) { return this.setProgress(t2 ? this.progress.val + t2 : null, e2 || null, r2 ? this.progress.n + r2 : null, n2 ? this.progress.stack.concat(n2) : null); }, s2.prototype.then = function(t2, e2) { var r2 = this; return this.thenCore(t2, e2, function(t3, e3) { return r2.updateProgress(null, null, 1, [t3]), Promise.prototype.then.call(this, function(e4) { return r2.updateProgress(null, t3), e4; }).then(t3, e3).then(function(t4) { return r2.updateProgress(1), t4; }); }); }, s2.prototype.thenCore = function(t2, e2, r2) { r2 = r2 || Promise.prototype.then; t2 && (t2 = t2.bind(this)), e2 && (e2 = e2.bind(this)); var n2 = -1 !== Promise.toString().indexOf("[native code]") && "Promise" === Promise.name ? this : s2.convert(Object.assign({}, this), Promise.prototype), i3 = r2.call(n2, t2, e2); return s2.convert(i3, this.__proto__); }, s2.prototype.thenExternal = function(t2, e2) { return Promise.prototype.then.call(this, t2, e2); }, s2.prototype.thenList = function(t2) { var e2 = this; return t2.forEach(function(t3) { e2 = e2.thenCore(t3); }), e2; }, s2.prototype.catch = function(t2) { t2 && (t2 = t2.bind(this)); var e2 = Promise.prototype.catch.call(this, t2); return s2.convert(e2, this); }, s2.prototype.catchExternal = function(t2) { return Promise.prototype.catch.call(this, t2); }, s2.prototype.error = function(t2) { return this.then(function() { throw new Error(t2); }); }, s2.prototype.using = s2.prototype.set, s2.prototype.saveAs = s2.prototype.save, s2.prototype.export = s2.prototype.output, s2.prototype.run = s2.prototype.then, E.getPageSize = function(e2, r2, n2) { if ("object" === _typeof(e2)) { var i3 = e2; e2 = i3.orientation, r2 = i3.unit || r2, n2 = i3.format || n2; } r2 = r2 || "mm", n2 = n2 || "a4", e2 = ("" + (e2 || "P")).toLowerCase(); var a3, o3 = ("" + n2).toLowerCase(), s3 = { a0: [2383.94, 3370.39], a1: [1683.78, 2383.94], a2: [1190.55, 1683.78], a3: [841.89, 1190.55], a4: [595.28, 841.89], a5: [419.53, 595.28], a6: [297.64, 419.53], a7: [209.76, 297.64], a8: [147.4, 209.76], a9: [104.88, 147.4], a10: [73.7, 104.88], b0: [2834.65, 4008.19], b1: [2004.09, 2834.65], b2: [1417.32, 2004.09], b3: [1000.63, 1417.32], b4: [708.66, 1000.63], b5: [498.9, 708.66], b6: [354.33, 498.9], b7: [249.45, 354.33], b8: [175.75, 249.45], b9: [124.72, 175.75], b10: [87.87, 124.72], c0: [2599.37, 3676.54], c1: [1836.85, 2599.37], c2: [1298.27, 1836.85], c3: [918.43, 1298.27], c4: [649.13, 918.43], c5: [459.21, 649.13], c6: [323.15, 459.21], c7: [229.61, 323.15], c8: [161.57, 229.61], c9: [113.39, 161.57], c10: [79.37, 113.39], dl: [311.81, 623.62], letter: [612, 792], "government-letter": [576, 756], legal: [612, 1008], "junior-legal": [576, 360], ledger: [1224, 792], tabloid: [792, 1224], "credit-card": [153, 243] }; switch (r2) { case "pt": a3 = 1; break; case "mm": a3 = 72 / 25.4; break; case "cm": a3 = 72 / 2.54; break; case "in": a3 = 72; break; case "px": a3 = 0.75; break; case "pc": case "em": a3 = 12; break; case "ex": a3 = 6; break; default: throw "Invalid unit: " + r2; } var c2, u2 = 0, h2 = 0; if (s3.hasOwnProperty(o3)) u2 = s3[o3][1] / a3, h2 = s3[o3][0] / a3; else try { u2 = n2[1], h2 = n2[0]; } catch (t2) { throw new Error("Invalid format: " + n2); } if ("p" === e2 || "portrait" === e2) e2 = "p", h2 > u2 && (c2 = h2, h2 = u2, u2 = c2); else { if ("l" !== e2 && "landscape" !== e2) throw "Invalid orientation: " + e2; e2 = "l", u2 > h2 && (c2 = h2, h2 = u2, u2 = c2); } return { width: h2, height: u2, unit: r2, k: a3, orientation: e2 }; }, e.html = function(t2, e2) { (e2 = e2 || {}).callback = e2.callback || function() { }, e2.html2canvas = e2.html2canvas || {}, e2.html2canvas.canvas = e2.html2canvas.canvas || this.canvas, e2.jsPDF = e2.jsPDF || this, e2.fontFaces = e2.fontFaces ? e2.fontFaces.map(jt) : null; var r2 = new s2(e2); return e2.worker ? r2 : r2.from(t2).doCallback(); }; }(E.API), E.API.addJS = function(t2) { return Ht = t2, this.internal.events.subscribe("postPutResources", function() { Ut = this.internal.newObject(), this.internal.out("<<"), this.internal.out("/Names [(EmbeddedJS) " + (Ut + 1) + " 0 R]"), this.internal.out(">>"), this.internal.out("endobj"), zt = this.internal.newObject(), this.internal.out("<<"), this.internal.out("/S /JavaScript"), this.internal.out("/JS (" + Ht + ")"), this.internal.out(">>"), this.internal.out("endobj"); }), this.internal.events.subscribe("putCatalog", function() { void 0 !== Ut && void 0 !== zt && this.internal.out("/Names <>"); }), this; }, /** * @license * Copyright (c) 2014 Steven Spungin (TwelveTone LLC) steven@twelvetone.tv * * Licensed under the MIT License. * http://opensource.org/licenses/mit-license */ function(t2) { var e; t2.events.push(["postPutResources", function() { var t3 = this, r = /^(\d+) 0 obj$/; if (this.outline.root.children.length > 0) for (var n2 = t3.outline.render().split(/\r\n/), i2 = 0; i2 < n2.length; i2++) { var a2 = n2[i2], o2 = r.exec(a2); if (null != o2) { var s2 = o2[1]; t3.internal.newObjectDeferredBegin(s2, false); } t3.internal.write(a2); } if (this.outline.createNamedDestinations) { var c2 = this.internal.pages.length, u2 = []; for (i2 = 0; i2 < c2; i2++) { var h2 = t3.internal.newObject(); u2.push(h2); var l2 = t3.internal.getPageInfo(i2 + 1); t3.internal.write("<< /D[" + l2.objId + " 0 R /XYZ null null null]>> endobj"); } var f2 = t3.internal.newObject(); t3.internal.write("<< /Names [ "); for (i2 = 0; i2 < u2.length; i2++) t3.internal.write("(page_" + (i2 + 1) + ")" + u2[i2] + " 0 R"); t3.internal.write(" ] >>", "endobj"), e = t3.internal.newObject(), t3.internal.write("<< /Dests " + f2 + " 0 R"), t3.internal.write(">>", "endobj"); } }]), t2.events.push(["putCatalog", function() { this.outline.root.children.length > 0 && (this.internal.write("/Outlines", this.outline.makeRef(this.outline.root)), this.outline.createNamedDestinations && this.internal.write("/Names " + e + " 0 R")); }]), t2.events.push(["initialized", function() { var t3 = this; t3.outline = { createNamedDestinations: false, root: { children: [] } }, t3.outline.add = function(t4, e2, r) { var n2 = { title: e2, options: r, children: [] }; return null == t4 && (t4 = this.root), t4.children.push(n2), n2; }, t3.outline.render = function() { return this.ctx = {}, this.ctx.val = "", this.ctx.pdf = t3, this.genIds_r(this.root), this.renderRoot(this.root), this.renderItems(this.root), this.ctx.val; }, t3.outline.genIds_r = function(e2) { e2.id = t3.internal.newObjectDeferred(); for (var r = 0; r < e2.children.length; r++) this.genIds_r(e2.children[r]); }, t3.outline.renderRoot = function(t4) { this.objStart(t4), this.line("/Type /Outlines"), t4.children.length > 0 && (this.line("/First " + this.makeRef(t4.children[0])), this.line("/Last " + this.makeRef(t4.children[t4.children.length - 1]))), this.line("/Count " + this.count_r({ count: 0 }, t4)), this.objEnd(); }, t3.outline.renderItems = function(e2) { for (var r = this.ctx.pdf.internal.getVerticalCoordinateString, n2 = 0; n2 < e2.children.length; n2++) { var i2 = e2.children[n2]; this.objStart(i2), this.line("/Title " + this.makeString(i2.title)), this.line("/Parent " + this.makeRef(e2)), n2 > 0 && this.line("/Prev " + this.makeRef(e2.children[n2 - 1])), n2 < e2.children.length - 1 && this.line("/Next " + this.makeRef(e2.children[n2 + 1])), i2.children.length > 0 && (this.line("/First " + this.makeRef(i2.children[0])), this.line("/Last " + this.makeRef(i2.children[i2.children.length - 1]))); var a2 = this.count = this.count_r({ count: 0 }, i2); if (a2 > 0 && this.line("/Count " + a2), i2.options && i2.options.pageNumber) { var o2 = t3.internal.getPageInfo(i2.options.pageNumber); this.line("/Dest [" + o2.objId + " 0 R /XYZ 0 " + r(0) + " 0]"); } this.objEnd(); } for (var s2 = 0; s2 < e2.children.length; s2++) this.renderItems(e2.children[s2]); }, t3.outline.line = function(t4) { this.ctx.val += t4 + "\r\n"; }, t3.outline.makeRef = function(t4) { return t4.id + " 0 R"; }, t3.outline.makeString = function(e2) { return "(" + t3.internal.pdfEscape(e2) + ")"; }, t3.outline.objStart = function(t4) { this.ctx.val += "\r\n" + t4.id + " 0 obj\r\n<<\r\n"; }, t3.outline.objEnd = function() { this.ctx.val += ">> \r\nendobj\r\n"; }, t3.outline.count_r = function(t4, e2) { for (var r = 0; r < e2.children.length; r++) t4.count++, this.count_r(t4, e2.children[r]); return t4.count; }; }]); }(E.API), /** * @license * * Licensed under the MIT License. * http://opensource.org/licenses/mit-license */ function(t2) { var e = [192, 193, 194, 195, 196, 197, 198, 199]; t2.processJPEG = function(t3, r, n2, i2, a2, o2) { var s2, c2 = this.decode.DCT_DECODE, u2 = null; if ("string" == typeof t3 || this.__addimage__.isArrayBuffer(t3) || this.__addimage__.isArrayBufferView(t3)) { switch (t3 = a2 || t3, t3 = this.__addimage__.isArrayBuffer(t3) ? new Uint8Array(t3) : t3, (s2 = function(t4) { for (var r2, n3 = 256 * t4.charCodeAt(4) + t4.charCodeAt(5), i3 = t4.length, a3 = { width: 0, height: 0, numcomponents: 1 }, o3 = 4; o3 < i3; o3 += 2) { if (o3 += n3, -1 !== e.indexOf(t4.charCodeAt(o3 + 1))) { r2 = 256 * t4.charCodeAt(o3 + 5) + t4.charCodeAt(o3 + 6), a3 = { width: 256 * t4.charCodeAt(o3 + 7) + t4.charCodeAt(o3 + 8), height: r2, numcomponents: t4.charCodeAt(o3 + 9) }; break; } n3 = 256 * t4.charCodeAt(o3 + 2) + t4.charCodeAt(o3 + 3); } return a3; }(t3 = this.__addimage__.isArrayBufferView(t3) ? this.__addimage__.arrayBufferToBinaryString(t3) : t3)).numcomponents) { case 1: o2 = this.color_spaces.DEVICE_GRAY; break; case 4: o2 = this.color_spaces.DEVICE_CMYK; break; case 3: o2 = this.color_spaces.DEVICE_RGB; } u2 = { data: t3, width: s2.width, height: s2.height, colorSpace: o2, bitsPerComponent: 8, filter: c2, index: r, alias: n2 }; } return u2; }; }(E.API); var Vt; var Gt; var Yt; var Jt; var Xt; var Kt = function() { var t2, e, i2; function a2(t3) { var e2, r, n2, i3, a3, o3, s2, c2, u2, h2, l2, f2, d2, p2; for (this.data = t3, this.pos = 8, this.palette = [], this.imgData = [], this.transparency = {}, this.animation = null, this.text = {}, o3 = null; ; ) { switch (e2 = this.readUInt32(), u2 = (function() { var t4, e3; for (e3 = [], t4 = 0; t4 < 4; ++t4) e3.push(String.fromCharCode(this.data[this.pos++])); return e3; }).call(this).join("")) { case "IHDR": this.width = this.readUInt32(), this.height = this.readUInt32(), this.bits = this.data[this.pos++], this.colorType = this.data[this.pos++], this.compressionMethod = this.data[this.pos++], this.filterMethod = this.data[this.pos++], this.interlaceMethod = this.data[this.pos++]; break; case "acTL": this.animation = { numFrames: this.readUInt32(), numPlays: this.readUInt32() || 1 / 0, frames: [] }; break; case "PLTE": this.palette = this.read(e2); break; case "fcTL": o3 && this.animation.frames.push(o3), this.pos += 4, o3 = { width: this.readUInt32(), height: this.readUInt32(), xOffset: this.readUInt32(), yOffset: this.readUInt32() }, a3 = this.readUInt16(), i3 = this.readUInt16() || 100, o3.delay = 1e3 * a3 / i3, o3.disposeOp = this.data[this.pos++], o3.blendOp = this.data[this.pos++], o3.data = []; break; case "IDAT": case "fdAT": for ("fdAT" === u2 && (this.pos += 4, e2 -= 4), t3 = (null != o3 ? o3.data : void 0) || this.imgData, f2 = 0; 0 <= e2 ? f2 < e2 : f2 > e2; 0 <= e2 ? ++f2 : --f2) t3.push(this.data[this.pos++]); break; case "tRNS": switch (this.transparency = {}, this.colorType) { case 3: if (n2 = this.palette.length / 3, this.transparency.indexed = this.read(e2), this.transparency.indexed.length > n2) throw new Error("More transparent colors than palette size"); if ((h2 = n2 - this.transparency.indexed.length) > 0) for (d2 = 0; 0 <= h2 ? d2 < h2 : d2 > h2; 0 <= h2 ? ++d2 : --d2) this.transparency.indexed.push(255); break; case 0: this.transparency.grayscale = this.read(e2)[0]; break; case 2: this.transparency.rgb = this.read(e2); } break; case "tEXt": s2 = (l2 = this.read(e2)).indexOf(0), c2 = String.fromCharCode.apply(String, l2.slice(0, s2)), this.text[c2] = String.fromCharCode.apply(String, l2.slice(s2 + 1)); break; case "IEND": return o3 && this.animation.frames.push(o3), this.colors = (function() { switch (this.colorType) { case 0: case 3: case 4: return 1; case 2: case 6: return 3; } }).call(this), this.hasAlphaChannel = 4 === (p2 = this.colorType) || 6 === p2, r = this.colors + (this.hasAlphaChannel ? 1 : 0), this.pixelBitlength = this.bits * r, this.colorSpace = (function() { switch (this.colors) { case 1: return "DeviceGray"; case 3: return "DeviceRGB"; } }).call(this), void (this.imgData = new Uint8Array(this.imgData)); default: this.pos += e2; } if (this.pos += 4, this.pos > this.data.length) throw new Error("Incomplete or corrupt PNG file"); } } a2.prototype.read = function(t3) { var e2, r; for (r = [], e2 = 0; 0 <= t3 ? e2 < t3 : e2 > t3; 0 <= t3 ? ++e2 : --e2) r.push(this.data[this.pos++]); return r; }, a2.prototype.readUInt32 = function() { return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++]; }, a2.prototype.readUInt16 = function() { return this.data[this.pos++] << 8 | this.data[this.pos++]; }, a2.prototype.decodePixels = function(t3) { var e2 = this.pixelBitlength / 8, n2 = new Uint8Array(this.width * this.height * e2), i3 = 0, a3 = this; if (null == t3 && (t3 = this.imgData), 0 === t3.length) return new Uint8Array(0); function o3(r, o4, s2, c2) { var u2, h2, l2, f2, d2, p2, g2, m2, v2, b3, y2, w2, N2, L2, A2, x2, S2, _2, P2, k2, I2, F2 = Math.ceil((a3.width - r) / s2), C2 = Math.ceil((a3.height - o4) / c2), j2 = a3.width == F2 && a3.height == C2; for (L2 = e2 * F2, w2 = j2 ? n2 : new Uint8Array(L2 * C2), p2 = t3.length, N2 = 0, h2 = 0; N2 < C2 && i3 < p2; ) { switch (t3[i3++]) { case 0: for (f2 = S2 = 0; S2 < L2; f2 = S2 += 1) w2[h2++] = t3[i3++]; break; case 1: for (f2 = _2 = 0; _2 < L2; f2 = _2 += 1) u2 = t3[i3++], d2 = f2 < e2 ? 0 : w2[h2 - e2], w2[h2++] = (u2 + d2) % 256; break; case 2: for (f2 = P2 = 0; P2 < L2; f2 = P2 += 1) u2 = t3[i3++], l2 = (f2 - f2 % e2) / e2, A2 = N2 && w2[(N2 - 1) * L2 + l2 * e2 + f2 % e2], w2[h2++] = (A2 + u2) % 256; break; case 3: for (f2 = k2 = 0; k2 < L2; f2 = k2 += 1) u2 = t3[i3++], l2 = (f2 - f2 % e2) / e2, d2 = f2 < e2 ? 0 : w2[h2 - e2], A2 = N2 && w2[(N2 - 1) * L2 + l2 * e2 + f2 % e2], w2[h2++] = (u2 + Math.floor((d2 + A2) / 2)) % 256; break; case 4: for (f2 = I2 = 0; I2 < L2; f2 = I2 += 1) u2 = t3[i3++], l2 = (f2 - f2 % e2) / e2, d2 = f2 < e2 ? 0 : w2[h2 - e2], 0 === N2 ? A2 = x2 = 0 : (A2 = w2[(N2 - 1) * L2 + l2 * e2 + f2 % e2], x2 = l2 && w2[(N2 - 1) * L2 + (l2 - 1) * e2 + f2 % e2]), g2 = d2 + A2 - x2, m2 = Math.abs(g2 - d2), b3 = Math.abs(g2 - A2), y2 = Math.abs(g2 - x2), v2 = m2 <= b3 && m2 <= y2 ? d2 : b3 <= y2 ? A2 : x2, w2[h2++] = (u2 + v2) % 256; break; default: throw new Error("Invalid filter algorithm: " + t3[i3 - 1]); } if (!j2) { var O2 = ((o4 + N2 * c2) * a3.width + r) * e2, B2 = N2 * L2; for (f2 = 0; f2 < F2; f2 += 1) { for (var M2 = 0; M2 < e2; M2 += 1) n2[O2++] = w2[B2++]; O2 += (s2 - 1) * e2; } } N2++; } } return t3 = unzlibSync(t3), 1 == a3.interlaceMethod ? (o3(0, 0, 8, 8), o3(4, 0, 8, 8), o3(0, 4, 4, 8), o3(2, 0, 4, 4), o3(0, 2, 2, 4), o3(1, 0, 2, 2), o3(0, 1, 1, 2)) : o3(0, 0, 1, 1), n2; }, a2.prototype.decodePalette = function() { var t3, e2, r, n2, i3, a3, o3, s2, c2; for (r = this.palette, a3 = this.transparency.indexed || [], i3 = new Uint8Array((a3.length || 0) + r.length), n2 = 0, t3 = 0, e2 = o3 = 0, s2 = r.length; o3 < s2; e2 = o3 += 3) i3[n2++] = r[e2], i3[n2++] = r[e2 + 1], i3[n2++] = r[e2 + 2], i3[n2++] = null != (c2 = a3[t3++]) ? c2 : 255; return i3; }, a2.prototype.copyToImageData = function(t3, e2) { var r, n2, i3, a3, o3, s2, c2, u2, h2, l2, f2; if (n2 = this.colors, h2 = null, r = this.hasAlphaChannel, this.palette.length && (h2 = null != (f2 = this._decodedPalette) ? f2 : this._decodedPalette = this.decodePalette(), n2 = 4, r = true), u2 = (i3 = t3.data || t3).length, o3 = h2 || e2, a3 = s2 = 0, 1 === n2) for (; a3 < u2; ) c2 = h2 ? 4 * e2[a3 / 4] : s2, l2 = o3[c2++], i3[a3++] = l2, i3[a3++] = l2, i3[a3++] = l2, i3[a3++] = r ? o3[c2++] : 255, s2 = c2; else for (; a3 < u2; ) c2 = h2 ? 4 * e2[a3 / 4] : s2, i3[a3++] = o3[c2++], i3[a3++] = o3[c2++], i3[a3++] = o3[c2++], i3[a3++] = r ? o3[c2++] : 255, s2 = c2; }, a2.prototype.decode = function() { var t3; return t3 = new Uint8Array(this.width * this.height * 4), this.copyToImageData(t3, this.decodePixels()), t3; }; var o2 = function() { if ("[object Window]" === Object.prototype.toString.call(n)) { try { e = n.document.createElement("canvas"), i2 = e.getContext("2d"); } catch (t3) { return false; } return true; } return false; }; return o2(), t2 = function(t3) { var r; if (true === o2()) return i2.width = t3.width, i2.height = t3.height, i2.clearRect(0, 0, t3.width, t3.height), i2.putImageData(t3, 0, 0), (r = new Image()).src = e.toDataURL(), r; throw new Error("This method requires a Browser with Canvas-capability."); }, a2.prototype.decodeFrames = function(e2) { var r, n2, i3, a3, o3, s2, c2, u2; if (this.animation) { for (u2 = [], n2 = o3 = 0, s2 = (c2 = this.animation.frames).length; o3 < s2; n2 = ++o3) r = c2[n2], i3 = e2.createImageData(r.width, r.height), a3 = this.decodePixels(new Uint8Array(r.data)), this.copyToImageData(i3, a3), r.imageData = i3, u2.push(r.image = t2(i3)); return u2; } }, a2.prototype.renderFrame = function(t3, e2) { var r, n2, i3; return r = (n2 = this.animation.frames)[e2], i3 = n2[e2 - 1], 0 === e2 && t3.clearRect(0, 0, this.width, this.height), 1 === (null != i3 ? i3.disposeOp : void 0) ? t3.clearRect(i3.xOffset, i3.yOffset, i3.width, i3.height) : 2 === (null != i3 ? i3.disposeOp : void 0) && t3.putImageData(i3.imageData, i3.xOffset, i3.yOffset), 0 === r.blendOp && t3.clearRect(r.xOffset, r.yOffset, r.width, r.height), t3.drawImage(r.image, r.xOffset, r.yOffset); }, a2.prototype.animate = function(t3) { var e2, r, n2, i3, a3, o3, s2 = this; return r = 0, o3 = this.animation, i3 = o3.numFrames, n2 = o3.frames, a3 = o3.numPlays, (e2 = function() { var o4, c2; if (o4 = r++ % i3, c2 = n2[o4], s2.renderFrame(t3, o4), i3 > 1 && r / i3 < a3) return s2.animation._timeout = setTimeout(e2, c2.delay); })(); }, a2.prototype.stopAnimation = function() { var t3; return clearTimeout(null != (t3 = this.animation) ? t3._timeout : void 0); }, a2.prototype.render = function(t3) { var e2, r; return t3._png && t3._png.stopAnimation(), t3._png = this, t3.width = this.width, t3.height = this.height, e2 = t3.getContext("2d"), this.animation ? (this.decodeFrames(e2), this.animate(e2)) : (r = e2.createImageData(this.width, this.height), this.copyToImageData(r, this.decodePixels()), e2.putImageData(r, 0, 0)); }, a2; }(); function Zt(t2) { var e = 0; if (71 !== t2[e++] || 73 !== t2[e++] || 70 !== t2[e++] || 56 !== t2[e++] || 56 != (t2[e++] + 1 & 253) || 97 !== t2[e++]) throw new Error("Invalid GIF 87a/89a header."); var r = t2[e++] | t2[e++] << 8, n2 = t2[e++] | t2[e++] << 8, i2 = t2[e++], a2 = i2 >> 7, o2 = 1 << (7 & i2) + 1; t2[e++]; t2[e++]; var s2 = null, c2 = null; a2 && (s2 = e, c2 = o2, e += 3 * o2); var u2 = true, h2 = [], l2 = 0, f2 = null, d2 = 0, p2 = null; for (this.width = r, this.height = n2; u2 && e < t2.length; ) switch (t2[e++]) { case 33: switch (t2[e++]) { case 255: if (11 !== t2[e] || 78 == t2[e + 1] && 69 == t2[e + 2] && 84 == t2[e + 3] && 83 == t2[e + 4] && 67 == t2[e + 5] && 65 == t2[e + 6] && 80 == t2[e + 7] && 69 == t2[e + 8] && 50 == t2[e + 9] && 46 == t2[e + 10] && 48 == t2[e + 11] && 3 == t2[e + 12] && 1 == t2[e + 13] && 0 == t2[e + 16]) e += 14, p2 = t2[e++] | t2[e++] << 8, e++; else for (e += 12; ; ) { if (!((P2 = t2[e++]) >= 0)) throw Error("Invalid block size"); if (0 === P2) break; e += P2; } break; case 249: if (4 !== t2[e++] || 0 !== t2[e + 4]) throw new Error("Invalid graphics extension block."); var g2 = t2[e++]; l2 = t2[e++] | t2[e++] << 8, f2 = t2[e++], 0 == (1 & g2) && (f2 = null), d2 = g2 >> 2 & 7, e++; break; case 254: for (; ; ) { if (!((P2 = t2[e++]) >= 0)) throw Error("Invalid block size"); if (0 === P2) break; e += P2; } break; default: throw new Error("Unknown graphic control label: 0x" + t2[e - 1].toString(16)); } break; case 44: var m2 = t2[e++] | t2[e++] << 8, v2 = t2[e++] | t2[e++] << 8, b3 = t2[e++] | t2[e++] << 8, y2 = t2[e++] | t2[e++] << 8, w2 = t2[e++], N2 = w2 >> 6 & 1, L2 = 1 << (7 & w2) + 1, A2 = s2, x2 = c2, S2 = false; if (w2 >> 7) { S2 = true; A2 = e, x2 = L2, e += 3 * L2; } var _2 = e; for (e++; ; ) { var P2; if (!((P2 = t2[e++]) >= 0)) throw Error("Invalid block size"); if (0 === P2) break; e += P2; } h2.push({ x: m2, y: v2, width: b3, height: y2, has_local_palette: S2, palette_offset: A2, palette_size: x2, data_offset: _2, data_length: e - _2, transparent_index: f2, interlaced: !!N2, delay: l2, disposal: d2 }); break; case 59: u2 = false; break; default: throw new Error("Unknown gif block: 0x" + t2[e - 1].toString(16)); } this.numFrames = function() { return h2.length; }, this.loopCount = function() { return p2; }, this.frameInfo = function(t3) { if (t3 < 0 || t3 >= h2.length) throw new Error("Frame index out of range."); return h2[t3]; }, this.decodeAndBlitFrameBGRA = function(e2, n3) { var i3 = this.frameInfo(e2), a3 = i3.width * i3.height, o3 = new Uint8Array(a3); $t(t2, i3.data_offset, o3, a3); var s3 = i3.palette_offset, c3 = i3.transparent_index; null === c3 && (c3 = 256); var u3 = i3.width, h3 = r - u3, l3 = u3, f3 = 4 * (i3.y * r + i3.x), d3 = 4 * ((i3.y + i3.height) * r + i3.x), p3 = f3, g3 = 4 * h3; true === i3.interlaced && (g3 += 4 * r * 7); for (var m3 = 8, v3 = 0, b5 = o3.length; v3 < b5; ++v3) { var y3 = o3[v3]; if (0 === l3 && (l3 = u3, (p3 += g3) >= d3 && (g3 = 4 * h3 + 4 * r * (m3 - 1), p3 = f3 + (u3 + h3) * (m3 << 1), m3 >>= 1)), y3 === c3) p3 += 4; else { var w3 = t2[s3 + 3 * y3], N3 = t2[s3 + 3 * y3 + 1], L3 = t2[s3 + 3 * y3 + 2]; n3[p3++] = L3, n3[p3++] = N3, n3[p3++] = w3, n3[p3++] = 255; } --l3; } }, this.decodeAndBlitFrameRGBA = function(e2, n3) { var i3 = this.frameInfo(e2), a3 = i3.width * i3.height, o3 = new Uint8Array(a3); $t(t2, i3.data_offset, o3, a3); var s3 = i3.palette_offset, c3 = i3.transparent_index; null === c3 && (c3 = 256); var u3 = i3.width, h3 = r - u3, l3 = u3, f3 = 4 * (i3.y * r + i3.x), d3 = 4 * ((i3.y + i3.height) * r + i3.x), p3 = f3, g3 = 4 * h3; true === i3.interlaced && (g3 += 4 * r * 7); for (var m3 = 8, v3 = 0, b5 = o3.length; v3 < b5; ++v3) { var y3 = o3[v3]; if (0 === l3 && (l3 = u3, (p3 += g3) >= d3 && (g3 = 4 * h3 + 4 * r * (m3 - 1), p3 = f3 + (u3 + h3) * (m3 << 1), m3 >>= 1)), y3 === c3) p3 += 4; else { var w3 = t2[s3 + 3 * y3], N3 = t2[s3 + 3 * y3 + 1], L3 = t2[s3 + 3 * y3 + 2]; n3[p3++] = w3, n3[p3++] = N3, n3[p3++] = L3, n3[p3++] = 255; } --l3; } }; } function $t(t2, e, r, n2) { for (var i2 = t2[e++], o2 = 1 << i2, s2 = o2 + 1, c2 = s2 + 1, u2 = i2 + 1, h2 = (1 << u2) - 1, l2 = 0, f2 = 0, d2 = 0, p2 = t2[e++], g2 = new Int32Array(4096), m2 = null; ; ) { for (; l2 < 16 && 0 !== p2; ) f2 |= t2[e++] << l2, l2 += 8, 1 === p2 ? p2 = t2[e++] : --p2; if (l2 < u2) break; var v2 = f2 & h2; if (f2 >>= u2, l2 -= u2, v2 !== o2) { if (v2 === s2) break; for (var b3 = v2 < c2 ? v2 : m2, y2 = 0, w2 = b3; w2 > o2; ) w2 = g2[w2] >> 8, ++y2; var N2 = w2; if (d2 + y2 + (b3 !== v2 ? 1 : 0) > n2) return void a.log("Warning, gif stream longer than expected."); r[d2++] = N2; var L2 = d2 += y2; for (b3 !== v2 && (r[d2++] = N2), w2 = b3; y2--; ) w2 = g2[w2], r[--L2] = 255 & w2, w2 >>= 8; null !== m2 && c2 < 4096 && (g2[c2++] = m2 << 8 | N2, c2 >= h2 + 1 && u2 < 12 && (++u2, h2 = h2 << 1 | 1)), m2 = v2; } else c2 = s2 + 1, h2 = (1 << (u2 = i2 + 1)) - 1, m2 = null; } return d2 !== n2 && a.log("Warning, gif stream shorter than expected."), r; } function Qt(t2) { var e, r, n2, i2, a2, o2 = Math.floor, s2 = new Array(64), c2 = new Array(64), u2 = new Array(64), h2 = new Array(64), l2 = new Array(65535), f2 = new Array(65535), d2 = new Array(64), p2 = new Array(64), g2 = [], m2 = 0, v2 = 7, b3 = new Array(64), y2 = new Array(64), w2 = new Array(64), N2 = new Array(256), L2 = new Array(2048), A2 = [0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63], x2 = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0], S2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], _2 = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125], P2 = [1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250], k2 = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], I2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], F2 = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119], C2 = [0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250]; function j2(t3, e2) { for (var r2 = 0, n3 = 0, i3 = new Array(), a3 = 1; a3 <= 16; a3++) { for (var o3 = 1; o3 <= t3[a3]; o3++) i3[e2[n3]] = [], i3[e2[n3]][0] = r2, i3[e2[n3]][1] = a3, n3++, r2++; r2 *= 2; } return i3; } function O2(t3) { for (var e2 = t3[0], r2 = t3[1] - 1; r2 >= 0; ) e2 & 1 << r2 && (m2 |= 1 << v2), r2--, --v2 < 0 && (255 == m2 ? (B2(255), B2(0)) : B2(m2), v2 = 7, m2 = 0); } function B2(t3) { g2.push(t3); } function M2(t3) { B2(t3 >> 8 & 255), B2(255 & t3); } function E2(t3, e2, r2, n3, i3) { for (var a3, o3 = i3[0], s3 = i3[240], c3 = function(t4, e3) { var r3, n4, i4, a4, o4, s4, c4, u4, h4, l3, f3 = 0; for (h4 = 0; h4 < 8; ++h4) { r3 = t4[f3], n4 = t4[f3 + 1], i4 = t4[f3 + 2], a4 = t4[f3 + 3], o4 = t4[f3 + 4], s4 = t4[f3 + 5], c4 = t4[f3 + 6]; var p3 = r3 + (u4 = t4[f3 + 7]), g4 = r3 - u4, m4 = n4 + c4, v4 = n4 - c4, b6 = i4 + s4, y4 = i4 - s4, w4 = a4 + o4, N3 = a4 - o4, L3 = p3 + w4, A3 = p3 - w4, x3 = m4 + b6, S3 = m4 - b6; t4[f3] = L3 + x3, t4[f3 + 4] = L3 - x3; var _3 = 0.707106781 * (S3 + A3); t4[f3 + 2] = A3 + _3, t4[f3 + 6] = A3 - _3; var P3 = 0.382683433 * ((L3 = N3 + y4) - (S3 = v4 + g4)), k3 = 0.5411961 * L3 + P3, I3 = 1.306562965 * S3 + P3, F3 = 0.707106781 * (x3 = y4 + v4), C3 = g4 + F3, j3 = g4 - F3; t4[f3 + 5] = j3 + k3, t4[f3 + 3] = j3 - k3, t4[f3 + 1] = C3 + I3, t4[f3 + 7] = C3 - I3, f3 += 8; } for (f3 = 0, h4 = 0; h4 < 8; ++h4) { r3 = t4[f3], n4 = t4[f3 + 8], i4 = t4[f3 + 16], a4 = t4[f3 + 24], o4 = t4[f3 + 32], s4 = t4[f3 + 40], c4 = t4[f3 + 48]; var O3 = r3 + (u4 = t4[f3 + 56]), B3 = r3 - u4, M3 = n4 + c4, E3 = n4 - c4, q3 = i4 + s4, D2 = i4 - s4, R2 = a4 + o4, T2 = a4 - o4, U2 = O3 + R2, z2 = O3 - R2, H2 = M3 + q3, W2 = M3 - q3; t4[f3] = U2 + H2, t4[f3 + 32] = U2 - H2; var V2 = 0.707106781 * (W2 + z2); t4[f3 + 16] = z2 + V2, t4[f3 + 48] = z2 - V2; var G2 = 0.382683433 * ((U2 = T2 + D2) - (W2 = E3 + B3)), Y2 = 0.5411961 * U2 + G2, J2 = 1.306562965 * W2 + G2, X2 = 0.707106781 * (H2 = D2 + E3), K2 = B3 + X2, Z2 = B3 - X2; t4[f3 + 40] = Z2 + Y2, t4[f3 + 24] = Z2 - Y2, t4[f3 + 8] = K2 + J2, t4[f3 + 56] = K2 - J2, f3++; } for (h4 = 0; h4 < 64; ++h4) l3 = t4[h4] * e3[h4], d2[h4] = l3 > 0 ? l3 + 0.5 | 0 : l3 - 0.5 | 0; return d2; }(t3, e2), u3 = 0; u3 < 64; ++u3) p2[A2[u3]] = c3[u3]; var h3 = p2[0] - r2; r2 = p2[0], 0 == h3 ? O2(n3[0]) : (O2(n3[f2[a3 = 32767 + h3]]), O2(l2[a3])); for (var g3 = 63; g3 > 0 && 0 == p2[g3]; ) g3--; if (0 == g3) return O2(o3), r2; for (var m3, v3 = 1; v3 <= g3; ) { for (var b5 = v3; 0 == p2[v3] && v3 <= g3; ) ++v3; var y3 = v3 - b5; if (y3 >= 16) { m3 = y3 >> 4; for (var w3 = 1; w3 <= m3; ++w3) O2(s3); y3 &= 15; } a3 = 32767 + p2[v3], O2(i3[(y3 << 4) + f2[a3]]), O2(l2[a3]), v3++; } return 63 != g3 && O2(o3), r2; } function q2(t3) { (t3 = Math.min(Math.max(t3, 1), 100), a2 != t3) && (!function(t4) { for (var e2 = [16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99], r2 = 0; r2 < 64; r2++) { var n3 = o2((e2[r2] * t4 + 50) / 100); n3 = Math.min(Math.max(n3, 1), 255), s2[A2[r2]] = n3; } for (var i3 = [17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99], a3 = 0; a3 < 64; a3++) { var l3 = o2((i3[a3] * t4 + 50) / 100); l3 = Math.min(Math.max(l3, 1), 255), c2[A2[a3]] = l3; } for (var f3 = [1, 1.387039845, 1.306562965, 1.175875602, 1, 0.785694958, 0.5411961, 0.275899379], d3 = 0, p3 = 0; p3 < 8; p3++) for (var g3 = 0; g3 < 8; g3++) u2[d3] = 1 / (s2[A2[d3]] * f3[p3] * f3[g3] * 8), h2[d3] = 1 / (c2[A2[d3]] * f3[p3] * f3[g3] * 8), d3++; }(t3 < 50 ? Math.floor(5e3 / t3) : Math.floor(200 - 2 * t3)), a2 = t3); } this.encode = function(t3, a3) { a3 && q2(a3), g2 = new Array(), m2 = 0, v2 = 7, M2(65496), M2(65504), M2(16), B2(74), B2(70), B2(73), B2(70), B2(0), B2(1), B2(1), B2(0), M2(1), M2(1), B2(0), B2(0), function() { M2(65499), M2(132), B2(0); for (var t4 = 0; t4 < 64; t4++) B2(s2[t4]); B2(1); for (var e2 = 0; e2 < 64; e2++) B2(c2[e2]); }(), function(t4, e2) { M2(65472), M2(17), B2(8), M2(e2), M2(t4), B2(3), B2(1), B2(17), B2(0), B2(2), B2(17), B2(1), B2(3), B2(17), B2(1); }(t3.width, t3.height), function() { M2(65476), M2(418), B2(0); for (var t4 = 0; t4 < 16; t4++) B2(x2[t4 + 1]); for (var e2 = 0; e2 <= 11; e2++) B2(S2[e2]); B2(16); for (var r2 = 0; r2 < 16; r2++) B2(_2[r2 + 1]); for (var n3 = 0; n3 <= 161; n3++) B2(P2[n3]); B2(1); for (var i3 = 0; i3 < 16; i3++) B2(k2[i3 + 1]); for (var a4 = 0; a4 <= 11; a4++) B2(I2[a4]); B2(17); for (var o4 = 0; o4 < 16; o4++) B2(F2[o4 + 1]); for (var s3 = 0; s3 <= 161; s3++) B2(C2[s3]); }(), M2(65498), M2(12), B2(3), B2(1), B2(0), B2(2), B2(17), B2(3), B2(17), B2(0), B2(63), B2(0); var o3 = 0, l3 = 0, f3 = 0; m2 = 0, v2 = 7, this.encode.displayName = "_encode_"; for (var d3, p3, N3, A3, j3, D2, R2, T2, U2, z2 = t3.data, H2 = t3.width, W2 = t3.height, V2 = 4 * H2, G2 = 0; G2 < W2; ) { for (d3 = 0; d3 < V2; ) { for (j3 = V2 * G2 + d3, R2 = -1, T2 = 0, U2 = 0; U2 < 64; U2++) D2 = j3 + (T2 = U2 >> 3) * V2 + (R2 = 4 * (7 & U2)), G2 + T2 >= W2 && (D2 -= V2 * (G2 + 1 + T2 - W2)), d3 + R2 >= V2 && (D2 -= d3 + R2 - V2 + 4), p3 = z2[D2++], N3 = z2[D2++], A3 = z2[D2++], b3[U2] = (L2[p3] + L2[N3 + 256 >> 0] + L2[A3 + 512 >> 0] >> 16) - 128, y2[U2] = (L2[p3 + 768 >> 0] + L2[N3 + 1024 >> 0] + L2[A3 + 1280 >> 0] >> 16) - 128, w2[U2] = (L2[p3 + 1280 >> 0] + L2[N3 + 1536 >> 0] + L2[A3 + 1792 >> 0] >> 16) - 128; o3 = E2(b3, u2, o3, e, n2), l3 = E2(y2, h2, l3, r, i2), f3 = E2(w2, h2, f3, r, i2), d3 += 32; } G2 += 8; } if (v2 >= 0) { var Y2 = []; Y2[1] = v2 + 1, Y2[0] = (1 << v2 + 1) - 1, O2(Y2); } return M2(65497), new Uint8Array(g2); }, t2 = t2 || 50, function() { for (var t3 = String.fromCharCode, e2 = 0; e2 < 256; e2++) N2[e2] = t3(e2); }(), e = j2(x2, S2), r = j2(k2, I2), n2 = j2(_2, P2), i2 = j2(F2, C2), function() { for (var t3 = 1, e2 = 2, r2 = 1; r2 <= 15; r2++) { for (var n3 = t3; n3 < e2; n3++) f2[32767 + n3] = r2, l2[32767 + n3] = [], l2[32767 + n3][1] = r2, l2[32767 + n3][0] = n3; for (var i3 = -(e2 - 1); i3 <= -t3; i3++) f2[32767 + i3] = r2, l2[32767 + i3] = [], l2[32767 + i3][1] = r2, l2[32767 + i3][0] = e2 - 1 + i3; t3 <<= 1, e2 <<= 1; } }(), function() { for (var t3 = 0; t3 < 256; t3++) L2[t3] = 19595 * t3, L2[t3 + 256 >> 0] = 38470 * t3, L2[t3 + 512 >> 0] = 7471 * t3 + 32768, L2[t3 + 768 >> 0] = -11059 * t3, L2[t3 + 1024 >> 0] = -21709 * t3, L2[t3 + 1280 >> 0] = 32768 * t3 + 8421375, L2[t3 + 1536 >> 0] = -27439 * t3, L2[t3 + 1792 >> 0] = -5329 * t3; }(), q2(t2); } function te2(t2, e) { if (this.pos = 0, this.buffer = t2, this.datav = new DataView(t2.buffer), this.is_with_alpha = !!e, this.bottom_up = true, this.flag = String.fromCharCode(this.buffer[0]) + String.fromCharCode(this.buffer[1]), this.pos += 2, -1 === ["BM", "BA", "CI", "CP", "IC", "PT"].indexOf(this.flag)) throw new Error("Invalid BMP File"); this.parseHeader(), this.parseBGR(); } function ee(t2) { function e(t3) { if (!t3) throw Error("assert :P"); } function r(t3, e2, r2) { for (var n3 = 0; 4 > n3; n3++) if (t3[e2 + n3] != r2.charCodeAt(n3)) return true; return false; } function n2(t3, e2, r2, n3, i3) { for (var a3 = 0; a3 < i3; a3++) t3[e2 + a3] = r2[n3 + a3]; } function i2(t3, e2, r2, n3) { for (var i3 = 0; i3 < n3; i3++) t3[e2 + i3] = r2; } function a2(t3) { return new Int32Array(t3); } function o2(t3, e2) { for (var r2 = [], n3 = 0; n3 < t3; n3++) r2.push(new e2()); return r2; } function s2(t3, e2) { var r2 = []; return function t4(r3, n3, i3) { for (var a3 = i3[n3], o3 = 0; o3 < a3 && (r3.push(i3.length > n3 + 1 ? [] : new e2()), !(i3.length < n3 + 1)); o3++) t4(r3[o3], n3 + 1, i3); }(r2, 0, t3), r2; } var c2 = function() { var t3 = this; function c3(t4, e2) { for (var r2 = 1 << e2 - 1 >>> 0; t4 & r2; ) r2 >>>= 1; return r2 ? (t4 & r2 - 1) + r2 : t4; } function u3(t4, r2, n3, i3, a3) { e(!(i3 % n3)); do { t4[r2 + (i3 -= n3)] = a3; } while (0 < i3); } function h3(t4, r2, n3, i3, o3) { if (e(2328 >= o3), 512 >= o3) var s3 = a2(512); else if (null == (s3 = a2(o3))) return 0; return function(t5, r3, n4, i4, o4, s4) { var h4, f4, d4 = r3, p4 = 1 << n4, g4 = a2(16), m4 = a2(16); for (e(0 != o4), e(null != i4), e(null != t5), e(0 < n4), f4 = 0; f4 < o4; ++f4) { if (15 < i4[f4]) return 0; ++g4[i4[f4]]; } if (g4[0] == o4) return 0; for (m4[1] = 0, h4 = 1; 15 > h4; ++h4) { if (g4[h4] > 1 << h4) return 0; m4[h4 + 1] = m4[h4] + g4[h4]; } for (f4 = 0; f4 < o4; ++f4) h4 = i4[f4], 0 < i4[f4] && (s4[m4[h4]++] = f4); if (1 == m4[15]) return (i4 = new l3()).g = 0, i4.value = s4[0], u3(t5, d4, 1, p4, i4), p4; var v4, b6 = -1, y4 = p4 - 1, w4 = 0, N4 = 1, L4 = 1, A4 = 1 << n4; for (f4 = 0, h4 = 1, o4 = 2; h4 <= n4; ++h4, o4 <<= 1) { if (N4 += L4 <<= 1, 0 > (L4 -= g4[h4])) return 0; for (; 0 < g4[h4]; --g4[h4]) (i4 = new l3()).g = h4, i4.value = s4[f4++], u3(t5, d4 + w4, o4, A4, i4), w4 = c3(w4, h4); } for (h4 = n4 + 1, o4 = 2; 15 >= h4; ++h4, o4 <<= 1) { if (N4 += L4 <<= 1, 0 > (L4 -= g4[h4])) return 0; for (; 0 < g4[h4]; --g4[h4]) { if (i4 = new l3(), (w4 & y4) != b6) { for (d4 += A4, v4 = 1 << (b6 = h4) - n4; 15 > b6 && !(0 >= (v4 -= g4[b6])); ) ++b6, v4 <<= 1; p4 += A4 = 1 << (v4 = b6 - n4), t5[r3 + (b6 = w4 & y4)].g = v4 + n4, t5[r3 + b6].value = d4 - r3 - b6; } i4.g = h4 - n4, i4.value = s4[f4++], u3(t5, d4 + (w4 >> n4), o4, A4, i4), w4 = c3(w4, h4); } } return N4 != 2 * m4[15] - 1 ? 0 : p4; }(t4, r2, n3, i3, o3, s3); } function l3() { this.value = this.g = 0; } function f3() { this.value = this.g = 0; } function d3() { this.G = o2(5, l3), this.H = a2(5), this.jc = this.Qb = this.qb = this.nd = 0, this.pd = o2(Dr, f3); } function p3(t4, r2, n3, i3) { e(null != t4), e(null != r2), e(2147483648 > i3), t4.Ca = 254, t4.I = 0, t4.b = -8, t4.Ka = 0, t4.oa = r2, t4.pa = n3, t4.Jd = r2, t4.Yc = n3 + i3, t4.Zc = 4 <= i3 ? n3 + i3 - 4 + 1 : n3, _2(t4); } function g3(t4, e2) { for (var r2 = 0; 0 < e2--; ) r2 |= k2(t4, 128) << e2; return r2; } function m3(t4, e2) { var r2 = g3(t4, e2); return P2(t4) ? -r2 : r2; } function v3(t4, r2, n3, i3) { var a3, o3 = 0; for (e(null != t4), e(null != r2), e(4294967288 > i3), t4.Sb = i3, t4.Ra = 0, t4.u = 0, t4.h = 0, 4 < i3 && (i3 = 4), a3 = 0; a3 < i3; ++a3) o3 += r2[n3 + a3] << 8 * a3; t4.Ra = o3, t4.bb = i3, t4.oa = r2, t4.pa = n3; } function b5(t4) { for (; 8 <= t4.u && t4.bb < t4.Sb; ) t4.Ra >>>= 8, t4.Ra += t4.oa[t4.pa + t4.bb] << Ur - 8 >>> 0, ++t4.bb, t4.u -= 8; A3(t4) && (t4.h = 1, t4.u = 0); } function y3(t4, r2) { if (e(0 <= r2), !t4.h && r2 <= Tr) { var n3 = L3(t4) & Rr[r2]; return t4.u += r2, b5(t4), n3; } return t4.h = 1, t4.u = 0; } function w3() { this.b = this.Ca = this.I = 0, this.oa = [], this.pa = 0, this.Jd = [], this.Yc = 0, this.Zc = [], this.Ka = 0; } function N3() { this.Ra = 0, this.oa = [], this.h = this.u = this.bb = this.Sb = this.pa = 0; } function L3(t4) { return t4.Ra >>> (t4.u & Ur - 1) >>> 0; } function A3(t4) { return e(t4.bb <= t4.Sb), t4.h || t4.bb == t4.Sb && t4.u > Ur; } function x2(t4, e2) { t4.u = e2, t4.h = A3(t4); } function S2(t4) { t4.u >= zr && (e(t4.u >= zr), b5(t4)); } function _2(t4) { e(null != t4 && null != t4.oa), t4.pa < t4.Zc ? (t4.I = (t4.oa[t4.pa++] | t4.I << 8) >>> 0, t4.b += 8) : (e(null != t4 && null != t4.oa), t4.pa < t4.Yc ? (t4.b += 8, t4.I = t4.oa[t4.pa++] | t4.I << 8) : t4.Ka ? t4.b = 0 : (t4.I <<= 8, t4.b += 8, t4.Ka = 1)); } function P2(t4) { return g3(t4, 1); } function k2(t4, e2) { var r2 = t4.Ca; 0 > t4.b && _2(t4); var n3 = t4.b, i3 = r2 * e2 >>> 8, a3 = (t4.I >>> n3 > i3) + 0; for (a3 ? (r2 -= i3, t4.I -= i3 + 1 << n3 >>> 0) : r2 = i3 + 1, n3 = r2, i3 = 0; 256 <= n3; ) i3 += 8, n3 >>= 8; return n3 = 7 ^ i3 + Hr[n3], t4.b -= n3, t4.Ca = (r2 << n3) - 1, a3; } function I2(t4, e2, r2) { t4[e2 + 0] = r2 >> 24 & 255, t4[e2 + 1] = r2 >> 16 & 255, t4[e2 + 2] = r2 >> 8 & 255, t4[e2 + 3] = r2 >> 0 & 255; } function F2(t4, e2) { return t4[e2 + 0] << 0 | t4[e2 + 1] << 8; } function C2(t4, e2) { return F2(t4, e2) | t4[e2 + 2] << 16; } function j2(t4, e2) { return F2(t4, e2) | F2(t4, e2 + 2) << 16; } function O2(t4, r2) { var n3 = 1 << r2; return e(null != t4), e(0 < r2), t4.X = a2(n3), null == t4.X ? 0 : (t4.Mb = 32 - r2, t4.Xa = r2, 1); } function B2(t4, r2) { e(null != t4), e(null != r2), e(t4.Xa == r2.Xa), n2(r2.X, 0, t4.X, 0, 1 << r2.Xa); } function M2() { this.X = [], this.Xa = this.Mb = 0; } function E2(t4, r2, n3, i3) { e(null != n3), e(null != i3); var a3 = n3[0], o3 = i3[0]; return 0 == a3 && (a3 = (t4 * o3 + r2 / 2) / r2), 0 == o3 && (o3 = (r2 * a3 + t4 / 2) / t4), 0 >= a3 || 0 >= o3 ? 0 : (n3[0] = a3, i3[0] = o3, 1); } function q2(t4, e2) { return t4 + (1 << e2) - 1 >>> e2; } function D2(t4, e2) { return ((4278255360 & t4) + (4278255360 & e2) >>> 0 & 4278255360) + ((16711935 & t4) + (16711935 & e2) >>> 0 & 16711935) >>> 0; } function R2(e2, r2) { t3[r2] = function(r3, n3, i3, a3, o3, s3, c4) { var u4; for (u4 = 0; u4 < o3; ++u4) { var h4 = t3[e2](s3[c4 + u4 - 1], i3, a3 + u4); s3[c4 + u4] = D2(r3[n3 + u4], h4); } }; } function T2() { this.ud = this.hd = this.jd = 0; } function U2(t4, e2) { return ((4278124286 & (t4 ^ e2)) >>> 1) + (t4 & e2) >>> 0; } function z2(t4) { return 0 <= t4 && 256 > t4 ? t4 : 0 > t4 ? 0 : 255 < t4 ? 255 : void 0; } function H2(t4, e2) { return z2(t4 + (t4 - e2 + 0.5 >> 1)); } function W2(t4, e2, r2) { return Math.abs(e2 - r2) - Math.abs(t4 - r2); } function V2(t4, e2, r2, n3, i3, a3, o3) { for (n3 = a3[o3 - 1], r2 = 0; r2 < i3; ++r2) a3[o3 + r2] = n3 = D2(t4[e2 + r2], n3); } function G2(t4, e2, r2, n3, i3) { var a3; for (a3 = 0; a3 < r2; ++a3) { var o3 = t4[e2 + a3], s3 = o3 >> 8 & 255, c4 = 16711935 & (c4 = (c4 = 16711935 & o3) + ((s3 << 16) + s3)); n3[i3 + a3] = (4278255360 & o3) + c4 >>> 0; } } function Y2(t4, e2) { e2.jd = t4 >> 0 & 255, e2.hd = t4 >> 8 & 255, e2.ud = t4 >> 16 & 255; } function J2(t4, e2, r2, n3, i3, a3) { var o3; for (o3 = 0; o3 < n3; ++o3) { var s3 = e2[r2 + o3], c4 = s3 >>> 8, u4 = s3, h4 = 255 & (h4 = (h4 = s3 >>> 16) + ((t4.jd << 24 >> 24) * (c4 << 24 >> 24) >>> 5)); u4 = 255 & (u4 = (u4 = u4 + ((t4.hd << 24 >> 24) * (c4 << 24 >> 24) >>> 5)) + ((t4.ud << 24 >> 24) * (h4 << 24 >> 24) >>> 5)); i3[a3 + o3] = (4278255360 & s3) + (h4 << 16) + u4; } } function X2(e2, r2, n3, i3, a3) { t3[r2] = function(t4, e3, r3, n4, o3, s3, c4, u4, h4) { for (n4 = c4; n4 < u4; ++n4) for (c4 = 0; c4 < h4; ++c4) o3[s3++] = a3(r3[i3(t4[e3++])]); }, t3[e2] = function(e3, r3, o3, s3, c4, u4, h4) { var l4 = 8 >> e3.b, f4 = e3.Ea, d4 = e3.K[0], p4 = e3.w; if (8 > l4) for (e3 = (1 << e3.b) - 1, p4 = (1 << l4) - 1; r3 < o3; ++r3) { var g4, m4 = 0; for (g4 = 0; g4 < f4; ++g4) g4 & e3 || (m4 = i3(s3[c4++])), u4[h4++] = a3(d4[m4 & p4]), m4 >>= l4; } else t3["VP8LMapColor" + n3](s3, c4, d4, p4, u4, h4, r3, o3, f4); }; } function K2(t4, e2, r2, n3, i3) { for (r2 = e2 + r2; e2 < r2; ) { var a3 = t4[e2++]; n3[i3++] = a3 >> 16 & 255, n3[i3++] = a3 >> 8 & 255, n3[i3++] = a3 >> 0 & 255; } } function Z2(t4, e2, r2, n3, i3) { for (r2 = e2 + r2; e2 < r2; ) { var a3 = t4[e2++]; n3[i3++] = a3 >> 16 & 255, n3[i3++] = a3 >> 8 & 255, n3[i3++] = a3 >> 0 & 255, n3[i3++] = a3 >> 24 & 255; } } function $2(t4, e2, r2, n3, i3) { for (r2 = e2 + r2; e2 < r2; ) { var a3 = (o3 = t4[e2++]) >> 16 & 240 | o3 >> 12 & 15, o3 = o3 >> 0 & 240 | o3 >> 28 & 15; n3[i3++] = a3, n3[i3++] = o3; } } function Q2(t4, e2, r2, n3, i3) { for (r2 = e2 + r2; e2 < r2; ) { var a3 = (o3 = t4[e2++]) >> 16 & 248 | o3 >> 13 & 7, o3 = o3 >> 5 & 224 | o3 >> 3 & 31; n3[i3++] = a3, n3[i3++] = o3; } } function tt2(t4, e2, r2, n3, i3) { for (r2 = e2 + r2; e2 < r2; ) { var a3 = t4[e2++]; n3[i3++] = a3 >> 0 & 255, n3[i3++] = a3 >> 8 & 255, n3[i3++] = a3 >> 16 & 255; } } function et3(t4, e2, r2, i3, a3, o3) { if (0 == o3) for (r2 = e2 + r2; e2 < r2; ) I2(i3, ((o3 = t4[e2++])[0] >> 24 | o3[1] >> 8 & 65280 | o3[2] << 8 & 16711680 | o3[3] << 24) >>> 0), a3 += 32; else n2(i3, a3, t4, e2, r2); } function rt2(e2, r2) { t3[r2][0] = t3[e2 + "0"], t3[r2][1] = t3[e2 + "1"], t3[r2][2] = t3[e2 + "2"], t3[r2][3] = t3[e2 + "3"], t3[r2][4] = t3[e2 + "4"], t3[r2][5] = t3[e2 + "5"], t3[r2][6] = t3[e2 + "6"], t3[r2][7] = t3[e2 + "7"], t3[r2][8] = t3[e2 + "8"], t3[r2][9] = t3[e2 + "9"], t3[r2][10] = t3[e2 + "10"], t3[r2][11] = t3[e2 + "11"], t3[r2][12] = t3[e2 + "12"], t3[r2][13] = t3[e2 + "13"], t3[r2][14] = t3[e2 + "0"], t3[r2][15] = t3[e2 + "0"]; } function nt2(t4) { return t4 == Hn || t4 == Wn || t4 == Vn || t4 == Gn; } function it2() { this.eb = [], this.size = this.A = this.fb = 0; } function at2() { this.y = [], this.f = [], this.ea = [], this.F = [], this.Tc = this.Ed = this.Cd = this.Fd = this.lb = this.Db = this.Ab = this.fa = this.J = this.W = this.N = this.O = 0; } function ot2() { this.Rd = this.height = this.width = this.S = 0, this.f = {}, this.f.RGBA = new it2(), this.f.kb = new at2(), this.sd = null; } function st2() { this.width = [0], this.height = [0], this.Pd = [0], this.Qd = [0], this.format = [0]; } function ct2() { this.Id = this.fd = this.Md = this.hb = this.ib = this.da = this.bd = this.cd = this.j = this.v = this.Da = this.Sd = this.ob = 0; } function ut2(t4) { return alert("todo:WebPSamplerProcessPlane"), t4.T; } function ht2(t4, e2) { var r2 = t4.T, i3 = e2.ba.f.RGBA, a3 = i3.eb, o3 = i3.fb + t4.ka * i3.A, s3 = vi[e2.ba.S], c4 = t4.y, u4 = t4.O, h4 = t4.f, l4 = t4.N, f4 = t4.ea, d4 = t4.W, p4 = e2.cc, g4 = e2.dc, m4 = e2.Mc, v4 = e2.Nc, b6 = t4.ka, y4 = t4.ka + t4.T, w4 = t4.U, N4 = w4 + 1 >> 1; for (0 == b6 ? s3(c4, u4, null, null, h4, l4, f4, d4, h4, l4, f4, d4, a3, o3, null, null, w4) : (s3(e2.ec, e2.fc, c4, u4, p4, g4, m4, v4, h4, l4, f4, d4, a3, o3 - i3.A, a3, o3, w4), ++r2); b6 + 2 < y4; b6 += 2) p4 = h4, g4 = l4, m4 = f4, v4 = d4, l4 += t4.Rc, d4 += t4.Rc, o3 += 2 * i3.A, s3(c4, (u4 += 2 * t4.fa) - t4.fa, c4, u4, p4, g4, m4, v4, h4, l4, f4, d4, a3, o3 - i3.A, a3, o3, w4); return u4 += t4.fa, t4.j + y4 < t4.o ? (n2(e2.ec, e2.fc, c4, u4, w4), n2(e2.cc, e2.dc, h4, l4, N4), n2(e2.Mc, e2.Nc, f4, d4, N4), r2--) : 1 & y4 || s3(c4, u4, null, null, h4, l4, f4, d4, h4, l4, f4, d4, a3, o3 + i3.A, null, null, w4), r2; } function lt2(t4, r2, n3) { var i3 = t4.F, a3 = [t4.J]; if (null != i3) { var o3 = t4.U, s3 = r2.ba.S, c4 = s3 == Tn || s3 == Vn; r2 = r2.ba.f.RGBA; var u4 = [0], h4 = t4.ka; u4[0] = t4.T, t4.Kb && (0 == h4 ? --u4[0] : (--h4, a3[0] -= t4.width), t4.j + t4.ka + t4.T == t4.o && (u4[0] = t4.o - t4.j - h4)); var l4 = r2.eb; h4 = r2.fb + h4 * r2.A; t4 = Sn(i3, a3[0], t4.width, o3, u4, l4, h4 + (c4 ? 0 : 3), r2.A), e(n3 == u4), t4 && nt2(s3) && An(l4, h4, c4, o3, u4, r2.A); } return 0; } function ft2(t4) { var e2 = t4.ma, r2 = e2.ba.S, n3 = 11 > r2, i3 = r2 == qn || r2 == Rn || r2 == Tn || r2 == Un || 12 == r2 || nt2(r2); if (e2.memory = null, e2.Ib = null, e2.Jb = null, e2.Nd = null, !Mr(e2.Oa, t4, i3 ? 11 : 12)) return 0; if (i3 && nt2(r2) && br(), t4.da) alert("todo:use_scaling"); else { if (n3) { if (e2.Ib = ut2, t4.Kb) { if (r2 = t4.U + 1 >> 1, e2.memory = a2(t4.U + 2 * r2), null == e2.memory) return 0; e2.ec = e2.memory, e2.fc = 0, e2.cc = e2.ec, e2.dc = e2.fc + t4.U, e2.Mc = e2.cc, e2.Nc = e2.dc + r2, e2.Ib = ht2, br(); } } else alert("todo:EmitYUV"); i3 && (e2.Jb = lt2, n3 && mr()); } if (n3 && !Ci) { for (t4 = 0; 256 > t4; ++t4) ji[t4] = 89858 * (t4 - 128) + _i >> Si, Mi[t4] = -22014 * (t4 - 128) + _i, Bi[t4] = -45773 * (t4 - 128), Oi[t4] = 113618 * (t4 - 128) + _i >> Si; for (t4 = Pi; t4 < ki; ++t4) e2 = 76283 * (t4 - 16) + _i >> Si, Ei[t4 - Pi] = Vt2(e2, 255), qi[t4 - Pi] = Vt2(e2 + 8 >> 4, 15); Ci = 1; } return 1; } function dt2(t4) { var r2 = t4.ma, n3 = t4.U, i3 = t4.T; return e(!(1 & t4.ka)), 0 >= n3 || 0 >= i3 ? 0 : (n3 = r2.Ib(t4, r2), null != r2.Jb && r2.Jb(t4, r2, n3), r2.Dc += n3, 1); } function pt2(t4) { t4.ma.memory = null; } function gt2(t4, e2, r2, n3) { return 47 != y3(t4, 8) ? 0 : (e2[0] = y3(t4, 14) + 1, r2[0] = y3(t4, 14) + 1, n3[0] = y3(t4, 1), 0 != y3(t4, 3) ? 0 : !t4.h); } function mt2(t4, e2) { if (4 > t4) return t4 + 1; var r2 = t4 - 2 >> 1; return (2 + (1 & t4) << r2) + y3(e2, r2) + 1; } function vt2(t4, e2) { return 120 < e2 ? e2 - 120 : 1 <= (r2 = ((r2 = $n[e2 - 1]) >> 4) * t4 + (8 - (15 & r2))) ? r2 : 1; var r2; } function bt2(t4, e2, r2) { var n3 = L3(r2), i3 = t4[e2 += 255 & n3].g - 8; return 0 < i3 && (x2(r2, r2.u + 8), n3 = L3(r2), e2 += t4[e2].value, e2 += n3 & (1 << i3) - 1), x2(r2, r2.u + t4[e2].g), t4[e2].value; } function yt2(t4, r2, n3) { return n3.g += t4.g, n3.value += t4.value << r2 >>> 0, e(8 >= n3.g), t4.g; } function wt2(t4, r2, n3) { var i3 = t4.xc; return e((r2 = 0 == i3 ? 0 : t4.vc[t4.md * (n3 >> i3) + (r2 >> i3)]) < t4.Wb), t4.Ya[r2]; } function Nt2(t4, r2, i3, a3) { var o3 = t4.ab, s3 = t4.c * r2, c4 = t4.C; r2 = c4 + r2; var u4 = i3, h4 = a3; for (a3 = t4.Ta, i3 = t4.Ua; 0 < o3--; ) { var l4 = t4.gc[o3], f4 = c4, d4 = r2, p4 = u4, g4 = h4, m4 = (h4 = a3, u4 = i3, l4.Ea); switch (e(f4 < d4), e(d4 <= l4.nc), l4.hc) { case 2: Gr(p4, g4, (d4 - f4) * m4, h4, u4); break; case 0: var v4 = f4, b6 = d4, y4 = h4, w4 = u4, N4 = (_3 = l4).Ea; 0 == v4 && (W