/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/hn-html2canvas@4.0.0/src/core.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var Support=require("./support"),CanvasRenderer=require("./renderers/canvas"),ImageLoader=require("./imageloader"),NodeParser=require("./nodeparser"),NodeContainer=require("./nodecontainer"),log=require("./log"),utils=require("./utils"),createWindowClone=require("./clone"),loadUrlDocument=require("./proxy").loadUrlDocument,getBounds=utils.getBounds,html2canvasNodeAttribute="data-html2canvas-node",html2canvasCloneIndex=0;function html2canvas(e,t){var n=html2canvasCloneIndex++;if((t=t||{}).logging&&(window.html2canvas.logging=!0,window.html2canvas.start=Date.now()),t.async=void 0===t.async||t.async,t.allowTaint=void 0!==t.allowTaint&&t.allowTaint,t.removeContainer=void 0===t.removeContainer||t.removeContainer,t.javascriptEnabled=void 0!==t.javascriptEnabled&&t.javascriptEnabled,t.imageTimeout=void 0===t.imageTimeout?1e4:t.imageTimeout,t.renderer="function"==typeof t.renderer?t.renderer:CanvasRenderer,t.strict=!!t.strict,"string"==typeof e){if("string"!=typeof t.proxy)return Promise.reject("Proxy must be used when rendering url");var o=null!=t.width?t.width:window.innerWidth,r=null!=t.height?t.height:window.innerHeight;return loadUrlDocument(absoluteUrl(e),t.proxy,document,o,r,t).then((function(e){return renderWindow(e.contentWindow.document.documentElement,e,t,o,r)}))}var a=(void 0===e?[document.documentElement]:e.length?e:[e])[0];return a.setAttribute(html2canvasNodeAttribute+n,n),renderDocument(a.ownerDocument,t,a.ownerDocument.defaultView.innerWidth,a.ownerDocument.defaultView.innerHeight,n).then((function(e){return"function"==typeof t.onrendered&&(log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),t.onrendered(e)),e}))}html2canvas.CanvasRenderer=CanvasRenderer,html2canvas.NodeContainer=NodeContainer,html2canvas.log=log,html2canvas.utils=utils;var html2canvasExport="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return Promise.reject("No canvas support")}:html2canvas;function renderDocument(e,t,n,o,r){return createWindowClone(e,e,n,o,t,e.defaultView.pageXOffset,e.defaultView.pageYOffset).then((function(a){log("Document cloned");var i=html2canvasNodeAttribute+r,d="["+i+"='"+r+"']";e.querySelector(d).removeAttribute(i);var c=a.contentWindow,u=c.document.querySelector(d);return("function"==typeof t.onclone?Promise.resolve(t.onclone(c.document)):Promise.resolve(!0)).then((function(){return renderWindow(u,a,t,n,o)}))}))}function renderWindow(e,t,n,o,r){var a=t.contentWindow,i=new Support(a.document),d=new ImageLoader(n,i),c=getBounds(e),u="view"===n.type?o:documentWidth(a.document),l="view"===n.type?r:documentHeight(a.document),h=new n.renderer(u,l,d,n,document);return new NodeParser(e,h,i,d,n).ready.then((function(){var o;return log("Finished rendering"),o="view"===n.type?crop(h.canvas,{width:h.canvas.width,height:h.canvas.height,top:0,left:0,x:0,y:0}):e===a.document.body||e===a.document.documentElement||null!=n.canvas?h.canvas:crop(h.canvas,{width:null!=n.width?n.width:c.width,height:null!=n.height?n.height:c.height,top:c.top,left:c.left,x:a.pageXOffset,y:a.pageYOffset}),cleanupContainer(t,n),o}))}function cleanupContainer(e,t){t.removeContainer&&(e.parentNode.removeChild(e),log("Cleaned up container"))}function crop(e,t){var n=document.createElement("canvas"),o=Math.min(e.width-1,Math.max(0,t.left)),r=Math.min(e.width,Math.max(1,t.left+t.width)),a=Math.min(e.height-1,Math.max(0,t.top)),i=Math.min(e.height,Math.max(1,t.top+t.height));return n.width=t.width,n.height=t.height,log("Cropping canvas at:","left:",t.left,"top:",t.top,"width:",r-o,"height:",i-a),log("Resulting crop with width",t.width,"and height",t.height," with x",o,"and y",a),n.getContext("2d").drawImage(e,o,a,r-o,i-a,t.x,t.y,r-o,i-a),n}function documentWidth(e){return Math.max(Math.max(e.body.scrollWidth,e.documentElement.scrollWidth),Math.max(e.body.offsetWidth,e.documentElement.offsetWidth),Math.max(e.body.clientWidth,e.documentElement.clientWidth))}function documentHeight(e){return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))}function absoluteUrl(e){var t=document.createElement("a");return t.href=e,t.href=t.href,t}module.exports=html2canvasExport,"function"==typeof define&&define.amd&&define("html2canvas",[],(function(){return html2canvasExport}));
//# sourceMappingURL=/sm/7aa8f8c04758d919080e2ebf48966d39e8ae5ba6a187c1d9f7466f46a65f9e77.map