!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]g||e.height>g)&&(e.width>g&&e.height>g?e.width>e.height?(e.height*=g/e.width,e.width=g):(e.width*=g/e.height,e.height=g):e.width>g?(e.height*=g/e.width,e.width=g):(e.width*=g/e.height,e.height=g)),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,H(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