!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).htmlToImage = {}) }(this, function (t) { "use strict"; function d(t, c, u, a) { return new (u = u || Promise)(function (n, e) { function r(t) { try { o(a.next(t)) } catch (t) { e(t) } } function i(t) { try { o(a.throw(t)) } catch (t) { e(t) } } function o(t) { var e; t.done ? n(t.value) : ((e = t.value) instanceof u ? e : new u(function (t) { t(e) })).then(r, i) } o((a = a.apply(t, c || [])).next()) }) } function v(r, i) { var o, c, u, a = { label: 0, sent: function () { if (1 & u[0]) throw u[1]; return u[1] }, trys: [], ops: [] }, s = { next: t(0), throw: t(1), return: t(2) }; return "function" == typeof Symbol && (s[Symbol.iterator] = function () { return this }), s; function t(n) { return function (t) { var e = [n, t]; if (o) throw new TypeError("Generator is already executing."); for (; s && (e[s = 0] && (a = 0)), a;)try { if (o = 1, c && (u = 2 & e[0] ? c.return : e[0] ? c.throw || ((u = c.return) && u.call(c), 0) : c.next) && !(u = u.call(c, e[1])).done) return u; switch (c = 0, (e = u ? [2 & e[0], u.value] : e)[0]) { case 0: case 1: u = e; break; case 4: return a.label++, { value: e[1], done: !1 }; case 5: a.label++, c = e[1], e = [0]; continue; case 7: e = a.ops.pop(), a.trys.pop(); continue; default: if (!((u = 0 < (u = a.trys).length && u[u.length - 1]) || 6 !== e[0] && 2 !== e[0])) { a = 0; continue } if (3 === e[0] && (!u || e[1] > u[0] && e[1] < u[3])) { a.label = e[1]; break } if (6 === e[0] && a.label < u[1]) { a.label = u[1], u = e; break } if (u && a.label < u[2]) { a.label = u[2], a.ops.push(e); break } u[2] && a.ops.pop(), a.trys.pop(); continue }e = i.call(r, a) } catch (t) { e = [6, t], c = 0 } finally { o = u = 0 } if (5 & e[0]) throw e[1]; return { value: e[0] ? e[1] : void 0, done: !0 } } } } var s; s = 0; function u(t) { for (var e = [], n = 0, r = t.length; n < r; n++)e.push(t[n]); return e } var e = null; function f(t) { return void 0 === t && (t = {}), e = e || (t.includeStyleProperties || u(window.getComputedStyle(document.documentElement))) } function o(t, e) { t = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e); return t ? parseFloat(t.replace("px", "")) : 0 } function g(t, e) { var n, r, i; return { width: (e = void 0 === e ? {} : e).width || (r = o(n = t, "border-left-width"), i = o(n, "border-right-width"), n.clientWidth + r + i), height: e.height || (r = o(n = t, "border-top-width"), i = o(n, "border-bottom-width"), n.clientHeight + r + i) } } var p = 16384; function m(r) { return new Promise(function (t, e) { var n = new Image; n.onload = function () { n.decode().then(function () { requestAnimationFrame(function () { return t(n) }) }) }, n.onerror = e, n.crossOrigin = "anonymous", n.decoding = "async", n.src = r }) } function F(r, i, o) { return d(this, void 0, void 0, function () { var e, n; return v(this, function (t) { return n = "http://www.w3.org/2000/svg", e = document.createElementNS(n, "svg"), n = document.createElementNS(n, "foreignObject"), e.setAttribute("width", "".concat(i)), e.setAttribute("height", "".concat(o)), e.setAttribute("viewBox", "0 0 ".concat(i, " ").concat(o)), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("x", "0"), n.setAttribute("y", "0"), n.setAttribute("externalResourcesRequired", "true"), e.appendChild(n), n.appendChild(r), [2, function (e) { return d(this, void 0, void 0, function () { return v(this, function (t) { return [2, Promise.resolve().then(function () { return (new XMLSerializer).serializeToString(e) }).then(encodeURIComponent).then(function (t) { return "data:image/svg+xml;charset=utf-8,".concat(t) })] }) }) }(e)] }) }) } var w = function (t, e) { if (t instanceof e) return !0; t = Object.getPrototypeOf(t); return null !== t && (t.constructor.name === e.name || w(t, e)) }; function b(t, e, n, r) { var i, o, c = window.getComputedStyle(t, n), u = c.getPropertyValue("content"); if ("" !== u && "none" !== u) { s += 1; var u = "u".concat("0000".concat((Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4)).concat(s); try { e.className = "".concat(e.className, " ").concat(u) } catch (t) { return } var a = document.createElement("style"); a.appendChild((n = n, c = c, r = r, u = ".".concat(u = u, ":").concat(n), n = c.cssText ? (o = (n = c).getPropertyValue("content"), "".concat(n.cssText, " content: '").concat(o.replace(/'|"/g, ""), "';")) : (i = c, f(r).map(function (t) { var e = i.getPropertyValue(t), n = i.getPropertyPriority(t); return "".concat(t, ": ").concat(e).concat(n ? " !important" : "", ";") }).join(" ")), document.createTextNode("".concat(u, "{").concat(n, "}")))), e.appendChild(a) } } var n = "application/font-woff", r = "image/jpeg", V = { woff: n, woff2: n, ttf: "application/font-truetype", eot: "application/vnd.ms-fontobject", png: "image/png", jpg: r, jpeg: r, gif: "image/gif", tiff: "image/tiff", svg: "image/svg+xml", webp: "image/webp" }; function y(t) { t = ((t = /\.([^./]*?)$/g.exec(t)) ? t[1] : "").toLowerCase(); return V[t] || "" } function a(t) { return -1 !== t.search(/^(data:)/) } function S(t, e) { return "data:".concat(e, ";base64,").concat(t) } function E(e, n, o) { return d(this, void 0, void 0, function () { var r, i; return v(this, function (t) { switch (t.label) { case 0: return [4, fetch(e, n)]; case 1: if (404 === (r = t.sent()).status) throw new Error('Resource "'.concat(r.url, '" not found')); return [4, r.blob()]; case 2: return i = t.sent(), [2, new Promise(function (t, e) { var n = new FileReader; n.onerror = e, n.onloadend = function () { try { t(o({ res: r, result: n.result })) } catch (t) { e(t) } }, n.readAsDataURL(i) })] } }) }) } var x = {}; function C(s, l, h) { return d(this, void 0, void 0, function () { var o, c, u, a; return v(this, function (t) { switch (t.label) { case 0: if (e = s, n = l, r = h.includeQueryParams, i = e.replace(/\?.*/, ""), /ttf|otf|eot|woff2?/i.test(i = r ? e : i) && (i = i.replace(/.*\//, "")), o = n ? "[".concat(n, "]").concat(i) : i, null != x[o]) return [2, x[o]]; h.cacheBust && (s += (/\?/.test(s) ? "&" : "?") + (new Date).getTime()), t.label = 1; case 1: return t.trys.push([1, 3, , 4]), [4, E(s, h.fetchRequestInit, function (t) { var e = t.res, t = t.result; return l = l || (e.headers.get("Content-Type") || ""), t.split(/,/)[1] })]; case 2: return c = t.sent(), c = S(c, l), [3, 4]; case 3: return u = t.sent(), c = h.imagePlaceholder || "", a = "Failed to fetch resource: ".concat(s), (a = u ? "string" == typeof u ? u : u.message : a) && console.warn(a), [3, 4]; case 4: return [2, x[o] = c] }var e, n, r, i }) }) } var c = function (t) { return null != t.tagName && "SVG" === t.tagName.toUpperCase() }; function P(l, h, e) { return d(this, void 0, void 0, function () { return v(this, function (t) { return e || !h.filter || h.filter(l) ? [2, Promise.resolve(l).then(function (t) { return function (e, n) { return d(this, void 0, void 0, function () { return v(this, function (t) { return w(e, HTMLCanvasElement) ? [2, function (n) { return d(this, void 0, void 0, function () { var e; return v(this, function (t) { return "data:," === (e = n.toDataURL()) ? [2, n.cloneNode(!1)] : [2, m(e)] }) }) }(e)] : w(e, HTMLVideoElement) ? [2, function (r, i) { return d(this, void 0, void 0, function () { var e, n; return v(this, function (t) { switch (t.label) { case 0: return r.currentSrc ? (n = document.createElement("canvas"), e = n.getContext("2d"), n.width = r.clientWidth, n.height = r.clientHeight, null != e && e.drawImage(r, 0, 0, n.width, n.height), [2, m(n.toDataURL())]) : (e = r.poster, n = y(e), [4, C(e, n, i)]); case 1: return [2, m(t.sent())] } }) }) }(e, n)] : w(e, HTMLIFrameElement) ? [2, function (e, n) { var r; return d(this, void 0, void 0, function () { return v(this, function (t) { switch (t.label) { case 0: return t.trys.push([0, 3, , 4]), null != (r = null == e ? void 0 : e.contentDocument) && r.body ? [4, P(e.contentDocument.body, n, !0)] : [3, 2]; case 1: return [2, t.sent()]; case 2: return [3, 4]; case 3: return t.sent(), [3, 4]; case 4: return [2, e.cloneNode(!1)] } }) }) }(e, n)] : [2, e.cloneNode(c(e))] }) }) }(t, h) }).then(function (t) { return function (n, r, i) { var o; return d(this, void 0, void 0, function () { var e; return v(this, function (t) { switch (t.label) { case 0: return c(r) ? [2, r] : (e = [], 0 === (e = null != n.tagName && "SLOT" === n.tagName.toUpperCase() && n.assignedNodes ? u(n.assignedNodes()) : w(n, HTMLIFrameElement) && null != (o = n.contentDocument) && o.body ? u(n.contentDocument.body.childNodes) : u((null != (o = n.shadowRoot) ? o : n).childNodes)).length || w(n, HTMLVideoElement) ? [2, r] : [4, e.reduce(function (t, e) { return t.then(function () { return P(e, i) }).then(function (t) { t && r.appendChild(t) }) }, Promise.resolve())]); case 1: return t.sent(), [2, r] } }) }) }(l, t, h) }).then(function (t) { return e = l, n = h, w(t = t, Element) && (o = e, u = n, (s = (c = t).style) && ((a = window.getComputedStyle(o)).cssText ? (s.cssText = a.cssText, s.transformOrigin = a.transformOrigin) : f(u).forEach(function (t) { var e, n = a.getPropertyValue(t); "font-size" === t && n.endsWith("px") && (e = Math.floor(parseFloat(n.substring(0, n.length - 2))) - .1, n = "".concat(e, "px")), w(o, HTMLIFrameElement) && "display" === t && "inline" === n && (n = "block"), "d" === t && c.getAttribute("d") && (n = "path(".concat(c.getAttribute("d"), ")")), s.setProperty(t, n, a.getPropertyPriority(t)) })), b(u = e, i = t, ":before", n = n), b(u, i, ":after", n), u = t, w(i = e, HTMLTextAreaElement) && (u.innerHTML = i.value), w(i, HTMLInputElement) && u.setAttribute("value", i.value), n = t, w(r = e, HTMLSelectElement) && (n = Array.from(n.children).find(function (t) { return r.value === t.getAttribute("value") })) && n.setAttribute("selected", "")), t; var e, n, r, i, o, c, u, a, s }).then(function (t) { return function (h, f) { return d(this, void 0, void 0, function () { var e, n, r, i, o, c, u, a, s, l; return v(this, function (t) { switch (t.label) { case 0: if (0 === (e = h.querySelectorAll ? h.querySelectorAll("use") : []).length) return [2, h]; n = {}, l = 0, t.label = 1; case 1: return l < e.length ? (a = e[l], (a = a.getAttribute("xlink:href")) ? (u = h.querySelector(a), r = document.querySelector(a), u || !r || n[a] ? [3, 3] : (i = n, o = a, [4, P(r, f, !0)])) : [3, 3]) : [3, 4]; case 2: i[o] = t.sent(), t.label = 3; case 3: return l++, [3, 1]; case 4: if ((c = Object.values(n)).length) { for (u = "http://www.w3.org/1999/xhtml", (a = document.createElementNS(u, "svg")).setAttribute("xmlns", u), a.style.position = "absolute", a.style.width = "0", a.style.height = "0", a.style.overflow = "hidden", a.style.display = "none", s = document.createElementNS(u, "defs"), a.appendChild(s), l = 0; l < c.length; l++)s.appendChild(c[l]); h.appendChild(a) } return [2, h] } }) }) }(t, h) })] : [2, null] }) }) } var l = /url\((['"]?)([^'"]+?)\1\)/g, U = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, j = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g; function h(t) { return -1 !== t.search(l) } function R(o, c, u) { return d(this, void 0, void 0, function () { var n; return v(this, function (t) { return h(o) ? (e = o, i = u.preferredFontFormat, n = i ? e.replace(j, function (t) { for (; ;) { var e = U.exec(t) || [], n = e[0], e = e[2]; if (!e) return ""; if (e === i) return "src: ".concat(n, ";") } }) : e, r = [], n.replace(l, function (t, e, n) { return r.push(n), t }), [2, r.filter(function (t) { return !a(t) }).reduce(function (t, e) { return t.then(function (t) { return function (c, u, a, s, l) { return d(this, void 0, void 0, function () { var n, r, i, o; return v(this, function (t) { switch (t.label) { case 0: return t.trys.push([0, 5, , 6]), n = a ? function (t, e) { if (t.match(/^[a-z]+:\/\//i)) return t; if (t.match(/^\/\//)) return window.location.protocol + t; if (t.match(/^[a-z]+:/i)) return t; var n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a"); return n.head.appendChild(r), n.body.appendChild(i), e && (r.href = e), i.href = t, i.href }(u, a) : u, r = y(u), i = void 0, l ? [4, l(n)] : [3, 2]; case 1: return o = t.sent(), i = S(o, r), [3, 4]; case 2: return [4, C(n, r, s)]; case 3: i = t.sent(), t.label = 4; case 4: return [2, c.replace((e = u.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1"), new RegExp("(url\\(['\"]?)(".concat(e, ")(['\"]?\\))"), "g")), "$1".concat(i, "$3"))]; case 5: return t.sent(), [3, 6]; case 6: return [2, c] }var e }) }) }(t, e, c, u) }) }, Promise.resolve(n))]) : [2, o]; var r, e, i }) }) } function T(n, r, i) { var o; return d(this, void 0, void 0, function () { var e; return v(this, function (t) { switch (t.label) { case 0: return (e = null == (o = r.style) ? void 0 : o.getPropertyValue(n)) ? [4, R(e, null, i)] : [3, 2]; case 1: return e = t.sent(), r.style.setProperty(n, e, r.style.getPropertyPriority(n)), [2, !0]; case 2: return [2, !1] } }) }) } function A(e, n) { return d(this, void 0, void 0, function () { return v(this, function (t) { switch (t.label) { case 0: return w(e, Element) ? [4, function (r, i) { return d(this, void 0, void 0, function () { var e, n; return v(this, function (t) { switch (t.label) { case 0: return [4, T("background", r, i)]; case 1: return t.sent() ? [3, 3] : [4, T("background-image", r, i)]; case 2: t.sent(), t.label = 3; case 3: return [4, T("mask", r, i)]; case 4: return (n = t.sent()) ? [3, 6] : [4, T("-webkit-mask", r, i)]; case 5: n = t.sent(), t.label = 6; case 6: return (e = n) ? [3, 8] : [4, T("mask-image", r, i)]; case 7: e = t.sent(), t.label = 8; case 8: return e ? [3, 10] : [4, T("-webkit-mask-image", r, i)]; case 9: t.sent(), t.label = 10; case 10: return [2] } }) }) }(e, n)] : [3, 4]; case 1: return t.sent(), [4, function (o, c) { return d(this, void 0, void 0, function () { var e, n, i; return v(this, function (t) { switch (t.label) { case 0: return (e = w(o, HTMLImageElement)) && !a(o.src) || w(o, SVGImageElement) && !a(o.href.baseVal) ? [4, C(n = e ? o.src : o.href.baseVal, y(n), c)] : [2]; case 1: return i = t.sent(), [4, new Promise(function (n, r) { o.onload = n, o.onerror = c.onImageErrorHandler ? function () { for (var t = [], e = 0; e < arguments.length; e++)t[e] = arguments[e]; try { n(c.onImageErrorHandler.apply(c, t)) } catch (t) { r(t) } } : r; var t = o; t.decode && (t.decode = n), "lazy" === t.loading && (t.loading = "eager"), e ? (o.srcset = "", o.src = i) : o.href.baseVal = i })]; case 2: return t.sent(), [2] } }) }) }(e, n)]; case 2: return t.sent(), [4, function (n, r) { return d(this, void 0, void 0, function () { var e; return v(this, function (t) { switch (t.label) { case 0: return e = u(n.childNodes), e = e.map(function (t) { return A(t, r) }), [4, Promise.all(e).then(function () { return n })]; case 1: return t.sent(), [2] } }) }) }(e, n)]; case 3: t.sent(), t.label = 4; case 4: return [2] } }) }) } var i = {}; function L(r) { return d(this, void 0, void 0, function () { var e, n; return v(this, function (t) { switch (t.label) { case 0: return null != (e = i[r]) ? [2, e] : [4, fetch(r)]; case 1: return [4, t.sent().text()]; case 2: return n = t.sent(), e = { url: r, cssText: n }, [2, i[r] = e] } }) }) } function k(c, u) { return d(this, void 0, void 0, function () { var r, i, e, o = this; return v(this, function (t) { return r = c.cssText, i = /url\(["']?([^"')]+)["']?\)/g, e = r.match(/url\([^)]+\)/g) || [], e = e.map(function (n) { return d(o, void 0, void 0, function () { var e; return v(this, function (t) { return [2, E(e = (e = n.replace(i, "$1")).startsWith("https://") ? e : new URL(e, c.url).href, u.fetchRequestInit, function (t) { t = t.result; return r = r.replace(n, "url(".concat(t, ")")), [n, t] })] }) }) }), [2, Promise.all(e).then(function () { return r })] }) }) } function N(t) { if (null == t) return []; for (var e = [], n = t.replace(/(\/\*[\s\S]*?\*\/)/gi, ""), r = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi"); null !== (i = r.exec(n));)e.push(i[0]); for (var i, n = n.replace(r, ""), o = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, c = new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", "gi"); ;) { if (null === (i = o.exec(n))) { if (null === (i = c.exec(n))) break; o.lastIndex = c.lastIndex } else c.lastIndex = o.lastIndex; e.push(i[0]) } return e } function q(e, n) { return d(this, void 0, void 0, function () { return v(this, function (t) { switch (t.label) { case 0: if (null == e.ownerDocument) throw new Error("Provided element is not within a Document"); return [4, function (o, c) { return d(this, void 0, void 0, function () { var n, i; return v(this, function (t) { return n = [], i = [], o.forEach(function (r) { if ("cssRules" in r) try { u(r.cssRules || []).forEach(function (t, e) { var n; t.type === CSSRule.IMPORT_RULE && (n = e + 1, e = L(t.href).then(function (t) { return k(t, c) }).then(function (t) { return N(t).forEach(function (e) { try { r.insertRule(e, e.startsWith("@import") ? n += 1 : r.cssRules.length) } catch (t) { console.error("Error inserting rule from remote css", { rule: e, error: t }) } }) }).catch(function (t) { console.error("Error loading remote css", t.toString()) }), i.push(e)) }) } catch (t) { var e = o.find(function (t) { return null == t.href }) || document.styleSheets[0]; null != r.href && i.push(L(r.href).then(function (t) { return k(t, c) }).then(function (t) { return N(t).forEach(function (t) { e.insertRule(t, e.cssRules.length) }) }).catch(function (t) { console.error("Error loading remote stylesheet", t) })), console.error("Error inlining remote css file", t) } }), [2, Promise.all(i).then(function () { return o.forEach(function (e) { if ("cssRules" in e) try { u(e.cssRules || []).forEach(function (t) { n.push(t) }) } catch (t) { console.error("Error while reading CSS rules from ".concat(e.href), t) } }), n })] }) }) }(u(e.ownerDocument.styleSheets), n)]; case 1: return [2, t.sent().filter(function (t) { return t.type === CSSRule.FONT_FACE_RULE }).filter(function (t) { return h(t.style.getPropertyValue("src")) })] } }) }) } function I(t) { return t.trim().replace(/["']/g, "") } function D(o, c) { return d(this, void 0, void 0, function () { var r, i; return v(this, function (t) { switch (t.label) { case 0: return [4, q(o, c)]; case 1: return r = t.sent(), e = o, n = new Set, function e(t) { (t.style.getPropertyValue('font-family') || getComputedStyle(t).fontFamily).split(",").forEach(function (t) { n.add(I(t)) }), Array.from(t.children).forEach(function (t) { t instanceof HTMLElement && e(t) }) }(e), i = n, [4, Promise.all(r.filter(function (t) { return i.has(I(t.style.getPropertyValue('font-family'))) }).map(function (t) { var e = t.parentStyleSheet ? t.parentStyleSheet.href : null; return R(t.cssText, e, c) }))]; case 2: return [2, t.sent().join("\n")] }var e, n }) }) } function H(u, a) { return void 0 === a && (a = {}), d(this, void 0, void 0, function () { var i, o, c; return v(this, function (t) { switch (t.label) { case 0: return o = g(u, a), i = o.width, o = o.height, [4, P(u, a, !0)]; case 1: return [4, function (o, c) { return d(this, void 0, void 0, function () { var e, n, r, i; return v(this, function (t) { switch (t.label) { case 0: return null == c.fontEmbedCSS ? [3, 1] : (e = c.fontEmbedCSS, [3, 5]); case 1: return c.skipFonts ? (n = null, [3, 4]) : [3, 2]; case 2: return [4, D(o, c)]; case 3: n = t.sent(), t.label = 4; case 4: e = n, t.label = 5; case 5: return (i = e) && (r = document.createElement("style"), i = document.createTextNode(i), r.appendChild(i), o.firstChild ? o.insertBefore(r, o.firstChild) : o.appendChild(r)), [2] } }) }) }(c = t.sent(), a)]; case 2: return t.sent(), [4, A(c, a)]; case 3: return t.sent(), e = a, n = c.style, e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = "".concat(e.width, "px")), e.height && (n.height = "".concat(e.height, "px")), null != (r = e.style) && Object.keys(r).forEach(function (t) { n[t] = r[t] }), [4, F(c, i, o)]; case 4: return [2, t.sent()] }var e, n, r }) }) } function M(l, h) { return void 0 === h && (h = {}), d(this, void 0, void 0, function () { var n, r, i, o, c, u, a, s; return v(this, function (t) { switch (t.label) { case 0: return r = g(l, h), n = r.width, r = r.height, [4, H(l, h)]; case 1: return [4, m(t.sent())]; case 2: return i = t.sent(), o = document.createElement("canvas"), c = o.getContext("2d"), u = h.pixelRatio || function () { var t; try { e = process } catch (t) { } var e = e && e.env ? e.env.devicePixelRatio : null; return e && (t = parseInt(e, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1 }(), a = h.canvasWidth || n, s = h.canvasHeight || r, o.width = a * u, o.height = s * u, h.skipAutoScale || ((e = o).width > p || e.height > p) && (e.width > p && e.height > p ? e.width > e.height ? (e.height *= p / e.width, e.width = p) : (e.width *= p / e.height, e.height = p) : e.width > p ? (e.height *= p / e.width, e.width = p) : (e.width *= p / e.height, e.height = p)), o.style.width = "".concat(a), o.style.height = "".concat(s), h.backgroundColor && (c.fillStyle = h.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(i, 0, 0, o.width, o.height), [2, o] }var e }) }) } t.getFontEmbedCSS = function (e, n) { return void 0 === n && (n = {}), d(this, void 0, void 0, function () { return v(this, function (t) { return [2, D(e, n)] }) }) }, t.toBlob = function (e, n) { return void 0 === n && (n = {}), d(this, void 0, void 0, function () { return v(this, function (t) { switch (t.label) { case 0: return [4, M(e, n)]; case 1: return [4, (o = t.sent(), void 0 === c && (c = {}), o.toBlob ? new Promise(function (t) { o.toBlob(t, c.type || "image/png", c.quality || 1) }) : new Promise(function (t) { for (var e = window.atob(o.toDataURL(c.type || void 0, c.quality || void 0).split(",")[1]), n = e.length, r = new Uint8Array(n), i = 0; i < n; i += 1)r[i] = e.charCodeAt(i); t(new Blob([r], { type: c.type || "image/png" })) }))]; case 2: return [2, t.sent()] }var o, c }) }) }, t.toCanvas = M, t.toJpeg = function (e, n) { return void 0 === n && (n = {}), d(this, void 0, void 0, function () { return v(this, function (t) { switch (t.label) { case 0: return [4, M(e, n)]; case 1: return [2, t.sent().toDataURL("image/jpeg", n.quality || 1)] } }) }) }, t.toPixelData = function (r, i) { return void 0 === i && (i = {}), d(this, void 0, void 0, function () { var e, n; return v(this, function (t) { switch (t.label) { case 0: return n = g(r, i), e = n.width, n = n.height, [4, M(r, i)]; case 1: return [2, t.sent().getContext("2d").getImageData(0, 0, e, n).data] } }) }) }, t.toPng = function (e, n) { return void 0 === n && (n = {}), d(this, void 0, void 0, function () { return v(this, function (t) { switch (t.label) { case 0: return [4, M(e, n)]; case 1: return [2, t.sent().toDataURL()] } }) }) }, t.toSvg = H });