!function(t,e){"use strict";"undefined"!=typeof define&&define.amd?define("canvgModule",["rgbcolor","stackblur"],e):"undefined"!=typeof module&&module.exports&&(module.exports=e(require("rgbcolor"),require("stackblur"))),t.canvg=e(t.RGBColor,t.stackBlur)}("undefined"!=typeof window?window:this,function(h,u){var c,m=function(t,e,n){if(null!=t||null!=e||null!=n){"string"==typeof t&&(t=document.getElementById(t)),null!=t.svg&&t.svg.stop();n=function(t){var P={opts:t,FRAMERATE:30,MAX_VIRTUAL_PIXELS:3e4,log:function(t){}};1==P.opts.log&&"undefined"!=typeof console&&(P.log=function(t){console.log(t)});P.init=function(t){var e=0;P.UniqueId=function(){return"canvg"+ ++e},P.Definitions={},P.Styles={},P.StylesSpecificity={},P.Animations=[],P.Images=[],P.ctx=t,P.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(t,e){this.viewPorts.push({width:t,height:e})},this.RemoveCurrent=function(){this.viewPorts.pop()},this.Current=function(){return this.viewPorts[this.viewPorts.length-1]},this.width=function(){return this.Current().width},this.height=function(){return this.Current().height},this.ComputeSize=function(t){return null!=t&&"number"==typeof t?t:"x"==t?this.width():"y"==t?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},P.init(),P.ImagesLoaded=function(){for(var t=0;t
]*>/,""),(e=new ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t),e);var e=new Windows.Data.Xml.Dom.XmlDocument,i=new Windows.Data.Xml.Dom.XmlLoadSettings;return i.prohibitDtd=!1,e.loadXml(t,i),e},P.Property=function(t,e){this.name=t,this.value=e},P.Property.prototype.getValue=function(){return this.value},P.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},P.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},P.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},P.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},P.Property.prototype.addOpacity=function(t){var e,i=this.value;return null==t.value||""==t.value||"string"!=typeof this.value||(e=new h(this.value)).ok&&(i="rgba("+e.r+", "+e.g+", "+e.b+", "+t.numValue()+")"),new P.Property(this.name,i)},P.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t=(t=t&&t[1])||this.value,P.Definitions[t]},P.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},P.Property.prototype.getFillStyleDefinition=function(t,e){var i=this.getDefinition();return null!=i&&i.createGradient?i.createGradient(P.ctx,t,e):null!=i&&i.createPattern?(i.getHrefAttribute().hasValue()&&(e=i.attribute("patternTransform"),i=i.getHrefAttribute().getDefinition(),e.hasValue()&&(i.attribute("patternTransform",!0).value=e.value)),i.createPattern(P.ctx,t)):null},P.Property.prototype.getDPI=function(t){return 96},P.Property.prototype.getEM=function(t){var e=12,i=new P.Property("fontSize",P.Font.Parse(P.ctx.font).fontSize);return i.hasValue()&&(e=i.toPixels(t)),e},P.Property.prototype.getUnits=function(){return(this.value+"").replace(/[0-9\.\-]/g,"")},P.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var i=this.value+"";if(i.match(/em$/))return this.numValue()*this.getEM(t);if(i.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(i.match(/px$/))return this.numValue();if(i.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(i.match(/pc$/))return 15*this.numValue();if(i.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(i.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(i.match(/in$/))return this.numValue()*this.getDPI(t);if(i.match(/%$/))return this.numValue()*P.ViewPort.ComputeSize(t);i=this.numValue();return e&&i<1?i*P.ViewPort.ComputeSize(t):i},P.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/s$/)?1e3*this.numValue():(t.match(/ms$/),this.numValue())},P.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/deg$/)?this.numValue()*(Math.PI/180):t.match(/grad$/)?this.numValue()*(Math.PI/200):t.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var e={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return P.Property.prototype.toTextBaseline=function(){return this.hasValue()?e[this.value]:null},P.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(t,e,i,n,s,a){a=null!=a?this.Parse(a):this.CreateFont("","","","","",P.ctx.font);return{fontFamily:s||a.fontFamily,fontSize:n||a.fontSize,fontStyle:t||a.fontStyle,fontWeight:i||a.fontWeight,fontVariant:e||a.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var r=this;this.Parse=function(t){for(var e={},i=P.trim(P.compressSpaces(t||"")).split(" "),n={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},s="",a=0;athis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))},this.addX=function(t){this.addPoint(t,null)},this.addY=function(t){this.addPoint(null,t)},this.addBoundingBox=function(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)},this.addQuadraticCurve=function(t,e,i,n,s,a){var r=t+2/3*(i-t),o=e+2/3*(n-e),i=r+1/3*(s-t),n=o+1/3*(a-e);this.addBezierCurve(t,e,r,i,o,n,s,a)},this.addBezierCurve=function(t,e,n,s,a,r,o,l){var h=[t,e],u=[n,s],c=[a,r],m=[o,l];for(this.addPoint(h[0],h[1]),this.addPoint(m[0],m[1]),i=0;i<=1;i++){function p(t){return Math.pow(1-t,3)*h[i]+3*Math.pow(1-t,2)*t*u[i]+3*(1-t)*Math.pow(t,2)*c[i]+Math.pow(t,3)*m[i]}var f,d,y=6*h[i]-12*u[i]+6*c[i],v=-3*h[i]+9*u[i]-9*c[i]+3*m[i],g=3*u[i]-3*h[i];0!=v?(f=Math.pow(y,2)-4*g*v)<0||(0<(d=(-y+Math.sqrt(f))/(2*v))&&d<1&&(0==i&&this.addX(p(d)),1==i&&this.addY(p(d))),0<(v=(-y-Math.sqrt(f))/(2*v))&&v<1&&(0==i&&this.addX(p(v)),1==i&&this.addY(p(v)))):0==y||0<(y=-g/y)&&y<1&&(0==i&&this.addX(p(y)),1==i&&this.addY(p(y)))}},this.isPointInBox=function(t,e){return this.x1<=t&&t<=this.x2&&this.y1<=e&&e<=this.y2},this.addPoint(t,e),this.addPoint(n,s)},P.Transform=function(t){var e=this;this.Type={},this.Type.translate=function(t){this.p=P.CreatePoint(t),this.apply=function(t){t.translate(this.p.x||0,this.p.y||0)},this.unapply=function(t){t.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(t){t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(t){t=P.ToNumberArray(t);this.angle=new P.Property("angle",t[0]),this.cx=t[1]||0,this.cy=t[2]||0,this.apply=function(t){t.translate(this.cx,this.cy),t.rotate(this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.unapply=function(t){t.translate(this.cx,this.cy),t.rotate(-1*this.angle.toRadians()),t.translate(-this.cx,-this.cy)},this.applyToPoint=function(t){var e=this.angle.toRadians();t.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),t.applyTransform([Math.cos(e),Math.sin(e),-Math.sin(e),Math.cos(e),0,0]),t.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(t){this.p=P.CreatePoint(t),this.apply=function(t){t.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(t){t.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(t){t.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(t){this.m=P.ToNumberArray(t),this.apply=function(t){t.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.unapply=function(t){var e=this.m[0],i=this.m[2],n=this.m[4],s=this.m[1],a=this.m[3],r=this.m[5],o=1/(e*(+a-0*r)-i*(+s-0*r)+n*(0*s-0*a));t.transform(o*(+a-0*r),o*(0*r-+s),o*(0*n-+i),o*(+e-0*n),o*(i*r-n*a),o*(n*s-e*r))},this.applyToPoint=function(t){t.applyTransform(this.m)}},this.Type.SkewBase=function(t){this.base=e.Type.matrix,this.base(t),this.angle=new P.Property("angle",t)},this.Type.SkewBase.prototype=new this.Type.matrix,this.Type.skewX=function(t){this.base=e.Type.SkewBase,this.base(t),this.m=[1,0,Math.tan(this.angle.toRadians()),1,0,0]},this.Type.skewX.prototype=new this.Type.SkewBase,this.Type.skewY=function(t){this.base=e.Type.SkewBase,this.base(t),this.m=[1,Math.tan(this.angle.toRadians()),0,1,0,0]},this.Type.skewY.prototype=new this.Type.SkewBase,this.transforms=[],this.apply=function(t){for(var e=0;e=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var t=new P.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(t)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t},this.getAsCurrentPoint=function(){var t=this.getPoint();return this.current=t},this.getReflectedControlPoint=function(){return"c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase()?this.current:new P.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},this.addMarker=function(t,e,i){null!=i&&0this.maxDuration){if("indefinite"==this.attribute("repeatCount").value||"indefinite"==this.attribute("repeatDur").value)this.duration=0;else if("freeze"!=this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"==this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+t;var e=!1;return this.begin~]/g," ")).replace(/[#\.]/g," "),t(M,2),s.join("")}(l),"@font-face"==l)for(var p=h["font-family"].value.replace(/"/g,""),f=h.src.value.split(","),d=0;d~\.\[:]+)/g,B=/(\.[^\s\+>~\.\[:]+)/g,C=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,T=/(:[\w-]+\([^\)]*\))/gi,V=/(:[^\s\+>~\.\[:]+)/g,M=/([^\s\+>~\.\[:]+)/g;return"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,i,n,s){m(this.canvas,t,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:i,scaleWidth:n,scaleHeight:s})}),m});