!function(G,R){"use strict";var K="ht",p=G[K],L=p.Default,E=L.getInternal();E.addMethod(L,{svgToShape:function(s,T){var B=new p.SvgConverter(T);return B.toShape(s)}});var k=p.Context2dProxy=function(g,o){var l=this;l.ctx=g,l.writer=o,l.$1A={a:1,b:0,c:0,d:1,tx:0,ty:0},l.$2A(),l.$3A=!0,l.$4A=16,l.$5A=[];for(var G in CanvasRenderingContext2D.prototype)if("webkitImageSmoothingEnabled"!==G){var N=g[G];if("function"==typeof N)l[G]=function(K,k){return function(){var p=k.apply(g,arguments);return l.handleFunc(K,p,arguments),p}}(G,N);else{var I=R.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,G);if(!I.get&&!I.set)continue;!function(b){R.defineProperty(l,b,{get:function(){return g[b]},set:function(S){g[b]=S,l.handleSetter(b,S)}})}(G)}}};k.prototype={},k.prototype.constructor=k,k.prototype.handleFunc=function(L,H,A){var m=this;switch(L){case"save":m.$7A();break;case"restore":m.$8A();break;case"translate":m.$9A.apply(m,A);break;case"rotate":m.$AA.apply(m,A);break;case"scale":m.$BA.apply(m,A);break;case"setTransform":m.$CA.apply(m,A);break;case"transform":m.$DA.apply(m,A);break;case"fillText":case"strokeText":m.$EA(A[0],A[1],A[2],"fillText"===L);break;case"rect":m.$FA.apply(m,A);break;case"fill":m.$10A(!1);break;case"stroke":m.$10A(!0);break;case"moveTo":m.$11A(A[0],A[1]);break;case"lineTo":m.$12A(A[0],A[1]);break;case"beginPath":m.$13A();break;case"closePath":m.$14A();break;case"arc":m.$15A.apply(m,A);break;case"ellipse":m.$16A.apply(m,A);break;case"quadraticCurveTo":m.$17A([{x:A[0],y:A[1]}],A[2],A[3]);break;case"bezierCurveTo":m.$17A([{x:A[0],y:A[1]},{x:A[2],y:A[3]}],A[4],A[5]);break;case"createLinearGradient":H.points=A}},k.prototype.handleSetter=function(){},k.prototype.$7A=function(){var q=this,o={},Y=q.$1A;for(var v in Y)o[v]=Y[v];q.$5A.push(o)},k.prototype.$8A=function(){var Q=this;Q.$1A=Q.$5A.pop(),Q._transformUpdated()},k.prototype.$9A=function(U,$){if(0!==U||0!==$){var E=this,B=E.$1A,g=B.a,J=B.b,w=B.c,t=B.d;B.tx=g*U+w*$+B.tx,B.ty=J*U+t*$+B.ty,E._transformUpdated()}},k.prototype.$BA=function(I,y){if(1!==I||1!==y){var D=this,u=D.$1A;u.a*=I,u.b*=I,u.c*=y,u.d*=y,D._transformUpdated()}},k.prototype.$AA=function(P){var k=Math.cos(P),l=Math.sin(P),E=this,e=E.$1A,q=e.a,f=e.b,a=e.c,s=e.d;e.a=q*k+a*l,e.b=f*k+s*l,e.c=-q*l+a*k,e.d=-f*l+s*k,E._transformUpdated()},k.prototype.$CA=function(_,T,K,f,l,g){var s=this,A=s.$1A;A.a=_,A.b=T,A.c=K,A.d=f,A.tx=l,A.ty=g,s._transformUpdated()},k.prototype.$DA=function(U,w,A,I,y,h){var S=this,J=S.$1A,r=J.a,x=J.b,z=J.c,p=J.d;J.a=r*U+z*w,J.b=x*U+p*w,J.c=r*A+z*I,J.d=x*A+p*I,J.tx=r*y+z*h+J.tx,J.ty=x*y+p*h+J.ty,S._transformUpdated()},k.prototype._transformUpdated=function(){},k.prototype.$18A=function(){var $=this.$1A;return 0===$.b&&0===$.c?0:Math.atan2($.b,$.a)},k.prototype.$19A=function(){var n=this.$1A;return{x:Math.sqrt(n.a*n.a+n.c*n.c),y:Math.sqrt(n.b*n.b+n.d*n.d)}},k.prototype.$20A=function(P){var G=this.$1A,S=P.x,y=P.y;return{x:G.a*S+G.c*y+G.tx,y:G.b*S+G.d*y+G.ty}},k.prototype.$21A=function(F){for(var $=this,y=new Array(F.length),V=0,r=F.length;r>V;V++)y[V]=$.$20A(F[V]);return y},k.prototype.$22A=function(Y){var z=this.$1A;return Y*Math.max(Math.sqrt(z.c*z.c+z.d*z.d),Math.sqrt(z.a*z.a+z.b*z.b))},k.prototype.$23A=function(H,V){var f=H-V;return f>-1e-5&&1e-5>f},k.prototype.$EA=function(e,i,G,_){var E,d,b=this,w=b.ctx,n=w.font,c=_?w.fillStyle:w.strokeStyle,q=w.textAlign,f=w.textBaseline;"string"==typeof n&&(d=n.match(/\d+/),d&&(E=d[0],n=n.replace(/\d+/,b.$22A(E))));var Z=b.$18A();"alphabetic"===f?(f="bottom",G+=.25*w.measureText("e").width):"hanging"===f&&(f="top",G+=.2*w.measureText("e").width),b.writer.$2AA(e,b.$20A({x:i,y:G}),n,Z,q,f,c)},k.prototype.$FA=function(l,b,j,E){var p=this,T=p.$21A([{x:l,y:b},{x:l+j,y:b},{x:l+j,y:b+E},{x:l,y:b+E}]);p._path.push({type:"rect",points:T})},k.prototype.$11A=function(t,$){var n=this,z=n.$20A({x:t,y:$});n._headPoint=z,n._path.push({type:"moveTo",x:z.x,y:z.y})},k.prototype.$12A=function(x,L){var u=this,F=u.$20A({x:x,y:L});u._path.push({type:"lineTo",x:F.x,y:F.y})},k.prototype.$15A=function(U,h,A,e,j,$){this.$16A(U,h,A,A,0,e,j,$)},k.prototype.$16A=function(T,G,b,R,V,o,W,I){var v,K,A,e,y,d,r,f,k,Z,w,s,m,N,B,l=this,P=l.$19A(),n=l.$20A({x:T,y:G});d=Math.sin(V),r=Math.cos(V);var U=function(K){var k=b*Math.cos(-K),z=R*Math.sin(-K);return l.$20A({x:T+(r*k-d*z),y:G+(d*k+r*z)})},J=[],F=W;if(I)for(;F>=o;)F-=2*Math.PI;else for(;o>=F;)F+=2*Math.PI;for(Z=(F-o)/l.$4A,s=0;s<=l.$4A;s++)w=o+Z*s,m=U(-w),J.push(m);if(e=J[0],y=J[J.length-1],v=l.$24A(o,W,I),o=v.start,W=v.end,f=l.$23A(P.x,P.y),k=l.$23A(b,R),!l.$3A&&f&&k&&l.$23A(Math.abs(o-W),2*Math.PI))l._path.push({type:"circle",x:n.x,y:n.y,end:y,keyPoints:J,radius:b*P.x});else if(!l.$3A&&f&&k)K=l.$18A(),A=Math.cos(K),N=l.$1A.a*A<0,B=l.$1A.d*A<0,v=l.$25A(o,W,N,B),o=v.start-K,W=v.end-K,l._path.push({type:"arc",x:n.x,y:n.y,end:y,radius:b*P.x,startAngle:o,endAngle:W,keyPoints:J});else{if(l.$3A||!f){for(s=1;s<=l.$4A;s++)m=J[s],l._path.push({type:"lineTo",x:m.x,y:m.y});return}var H,c,X=U(0),M=U(Math.PI/2),$=function(z,t){var C=z.x-t.x,G=z.y-t.y;return Math.sqrt(C*C+G*G)},S=$(X,n),C=$(M,n);C>S?(c=S,S=C,C=c,H=M):H=X,K=l.$18A(),A=Math.cos(K),N=l.$1A.a*A<0,B=l.$1A.d*A<0,v=l.$25A(o-Math.PI/2,W-Math.PI/2,N,B),o=v.start,W=v.end,l._path.push({type:"ellipse",x:n.x,y:n.y,end:y,major:{x:H.x-n.x,y:H.y-n.y},ratio:C/S,startAngle:o,endAngle:W,keyPoints:J})}},k.prototype.$17A=function(L,Q,v){var g=this,E=g.$20A({x:Q,y:v});this._path.push({type:"bezier",x:E.x,y:E.y,ctrl:g.$21A(L)})},k.prototype.$13A=function(){this.$2A()},k.prototype.$14A=function(){var n=this,b=n._headPoint;b&&(n._path.push({type:"lineTo",x:b.x,y:b.y,subType:"closePath"}),n._headPoint=null,n._lastPoint=null)},k.prototype.$24A=function(n,R,l){n=-n,R=-R;var p,W=n%(2*Math.PI),b=R%(2*Math.PI);for(0>W&&(W+=2*Math.PI),0>b&&(b+=2*Math.PI),l||(p=W,W=b,b=p);W>=b;)b+=2*Math.PI;return{start:W,end:b}},k.prototype.$25A=function(k,A,w,C){var T;return(C||w)&&(w&&C?(k=Math.PI+k,A=Math.PI+A):(T=Math.PI*(w?1:2)-A,A=Math.PI*(w?1:2)-k,k=T)),{start:k,end:A}},k.prototype.$10A=function(g){var k=this,z=k._path;if(z.length){var a,x,W,c,R,C=[],o=[],q={stroke:g};for(g?(q.lineWidth=k.$22A(k.ctx.lineWidth),q.color=k.ctx.strokeStyle):q.color=k.ctx.fillStyle,"string"!=typeof q.color&&(q.color="#ff0000"),x=0,a=z.length;a>x;x++)switch(W=z[x],W.type){case"moveTo":k._lastPoint={x:W.x,y:W.y},C.push(k._lastPoint),o.push(1);break;case"lineTo":C.push({x:W.x,y:W.y}),o.push(2),k._lastPoint={x:W.x,y:W.y};break;case"rect":R=W.points,C.push({x:R[0].x,y:R[0].y},{x:R[1].x,y:R[1].y},{x:R[2].x,y:R[2].y},{x:R[3].x,y:R[3].y},{x:R[0].x,y:R[0].y}),o.push(2,2,2,2,2),k._lastPoint=W.points[0];break;case"circle":case"arc":case"ellipse":console.log("split to line",W.type);break;case"arcBegin":C.length&&o.length&&k.writer.$2BA(C,o,q),C=[],o=[];break;case"arcClose":k.writer.$2BA(C,o,q),C=[],o=[];break;case"bezier":if(c=k._lastPoint,!c)break;1===W.ctrl.length?(C.push({x:W.ctrl[0].x,y:W.ctrl[0].y},{x:W.x,y:W.y}),o.push(3)):(C.push({x:W.ctrl[0].x,y:W.ctrl[0].y},{x:W.ctrl[1].x,y:W.ctrl[1].y},{x:W.x,y:W.y}),o.push(4)),k._lastPoint={x:W.x,y:W.y};break;default:C.push({x:W.x,y:W.y}),o.push(2)}k.writer.$2BA(C,o,q)}},k.prototype.$2A=function(){var G=this;G._path=[],G._lastPoint=null,G._headPoint=null};var w=p.SvgConverter=function(W){var g=this;g.$26A(W||{}),g.$27A()};w.prototype={},w.prototype.constructor=w,w.prototype.$26A=function(p){var K,V=this;K=V.options={},K.size=p.size||512},w.prototype.$27A=function(){var U=this,H=document.createElement("canvas");H.width=H.height=U.options.size,H.style.width=H.style.height=U.options.size,U._canvas=H,U._segments=[]},w.prototype.toShape=function(r){var e=this,G=e._canvas;e._segments=[];var V=G.getContext;return G.getContext=function(L){return function(d){var r=L.apply(this,arguments);return"2d"===d&&(r=e.$28A(r)),r}}(G.getContext),canvg(e._canvas,r),G.getContext=V,e.write()},w.prototype.$28A=function(z){var v=this,e=new p.Context2dProxy(z,v);return e},w.prototype.write=function(){var M=this,p=M.options.size;return{width:p,height:p,comps:M._segments}},w.prototype.$29A=function(J){var M=this;M._segments.push(J)},w.prototype.$2AA=function(e,y,H,A,v,N,K){v=v||"left","start"===v?v="left":"end"===v&&(v="right"),"alphabetic"===N?N="bottom":"hanging"===N&&(N="top");var u=this;u.$29A({type:"text",color:K,text:e,rotation:A,rect:[y.x,y.y,0,0],align:v,vAlign:N,font:H})},w.prototype.$2BA=function(S,k,a){for(var M=this,E=[],d=0,K=S.length;K>d;d++){var v=S[d];E.push(v.x,v.y)}var q={type:"shape",points:E,segments:k};a.stroke?(q.borderColor=a.color,q.borderWidth=a.lineWidth,q.background=null):(q.borderColor=null,q.borderWidth=0,q.background=a.color,a.gradient&&(q.gradient=a.gradient,q.gradientColor=a.gradientColor)),M.$29A(q)},function(V){function z(P){this.ok=!1,"#"==P.charAt(0)&&(P=P.substr(1,6)),P=P.replace(/ /g,""),P=P.toLowerCase();var K={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var h in K)P==h&&(P=K[h]);for(var u=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(b){return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(l){return[parseInt(l[1],16),parseInt(l[2],16),parseInt(l[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(R){return[parseInt(R[1]+R[1],16),parseInt(R[2]+R[2],16),parseInt(R[3]+R[3],16)]}}],j=0;j255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var $=this.r.toString(16),f=this.g.toString(16),T=this.b.toString(16);return 1==$.length&&($="0"+$),1==f.length&&(f="0"+f),1==T.length&&(T="0"+T),"#"+$+f+T},this.getHelpXML=function(){for(var j=new Array,A=0;A "+k.toRGB()+" -> "+k.toHex());S.appendChild(x),S.appendChild(h),l.appendChild(S)}catch(e){}return l}}"undefined"!=typeof define&&define.amd?define(function(){return z}):"undefined"!=typeof module&&module.exports&&(module.exports=z),V.RGBColor=z}("undefined"!=typeof G?G:this),function(m){function z(R){for(var V=R.data,e=4*R.width*R.height,q=0;e>q;q+=4){var p=V[q+3]/255;V[q]*=p,V[q+1]*=p,V[q+2]*=p}}function u(d){for(var p=d.data,K=4*d.width*d.height,Y=0;K>Y;Y+=4){var A=p[Y+3];0!=A&&(A=255/A,p[Y]*=A,p[Y+1]*=A,p[Y+2]*=A)}}function i(_,e,Y,p){var J=document.getElementById(_),z=J.naturalWidth,S=J.naturalHeight,i=document.getElementById(e);i.style.width=z+"px",i.style.height=S+"px",i.width=z,i.height=S;var y=i.getContext("2d");y.clearRect(0,0,z,S),y.drawImage(J,0,0),isNaN(Y)||1>Y||(p?N(e,0,0,z,S,Y):n(e,0,0,z,S,Y))}function N(E,P,k,F,a,o){if(!(isNaN(o)||1>o)){o|=0;var B,C=document.getElementById(E),l=C.getContext("2d");try{try{B=l.getImageData(P,k,F,a)}catch(r){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),B=l.getImageData(P,k,F,a)}catch(r){throw alert("Cannot access local image"),new Error("unable to access local image data: "+r)}}}catch(r){throw alert("Cannot access image"),new Error("unable to access image data: "+r)}z(B);var c,R,w,J,e,L,U,g,H,A,v,Q,G,m,O,N,K,M,_,T,i,j,W,X,D=B.data,t=o+o+1,n=F-1,d=a-1,y=o+1,x=y*(y+1)/2,p=new q,$=p;for(w=1;t>w;w++)if($=$.next=new q,w==y)var s=$;$.next=p;var I=null,h=null;U=L=0;var Z=S[o],f=b[o];for(R=0;a>R;R++){for(N=K=M=_=g=H=A=v=0,Q=y*(T=D[L]),G=y*(i=D[L+1]),m=y*(j=D[L+2]),O=y*(W=D[L+3]),g+=x*T,H+=x*i,A+=x*j,v+=x*W,$=p,w=0;y>w;w++)$.r=T,$.g=i,$.b=j,$.a=W,$=$.next;for(w=1;y>w;w++)J=L+((w>n?n:w)<<2),g+=($.r=T=D[J])*(X=y-w),H+=($.g=i=D[J+1])*X,A+=($.b=j=D[J+2])*X,v+=($.a=W=D[J+3])*X,N+=T,K+=i,M+=j,_+=W,$=$.next;for(I=p,h=s,c=0;F>c;c++)D[L]=g*Z>>f,D[L+1]=H*Z>>f,D[L+2]=A*Z>>f,D[L+3]=v*Z>>f,g-=Q,H-=G,A-=m,v-=O,Q-=I.r,G-=I.g,m-=I.b,O-=I.a,J=U+((J=c+o+1)c;c++){for(K=M=_=N=H=A=v=g=0,L=c<<2,Q=y*(T=D[L]),G=y*(i=D[L+1]),m=y*(j=D[L+2]),O=y*(W=D[L+3]),g+=x*T,H+=x*i,A+=x*j,v+=x*W,$=p,w=0;y>w;w++)$.r=T,$.g=i,$.b=j,$.a=W,$=$.next;for(e=F,w=1;o>=w;w++)L=e+c<<2,g+=($.r=T=D[L])*(X=y-w),H+=($.g=i=D[L+1])*X,A+=($.b=j=D[L+2])*X,v+=($.a=W=D[L+3])*X,N+=T,K+=i,M+=j,_+=W,$=$.next,d>w&&(e+=F);for(L=c,I=p,h=s,R=0;a>R;R++)J=L<<2,D[J]=g*Z>>f,D[J+1]=H*Z>>f,D[J+2]=A*Z>>f,D[J+3]=v*Z>>f,g-=Q,H-=G,A-=m,v-=O,Q-=I.r,G-=I.g,m-=I.b,O-=I.a,J=c+((J=R+y)E)){E|=0;var K,A=document.getElementById(l),m=A.getContext("2d");try{try{K=m.getImageData($,G,k,D)}catch(f){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),K=m.getImageData($,G,k,D)}catch(f){throw alert("Cannot access local image"),new Error("unable to access local image data: "+f)}}}catch(f){throw alert("Cannot access image"),new Error("unable to access image data: "+f)}var I,e,T,Y,c,g,d,N,o,j,L,F,C,z,X,O,s,H,u,r,V=K.data,U=E+E+1,a=k-1,p=D-1,n=E+1,w=n*(n+1)/2,t=new q,J=t;for(T=1;U>T;T++)if(J=J.next=new q,T==n)var R=J;J.next=t;var y=null,Q=null;d=g=0;var v=S[E],Z=b[E];for(e=0;D>e;e++){for(z=X=O=N=o=j=0,L=n*(s=V[g]),F=n*(H=V[g+1]),C=n*(u=V[g+2]),N+=w*s,o+=w*H,j+=w*u,J=t,T=0;n>T;T++)J.r=s,J.g=H,J.b=u,J=J.next;for(T=1;n>T;T++)Y=g+((T>a?a:T)<<2),N+=(J.r=s=V[Y])*(r=n-T),o+=(J.g=H=V[Y+1])*r,j+=(J.b=u=V[Y+2])*r,z+=s,X+=H,O+=u,J=J.next;for(y=t,Q=R,I=0;k>I;I++)V[g]=N*v>>Z,V[g+1]=o*v>>Z,V[g+2]=j*v>>Z,N-=L,o-=F,j-=C,L-=y.r,F-=y.g,C-=y.b,Y=d+((Y=I+E+1)I;I++){for(X=O=z=o=j=N=0,g=I<<2,L=n*(s=V[g]),F=n*(H=V[g+1]),C=n*(u=V[g+2]),N+=w*s,o+=w*H,j+=w*u,J=t,T=0;n>T;T++)J.r=s,J.g=H,J.b=u,J=J.next;for(c=k,T=1;E>=T;T++)g=c+I<<2,N+=(J.r=s=V[g])*(r=n-T),o+=(J.g=H=V[g+1])*r,j+=(J.b=u=V[g+2])*r,z+=s,X+=H,O+=u,J=J.next,p>T&&(c+=k);for(g=I,y=t,Q=R,e=0;D>e;e++)Y=g<<2,V[Y]=N*v>>Z,V[Y+1]=o*v>>Z,V[Y+2]=j*v>>Z,N-=L,o-=F,j-=C,L-=y.r,F-=y.g,C-=y.b,Y=I+((Y=e+n)~]/g," "),y=y.replace(/[#\.]/g," "),B(U,2),R.join("")}function h($){var N={opts:$};N.FRAMERATE=30,N.MAX_VIRTUAL_PIXELS=3e4,N.log=function(){},1==N.opts.log&&"undefined"!=typeof console&&(N.log=function(H){console.log(H)}),N.init=function(f){var b=0;N.UniqueId=function(){return b++,"canvg"+b},N.Definitions={},N.Styles={},N.StylesSpecificity={},N.Animations=[],N.Images=[],N.ctx=f,N.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(o,a){this.viewPorts.push({width:o,height:a})},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(i){return null!=i&&"number"==typeof i?i:"x"==i?this.width():"y"==i?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},N.init(),N.ImagesLoaded=function(){for(var V=0;V]*>/,"");var y=new ActiveXObject("Microsoft.XMLDOM");return y.async="false",y.loadXML(x),y},N.Property=function(c,X){this.name=c,this.value=X},N.Property.prototype.getValue=function(){return this.value},N.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},N.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var b=parseFloat(this.value);return(this.value+"").match(/%$/)&&(b/=100),b},N.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},N.Property.prototype.numValueOrDefault=function(j){return this.hasValue()?this.numValue():j},N.Property.prototype.addOpacity=function(y){var l=this.value;if(null!=y.value&&""!=y.value&&"string"==typeof this.value){var e=new Q(this.value);e.ok&&(l="rgba("+e.r+", "+e.g+", "+e.b+", "+y.numValue()+")")}return new N.Property(this.name,l)},N.Property.prototype.getDefinition=function(){var S=this.value.match(/#([^\)'"]+)/);return S&&(S=S[1]),S||(S=this.value),N.Definitions[S]},N.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},N.Property.prototype.getFillStyleDefinition=function(D,O){var w=this.getDefinition();if(null!=w&&w.createGradient)return w.createGradient(N.ctx,D,O);if(null!=w&&w.createPattern){if(w.getHrefAttribute().hasValue()){var e=w.attribute("patternTransform");w=w.getHrefAttribute().getDefinition(),e.hasValue()&&(w.attribute("patternTransform",!0).value=e.value)}return w.createPattern(N.ctx,D)}return null},N.Property.prototype.getDPI=function(){return 96},N.Property.prototype.getEM=function(e){var g=12,L=new N.Property("fontSize",N.Font.Parse(N.ctx.font).fontSize);return L.hasValue()&&(g=L.toPixels(e)),g},N.Property.prototype.getUnits=function(){var F=this.value+"";return F.replace(/[0-9\.\-]/g,"")},N.Property.prototype.toPixels=function(m,L){if(!this.hasValue())return 0;var b=this.value+"";if(b.match(/em$/))return this.numValue()*this.getEM(m);if(b.match(/ex$/))return this.numValue()*this.getEM(m)/2;if(b.match(/px$/))return this.numValue();if(b.match(/pt$/))return this.numValue()*this.getDPI(m)*(1/72);if(b.match(/pc$/))return 15*this.numValue();if(b.match(/cm$/))return this.numValue()*this.getDPI(m)/2.54;if(b.match(/mm$/))return this.numValue()*this.getDPI(m)/25.4;if(b.match(/in$/))return this.numValue()*this.getDPI(m);if(b.match(/%$/))return this.numValue()*N.ViewPort.ComputeSize(m);var a=this.numValue();return L&&1>a?a*N.ViewPort.ComputeSize(m):a},N.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var M=this.value+"";return M.match(/s$/)?1e3*this.numValue():M.match(/ms$/)?this.numValue():this.numValue()},N.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var M=this.value+"";return M.match(/deg$/)?this.numValue()*(Math.PI/180):M.match(/grad$/)?this.numValue()*(Math.PI/200):M.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var n={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 N.Property.prototype.toTextBaseline=function(){return this.hasValue()?n[this.value]:null},N.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(f,U,m,s,W,B){var S=null!=B?this.Parse(B):this.CreateFont("","","","","",N.ctx.font);return{fontFamily:W||S.fontFamily,fontSize:s||S.fontSize,fontStyle:f||S.fontStyle,fontWeight:m||S.fontWeight,fontVariant:U||S.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var V=this;this.Parse=function(Q){for(var O={},Y=N.trim(N.compressSpaces(Q||"")).split(" "),$={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},n="",c=0;cthis.x2&&(this.x2=z)),null!=w&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=w,this.y2=w),wthis.y2&&(this.y2=w))},this.addX=function(s){this.addPoint(s,null)},this.addY=function(y){this.addPoint(null,y)},this.addBoundingBox=function(R){this.addPoint(R.x1,R.y1),this.addPoint(R.x2,R.y2)},this.addQuadraticCurve=function(d,i,j,n,w,e){var k=d+2/3*(j-d),W=i+2/3*(n-i),l=k+1/3*(w-d),t=W+1/3*(e-i);this.addBezierCurve(d,i,k,l,W,t,w,e)},this.addBezierCurve=function(s,M,I,n,T,L,E,O){var R=[s,M],i=[I,n],H=[T,L],v=[E,O];this.addPoint(R[0],R[1]),this.addPoint(v[0],v[1]);for(var q=0;1>=q;q++){var k=function(g){return Math.pow(1-g,3)*R[q]+3*Math.pow(1-g,2)*g*i[q]+3*(1-g)*Math.pow(g,2)*H[q]+Math.pow(g,3)*v[q]},S=6*R[q]-12*i[q]+6*H[q],o=-3*R[q]+9*i[q]-9*H[q]+3*v[q],x=3*i[q]-3*R[q];if(0!=o){var N=Math.pow(S,2)-4*x*o;if(!(0>N)){var y=(-S+Math.sqrt(N))/(2*o);y>0&&1>y&&(0==q&&this.addX(k(y)),1==q&&this.addY(k(y)));var P=(-S-Math.sqrt(N))/(2*o);P>0&&1>P&&(0==q&&this.addX(k(P)),1==q&&this.addY(k(P)))}}else{if(0==S)continue;var U=-x/S;U>0&&1>U&&(0==q&&this.addX(k(U)),1==q&&this.addY(k(U)))}}},this.isPointInBox=function(c,G){return this.x1<=c&&c<=this.x2&&this.y1<=G&&G<=this.y2},this.addPoint(K,P),this.addPoint(C,j)},N.Transform=function(m){var p=this;this.Type={},this.Type.translate=function(Q){this.p=N.CreatePoint(Q),this.apply=function($){$.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(g){g.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(q){var $=N.ToNumberArray(q);this.angle=new N.Property("angle",$[0]),this.cx=$[1]||0,this.cy=$[2]||0,this.apply=function(E){E.translate(this.cx,this.cy),E.rotate(this.angle.toRadians()),E.translate(-this.cx,-this.cy)},this.unapply=function(f){f.translate(this.cx,this.cy),f.rotate(-1*this.angle.toRadians()),f.translate(-this.cx,-this.cy)},this.applyToPoint=function(R){var p=this.angle.toRadians();R.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),R.applyTransform([Math.cos(p),Math.sin(p),-Math.sin(p),Math.cos(p),0,0]),R.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(K){this.p=N.CreatePoint(K),this.apply=function(e){e.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(o){o.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(q){q.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(T){this.m=N.ToNumberArray(T),this.apply=function(F){F.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.unapply=function(K){var X=this.m[0],L=this.m[2],j=this.m[4],i=this.m[1],h=this.m[3],r=this.m[5],I=0,O=0,k=1,P=1/(X*(h*k-r*O)-L*(i*k-r*I)+j*(i*O-h*I));K.transform(P*(h*k-r*O),P*(r*I-i*k),P*(j*O-L*k),P*(X*k-j*I),P*(L*r-j*h),P*(j*i-X*r))},this.applyToPoint=function(Z){Z.applyTransform(this.m)}},this.Type.SkewBase=function(g){this.base=p.Type.matrix,this.base(g),this.angle=new N.Property("angle",g)},this.Type.SkewBase.prototype=new this.Type.matrix,this.Type.skewX=function(X){this.base=p.Type.SkewBase,this.base(X),this.m=[1,0,Math.tan(this.angle.toRadians()),1,0,0]},this.Type.skewX.prototype=new this.Type.SkewBase,this.Type.skewY=function(s){this.base=p.Type.SkewBase,this.base(s),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(V){for(var Y=0;Y=0;r--)this.transforms[r].unapply(d)},this.applyToPoint=function(I){for(var q=0;qZ&&(this.styles[F]=B[F],this.stylesSpecificity[F]=i)}}};var n=new RegExp("^[A-Z-]+$"),X=function(p){return n.test(p)?p.toLowerCase():p};if(null!=K&&1==K.nodeType){for(var h=0;h0&&c.push([this.points[this.points.length-1],c[c.length-1][1]]),c}},N.Element.polyline.prototype=new N.Element.PathElementBase,N.Element.polygon=function(r){this.base=N.Element.polyline,this.base(r),this.basePath=this.path,this.path=function(e){var w=this.basePath(e);return null!=e&&(e.lineTo(this.points[0].x,this.points[0].y),e.closePath()),w}},N.Element.polygon.prototype=new N.Element.polyline,N.Element.path=function(Q){this.base=N.Element.PathElementBase,this.base(Q);var s=this.attribute("d").value;s=s.replace(/,/gm," ");for(var X=0;2>X;X++)s=s.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2");s=s.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),s=s.replace(/([0-9])([+\-])/gm,"$1 $2");for(var X=0;2>X;X++)s=s.replace(/(\.[0-9]*)(\.)/gm,"$1 $2");s=s.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 "),s=N.compressSpaces(s),s=N.trim(s),this.PathParser=new function(g){this.tokens=g.split(" "),this.reset=function(){this.i=-1,this.command="",this.previousCommand="",this.start=new N.Point(0,0),this.control=new N.Point(0,0),this.current=new N.Point(0,0),this.points=[],this.angles=[]},this.isEnd=function(){return this.i>=this.tokens.length-1},this.isCommandOrEnd=function(){return this.isEnd()?!0: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 z=new N.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(z)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t,t},this.getAsCurrentPoint=function(){var D=this.getPoint();return this.current=D,D},this.getReflectedControlPoint=function(){if("c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase())return this.current;var i=new N.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y);return i},this.makeAbsolute=function(J){return this.isRelativeCommand()&&(J.x+=this.current.x,J.y+=this.current.y),J},this.addMarker=function(c,B,R){null!=R&&this.angles.length>0&&null==this.angles[this.angles.length-1]&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(R)),this.addMarkerAngle(c,null==B?null:B.angleTo(c))},this.addMarkerAngle=function(X,Q){this.points.push(X),this.angles.push(Q)},this.getMarkerPoints=function(){return this.points},this.getMarkerAngles=function(){for(var q=0;q1&&(b*=Math.sqrt(y),d*=Math.sqrt(y));var _=(U==C?-1:1)*Math.sqrt((Math.pow(b,2)*Math.pow(d,2)-Math.pow(b,2)*Math.pow(r.y,2)-Math.pow(d,2)*Math.pow(r.x,2))/(Math.pow(b,2)*Math.pow(r.y,2)+Math.pow(d,2)*Math.pow(r.x,2)));isNaN(_)&&(_=0);var E=new N.Point(_*b*r.y/d,_*-d*r.x/b),K=new N.Point((S.x+T.x)/2+Math.cos(h)*E.x-Math.sin(h)*E.y,(S.y+T.y)/2+Math.sin(h)*E.x+Math.cos(h)*E.y),f=function(z){return Math.sqrt(Math.pow(z[0],2)+Math.pow(z[1],2))},u=function(w,_){return(w[0]*_[0]+w[1]*_[1])/(f(w)*f(_))},s=function(U,y){return(U[0]*y[1]=1&&(c=0);var O=1-C?1:-1,D=l+O*(c/2),z=new N.Point(K.x+b*Math.cos(D),K.y+d*Math.sin(D));if(p.addMarkerAngle(z,D-O*Math.PI/2),p.addMarkerAngle(T,D-O*Math.PI),g.addPoint(T.x,T.y),null!=V){var u=b>d?b:d,L=b>d?1:b/d,x=b>d?d/b:1;V.translate(K.x,K.y),V.rotate(h),V.scale(L,x),V.arc(0,0,u,l,l+c,1-C),V.scale(1/L,1/x),V.rotate(-h),V.translate(-K.x,-K.y)}}break;case"Z":case"z":null!=V&&V.closePath(),p.current=p.start}return g},this.getMarkers=function(){for(var G=this.PathParser.getMarkerPoints(),D=this.PathParser.getMarkerAngles(),$=[],r=0;r=T;T++)for(var q=-1;1>=q;q++)X.save(),o.attributes.x=new N.Property("x",T*L.width),o.attributes.y=new N.Property("y",q*L.height),o.render(X),X.restore();var s=t.createPattern(L,"repeat");return s}},N.Element.pattern.prototype=new N.Element.ElementBase,N.Element.marker=function(p){this.base=N.Element.ElementBase,this.base(p),this.baseRender=this.render,this.render=function(x,W,Y){x.translate(W.x,W.y),"auto"==this.attribute("orient").valueOrDefault("auto")&&x.rotate(Y),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&x.scale(x.lineWidth,x.lineWidth),x.save();var q=new N.Element.svg;q.attributes.viewBox=new N.Property("viewBox",this.attribute("viewBox").value),q.attributes.refX=new N.Property("refX",this.attribute("refX").value),q.attributes.refY=new N.Property("refY",this.attribute("refY").value),q.attributes.width=new N.Property("width",this.attribute("markerWidth").value),q.attributes.height=new N.Property("height",this.attribute("markerHeight").value),q.attributes.fill=new N.Property("fill",this.attribute("fill").valueOrDefault("black")),q.attributes.stroke=new N.Property("stroke",this.attribute("stroke").valueOrDefault("none")),q.children=this.children,q.render(x),x.restore(),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&x.scale(1/x.lineWidth,1/x.lineWidth),"auto"==this.attribute("orient").valueOrDefault("auto")&&x.rotate(-Y),x.translate(-W.x,-W.y)}},N.Element.marker.prototype=new N.Element.ElementBase,N.Element.defs=function(b){this.base=N.Element.ElementBase,this.base(b),this.render=function(){}},N.Element.defs.prototype=new N.Element.ElementBase,N.Element.GradientBase=function(O){this.base=N.Element.ElementBase,this.base(O),this.stops=[];for(var h=0;h1&&(this.offset=1);var t=this.style("stop-color",!0);""===t.value&&(t.value="#000"),this.style("stop-opacity").hasValue()&&(t=t.addOpacity(this.style("stop-opacity"))),this.color=t.value},N.Element.stop.prototype=new N.Element.ElementBase,N.Element.AnimateBase=function(j){this.base=N.Element.ElementBase,this.base(j),N.Animations.push(this),this.duration=0,this.begin=this.attribute("begin").toMilliseconds(),this.maxDuration=this.begin+this.attribute("dur").toMilliseconds(),this.getProperty=function(){var Q=this.attribute("attributeType").value,x=this.attribute("attributeName").value;return"CSS"==Q?this.parent.style(x,!0):this.parent.attribute(x,!0)},this.initialValue=null,this.initialUnits="",this.removed=!1,this.calcValue=function(){return""},this.update=function(i){if(null==this.initialValue&&(this.initialValue=this.getProperty().value,this.initialUnits=this.getProperty().getUnits()),this.duration>this.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+i;var s=!1;if(this.begini&&g.attribute("x").hasValue())break;V+=g.measureTextRecursive(U)}return-1*("end"==$?V:V/2)}return 0},this.renderChild=function(d,T,Z,U){var $=Z.children[U];$.attribute("x").hasValue()?($.x=$.attribute("x").toPixels("x")+T.getAnchorDelta(d,Z,U),$.attribute("dx").hasValue()&&($.x+=$.attribute("dx").toPixels("x"))):($.attribute("dx").hasValue()&&(T.x+=$.attribute("dx").toPixels("x")),$.x=T.x),T.x=$.x+$.measureText(d),$.attribute("y").hasValue()?($.y=$.attribute("y").toPixels("y"),$.attribute("dy").hasValue()&&($.y+=$.attribute("dy").toPixels("y"))):($.attribute("dy").hasValue()&&(T.y+=$.attribute("dy").toPixels("y")),$.y=T.y),T.y=$.y,$.render(d);for(var U=0;U<$.children.length;U++)T.renderChild(d,T,$,U)}},N.Element.text.prototype=new N.Element.RenderedElementBase,N.Element.TextElementBase=function(d){this.base=N.Element.RenderedElementBase,this.base(d),this.getGlyph=function(j,b,n){var F=b[n],P=null;if(j.isArabic){var Y="isolated";(0==n||" "==b[n-1])&&n0&&" "!=b[n-1]&&n0&&" "!=b[n-1]&&(n==b.length-1||" "==b[n+1])&&(Y="initial"),"undefined"!=typeof j.glyphs[F]&&(P=j.glyphs[F][Y],null==P&&"glyph"==j.glyphs[F].type&&(P=j.glyphs[F])) }else P=j.glyphs[F];return null==P&&(P=j.missingGlyph),P},this.renderChildren=function(Y){var j=this.parent.style("font-family").getDefinition();if(null==j)""!=Y.fillStyle&&Y.fillText(N.compressSpaces(this.getText()),this.x,this.y),""!=Y.strokeStyle&&Y.strokeText(N.compressSpaces(this.getText()),this.x,this.y);else{var R=this.parent.style("font-size").numValueOrDefault(N.Font.Parse(N.ctx.font).fontSize),l=this.parent.style("font-style").valueOrDefault(N.Font.Parse(N.ctx.font).fontStyle),W=this.getText();j.isRTL&&(W=W.split("").reverse().join(""));for(var p=N.ToNumberArray(this.parent.attribute("dx").value),h=0;h0?"":this.text}},N.Element.tspan.prototype=new N.Element.TextElementBase,N.Element.tref=function(m){this.base=N.Element.TextElementBase,this.base(m),this.getText=function(){var s=this.getHrefAttribute().getDefinition();return null!=s?s.children[0].getText():void 0}},N.Element.tref.prototype=new N.Element.TextElementBase,N.Element.a=function(p){this.base=N.Element.TextElementBase,this.base(p),this.hasText=p.childNodes.length>0;for(var B=0;B0){var F=new N.Element.g;F.children=this.children,F.parent=this,F.render(K)}},this.onclick=function(){G.open(this.getHrefAttribute().value)},this.onmousemove=function(){N.ctx.canvas.style.cursor="pointer"}},N.Element.a.prototype=new N.Element.TextElementBase,N.Element.image=function(P){this.base=N.Element.RenderedElementBase,this.base(P);var E=this.getHrefAttribute().value;if(""!=E){var z=E.match(/\.svg$/);if(N.Images.push(this),this.loaded=!1,z)this.img=N.ajax(E),this.loaded=!0;else{this.img=document.createElement("img"),1==N.opts.useCORS&&(this.img.crossOrigin="Anonymous");var A=this;this.img.onload=function(){A.loaded=!0},this.img.onerror=function(){N.log('ERROR: image "'+E+'" not found'),A.loaded=!0},this.img.src=E}this.renderChildren=function(D){var R=this.attribute("x").toPixels("x"),_=this.attribute("y").toPixels("y"),n=this.attribute("width").toPixels("x"),Z=this.attribute("height").toPixels("y");0!=n&&0!=Z&&(D.save(),z?D.drawSvg(this.img,R,_,n,Z):(D.translate(R,_),N.AspectRatio(D,this.attribute("preserveAspectRatio").value,n,this.img.width,Z,this.img.height,0,0),D.drawImage(this.img,0,0)),D.restore())},this.getBoundingBox=function(){var B=this.attribute("x").toPixels("x"),O=this.attribute("y").toPixels("y"),E=this.attribute("width").toPixels("x"),V=this.attribute("height").toPixels("y");return new N.BoundingBox(B,O,B+E,O+V)}}},N.Element.image.prototype=new N.Element.RenderedElementBase,N.Element.g=function(x){this.base=N.Element.RenderedElementBase,this.base(x),this.getBoundingBox=function(){for(var L=new N.BoundingBox,z=0;z0)for(var c=Q[G].indexOf("url"),v=Q[G].indexOf(")",c),H=Q[G].substr(c+5,v-c-6),l=N.parseXml(N.ajax(H)),p=l.getElementsByTagName("font"),m=0;mY?R-255:R)}this.base=N.Element.ElementBase,this.base(y);var L=N.ToNumberArray(this.attribute("values").value);switch(this.attribute("type").valueOrDefault("matrix")){case"saturate":var T=L[0];L=[.213+.787*T,.715-.715*T,.072-.072*T,0,0,.213-.213*T,.715+.285*T,.072-.072*T,0,0,.213-.213*T,.715-.715*T,.072+.928*T,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var c=L[0]*Math.PI/180,b=function(V,O,d){return V+Math.cos(c)*O+Math.sin(c)*d};L=[b(.213,.787,-.213),b(.715,-.715,-.715),b(.072,-.072,.928),0,0,b(.213,-.213,.143),b(.715,.285,.14),b(.072,-.072,-.283),0,0,b(.213,-.213,-.787),b(.715,-.715,.715),b(.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}this.apply=function(d,Z,s,H,T){if(H&&T){for(var f=d.getImageData(0,0,H,T),s=0;T>s;s++)for(var Z=0;H>Z;Z++){var h=t(f.data,Z,s,H,T,0),O=t(f.data,Z,s,H,T,1),S=t(f.data,Z,s,H,T,2),G=t(f.data,Z,s,H,T,3);m(f.data,Z,s,H,T,0,P(0,h)+P(1,O)+P(2,S)+P(3,G)+P(4,1)),m(f.data,Z,s,H,T,1,P(5,h)+P(6,O)+P(7,S)+P(8,G)+P(9,1)),m(f.data,Z,s,H,T,2,P(10,h)+P(11,O)+P(12,S)+P(13,G)+P(14,1)),m(f.data,Z,s,H,T,3,P(15,h)+P(16,O)+P(17,S)+P(18,G)+P(19,1))}d.clearRect(0,0,H,T),d.putImageData(f,0,0)}}},N.Element.feColorMatrix.prototype=new N.Element.ElementBase,N.Element.feGaussianBlur=function(B){this.base=N.Element.ElementBase,this.base(B),this.blurRadius=Math.floor(this.attribute("stdDeviation").numValue()),this.extraFilterDistance=this.blurRadius,this.apply=function(S,v,n,h,q){return"undefined"==typeof M.canvasRGBA?(N.log("ERROR: StackBlur.js must be included for blur to work"),void 0):(S.canvas.id=N.UniqueId(),S.canvas.style.display="none",document.body.appendChild(S.canvas),M.canvasRGBA(S.canvas.id,v,n,h,q,this.blurRadius),document.body.removeChild(S.canvas),void 0)}},N.Element.feGaussianBlur.prototype=new N.Element.ElementBase,N.Element.title=function(){},N.Element.title.prototype=new N.Element.ElementBase,N.Element.desc=function(){},N.Element.desc.prototype=new N.Element.ElementBase,N.Element.MISSING=function(l){N.log("ERROR: Element '"+l.nodeName+"' not yet implemented.")},N.Element.MISSING.prototype=new N.Element.ElementBase,N.CreateElement=function(l){var w=l.nodeName.replace(/^[^:]+:/,"");w=w.replace(/\-/g,"");var X=null;return X="undefined"!=typeof N.Element[w]?new N.Element[w](l):new N.Element.MISSING(l),X.type=l.nodeName,X},N.load=function(p,w){N.loadXml(p,N.ajax(w))},N.loadXml=function(m,u){N.loadXmlDoc(m,N.parseXml(u))},N.loadXmlDoc=function(v,t){N.init(v);var M=function(H){for(var E=v.canvas;E;)H.x-=E.offsetLeft,H.y-=E.offsetTop,E=E.offsetParent;return G.scrollX&&(H.x+=G.scrollX),G.scrollY&&(H.y+=G.scrollY),H};1!=N.opts.ignoreMouse&&(v.canvas.onclick=function(Q){var h=M(new N.Point(null!=Q?Q.clientX:event.clientX,null!=Q?Q.clientY:event.clientY));N.Mouse.onclick(h.x,h.y)},v.canvas.onmousemove=function(P){var h=M(new N.Point(null!=P?P.clientX:event.clientX,null!=P?P.clientY:event.clientY));N.Mouse.onmousemove(h.x,h.y)});var i=N.CreateElement(t.documentElement);i.root=!0,i.addStylesFromStyleDefinition();var x=!0,K=function(){N.ViewPort.Clear(),v.canvas.parentNode&&N.ViewPort.SetCurrent(v.canvas.parentNode.clientWidth,v.canvas.parentNode.clientHeight),1!=N.opts.ignoreDimensions&&(i.style("width").hasValue()&&(v.canvas.width=i.style("width").toPixels("x"),v.canvas.style.width=v.canvas.width+"px"),i.style("height").hasValue()&&(v.canvas.height=i.style("height").toPixels("y"),v.canvas.style.height=v.canvas.height+"px"));var j=v.canvas.clientWidth||v.canvas.width,g=v.canvas.clientHeight||v.canvas.height;if(1==N.opts.ignoreDimensions&&i.style("width").hasValue()&&i.style("height").hasValue()&&(j=i.style("width").toPixels("x"),g=i.style("height").toPixels("y")),N.ViewPort.SetCurrent(j,g),null!=N.opts.offsetX&&(i.attribute("x",!0).value=N.opts.offsetX),null!=N.opts.offsetY&&(i.attribute("y",!0).value=N.opts.offsetY),null!=N.opts.scaleWidth||null!=N.opts.scaleHeight){var D=null,Q=null,I=N.ToNumberArray(i.attribute("viewBox").value);null!=N.opts.scaleWidth&&(i.attribute("width").hasValue()?D=i.attribute("width").toPixels("x")/N.opts.scaleWidth:isNaN(I[2])||(D=I[2]/N.opts.scaleWidth)),null!=N.opts.scaleHeight&&(i.attribute("height").hasValue()?Q=i.attribute("height").toPixels("y")/N.opts.scaleHeight:isNaN(I[3])||(Q=I[3]/N.opts.scaleHeight)),null==D&&(D=Q),null==Q&&(Q=D),i.attribute("width",!0).value=N.opts.scaleWidth,i.attribute("height",!0).value=N.opts.scaleHeight,i.style("transform",!0,!0).value+=" scale("+1/D+","+1/Q+")"}1!=N.opts.ignoreClear&&v.clearRect(0,0,j,g),i.render(v),x&&(x=!1,"function"==typeof N.opts.renderCallback&&N.opts.renderCallback(t))},w=!0;N.ImagesLoaded()&&(w=!1,K()),N.intervalID=setInterval(function(){var e=!1;if(w&&N.ImagesLoaded()&&(w=!1,e=!0),1!=N.opts.ignoreMouse&&(e|=N.Mouse.hasEvents()),1!=N.opts.ignoreAnimation)for(var u=0;u~\.\[:]+)/g,V=/(\.[^\s\+>~\.\[:]+)/g,g=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,r=/(:[\w-]+\([^\)]*\))/gi,p=/(:[^\s\+>~\.\[:]+)/g,U=/([^\s\+>~\.\[:]+)/g;return"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(j,r,D,J,H,d){var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:r,offsetY:D,scaleWidth:J,scaleHeight:H};for(var x in d)d.hasOwnProperty(x)&&(f[x]=d[x]);T(this.canvas,j,f)}),T})}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:this,Object);