/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/dom-to-image-improved@2.8.0/src/dom-to-image-improved.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(e){"use strict";var t=function(){return{escape:function(e){return e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},parseExtension:t,mimeType:function(e){var n=t(e).toLowerCase();return(r="application/font-woff",o="image/jpeg",{woff:r,woff2:r,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:o,jpeg:o,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"})[n]||"";var r,o},dataAsUrl:function(e,t){return"data:"+t+";base64,"+e},isDataUrl:function(e){return-1!==e.search(/^(data:)/)},canvasToBlob:function(e){return e.toBlob?new Promise((function(t){e.toBlob(t)})):function(e){return new Promise((function(t){for(var n=window.atob(e.toDataURL().split(",")[1]),r=n.length,o=new Uint8Array(r),i=0;i<r;i++)o[i]=n.charCodeAt(i);t(new Blob([o],{type:"image/png"}))}))}(e)},resolveUrl:function(e,t){var n=document.implementation.createHTMLDocument(),r=n.createElement("base");n.head.appendChild(r);var o=n.createElement("a");return n.body.appendChild(o),r.href=t,o.href=e,o.href},getAndEncode:function(e){var t=3e4;a.impl.options.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());return new Promise((function(n){var r,o=new XMLHttpRequest;if(o.onreadystatechange=u,o.ontimeout=c,o.responseType="blob",o.timeout=t,a.impl.options.useCredentials&&(o.withCredentials=!0),o.open("GET",e,!0),o.send(),a.impl.options.imagePlaceholder){var i=a.impl.options.imagePlaceholder.split(/,/);i&&i[1]&&(r=i[1])}function u(){if(4===o.readyState)if(200===o.status){var t=new FileReader;t.onloadend=function(){var e=t.result.split(/,/)[1];n(e)},t.readAsDataURL(o.response)}else r?n(r):s("cannot fetch resource: "+e+", status: "+o.status)}function c(){r?n(r):s("timeout of "+t+"ms occured while fetching resource: "+e)}function s(e){console.error(e),n("")}}))},uid:(e=0,function(){return"u"+t()+e++;function t(){return("0000"+(Math.random()*Math.pow(36,4)|0).toString(36)).slice(-4)}}),delay:function(e){return function(t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))}},asArray:function(e){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t},isChrome:function(){return/chrome/i.test(navigator.userAgent)},escapeXhtml:function(e){return e.replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(e){return"data:,"===e?Promise.resolve():new Promise((function(t,n){var r=new Image;a.impl.options.useCredentials&&(r.crossOrigin="use-credentials"),r.onload=function(){t(r)},r.onerror=n,r.src=e}))},width:function(e){var t=n(e,"border-left-width"),r=n(e,"border-right-width");return e.scrollWidth+t+r},height:function(e){var t=n(e,"border-top-width"),r=n(e,"border-bottom-width");return e.scrollHeight+t+r}};var e;function t(e){var t=/\.([^\.\/]*?)(\?|$)/g.exec(e);return t?t[1]:""}function n(e,t){var n=window.getComputedStyle(e).getPropertyValue(t);return parseFloat(n.replace("px",""))}}(),n=function(){var e=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:function(e,t,i){return a()?Promise.resolve(e):Promise.resolve(e).then(r).then((function(n){var r=Promise.resolve(e);return n.forEach((function(e){r=r.then((function(n){return o(n,e,t,i)}))})),r}));function a(){return!n(e)}},shouldProcess:n,impl:{readUrls:r,inline:o}};function n(t){return-1!==t.search(e)}function r(n){for(var r,o=[];null!==(r=e.exec(n));)o.push(r[1]);return o.filter((function(e){return!t.isDataUrl(e)}))}function o(e,n,r,o){return Promise.resolve(n).then((function(e){return r?t.resolveUrl(e,r):e})).then(o||t.getAndEncode).then((function(e){return t.dataAsUrl(e,t.mimeType(n))})).then((function(r){return e.replace(function(e){return new RegExp("(url\\(['\"]?)("+t.escape(e)+")(['\"]?\\))","g")}(n),"$1"+r+"$3")}))}}(),r=function(){return{resolveAll:function(){return e(document).then((function(e){return Promise.all(e.map((function(e){return e.resolve()})))})).then((function(e){return e.join("\n")}))},impl:{readAll:e}};function e(){return Promise.resolve(t.asArray(document.styleSheets)).then((function(e){var n=[];return e.forEach((function(e){if(e.hasOwnProperty("cssRules"))try{t.asArray(e.cssRules||[]).forEach(n.push.bind(n))}catch(t){console.log("Error while reading CSS rules from "+e.href,t.toString())}})),n})).then((function(e){return e.filter((function(e){return e.type===CSSRule.FONT_FACE_RULE})).filter((function(e){return n.shouldProcess(e.style.getPropertyValue("src"))}))})).then((function(t){return t.map(e)}));function e(e){return{resolve:function(){var t=(e.parentStyleSheet||{}).href;return n.inlineAll(e.cssText,t)},src:function(){return e.style.getPropertyValue("src")}}}}}(),o=function(){return{inlineAll:function r(o){return o instanceof Element?i(o).then((function(){return o instanceof HTMLImageElement?e(o).inline():Promise.all(t.asArray(o.childNodes).map((function(e){return r(e)})))})):Promise.resolve(o);function i(e){var t=e.style.getPropertyValue("background");return t?n.inlineAll(t).then((function(t){e.style.setProperty("background",t,e.style.getPropertyPriority("background"))})).then((function(){return e})):Promise.resolve(e)}},impl:{newImage:e}};function e(e){return{inline:function(n){return t.isDataUrl(e.src)?Promise.resolve():Promise.resolve(e.src).then(n||t.getAndEncode).then((function(n){return t.dataAsUrl(n,t.mimeType(e.src))})).then((function(t){return new Promise((function(n,r){e.onload=n,e.onerror=n,e.src=t}))}))}}}}(),i={imagePlaceholder:void 0,cacheBust:!1,useCredentials:!1},a={toSvg:u,toPng:function(e,t){return c(e,t||{}).then((function(e){return e.toDataURL()}))},toJpeg:function(e,t){return c(e,t=t||{}).then((function(e){return e.toDataURL("image/jpeg",t.quality||1)}))},toBlob:function(e,n){return c(e,n||{}).then(t.canvasToBlob)},toPixelData:function(e,n){return c(e,n||{}).then((function(n){return n.getContext("2d").getImageData(0,0,t.width(e),t.height(e)).data}))},toCanvas:function(e,t){return c(e,t||{})},impl:{fontFaces:r,images:o,util:t,inliner:n,options:{}}};function u(e,n){return function(e){void 0===e.imagePlaceholder?a.impl.options.imagePlaceholder=i.imagePlaceholder:a.impl.options.imagePlaceholder=e.imagePlaceholder;void 0===e.cacheBust?a.impl.options.cacheBust=i.cacheBust:a.impl.options.cacheBust=e.cacheBust;void 0===e.useCredentials?a.impl.options.useCredentials=i.useCredentials:a.impl.options.useCredentials=e.useCredentials}(n=n||{}),Promise.resolve(e).then((function(e){return s(e,n.filter,!0)})).then(l).then(f).then((function(e){n.bgcolor&&(e.style.backgroundColor=n.bgcolor);n.width&&(e.style.width=n.width+"px");n.height&&(e.style.height=n.height+"px");n.style&&Object.keys(n.style).forEach((function(t){e.style[t]=n.style[t]}));return e})).then((function(r){return function(e,n,r){return Promise.resolve(e).then((function(e){return e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(e)})).then(t.escapeXhtml).then((function(e){return'<foreignObject x="0" y="0" width="100%" height="100%">'+e+"</foreignObject>"})).then((function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+r+'">'+e+"</svg>"})).then((function(e){return"data:image/svg+xml;charset=utf-8,"+e}))}(r,n.width||t.width(e),n.height||t.height(e))}))}function c(e,n){return u(e,n).then(t.makeImage).then(t.delay(100)).then((function(r){var o="number"!=typeof n.scale?1:n.scale;console.log("scale",o);var i=function(e,r){var o=document.createElement("canvas");if(o.width=(n.width||t.width(e))*r,o.height=(n.height||t.height(e))*r,console.log(o.width,o.height),n.bgcolor){var i=o.getContext("2d");i.fillStyle=n.bgcolor,i.fillRect(0,0,o.width,o.height)}return o}(e,o),a=i.getContext("2d");return r&&(a.scale(o,o),n.canvas&&n.canvas.width&&(i.width=n.canvas.width),n.canvas&&n.canvas.height&&(i.height=n.canvas.height),n.canvas?(console.log("canv",n.canvas),a.drawImage(r,n.canvas.sx||0,n.canvas.sy||0,n.canvas.sw||n.width,n.canvas.sh||n.height,n.canvas.dx||0,n.canvas.dy||0,n.canvas.dw||n.width,n.canvas.dh||n.height)):a.drawImage(r,0,0)),i}))}function s(e,n,r){return r||!n||n(e)?Promise.resolve(e).then((function(e){return e instanceof HTMLCanvasElement?t.makeImage(e.toDataURL()):e.cloneNode(!1)})).then((function(r){return function(e,n,r){var o="use"===e.tagName?function(e){var t=document.getElementById(e.href.baseVal.replace("#",""));return[t.cloneNode(!0)]}(e):e.childNodes;return 0===o.length?Promise.resolve(n):i(n,t.asArray(o),r).then((function(){return n}));function i(e,t,n){var r=Promise.resolve();return t.forEach((function(t){r=r.then((function(){return s(t,n)})).then((function(t){t&&e.appendChild(t)}))})),r}}(e,r,n)})).then((function(n){return function(e,n){return n instanceof Element?Promise.resolve().then(r).then(o).then(i).then(a).then((function(){return n})):n;function r(){function r(e,n){function r(e,n){t.asArray(e).forEach((function(t){n.setProperty(t,e.getPropertyValue(t),e.getPropertyPriority(t))}))}e.cssText?(n.cssText=e.cssText,n.font=e.font):r(e,n)}r(window.getComputedStyle(e),n.style),t.isChrome()&&n.style.marker&&("line"===n.tagName||"path"===n.tagName)&&(n.style.marker="")}function o(){function r(r){var o=window.getComputedStyle(e,r),i=o.getPropertyValue("content");if(""!==i&&"none"!==i){var a=t.uid(),u=n.getAttribute("class");u&&n.setAttribute("class",u+" "+a);var c=document.createElement("style");c.appendChild(s(a,r,o)),n.appendChild(c)}function s(e,n,r){var o="."+e+":"+n,i=r.cssText?a(r):u(r);return document.createTextNode(o+"{"+i+"}");function a(e){var t=e.getPropertyValue("content");return e.cssText+" content: "+t+";"}function u(e){return t.asArray(e).map(n).join("; ")+";";function n(t){return t+": "+e.getPropertyValue(t)+(e.getPropertyPriority(t)?" !important":"")}}}}[":before",":after"].forEach((function(e){r(e)}))}function i(){e instanceof HTMLTextAreaElement&&(n.innerHTML=e.value),e instanceof HTMLInputElement&&n.setAttribute("value",e.value)}function a(){n instanceof SVGElement&&(n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n instanceof SVGRectElement&&["width","height"].forEach((function(e){var t=n.getAttribute(e);t&&n.style.setProperty(e,t)})))}}(e,n)})):Promise.resolve()}function l(e){return r.resolveAll().then((function(t){var n=document.createElement("style");return e.appendChild(n),n.appendChild(document.createTextNode(t)),e}))}function f(e){return o.inlineAll(e).then((function(){return e}))}"object"==typeof exports&&"object"==typeof module?module.exports=a:e.domtoimage=a}(this);
//# sourceMappingURL=/sm/7a1e8ce8a05312aefcbac79d233caab75721f22d5e61c98c64845159d5bf6e6b.map