diff --git a/dist/html2canvas.js b/dist/html2canvas.js
index ff2d324..733d369 100644
--- a/dist/html2canvas.js
+++ b/dist/html2canvas.js
@@ -604,7 +604,7 @@ function renderDocument(document, options, windowWidth, windowHeight) {
var bounds = getBounds(node);
var width = options.type === "view" ? Math.min(bounds.width, windowWidth) : documentWidth();
var height = options.type === "view" ? Math.min(bounds.height, windowHeight) : documentHeight();
- var renderer = new CanvasRenderer(width, height, imageLoader, options);
+ var renderer = new CanvasRenderer(width, height, imageLoader, options, document);
var parser = new NodeParser(node, renderer, support, imageLoader, options);
return parser.ready.then(function() {
log("Finished rendering");
@@ -1521,7 +1521,6 @@ NodeParser.prototype.getPseudoElement = function(container, type) {
var pseudoNode = document.createElement(isImage ? 'img' : 'html2canvaspseudoelement');
var pseudoContainer = new NodeContainer(pseudoNode, container);
-
for (var i = style.length-1; i >= 0; i--) {
var property = toCamelCase(style.item(i));
pseudoNode.style[property] = style[property];
@@ -2178,11 +2177,12 @@ function ProxyImageContainer(src, proxy) {
var proxyImageCount = 0;
-function Renderer(width, height, images, options) {
+function Renderer(width, height, images, options, document) {
this.width = width;
this.height = height;
this.images = images;
this.options = options;
+ this.document = document;
}
Renderer.prototype.renderImage = function(container, bounds, borderData, imageContainer) {
@@ -2508,11 +2508,11 @@ function XHR(url) {
function CanvasRenderer(width, height) {
Renderer.apply(this, arguments);
- this.canvas = document.createElement("canvas");
+ this.canvas = this.document.createElement("canvas");
this.canvas.width = width;
this.canvas.height = height;
this.ctx = this.canvas.getContext("2d");
- this.taintCtx = document.createElement("canvas").getContext("2d");
+ this.taintCtx = this.document.createElement("canvas").getContext("2d");
this.ctx.textBaseline = "bottom";
this.variables = {};
log("Initialized CanvasRenderer");
diff --git a/dist/html2canvas.min.js b/dist/html2canvas.min.js
index b445c52..b1120c7 100644
--- a/dist/html2canvas.min.js
+++ b/dist/html2canvas.min.js
@@ -4,5 +4,5 @@
Released under MIT License
*/
-!function(a,b,c){function d(a,b,c,d){return i(a,c,d,b).then(function(h){w("Document cloned");var i="["+zb+"='true']";a.querySelector(i).removeAttribute(zb);var j=h.contentWindow,k=j.document.querySelector(i),l=new qb(j.document),m=new q(b,l),n=E(k),o="view"===b.type?Math.min(n.width,c):f(),p="view"===b.type?Math.min(n.height,d):g(),r=new yb(o,p,m,b),s=new G(k,r,l,m,b);return s.ready.then(function(){w("Finished rendering");var a="view"===b.type||k!==j.document.body&&k!==j.document.documentElement?e(r.canvas,n):r.canvas;return b.removeContainer&&(h.parentNode.removeChild(h),w("Cleaned up container")),a})})}function e(a,c){var d=b.createElement("canvas"),e=Math.min(a.width-1,Math.max(0,c.left)),f=Math.min(a.width,Math.max(1,c.left+c.width)),g=Math.min(a.height-1,Math.max(0,c.top)),h=Math.min(a.height,Math.max(1,c.top+c.height)),i=d.width=f-e,j=d.height=h-g;return w("Cropping canvas at:","left:",c.left,"top:",c.top,"width:",c.width,"height:",c.height),w("Resulting crop with width",i,"and height",j," with x",e,"and y",g),d.getContext("2d").drawImage(a,e,g,i,j,0,0,i,j),d}function f(){return Math.max(Math.max(b.body.scrollWidth,b.documentElement.scrollWidth),Math.max(b.body.offsetWidth,b.documentElement.offsetWidth),Math.max(b.body.clientWidth,b.documentElement.clientWidth))}function g(){return Math.max(Math.max(b.body.scrollHeight,b.documentElement.scrollHeight),Math.max(b.body.offsetHeight,b.documentElement.offsetHeight),Math.max(b.body.clientHeight,b.documentElement.clientHeight))}function h(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}function i(b,c,d,e){var f=b.documentElement.cloneNode(!0),g=b.createElement("iframe");return g.style.visibility="hidden",g.style.position="absolute",g.style.left=g.style.top="-10000px",g.width=c,g.height=d,g.scrolling="no",b.body.appendChild(g),new Promise(function(b){var c=g.contentWindow.document;g.contentWindow.onload=g.onload=function(){b(g)},c.open(),c.write(""),c.close(),c.replaceChild(j(c.adoptNode(f)),c.documentElement),"view"===e.type&&g.contentWindow.scrollTo(a.pageXOffset,a.pageYOffset)})}function j(a){return[].slice.call(a.childNodes,0).filter(k).forEach(function(b){"SCRIPT"===b.tagName?a.removeChild(b):j(b)}),a}function k(a){return a.nodeType===Node.ELEMENT_NODE}function l(a){if(this.src=a,w("DummyImageContainer for",a),!this.promise||!this.image){w("Initiating DummyImageContainer"),l.prototype.image=new Image;var b=this.image;l.prototype.promise=new Promise(function(a,c){b.onload=a,b.onerror=c,b.src=h(),b.complete===!0&&a(b)})}}function m(a,c){var d,e,f=b.createElement("div"),g=b.createElement("img"),i=b.createElement("span"),j="Hidden Text";f.style.visibility="hidden",f.style.fontFamily=a,f.style.fontSize=c,f.style.margin=0,f.style.padding=0,b.body.appendChild(f),g.src=h(),g.width=1,g.height=1,g.style.margin=0,g.style.padding=0,g.style.verticalAlign="baseline",i.style.fontFamily=a,i.style.fontSize=c,i.style.margin=0,i.style.padding=0,i.appendChild(b.createTextNode(j)),f.appendChild(i),f.appendChild(g),d=g.offsetTop-i.offsetTop+1,f.removeChild(i),f.appendChild(b.createTextNode(j)),f.style.lineHeight="normal",g.style.verticalAlign="super",e=g.offsetTop-f.offsetTop+1,b.body.removeChild(f),this.baseline=d,this.lineWidth=1,this.middle=e}function n(){this.data={}}function o(a){this.src=a.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=Promise.resolve(!0)}function p(a,b){this.src=a,this.image=new Image;var c=this;this.tainted=null,this.promise=new Promise(function(d,e){c.image.onload=d,c.image.onerror=e,b&&(c.image.crossOrigin="anonymous"),c.image.src=a,c.image.complete===!0&&d(c.image)})["catch"](function(){var b=new l(a);return b.promise.then(function(a){c.image=a})})}function q(b,c){this.link=null,this.options=b,this.support=c,this.origin=a.location.protocol+a.location.hostname+a.location.port}function r(a){return"IMG"===a.node.nodeName}function s(a){return"svg"===a.node.nodeName}function t(a){return{args:[a.node.src],method:"url"}}function u(a){return{args:[a.node],method:"svg"}}function v(a){o.apply(this,arguments),this.type=this.TYPES.LINEAR;var b=null===a.args[0].match(this.stepRegExp);b?a.args[0].split(" ").reverse().forEach(function(a){switch(a){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var b=this.y0,c=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=c,this.y1=b;break;default:var d=a.match(this.angleRegExp);if(d)switch(d[2]){case"deg":var e=parseFloat(d[1]),f=e/(180/Math.PI),g=Math.tan(f);this.y0=2/Math.tan(g)/2,this.x0=0,this.x1=1,this.y1=0}}},this):(this.y0=0,this.y1=1),this.colorStops=a.args.slice(b?1:0).map(function(a){var b=a.match(this.stepRegExp);return{color:b[1],stop:"%"===b[3]?b[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(a,b){null===a.stop&&this.colorStops.slice(b).some(function(c,d){return null!==c.stop?(a.stop=(c.stop-this.colorStops[b-1].stop)/(d+1)+this.colorStops[b-1].stop,!0):!1},this)},this)}function w(){a.html2canvas.logging&&a.console&&a.console.log&&Function.prototype.bind.call(a.console.log,a.console).apply(a.console,[Date.now()-a.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}function x(a,b){this.node=a,this.parent=b,this.stack=null,this.bounds=null,this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null}function y(a){var b=a.options[a.selectedIndex||0];return b?b.text||"":""}function z(a){return a&&"matrix"===a[1]?a[2].split(",").map(function(a){return parseFloat(a.trim())}):void 0}function A(a){return-1!==a.toString().indexOf("%")}function B(a){var b,c,d,e,f,g,h,i=" \r\n ",j=[],k=0,l=0,m=function(){b&&('"'===c.substr(0,1)&&(c=c.substr(1,c.length-2)),c&&h.push(c),"-"===b.substr(0,1)&&(e=b.indexOf("-",1)+1)>0&&(d=b.substr(0,e),b=b.substr(e)),j.push({prefix:d,method:b.toLowerCase(),value:f,args:h,image:null})),h=[],b=d=c=f=""};return h=[],b=d=c=f="",a.split("").forEach(function(a){if(!(0===k&&i.indexOf(a)>-1)){switch(a){case'"':g?g===a&&(g=null):g=a;break;case"(":if(g)break;if(0===k)return k=1,void(f+=a);l++;break;case")":if(g)break;if(1===k){if(0===l)return k=0,f+=a,void m();l--}break;case",":if(g)break;if(0===k)return void m();if(1===k&&0===l&&!b.match(/^url$/i))return h.push(c),c="",void(f+=a)}f+=a,0===k?b+=a:c+=a}}),m(),j}function C(a){return a.replace("px","")}function D(a){return parseFloat(a)}function E(a){if(a.getBoundingClientRect){var b=a.getBoundingClientRect(),c="BODY"===a.nodeName,d=c?a.scrollWidth:null==a.offsetWidth?b.width:a.offsetWidth;return{top:b.top,bottom:b.bottom||b.top+b.height,right:b.left+d,left:b.left,width:d,height:c?a.scrollHeight:null==a.offsetHeight?b.height:a.offsetHeight}}return{}}function F(a){var b=a.offsetParent?F(a.offsetParent):{top:0,left:0};return{top:a.offsetTop+b.top,bottom:a.offsetTop+a.offsetHeight+b.top,right:a.offsetLeft+b.left+a.offsetWidth,left:a.offsetLeft+b.left,width:a.offsetWidth,height:a.offsetHeight}}function G(a,b,c,d,e){w("Starting NodeParser"),this.renderer=b,this.options=e,this.range=null,this.support=c,this.renderQueue=[],this.stack=new pb(!0,1,a.ownerDocument,null);var f=new x(a,null);a!==a.ownerDocument.documentElement&&this.renderer.isTransparent(f.css("backgroundColor"))&&b.rectangle(0,0,b.width,b.height,new x(a.ownerDocument.documentElement,null).css("backgroundColor")),f.visibile=f.isElementVisible(),this.createPseudoHideStyles(a.ownerDocument),this.nodes=ib([f].concat(this.getChildren(f)).filter(function(a){return a.visible=a.isElementVisible()}).map(this.getPseudoElements,this)),this.fontMetrics=new n,w("Fetched nodes"),this.images=d.fetch(this.nodes.filter(ab)),w("Creating stacking contexts"),this.createStackingContexts(),w("Sorting stacking contexts"),this.sortStackingContexts(this.stack),this.ready=this.images.ready.then(eb(function(){return w("Images loaded, starting parsing"),this.parse(this.stack),w("Render queue created with "+this.renderQueue.length+" items"),new Promise(eb(function(a){e.async?"function"==typeof e.async?e.async.call(this,this.renderQueue,a):(this.renderIndex=0,this.asyncRenderer(this.renderQueue,a)):(this.renderQueue.forEach(this.paint,this),a())},this))},this))}function H(a){return a.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function I(){}function J(a,b,c,d){var e=4*((Math.sqrt(2)-1)/3),f=c*e,g=d*e,h=a+c,i=b+d;return{topLeft:L({x:a,y:i},{x:a,y:i-g},{x:h-f,y:b},{x:h,y:b}),topRight:L({x:a,y:b},{x:a+f,y:b},{x:h,y:i-g},{x:h,y:i}),bottomRight:L({x:h,y:b},{x:h,y:b+g},{x:a+f,y:i},{x:a,y:i}),bottomLeft:L({x:h,y:i},{x:h-f,y:i},{x:a,y:b+g},{x:a,y:b})}}function K(a,b,c){var d=a.left,e=a.top,f=a.width,g=a.height,h=b[0][0],i=b[0][1],j=b[1][0],k=b[1][1],l=b[2][0],m=b[2][1],n=b[3][0],o=b[3][1],p=f-j,q=g-m,r=f-l,s=g-o;return{topLeftOuter:J(d,e,h,i).topLeft.subdivide(.5),topLeftInner:J(d+c[3].width,e+c[0].width,Math.max(0,h-c[3].width),Math.max(0,i-c[0].width)).topLeft.subdivide(.5),topRightOuter:J(d+p,e,j,k).topRight.subdivide(.5),topRightInner:J(d+Math.min(p,f+c[3].width),e+c[0].width,p>f+c[3].width?0:j-c[3].width,k-c[0].width).topRight.subdivide(.5),bottomRightOuter:J(d+r,e+q,l,m).bottomRight.subdivide(.5),bottomRightInner:J(d+Math.min(r,f+c[3].width),e+Math.min(q,g+c[0].width),Math.max(0,l-c[1].width),Math.max(0,m-c[2].width)).bottomRight.subdivide(.5),bottomLeftOuter:J(d,e+s,n,o).bottomLeft.subdivide(.5),bottomLeftInner:J(d+c[3].width,e+s,Math.max(0,n-c[3].width),Math.max(0,o-c[2].width)).bottomLeft.subdivide(.5)}}function L(a,b,c,d){var e=function(a,b,c){return{x:a.x+(b.x-a.x)*c,y:a.y+(b.y-a.y)*c}};return{start:a,startControl:b,endControl:c,end:d,subdivide:function(f){var g=e(a,b,f),h=e(b,c,f),i=e(c,d,f),j=e(g,h,f),k=e(h,i,f),l=e(j,k,f);return[L(a,g,j,l),L(l,k,i,d)]},curveTo:function(a){a.push(["bezierCurve",b.x,b.y,c.x,c.y,d.x,d.y])},curveToReversed:function(d){d.push(["bezierCurve",c.x,c.y,b.x,b.y,a.x,a.y])}}}function M(a,b,c,d,e,f,g){var h=[];return b[0]>0||b[1]>0?(h.push(["line",d[1].start.x,d[1].start.y]),d[1].curveTo(h)):h.push(["line",a.c1[0],a.c1[1]]),c[0]>0||c[1]>0?(h.push(["line",f[0].start.x,f[0].start.y]),f[0].curveTo(h),h.push(["line",g[0].end.x,g[0].end.y]),g[0].curveToReversed(h)):(h.push(["line",a.c2[0],a.c2[1]]),h.push(["line",a.c3[0],a.c3[1]])),b[0]>0||b[1]>0?(h.push(["line",e[1].end.x,e[1].end.y]),e[1].curveToReversed(h)):h.push(["line",a.c4[0],a.c4[1]]),h}function N(a,b,c,d,e,f,g){b[0]>0||b[1]>0?(a.push(["line",d[0].start.x,d[0].start.y]),d[0].curveTo(a),d[1].curveTo(a)):a.push(["line",f,g]),(c[0]>0||c[1]>0)&&a.push(["line",e[0].start.x,e[0].start.y])}function O(a){return a.cssInt("zIndex")<0}function P(a){return a.cssInt("zIndex")>0}function Q(a){return 0===a.cssInt("zIndex")}function R(a){return-1!==["inline","inline-block","inline-table"].indexOf(a.css("display"))}function S(a){return a instanceof pb}function T(a){return a.node.data.trim().length>0}function U(a){return/^(normal|none|0px)$/.test(a.parent.css("letterSpacing"))}function V(a){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(b){var c=a.css("border"+b+"Radius"),d=c.split(" ");return d.length<=1&&(d[1]=d[0]),d.map(fb)})}function W(a){return a.nodeType===Node.TEXT_NODE||a.nodeType===Node.ELEMENT_NODE}function X(a){var b=a.css("position"),c="absolute"===b||"relative"===b?a.css("zIndex"):"auto";return"auto"!==c}function Y(a){return"static"!==a.css("position")}function Z(a){return"none"!==a.css("float")}function $(a){return-1!==["inline-block","inline-table"].indexOf(a.css("display"))}function _(a){var b=this;return function(){return!a.apply(b,arguments)}}function ab(a){return a.node.nodeType===Node.ELEMENT_NODE}function bb(a){return a.node.nodeType===Node.TEXT_NODE}function cb(a,b){return a.cssInt("zIndex")-b.cssInt("zIndex")}function db(a){return a.css("opacity")<1}function eb(a,b){return function(){return a.apply(b,arguments)}}function fb(a){return parseInt(a,10)}function gb(a){return a.width}function hb(a){return a.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(a.node.nodeName)}function ib(a){return[].concat.apply([],a)}function jb(a){var b=a.substr(0,1);return b===a.substr(a.length-1)&&b.match(/'|"/)?a.substr(1,a.length-2):a}function kb(b){for(var c,d=[],e=0,f=!1;b.length;)lb(b[e])===f?(c=b.splice(0,e),c.length&&d.push(a.html2canvas.punycode.ucs2.encode(c)),f=!f,e=0):e++,e>=b.length&&(c=b.splice(0,e),c.length&&d.push(a.html2canvas.punycode.ucs2.encode(c)));return d}function lb(a){return-1!==[32,13,10,9,45].indexOf(a)}function mb(a){return/[^\u0000-\u00ff]/.test(a)}function nb(d,e){var f="html2canvas_"+Ab++,g=b.createElement("script"),h=b.createElement("a");h.href=d,d=h.href;var i=e+(e.indexOf("?")>-1?"&":"?")+"url="+encodeURIComponent(d)+"&callback="+f;this.src=d,this.image=new Image;var j=this;this.promise=new Promise(function(d,e){j.image.onload=d,j.image.onerror=e,a[f]=function(b){"error:"===b.substring(0,6)?e():j.image.src=b,a[f]=c;try{delete a[f]}catch(d){}g.parentNode.removeChild(g)},g.setAttribute("type","text/javascript"),g.setAttribute("src",i),b.body.appendChild(g)})["catch"](function(){var a=new l(d);return a.promise.then(function(a){j.image=a})})}function ob(a,b,c,d){this.width=a,this.height=b,this.images=c,this.options=d}function pb(a,b,c,d){x.call(this,c,d),this.ownStacking=a,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*b}function qb(a){this.rangeBounds=this.testRangeBounds(a),this.cors=this.testCORS(),this.svg=this.testSVG()}function rb(a){this.src=a,this.image=null;var b=this;this.promise=this.hasFabric().then(function(){return b.isInline(a)?Promise.resolve(b.inlineFormatting(a)):xb(a)}).then(function(a){return new Promise(function(c){html2canvas.fabric.loadSVGFromString(a,b.createCanvas.call(b,c))})})}function sb(a){var b,c,d,e,f,g,h,i,j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=a.length,l="";for(b=0;k>b;b+=4)c=j.indexOf(a[b]),d=j.indexOf(a[b+1]),e=j.indexOf(a[b+2]),f=j.indexOf(a[b+3]),g=c<<2|d>>4,h=(15&d)<<4|e>>2,i=(3&e)<<6|f,l+=64===e?String.fromCharCode(g):64===f||-1===f?String.fromCharCode(g,h):String.fromCharCode(g,h,i);return l}function tb(a){this.src=a,this.image=null;var b=this;this.promise=this.hasFabric().then(function(){return new Promise(function(c){html2canvas.fabric.parseSVGDocument(a,b.createCanvas.call(b,c))})})}function ub(a,b){x.call(this,a,b)}function vb(a,b,c){return a.length>0?b+c.toUpperCase():void 0}function wb(a){o.apply(this,arguments),this.type="linear"===a.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}function xb(a){return new Promise(function(b,c){var d=new XMLHttpRequest;d.open("GET",a),d.onload=function(){200===d.status?b(d.responseText):c(new Error(d.statusText))},d.onerror=function(){c(new Error("Network Error"))},d.send()})}function yb(a,c){ob.apply(this,arguments),this.canvas=b.createElement("canvas"),this.canvas.width=a,this.canvas.height=c,this.ctx=this.canvas.getContext("2d"),this.taintCtx=b.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},w("Initialized CanvasRenderer")}if(!function(){var c,d,e,f;!function(){var a={},b={};c=function(b,c,d){a[b]={deps:c,callback:d}},f=e=d=function(c){function e(a){if("."!==a.charAt(0))return a;for(var b=a.split("/"),d=c.split("/").slice(0,-1),e=0,f=b.length;f>e;e++){var g=b[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(f._eak_seen=a,b[c])return b[c];if(b[c]={},!a[c])throw new Error("Could not find module "+c);for(var g,h=a[c],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:d(e(i[l])));var n=j.apply(this,k);return b[c]=g||n}}(),c("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j1&&(e=d[0]+"@",a=d[1]);var f=a.split(D),g=c(f,b).join(".");return e+g}function e(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function f(a){return c(a,function(a){var b="";return a>65535&&(a-=65536,b+=H(a>>>10&1023|55296),a=56320|1023&a),b+=H(a)}).join("")}function g(a){return 10>a-48?a-22:26>a-65?a-65:26>a-97?a-97:t}function h(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function i(a,b,c){var d=0;for(a=c?G(a/x):a>>1,a+=G(a/b);a>F*v>>1;d+=t)a=G(a/F);return G(d+(F+1)*a/(a+w))}function j(a){var c,d,e,h,j,k,l,m,n,o,p=[],q=a.length,r=0,w=z,x=y;for(d=a.lastIndexOf(A),0>d&&(d=0),e=0;d>e;++e)a.charCodeAt(e)>=128&&b("not-basic"),p.push(a.charCodeAt(e));for(h=d>0?d+1:0;q>h;){for(j=r,k=1,l=t;h>=q&&b("invalid-input"),m=g(a.charCodeAt(h++)),(m>=t||m>G((s-r)/k))&&b("overflow"),r+=m*k,n=x>=l?u:l>=x+v?v:l-x,!(n>m);l+=t)o=t-n,k>G(s/o)&&b("overflow"),k*=o;c=p.length+1,x=i(r-j,c,0==j),G(r/c)>s-w&&b("overflow"),w+=G(r/c),r%=c,p.splice(r++,0,w)}return f(p)}function k(a){var c,d,f,g,j,k,l,m,n,o,p,q,r,w,x,B=[];for(a=e(a),q=a.length,c=z,d=0,j=y,k=0;q>k;++k)p=a[k],128>p&&B.push(H(p));for(f=g=B.length,g&&B.push(A);q>f;){for(l=s,k=0;q>k;++k)p=a[k],p>=c&&l>p&&(l=p);for(r=f+1,l-c>G((s-d)/r)&&b("overflow"),d+=(l-c)*r,c=l,k=0;q>k;++k)if(p=a[k],c>p&&++d>s&&b("overflow"),p==c){for(m=d,n=t;o=j>=n?u:n>=j+v?v:n-j,!(o>m);n+=t)x=m-o,w=t-o,B.push(H(h(o+x%w,0))),m=G(x/w);B.push(H(h(m,0))),j=i(d,r,f==g),d=0,++f}++d,++c}return B.join("")}function l(a){return d(a,function(a){return B.test(a)?j(a.slice(4).toLowerCase()):a})}function m(a){return d(a,function(a){return C.test(a)?"xn--"+k(a):a})}var n="object"==typeof exports&&exports&&!exports.nodeType&&exports,o="object"==typeof module&&module&&!module.nodeType&&module,p="object"==typeof global&&global;(p.global===p||p.window===p||p.self===p)&&(a=p);var q,r,s=2147483647,t=36,u=1,v=26,w=38,x=700,y=72,z=128,A="-",B=/^xn--/,C=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},F=t-u,G=Math.floor,H=String.fromCharCode;if(q={version:"1.3.1",ucs2:{decode:e,encode:f},decode:j,encode:k,toASCII:m,toUnicode:l},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return q});else if(n&&o)if(module.exports==n)o.exports=q;else for(r in q)q.hasOwnProperty(r)&&(n[r]=q[r]);else a.punycode=q}(this);var zb="data-html2canvas-node";a.html2canvas=function(e,f){f=f||{},f.logging&&(a.html2canvas.logging=!0,a.html2canvas.start=Date.now()),f.async="undefined"==typeof f.async?!0:f.async,f.allowTaint="undefined"==typeof f.allowTaint?!1:f.allowTaint,f.removeContainer="undefined"==typeof f.removeContainer?!0:f.removeContainer;var g=(e===c?[b.documentElement]:e.length?e:[e])[0];return g.setAttribute(zb,"true"),d(g.ownerDocument,f,a.innerWidth,a.innerHeight).then(function(a){return"function"==typeof f.onrendered&&(w("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),f.onrendered(a)),a})},a.html2canvas.punycode=this.punycode,n.prototype.getMetrics=function(a,b){return this.data[a+"-"+b]===c&&(this.data[a+"-"+b]=new m(a,b)),this.data[a+"-"+b]},o.prototype.TYPES={LINEAR:1,RADIAL:2},o.prototype.angleRegExp=/([+-]?\d*\.?\d+)(deg|grad|rad|turn)/,q.prototype.findImages=function(a){var b=[];return a.filter(r).map(t).forEach(this.addImage(b,this.loadImage),this),a.filter(s).map(u).forEach(this.addImage(b,this.loadImage),this),b},q.prototype.findBackgroundImage=function(a,b){return b.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(a,this.loadImage),this),a},q.prototype.addImage=function(a,b){return function(c){c.args.forEach(function(d){this.imageExists(a,d)||(a.splice(0,0,b.call(this,c)),w("Added image #"+a.length,"string"==typeof d?d.substring(0,100):d))},this)}},q.prototype.hasImageBackground=function(a){return"none"!==a.method},q.prototype.loadImage=function(a){if("url"===a.method){var b=a.args[0];return!this.isSVG(b)||this.support.svg||this.options.allowTaint?b.match(/data:image\/.*;base64,/i)?new p(b.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(b)||this.options.allowTaint===!0||this.isSVG(b)?new p(b,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new p(b,!0):this.options.proxy?new nb(b,this.options.proxy):new l(b):new rb(b)}return"linear-gradient"===a.method?new v(a):"gradient"===a.method?new wb(a):"svg"===a.method?new tb(a.args[0]):new l(a)},q.prototype.isSVG=function(a){return/(.+).svg$/i.test(a)||rb.prototype.isInline(a)},q.prototype.imageExists=function(a,b){return a.some(function(a){return a.src===b})},q.prototype.isSameOrigin=function(a){var c=this.link||(this.link=b.createElement("a"));c.href=a,c.href=c.href;var d=c.protocol+c.hostname+c.port;return d===this.origin},q.prototype.getPromise=function(a){return a.promise},q.prototype.get=function(a){var b=null;return this.images.some(function(c){return(b=c).src===a})?b:null},q.prototype.fetch=function(a){return this.images=a.reduce(eb(this.findBackgroundImage,this),this.findImages(a)),this.images.forEach(function(a,b){a.promise.then(function(){w("Succesfully loaded image #"+(b+1))},function(){w("Failed loading image #"+(b+1))})}),this.ready=Promise.all(this.images.map(this.getPromise)),w("Finished searching images"),this},v.prototype=Object.create(o.prototype),v.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,x.prototype.assignStack=function(a){this.stack=a,a.children.push(this)},x.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&"hidden"!==this.css("visibility")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},x.prototype.css=function(a){return this.computedStyles||(this.computedStyles=this.computedStyle(null)),this.styles[a]||(this.styles[a]=this.computedStyles[a])},x.prototype.prefixedCss=function(a){var b=["webkit","moz","ms","o"],d=this.css(a);return d===c&&b.some(function(b){return d=this.css(b+a.substr(0,1).toUpperCase()+a.substr(1)),d!==c},this),d===c?null:d},x.prototype.computedStyle=function(a){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,a)},x.prototype.cssInt=function(a){var b=parseInt(this.css(a),10);return isNaN(b)?0:b},x.prototype.cssFloat=function(a){var b=parseFloat(this.css(a));return isNaN(b)?0:b},x.prototype.fontWeight=function(){var a=this.css("fontWeight");switch(parseInt(a,10)){case 401:a="bold";break;case 400:a="normal"}return a},x.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=B(this.css("backgroundImage")))},x.prototype.cssList=function(a,b){var c=(this.css(a)||"").split(",");return c=c[b||0]||c[0]||"auto",c=c.trim().split(" "),1===c.length&&(c=[c[0],c[0]]),c},x.prototype.parseBackgroundSize=function(a,b,c){var d,e,f=this.cssList("backgroundSize",c);if(A(f[0]))d=a.width*parseFloat(f[0])/100;else{if(/contain|cover/.test(f[0])){var g=a.width/a.height,h=b.width/b.height;return h>g^"contain"===f[0]?{width:a.height*h,height:a.height}:{width:a.width,height:a.width/h}}d=parseInt(f[0],10)}return e="auto"===f[0]&&"auto"===f[1]?b.height:"auto"===f[1]?d/b.width*b.height:A(f[1])?a.height*parseFloat(f[1])/100:parseInt(f[1],10),"auto"===f[0]&&(d=e/b.height*b.width),{width:d,height:e}},x.prototype.parseBackgroundPosition=function(a,b,c,d){var e,f,g=this.cssList("backgroundPosition",c);return e=A(g[0])?(a.width-(d||b).width)*(parseFloat(g[0])/100):parseInt(g[0],10),f="auto"===g[1]?e/b.width*b.height:A(g[1])?(a.height-(d||b).height)*parseFloat(g[1])/100:parseInt(g[1],10),"auto"===g[0]&&(e=f/b.height*b.width),{left:e,top:f}},x.prototype.parseBackgroundRepeat=function(a){return this.cssList("backgroundRepeat",a)[0]},x.prototype.parseTextShadows=function(){var a=this.css("textShadow"),b=[];if(a&&"none"!==a)for(var c=a.match(this.TEXT_SHADOW_PROPERTY),d=0;c&&dDate.now()?this.asyncRenderer(a,b,c):setTimeout(eb(function(){this.asyncRenderer(a,b)},this),0)},G.prototype.createPseudoHideStyles=function(a){var b=a.createElement("style");b.innerHTML="."+this.pseudoHideClass+':before { content: "" !important; display: none !important; }.'+this.pseudoHideClass+':after { content: "" !important; display: none !important; }',a.body.appendChild(b)},G.prototype.getPseudoElements=function(a){var b=[[a]];if(a.node.nodeType===Node.ELEMENT_NODE){var c=this.getPseudoElement(a,":before"),d=this.getPseudoElement(a,":after");c&&(a.node.insertBefore(c[0].node,a.node.firstChild),b.push(c)),d&&(a.node.appendChild(d[0].node),b.push(d)),(c||d)&&(a.node.className+=" "+this.pseudoHideClass)}return ib(b)},G.prototype.getPseudoElement=function(a,c){var d=a.computedStyle(c);if(!d||!d.content||"none"===d.content||"-moz-alt-content"===d.content||"none"===d.display)return null;for(var e=jb(d.content),f="url"===e.substr(0,3),g=b.createElement(f?"img":"html2canvaspseudoelement"),h=new x(g,a),i=d.length-1;i>=0;i--){var j=H(d.item(i));g.style[j]=d[j]}if(g.className=this.pseudoHideClass,f)return g.src=B(e)[0].args[0],[h];var k=b.createTextNode(e);return g.appendChild(k),[h,new ub(k,h)]},G.prototype.getChildren=function(a){return ib([].filter.call(a.node.childNodes,W).map(function(b){var c=[b.nodeType===Node.TEXT_NODE?new ub(b,a):new x(b,a)].filter(hb);return b.nodeType===Node.ELEMENT_NODE&&c.length&&"TEXTAREA"!==b.tagName?c[0].isElementVisible()?c.concat(this.getChildren(c[0])):[]:c
-},this))},G.prototype.newStackingContext=function(a,b){var c=new pb(b,a.cssFloat("opacity"),a.node,a.parent);c.visible=a.visible;var d=b?c.getParentStack(this):c.parent.stack;d.contexts.push(c),a.stack=c},G.prototype.createStackingContexts=function(){this.nodes.forEach(function(a){ab(a)&&(this.isRootElement(a)||db(a)||X(a)||this.isBodyWithTransparentRoot(a)||a.hasTransform())?this.newStackingContext(a,!0):ab(a)&&(Y(a)&&Q(a)||$(a)||Z(a))?this.newStackingContext(a,!1):a.assignStack(a.parent.stack)},this)},G.prototype.isBodyWithTransparentRoot=function(a){return"BODY"===a.node.nodeName&&this.renderer.isTransparent(a.parent.css("backgroundColor"))},G.prototype.isRootElement=function(a){return null===a.parent},G.prototype.sortStackingContexts=function(a){a.contexts.sort(cb),a.contexts.forEach(this.sortStackingContexts,this)},G.prototype.parseTextBounds=function(a){return function(b,c,d){if("none"!==a.parent.css("textDecoration").substr(0,4)||0!==b.trim().length){if(this.support.rangeBounds&&!a.parent.hasTransform()){var e=d.slice(0,c).join("").length;return this.getRangeBounds(a.node,e,b.length)}if(a.node&&"string"==typeof a.node.data){var f=a.node.splitText(b.length),g=this.getWrapperBounds(a.node,a.parent.hasTransform());return a.node=f,g}}else(!this.support.rangeBounds||a.parent.hasTransform())&&(a.node=a.node.splitText(b.length));return{}}},G.prototype.getWrapperBounds=function(a,b){var c=a.ownerDocument.createElement("html2canvaswrapper"),d=a.parentNode,e=a.cloneNode(!0);c.appendChild(a.cloneNode(!0)),d.replaceChild(c,a);var f=b?F(c):E(c);return d.replaceChild(e,c),f},G.prototype.getRangeBounds=function(a,b,c){var d=this.range||(this.range=a.ownerDocument.createRange());return d.setStart(a,b),d.setEnd(a,b+c),d.getBoundingClientRect()},G.prototype.parse=function(a){var b=a.contexts.filter(O),c=a.children.filter(ab),d=c.filter(_(Z)),e=d.filter(_(Y)).filter(_(R)),f=c.filter(_(Y)).filter(Z),g=d.filter(_(Y)).filter(R),h=a.contexts.concat(d.filter(Y)).filter(Q),i=a.children.filter(bb).filter(T),j=a.contexts.filter(P);b.concat(e).concat(f).concat(g).concat(h).concat(i).concat(j).forEach(function(a){this.renderQueue.push(a),S(a)&&(this.parse(a),this.renderQueue.push(new I))},this)},G.prototype.paint=function(a){try{a instanceof I?this.renderer.ctx.restore():bb(a)?this.paintText(a):this.paintNode(a)}catch(b){w(b)}},G.prototype.paintNode=function(a){S(a)&&(this.renderer.setOpacity(a.opacity),this.renderer.ctx.save(),a.hasTransform()&&this.renderer.setTransform(a.parseTransform()));var b=a.parseBounds(),c=this.parseBorders(a);switch(this.renderer.clip(c.clip,function(){this.renderer.renderBackground(a,b,c.borders.map(gb))},this),this.renderer.renderBorders(c.borders),a.node.nodeName){case"svg":var d=this.images.get(a.node);d?this.renderer.renderImage(a,b,c,d):w("Error loading