/*! iframe2image - v0.2.1 - 2017-06-14 * https://github.com/twolfson/iframe2image * Copyright (c) 2017 Todd Wolfson; Licensed MIT */ (function(){"use strict";function t(t,n,r){var i=getComputedStyle(n);if(e)t.style.cssText=i.cssText;else for(var s in i)isNaN(parseInt(s,10))&&typeof i[s]!="function"&&!/^(cssText|length|parentRule)$/.test(s)&&(t.style[s]=i[s])}function n(e,n){var r=e.querySelectorAll("*"),i=n.querySelectorAll("*");t(e,n,1),Array.prototype.forEach.call(r,function(e,n){t(e,i[n])}),e.style.margin=e.style.marginLeft=e.style.marginTop=e.style.marginBottom=e.style.marginRight=""}var e=getComputedStyle(document.body).cssText!=="";window.domvas={toImage:function(e,t,r,i,s,o){s=s||0,o=o||0;var u=e.cloneNode(!0);n(u,e),u.setAttribute("xmlns","http://www.w3.org/1999/xhtml");var a=(new XMLSerializer).serializeToString(u),f="data:image/svg+xml,"+""+a+""+"",l=new Image;l.src=f,l.onload=function(){t&&t.call(this,this)}}}})(),function(e){function t(e,t){function s(){var e=n.contentWindow.document.body,r=getComputedStyle(n),i=parseInt(r.height,"10"),s=parseInt(r.width,"10");domvas.toImage(e,function(e){t(null,e)},s,i)}var n=e.iframe||e;if(!n.contentWindow)throw new Error("Unable to access iframe contents. Please verify it's hosted on the same domain");var r=n.contentWindow.document;if(r&&r.readyState==="complete")s();else{function i(e){n.removeEventListener("load",i),s()}n.addEventListener("load",i)}}e.iframe2image=t}(typeof exports=="object"&&exports||this);