forked from fex-team/kf-parser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
kity-formula-render.all.min.js
12 lines (12 loc) · 121 KB
/
kity-formula-render.all.min.js
1
2
3
4
5
6
7
8
9
10
11
12
/*!
* ====================================================
* Kity Formula Render - v1.0.0 - 2014-10-15
* https://github.com/kitygraph/formula
* GitHub: https://github.com/kitygraph/formula.git
* Copyright (c) 2014 Baidu Kity Group; Licensed MIT
* ====================================================
*/
!function(){function a(a){b.r([c[a]])}var b={r:function(a){if(b[a].inited)return b[a].value;if("function"!=typeof b[a].value)return b[a].inited=!0,b[a].value;var c={exports:{}},d=b[a].value(null,c.exports,c);if(b[a].inited=!0,b[a].value=d,void 0!==d)return d;for(var e in c.exports)if(c.exports.hasOwnProperty(e))return b[a].inited=!0,b[a].value=c.exports,c.exports}};b[0]={value:function(){function a(b){this.ok=!1,"#"==b.charAt(0)&&(b=b.substr(1,6)),b=b.replace(/ /g,""),b=b.toLowerCase();var c={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 d in c)b==d&&(b=c[d]);for(var e=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],f=0;f<e.length;f++){var g=e[f].re,h=e[f].process,i=g.exec(b);i&&(channels=h(i),this.r=channels[0],this.g=channels[1],this.b=channels[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?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 a=this.r.toString(16),b=this.g.toString(16),c=this.b.toString(16);return 1==a.length&&(a="0"+a),1==b.length&&(b="0"+b),1==c.length&&(c="0"+c),"#"+a+b+c},this.getHelpXML=function(){for(var b=new Array,d=0;d<e.length;d++)for(var f=e[d].example,g=0;g<f.length;g++)b[b.length]=f[g];for(var h in c)b[b.length]=h;var i=document.createElement("ul");i.setAttribute("id","rgbcolor-examples");for(var d=0;d<b.length;d++)try{var j=document.createElement("li"),k=new a(b[d]),l=document.createElement("div");l.style.cssText="margin: 3px; border: 1px solid black; background:"+k.toHex()+"; color:"+k.toHex(),l.appendChild(document.createTextNode("test"));var m=document.createTextNode(" "+b[d]+" -> "+k.toRGB()+" -> "+k.toHex());j.appendChild(l),j.appendChild(m),i.appendChild(j)}catch(n){}return i}}function b(a,b,f,g,h,i){if(!(isNaN(i)||1>i)){i|=0;var j,k=document.getElementById(a),l=k.getContext("2d");try{try{j=l.getImageData(b,f,g,h)}catch(m){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),j=l.getImageData(b,f,g,h)}catch(m){throw alert("Cannot access local image"),new Error("unable to access local image data: "+m)}}}catch(m){throw alert("Cannot access image"),new Error("unable to access image data: "+m)}var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L=j.data,M=i+i+1,N=g-1,O=h-1,P=i+1,Q=P*(P+1)/2,R=new c,S=R;for(p=1;M>p;p++)if(S=S.next=new c,p==P)var T=S;S.next=R;var U=null,V=null;t=s=0;var W=d[i],X=e[i];for(o=0;h>o;o++){for(C=D=E=F=u=v=w=x=0,y=P*(G=L[s]),z=P*(H=L[s+1]),A=P*(I=L[s+2]),B=P*(J=L[s+3]),u+=Q*G,v+=Q*H,w+=Q*I,x+=Q*J,S=R,p=0;P>p;p++)S.r=G,S.g=H,S.b=I,S.a=J,S=S.next;for(p=1;P>p;p++)q=s+((p>N?N:p)<<2),u+=(S.r=G=L[q])*(K=P-p),v+=(S.g=H=L[q+1])*K,w+=(S.b=I=L[q+2])*K,x+=(S.a=J=L[q+3])*K,C+=G,D+=H,E+=I,F+=J,S=S.next;for(U=R,V=T,n=0;g>n;n++)L[s+3]=J=x*W>>X,0!=J?(J=255/J,L[s]=(u*W>>X)*J,L[s+1]=(v*W>>X)*J,L[s+2]=(w*W>>X)*J):L[s]=L[s+1]=L[s+2]=0,u-=y,v-=z,w-=A,x-=B,y-=U.r,z-=U.g,A-=U.b,B-=U.a,q=t+((q=n+i+1)<N?q:N)<<2,C+=U.r=L[q],D+=U.g=L[q+1],E+=U.b=L[q+2],F+=U.a=L[q+3],u+=C,v+=D,w+=E,x+=F,U=U.next,y+=G=V.r,z+=H=V.g,A+=I=V.b,B+=J=V.a,C-=G,D-=H,E-=I,F-=J,V=V.next,s+=4;t+=g}for(n=0;g>n;n++){for(D=E=F=C=v=w=x=u=0,s=n<<2,y=P*(G=L[s]),z=P*(H=L[s+1]),A=P*(I=L[s+2]),B=P*(J=L[s+3]),u+=Q*G,v+=Q*H,w+=Q*I,x+=Q*J,S=R,p=0;P>p;p++)S.r=G,S.g=H,S.b=I,S.a=J,S=S.next;for(r=g,p=1;i>=p;p++)s=r+n<<2,u+=(S.r=G=L[s])*(K=P-p),v+=(S.g=H=L[s+1])*K,w+=(S.b=I=L[s+2])*K,x+=(S.a=J=L[s+3])*K,C+=G,D+=H,E+=I,F+=J,S=S.next,O>p&&(r+=g);for(s=n,U=R,V=T,o=0;h>o;o++)q=s<<2,L[q+3]=J=x*W>>X,J>0?(J=255/J,L[q]=(u*W>>X)*J,L[q+1]=(v*W>>X)*J,L[q+2]=(w*W>>X)*J):L[q]=L[q+1]=L[q+2]=0,u-=y,v-=z,w-=A,x-=B,y-=U.r,z-=U.g,A-=U.b,B-=U.a,q=n+((q=o+P)<O?q:O)*g<<2,u+=C+=U.r=L[q],v+=D+=U.g=L[q+1],w+=E+=U.b=L[q+2],x+=F+=U.a=L[q+3],U=U.next,y+=G=V.r,z+=H=V.g,A+=I=V.b,B+=J=V.a,C-=G,D-=H,E-=I,F-=J,V=V.next,s+=g}l.putImageData(j,b,f)}}function c(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var d=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],e=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];return function(){function c(){var c={};return c.FRAMERATE=30,c.MAX_VIRTUAL_PIXELS=3e4,c.init=function(a){var b=0;c.UniqueId=function(){return b++,"canvg"+b},c.Definitions={},c.Styles={},c.Animations=[],c.Images=[],c.ctx=a,c.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(a,b){this.viewPorts.push({width:a,height:b})},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(a){return null!=a&&"number"==typeof a?a:"x"==a?this.width():"y"==a?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},c.init(),c.ImagesLoaded=function(){for(var a=0;a<c.Images.length;a++)if(!c.Images[a].loaded)return!1;return!0},c.trim=function(a){return a.replace(/^\s+|\s+$/g,"")},c.compressSpaces=function(a){return a.replace(/[\s\r\t\n]+/gm," ")},c.ajax=function(a){var b;return b=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),b?(b.open("GET",a,!1),b.send(null),b.responseText):null},c.parseXml=function(a){if(window.DOMParser){var b=new DOMParser;return b.parseFromString(a,"text/xml")}a=a.replace(/<!DOCTYPE svg[^>]*>/,"");var c=new ActiveXObject("Microsoft.XMLDOM");return c.async="false",c.loadXML(a),c},c.Property=function(a,b){this.name=a,this.value=b},c.Property.prototype.getValue=function(){return this.value},c.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},c.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var a=parseFloat(this.value);return(this.value+"").match(/%$/)&&(a/=100),a},c.Property.prototype.valueOrDefault=function(a){return this.hasValue()?this.value:a},c.Property.prototype.numValueOrDefault=function(a){return this.hasValue()?this.numValue():a},c.Property.prototype.addOpacity=function(b){var d=this.value;if(null!=b&&""!=b&&"string"==typeof this.value){var e=new a(this.value);e.ok&&(d="rgba("+e.r+", "+e.g+", "+e.b+", "+b+")")}return new c.Property(this.name,d)},c.Property.prototype.getDefinition=function(){var a=this.value.match(/#([^\)'"]+)/);return a&&(a=a[1]),a||(a=this.value),c.Definitions[a]},c.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},c.Property.prototype.getFillStyleDefinition=function(a,b){var d=this.getDefinition();if(null!=d&&d.createGradient)return d.createGradient(c.ctx,a,b);if(null!=d&&d.createPattern){if(d.getHrefAttribute().hasValue()){var e=d.attribute("patternTransform");d=d.getHrefAttribute().getDefinition(),e.hasValue()&&(d.attribute("patternTransform",!0).value=e.value)}return d.createPattern(c.ctx,a)}return null},c.Property.prototype.getDPI=function(){return 96},c.Property.prototype.getEM=function(a){var b=12,d=new c.Property("fontSize",c.Font.Parse(c.ctx.font).fontSize);return d.hasValue()&&(b=d.toPixels(a)),b},c.Property.prototype.getUnits=function(){var a=this.value+"";return a.replace(/[0-9\.\-]/g,"")},c.Property.prototype.toPixels=function(a,b){if(!this.hasValue())return 0;var d=this.value+"";if(d.match(/em$/))return this.numValue()*this.getEM(a);if(d.match(/ex$/))return this.numValue()*this.getEM(a)/2;if(d.match(/px$/))return this.numValue();if(d.match(/pt$/))return this.numValue()*this.getDPI(a)*(1/72);if(d.match(/pc$/))return 15*this.numValue();if(d.match(/cm$/))return this.numValue()*this.getDPI(a)/2.54;if(d.match(/mm$/))return this.numValue()*this.getDPI(a)/25.4;if(d.match(/in$/))return this.numValue()*this.getDPI(a);if(d.match(/%$/))return this.numValue()*c.ViewPort.ComputeSize(a);var e=this.numValue();return b&&1>e?e*c.ViewPort.ComputeSize(a):e},c.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var a=this.value+"";return a.match(/s$/)?1e3*this.numValue():(a.match(/ms$/),this.numValue())},c.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var a=this.value+"";return a.match(/deg$/)?this.numValue()*(Math.PI/180):a.match(/grad$/)?this.numValue()*(Math.PI/200):a.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)},c.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(a,b,d,e,f,g){var h=null!=g?this.Parse(g):this.CreateFont("","","","","",c.ctx.font);return{fontFamily:f||h.fontFamily,fontSize:e||h.fontSize,fontStyle:a||h.fontStyle,fontWeight:d||h.fontWeight,fontVariant:b||h.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var a=this;this.Parse=function(b){for(var d={},e=c.trim(c.compressSpaces(b||"")).split(" "),f={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},g="",h=0;h<e.length;h++)f.fontStyle||-1==a.Styles.indexOf(e[h])?f.fontVariant||-1==a.Variants.indexOf(e[h])?f.fontWeight||-1==a.Weights.indexOf(e[h])?f.fontSize?"inherit"!=e[h]&&(g+=e[h]):("inherit"!=e[h]&&(d.fontSize=e[h].split("/")[0]),f.fontStyle=f.fontVariant=f.fontWeight=f.fontSize=!0):("inherit"!=e[h]&&(d.fontWeight=e[h]),f.fontStyle=f.fontVariant=f.fontWeight=!0):("inherit"!=e[h]&&(d.fontVariant=e[h]),f.fontStyle=f.fontVariant=!0):("inherit"!=e[h]&&(d.fontStyle=e[h]),f.fontStyle=!0);return""!=g&&(d.fontFamily=g),d}},c.ToNumberArray=function(a){for(var b=c.trim(c.compressSpaces((a||"").replace(/,/g," "))).split(" "),d=0;d<b.length;d++)b[d]=parseFloat(b[d]);return b},c.Point=function(a,b){this.x=a,this.y=b},c.Point.prototype.angleTo=function(a){return Math.atan2(a.y-this.y,a.x-this.x)},c.Point.prototype.applyTransform=function(a){var b=this.x*a[0]+this.y*a[2]+a[4],c=this.x*a[1]+this.y*a[3]+a[5];this.x=b,this.y=c},c.CreatePoint=function(a){var b=c.ToNumberArray(a);return new c.Point(b[0],b[1])},c.CreatePath=function(a){for(var b=c.ToNumberArray(a),d=[],e=0;e<b.length;e+=2)d.push(new c.Point(b[e],b[e+1]));return d},c.BoundingBox=function(a,b,c,d){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.x=function(){return this.x1},this.y=function(){return this.y1},this.width=function(){return this.x2-this.x1},this.height=function(){return this.y2-this.y1},this.addPoint=function(a,b){null!=a&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=a,this.x2=a),a<this.x1&&(this.x1=a),a>this.x2&&(this.x2=a)),null!=b&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=b,this.y2=b),b<this.y1&&(this.y1=b),b>this.y2&&(this.y2=b))},this.addX=function(a){this.addPoint(a,null)},this.addY=function(a){this.addPoint(null,a)},this.addBoundingBox=function(a){this.addPoint(a.x1,a.y1),this.addPoint(a.x2,a.y2)},this.addQuadraticCurve=function(a,b,c,d,e,f){var g=a+2/3*(c-a),h=b+2/3*(d-b),i=g+1/3*(e-a),j=h+1/3*(f-b);this.addBezierCurve(a,b,g,i,h,j,e,f)},this.addBezierCurve=function(a,b,c,d,e,f,g,h){var j=[a,b],k=[c,d],l=[e,f],m=[g,h];for(this.addPoint(j[0],j[1]),this.addPoint(m[0],m[1]),i=0;1>=i;i++){var n=function(a){return Math.pow(1-a,3)*j[i]+3*Math.pow(1-a,2)*a*k[i]+3*(1-a)*Math.pow(a,2)*l[i]+Math.pow(a,3)*m[i]},o=6*j[i]-12*k[i]+6*l[i],p=-3*j[i]+9*k[i]-9*l[i]+3*m[i],q=3*k[i]-3*j[i];if(0!=p){var r=Math.pow(o,2)-4*q*p;if(!(0>r)){var s=(-o+Math.sqrt(r))/(2*p);s>0&&1>s&&(0==i&&this.addX(n(s)),1==i&&this.addY(n(s)));var t=(-o-Math.sqrt(r))/(2*p);t>0&&1>t&&(0==i&&this.addX(n(t)),1==i&&this.addY(n(t)))}}else{if(0==o)continue;var u=-q/o;u>0&&1>u&&(0==i&&this.addX(n(u)),1==i&&this.addY(n(u)))}}},this.isPointInBox=function(a,b){return this.x1<=a&&a<=this.x2&&this.y1<=b&&b<=this.y2},this.addPoint(a,b),this.addPoint(c,d)},c.Transform=function(a){var b=this;this.Type={},this.Type.translate=function(a){this.p=c.CreatePoint(a),this.apply=function(a){a.translate(this.p.x||0,this.p.y||0)},this.unapply=function(a){a.translate(-1*this.p.x||0,-1*this.p.y||0)},this.applyToPoint=function(a){a.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0])}},this.Type.rotate=function(a){var b=c.ToNumberArray(a);this.angle=new c.Property("angle",b[0]),this.cx=b[1]||0,this.cy=b[2]||0,this.apply=function(a){a.translate(this.cx,this.cy),a.rotate(this.angle.toRadians()),a.translate(-this.cx,-this.cy)},this.unapply=function(a){a.translate(this.cx,this.cy),a.rotate(-1*this.angle.toRadians()),a.translate(-this.cx,-this.cy)},this.applyToPoint=function(a){var b=this.angle.toRadians();a.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]),a.applyTransform([Math.cos(b),Math.sin(b),-Math.sin(b),Math.cos(b),0,0]),a.applyTransform([1,0,0,1,-this.p.x||0,-this.p.y||0])}},this.Type.scale=function(a){this.p=c.CreatePoint(a),this.apply=function(a){a.scale(this.p.x||1,this.p.y||this.p.x||1)},this.unapply=function(a){a.scale(1/this.p.x||1,1/this.p.y||this.p.x||1)},this.applyToPoint=function(a){a.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}},this.Type.matrix=function(a){this.m=c.ToNumberArray(a),this.apply=function(a){a.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])},this.applyToPoint=function(a){a.applyTransform(this.m)}},this.Type.SkewBase=function(a){this.base=b.Type.matrix,this.base(a),this.angle=new c.Property("angle",a)},this.Type.SkewBase.prototype=new this.Type.matrix,this.Type.skewX=function(a){this.base=b.Type.SkewBase,this.base(a),this.m=[1,0,Math.tan(this.angle.toRadians()),1,0,0]},this.Type.skewX.prototype=new this.Type.SkewBase,this.Type.skewY=function(a){this.base=b.Type.SkewBase,this.base(a),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(a){for(var b=0;b<this.transforms.length;b++)this.transforms[b].apply(a)},this.unapply=function(a){for(var b=this.transforms.length-1;b>=0;b--)this.transforms[b].unapply(a)},this.applyToPoint=function(a){for(var b=0;b<this.transforms.length;b++)this.transforms[b].applyToPoint(a)};for(var d=c.trim(c.compressSpaces(a)).replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/),e=0;e<d.length;e++){var f=c.trim(d[e].split("(")[0]),g=d[e].split("(")[1].replace(")",""),h=new this.Type[f](g);h.type=f,this.transforms.push(h)}},c.AspectRatio=function(a,b,d,e,f,g,h,i,j,k){b=c.compressSpaces(b),b=b.replace(/^defer\s/,"");var l=b.split(" ")[0]||"xMidYMid",m=b.split(" ")[1]||"meet",n=d/e,o=f/g,p=Math.min(n,o),q=Math.max(n,o);"meet"==m&&(e*=p,g*=p),"slice"==m&&(e*=q,g*=q),j=new c.Property("refX",j),k=new c.Property("refY",k),j.hasValue()&&k.hasValue()?a.translate(-p*j.toPixels("x"),-p*k.toPixels("y")):(l.match(/^xMid/)&&("meet"==m&&p==o||"slice"==m&&q==o)&&a.translate(d/2-e/2,0),l.match(/YMid$/)&&("meet"==m&&p==n||"slice"==m&&q==n)&&a.translate(0,f/2-g/2),l.match(/^xMax/)&&("meet"==m&&p==o||"slice"==m&&q==o)&&a.translate(d-e,0),l.match(/YMax$/)&&("meet"==m&&p==n||"slice"==m&&q==n)&&a.translate(0,f-g)),"none"==l?a.scale(n,o):"meet"==m?a.scale(p,p):"slice"==m&&a.scale(q,q),a.translate(null==h?0:-h,null==i?0:-i)},c.Element={},c.EmptyProperty=new c.Property("EMPTY",""),c.Element.ElementBase=function(a){if(this.attributes={},this.styles={},this.children=[],this.attribute=function(a,b){var d=this.attributes[a];return null!=d?d:(1==b&&(d=new c.Property(a,""),this.attributes[a]=d),d||c.EmptyProperty)},this.getHrefAttribute=function(){for(var a in this.attributes)if(a.match(/:href$/))return this.attributes[a];return c.EmptyProperty},this.style=function(a,b){var d=this.styles[a];if(null!=d)return d;var e=this.attribute(a);if(null!=e&&e.hasValue())return this.styles[a]=e,e;var f=this.parent;if(null!=f){var g=f.style(a);if(null!=g&&g.hasValue())return g}return 1==b&&(d=new c.Property(a,""),this.styles[a]=d),d||c.EmptyProperty},this.render=function(a){if("none"!=this.style("display").value&&"hidden"!=this.attribute("visibility").value){if(a.save(),this.attribute("mask").hasValue()){var b=this.attribute("mask").getDefinition();null!=b&&b.apply(a,this)}else if(this.style("filter").hasValue()){var c=this.style("filter").getDefinition();null!=c&&c.apply(a,this)}else this.setContext(a),this.renderChildren(a),this.clearContext(a);a.restore()}},this.setContext=function(){},this.clearContext=function(){},this.renderChildren=function(a){for(var b=0;b<this.children.length;b++)this.children[b].render(a)},this.addChild=function(a,b){var d=a;b&&(d=c.CreateElement(a)),d.parent=this,this.children.push(d)},null!=a&&1==a.nodeType){for(var b=0;b<a.childNodes.length;b++){var d=a.childNodes[b];if(1==d.nodeType&&this.addChild(d,!0),this.captureTextNodes&&3==d.nodeType){var e=d.nodeValue||d.text||"";""!=c.trim(c.compressSpaces(e))&&this.addChild(new c.Element.tspan(d),!1)}}for(var b=0;b<a.attributes.length;b++){var f=a.attributes[b];this.attributes[f.nodeName]=new c.Property(f.nodeName,f.nodeValue)}var g=c.Styles[a.nodeName];if(null!=g)for(var h in g)this.styles[h]=g[h];if(this.attribute("class").hasValue())for(var i=c.compressSpaces(this.attribute("class").value).split(" "),j=0;j<i.length;j++){if(g=c.Styles["."+i[j]],null!=g)for(var h in g)this.styles[h]=g[h];if(g=c.Styles[a.nodeName+"."+i[j]],null!=g)for(var h in g)this.styles[h]=g[h]}if(this.attribute("id").hasValue()){var g=c.Styles["#"+this.attribute("id").value];if(null!=g)for(var h in g)this.styles[h]=g[h]}if(this.attribute("style").hasValue())for(var g=this.attribute("style").value.split(";"),b=0;b<g.length;b++)if(""!=c.trim(g[b])){var k=g[b].split(":"),h=c.trim(k[0]),l=c.trim(k[1]);this.styles[h]=new c.Property(h,l)}this.attribute("id").hasValue()&&null==c.Definitions[this.attribute("id").value]&&(c.Definitions[this.attribute("id").value]=this)}},c.Element.RenderedElementBase=function(a){this.base=c.Element.ElementBase,this.base(a),this.setContext=function(a){if(this.style("fill").isUrlDefinition()){var b=this.style("fill").getFillStyleDefinition(this,this.style("fill-opacity"));null!=b&&(a.fillStyle=b)}else if(this.style("fill").hasValue()){var d=this.style("fill");"currentColor"==d.value&&(d.value=this.style("color").value),a.fillStyle="none"==d.value?"rgba(0,0,0,0)":d.value}if(this.style("fill-opacity").hasValue()){var d=new c.Property("fill",a.fillStyle);d=d.addOpacity(this.style("fill-opacity").value),a.fillStyle=d.value}if(this.style("stroke").isUrlDefinition()){var b=this.style("stroke").getFillStyleDefinition(this,this.style("stroke-opacity"));null!=b&&(a.strokeStyle=b)}else if(this.style("stroke").hasValue()){var e=this.style("stroke");"currentColor"==e.value&&(e.value=this.style("color").value),a.strokeStyle="none"==e.value?"rgba(0,0,0,0)":e.value}if(this.style("stroke-opacity").hasValue()){var e=new c.Property("stroke",a.strokeStyle);e=e.addOpacity(this.style("stroke-opacity").value),a.strokeStyle=e.value}if(this.style("stroke-width").hasValue()){var f=this.style("stroke-width").toPixels();a.lineWidth=0==f?.001:f}if(this.style("stroke-linecap").hasValue()&&(a.lineCap=this.style("stroke-linecap").value),this.style("stroke-linejoin").hasValue()&&(a.lineJoin=this.style("stroke-linejoin").value),this.style("stroke-miterlimit").hasValue()&&(a.miterLimit=this.style("stroke-miterlimit").value),this.style("stroke-dasharray").hasValue()){var g=c.ToNumberArray(this.style("stroke-dasharray").value);"undefined"!=typeof a.setLineDash?a.setLineDash(g):"undefined"!=typeof a.webkitLineDash?a.webkitLineDash=g:"undefined"!=typeof a.mozDash&&(a.mozDash=g);var h=this.style("stroke-dashoffset").numValueOrDefault(1);"undefined"!=typeof a.lineDashOffset?a.lineDashOffset=h:"undefined"!=typeof a.webkitLineDashOffset?a.webkitLineDashOffset=h:"undefined"!=typeof a.mozDashOffset&&(a.mozDashOffset=h)}if("undefined"!=typeof a.font&&(a.font=c.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").toPixels()+"px":"",this.style("font-family").value).toString()),this.attribute("transform").hasValue()){var i=new c.Transform(this.attribute("transform").value);i.apply(a)}if(this.style("clip-path").hasValue()){var j=this.style("clip-path").getDefinition();null!=j&&j.apply(a)}this.style("opacity").hasValue()&&(a.globalAlpha=this.style("opacity").numValue())}},c.Element.RenderedElementBase.prototype=new c.Element.ElementBase,c.Element.PathElementBase=function(a){this.base=c.Element.RenderedElementBase,this.base(a),this.path=function(a){return null!=a&&a.beginPath(),new c.BoundingBox},this.renderChildren=function(a){this.path(a),c.Mouse.checkPath(this,a),""!=a.fillStyle&&(this.attribute("fill-rule").hasValue()?a.fill(this.attribute("fill-rule").value):a.fill()),""!=a.strokeStyle&&a.stroke();var b=this.getMarkers();if(null!=b){if(this.style("marker-start").isUrlDefinition()){var d=this.style("marker-start").getDefinition();d.render(a,b[0][0],b[0][1])}if(this.style("marker-mid").isUrlDefinition())for(var d=this.style("marker-mid").getDefinition(),e=1;e<b.length-1;e++)d.render(a,b[e][0],b[e][1]);if(this.style("marker-end").isUrlDefinition()){var d=this.style("marker-end").getDefinition();d.render(a,b[b.length-1][0],b[b.length-1][1])}}},this.getBoundingBox=function(){return this.path()},this.getMarkers=function(){return null}},c.Element.PathElementBase.prototype=new c.Element.RenderedElementBase,c.Element.svg=function(a){this.base=c.Element.RenderedElementBase,this.base(a),this.baseClearContext=this.clearContext,this.clearContext=function(a){this.baseClearContext(a),c.ViewPort.RemoveCurrent()},this.baseSetContext=this.setContext,this.setContext=function(a){a.strokeStyle="rgba(0,0,0,0)",a.lineCap="butt",a.lineJoin="miter",a.miterLimit=4,this.baseSetContext(a),this.attribute("x").hasValue()||(this.attribute("x",!0).value=0),this.attribute("y").hasValue()||(this.attribute("y",!0).value=0),a.translate(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"));var b=c.ViewPort.width(),d=c.ViewPort.height();if(this.attribute("width").hasValue()||(this.attribute("width",!0).value="100%"),this.attribute("height").hasValue()||(this.attribute("height",!0).value="100%"),"undefined"==typeof this.root){b=this.attribute("width").toPixels("x"),d=this.attribute("height").toPixels("y");var e=0,f=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(e=-this.attribute("refX").toPixels("x"),f=-this.attribute("refY").toPixels("y")),a.beginPath(),a.moveTo(e,f),a.lineTo(b,f),a.lineTo(b,d),a.lineTo(e,d),a.closePath(),a.clip()}if(c.ViewPort.SetCurrent(b,d),this.attribute("viewBox").hasValue()){var g=c.ToNumberArray(this.attribute("viewBox").value),h=g[0],i=g[1];b=g[2],d=g[3],c.AspectRatio(a,this.attribute("preserveAspectRatio").value,c.ViewPort.width(),b,c.ViewPort.height(),d,h,i,this.attribute("refX").value,this.attribute("refY").value),c.ViewPort.RemoveCurrent(),c.ViewPort.SetCurrent(g[2],g[3])}}},c.Element.svg.prototype=new c.Element.RenderedElementBase,c.Element.rect=function(a){this.base=c.Element.PathElementBase,this.base(a),this.path=function(a){var b=this.attribute("x").toPixels("x"),d=this.attribute("y").toPixels("y"),e=this.attribute("width").toPixels("x"),f=this.attribute("height").toPixels("y"),g=this.attribute("rx").toPixels("x"),h=this.attribute("ry").toPixels("y");return this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(h=g),this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(g=h),g=Math.min(g,e/2),h=Math.min(h,f/2),null!=a&&(a.beginPath(),a.moveTo(b+g,d),a.lineTo(b+e-g,d),a.quadraticCurveTo(b+e,d,b+e,d+h),a.lineTo(b+e,d+f-h),a.quadraticCurveTo(b+e,d+f,b+e-g,d+f),a.lineTo(b+g,d+f),a.quadraticCurveTo(b,d+f,b,d+f-h),a.lineTo(b,d+h),a.quadraticCurveTo(b,d,b+g,d),a.closePath()),new c.BoundingBox(b,d,b+e,d+f)}},c.Element.rect.prototype=new c.Element.PathElementBase,c.Element.circle=function(a){this.base=c.Element.PathElementBase,this.base(a),this.path=function(a){var b=this.attribute("cx").toPixels("x"),d=this.attribute("cy").toPixels("y"),e=this.attribute("r").toPixels();return null!=a&&(a.beginPath(),a.arc(b,d,e,0,2*Math.PI,!0),a.closePath()),new c.BoundingBox(b-e,d-e,b+e,d+e)}},c.Element.circle.prototype=new c.Element.PathElementBase,c.Element.ellipse=function(a){this.base=c.Element.PathElementBase,this.base(a),this.path=function(a){var b=4*((Math.sqrt(2)-1)/3),d=this.attribute("rx").toPixels("x"),e=this.attribute("ry").toPixels("y"),f=this.attribute("cx").toPixels("x"),g=this.attribute("cy").toPixels("y");return null!=a&&(a.beginPath(),a.moveTo(f,g-e),a.bezierCurveTo(f+b*d,g-e,f+d,g-b*e,f+d,g),a.bezierCurveTo(f+d,g+b*e,f+b*d,g+e,f,g+e),a.bezierCurveTo(f-b*d,g+e,f-d,g+b*e,f-d,g),a.bezierCurveTo(f-d,g-b*e,f-b*d,g-e,f,g-e),a.closePath()),new c.BoundingBox(f-d,g-e,f+d,g+e)}},c.Element.ellipse.prototype=new c.Element.PathElementBase,c.Element.line=function(a){this.base=c.Element.PathElementBase,this.base(a),this.getPoints=function(){return[new c.Point(this.attribute("x1").toPixels("x"),this.attribute("y1").toPixels("y")),new c.Point(this.attribute("x2").toPixels("x"),this.attribute("y2").toPixels("y"))]},this.path=function(a){var b=this.getPoints();return null!=a&&(a.beginPath(),a.moveTo(b[0].x,b[0].y),a.lineTo(b[1].x,b[1].y)),new c.BoundingBox(b[0].x,b[0].y,b[1].x,b[1].y)},this.getMarkers=function(){var a=this.getPoints(),b=a[0].angleTo(a[1]);return[[a[0],b],[a[1],b]]}},c.Element.line.prototype=new c.Element.PathElementBase,c.Element.polyline=function(a){this.base=c.Element.PathElementBase,this.base(a),this.points=c.CreatePath(this.attribute("points").value),this.path=function(a){var b=new c.BoundingBox(this.points[0].x,this.points[0].y);null!=a&&(a.beginPath(),a.moveTo(this.points[0].x,this.points[0].y));for(var d=1;d<this.points.length;d++)b.addPoint(this.points[d].x,this.points[d].y),null!=a&&a.lineTo(this.points[d].x,this.points[d].y);return b},this.getMarkers=function(){for(var a=[],b=0;b<this.points.length-1;b++)a.push([this.points[b],this.points[b].angleTo(this.points[b+1])]);return a.push([this.points[this.points.length-1],a[a.length-1][1]]),a}},c.Element.polyline.prototype=new c.Element.PathElementBase,c.Element.polygon=function(a){this.base=c.Element.polyline,this.base(a),this.basePath=this.path,this.path=function(a){var b=this.basePath(a);return null!=a&&(a.lineTo(this.points[0].x,this.points[0].y),a.closePath()),b}},c.Element.polygon.prototype=new c.Element.polyline,c.Element.path=function(a){this.base=c.Element.PathElementBase,this.base(a);var b=this.attribute("d").value;b=b.replace(/,/gm," "),b=b.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),b=b.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),b=b.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2"),b=b.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2"),b=b.replace(/([0-9])([+\-])/gm,"$1 $2"),b=b.replace(/(\.[0-9]*)(\.)/gm,"$1 $2"),b=b.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 "),b=c.compressSpaces(b),b=c.trim(b),this.PathParser=new function(a){this.tokens=a.split(" "),this.reset=function(){this.i=-1,this.command="",this.previousCommand="",this.start=new c.Point(0,0),this.control=new c.Point(0,0),this.current=new c.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 a=new c.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(a)},this.getAsControlPoint=function(){var a=this.getPoint();return this.control=a,a},this.getAsCurrentPoint=function(){var a=this.getPoint();return this.current=a,a},this.getReflectedControlPoint=function(){if("c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase())return this.current;var a=new c.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y);return a},this.makeAbsolute=function(a){return this.isRelativeCommand()&&(a.x+=this.current.x,a.y+=this.current.y),a},this.addMarker=function(a,b,c){null!=c&&this.angles.length>0&&null==this.angles[this.angles.length-1]&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(c)),this.addMarkerAngle(a,null==b?null:b.angleTo(a))},this.addMarkerAngle=function(a,b){this.points.push(a),this.angles.push(b)},this.getMarkerPoints=function(){return this.points},this.getMarkerAngles=function(){for(var a=0;a<this.angles.length;a++)if(null==this.angles[a])for(var b=a+1;b<this.angles.length;b++)if(null!=this.angles[b]){this.angles[a]=this.angles[b];break}return this.angles}}(b),this.path=function(a){var b=this.PathParser;b.reset();var d=new c.BoundingBox;for(null!=a&&a.beginPath();!b.isEnd();)switch(b.nextCommand(),b.command){case"M":case"m":var e=b.getAsCurrentPoint();for(b.addMarker(e),d.addPoint(e.x,e.y),null!=a&&a.moveTo(e.x,e.y),b.start=b.current;!b.isCommandOrEnd();){var e=b.getAsCurrentPoint();b.addMarker(e,b.start),d.addPoint(e.x,e.y),null!=a&&a.lineTo(e.x,e.y)}break;case"L":case"l":for(;!b.isCommandOrEnd();){var f=b.current,e=b.getAsCurrentPoint();b.addMarker(e,f),d.addPoint(e.x,e.y),null!=a&&a.lineTo(e.x,e.y)}break;case"H":case"h":for(;!b.isCommandOrEnd();){var g=new c.Point((b.isRelativeCommand()?b.current.x:0)+b.getScalar(),b.current.y);b.addMarker(g,b.current),b.current=g,d.addPoint(b.current.x,b.current.y),null!=a&&a.lineTo(b.current.x,b.current.y)}break;case"V":case"v":for(;!b.isCommandOrEnd();){var g=new c.Point(b.current.x,(b.isRelativeCommand()?b.current.y:0)+b.getScalar());b.addMarker(g,b.current),b.current=g,d.addPoint(b.current.x,b.current.y),null!=a&&a.lineTo(b.current.x,b.current.y)}break;case"C":case"c":for(;!b.isCommandOrEnd();){var h=b.current,i=b.getPoint(),j=b.getAsControlPoint(),k=b.getAsCurrentPoint();b.addMarker(k,j,i),d.addBezierCurve(h.x,h.y,i.x,i.y,j.x,j.y,k.x,k.y),null!=a&&a.bezierCurveTo(i.x,i.y,j.x,j.y,k.x,k.y)}break;case"S":case"s":for(;!b.isCommandOrEnd();){var h=b.current,i=b.getReflectedControlPoint(),j=b.getAsControlPoint(),k=b.getAsCurrentPoint();b.addMarker(k,j,i),d.addBezierCurve(h.x,h.y,i.x,i.y,j.x,j.y,k.x,k.y),null!=a&&a.bezierCurveTo(i.x,i.y,j.x,j.y,k.x,k.y)}break;case"Q":case"q":for(;!b.isCommandOrEnd();){var h=b.current,j=b.getAsControlPoint(),k=b.getAsCurrentPoint();b.addMarker(k,j,j),d.addQuadraticCurve(h.x,h.y,j.x,j.y,k.x,k.y),null!=a&&a.quadraticCurveTo(j.x,j.y,k.x,k.y)}break;case"T":case"t":for(;!b.isCommandOrEnd();){var h=b.current,j=b.getReflectedControlPoint();b.control=j;var k=b.getAsCurrentPoint();b.addMarker(k,j,j),d.addQuadraticCurve(h.x,h.y,j.x,j.y,k.x,k.y),null!=a&&a.quadraticCurveTo(j.x,j.y,k.x,k.y)}break;case"A":case"a":for(;!b.isCommandOrEnd();){var h=b.current,l=b.getScalar(),m=b.getScalar(),n=b.getScalar()*(Math.PI/180),o=b.getScalar(),p=b.getScalar(),k=b.getAsCurrentPoint(),q=new c.Point(Math.cos(n)*(h.x-k.x)/2+Math.sin(n)*(h.y-k.y)/2,-Math.sin(n)*(h.x-k.x)/2+Math.cos(n)*(h.y-k.y)/2),r=Math.pow(q.x,2)/Math.pow(l,2)+Math.pow(q.y,2)/Math.pow(m,2);r>1&&(l*=Math.sqrt(r),m*=Math.sqrt(r));var s=(o==p?-1:1)*Math.sqrt((Math.pow(l,2)*Math.pow(m,2)-Math.pow(l,2)*Math.pow(q.y,2)-Math.pow(m,2)*Math.pow(q.x,2))/(Math.pow(l,2)*Math.pow(q.y,2)+Math.pow(m,2)*Math.pow(q.x,2)));isNaN(s)&&(s=0);var t=new c.Point(s*l*q.y/m,s*-m*q.x/l),u=new c.Point((h.x+k.x)/2+Math.cos(n)*t.x-Math.sin(n)*t.y,(h.y+k.y)/2+Math.sin(n)*t.x+Math.cos(n)*t.y),v=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2))},w=function(a,b){return(a[0]*b[0]+a[1]*b[1])/(v(a)*v(b))},x=function(a,b){return(a[0]*b[1]<a[1]*b[0]?-1:1)*Math.acos(w(a,b))},y=x([1,0],[(q.x-t.x)/l,(q.y-t.y)/m]),z=[(q.x-t.x)/l,(q.y-t.y)/m],A=[(-q.x-t.x)/l,(-q.y-t.y)/m],B=x(z,A);w(z,A)<=-1&&(B=Math.PI),w(z,A)>=1&&(B=0);var C=1-p?1:-1,D=y+C*(B/2),E=new c.Point(u.x+l*Math.cos(D),u.y+m*Math.sin(D));if(b.addMarkerAngle(E,D-C*Math.PI/2),b.addMarkerAngle(k,D-C*Math.PI),d.addPoint(k.x,k.y),null!=a){var w=l>m?l:m,F=l>m?1:l/m,G=l>m?m/l:1;a.translate(u.x,u.y),a.rotate(n),a.scale(F,G),a.arc(0,0,w,y,y+B,1-p),a.scale(1/F,1/G),a.rotate(-n),a.translate(-u.x,-u.y)}}break;case"Z":case"z":null!=a&&a.closePath(),b.current=b.start}return d},this.getMarkers=function(){for(var a=this.PathParser.getMarkerPoints(),b=this.PathParser.getMarkerAngles(),c=[],d=0;d<a.length;d++)c.push([a[d],b[d]]);return c}},c.Element.path.prototype=new c.Element.PathElementBase,c.Element.pattern=function(a){this.base=c.Element.ElementBase,this.base(a),this.createPattern=function(a){var b=this.attribute("width").toPixels("x",!0),d=this.attribute("height").toPixels("y",!0),e=new c.Element.svg;e.attributes.viewBox=new c.Property("viewBox",this.attribute("viewBox").value),e.attributes.width=new c.Property("width",b+"px"),e.attributes.height=new c.Property("height",d+"px"),e.attributes.transform=new c.Property("transform",this.attribute("patternTransform").value),e.children=this.children;var f=document.createElement("canvas");f.width=b,f.height=d;var g=f.getContext("2d");this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&g.translate(this.attribute("x").toPixels("x",!0),this.attribute("y").toPixels("y",!0));for(var h=-1;1>=h;h++)for(var i=-1;1>=i;i++)g.save(),g.translate(h*f.width,i*f.height),e.render(g),g.restore();var j=a.createPattern(f,"repeat");return j}},c.Element.pattern.prototype=new c.Element.ElementBase,c.Element.marker=function(a){this.base=c.Element.ElementBase,this.base(a),this.baseRender=this.render,this.render=function(a,b,d){a.translate(b.x,b.y),"auto"==this.attribute("orient").valueOrDefault("auto")&&a.rotate(d),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&a.scale(a.lineWidth,a.lineWidth),a.save();var e=new c.Element.svg;e.attributes.viewBox=new c.Property("viewBox",this.attribute("viewBox").value),e.attributes.refX=new c.Property("refX",this.attribute("refX").value),e.attributes.refY=new c.Property("refY",this.attribute("refY").value),e.attributes.width=new c.Property("width",this.attribute("markerWidth").value),e.attributes.height=new c.Property("height",this.attribute("markerHeight").value),e.attributes.fill=new c.Property("fill",this.attribute("fill").valueOrDefault("black")),e.attributes.stroke=new c.Property("stroke",this.attribute("stroke").valueOrDefault("none")),e.children=this.children,e.render(a),a.restore(),"strokeWidth"==this.attribute("markerUnits").valueOrDefault("strokeWidth")&&a.scale(1/a.lineWidth,1/a.lineWidth),"auto"==this.attribute("orient").valueOrDefault("auto")&&a.rotate(-d),a.translate(-b.x,-b.y)}},c.Element.marker.prototype=new c.Element.ElementBase,c.Element.defs=function(a){this.base=c.Element.ElementBase,this.base(a),this.render=function(){}},c.Element.defs.prototype=new c.Element.ElementBase,c.Element.GradientBase=function(a){this.base=c.Element.ElementBase,this.base(a),this.gradientUnits=this.attribute("gradientUnits").valueOrDefault("objectBoundingBox"),this.stops=[];for(var b=0;b<this.children.length;b++){var d=this.children[b];"stop"==d.type&&this.stops.push(d)}this.getGradient=function(){},this.createGradient=function(a,b,d){var e=this;this.getHrefAttribute().hasValue()&&(e=this.getHrefAttribute().getDefinition());var f=function(a){if(d.hasValue()){var b=new c.Property("color",a);return b.addOpacity(d.value).value}return a},g=this.getGradient(a,b);if(null==g)return f(e.stops[e.stops.length-1].color);for(var h=0;h<e.stops.length;h++)g.addColorStop(e.stops[h].offset,f(e.stops[h].color));if(this.attribute("gradientTransform").hasValue()){var i=c.ViewPort.viewPorts[0],j=new c.Element.rect;j.attributes.x=new c.Property("x",-c.MAX_VIRTUAL_PIXELS/3),j.attributes.y=new c.Property("y",-c.MAX_VIRTUAL_PIXELS/3),j.attributes.width=new c.Property("width",c.MAX_VIRTUAL_PIXELS),j.attributes.height=new c.Property("height",c.MAX_VIRTUAL_PIXELS);var k=new c.Element.g;k.attributes.transform=new c.Property("transform",this.attribute("gradientTransform").value),k.children=[j];var l=new c.Element.svg;l.attributes.x=new c.Property("x",0),l.attributes.y=new c.Property("y",0),l.attributes.width=new c.Property("width",i.width),l.attributes.height=new c.Property("height",i.height),l.children=[k];var m=document.createElement("canvas");m.width=i.width,m.height=i.height;var n=m.getContext("2d");return n.fillStyle=g,l.render(n),n.createPattern(m,"no-repeat")}return g}},c.Element.GradientBase.prototype=new c.Element.ElementBase,c.Element.linearGradient=function(a){this.base=c.Element.GradientBase,this.base(a),this.getGradient=function(a,b){var c=b.getBoundingBox();this.attribute("x1").hasValue()||this.attribute("y1").hasValue()||this.attribute("x2").hasValue()||this.attribute("y2").hasValue()||(this.attribute("x1",!0).value=0,this.attribute("y1",!0).value=0,this.attribute("x2",!0).value=1,this.attribute("y2",!0).value=0);var d="objectBoundingBox"==this.gradientUnits?c.x()+c.width()*this.attribute("x1").numValue():this.attribute("x1").toPixels("x"),e="objectBoundingBox"==this.gradientUnits?c.y()+c.height()*this.attribute("y1").numValue():this.attribute("y1").toPixels("y"),f="objectBoundingBox"==this.gradientUnits?c.x()+c.width()*this.attribute("x2").numValue():this.attribute("x2").toPixels("x"),g="objectBoundingBox"==this.gradientUnits?c.y()+c.height()*this.attribute("y2").numValue():this.attribute("y2").toPixels("y");return d==f&&e==g?null:a.createLinearGradient(d,e,f,g)}},c.Element.linearGradient.prototype=new c.Element.GradientBase,c.Element.radialGradient=function(a){this.base=c.Element.GradientBase,this.base(a),this.getGradient=function(a,b){var c=b.getBoundingBox();this.attribute("cx").hasValue()||(this.attribute("cx",!0).value="50%"),this.attribute("cy").hasValue()||(this.attribute("cy",!0).value="50%"),this.attribute("r").hasValue()||(this.attribute("r",!0).value="50%");var d="objectBoundingBox"==this.gradientUnits?c.x()+c.width()*this.attribute("cx").numValue():this.attribute("cx").toPixels("x"),e="objectBoundingBox"==this.gradientUnits?c.y()+c.height()*this.attribute("cy").numValue():this.attribute("cy").toPixels("y"),f=d,g=e;this.attribute("fx").hasValue()&&(f="objectBoundingBox"==this.gradientUnits?c.x()+c.width()*this.attribute("fx").numValue():this.attribute("fx").toPixels("x")),this.attribute("fy").hasValue()&&(g="objectBoundingBox"==this.gradientUnits?c.y()+c.height()*this.attribute("fy").numValue():this.attribute("fy").toPixels("y"));var h="objectBoundingBox"==this.gradientUnits?(c.width()+c.height())/2*this.attribute("r").numValue():this.attribute("r").toPixels();return a.createRadialGradient(f,g,0,d,e,h)}},c.Element.radialGradient.prototype=new c.Element.GradientBase,c.Element.stop=function(a){this.base=c.Element.ElementBase,this.base(a),this.offset=this.attribute("offset").numValue(),this.offset<0&&(this.offset=0),this.offset>1&&(this.offset=1);var b=this.style("stop-color");this.style("stop-opacity").hasValue()&&(b=b.addOpacity(this.style("stop-opacity").value)),this.color=b.value},c.Element.stop.prototype=new c.Element.ElementBase,c.Element.AnimateBase=function(a){this.base=c.Element.ElementBase,this.base(a),c.Animations.push(this),this.duration=0,this.begin=this.attribute("begin").toMilliseconds(),this.maxDuration=this.begin+this.attribute("dur").toMilliseconds(),this.getProperty=function(){var a=this.attribute("attributeType").value,b=this.attribute("attributeName").value;return"CSS"==a?this.parent.style(b,!0):this.parent.attribute(b,!0)},this.initialValue=null,this.initialUnits="",this.removed=!1,this.calcValue=function(){return""},this.update=function(a){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)return"remove"!=this.attribute("fill").valueOrDefault("remove")||this.removed?!1:(this.removed=!0,this.getProperty().value=this.initialValue,!0);this.duration=0}this.duration=this.duration+a;var b=!1;if(this.begin<this.duration){var c=this.calcValue();if(this.attribute("type").hasValue()){var d=this.attribute("type").value;c=d+"("+c+")"}this.getProperty().value=c,b=!0}return b},this.from=this.attribute("from"),this.to=this.attribute("to"),this.values=this.attribute("values"),this.values.hasValue()&&(this.values.value=this.values.value.split(";")),this.progress=function(){var a={progress:(this.duration-this.begin)/(this.maxDuration-this.begin)};if(this.values.hasValue()){var b=a.progress*(this.values.value.length-1),d=Math.floor(b),e=Math.ceil(b);a.from=new c.Property("from",parseFloat(this.values.value[d])),a.to=new c.Property("to",parseFloat(this.values.value[e])),a.progress=(b-d)/(e-d)}else a.from=this.from,a.to=this.to;return a}},c.Element.AnimateBase.prototype=new c.Element.ElementBase,c.Element.animate=function(a){this.base=c.Element.AnimateBase,this.base(a),this.calcValue=function(){var a=this.progress(),b=a.from.numValue()+(a.to.numValue()-a.from.numValue())*a.progress;return b+this.initialUnits}},c.Element.animate.prototype=new c.Element.AnimateBase,c.Element.animateColor=function(b){this.base=c.Element.AnimateBase,this.base(b),this.calcValue=function(){var b=this.progress(),c=new a(b.from.value),d=new a(b.to.value);if(c.ok&&d.ok){var e=c.r+(d.r-c.r)*b.progress,f=c.g+(d.g-c.g)*b.progress,g=c.b+(d.b-c.b)*b.progress;return"rgb("+parseInt(e,10)+","+parseInt(f,10)+","+parseInt(g,10)+")"}return this.attribute("from").value}},c.Element.animateColor.prototype=new c.Element.AnimateBase,c.Element.animateTransform=function(a){this.base=c.Element.AnimateBase,this.base(a),this.calcValue=function(){for(var a=this.progress(),b=c.ToNumberArray(a.from.value),d=c.ToNumberArray(a.to.value),e="",f=0;f<b.length;f++)e+=b[f]+(d[f]-b[f])*a.progress+" ";return e}},c.Element.animateTransform.prototype=new c.Element.animate,c.Element.font=function(a){this.base=c.Element.ElementBase,this.base(a),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.isRTL=!1,this.isArabic=!1,this.fontFace=null,this.missingGlyph=null,this.glyphs=[];for(var b=0;b<this.children.length;b++){var d=this.children[b];"font-face"==d.type?(this.fontFace=d,d.style("font-family").hasValue()&&(c.Definitions[d.style("font-family").value]=this)):"missing-glyph"==d.type?this.missingGlyph=d:"glyph"==d.type&&(""!=d.arabicForm?(this.isRTL=!0,this.isArabic=!0,"undefined"==typeof this.glyphs[d.unicode]&&(this.glyphs[d.unicode]=[]),this.glyphs[d.unicode][d.arabicForm]=d):this.glyphs[d.unicode]=d)}},c.Element.font.prototype=new c.Element.ElementBase,c.Element.fontface=function(a){this.base=c.Element.ElementBase,this.base(a),this.ascent=this.attribute("ascent").value,this.descent=this.attribute("descent").value,this.unitsPerEm=this.attribute("units-per-em").numValue()},c.Element.fontface.prototype=new c.Element.ElementBase,c.Element.missingglyph=function(a){this.base=c.Element.path,this.base(a),this.horizAdvX=0},c.Element.missingglyph.prototype=new c.Element.path,c.Element.glyph=function(a){this.base=c.Element.path,this.base(a),this.horizAdvX=this.attribute("horiz-adv-x").numValue(),this.unicode=this.attribute("unicode").value,this.arabicForm=this.attribute("arabic-form").value},c.Element.glyph.prototype=new c.Element.path,c.Element.text=function(a){this.captureTextNodes=!0,this.base=c.Element.RenderedElementBase,this.base(a),this.baseSetContext=this.setContext,this.setContext=function(a){this.baseSetContext(a),this.style("dominant-baseline").hasValue()&&(a.textBaseline=this.style("dominant-baseline").value),this.style("alignment-baseline").hasValue()&&(a.textBaseline=this.style("alignment-baseline").value)},this.getBoundingBox=function(){return new c.BoundingBox(this.attribute("x").toPixels("x"),this.attribute("y").toPixels("y"),0,0)},this.renderChildren=function(a){this.x=this.attribute("x").toPixels("x"),this.y=this.attribute("y").toPixels("y"),this.x+=this.getAnchorDelta(a,this,0);for(var b=0;b<this.children.length;b++)this.renderChild(a,this,b)},this.getAnchorDelta=function(a,b,c){var d=this.style("text-anchor").valueOrDefault("start");if("start"!=d){for(var e=0,f=c;f<b.children.length;f++){var g=b.children[f];if(f>c&&g.attribute("x").hasValue())break;e+=g.measureTextRecursive(a)}return-1*("end"==d?e:e/2)}return 0},this.renderChild=function(a,b,c){var d=b.children[c];d.attribute("x").hasValue()?d.x=d.attribute("x").toPixels("x")+this.getAnchorDelta(a,b,c):(this.attribute("dx").hasValue()&&(this.x+=this.attribute("dx").toPixels("x")),d.attribute("dx").hasValue()&&(this.x+=d.attribute("dx").toPixels("x")),d.x=this.x),this.x=d.x+d.measureText(a),d.attribute("y").hasValue()?d.y=d.attribute("y").toPixels("y"):(this.attribute("dy").hasValue()&&(this.y+=this.attribute("dy").toPixels("y")),d.attribute("dy").hasValue()&&(this.y+=d.attribute("dy").toPixels("y")),d.y=this.y),this.y=d.y,d.render(a);for(var c=0;c<d.children.length;c++)this.renderChild(a,d,c)}},c.Element.text.prototype=new c.Element.RenderedElementBase,c.Element.TextElementBase=function(a){this.base=c.Element.RenderedElementBase,this.base(a),this.getGlyph=function(a,b,c){var d=b[c],e=null;if(a.isArabic){var f="isolated";(0==c||" "==b[c-1])&&c<b.length-2&&" "!=b[c+1]&&(f="terminal"),c>0&&" "!=b[c-1]&&c<b.length-2&&" "!=b[c+1]&&(f="medial"),c>0&&" "!=b[c-1]&&(c==b.length-1||" "==b[c+1])&&(f="initial"),"undefined"!=typeof a.glyphs[d]&&(e=a.glyphs[d][f],null==e&&"glyph"==a.glyphs[d].type&&(e=a.glyphs[d]))}else e=a.glyphs[d];return null==e&&(e=a.missingGlyph),e},this.renderChildren=function(a){var b=this.parent.style("font-family").getDefinition();if(null==b)""!=a.fillStyle&&a.fillText(c.compressSpaces(this.getText()),this.x,this.y),""!=a.strokeStyle&&a.strokeText(c.compressSpaces(this.getText()),this.x,this.y);else{var d=this.parent.style("font-size").numValueOrDefault(c.Font.Parse(c.ctx.font).fontSize),e=this.parent.style("font-style").valueOrDefault(c.Font.Parse(c.ctx.font).fontStyle),f=this.getText();b.isRTL&&(f=f.split("").reverse().join(""));for(var g=c.ToNumberArray(this.parent.attribute("dx").value),h=0;h<f.length;h++){var i=this.getGlyph(b,f,h),j=d/b.fontFace.unitsPerEm;a.translate(this.x,this.y),a.scale(j,-j);var k=a.lineWidth;a.lineWidth=a.lineWidth*b.fontFace.unitsPerEm/d,"italic"==e&&a.transform(1,0,.4,1,0,0),i.render(a),"italic"==e&&a.transform(1,0,-.4,1,0,0),a.lineWidth=k,a.scale(1/j,-1/j),a.translate(-this.x,-this.y),this.x+=d*(i.horizAdvX||b.horizAdvX)/b.fontFace.unitsPerEm,"undefined"==typeof g[h]||isNaN(g[h])||(this.x+=g[h])}}},this.getText=function(){},this.measureTextRecursive=function(a){for(var b=this.measureText(a),c=0;c<this.children.length;c++)b+=this.children[c].measureTextRecursive(a);return b},this.measureText=function(a){var b=this.parent.style("font-family").getDefinition();if(null!=b){var d=this.parent.style("font-size").numValueOrDefault(c.Font.Parse(c.ctx.font).fontSize),e=0,f=this.getText();b.isRTL&&(f=f.split("").reverse().join(""));for(var g=c.ToNumberArray(this.parent.attribute("dx").value),h=0;h<f.length;h++){var i=this.getGlyph(b,f,h);e+=(i.horizAdvX||b.horizAdvX)*d/b.fontFace.unitsPerEm,"undefined"==typeof g[h]||isNaN(g[h])||(e+=g[h])}return e}var j=c.compressSpaces(this.getText());if(!a.measureText)return 10*j.length;a.save(),this.setContext(a);var k=a.measureText(j).width;return a.restore(),k}},c.Element.TextElementBase.prototype=new c.Element.RenderedElementBase,c.Element.tspan=function(a){this.captureTextNodes=!0,this.base=c.Element.TextElementBase,this.base(a),this.text=a.nodeValue||a.text||"",this.getText=function(){return this.text}},c.Element.tspan.prototype=new c.Element.TextElementBase,c.Element.tref=function(a){this.base=c.Element.TextElementBase,this.base(a),this.getText=function(){var a=this.getHrefAttribute().getDefinition();return null!=a?a.children[0].getText():void 0}},c.Element.tref.prototype=new c.Element.TextElementBase,c.Element.a=function(a){this.base=c.Element.TextElementBase,this.base(a),this.hasText=!0;for(var b=0;b<a.childNodes.length;b++)3!=a.childNodes[b].nodeType&&(this.hasText=!1);this.text=this.hasText?a.childNodes[0].nodeValue:"",this.getText=function(){return this.text},this.baseRenderChildren=this.renderChildren,this.renderChildren=function(a){if(this.hasText){this.baseRenderChildren(a);var b=new c.Property("fontSize",c.Font.Parse(c.ctx.font).fontSize);c.Mouse.checkBoundingBox(this,new c.BoundingBox(this.x,this.y-b.toPixels("y"),this.x+this.measureText(a),this.y))}else{var d=new c.Element.g;d.children=this.children,d.parent=this,d.render(a)}},this.onclick=function(){window.open(this.getHrefAttribute().value)},this.onmousemove=function(){c.ctx.canvas.style.cursor="pointer"}},c.Element.a.prototype=new c.Element.TextElementBase,c.Element.image=function(a){this.base=c.Element.RenderedElementBase,this.base(a);var b=this.getHrefAttribute().value,d=b.match(/\.svg$/);if(c.Images.push(this),this.loaded=!1,d)this.img=c.ajax(b),this.loaded=!0;else{this.img=document.createElement("img");var e=this;this.img.onload=function(){e.loaded=!0},this.img.onerror=function(){"undefined"!=typeof console&&(console.log('ERROR: image "'+b+'" not found'),e.loaded=!0)},this.img.src=b}this.renderChildren=function(a){var b=this.attribute("x").toPixels("x"),e=this.attribute("y").toPixels("y"),f=this.attribute("width").toPixels("x"),g=this.attribute("height").toPixels("y");0!=f&&0!=g&&(a.save(),d?a.drawSvg(this.img,b,e,f,g):(a.translate(b,e),c.AspectRatio(a,this.attribute("preserveAspectRatio").value,f,this.img.width,g,this.img.height,0,0),a.drawImage(this.img,0,0)),a.restore())},this.getBoundingBox=function(){var a=this.attribute("x").toPixels("x"),b=this.attribute("y").toPixels("y"),d=this.attribute("width").toPixels("x"),e=this.attribute("height").toPixels("y");return new c.BoundingBox(a,b,a+d,b+e)}},c.Element.image.prototype=new c.Element.RenderedElementBase,c.Element.g=function(a){this.base=c.Element.RenderedElementBase,this.base(a),this.getBoundingBox=function(){for(var a=new c.BoundingBox,b=0;b<this.children.length;b++)a.addBoundingBox(this.children[b].getBoundingBox());return a}},c.Element.g.prototype=new c.Element.RenderedElementBase,c.Element.symbol=function(a){this.base=c.Element.RenderedElementBase,this.base(a),this.baseSetContext=this.setContext,this.setContext=function(a){if(this.baseSetContext(a),this.attribute("viewBox").hasValue()){var b=c.ToNumberArray(this.attribute("viewBox").value),d=b[0],e=b[1];width=b[2],height=b[3],c.AspectRatio(a,this.attribute("preserveAspectRatio").value,this.attribute("width").toPixels("x"),width,this.attribute("height").toPixels("y"),height,d,e),c.ViewPort.SetCurrent(b[2],b[3])}}},c.Element.symbol.prototype=new c.Element.RenderedElementBase,c.Element.style=function(a){this.base=c.Element.ElementBase,this.base(a);for(var b="",d=0;d<a.childNodes.length;d++)b+=a.childNodes[d].nodeValue;b=b.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,""),b=c.compressSpaces(b);for(var e=b.split("}"),d=0;d<e.length;d++)if(""!=c.trim(e[d]))for(var f=e[d].split("{"),g=f[0].split(","),h=f[1].split(";"),i=0;i<g.length;i++){var j=c.trim(g[i]);if(""!=j){for(var k={},l=0;l<h.length;l++){var m=h[l].indexOf(":"),n=h[l].substr(0,m),o=h[l].substr(m+1,h[l].length-m);null!=n&&null!=o&&(k[c.trim(n)]=new c.Property(c.trim(n),c.trim(o)))}if(c.Styles[j]=k,"@font-face"==j)for(var p=k["font-family"].value.replace(/"/g,""),q=k.src.value.split(","),r=0;r<q.length;r++)if(q[r].indexOf('format("svg")')>0)for(var s=q[r].indexOf("url"),t=q[r].indexOf(")",s),u=q[r].substr(s+5,t-s-6),v=c.parseXml(c.ajax(u)),w=v.getElementsByTagName("font"),x=0;x<w.length;x++){var y=c.CreateElement(w[x]);c.Definitions[p]=y}}}},c.Element.style.prototype=new c.Element.ElementBase,c.Element.use=function(a){this.base=c.Element.RenderedElementBase,this.base(a),this.baseSetContext=this.setContext,this.setContext=function(a){this.baseSetContext(a),this.attribute("x").hasValue()&&a.translate(this.attribute("x").toPixels("x"),0),this.attribute("y").hasValue()&&a.translate(0,this.attribute("y").toPixels("y"))},this.getDefinition=function(){var a=this.getHrefAttribute().getDefinition();return this.attribute("width").hasValue()&&(a.attribute("width",!0).value=this.attribute("width").value),this.attribute("height").hasValue()&&(a.attribute("height",!0).value=this.attribute("height").value),a},this.path=function(a){var b=this.getDefinition();null!=b&&b.path(a)},this.getBoundingBox=function(){var a=this.getDefinition();return null!=a?a.getBoundingBox():void 0},this.renderChildren=function(a){var b=this.getDefinition();if(null!=b){var c=b.parent;b.parent=null,b.render(a),b.parent=c}}},c.Element.use.prototype=new c.Element.RenderedElementBase,c.Element.mask=function(a){this.base=c.Element.ElementBase,this.base(a),this.apply=function(a,b){var d=this.attribute("x").toPixels("x"),e=this.attribute("y").toPixels("y"),f=this.attribute("width").toPixels("x"),g=this.attribute("height").toPixels("y");if(0==f&&0==g){for(var h=new c.BoundingBox,i=0;i<this.children.length;i++)h.addBoundingBox(this.children[i].getBoundingBox());var d=Math.floor(h.x1),e=Math.floor(h.y1),f=Math.floor(h.width()),g=Math.floor(h.height())}var j=b.attribute("mask").value;b.attribute("mask").value="";var k=document.createElement("canvas");k.width=d+f,k.height=e+g;var l=k.getContext("2d");this.renderChildren(l);var m=document.createElement("canvas");m.width=d+f,m.height=e+g;var n=m.getContext("2d");b.render(n),n.globalCompositeOperation="destination-in",n.fillStyle=l.createPattern(k,"no-repeat"),n.fillRect(0,0,d+f,e+g),a.fillStyle=n.createPattern(m,"no-repeat"),a.fillRect(0,0,d+f,e+g),b.attribute("mask").value=j},this.render=function(){}},c.Element.mask.prototype=new c.Element.ElementBase,c.Element.clipPath=function(a){this.base=c.Element.ElementBase,this.base(a),this.apply=function(a){for(var b=0;b<this.children.length;b++){var d=this.children[b];if("undefined"!=typeof d.path){var e=null;d.attribute("transform").hasValue()&&(e=new c.Transform(d.attribute("transform").value),e.apply(a)),d.path(a),a.clip(),e&&e.unapply(a)}}},this.render=function(){}},c.Element.clipPath.prototype=new c.Element.ElementBase,c.Element.filter=function(a){this.base=c.Element.ElementBase,this.base(a),this.apply=function(a,b){var c=b.getBoundingBox(),d=Math.floor(c.x1),e=Math.floor(c.y1),f=Math.floor(c.width()),g=Math.floor(c.height()),h=b.style("filter").value;b.style("filter").value="";for(var i=0,j=0,k=0;k<this.children.length;k++){var l=this.children[k].extraFilterDistance||0;i=Math.max(i,l),j=Math.max(j,l)}var m=document.createElement("canvas");m.width=f+2*i,m.height=g+2*j;var n=m.getContext("2d");n.translate(-d+i,-e+j),b.render(n);for(var k=0;k<this.children.length;k++)this.children[k].apply(n,0,0,f+2*i,g+2*j);a.drawImage(m,0,0,f+2*i,g+2*j,d-i,e-j,f+2*i,g+2*j),b.style("filter",!0).value=h},this.render=function(){}},c.Element.filter.prototype=new c.Element.ElementBase,c.Element.feMorphology=function(a){this.base=c.Element.ElementBase,this.base(a),this.apply=function(){}},c.Element.feMorphology.prototype=new c.Element.ElementBase,c.Element.feColorMatrix=function(a){function b(a,b,c,d,e,f){return a[c*d*4+4*b+f]}function d(a,b,c,d,e,f,g){a[c*d*4+4*b+f]=g}this.base=c.Element.ElementBase,this.base(a),this.apply=function(a,c,e,f,g){for(var h=a.getImageData(0,0,f,g),e=0;g>e;e++)for(var c=0;f>c;c++){var i=b(h.data,c,e,f,g,0),j=b(h.data,c,e,f,g,1),k=b(h.data,c,e,f,g,2),l=(i+j+k)/3;d(h.data,c,e,f,g,0,l),d(h.data,c,e,f,g,1,l),d(h.data,c,e,f,g,2,l)}a.clearRect(0,0,f,g),a.putImageData(h,0,0)}},c.Element.feColorMatrix.prototype=new c.Element.ElementBase,c.Element.feGaussianBlur=function(a){this.base=c.Element.ElementBase,this.base(a),this.blurRadius=Math.floor(this.attribute("stdDeviation").numValue()),this.extraFilterDistance=this.blurRadius,this.apply=function(a,d,e,f,g){return"undefined"==typeof b?void("undefined"!=typeof console&&console.log("ERROR: StackBlur.js must be included for blur to work")):(a.canvas.id=c.UniqueId(),a.canvas.style.display="none",document.body.appendChild(a.canvas),b(a.canvas.id,d,e,f,g,this.blurRadius),void document.body.removeChild(a.canvas))}},c.Element.feGaussianBlur.prototype=new c.Element.ElementBase,c.Element.title=function(){},c.Element.title.prototype=new c.Element.ElementBase,c.Element.desc=function(){},c.Element.desc.prototype=new c.Element.ElementBase,c.Element.MISSING=function(a){"undefined"!=typeof console&&console.log("ERROR: Element '"+a.nodeName+"' not yet implemented.")},c.Element.MISSING.prototype=new c.Element.ElementBase,c.CreateElement=function(a){var b=a.nodeName.replace(/^[^:]+:/,"");b=b.replace(/\-/g,"");var d=null;return d="undefined"!=typeof c.Element[b]?new c.Element[b](a):new c.Element.MISSING(a),d.type=a.nodeName,d},c.load=function(a,b){c.loadXml(a,c.ajax(b))},c.loadXml=function(a,b){c.loadXmlDoc(a,c.parseXml(b))},c.loadXmlDoc=function(a,b){c.init(a);var d=function(b){for(var c=a.canvas;c;)b.x-=c.offsetLeft,b.y-=c.offsetTop,c=c.offsetParent;return window.scrollX&&(b.x+=window.scrollX),window.scrollY&&(b.y+=window.scrollY),b};1!=c.opts.ignoreMouse&&(a.canvas.onclick=function(a){var b=d(new c.Point(null!=a?a.clientX:event.clientX,null!=a?a.clientY:event.clientY));c.Mouse.onclick(b.x,b.y)},a.canvas.onmousemove=function(a){var b=d(new c.Point(null!=a?a.clientX:event.clientX,null!=a?a.clientY:event.clientY));c.Mouse.onmousemove(b.x,b.y)});var e=c.CreateElement(b.documentElement);e.root=!0;var f=!0,g=function(){c.ViewPort.Clear(),a.canvas.parentNode&&c.ViewPort.SetCurrent(a.canvas.parentNode.clientWidth,a.canvas.parentNode.clientHeight),1!=c.opts.ignoreDimensions&&(e.style("width").hasValue()&&(a.canvas.width=e.style("width").toPixels("x"),a.canvas.style.width=a.canvas.width+"px"),e.style("height").hasValue()&&(a.canvas.height=e.style("height").toPixels("y"),a.canvas.style.height=a.canvas.height+"px"));var d=a.canvas.clientWidth||a.canvas.width,g=a.canvas.clientHeight||a.canvas.height;if(1==c.opts.ignoreDimensions&&e.style("width").hasValue()&&e.style("height").hasValue()&&(d=e.style("width").toPixels("x"),g=e.style("height").toPixels("y")),c.ViewPort.SetCurrent(d,g),null!=c.opts.offsetX&&(e.attribute("x",!0).value=c.opts.offsetX),null!=c.opts.offsetY&&(e.attribute("y",!0).value=c.opts.offsetY),null!=c.opts.scaleWidth&&null!=c.opts.scaleHeight){var h=1,i=1,j=c.ToNumberArray(e.attribute("viewBox").value);e.attribute("width").hasValue()?h=e.attribute("width").toPixels("x")/c.opts.scaleWidth:isNaN(j[2])||(h=j[2]/c.opts.scaleWidth),e.attribute("height").hasValue()?i=e.attribute("height").toPixels("y")/c.opts.scaleHeight:isNaN(j[3])||(i=j[3]/c.opts.scaleHeight),e.attribute("width",!0).value=c.opts.scaleWidth,e.attribute("height",!0).value=c.opts.scaleHeight,e.attribute("viewBox",!0).value="0 0 "+d*h+" "+g*i,e.attribute("preserveAspectRatio",!0).value="none"}1!=c.opts.ignoreClear&&a.clearRect(0,0,d,g),e.render(a),f&&(f=!1,"function"==typeof c.opts.renderCallback&&c.opts.renderCallback(b))},h=!0;c.ImagesLoaded()&&(h=!1,g()),c.intervalID=setInterval(function(){var a=!1;if(h&&c.ImagesLoaded()&&(h=!1,a=!0),1!=c.opts.ignoreMouse&&(a|=c.Mouse.hasEvents()),1!=c.opts.ignoreAnimation)for(var b=0;b<c.Animations.length;b++)a|=c.Animations[b].update(1e3/c.FRAMERATE);"function"==typeof c.opts.forceRedraw&&1==c.opts.forceRedraw()&&(a=!0),a&&(g(),c.Mouse.runEvents())
},1e3/c.FRAMERATE)},c.stop=function(){c.intervalID&&clearInterval(c.intervalID)},c.Mouse=new function(){this.events=[],this.hasEvents=function(){return 0!=this.events.length},this.onclick=function(a,b){this.events.push({type:"onclick",x:a,y:b,run:function(a){a.onclick&&a.onclick()}})},this.onmousemove=function(a,b){this.events.push({type:"onmousemove",x:a,y:b,run:function(a){a.onmousemove&&a.onmousemove()}})},this.eventElements=[],this.checkPath=function(a,b){for(var c=0;c<this.events.length;c++){var d=this.events[c];b.isPointInPath&&b.isPointInPath(d.x,d.y)&&(this.eventElements[c]=a)}},this.checkBoundingBox=function(a,b){for(var c=0;c<this.events.length;c++){var d=this.events[c];b.isPointInBox(d.x,d.y)&&(this.eventElements[c]=a)}},this.runEvents=function(){c.ctx.canvas.style.cursor="";for(var a=0;a<this.events.length;a++)for(var b=this.events[a],d=this.eventElements[a];d;)b.run(d),d=d.parent;this.events=[],this.eventElements=[]}},c}this.canvg=function(a,b,d){if(null!=a||null!=b||null!=d){d=d||{},"string"==typeof a&&(a=document.getElementById(a)),null!=a.svg&&a.svg.stop();var e=c();(1!=a.childNodes.length||"OBJECT"!=a.childNodes[0].nodeName)&&(a.svg=e),e.opts=d;var f=a.getContext("2d");"undefined"!=typeof b.documentElement?e.loadXmlDoc(f,b):"<"==b.substr(0,1)?e.loadXml(f,b):e.load(f,b)}else for(var g=document.getElementsByTagName("svg"),h=0;h<g.length;h++){var i=g[h],j=document.createElement("canvas");j.width=i.clientWidth,j.height=i.clientHeight,i.parentNode.insertBefore(j,i),i.parentNode.removeChild(i);var k=document.createElement("div");k.appendChild(i),canvg(j,k.innerHTML)}}}(),"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(a,b,c,d,e){canvg(this.canvas,a,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:b,offsetY:c,scaleWidth:d,scaleHeight:e})}),canvg}},b[1]={value:function(){function a(a,b,e){var f=a.container.getRenderBox();return c(a.node.ownerDocument,{width:f.width,height:f.height,content:d(a.node)},b,e)}function c(a,b,c,d){var e=arguments;f.apply(null,e)}function d(a){var b=a.ownerDocument.createElement("div"),c=['<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="',a.getAttribute("width"),'" height="',a.getAttribute("height"),'">'];return b.appendChild(a.cloneNode(!0)),b.innerHTML.replace(/<svg[^>]+?>/i,c.join("")).replace(/ /g,"")}function e(a,b,c,d){var e=a.createElement("canvas"),f=e.getContext("2d");return e.width=b,e.height=c,"image/png"!==d&&(f.fillStyle="white",f.fillRect(0,0,e.width,e.height)),e}function f(a,b,c,d){var f=e(a,b.width,b.height,c);f.style.cssText="position: absolute; top: 0; left: 100000px; z-index: -1;",window.setTimeout(function(){a.body.appendChild(f),h(f,b.content),a.body.removeChild(f),d(f.toDataURL(c))},0)}var g=b.r(43),h=b.r(0);return g.createClass("Output",{constructor:function(a){this.formula=a},toJPG:function(b){a(this.formula,"image/jpeg",b)},toPNG:function(b){a(this.formula,"image/png",b)}})}},b[2]={value:function(){return["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","ȷ","ı","α","β","γ","δ","ε","ζ","η","θ","ι","κ","λ","μ","ν","ξ","ο","π","ρ","ς","σ","τ","υ","φ","χ","ψ","ω","ϑ","ϕ","ϖ","Ϟ","Ϝ","ϵ","ϱ","Ϲ","ℜ","ℵ","ℑ","℧","ℶ","ℷ","ℸ","ð","ℏ","⅁","ℎ","∂","℘","⅌","Ⅎ","∁","ℓ","Ⓢ","(",")","Γ","Δ","Ε","Ζ","Η","Θ","Ι","Κ","Λ","Μ","Ν","Ξ","Ο","Π","Ρ","Σ","Τ","Υ","Φ","Χ","Ψ","Ω","Α","Β","#","!","$","%","&","∠","′","‵","★","◆","■","▲","▼","⊤","⊥","♣","♠","♢","♡","∃","∄","♭","♮","♯","∀","∞","∡","∇","¬","∢","√","△","▽","∅","ø","◇","◀","▸","[","]","{","}","〈","〉","ϰ",",",".","/",":",";","?","\\","⋮","⋯","⋰","…","@",""","'","|","^","`","“","_","*","+","-","∐","⊼","⊻","◯","⊡","⊟","⊞","⊠","•","∩","∪","⋒","⋓","⋐","⋑","·","▪","◦","⊛","⊚","⊖","⊙","⊝","⊕","⊗","⊘","±","∓","⋏","⋎","†","‡","⋄","÷","⋇","∔","⌭","⋗","⋖","⋉","⋊","⋋","⋌","⊓","⊔","⊑","⊒","⊏","⊐","⋆","×","⊳","⊲","⊵","⊴","⊎","∨","∧","≀","<","=",">","≈","≇","≍","≒","≓","≊","∽","≁","≂","≃","⋍","≏","≎","≗","≅","⋞","⋟","≐","≑","≖","⪖","⪕","≡","≥","≤","≦","≧","⩾","⩽","≫","≪","≨","≩","⋘","⋙","⪇","⪈","⪉","⪊","⋧","⋦","⪆","⪅","⋛","⋚","⪋","⪌","≷","≶","≳","≲","⌮","⌯","≯","≱","≰","≮","⌱","⌰","⌲","⌳","≬","⊀","⊁","⋠","⋡","≺","≻","≼","≽","≾","≿","⊂","⊃","⊈","⊉","⊆","⊇","⊊","⊋","⪷","⪸","⪯","⪰","⪹","⪺","⪵","⪶","⋨","⋩","∼","≜","↶","↷","↺","↻","↾","↿","⇂","⇃","⇄","⇆","⇈","⇊","⇋","⇌","⇍","⇎","⇏","⇐","⇑","⇒","⇓","⇔","⇕","⇚","⇛","⇝","↫","↬","↭","↮","←","↑","→","↓","↔","↕","↖","↗","↘","↙","↞","↠","↢","↣","↰","↱","⊢","⊣","⊨","⊩","⊪","⊭","⊯","⊸","⊺","⋔","⋪","⋫","⋬","⋭","⌈","⌉","⌊","⌋","⫋","⫌","⫅","⫆","∈","∋","∝","∤","∦","∴","∵","∍","⋈","⌢","⌣","∣","∥","⏐","⏑","⏒","⏓","⫇","⫈","⊮","⊬","⫉","⏔","⏕","⏖","⏗","⇇","⇉","↼","↽","⇀","⇁","↚","↛","⟵","⟶","⟷","⟹","⟸","⟺","≢","≠","∉"]}},b[3]={value:function(){return{defaultFont:"KF AMS MAIN"}}},b[4]={value:function(){function a(a){var b=new d.Text;return"innerHTML"in b.node?b.node.setAttributeNS(f,"xml:space","preserve"):-1!=a.indexOf(" ")&&(a=c(a)),b.setContent(a),b}function c(a){return e.innerHTML='<svg><text gg="asfdas">'+a.replace(/\s/gi," ")+"</text></svg>",e.firstChild.firstChild.textContent}var d=b.r(43),e=document.createElement("div"),f="http://www.w3.org/XML/1998/namespace";return{create:function(b){return a(b)}}}},b[5]={value:function(){var a=b.r(43),c=b.r(65).font,d=b.r(34),e=b.r(4);return a.createClass("Text",{base:b.r(64),constructor:function(b,c){this.callBase(),this.fontFamily=c,this.fontSize=50,this.content=b||"",this.box.remove(),this.translationContent=this.translation(this.content),this.contentShape=new a.Group,this.contentNode=this.createContent(),this.contentShape.addShape(this.contentNode),this.addShape(this.contentShape)},createContent:function(){var a=e.create(this.translationContent);return a.setAttr({"font-family":this.fontFamily,"font-size":50,x:0,y:c.offset}),a},setFamily:function(a){this.fontFamily=a,this.contentNode.setAttr("font-family",a)},setFontSize:function(a){this.fontSize=a,this.contentNode.setAttr("font-size",a+"px"),this.contentNode.setAttr("y",a/50*c.offset)},getBaseHeight:function(){for(var a=this.contentShape.getItems(),b=null,c=0,d=0;b=a[c];)d=Math.max(d,b.getHeight()),c++;return d},translation:function(a){var b=this.fontFamily;return a.replace(/``/g,"\u201c").replace(/\\([a-zA-Z,]+)\\/g,function(a,c){if(","===c)return" ";var e=d.getCharacterValue(c,b);return e?e:""})}})}},b[6]={value:function(){return{UNKNOWN:-1,EXP:0,COMPOUND_EXP:1,OP:2}}},b[7]={value:function(){return{SIDE:"side",FOLLOW:"follow"}}},b[8]={value:function(){var a=b.r(43),c=b.r(44),d=a.createClass("ArrayExpression",{base:b.r(28),constructor:function(){var a=arguments;this.callBase(),this.colNum=0,this.setFlag("Array"),this.setOperator(new c);for(var b=0,d=a.length;d>b;b++)this.setOperand(a[b],b)},setColNum:function(a){return this.colNum=a,this},getColNum:function(){return this.colNum}});return d}},b[9]={value:function(){var a=b.r(43);return a.createClass("SubscriptExpression",{base:b.r(23),constructor:function(a,b){this.callBase(a,null,b),this.setFlag("Subscript")}})}},b[10]={value:function(){var a=b.r(43);return a.createClass("SuperscriptExpression",{base:b.r(23),constructor:function(a,b){this.callBase(a,b,null),this.setFlag("Superscript")}})}},b[11]={value:function(){var a=b.r(43);return a.createClass("BinaryExpression",{base:b.r(28),constructor:function(a,b){this.callBase(),this.setFirstOperand(a),this.setLastOperand(b)},setFirstOperand:function(a){return this.setOperand(a,0)},getFirstOperand:function(){return this.getOperand(0)},setLastOperand:function(a){return this.setOperand(a,1)},getLastOperand:function(){return this.getOperand(1)}})}},b[12]={value:function(){var a=b.r(43),c=b.r(45);return a.createClass("BracketsExpression",{base:b.r(28),constructor:function(a,b,d){this.callBase(),this.setFlag("Brackets"),2===arguments.length&&(d=b,b=a),this.leftSymbol=a,this.rightSymbol=b,this.setOperator(new c),this.setOperand(d,0)},getLeftSymbol:function(){return this.leftSymbol},getRightSymbol:function(){return this.rightSymbol}})}},b[13]={value:function(){var a=b.r(43),c=b.r(46);return a.createClass("CasesExpression",{base:b.r(28),constructor:function(){var a=arguments;this.callBase(),this.setFlag("Cases"),this.setOperator(new c);for(var b=0,d=a.length;d>b;b++)this.setOperand(a[b],b)}})}},b[14]={value:function(){var a=b.r(43),c=b.r(65).font,d=b.r(47);return a.createClass("CombinationExpression",{base:b.r(28),constructor:function(){this.callBase(),this.setFlag("Combination"),this.setOperator(new d),a.Utils.each(arguments,function(a,b){this.setOperand(a,b)},this)},getRenderBox:function(a){var b=this.callBase(a);return 0===this.getOperands().length&&(b.height=c.spaceHeight),b},getBaseline:function(b){var c=0,d=this.getOperands();return 0===d.length?this.callBase(b):(a.Utils.each(d,function(a){c=Math.max(a.getBaseline(b),c)}),c)},getMeanline:function(b){var c=1e7,d=this.getOperands();return 0===d.length?this.callBase(b):(a.Utils.each(d,function(a){c=Math.min(a.getMeanline(b),c)}),c)}})}},b[15]={value:function(){var a=b.r(43),c=b.r(49);return a.createClass("FractionExpression",{base:b.r(11),constructor:function(a,b){this.callBase(a,b),this.setFlag("Fraction"),this.setOperator(new c)},setZoom:function(a){return this.getOperator().setZoom(a)},getBaseline:function(a){var b=this.getOperand(1),c=b.getRenderBox(a);return c.y+b.getBaselineProportion()*c.height},getMeanline:function(a){var b=this.getOperand(0),c=b.getRenderBox(a);return b.getMeanlineProportion()*c.height}})}},b[16]={value:function(){var a=b.r(43),c=b.r(65).func,d=b.r(50);return a.createClass("FunctionExpression",{base:b.r(28),constructor:function(a,b,c,e){this.callBase(),this.setFlag("Func"),this.funcName=a,this.setOperator(new d(a)),this.setExpr(b),this.setSuperscript(c),this.setSubscript(e)},isSideScript:function(){return!c["ud-script"][this.funcName]},setExpr:function(a){return this.setOperand(a,0)},setSuperscript:function(a){return this.setOperand(a,1)},setSubscript:function(a){return this.setOperand(a,2)}})}},b[17]={value:function(){var a=b.r(43),c=b.r(51),d=a.createClass("HatExpression",{base:b.r(28),constructor:function(a){this.callBase(),this.setFlag("Hat"),this.setOperator(new c),this.setOperand(a,0)},setType:function(a){return this.getOperator().setType(a),this}});return d}},b[18]={value:function(){var a=b.r(43),c=b.r(52),d=a.createClass("IntegrationExpression",{base:b.r(28),constructor:function(a,b,d){this.callBase(),this.setFlag("Integration"),this.setOperator(new c),this.setIntegrand(a),this.setSuperscript(b),this.setSubscript(d)},setType:function(a){return this.getOperator().setType(a),this},resetType:function(){return this.getOperator().resetType(),this},setIntegrand:function(a){this.setOperand(a,0)},setSuperscript:function(a){this.setOperand(a,1)},setSubscript:function(a){this.setOperand(a,2)}});return d}},b[19]={value:function(){var a=b.r(43),c=b.r(54),d=a.createClass("OverlineExpression",{base:b.r(28),constructor:function(a){this.callBase(),this.setFlag("Overline"),this.setOperator(new c),this.setOperand(a,0)}});return d}},b[20]={value:function(){var a=b.r(43),c=b.r(55),d=a.createClass("PmodExpression",{base:b.r(28),constructor:function(a){this.callBase(),this.setFlag("PMod"),this.setOperator(new c),this.setOperand(a,0)}});return d}},b[21]={value:function(){var a=b.r(43),c=b.r(56);return a.createClass("ProductExpression",{base:b.r(28),constructor:function(a,b,d){this.callBase(),this.setFlag("Product"),this.setOperator(new c),this.setExpr(a),this.setSuperscript(b),this.setSubscript(d)},setExpr:function(a){this.setOperand(a,0)},setSuperscript:function(a){this.setOperand(a,1)},setSubscript:function(a){this.setOperand(a,2)}})}},b[22]={value:function(){var a=b.r(43),c=b.r(57);return a.createClass("RadicalExpression",{base:b.r(11),constructor:function(a,b){this.callBase(a,b),this.setFlag("Radicand"),this.setOperator(new c)},setRadicand:function(a){return this.setFirstOperand(a)},getRadicand:function(){return this.getFirstOperand()},setExponent:function(a){return this.setLastOperand(a)},getExponent:function(){return this.getLastOperand()}})}},b[23]={value:function(){var a=b.r(43),c=b.r(58);return a.createClass("ScriptExpression",{base:b.r(28),constructor:function(a,b,d){this.callBase(),this.setFlag("Script"),this.setOperator(new c),this.setOpd(a),this.setSuperscript(b),this.setSubscript(d)},setOpd:function(a){this.setOperand(a,0)},setSuperscript:function(a){this.setOperand(a,1)},setSubscript:function(a){this.setOperand(a,2)}})}},b[24]={value:function(){var a=b.r(43),c=b.r(59);return a.createClass("SummationExpression",{base:b.r(28),constructor:function(a,b,d){this.callBase(),this.setFlag("Summation"),this.setOperator(new c),this.setExpr(a),this.setSuperscript(b),this.setSubscript(d)},setExpr:function(a){this.setOperand(a,0)},setSuperscript:function(a){this.setOperand(a,1)},setSubscript:function(a){this.setOperand(a,2)}})}},b[25]={value:function(){var a=b.r(43),c="\u24ea\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468\u2469".split(""),d=b.r(60),e=a.createClass("TextcircledExpression",{base:b.r(28),constructor:function(a){this.callBase(),this.setFlag("Textcircled"),this.setOperator(new d),this.setOperand(c[a-0],0)}});return e}},b[26]={value:function(){var a=b.r(43),c=b.r(61);return a.createClass("UnderbraceExpression",{base:b.r(28),constructor:function(a,b){this.callBase(),this.setFlag("Underbrace"),this.setOperator(new c),this.setOperand(a,0),this.setOperand(b,1)}})}},b[27]={value:function(){var a=b.r(43),c=b.r(62);return a.createClass("WideparenExpression",{base:b.r(28),constructor:function(a){this.callBase(),this.setFlag("Wideparen"),this.setOperator(new c),this.setOperand(a,0)}})}},b[28]={value:function(){var a=b.r(43),c=b.r(6),d=b.r(30);return a.createClass("CompoundExpression",{base:b.r(30),constructor:function(){this.callBase(),this.type=c.COMPOUND_EXP,this.operands=[],this.operator=null,this.operatorBox=new a.Group,this.operatorBox.setAttr("data-type","kf-editor-exp-op-box"),this.operandBox=new a.Group,this.operandBox.setAttr("data-type","kf-editor-exp-operand-box"),this.setChildren(0,this.operatorBox),this.setChildren(1,this.operandBox)},setOperator:function(a){return void 0===a?this:(this.operator&&this.operator.remove(),this.operatorBox.addShape(a),this.operator=a,this.operator.setParentExpression(this),a.expression=this,this)},getOperator:function(){return this.operator},setOperand:function(a,b,c){return c===!1?(this.operands[b]=a,this):(a=d.wrap(a),this.operands[b]&&this.operands[b].remove(),this.operands[b]=a,this.operandBox.addShape(a),this)},getOperand:function(a){return this.operands[a]},getOperands:function(){return this.operands},addedCall:function(){return this.operator&&this.operator.applyOperand.apply(this.operator,this.operands),this}})}},b[29]={value:function(){var a=b.r(43),c=b.r(65).font,d=b.r(30),e=a.createClass("EmptyExpression",{base:d,constructor:function(){this.callBase(),this.setFlag("Empty")},getRenderBox:function(){return{width:0,height:c.spaceHeight,x:0,y:0}}});return e.isEmpty=function(a){return a instanceof e},d.registerWrap("empty",function(a){return null===a||void 0===a?new e:void 0}),e}},b[30]={value:function(){var a=b.r(43),c=b.r(6),d=b.r(65).font,e=[],f={},g=a.createClass("Expression",{base:b.r(64),constructor:function(){this.callBase(),this.type=c.EXP,this._offset={top:0,bottom:0},this.children=[],this.box.fill("transparent").setAttr("data-type","kf-editor-exp-box"),this.box.setAttr("data-type","kf-editor-exp-bg-box"),this.expContent=new a.Group,this.expContent.setAttr("data-type","kf-editor-exp-content-box"),this.addShape(this.expContent)},getChildren:function(){return this.children},getChild:function(a){return this.children[a]||null},getTopOffset:function(){return this._offset.top},getBottomOffset:function(){return this._offset.bottom},getOffset:function(){return this._offset},setTopOffset:function(a){this._offset.top=a},setBottomOffset:function(a){this._offset.bottom=a},setOffset:function(a,b){this._offset.top=a,this._offset.bottom=b},setFlag:function(a){this.setAttr("data-flag",a||"Expression")},setChildren:function(a,b){this.children[a]&&this.children[a].remove(),this.children[a]=b,this.expContent.addShape(b)},getBaselineProportion:function(){return d.baselinePosition},getMeanlineProportion:function(){return d.meanlinePosition},getBaseline:function(a){return this.getRenderBox(a).height*d.baselinePosition-3},getMeanline:function(a){return this.getRenderBox(a).height*d.meanlinePosition-1},getAscenderline:function(){return this.getFixRenderBox().height*d.ascenderPosition},getDescenderline:function(){return this.getFixRenderBox().height*d.descenderPosition},translateElement:function(a,b){this.expContent.translate(a,b)},expand:function(a,b){var c=this.getFixRenderBox();this.setBoxSize(c.width+a,c.height+b)},getBaseWidth:function(){return this.getWidth()},getBaseHeight:function(){return this.getHeight()},updateBoxSize:function(){var a=this.expContent.getFixRenderBox();this.setBoxSize(a.width,a.height)},getBox:function(){return this.box}});return a.Utils.extend(g,{registerWrap:function(a,b){f[a]=e.length,e.push(b)},revokeWrap:function(a){var b=null;return a in f&&(b=e[f[a]],e[f[a]]=null,delete f[a]),b},wrap:function(b){var c;return a.Utils.each(e,function(a){return a?(c=a(b),c?!1:void 0):void 0}),c}}),g}},b[31]={value:function(){var a=b.r(5),c=b.r(43),d="\u24ea\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468\u2469".split(""),e=b.r(3),f=b.r(30),g=c.createClass("TextExpression",{base:b.r(30),constructor:function(b,f){this.callBase(),this.fontFamily=f||e.defaultFont,this.setFlag("Text"),this.content=b+"","textcircled"===this.fontFamily&&(this.fontFamily=e.defaultFont,this.content=d[this.content-0]),this.textContent=new a(this.content,this.fontFamily),this.setChildren(0,this.textContent),this.setChildren(1,new c.Rect(0,0,0,0).fill("transparent"))},setFamily:function(a){this.textContent.setFamily(a)},setFontSize:function(a){this.textContent.setFontSize(a)},addedCall:function(){var a=this.textContent.getFixRenderBox();return this.getChild(1).setSize(a.width,a.height),this.updateBoxSize(),this}});return f.registerWrap("text",function(a){var b=typeof a;return("number"===b||"string"===b)&&(a=new g(a)),a}),g}},b[32]={value:function(){return['<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">','<text id="abcd" font-family="KF AMS MAIN" font-size="50" x="0" y="0">x</text>',"</svg>"]}},b[33]={value:function(){function a(a,b,c){window.setTimeout(function(){d(a,b),c()},0)}function c(a,b){window.setTimeout(function(){e(a),f(),b()},0)}function d(a,b){var c=document.createElement("div"),d=b.meta.fontFamily;c.style.cssText="position: absolute; top: -10000px; left: -100000px;",c.style.fontFamily=d,c.innerHTML=j.join(""),a.body.appendChild(c),k.push(c)}function e(a){var c=a.createElement("div");c.style.cssText="position: absolute; top: 0; left: -100000px;",c.innerHTML=b.r(32).join(""),a.body.appendChild(c);var d=c.getElementsByTagName("text")[0].getBBox();i.spaceHeight=d.height,i.topSpace=-d.y-i.baseline,i.bottomSpace=i.spaceHeight-i.topSpace-i.baseHeight,i.offset=i.baseline+i.topSpace,i.baselinePosition=(i.topSpace+i.baseline)/i.spaceHeight,i.meanlinePosition=(i.topSpace+i.meanline)/i.spaceHeight,i.ascenderPosition=i.topSpace/i.spaceHeight,i.descenderPosition=(i.topSpace+i.baseHeight)/i.spaceHeight,a.body.removeChild(c)}function f(){g.Utils.each(k,function(a){a.parentNode.removeChild(a)}),k=[]}var g=b.r(43),h=b.r(34),i=b.r(65).font,j=b.r(2),k=[];return g.createClass("FontInstaller",{constructor:function(a,b){this.callBase(),this.resource=b||"../src/resource/",this.doc=a},mount:function(b){var d=h.getFontList(),e=0,f=this;g.Utils.each(d,function(d){e++,d.meta.src=f.resource+d.meta.src,f.createFontStyle(d),a(f.doc,d,function(){e--,0===e&&c(f.doc,b)})})},createFontStyle:function(a){var b=this.doc.createElement("style"),c='@font-face{\nfont-family: "${fontFamily}";\nsrc: url("${src}");\n}';b.setAttribute("type","text/css"),b.innerHTML=c.replace("${fontFamily}",a.meta.fontFamily).replace("${src}",a.meta.src),this.doc.head.appendChild(b)}})}},b[34]={value:function(){var a={},c=b.r(43),d=b.r(65).font.list;return function(){c.Utils.each(d,function(b){a[b.meta.fontFamily]=b})}(),{getFontList:function(){return a},getCharacterValue:function(b,c){return a[c]?a[c].map[b]||null:null}}}},b[35]={value:function(){return{meta:{fontFamily:"KF AMS BB",src:"KF_AMS_BB.woff"}}}},b[36]={value:function(){return{meta:{fontFamily:"KF AMS CAL",src:"KF_AMS_CAL.woff"}}}},b[37]={value:function(){return{meta:{fontFamily:"KF AMS FRAK",src:"KF_AMS_FRAK.woff"}}}},b[38]={value:function(){return{meta:{fontFamily:"KF AMS MAIN",src:"KF_AMS_MAIN.woff"},map:{Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039a",Lambda:"\u039b",Mu:"\u039c",Nu:"\u039d",Xi:"\u039e",Omicron:"\u039f",Pi:"\u03a0",Rho:"\u03a1",Sigma:"\u03a3",Tau:"\u03a4",Upsilon:"\u03a5",Phi:"\u03a6",Chi:"\u03a7",Psi:"\u03a8",Omega:"\u03a9",alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03b5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u03c1",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03c6",varkappa:"\u03f0",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",digamma:"\u03dc",varepsilon:"\u03f5",varrho:"\u03f1",varphi:"\u03d5",vartheta:"\u03d1",varpi:"\u03d6",varsigma:"\u03f9",aleph:"\u2135",beth:"\u2136",daleth:"\u2138",gimel:"\u2137",eth:"\xf0",hbar:"\u210e",hslash:"\u210f",mho:"\u2127",partial:"\u2202",wp:"\u2118",Game:"\u2141",Bbbk:"\u214c",Finv:"\u2132",Im:"\u2111",Re:"\u211c",complement:"\u2201",ell:"\u2113",circledS:"\u24c8",imath:"\u0131",jmath:"\u0237",doublecap:"\u22d2",Cap:"\u22d2",doublecup:"\u22d3",Cup:"\u22d3",ast:"*",divideontimes:"\u22c7",rightthreetimes:"\u22cc",leftthreetimes:"\u22cb",cdot:"\xb7",odot:"\u2299",dotplus:"\u2214",rtimes:"\u22ca",ltimes:"\u22c9",centerdot:"\u25aa",doublebarwedge:"\u232d",setminus:"\u2481",amalg:"\u2210",circ:"\u25e6",bigcirc:"\u25ef",gtrdot:"\u22d7",lessdot:"\u22d6",smallsetminus:"\u2485",circledast:"\u229b",circledcirc:"\u229a",sqcap:"\u2293",sqcup:"\u2294",barwedge:"\u22bc",circleddash:"\u229d",star:"\u22c6",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",cup:"\u222a",cap:"\u2229",times:"\xd7",mp:"\u2213",pm:"\xb1",triangleleft:"\u22b2",triangleright:"\u22b3",boxdot:"\u22a1",curlyvee:"\u22cf",curlywedge:"\u22ce",boxminus:"\u229f",boxtimes:"\u22a0",ominus:"\u2296",oplus:"\u2295",oslash:"\u2298",otimes:"\u2297",uplus:"\u228e",boxplus:"\u229e",dagger:"\u2020",ddagger:"\u2021",vee:"\u2228",lor:"\u2228",veebar:"\u22bb",bullet:"\u2022",diamond:"\u22c4",wedge:"\u2227",land:"\u2227",div:"\xf7",wr:"\u2240",geqq:"\u2267",lll:"\u22d8",llless:"\u22d8",ggg:"\u22d9",gggtr:"\u22d9",preccurlyeq:"\u227c",geqslant:"\u2a7e",lnapprox:"\u2a89",preceq:"\u2aaf",gg:"\u226b",lneq:"\u2a87",precnapprox:"\u2ab9",approx:"\u2248",lneqq:"\u2268",precneqq:"\u2ab5",approxeq:"\u224a",gnapprox:"\u2a8a",lnsim:"\u22e6",precnsim:"\u22e8",asymp:"\u224d",gneq:"\u2a88",lvertneqq:"\u232e",precsim:"\u227e",backsim:"\u223d",gneqq:"\u2269",ncong:"\u2247",risingdotseq:"\u2253",backsimeq:"\u22cd",gnsim:"\u22e7",sim:"\u223c",simeq:"\u2243",bumpeq:"\u224f",gtrapprox:"\u2a86",ngeq:"\u2271",Bumpeq:"\u224e",gtreqless:"\u22db",ngeqq:"\u2331",succ:"\u227b",circeq:"\u2257",gtreqqless:"\u2a8c",ngeqslant:"\u2333",succapprox:"\u2ab8",cong:"\u2245",gtrless:"\u2277",ngtr:"\u226f",succcurlyeq:"\u227d",curlyeqprec:"\u22de",gtrsim:"\u2273",nleq:"\u2270",succeq:"\u2ab0",curlyeqsucc:"\u22df",gvertneqq:"\u232f",neq:"\u2260",ne:"\u2260",nequiv:"\u2262",nleqq:"\u2330",succnapprox:"\u2aba",doteq:"\u2250",leq:"\u2264",le:"\u2264",nleqslant:"\u2332",succneqq:"\u2ab6",doteqdot:"\u2251",Doteq:"\u2251",leqq:"\u2266",nless:"\u226e",succnsim:"\u22e9",leqslant:"\u2a7d",nprec:"\u2280",succsim:"\u227f",eqsim:"\u2242",lessapprox:"\u2a85",npreceq:"\u22e0",eqslantgtr:"\u2a96",lesseqgtr:"\u22da",nsim:"\u2241",eqslantless:"\u2a95",lesseqqgtr:"\u2a8b",nsucc:"\u2281",triangleq:"\u225c",eqcirc:"\u2256",equiv:"\u2261",lessgtr:"\u2276",nsucceq:"\u22e1",fallingdotseq:"\u2252",lesssim:"\u2272",prec:"\u227a",geq:"\u2265",ge:"\u2265",ll:"\u226a",precapprox:"\u2ab7",uparrow:"\u2191",downarrow:"\u2193",updownarrow:"\u2195",Uparrow:"\u21d1",Downarrow:"\u21d3",Updownarrow:"\u21d5",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",curvearrowleft:"\u21b6",curvearrowright:"\u21b7",downdownarrows:"\u21ca",downharpoonleft:"\u21c3",downharpoonright:"\u21c2",leftarrow:"\u2190",gets:"\u2190",Leftarrow:"\u21d0",leftarrowtail:"\u21a2",leftharpoondown:"\u21bd",leftharpoonup:"\u21bc",leftleftarrows:"\u21c7",leftrightarrow:"\u2194",Leftrightarrow:"\u21d4",leftrightarrows:"\u21c4",leftrightharpoons:"\u21cb",leftrightsquigarrow:"\u21ad",Lleftarrow:"\u21da",looparrowleft:"\u21ab",looparrowright:"\u21ac",multimap:"\u22b8",nLeftarrow:"\u21cd",nRightarrow:"\u21cf",nLeftrightarrow:"\u21ce",nearrow:"\u2197",nleftarrow:"\u219a",nleftrightarrow:"\u21ae",nrightarrow:"\u219b",nwarrow:"\u2196",rightarrow:"\u2192",to:"\u2192",Rightarrow:"\u21d2",rightarrowtail:"\u21a3",rightharpoondown:"\u21c1",rightharpoonup:"\u21c0",rightleftarrows:"\u21c6",rightleftharpoons:"\u21cc",rightrightarrows:"\u21c9",rightsquigarrow:"\u21dd",Rrightarrow:"\u21db",searrow:"\u2198",swarrow:"\u2199",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",upharpoonleft:"\u21bf",upharpoonright:"\u21be",restriction:"\u21be",upuparrows:"\u21c8",Lsh:"\u21b0",Rsh:"\u21b1",longleftarrow:"\u27f5",longrightarrow:"\u27f6",Longleftarrow:"\u27f8",Longrightarrow:"\u27f9",implies:"\u27f9",longleftrightarrow:"\u27f7",Longleftrightarrow:"\u27fa",backepsilon:"\u220d",because:"\u2235",therefore:"\u2234",between:"\u226c",blacktriangleleft:"\u25c0",blacktriangleright:"\u25b8",dashv:"\u22a3",bowtie:"\u22c8",frown:"\u2322","in":"\u2208",notin:"\u2209",mid:"\u2223",parallel:"\u2225",models:"\u22a8",ni:"\u220b",owns:"\u220b",nmid:"\u2224",nparallel:"\u2226",nshortmid:"\u23d2",nshortparallel:"\u23d3",nsubseteq:"\u2288",nsubseteqq:"\u2ac7",nsupseteq:"\u2289",nsupseteqq:"\u2ac8",ntriangleleft:"\u22ea",ntrianglelefteq:"\u22ec",ntriangleright:"\u22eb",ntrianglerighteq:"\u22ed",nvdash:"\u22ac",nVdash:"\u22ae",nvDash:"\u22ad",nVDash:"\u22af",pitchfork:"\u22d4",propto:"\u221d",shortmid:"\u23d0",shortparallel:"\u23d1",smile:"\u2323",sqsubset:"\u228f",sqsubseteq:"\u2291",sqsupset:"\u2290",sqsupseteq:"\u2292",subset:"\u2282",Subset:"\u22d0",subseteq:"\u2286",subseteqq:"\u2ac5",subsetneq:"\u228a",subsetneqq:"\u2acb",supset:"\u2283",Supset:"\u22d1",supseteq:"\u2287",supseteqq:"\u2ac6",supsetneq:"\u228b",supsetneqq:"\u2acc",trianglelefteq:"\u22b4",trianglerighteq:"\u22b5",varpropto:"\u2ac9",varsubsetneq:"\u23d4",varsubsetneqq:"\u23d6",varsupsetneq:"\u23d5",varsupsetneqq:"\u23d7",vdash:"\u22a2",Vdash:"\u22a9",vDash:"\u22a8",Vvdash:"\u22aa",vert:"|",Vert:"\u01c1","|":"\u01c1","{":"{","}":"}",backslash:"\\",langle:"\u3008",rangle:"\u3009",lceil:"\u2308",rceil:"\u2309",lbrace:"{",rbrace:"}",lfloor:"\u230a",rfloor:"\u230b",cdots:"\u22ef",ddots:"\u22f0",vdots:"\u22ee",dots:"\u2026",ldots:"\u2026","#":"#",bot:"\u22a5",perp:"\u22a5",angle:"\u2220",backprime:"\u2035",bigstar:"\u2605",blacklozenge:"\u25c6",blacksquare:"\u25a0",blacktriangle:"\u25b2",blacktriangledown:"\u25bc",clubsuit:"\u2663",diagdown:"\u2481",diagup:"\u2482",diamondsuit:"\u2662",emptyset:"\xf8",exists:"\u2203",flat:"\u266d",forall:"\u2200",heartsuit:"\u2661",infty:"\u221e",lozenge:"\u25c7",measuredangle:"\u2221",nabla:"\u2207",natural:"\u266e",neg:"\xac",lnot:"\xac",nexists:"\u2204",prime:"\u2032",sharp:"\u266f",spadesuit:"\u2660",sphericalangle:"\u2222",surd:"\u221a",top:"\u22a4",varnothing:"\u2205",triangle:"\u25b3",triangledown:"\u25bd"}}}},b[39]={value:function(){return{meta:{fontFamily:"KF AMS ROMAN",src:"KF_AMS_ROMAN.woff"}}}},b[40]={value:function(){function a(){var a=0;return d.Utils.each(this.expressions,function(b){var c=null;b&&(b.setMatrix(new d.Matrix(1,0,0,1,0,0)),c=b.getFixRenderBox(),b.translate(0-c.x,a),a+=c.height+j)}),this}function c(a){var b=0;if(a){if(a.getType()===e.EXP)for(var d=0,b=a.getChildren().length;b>d;d++)c(a.getChild(d));else if(a.getType()===e.COMPOUND_EXP){for(var d=0,b=a.getOperands().length;b>d;d++)c(a.getOperand(d));c(a.getOperator())}a.addedCall&&a.addedCall()}}var d=b.r(43),e=b.r(6),f=b.r(34),g=b.r(33),h={fontsize:50,autoresize:!0,padding:[0]},i=b.r(1),j=10,k=d.createClass("ExpressionWrap",{constructor:function(a,b){this.wrap=new d.Group,this.bg=new d.Rect(0,0,0,0).fill("transparent"),this.exp=a,this.config=b,this.wrap.setAttr("data-type","kf-exp-wrap"),this.bg.setAttr("data-type","kf-exp-wrap-bg"),this.wrap.addShape(this.bg),this.wrap.addShape(this.exp)},getWrapShape:function(){return this.wrap},getExpression:function(){return this.exp},getBackground:function(){return this.bg},resize:function(){var a=this.config.padding,b=this.exp.getFixRenderBox();1===a.length&&(a[1]=a[0]),this.bg.setSize(2*a[1]+b.width,2*a[0]+b.height),this.exp.translate(a[1],a[0])}}),l=d.createClass("Formula",{base:b.r(41),constructor:function(a,b){this.callBase(a),this.expressions=[],this.fontInstaller=new g(this),this.config=d.Utils.extend({},h,b),this.initEnvironment(),this.initInnerFont()
},getContentContainer:function(){return this.container},initEnvironment:function(){this.zoom=this.config.fontsize/50,"width"in this.config&&this.setWidth(this.config.width),"height"in this.config&&this.setHeight(this.config.height),this.node.setAttribute("font-size",h.fontsize)},initInnerFont:function(){function a(a){var b=c.doc.createElement("style"),d='@font-face{font-family: "${fontFamily}";font-style: normal;src: url("${src}") format("woff");}';b.setAttribute("type","text/css"),b.innerHTML=d.replace("${fontFamily}",a.meta.fontFamily).replace("${src}",a.meta.src),c.resourceNode.appendChild(b)}var b=f.getFontList(),c=this;d.Utils.each(b,function(b){a(b)})},insertExpression:function(b,d){var e=this.wrap(b);this.container.clearTransform(),this.expressions.splice(d,0,e.getWrapShape()),this.addShape(e.getWrapShape()),c.call(this,e.getExpression()),e.resize(),a.call(this),this.resetZoom(),this.config.autoresize&&this.resize()},appendExpression:function(a){this.insertExpression(a,this.expressions.length)},resize:function(){var a=this.container.getRenderBox("paper");this.node.setAttribute("width",a.width),this.node.setAttribute("height",a.height)},resetZoom:function(){var a=this.zoom/this.getBaseZoom();0!==a&&this.container.scale(a)},wrap:function(a){return new k(a,this.config)},clear:function(){this.callBase(),this.expressions=[]},clearExpressions:function(){d.Utils.each(this.expressions,function(a){a.remove()}),this.expressions=[]},toJPG:function(a){new i(this).toJPG(a)},toPNG:function(a){new i(this).toPNG(a)}});return d.Utils.extend(l,{registerFont:function(a){f.registerFont(a)}}),l}},b[41]={value:function(){var a=b.r(43);return a.createClass("FPaper",{base:a.Paper,constructor:function(b){this.callBase(b),this.doc=b.ownerDocument,this.container=new a.Group,this.container.setAttr("data-type","kf-container"),this.background=new a.Group,this.background.setAttr("data-type","kf-bg"),this.baseZoom=1,this.zoom=1,this.base("addShape",this.background),this.base("addShape",this.container)},getZoom:function(){return this.zoom},getBaseZoom:function(){return this.baseZoom},addShape:function(a,b){return this.container.addShape(a,b)},getBackground:function(){return this.background},removeShape:function(a){return this.container.removeShape(a)},clear:function(){return this.container.clear()}})}},b[42]={value:function(){if(!window.jQuery)throw new Error("Missing jQuery");return window.jQuery}},b[43]={value:function(){if(!window.kity)throw new Error("Missing Kity Graphic Lib");return window.kity}},b[44]={value:function(){var a=b.r(43);return a.createClass("ArrayOperator",{base:b.r(53),constructor:function(){this.callBase("Array")},applyOperand:function(){for(var a=[].slice.call(arguments),b=this.parentExpression,c=b.getColNum(),d=this.getBoxs(a),e=[],f=[],g=0,h=0,i=a.length/c;i>h;h++){g=0;for(var j=0,k=c;k>j;j++)g=Math.max(g,d[h*c+j].height),f[j]=Math.max(f[j]||0,d[h*c+j].width);e[h]=g}this.relocation(a,d,f,e,c)},relocation:function(a,b,c,d,e){for(var f=0,g=5,h=0,i=0,j=0,k=a.length/e;k>j;j++){h=0;for(var l=0,m=e;m>l;l++)i=j*e+l,a[i].translate(h+(c[l]-b[i].width)/2,f+(d[j]-b[i].height)/2),h+=c[l]+g;f+=d[j]+g}},getBoxs:function(a){for(var b=[],c=0,d=a.length;d>c;c++)b[c]=a[c].getFixRenderBox();return b}})}},b[45]={value:function(){function a(a){var b=this.getParentExpression().getLeftSymbol(),e=this.getParentExpression().getRightSymbol(),f=a.getFixRenderBox().height,g=new c.Group,h=0,i=new d(b,"KF AMS MAIN").fill("black"),j=new d(e,"KF AMS MAIN").fill("black");i.setFontSize(f),j.setFontSize(f),this.addOperatorShape(g.addShape(i).addShape(j)),h+=i.getFixRenderBox().width,a.translate(h,0),h+=a.getFixRenderBox().width,j.translate(h,0)}var c=b.r(43),d=b.r(5);return c.createClass("BracketsOperator",{base:b.r(53),constructor:function(){this.callBase("Brackets")},applyOperand:function(b){a.call(this,b)}})}},b[46]={value:function(){var a=b.r(43),c="M4.825,23.839V9.577c0-2.88,1.872-7.489,9.721-7.993c0.36-0.072,0.648-0.36,0.648-0.792C15.193,0,14.617,0,13.825,0 C6.625,0,0.072,3.672,0,9.001v14.838H4.825z",d="M10.153,18.365c0.178,0.655,0.209,0.871,0.215,2.39h4.824c-0.007-3.266-0.589-4.493-2.879-6.783 c-1.512-1.512-3.601-2.232-5.617-2.808c5.905-1.656,8.497-4.969,8.497-9.145V0h-4.825v0.579c0,2.808,0,5.112-2.88,7.489 c-2.52,2.088-5.256,2.232-6.84,2.304C0.288,10.444,0,10.732,0,11.164c0,0.72,0.432,0.72,1.152,0.792 C5.904,12.244,9.361,14.836,10.153,18.365z",e="M14.042,23.828c-4.537-0.288-8.065-2.592-9.001-6.265c-0.216-0.648-0.216-0.792-0.216-3.384V0H0v14.395 c0,3.024,0,5.329,3.457,8.065c2.808,2.16,7.561,2.952,10.369,2.952c0.792,0,1.368,0,1.368-0.792 C15.193,23.9,14.761,23.9,14.042,23.828z";return a.createClass("CasesOperator",{base:b.r(53),constructor:function(){this.callBase("Cases")},applyOperand:function(){for(var a=arguments,b=0,c=0,d=10,e=null,f=0,g=a.length;g>f;f++)e=a[f].getFixRenderBox(),b=Math.max(b,e.width),a[f].translate(0,c),c+=e.height;var h=this.getOperatorShape(c),i=(h.height-c)/2;i=Math.max(i,0);for(var f=0,g=a.length;g>f;f++)a[f].translate(h.width,i);this.parentExpression.expand(8*d,2*d),this.parentExpression.translateElement(d,d)},getOperatorShape:function(b){var f=new a.Group,g=4.8,h=[new a.Path(c).fill("black"),new a.Path(d).fill("black"),new a.Path(e).fill("black"),new a.Rect(g,0).fill("black"),new a.Rect(g,0).fill("black")],i=[],j=0,k=0;this.addOperatorShape(f);for(var l=0;5>l;l++)f.addShape(h[l]),i[l]=h[l].getFixRenderBox();return k=i[0].height+i[1].height+i[2].height,k>=b?(h[0].translate(i[1].width-g,0),h[1].translate(0,i[0].height),h[2].translate(i[1].width-g,i[0].height+i[1].height),h[3].remove(),h[4].remove()):(b=(b-k)/2,h[3].setHeight(b),h[4].setHeight(b),h[0].translate(i[1].width-g,j),j+=i[0].height,h[3].translate(i[1].width-g,j),j+=b,h[1].translate(0,j),j+=i[1].height,h[4].translate(i[1].width-g,j),j+=b,h[2].translate(i[1].width-g,j)),f.getFixRenderBox()}})}},b[47]={value:function(){var a=b.r(43);return a.createClass("CombinationOperator",{base:b.r(53),constructor:function(){this.callBase("Combination")},applyOperand:function(){var b=0,c=arguments,d=0,e=0,f=0,g=[],h=[];a.Utils.each(c,function(a){var b=a.getFixRenderBox(),c=a.getOffset();b.height-=c.top+c.bottom,g.push(b),h.push(c),e=Math.max(c.top,e),f=Math.max(c.bottom,f),d=Math.max(b.height,d)}),a.Utils.each(c,function(a,c){var e=g[c];a.translate(b-e.x,(d-(e.y+e.height))/2+f-h[c].bottom),b+=e.width}),this.parentExpression.setOffset(e,f),this.parentExpression.updateBoxSize()}})}},b[48]={value:function(){var a=b.r(43),c=b.r(29),d={subOffset:0,supOffset:0,zoom:.66};return a.createClass("ScriptController",{constructor:function(b,c,e,f,g){this.observer=b.getParentExpression(),this.target=c,this.sup=e,this.sub=f,this.options=a.Utils.extend({},d,g)},applyUpDown:function(){var a=this.target,b=this.sup,d=this.sub,e=this.options;b.scale(e.zoom),d.scale(e.zoom);var f=a.getFixRenderBox();return c.isEmpty(b)&&c.isEmpty(d)?{width:f.width,height:f.height,top:0,bottom:0}:!c.isEmpty(b)&&c.isEmpty(d)?this.applyUp(a,b):c.isEmpty(b)&&!c.isEmpty(d)?this.applyDown(a,d):this.applyUpDownScript(a,b,d)},applySide:function(){var a=this.target,b=this.sup,d=this.sub;if(c.isEmpty(b)&&c.isEmpty(d)){var e=a.getRenderBox(this.observer);return{width:e.width,height:e.height,top:0,bottom:0}}return c.isEmpty(b)&&!c.isEmpty(d)?this.applySideSub(a,d):!c.isEmpty(b)&&c.isEmpty(d)?this.applySideSuper(a,b):this.applySideScript(a,b,d)},applySideSuper:function(a,b){b.scale(this.options.zoom);var c=a.getRenderBox(this.observer),d=b.getRenderBox(this.observer),e=a.getMeanline(this.observer),f=b.getBaseline(this.observer),g=e,h=f-g,i={top:0,bottom:0,width:c.width+d.width,height:c.height};return b.translate(c.width,0),this.options.supOffset&&b.translate(this.options.supOffset,0),h>0?(a.translate(0,h),i.bottom=h,i.height+=h):b.translate(0,-h),i},applySideSub:function(a,b){b.scale(this.options.zoom);var c=a.getRenderBox(this.observer),d=b.getRenderBox(this.observer),e=b.getOffset(),f=a.getBaseline(this.observer),g=(d.height+e.top+e.bottom)/2,h=c.height-f-g,i={top:0,bottom:0,width:c.width+d.width,height:c.height};return b.translate(c.width,e.top+f-g),this.options.subOffset&&b.translate(this.options.subOffset,0),0>h&&(i.top=-h,i.height-=h),i},applySideScript:function(a,b,c){b.scale(this.options.zoom),c.scale(this.options.zoom);var d=a.getRenderBox(this.observer),e=c.getRenderBox(this.observer),f=b.getRenderBox(this.observer),g=a.getMeanline(this.observer),h=a.getBaseline(this.observer),i=b.getBaseline(this.observer),j=c.getAscenderline(this.observer),k=g,l=g+2*(h-g)/3,m=k-i,n=d.height-l-(e.height-j),o={top:0,bottom:0,width:d.width+Math.max(e.width,f.width),height:d.height};return b.translate(d.width,m),c.translate(d.width,l-j),this.options.supOffset&&b.translate(this.options.supOffset,0),this.options.subOffset&&c.translate(this.options.subOffset,0),m>0?0>n&&(d.height-=n,o.top=-n):(a.translate(0,-m),b.translate(0,-m),c.translate(0,-m),o.height-=m,n>0?o.bottom=-m:(o.height-=n,m=-m,n=-n,m>n?o.bottom=m-n:o.top=n-m)),o},applyUp:function(a,b){var c=b.getFixRenderBox(),d=a.getFixRenderBox(),e={width:Math.max(d.width,c.width),height:c.height+d.height,top:0,bottom:c.height};return b.translate((e.width-c.width)/2,0),a.translate((e.width-d.width)/2,c.height),e},applyDown:function(a,b){var c=b.getFixRenderBox(),d=a.getFixRenderBox(),e={width:Math.max(d.width,c.width),height:c.height+d.height,top:c.height,bottom:0};return b.translate((e.width-c.width)/2,d.height),a.translate((e.width-d.width)/2,0),e},applyUpDownScript:function(a,b,c){var d=b.getFixRenderBox(),e=c.getFixRenderBox(),f=a.getFixRenderBox(),g={width:Math.max(f.width,d.width,e.width),height:d.height+e.height+f.height,top:0,bottom:0};return b.translate((g.width-d.width)/2,0),a.translate((g.width-f.width)/2,d.height),c.translate((g.width-e.width)/2,d.height+f.height),g}})}},b[49]={value:function(){function a(a,b){return new c.Rect(a+2*b,1).fill("black")}var c=b.r(43),d=b.r(65).zoom;return c.createClass("FractionOperator",{base:b.r(53),constructor:function(){this.zoom=d,this.callBase("Fraction")},setZoom:function(a){this.zoom=a},applyOperand:function(b,c){b.scale(this.zoom),c.scale(this.zoom);var d=Math.ceil(b.getWidth()),e=Math.ceil(c.getWidth()),f=Math.ceil(b.getHeight()),g=Math.ceil(c.getHeight()),h=3,i=1,j=Math.max(d,e),k=Math.max(f,g),l=a(j,h);this.addOperatorShape(l),b.translate((j-d)/2+h,0),l.translate(0,f+1),c.translate((j-e)/2+h,f+l.getHeight()+2),this.parentExpression.setOffset(k-f,k-g),this.parentExpression.expand(2*i,2*i),this.parentExpression.translateElement(i,i)}})}},b[50]={value:function(){function a(){var a=new d(this.funcName,"KF AMS ROMAN");return this.addOperatorShape(a),a.getBaseline=function(){return a.getFixRenderBox().height},a.getMeanline=function(){return 0},a}var c=b.r(43),d=b.r(5),e=b.r(48);return c.createClass("FunctionOperator",{base:b.r(53),constructor:function(a){this.callBase("Function: "+a),this.funcName=a},applyOperand:function(b,c,d){var f=a.call(this),g=b.getFixRenderBox(),h=this.parentExpression.isSideScript()?"applySide":"applyUpDown",i=new e(this,f,c,d,{zoom:.5})[h](),j=5,k=(i.height+i.top+i.bottom-g.height)/2;f.translate(0,i.top),c.translate(0,i.top),d.translate(0,i.top),k>=0?b.translate(i.width+j,k):(k=-k,f.translate(0,k),c.translate(0,k),d.translate(0,k),b.translate(i.width+j,0)),this.parentExpression.expand(j,2*j),this.parentExpression.translateElement(j,j)}})}},b[51]={value:function(){var a=b.r(43),c=["M27.938,7.681l-0.576,1.2L13.969,2.976L0.576,8.88L0,7.632L13.969,0L27.938,7.681z","M49.684,8.305L49.3,9.553L24.866,2.976L0.384,9.553L0,8.305L24.866,0L49.684,8.305z","M35.763,2.976L0.288,9.601L0,8.256L35.763,0l34.995,8.113c0.672,0.144,0.72,0.192,0.72,0.288c0,0.192-0.192,0.96-0.24,1.2 L35.763,2.976z"];return a.createClass("HatOperator",{base:b.r(53),constructor:function(){this.callBase("Hat")},setType:function(a){this.opType=a},applyOperand:function(a){var b=a.getFixRenderBox(),c=this.getOperatorShape(b.width),d=3,e=null;this.addOperatorShape(c),e=c.getFixRenderBox(),c.translate((b.width-e.width)/2,0),a.translate(0,e.height),this.parentExpression.expand(d,2*d),this.parentExpression.translateElement(d,d)},getOperatorShape:function(b){var d=null;switch(this.opType){case"vec":d="M15.103,0.896c0.128,0.896,0.512,1.664,0.96,2.432c0.704,1.024,1.664,1.856,2.816,2.304 c0.448,0.192,0.704,0.448,0.704,0.896c0,0.512-0.256,0.768-0.704,0.96C17.727,8,16.767,8.768,16.063,9.855 c-0.448,0.704-0.832,1.536-0.96,2.368c-0.128,0.768-0.512,0.896-1.344,0.896c-0.576,0-1.024-0.256-1.024-1.024 c0-0.704,0.704-2.88,1.984-4.352H0.96C0.448,7.744,0,6.976,0,6.527C0,6.08,0.448,5.375,0.96,5.375h13.759 c-1.28-1.408-1.984-3.647-1.984-4.352S13.183,0,13.759,0C14.591,0,14.975,0.192,15.103,0.896z";break;case"hat":d="M12.817,6.529l-0.864,0.864L6.433,2.496L0.864,7.393L0,6.529L6.433,0L12.817,6.529z";break;case"widehat":d=50>b?c[0]:100>b?c[1]:c[2]}return new a.Path(d).fill("black")}})}},b[52]={value:function(){var a=b.r(43),c=b.r(48);return a.createClass("IntegrationOperator",{base:b.r(53),constructor:function(a){this.callBase("Integration"),this.opType=a||1},setType:function(a){this.opType=0|a},resetType:function(){this.opType=1},applyOperand:function(a,b,d){var e=this.getOperatorShape(),f=3,g=a.getFixRenderBox(),h=new c(this,e,b,d,{supOffset:3,subOffset:-15}).applySide(),i=(h.height+h.top-g.height)/2;e.translate(0,h.top),b.translate(0,h.top),d.translate(0,h.top),i>=0?a.translate(h.width+f,i):(i=-i,e.translate(0,i),b.translate(0,i),d.translate(0,i),a.translate(h.width+f,0)),this.parentExpression.expand(f,2*f),this.parentExpression.translateElement(f,f)},getOperatorShape:function(){var b="M1.318,48.226c0,0,0.044,0.066,0.134,0.134c0.292,0.313,0.626,0.447,1.006,0.447c0.246,0.022,0.358-0.044,0.604-0.268 c0.782-0.782,1.497-2.838,2.324-6.727c0.514-2.369,0.938-4.693,1.586-8.448C8.559,24.068,9.9,17.878,11.978,9.52 c0.917-3.553,1.922-7.576,3.866-8.983C16.247,0.246,16.739,0,17.274,0c1.564,0,2.503,1.162,2.592,2.57 c0,0.827-0.424,1.386-1.273,1.386c-0.671,0-1.229-0.514-1.229-1.251c0-0.805,0.514-1.095,1.185-1.274 c0.022,0-0.291-0.29-0.425-0.379c-0.201-0.134-0.514-0.224-0.737-0.224c-0.067,0-0.112,0-0.157,0.022 c-0.469,0.134-0.983,0.939-1.453,2.234c-0.537,1.475-0.961,3.174-1.631,6.548c-0.424,2.101-0.693,3.464-1.229,6.727 c-1.608,9.185-2.949,15.487-5.006,23.756c-0.514,2.034-0.849,3.24-1.207,4.335c-0.559,1.698-1.162,2.95-1.811,3.799 c-0.514,0.715-1.385,1.408-2.436,1.408c-1.363,0-2.391-1.185-2.458-2.592c0-0.804,0.447-1.363,1.273-1.363 c0.671,0,1.229,0.514,1.229,1.251C2.503,47.757,1.989,48.047,1.318,48.226z",c=new a.Group,d=new a.Group,e=new a.Path(b).fill("black"),f=new a.Rect(0,0,0,0).fill("transparent"),g=null;d.addShape(e),c.addShape(f),c.addShape(d),this.addOperatorShape(c);for(var h=1;h<this.opType;h++)g=new a.Use(e).translate(e.getWidth()/2*h,0),d.addShape(g);return d.scale(1.6),g=null,c.getBaseline=function(){return d.getFixRenderBox().height},c.getMeanline=function(){return 10},c}})}},b[53]={value:function(){var a=b.r(43),c=b.r(6);return a.createClass("Operator",{base:b.r(64),constructor:function(b){this.callBase(),this.type=c.OP,this.parentExpression=null,this.operatorName=b,this.operatorShape=new a.Group,this.addShape(this.operatorShape)},applyOperand:function(){throw new Error("applyOperand is abstract")},setParentExpression:function(a){this.parentExpression=a},getParentExpression:function(){return this.parentExpression},clearParentExpression:function(){this.parentExpression=null},addOperatorShape:function(a){return this.operatorShape.addShape(a)},getOperatorShape:function(){return this.operatorShape}})}},b[54]={value:function(){var a=b.r(43);return a.createClass("OverlineOperator",{base:b.r(53),constructor:function(){this.callBase("Overline")},applyOperand:function(a){var b=a.getFixRenderBox(),c=this.getOperatorShape(b.width),d=3,e=null;this.addOperatorShape(c),e=c.getFixRenderBox(),a.translate(0,e.height),this.parentExpression.expand(d,2*d),this.parentExpression.translateElement(d,d)},getOperatorShape:function(b){return new a.Rect(b,3).fill("black")}})}},b[55]={value:function(){var a=b.r(43),c=b.r(5);return a.createClass("PmodOperator",{base:b.r(53),constructor:function(){this.callBase("Pmod")},applyOperand:function(a){var b=a.getFixRenderBox(),c=5,d=this.createOperatorShape(b);a.translate(d.left,d.top),this.parentExpression.expand(c,2*c)},createOperatorShape:function(b){var d=new a.Path("M10.657,48.004c-0.48,0-4.608-3.12-7.489-9.025C0.528,33.555,0,27.746,0,24.002c0-4.032,0.576-9.361,3.024-14.641 C5.857,3.264,10.177,0,10.657,0c0.288,0,0.48,0.144,0.48,0.48c0,0.144,0,0.24-0.624,0.816c-5.905,6-7.729,14.354-7.729,22.706 c0,7.345,1.536,16.417,7.537,22.466c0.816,0.816,0.816,0.912,0.816,1.056C11.137,47.86,10.945,48.004,10.657,48.004z").fill("black"),e=new a.Path("M8.112,38.643C5.28,44.74,0.96,48.004,0.48,48.004c-0.288,0-0.48-0.192-0.48-0.48c0-0.144,0-0.24,0.624-0.816 c5.952-6.049,7.729-14.498,7.729-22.706c0-10.033-2.736-17.666-7.441-22.418C0,0.72,0,0.624,0,0.48C0,0.192,0.192,0,0.48,0 c0.48,0,4.608,3.12,7.488,9.024c2.641,5.425,3.168,11.233,3.168,14.978C11.137,28.034,10.561,33.363,8.112,38.643z").fill("black"),f=new c("mod","KF AMS ROMAN"),g=new a.Group,h=0,i={};g.addShape(d),g.addShape(e),g.addShape(f),this.addOperatorShape(g);var j=d.getFixRenderBox(),k=f.getFixRenderBox();return i.top=0,i.left=j.width+3+k.width+10,f.translate(j.width+3,(j.height-k.height)/2),e.translate(i.left+b.width+3,0),h=b.height-j.height,h>0?(d.translate(0,h/2),e.translate(0,h/2),f.translate(0,h/2)):i.top=-h/2,i}})}},b[56]={value:function(){var a=b.r(43),c=b.r(48);return a.createClass("ProductOperator",{base:b.r(53),constructor:function(){this.callBase("Product"),this.displayType="equation"},applyOperand:function(a,b,d){var e=this.getOperatorShape(),f=a.getFixRenderBox(),g=0,h=new c(this,e,b,d).applyUpDown(),i=(h.height-h.top-h.bottom-f.height)/2;i>=0?a.translate(h.width+g,i+h.bottom):(i=-i,e.translate(0,i),b.translate(0,i),d.translate(0,i),a.translate(h.width+g,h.bottom)),this.parentExpression.setOffset(h.top,h.bottom),this.parentExpression.expand(g,2*g),this.parentExpression.translateElement(g,g)},getOperatorShape:function(){var b="M27.842,28.898c0,1.728,0.096,2.256,3.792,2.256h1.152v1.488c-1.68-0.144-5.28-0.144-7.104-0.144s-5.376,0-7.057,0.144 v-1.488h1.152c3.696,0,3.792-0.528,3.792-2.256V1.488H9.217v27.411c0,1.728,0.096,2.256,3.792,2.256h1.152v1.488 c-1.68-0.144-5.28-0.144-7.104-0.144s-5.376,0-7.057,0.144v-1.488h1.152c3.696,0,3.792-0.528,3.792-2.256V3.744 c0-1.728-0.096-2.256-3.792-2.256H0V0h32.787v1.488h-1.152c-3.696,0-3.792,0.528-3.792,2.256V28.898z",c=new a.Path(b).fill("black"),d=new a.Rect(0,0,0,0).fill("transparent"),e=new a.Group,f=null;return e.addShape(d),e.addShape(c),c.scale(1.6),this.addOperatorShape(e),f=c.getFixRenderBox(),"inline"===this.displayType?(c.translate(5,15),d.setSize(f.width+10,f.height+25)):(c.translate(2,5),d.setSize(f.width+4,f.height+8)),e}})}},b[57]={value:function(){function a(a,b){var h=c(a),i=d(a),j=5,k=e(a);this.addOperatorShape(h),this.addOperatorShape(i),this.addOperatorShape(k),g.call(this,f(h,i,k),this.operatorShape,a,b),this.parentExpression.expand(0,2*j),this.parentExpression.translateElement(0,j)}function c(a){var b=new h.Path,c=i,d=a.getHeight()/3,e=b.getDrawer();return e.moveTo(0,l*c*6),e.lineBy(k*c,l*c),e.lineBy(l*c*3,-k*c*3),e.lineBy(m*d,d),e.lineBy(k*c*3,-l*c*3),e.lineBy(-k*d,-d),e.close(),b.fill("black")}function d(a){var b=new h.Path,c=.9*a.getHeight(),d=b.getDrawer();return d.moveTo(m*c,0),d.lineTo(0,c),d.lineBy(k*i*3,l*i*3),d.lineBy(m*c+k*i*3,-(c+3*i*l)),d.close(),b.fill("black")}function e(a){var b=a.getWidth()+2*i;return new h.Rect(b,2*i).fill("black")}function f(a,b,c){var d=a.getFixRenderBox(),e=b.getFixRenderBox();return b.translate(d.width-k*i*3,0),a.translate(0,e.height-d.height),e=b.getFixRenderBox(),c.translate(e.x+e.width-i/l,0),{x:e.x+e.width-i/l,y:0}}function g(a,b,c,d){var e=null,f={x:0,y:0},g=b.getFixRenderBox();d.scale(.66),e=d.getFixRenderBox(),e.width>0&&e.height>0&&(f.y=e.height-g.height/2,f.y<0&&(d.translate(0,-f.y),f.y=0),f.x=e.width+g.height/2*m-a.x),b.translate(f.x,f.y),c.translate(f.x+a.x+i,f.y+2*i)}var h=b.r(43),i=1,j=2*Math.PI/360,k=Math.sin(15*j),l=Math.cos(15*j),m=Math.tan(15*j);return h.createClass("RadicalOperator",{base:b.r(53),constructor:function(){this.callBase("Radical")},applyOperand:function(b,c){a.call(this,b,c)}})}},b[58]={value:function(){var a=b.r(43),c=b.r(48);return a.createClass("ScriptOperator",{base:b.r(53),constructor:function(a){this.callBase(a||"Script")},applyOperand:function(a,b,d){var e=1,f=this.parentExpression,g=new c(this,a,b,d).applySide();this.getOperatorShape(),g&&f.setOffset(g.top,g.bottom),f.expand(4,2*e),f.translateElement(2,e)}})}},b[59]={value:function(){var a=b.r(43),c=b.r(48);return a.createClass("SummationOperator",{base:b.r(53),constructor:function(){this.callBase("Summation"),this.displayType="equation"},applyOperand:function(a,b,d){var e=this.getOperatorShape(),f=a.getFixRenderBox(),g=0,h=new c(this,e,b,d).applyUpDown(),i=(h.height-h.top-h.bottom-f.height)/2;i>=0?a.translate(h.width+g,i+h.bottom):(i=-i,e.translate(0,i),b.translate(0,i),d.translate(0,i),a.translate(h.width+g,h.bottom)),this.parentExpression.setOffset(h.top,h.bottom),this.parentExpression.expand(g,2*g),this.parentExpression.translateElement(g,g)},getOperatorShape:function(){var b="M0.672,33.603c-0.432,0-0.648,0-0.648-0.264c0-0.024,0-0.144,0.24-0.432l12.433-14.569L0,0.96c0-0.264,0-0.72,0.024-0.792 C0.096,0.024,0.12,0,0.672,0h28.371l2.904,6.745h-0.6C30.531,4.8,28.898,3.72,28.298,3.336c-1.896-1.2-3.984-1.608-5.28-1.8 c-0.216-0.048-2.4-0.384-5.617-0.384H4.248l11.185,15.289c0.168,0.24,0.168,0.312,0.168,0.36c0,0.12-0.048,0.192-0.216,0.384 L3.168,31.515h14.474c4.608,0,6.96-0.624,7.464-0.744c2.76-0.72,5.305-2.352,6.241-4.848h0.6l-2.904,7.681H0.672z",c=new a.Path(b).fill("black"),d=new a.Rect(0,0,0,0).fill("transparent"),e=new a.Group,f=null;return e.addShape(d),e.addShape(c),c.scale(1.6),this.addOperatorShape(e),f=c.getFixRenderBox(),"inline"===this.displayType?(c.translate(5,15),d.setSize(f.width+10,f.height+25)):(c.translate(2,5),d.setSize(f.width+4,f.height+8)),e}})}},b[60]={value:function(){var a=b.r(43);return a.createClass("TextcircledOperator",{base:b.r(53),constructor:function(){this.callBase("Textcircled")},setType:function(a){this.opType=a},applyOperand:function(){}})}},b[61]={value:function(){var a=b.r(43),c=["M19.505,10.369H9.577c-2.88,0-7.489-1.872-7.993-9.721C1.512,0.288,1.224,0,0.792,0C0,0,0,0.576,0,1.368 c0,7.201,3.672,13.753,9.001,13.825h10.504V10.369z","M22.699,5.041c0.792-0.216,0.936-0.216,3.528-0.216h4.607C30.822,3.215,30.822,1.606,30.861,0h-5.713 c-3.313,0-4.537,0.576-6.841,2.88c-1.512,1.512-2.232,3.601-2.808,5.617C13.842,2.592,10.53,0,6.354,0H0v4.825h4.914 c2.808,0,5.112,0,7.489,2.88c2.088,2.52,2.232,5.256,2.304,6.84c0.072,0.36,0.36,0.648,0.792,0.648c0.72,0,0.72-0.432,0.792-1.152 C16.579,9.289,19.171,5.833,22.699,5.041z","M18.096,1.152c-0.288,4.537-2.592,8.065-6.265,9.001c-0.648,0.216-0.792,0.216-3.384,0.216H0.032 c-0.038,1.606-0.038,3.216-0.023,4.825h8.653c3.024,0,5.329,0,8.065-3.457c2.16-2.808,2.952-7.561,2.952-10.369 c0-0.792,0-1.368-0.792-1.368C18.167,0,18.167,0.432,18.096,1.152z"];return a.createClass("UnderbraceOperator",{base:b.r(53),constructor:function(){this.callBase("Underbrace")},applyOperand:function(a,b){var c=a.getFixRenderBox(),d=b.getFixRenderBox(),e=this.getOperatorShape(c.width),f=e.getFixRenderBox(),g=0,h=Math.max(c.width,d.width,f.width);a.translate((h-c.width)/2,g),g+=c.height+5,e.translate((h-f.width)/2,g),g+=f.height,b.translate((h-d.width)/2,g)},getOperatorShape:function(b){var d=5,e=2,f=73>b?5:5+((b-73)/2|0)+1,g=0,h=new a.Path(c[0]).fill("black"),i=new a.Path(c[1]).fill("black"),j=new a.Path(c[2]).fill("black"),k=new a.Rect(f,d).fill("black"),l=new a.Rect(f,d).fill("black"),m=[],n=new a.Group;n.addShape(h),n.addShape(i),n.addShape(j),n.addShape(k),n.addShape(l),this.addOperatorShape(n),m[0]=h.getFixRenderBox(),m[1]=i.getFixRenderBox();var o=m[0].height-d;return h.translate(0,0),g+=m[0].width-e,k.translate(g,o),g+=f-e,i.translate(g,o),g+=m[1].width-e,l.translate(g,o),g+=f-e,j.translate(g,0),n}})}},b[62]={value:function(){var a=b.r(43);return a.createClass("WideparenOperator",{base:b.r(53),constructor:function(){this.callBase("Wideparen")},applyOperand:function(b){var c="M0.527,7.805H0c0.727-1.43,1.57-2.619,2.531-3.568c1.359-1.359,2.971-2.405,4.834-3.138S11.156,0,13.148,0 c2.93,0,5.599,0.721,8.007,2.162s4.134,3.322,5.177,5.643h-0.598c-0.645-1.16-1.523-2.112-2.637-2.856s-2.522-1.301-4.228-1.67 s-3.489-0.554-5.353-0.554c-2.016,0-3.85,0.158-5.502,0.475C6.715,3.434,5.672,3.727,4.887,4.078S3.346,4.901,2.619,5.493 S1.195,6.855,0.527,7.805z",d=new a.Path(c).fill("black"),e=b.getFixRenderBox(),f=null,g=0;this.addOperatorShape(d),f=d.getFixRenderBox(),g=e.width/f.width,d.scale(g,1+g/20),f=d.getFixRenderBox(),b.translate(0,f.height)}})}},b[63]={value:function(){function a(a){a=e.Utils.extend({},g,a),/^(https?:)?\/\//.test(a.path)||(a.path=d(a.path)),new h(document,a.path).mount(c)}function c(){j=!0,e.Utils.each(f,function(a){a(i)})}function d(a){var b,c=location.pathname.split("/");return c.length-=1,c=c.join("/")+"/",b=[location.protocol,"//",location.host,c,a.replace(/^\//,"")],b.join("")}var e=b.r(43),f=[],g=b.r(65).resource,h=b.r(33),i=b.r(40),j=!1,k=!1;return{ready:function(b,c){k||(k=!0,a(c)),j?window.setTimeout(function(){b(i)},0):f.push(b)}}}},b[64]={value:function(){var a=b.r(43),c=b.r(6);return a.createClass("SignGroup",{base:a.Group,constructor:function(){this.callBase(),this.box=new a.Rect(0,0,0,0),this.type=c.UNKNOWN,this.addShape(this.box),this.zoom=1},setZoom:function(a){this.zoom=a},getZoom:function(){return this.zoom},setBoxSize:function(a,b){return this.box.setSize(a,b)},setBoxWidth:function(a){return this.box.setWidth(a)},setBoxHeight:function(a){return this.box.setHeight(a)},getType:function(){return this.type},getBaseHeight:function(){return this.getHeight()},getBaseWidth:function(){return this.getWidth()},addedCall:function(){}})}},b[65]={value:function(){return{zoom:.66,font:{meanline:Math.round(19),baseline:Math.round(40),baseHeight:50,list:[b.r(38),b.r(36),b.r(37),b.r(35),b.r(39)]},resource:{path:"src/resource/"},func:{"ud-script":{lim:!0}}}}},b[66]={value:function(){window.kf={ResourceManager:b.r(63),Operator:b.r(53),Expression:b.r(30),CompoundExpression:b.r(28),TextExpression:b.r(31),EmptyExpression:b.r(29),CombinationExpression:b.r(14),FunctionExpression:b.r(16),FractionExpression:b.r(15),IntegrationExpression:b.r(18),RadicalExpression:b.r(22),ScriptExpression:b.r(23),SuperscriptExpression:b.r(10),SubscriptExpression:b.r(9),SummationExpression:b.r(24),CasesExpression:b.r(13),HatExpression:b.r(17),TextcircledExpression:b.r(25),ProductExpression:b.r(21),PmodExpression:b.r(20),OverlineExpression:b.r(19),ArrayExpression:b.r(8),WideparenExpression:b.r(27),BracketsExpression:b.r(12),UnderbraceExpression:b.r(26)}}};var c={"kf.start":66};!function(){kity.Shape.getRenderBox;kity.extendClass(kity.Shape,{getFixRenderBox:function(){return this.getRenderBox(this.container.container)},getTranslate:function(){return this.transform.translate}});try{a("kf.start")}catch(b){}}(this)}();