var ProtoJS={Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)}};if(typeof console=="undefined"){console={log:function(){}}}ProtoJS.Event={observe:function(b,a,c){if(b.addEventListener){b.addEventListener(a,c,false)}else{b.attachEvent("on"+a,c)}return b}};ProtoJS.mix=function(b,a,d){d=d||false;for(var c in b){if(d||!a[c]){a[c]=b[c]}else{console.log("ProtoJS: Found an implementation for "+c)}}};ProtoJS.Object={isArray:function(a){a=a||this;return a!=null&&typeof a=="object"&&"splice" in a&&"join" in a},isHash:function(a){a=a||this;return a instanceof Hash},isFunction:function(a){a=a||this;return typeof a=="function"},isString:function(a){a=a||this;return typeof a=="string"},isNumber:function(a){a=a||this;return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}};ProtoJS.mix(ProtoJS.Object,Object);ProtoJS.String={contains:function(a){return this.indexOf(a)>-1},trim:function(a){if(typeof this.replace=="function"){a=this}return a.replace(/^\s*/,"").replace(/\s*$/,"")},isArray:function(){return false},isHash:function(){return false},isFunction:function(){return false},isString:function(){return true},isNumber:function(){return false}};ProtoJS.mix(ProtoJS.String,String.prototype);ProtoJS.Number={isArray:function(){return false},isHash:function(){return false},isFunction:function(){return false},isString:function(){return false},isNumber:function(){return true}};ProtoJS.mix(ProtoJS.Number,Number.prototype);(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(h){var g=this.prototype;a=true;var f=new this();a=false;f.isArray=function(){return false};f.isHash=function(){return false};f.isFunction=function(){return false};f.isNumber=function(){return false};f.isString=function(){return false};function c(k,l){return function(){var n=this._super;this._super=g[k];var m=l.apply(this,arguments);this._super=n;return m}}for(var e in h){f[e]=typeof h[e]=="function"&&typeof g[e]=="function"&&b.test(h[e])?c(e,h[e]):h[e]}if(ProtoJS.Browser.IE&&h.toString){f.toString=c("toString",h.toString)}function d(){if(!a&&this.init){this.init.apply(this,arguments)}}function d(){if(!a&&this.init){this.init.apply(this,arguments)}}d.prototype=f;d.constructor=d;d.extend=arguments.callee;return d}})();ProtoJS.Array={compare:function(a){if(this.length!=a.length){return false}for(var b=0;b<a.length;b++){if(this[b].compare){if(!this[b].compare(a[b])){return false}}if(this[b]!==a[b]){return false}}return true},has:function(a){return this.indexOf(a)>-1},unique:function unique(){var a=this.dup();this.clear();a.iterate(function(b){if(!this.has(b)){this.push(b)}}.scope(this));return this},iterate:function(c,b){for(var a=0,d=this.length;a<d;a++){c.call(b,this[a],a)}},dup:function(){return[].concat(this)},clear:function(){this.length=0;return this},remove:function(){var b=$A(arguments);var a=this.dup();this.clear();a.iterate(function(c){if(!b.has(c)){this.push(c)}}.scope(this));return this},isArray:function(){return true},isHash:function(){return false},isFunction:function(){return false},isString:function(){return false},isNumber:function(){return false}};ProtoJS.mix(ProtoJS.Array,Array.prototype);function $A(a){var c=a.length||0;var b=new Array(c);while(c--){b[c]=a[c]}return b}var Hash=Class.extend({init:function init(a){this.hash=a||{}},set:function(a,b){this.hash[a]=b},get:function(a){return this.hash[a]},keys:function keys(){var a=[];this.iterate(function(b,c){a.push(b)});return a},values:function values(){var a=[];this.iterate(function(b,c){a.push(c)});return a},hasKey:function has(a){return this.keys().has(a)},hasValue:function has(a){return this.values().has(a)},iterate:function each(c,b){for(var a in this.hash){c.call(b,a,this.hash[a])}},isArray:function(){return false},isHash:function(){return true},isFunction:function(){return false},isString:function(){return false},isNumber:function(){return false}});var $H=function(a){return new Hash(a)};ProtoJS.Function={after:function(){var c=this;var a=$A(arguments);var b=a.shift();return window.setTimeout(function(){return c.apply(c,a)},b)},scope:function scope(a){var b=this;return function(){return b.apply(a,arguments)}},isArray:function(){return false},isHash:function(){return false},isFunction:function(){return true},isString:function(){return false},isNumber:function(){return false}};ProtoJS.mix(ProtoJS.Function,Function.prototype);ProtoJS.Ajax=Class.extend({init:function(){this.xmlhttp=null;if(window.XMLHttpRequest){this.xmlhttp=new XMLHttpRequest()}else{if(window.ActiveXObject){this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}else{alert("Your browser does not support XMLHTTP!")}}},fetch:function(a,b){if(a.substring(0,4)=="http"){return this.fetchUsingXDR(a,b)}this.xmlhttp.open("GET",a,typeof b=="function");if(b){this.xmlhttp.onreadystatechange=function(){b.call(this,this.xmlhttp)}.scope(this)}this.xmlhttp.send(null);return this.xmlhttp.responseText},fetchUsingXDR:function(a,d){ProtoJS.XDR.push(d);var b=document.createElement("script");var c=a.contains("?")?"&":"?";b.src=a+c+"f=ProtoJS.XDR["+(ProtoJS.XDR.length-1)+"]";b.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(b)}});ProtoJS.XDR=[];ProtoJS.version="0.1-7";if(!document.createElement("canvas").getContext){(function(){var Y=Math;var n=Y.round;var l=Y.sin;var A=Y.cos;var G=Y.abs;var M=Y.sqrt;var d=10;var f=d/2;var z=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function y(){return this.context_||(this.context_=new C(this))}var s=Array.prototype.slice;function g(p,Z,ae){var m=s.call(arguments,2);return function(){return p.apply(Z,m.concat(s.call(arguments)))}}function ad(m){return String(m).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function W(Z,p,m){if(!Z.namespaces[p]){if(z>=7){Z.namespaces.add(p,m).doImport("#default#VML")}else{Z.namespaces.add(p,m)}}}function Q(p){W(p,"g_vml_","urn:schemas-microsoft-com:vml");W(p,"g_o_","urn:schemas-microsoft-com:office:office");if(!p.styleSheets.ex_canvas_){var m=p.createStyleSheet();m.owningElement.id="ex_canvas_";m.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}Q(document);var e={init:function(m){var p=m||document;p.createElement("canvas");p.attachEvent("onreadystatechange",g(this.init_,this,p))},init_:function(Z){var p=Z.getElementsByTagName("canvas");for(var m=0;m<p.length;m++){this.initElement(p[m])}},initElement:function(p){if(!p.getContext){p.getContext=y;Q(p.ownerDocument);p.innerHTML="";p.attachEvent("onpropertychange",x);p.attachEvent("onresize",U);var m=p.attributes;if(m.width&&m.width.specified){p.style.width=m.width.nodeValue+"px"}else{p.width=p.clientWidth}if(m.height&&m.height.specified){p.style.height=m.height.nodeValue+"px"}else{p.height=p.clientHeight}}return p}};function x(p){var m=p.srcElement;switch(p.propertyName){case"width":m.getContext().clearRect();m.style.width=m.attributes.width.nodeValue+"px";m.firstChild.style.width=m.clientWidth+"px";break;case"height":m.getContext().clearRect();m.style.height=m.attributes.height.nodeValue+"px";m.firstChild.style.height=m.clientHeight+"px";break}}function U(p){var m=p.srcElement;if(m.firstChild){m.firstChild.style.width=m.clientWidth+"px";m.firstChild.style.height=m.clientHeight+"px"}}e.init();var k=[];for(var ac=0;ac<16;ac++){for(var ab=0;ab<16;ab++){k[ac*16+ab]=ac.toString(16)+ab.toString(16)}}function B(){return[[1,0,0],[0,1,0],[0,0,1]]}function I(ae,Z){var p=B();for(var m=0;m<3;m++){for(var ah=0;ah<3;ah++){var af=0;for(var ag=0;ag<3;ag++){af+=ae[m][ag]*Z[ag][ah]}p[m][ah]=af}}return p}function v(p,m){m.fillStyle=p.fillStyle;m.lineCap=p.lineCap;m.lineJoin=p.lineJoin;m.lineWidth=p.lineWidth;m.miterLimit=p.miterLimit;m.shadowBlur=p.shadowBlur;m.shadowColor=p.shadowColor;m.shadowOffsetX=p.shadowOffsetX;m.shadowOffsetY=p.shadowOffsetY;m.strokeStyle=p.strokeStyle;m.globalAlpha=p.globalAlpha;m.font=p.font;m.textAlign=p.textAlign;m.textBaseline=p.textBaseline;m.arcScaleX_=p.arcScaleX_;m.arcScaleY_=p.arcScaleY_;m.lineScale_=p.lineScale_}var b={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",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",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",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",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"};function L(p){var ae=p.indexOf("(",3);var m=p.indexOf(")",ae+1);var Z=p.substring(ae+1,m).split(",");if(Z.length!=4||p.charAt(3)!="a"){Z[3]=1}return Z}function c(m){return parseFloat(m)/100}function r(p,Z,m){return Math.min(m,Math.max(Z,p))}function H(ag){var m,ai,aj,ah,ak,af;ah=parseFloat(ag[0])/360%360;if(ah<0){ah++}ak=r(c(ag[1]),0,1);af=r(c(ag[2]),0,1);if(ak==0){m=ai=aj=af}else{var Z=af<0.5?af*(1+ak):af+ak-af*ak;var ae=2*af-Z;m=a(ae,Z,ah+1/3);ai=a(ae,Z,ah);aj=a(ae,Z,ah-1/3)}return"#"+k[Math.floor(m*255)]+k[Math.floor(ai*255)]+k[Math.floor(aj*255)]}function a(p,m,Z){if(Z<0){Z++}if(Z>1){Z--}if(6*Z<1){return p+(m-p)*6*Z}else{if(2*Z<1){return m}else{if(3*Z<2){return p+(m-p)*(2/3-Z)*6}else{return p}}}}function E(m){var af,ae=1;m=String(m);if(m.charAt(0)=="#"){af=m}else{if(/^rgb/.test(m)){var Z=L(m);var af="#",ag;for(var p=0;p<3;p++){if(Z[p].indexOf("%")!=-1){ag=Math.floor(c(Z[p])*255)}else{ag=+Z[p]}af+=k[r(ag,0,255)]}ae=+Z[3]}else{if(/^hsl/.test(m)){var Z=L(m);af=H(Z);ae=Z[3]}else{af=b[m]||m}}}return{color:af,alpha:ae}}var o={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"};var K={};function D(m){if(K[m]){return K[m]}var ae=document.createElement("div");var Z=ae.style;try{Z.font=m}catch(p){}return K[m]={style:Z.fontStyle||o.style,variant:Z.fontVariant||o.variant,weight:Z.fontWeight||o.weight,size:Z.fontSize||o.size,family:Z.fontFamily||o.family}}function u(ae,Z){var m={};for(var ah in ae){m[ah]=ae[ah]}var ag=parseFloat(Z.currentStyle.fontSize),af=parseFloat(ae.size);if(typeof ae.size=="number"){m.size=ae.size}else{if(ae.size.indexOf("px")!=-1){m.size=af}else{if(ae.size.indexOf("em")!=-1){m.size=ag*af}else{if(ae.size.indexOf("%")!=-1){m.size=(ag/100)*af}else{if(ae.size.indexOf("pt")!=-1){m.size=af/0.75}else{m.size=ag}}}}}m.size*=0.981;return m}function aa(m){return m.style+" "+m.variant+" "+m.weight+" "+m.size+"px "+m.family}function R(m){switch(m){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function C(m){this.m_=B();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=d*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=m;var Z="width:"+m.clientWidth+"px;height:"+m.clientHeight+"px;overflow:hidden;position:absolute";var p=m.ownerDocument.createElement("div");p.style.cssText=Z;m.appendChild(p);var ae=p.cloneNode(false);ae.style.backgroundColor="red";ae.style.filter="alpha(opacity=0)";m.appendChild(ae);this.element_=p;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var q=C.prototype;q.clearRect=function(){if(this.textMeasureEl_){this.textMeasureEl_.removeNode(true);this.textMeasureEl_=null}this.element_.innerHTML=""};q.beginPath=function(){this.currentPath_=[]};q.moveTo=function(Z,m){var ae=this.getCoords_(Z,m);this.currentPath_.push({type:"moveTo",x:ae.x,y:ae.y});this.currentX_=ae.x;this.currentY_=ae.y};q.lineTo=function(Z,m){var ae=this.getCoords_(Z,m);this.currentPath_.push({type:"lineTo",x:ae.x,y:ae.y});this.currentX_=ae.x;this.currentY_=ae.y};q.bezierCurveTo=function(ae,Z,ak,aj,ai,ag){var m=this.getCoords_(ai,ag);var ah=this.getCoords_(ae,Z);var af=this.getCoords_(ak,aj);J(this,ah,af,m)};function J(m,af,ae,Z){m.currentPath_.push({type:"bezierCurveTo",cp1x:af.x,cp1y:af.y,cp2x:ae.x,cp2y:ae.y,x:Z.x,y:Z.y});m.currentX_=Z.x;m.currentY_=Z.y}q.quadraticCurveTo=function(ai,ae,Z,m){var ah=this.getCoords_(ai,ae);var ag=this.getCoords_(Z,m);var aj={x:this.currentX_+2/3*(ah.x-this.currentX_),y:this.currentY_+2/3*(ah.y-this.currentY_)};var af={x:aj.x+(ag.x-this.currentX_)/3,y:aj.y+(ag.y-this.currentY_)/3};J(this,aj,af,ag)};q.arc=function(al,aj,ak,ag,Z,ae){ak*=d;var ap=ae?"at":"wa";var am=al+A(ag)*ak-f;var ao=aj+l(ag)*ak-f;var m=al+A(Z)*ak-f;var an=aj+l(Z)*ak-f;if(am==m&&!ae){am+=0.125}var af=this.getCoords_(al,aj);var ai=this.getCoords_(am,ao);var ah=this.getCoords_(m,an);this.currentPath_.push({type:ap,x:af.x,y:af.y,radius:ak,xStart:ai.x,yStart:ai.y,xEnd:ah.x,yEnd:ah.y})};q.rect=function(Z,p,m,ae){this.moveTo(Z,p);this.lineTo(Z+m,p);this.lineTo(Z+m,p+ae);this.lineTo(Z,p+ae);this.closePath()};q.strokeRect=function(Z,p,m,ae){var af=this.currentPath_;this.beginPath();this.moveTo(Z,p);this.lineTo(Z+m,p);this.lineTo(Z+m,p+ae);this.lineTo(Z,p+ae);this.closePath();this.stroke();this.currentPath_=af};q.fillRect=function(Z,p,m,ae){var af=this.currentPath_;this.beginPath();this.moveTo(Z,p);this.lineTo(Z+m,p);this.lineTo(Z+m,p+ae);this.lineTo(Z,p+ae);this.closePath();this.fill();this.currentPath_=af};q.createLinearGradient=function(p,ae,m,Z){var af=new T("gradient");af.x0_=p;af.y0_=ae;af.x1_=m;af.y1_=Z;return af};q.createRadialGradient=function(ae,ag,Z,p,af,m){var ah=new T("gradientradial");ah.x0_=ae;ah.y0_=ag;ah.r0_=Z;ah.x1_=p;ah.y1_=af;ah.r1_=m;return ah};q.drawImage=function(aq,Z){var aj,ah,al,ay,ao,am,at,aA;var ak=aq.runtimeStyle.width;var ap=aq.runtimeStyle.height;aq.runtimeStyle.width="auto";aq.runtimeStyle.height="auto";var ai=aq.width;var aw=aq.height;aq.runtimeStyle.width=ak;aq.runtimeStyle.height=ap;if(arguments.length==3){aj=arguments[1];ah=arguments[2];ao=am=0;at=al=ai;aA=ay=aw}else{if(arguments.length==5){aj=arguments[1];ah=arguments[2];al=arguments[3];ay=arguments[4];ao=am=0;at=ai;aA=aw}else{if(arguments.length==9){ao=arguments[1];am=arguments[2];at=arguments[3];aA=arguments[4];aj=arguments[5];ah=arguments[6];al=arguments[7];ay=arguments[8]}else{throw Error("Invalid number of arguments")}}}var az=this.getCoords_(aj,ah);var ae=at/2;var p=aA/2;var ax=[];var m=10;var ag=10;ax.push(" <g_vml_:group",' coordsize="',d*m,",",d*ag,'"',' coordorigin="0,0"',' style="width:',m,"px;height:",ag,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var af=[];af.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",n(az.x/d),",","Dy=",n(az.y/d),"");var av=az;var au=this.getCoords_(aj+al,ah);var ar=this.getCoords_(aj,ah+ay);var an=this.getCoords_(aj+al,ah+ay);av.x=Y.max(av.x,au.x,ar.x,an.x);av.y=Y.max(av.y,au.y,ar.y,an.y);ax.push("padding:0 ",n(av.x/d),"px ",n(av.y/d),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",af.join(""),", sizingmethod='clip');")}else{ax.push("top:",n(az.y/d),"px;left:",n(az.x/d),"px;")}ax.push(' ">','<g_vml_:image src="',aq.src,'"',' style="width:',d*al,"px;"," height:",d*ay,'px"',' cropleft="',ao/ai,'"',' croptop="',am/aw,'"',' cropright="',(ai-ao-at)/ai,'"',' cropbottom="',(aw-am-aA)/aw,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",ax.join(""))};q.stroke=function(ak){var ai=[];var ae=false;var Z=10;var al=10;ai.push("<g_vml_:shape",' filled="',!!ak,'"',' style="position:absolute;width:',Z,"px;height:",al,'px;"',' coordorigin="0,0"',' coordsize="',d*Z,",",d*al,'"',' stroked="',!ak,'"',' path="');var am=false;var af={x:null,y:null};var aj={x:null,y:null};for(var ag=0;ag<this.currentPath_.length;ag++){var m=this.currentPath_[ag];var ah;switch(m.type){case"moveTo":ah=m;ai.push(" m ",n(m.x),",",n(m.y));break;case"lineTo":ai.push(" l ",n(m.x),",",n(m.y));break;case"close":ai.push(" x ");m=null;break;case"bezierCurveTo":ai.push(" c ",n(m.cp1x),",",n(m.cp1y),",",n(m.cp2x),",",n(m.cp2y),",",n(m.x),",",n(m.y));break;case"at":case"wa":ai.push(" ",m.type," ",n(m.x-this.arcScaleX_*m.radius),",",n(m.y-this.arcScaleY_*m.radius)," ",n(m.x+this.arcScaleX_*m.radius),",",n(m.y+this.arcScaleY_*m.radius)," ",n(m.xStart),",",n(m.yStart)," ",n(m.xEnd),",",n(m.yEnd));break}if(m){if(af.x==null||m.x<af.x){af.x=m.x}if(aj.x==null||m.x>aj.x){aj.x=m.x}if(af.y==null||m.y<af.y){af.y=m.y}if(aj.y==null||m.y>aj.y){aj.y=m.y}}}ai.push(' ">');if(!ak){w(this,ai)}else{F(this,ai,af,aj)}ai.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",ai.join(""))};function w(Z,ag){var p=E(Z.strokeStyle);var ae=p.color;var af=p.alpha*Z.globalAlpha;var m=Z.lineScale_*Z.lineWidth;if(m<1){af*=m}ag.push("<g_vml_:stroke",' opacity="',af,'"',' joinstyle="',Z.lineJoin,'"',' miterlimit="',Z.miterLimit,'"',' endcap="',R(Z.lineCap),'"',' weight="',m,'px"',' color="',ae,'" />')}function F(ap,ah,aJ,aq){var ai=ap.fillStyle;var aA=ap.arcScaleX_;var az=ap.arcScaleY_;var m=aq.x-aJ.x;var Z=aq.y-aJ.y;if(ai instanceof T){var am=0;var aE={x:0,y:0};var aw=0;var al=1;if(ai.type_=="gradient"){var ak=ai.x0_/aA;var p=ai.y0_/az;var aj=ai.x1_/aA;var aL=ai.y1_/az;var aI=ap.getCoords_(ak,p);var aH=ap.getCoords_(aj,aL);var af=aH.x-aI.x;var ae=aH.y-aI.y;am=Math.atan2(af,ae)*180/Math.PI;if(am<0){am+=360}if(am<0.000001){am=0}}else{var aI=ap.getCoords_(ai.x0_,ai.y0_);aE={x:(aI.x-aJ.x)/m,y:(aI.y-aJ.y)/Z};m/=aA*d;Z/=az*d;var aC=Y.max(m,Z);aw=2*ai.r0_/aC;al=2*ai.r1_/aC-aw}var au=ai.colors_;au.sort(function(aN,aM){return aN.offset-aM.offset});var ao=au.length;var at=au[0].color;var ar=au[ao-1].color;var ay=au[0].alpha*ap.globalAlpha;var ax=au[ao-1].alpha*ap.globalAlpha;var aD=[];for(var aG=0;aG<ao;aG++){var an=au[aG];aD.push(an.offset*al+aw+" "+an.color)}ah.push('<g_vml_:fill type="',ai.type_,'"',' method="none" focus="100%"',' color="',at,'"',' color2="',ar,'"',' colors="',aD.join(","),'"',' opacity="',ax,'"',' g_o_:opacity2="',ay,'"',' angle="',am,'"',' focusposition="',aE.x,",",aE.y,'" />')}else{if(ai instanceof S){if(m&&Z){var ag=-aJ.x;var aB=-aJ.y;ah.push("<g_vml_:fill",' position="',ag/m*aA*aA,",",aB/Z*az*az,'"',' type="tile"',' src="',ai.src_,'" />')}}else{var aK=E(ap.fillStyle);var av=aK.color;var aF=aK.alpha*ap.globalAlpha;ah.push('<g_vml_:fill color="',av,'" opacity="',aF,'" />')}}}q.fill=function(){this.stroke(true)};q.closePath=function(){this.currentPath_.push({type:"close"})};q.getCoords_=function(ae,Z){var p=this.m_;return{x:d*(ae*p[0][0]+Z*p[1][0]+p[2][0])-f,y:d*(ae*p[0][1]+Z*p[1][1]+p[2][1])-f}};q.save=function(){var m={};v(this,m);this.aStack_.push(m);this.mStack_.push(this.m_);this.m_=I(B(),this.m_)};q.restore=function(){if(this.aStack_.length){v(this.aStack_.pop(),this);this.m_=this.mStack_.pop()}};function h(p){return isFinite(p[0][0])&&isFinite(p[0][1])&&isFinite(p[1][0])&&isFinite(p[1][1])&&isFinite(p[2][0])&&isFinite(p[2][1])}function X(Z,p,ae){if(!h(p)){return}Z.m_=p;if(ae){var af=p[0][0]*p[1][1]-p[0][1]*p[1][0];Z.lineScale_=M(G(af))}}q.translate=function(Z,p){var m=[[1,0,0],[0,1,0],[Z,p,1]];X(this,I(m,this.m_),false)};q.rotate=function(p){var ae=A(p);var Z=l(p);var m=[[ae,Z,0],[-Z,ae,0],[0,0,1]];X(this,I(m,this.m_),false)};q.scale=function(Z,p){this.arcScaleX_*=Z;this.arcScaleY_*=p;var m=[[Z,0,0],[0,p,0],[0,0,1]];X(this,I(m,this.m_),true)};q.transform=function(af,ae,ah,ag,p,m){var Z=[[af,ae,0],[ah,ag,0],[p,m,1]];X(this,I(Z,this.m_),true)};q.setTransform=function(ag,af,ai,ah,ae,Z){var p=[[ag,af,0],[ai,ah,0],[ae,Z,1]];X(this,p,true)};q.drawText_=function(am,ak,aj,ap,ai){var ao=this.m_,at=1000,Z=0,ar=at,ah={x:0,y:0},ag=[];var p=u(D(this.font),this.element_);var ae=aa(p);var au=this.element_.currentStyle;var af=this.textAlign.toLowerCase();switch(af){case"left":case"center":case"right":break;case"end":af=au.direction=="ltr"?"right":"left";break;case"start":af=au.direction=="rtl"?"right":"left";break;default:af="left"}switch(this.textBaseline){case"hanging":case"top":ah.y=p.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":ah.y=-p.size/2.25;break}switch(af){case"right":Z=at;ar=0.05;break;case"center":Z=ar=at/2;break}var aq=this.getCoords_(ak+ah.x,aj+ah.y);ag.push('<g_vml_:line from="',-Z,' 0" to="',ar,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!ai,'" stroked="',!!ai,'" style="position:absolute;width:1px;height:1px;">');if(ai){w(this,ag)}else{F(this,ag,{x:-Z,y:0},{x:ar,y:p.size})}var an=ao[0][0].toFixed(3)+","+ao[1][0].toFixed(3)+","+ao[0][1].toFixed(3)+","+ao[1][1].toFixed(3)+",0,0";var al=n(aq.x/d)+","+n(aq.y/d);ag.push('<g_vml_:skew on="t" matrix="',an,'" ',' offset="',al,'" origin="',Z,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',ad(am),'" style="v-text-align:',af,";font:",ad(ae),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",ag.join(""))};q.fillText=function(Z,m,ae,p){this.drawText_(Z,m,ae,p,false)};q.strokeText=function(Z,m,ae,p){this.drawText_(Z,m,ae,p,true)};q.measureText=function(Z){if(!this.textMeasureEl_){var m='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",m);this.textMeasureEl_=this.element_.lastChild}var p=this.element_.ownerDocument;this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(p.createTextNode(Z));return{width:this.textMeasureEl_.offsetWidth}};q.clip=function(){};q.arcTo=function(){};q.createPattern=function(p,m){return new S(p,m)};function T(m){this.type_=m;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}T.prototype.addColorStop=function(p,m){m=E(m);this.colors_.push({offset:p,color:m.color,alpha:m.alpha})};function S(p,m){P(p);switch(m){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=m;break;default:N("SYNTAX_ERR")}this.src_=p.src;this.width_=p.width;this.height_=p.height}function N(m){throw new O(m)}function P(m){if(!m||m.nodeType!=1||m.tagName!="IMG"){N("TYPE_MISMATCH_ERR")}if(m.readyState!="complete"){N("INVALID_STATE_ERR")}}function O(m){this.code=this[m];this.message=m+": DOM Exception "+this.code}var V=O.prototype=new Error;V.INDEX_SIZE_ERR=1;V.DOMSTRING_SIZE_ERR=2;V.HIERARCHY_REQUEST_ERR=3;V.WRONG_DOCUMENT_ERR=4;V.INVALID_CHARACTER_ERR=5;V.NO_DATA_ALLOWED_ERR=6;V.NO_MODIFICATION_ALLOWED_ERR=7;V.NOT_FOUND_ERR=8;V.NOT_SUPPORTED_ERR=9;V.INUSE_ATTRIBUTE_ERR=10;V.INVALID_STATE_ERR=11;V.SYNTAX_ERR=12;V.INVALID_MODIFICATION_ERR=13;V.NAMESPACE_ERR=14;V.INVALID_ACCESS_ERR=15;V.VALIDATION_ERR=16;V.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=e;CanvasRenderingContext2D=C;CanvasGradient=T;CanvasPattern=S;DOMException=O})()}var CanvasTextFunctions={};CanvasTextFunctions.letters={" ":{width:16,points:[]},"!":{width:10,points:[[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]]},'"':{width:16,points:[[4,21],[4,14],[-1,-1],[12,21],[12,14]]},"#":{width:21,points:[[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]]},"$":{width:20,points:[[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},"%":{width:24,points:[[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]]},"&":{width:26,points:[[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]]},"'":{width:10,points:[[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]]},"(":{width:14,points:[[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]]},")":{width:14,points:[[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]]},"*":{width:16,points:[[8,21],[8,9],[-1,-1],[3,18],[13,12],[-1,-1],[13,18],[3,12]]},"+":{width:26,points:[[13,18],[13,0],[-1,-1],[4,9],[22,9]]},",":{width:10,points:[[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"-":{width:26,points:[[4,9],[22,9]]},".":{width:10,points:[[5,2],[4,1],[5,0],[6,1],[5,2]]},"/":{width:22,points:[[20,25],[2,-7]]},"0":{width:20,points:[[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]]},"1":{width:20,points:[[6,17],[8,18],[11,21],[11,0]]},"2":{width:20,points:[[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]]},"3":{width:20,points:[[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},"4":{width:20,points:[[13,21],[3,7],[18,7],[-1,-1],[13,21],[13,0]]},"5":{width:20,points:[[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},"6":{width:20,points:[[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]]},"7":{width:20,points:[[17,21],[7,0],[-1,-1],[3,21],[17,21]]},"8":{width:20,points:[[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]]},"9":{width:20,points:[[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]]},":":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]]},",":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"<":{width:24,points:[[20,18],[4,9],[20,0]]},"=":{width:26,points:[[4,12],[22,12],[-1,-1],[4,6],[22,6]]},">":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],[-1,-1],[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],[-1,-1],[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],[-1,-1],[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],[-1,-1],[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]]},"^":{width:16,points:[[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],[-1,-1],[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]}};CanvasTextFunctions.letter=function(a){return CanvasTextFunctions.letters[a]};CanvasTextFunctions.ascent=function(a,b){return b};CanvasTextFunctions.descent=function(a,b){return 7*b/25};CanvasTextFunctions.measure=function(b,d,f){var e=0;var a=f.length;for(i=0;i<a;i++){var g=CanvasTextFunctions.letter(f.charAt(i));if(g){e+=g.width*d/25}}return e};CanvasTextFunctions.italics={};CanvasTextFunctions.makeItalic=function(g,h,f){if(!CanvasTextFunctions.italics[g]){var d=[];for(var e=0;e<h.points.length;e++){var b=h.points[e];if(b[0]!=-1&&b[1]!=-1){d[e]=[b[0]+(b[1]/3),b[1]]}else{d[e]=[-1,-1]}}CanvasTextFunctions.italics[g]={width:h.width,points:d}}return CanvasTextFunctions.italics[g]};CanvasTextFunctions.draw=function(q,d,r,p,m,l){var n=0;var h=l.length;var f=r/25;q.save();q.lineCap="round";q.lineWidth=2*f;for(i=0;i<h;i++){var g=l.charAt(i);var k=CanvasTextFunctions.letter(g);if(!k){continue}if(d.toLowerCase().indexOf("italic")>-1){k=CanvasTextFunctions.makeItalic(g,k,r)}q.beginPath();var e=1;var b=0;for(j=0;j<k.points.length;j++){var o=k.points[j];if(o[0]==-1&&o[1]==-1){e=1;continue}if(e){q.moveTo(p+o[0]*f,m-o[1]*f);e=false}else{q.lineTo(p+o[0]*f,m-o[1]*f)}}q.stroke();p+=k.width*f}q.restore();return n};CanvasTextFunctions.enable=function(a){a.drawText=function(c,d,b,f,e){return CanvasTextFunctions.draw(a,c,d,b,f,e)};a.measureText=function(b,c,d){return CanvasTextFunctions.measure(b,c,d)};a.fontAscent=function(b,c){return CanvasTextFunctions.ascent(b,c)};a.fontDescent=function(b,c){return CanvasTextFunctions.descent(b,c)};a.drawTextRight=function(d,e,b,g,f){var c=CanvasTextFunctions.measure(d,e,f);return CanvasTextFunctions.draw(a,d,e,b-c,g,f)};a.drawTextCenter=function(d,e,b,g,f){var c=CanvasTextFunctions.measure(d,e,f);return CanvasTextFunctions.draw(a,d,e,b-c/2,g,f)}};var ADL={};ADL.Boolean=Class.extend({value:null,init:function(a){this.value=a=="true"?true:false},toString:function(){return this.value?"true":"false"}});ADL.Integer=Class.extend({value:null,init:function(a){this.value=a},toString:function(){return this.value}});ADL.String=Class.extend({value:null,init:function(a){this.value=a},toString:function(){return'"'+this.value+'"'}});ADL.Annotation=Class.extend({data:null,init:function(a){this.data=a},toString:function(){return"[@"+this.data+"]"}});ADL.Multiplicity=Class.extend({low:null,high:null,init:function(a,b){this.low=a;this.high=b},toString:function(){return"["+this.low+(this.high?".."+this.high:"")+"]"}});ADL.Reference=Class.extend({constructName:null,multiplicity:null,init:function(a,b){this.constructName=a;this.multiplicity=b},toString:function(){return this.constructName+(this.multiplicity?this.multiplicity.toString():"")}});ADL.Modifier=Class.extend({key:null,value:null,init:function(a,b){this.key=a;this.value=b},toString:function(){return"+"+this.key+(this.value?"="+this.value.toString():"")}});ADL.Construct=Class.extend({init:function(b,a){this.annotation=null;this.type=b;this.name=a;this.value=null;this.supers=new Array();this.modifiers=new Hash();this.children=new Array()},toString:function(c){c=c||"";var a=new Array();this.modifiers.iterate(function(d,e){a.push(e.toString())});var b=new Array();this.children.iterate(function(d){b.push(d.toString("  "+c))});return(this.annotation?c+this.annotation.toString()+"\n":"")+c+this.type+" "+this.name+(this.supers.length>0?" : "+this.supers.join(" : "):"")+(a.length>0?" "+a.join(" "):"")+(this.value?" = "+this.value:"")+(b.length>0?" {\n"+b.join("\n")+"\n"+c+"}":";")},accept:function(b,a){return b.visit(this,a)},childrenAccept:function(b,a){this.children.iterate(function(c){b.visit(c,a)});return a}});ADL.include=function(b){var a=new ProtoJS.Ajax().fetch(b.value+".adl");return new ADL.Parser().parse(a).getChildren()};ADL.createConstruct=function(a,g,d,f,b,h,e){var k=new ADL.Construct(g,d);if(a){k.annotation=a}if(f){k.supers=f}if(Object.isArray(b)){b.iterate(function(c){k.modifiers.set(c.key,c)})}if(h){k.value=h}if(Object.isArray(e)){k.children=e}return k};ADL.AST=Class.extend({root:ADL.createConstruct("","root",""),init:function(a){this.root.children=a},getRoot:function(){return this.root},getChildren:function(){return this.root.children}});ADL.ast=null;ADL.Parser=Class.extend({parse:function(d){var f=0;var c=new Array();var a=new Array();ADL.ast=null;if((f=__parse(d,c,a))>0){var b;var e="";for(b=0;b<f;b++){e+="Parse error: "+d.substr(c[b],30)+'. Expecting "'+a[b].join()+"\n"}this.errors=e;return null}this.errors="";return ADL.ast}});function makeList(){var b=new Array();if(arguments){for(var a=0;a<arguments.length;a++){if(Object.isArray(arguments[a])){for(var c=0;c<arguments[a].length;c++){if(arguments[a][c]){b.push(arguments[a][c])}}}else{if(arguments[a]){b.push(arguments[a])}}}}return b}var _dbg_withtrace=false;var _dbg_string=new String();function __dbg_print(a){_dbg_string+=a+"\n"}function __lex(d){var c=0;var a=-1;var b=0;var f=0;var e=d.offset+1;do{e--;c=0;a=-2;f=e;if(d.src.length<=f){return 50}do{switch(c){case 0:if((d.src.charCodeAt(e)>=9&&d.src.charCodeAt(e)<=10)||d.src.charCodeAt(e)==13||d.src.charCodeAt(e)==32){c=1}else{if(d.src.charCodeAt(e)==40){c=2}else{if(d.src.charCodeAt(e)==41){c=3}else{if(d.src.charCodeAt(e)==42){c=4}else{if(d.src.charCodeAt(e)==43){c=5}else{if(d.src.charCodeAt(e)==44){c=6}else{if(d.src.charCodeAt(e)==45){c=7}else{if(d.src.charCodeAt(e)==46){c=8}else{if(d.src.charCodeAt(e)==47){c=9}else{if(d.src.charCodeAt(e)==48){c=10}else{if(d.src.charCodeAt(e)==58){c=11}else{if(d.src.charCodeAt(e)==59){c=12}else{if(d.src.charCodeAt(e)==60){c=13}else{if(d.src.charCodeAt(e)==61){c=14}else{if(d.src.charCodeAt(e)==62){c=15}else{if((d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=101)||(d.src.charCodeAt(e)>=103&&d.src.charCodeAt(e)<=115)||(d.src.charCodeAt(e)>=117&&d.src.charCodeAt(e)<=122)){c=16}else{if(d.src.charCodeAt(e)==91){c=17}else{if(d.src.charCodeAt(e)==93){c=18}else{if(d.src.charCodeAt(e)==123){c=19}else{if(d.src.charCodeAt(e)==124){c=20}else{if(d.src.charCodeAt(e)==125){c=21}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=8)||(d.src.charCodeAt(e)>=11&&d.src.charCodeAt(e)<=12)||(d.src.charCodeAt(e)>=14&&d.src.charCodeAt(e)<=31)||(d.src.charCodeAt(e)>=36&&d.src.charCodeAt(e)<=39)||(d.src.charCodeAt(e)>=63&&d.src.charCodeAt(e)<=64)||d.src.charCodeAt(e)==92||d.src.charCodeAt(e)==94||d.src.charCodeAt(e)==96||(d.src.charCodeAt(e)>=126&&d.src.charCodeAt(e)<=254)){c=30}else{if(d.src.charCodeAt(e)==102){c=31}else{if((d.src.charCodeAt(e)>=49&&d.src.charCodeAt(e)<=57)){c=32}else{if(d.src.charCodeAt(e)==33){c=35}else{if(d.src.charCodeAt(e)==34){c=39}else{if(d.src.charCodeAt(e)==35){c=42}else{if(d.src.charCodeAt(e)==116){c=62}else{c=-1}}}}}}}}}}}}}}}}}}}}}}}}}}}}break;case 1:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=1;b=e;break;case 2:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=6;b=e;break;case 3:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=7;b=e;break;case 4:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=22;b=e;break;case 5:if(d.src.charCodeAt(e)==48){c=37}else{if((d.src.charCodeAt(e)>=49&&d.src.charCodeAt(e)<=57)){c=41}else{if(d.src.charCodeAt(e)==47){c=43}else{c=-1}}}a=17;b=e;break;case 6:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=16;b=e;break;case 7:if(d.src.charCodeAt(e)==48){c=37}else{if((d.src.charCodeAt(e)>=49&&d.src.charCodeAt(e)<=57)){c=41}else{if(d.src.charCodeAt(e)==47){c=43}else{c=-1}}}a=18;b=e;break;case 8:if(d.src.charCodeAt(e)==46){c=24}else{if(d.src.charCodeAt(e)==47){c=43}else{c=-1}}a=15;b=e;break;case 9:if(d.src.charCodeAt(e)==47){c=45}else{c=-1}a=23;b=e;break;case 10:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=3;b=e;break;case 11:if(d.src.charCodeAt(e)==58){c=25}else{if(d.src.charCodeAt(e)==61){c=26}else{if(d.src.charCodeAt(e)==47){c=43}else{c=-1}}}a=13;b=e;break;case 12:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=12;b=e;break;case 13:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=26;b=e;break;case 14:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=19;b=e;break;case 15:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=27;b=e;break;case 16:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==47){c=43}else{c=-1}}a=29;b=e;break;case 17:if(d.src.charCodeAt(e)==47){c=43}else{if(d.src.charCodeAt(e)==64){c=46}else{c=-1}}a=10;b=e;break;case 18:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=11;b=e;break;case 19:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=8;b=e;break;case 20:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=24;b=e;break;case 21:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}a=9;b=e;break;case 22:c=-1;a=20;b=e;break;case 23:c=-1;a=4;b=e;break;case 24:c=-1;a=25;b=e;break;case 25:c=-1;a=14;b=e;break;case 26:c=-1;a=21;b=e;break;case 27:c=-1;a=5;b=e;break;case 28:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=122)){c=33}else{c=-1}a=2;b=e;break;case 29:c=-1;a=28;b=e;break;case 30:if(d.src.charCodeAt(e)==47){c=43}else{c=-1}break;case 31:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=98&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==47){c=43}else{if(d.src.charCodeAt(e)==97){c=63}else{c=-1}}}a=1;b=e;break;case 32:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=41}else{if(d.src.charCodeAt(e)==47){c=43}else{c=-1}}a=3;b=e;break;case 33:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=122)){c=33}else{c=-1}a=29;b=e;break;case 34:if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=47}else{if(d.src.charCodeAt(e)==42){c=50}else{c=-1}}a=4;b=e;break;case 35:if(d.src.charCodeAt(e)==61){c=22}else{if(d.src.charCodeAt(e)==47){c=43}else{c=-1}}break;case 36:c=-1;a=1;b=e;break;case 37:c=-1;a=3;b=e;break;case 38:if(d.src.charCodeAt(e)==101){c=28}else{if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=100)||(d.src.charCodeAt(e)>=102&&d.src.charCodeAt(e)<=122)){c=33}else{c=-1}}a=29;b=e;break;case 39:if(d.src.charCodeAt(e)==34){c=23}else{if(d.src.charCodeAt(e)==47){c=60}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=254)){c=64}else{c=-1}}}break;case 40:if(d.src.charCodeAt(e)==34){c=23}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=254)){c=64}else{c=-1}}a=1;b=e;break;case 41:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=41}else{c=-1}a=3;b=e;break;case 42:if(d.src.charCodeAt(e)==47){c=43}else{if(d.src.charCodeAt(e)==105){c=44}else{c=-1}}break;case 43:if(d.src.charCodeAt(e)==42){c=47}else{c=-1}break;case 44:if(d.src.charCodeAt(e)==110){c=49}else{c=-1}break;case 45:if(d.src.charCodeAt(e)==10){c=36}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=9)||(d.src.charCodeAt(e)>=11&&d.src.charCodeAt(e)<=254)){c=45}else{c=-1}}break;case 46:if(d.src.charCodeAt(e)==93){c=27}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=92)||(d.src.charCodeAt(e)>=94&&d.src.charCodeAt(e)<=254)){c=46}else{c=-1}}break;case 47:if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=47}else{if(d.src.charCodeAt(e)==42){c=50}else{c=-1}}break;case 48:if(d.src.charCodeAt(e)==34){c=34}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=48}else{if(d.src.charCodeAt(e)==42){c=51}else{c=-1}}}break;case 49:if(d.src.charCodeAt(e)==99){c=52}else{c=-1}break;case 50:if(d.src.charCodeAt(e)==47){c=36}else{if(d.src.charCodeAt(e)==42){c=50}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=254)){c=53}else{c=-1}}}break;case 51:if(d.src.charCodeAt(e)==47){c=40}else{if(d.src.charCodeAt(e)==42){c=51}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=254)){c=54}else{if(d.src.charCodeAt(e)==34){c=59}else{c=-1}}}}break;case 52:if(d.src.charCodeAt(e)==108){c=55}else{c=-1}break;case 53:if(d.src.charCodeAt(e)==42){c=50}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=53}else{c=-1}}break;case 54:if(d.src.charCodeAt(e)==42){c=51}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=54}else{if(d.src.charCodeAt(e)==34){c=59}else{c=-1}}}break;case 55:if(d.src.charCodeAt(e)==117){c=56}else{c=-1}break;case 56:if(d.src.charCodeAt(e)==100){c=57}else{c=-1}break;case 57:if(d.src.charCodeAt(e)==101){c=29}else{c=-1}break;case 58:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=116)||(d.src.charCodeAt(e)>=118&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==117){c=38}else{c=-1}}a=29;b=e;break;case 59:if(d.src.charCodeAt(e)==42){c=50}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=53}else{c=-1}}a=4;b=e;break;case 60:if(d.src.charCodeAt(e)==34){c=23}else{if(d.src.charCodeAt(e)==42){c=48}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=41)||(d.src.charCodeAt(e)>=43&&d.src.charCodeAt(e)<=254)){c=64}else{c=-1}}}break;case 61:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=114)||(d.src.charCodeAt(e)>=116&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==115){c=38}else{c=-1}}a=29;b=e;break;case 62:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=113)||(d.src.charCodeAt(e)>=115&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==47){c=43}else{if(d.src.charCodeAt(e)==114){c=58}else{c=-1}}}a=29;b=e;break;case 63:if((d.src.charCodeAt(e)>=45&&d.src.charCodeAt(e)<=46)||(d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)||(d.src.charCodeAt(e)>=65&&d.src.charCodeAt(e)<=90)||d.src.charCodeAt(e)==95||(d.src.charCodeAt(e)>=97&&d.src.charCodeAt(e)<=107)||(d.src.charCodeAt(e)>=109&&d.src.charCodeAt(e)<=122)){c=33}else{if(d.src.charCodeAt(e)==108){c=61}else{c=-1}}a=29;b=e;break;case 64:if(d.src.charCodeAt(e)==34){c=23}else{if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=33)||(d.src.charCodeAt(e)>=35&&d.src.charCodeAt(e)<=254)){c=64}else{c=-1}}break}e++}while(c>-1)}while(1>-1&&a==1);if(a>-1){d.att=d.src.substr(f,b-f);d.offset=b;switch(a){case 2:d.att=new ADL.Boolean(d.att);break;case 3:d.att=new ADL.Integer(d.att);break;case 4:d.att=new ADL.String(d.att.substr(1,d.att.length-2));break;case 5:d.att=new ADL.Annotation(d.att.substr(2,d.att.length-3));break}}else{d.att=new String();a=-1}return a}function __parse(a,r,s){var b=new Array();var n=new Array();var e=0;var q;var f;var g;var v;var h=new Function("","var offset; var src; var att;");var o=new h();var l=new Array(new Array(0,1),new Array(31,1),new Array(30,2),new Array(30,0),new Array(32,1),new Array(32,1),new Array(33,8),new Array(34,2),new Array(35,1),new Array(35,0),new Array(42,2),new Array(43,3),new Array(45,1),new Array(44,3),new Array(44,1),new Array(44,0),new Array(38,1),new Array(38,2),new Array(37,1),new Array(37,2),new Array(39,2),new Array(39,0),new Array(46,3),new Array(47,3),new Array(47,5),new Array(47,0),new Array(36,2),new Array(36,0),new Array(48,2),new Array(48,4),new Array(40,2),new Array(40,0),new Array(49,1),new Array(49,1),new Array(49,1),new Array(41,3),new Array(41,1));var d=new Array(new Array(50,-3,28,-3,5,-3,29,-3,17,-3),new Array(50,0),new Array(28,7,5,8,50,-1,17,-9,29,-9),new Array(50,-2,28,-2,5,-2,29,-2,17,-2,9,-2),new Array(50,-4,28,-4,5,-4,29,-4,17,-4,9,-4),new Array(50,-5,28,-5,5,-5,29,-5,17,-5,9,-5),new Array(29,-27,17,-27),new Array(4,10),new Array(17,-8,29,-8),new Array(29,13,17,14),new Array(50,-7,28,-7,5,-7,29,-7,17,-7,9,-7),new Array(29,-26,17,-26,21,-26,8,-26,12,-26),new Array(29,16),new Array(26,18,29,-18,10,-18,17,-18,21,-18,8,-18,12,-18,13,-18),new Array(29,19),new Array(17,-21,21,-21,8,-21,12,-21,13,-21),new Array(26,18,13,-16,17,-16,21,-16,8,-16,12,-16),new Array(29,-19,10,-19,17,-19,21,-19,8,-19,12,-19,13,-19),new Array(29,24,27,-15,16,-15),new Array(19,25,29,-28,17,-28,21,-28,8,-28,12,-28),new Array(13,28,21,-27,8,-27,12,-27,17,-27),new Array(13,-17,17,-17,21,-17,8,-17,12,-17),new Array(16,29,27,30),new Array(27,-14,16,-14),new Array(27,-12,16,-12),new Array(4,32,3,33,2,34),new Array(17,-20,21,-20,8,-20,12,-20,13,-20),new Array(21,36,17,14,8,-31,12,-31),new Array(29,13),new Array(29,24),new Array(29,-11,13,-11,17,-11,21,-11,8,-11,12,-11,10,-11),new Array(29,-29,17,-29,21,-29,8,-29,12,-29),new Array(29,-32,17,-32,21,-32,8,-32,12,-32),new Array(29,-33,17,-33,21,-33,8,-33,12,-33),new Array(29,-34,17,-34,21,-34,8,-34,12,-34),new Array(8,40,12,41),new Array(4,32,3,33,2,34),new Array(10,44,17,-25,21,-25,8,-25,12,-25,13,-25),new Array(27,-13,16,-13),new Array(50,-6,28,-6,5,-6,29,-6,17,-6,9,-6),new Array(9,-3,28,-3,5,-3,29,-3,17,-3),new Array(50,-36,28,-36,5,-36,29,-36,17,-36,9,-36),new Array(8,-30,12,-30),new Array(17,-22,21,-22,8,-22,12,-22,13,-22),new Array(3,46),new Array(9,47,28,7,5,8,17,-9,29,-9),new Array(11,48,25,49),new Array(50,-35,28,-35,5,-35,29,-35,17,-35,9,-35),new Array(17,-23,21,-23,8,-23,12,-23,13,-23),new Array(3,50),new Array(11,51),new Array(17,-24,21,-24,8,-24,12,-24,13,-24));var k=new Array(new Array(31,1,30,2),new Array(),new Array(32,3,33,4,34,5,35,6),new Array(),new Array(),new Array(),new Array(36,9),new Array(),new Array(),new Array(48,11,37,12),new Array(),new Array(),new Array(38,15),new Array(43,17),new Array(),new Array(39,20),new Array(43,21),new Array(),new Array(44,22,45,23),new Array(),new Array(46,26,36,27),new Array(),new Array(),new Array(),new Array(),new Array(49,31),new Array(),new Array(48,11,40,35),new Array(37,37),new Array(45,38),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(41,39),new Array(49,42),new Array(47,43),new Array(),new Array(),new Array(30,45),new Array(),new Array(),new Array(),new Array(),new Array(32,3,33,4,34,5,35,6),new Array(),new Array(),new Array(),new Array(),new Array(),new Array());var p=new Array("Program'","WHITESPACE","Boolean","Integer","String","Annotation","(",")","{","}","[","]",";",":","::",".",",","+","-","=","!=",":=","*","/","|","..","<",">","IncludeDirective","Identifier","Statements","Program","Statement","Construct","Directive","Annotations","Modifiers","Type","Name","Supers","Value","Children","Generics","Generic","GenericArguments","GenericArgument","Super","Multiplicity","Modifier","Constant","$");o.offset=0;o.src=a;o.att=new String();if(!r){r=new Array()}if(!s){s=new Array()}b.push(0);n.push(0);g=__lex(o);while(true){q=53;for(var m=0;m<d[b[b.length-1]].length;m+=2){if(d[b[b.length-1]][m]==g){q=d[b[b.length-1]][m+1];break}}if(_dbg_withtrace&&b.length>0){__dbg_print("\nState "+b[b.length-1]+"\n\tLookahead: "+p[g]+' ("'+o.att+'")\n\tAction: '+q+'\n\tSource: "'+o.src.substr(o.offset,30)+((o.offset+30<o.src.length)?"...":"")+'"\n\tStack: '+b.join()+"\n\tValue stack: "+n.join()+"\n")}if(q==53){if(_dbg_withtrace){__dbg_print("Error detected: There is no reduce or shift on the symbol "+p[g])}e++;r.push(o.offset-o.att.length);s.push(new Array());for(var m=0;m<d[b[b.length-1]].length;m+=2){s[s.length-1].push(p[d[b[b.length-1]][m]])}var c=new Array();var u=new Array();for(var m=0;m<b.length;m++){c[m]=b[m];u[m]=n[m]}while(q==53&&g!=50){if(_dbg_withtrace){__dbg_print("\tError recovery\nCurrent lookahead: "+p[g]+" ("+o.att+")\nAction: "+q+"\n\n")}if(g==-1){o.offset++}while(q==53&&b.length>0){b.pop();n.pop();if(b.length==0){break}q=53;for(var m=0;m<d[b[b.length-1]].length;m+=2){if(d[b[b.length-1]][m]==g){q=d[b[b.length-1]][m+1];break}}}if(q!=53){break}for(var m=0;m<c.length;m++){b.push(c[m]);n.push(u[m])}g=__lex(o)}if(q==53){if(_dbg_withtrace){__dbg_print("\tError recovery failed, terminating parse process...")}break}if(_dbg_withtrace){__dbg_print("\tError recovery succeeded, continuing")}}if(q>0){if(_dbg_withtrace){__dbg_print("Shifting symbol: "+p[g]+" ("+o.att+")")}b.push(q);n.push(o.att);g=__lex(o);if(_dbg_withtrace){__dbg_print("\tNew lookahead symbol: "+p[g]+" ("+o.att+")")}}else{q*=-1;if(_dbg_withtrace){__dbg_print("Reducing by producution: "+q)}v=void (0);if(_dbg_withtrace){__dbg_print("\tPerforming semantic action...")}switch(q){case 0:v=n[n.length-1];break;case 1:ADL.ast=new ADL.AST(n[n.length-1]);break;case 2:v=makeList(n[n.length-2],n[n.length-1]);break;case 3:v=n[n.length-0];break;case 4:v=n[n.length-1];break;case 5:v=n[n.length-1];break;case 6:v=ADL.createConstruct(n[n.length-8],n[n.length-6],n[n.length-5],n[n.length-4],makeList(n[n.length-7],n[n.length-3]),n[n.length-2],n[n.length-1]);break;case 7:v=ADL.include(n[n.length-1]);break;case 8:v=n[n.length-1];break;case 9:v=n[n.length-0];break;case 10:v=makeList(n[n.length-2],n[n.length-1]);break;case 11:v=n[n.length-3]+n[n.length-2].join(",")+n[n.length-1];break;case 12:v=n[n.length-1];break;case 13:v=makeList(n[n.length-3],n[n.length-1]);break;case 14:v=makeList(n[n.length-1]);break;case 15:v=n[n.length-0];break;case 16:v=n[n.length-1];break;case 17:v=n[n.length-2]+n[n.length-1];break;case 18:v=n[n.length-1];break;case 19:v=n[n.length-2]+n[n.length-1];break;case 20:v=makeList(n[n.length-2],n[n.length-1]);break;case 21:v=n[n.length-0];break;case 22:v=new ADL.Reference(n[n.length-2],n[n.length-1]);break;case 23:v=new ADL.Multiplicity(n[n.length-2]);break;case 24:v=new ADL.Multiplicity(n[n.length-4],n[n.length-2]);break;case 25:v=n[n.length-0];break;case 26:v=makeList(n[n.length-2],n[n.length-1]);break;case 27:v=n[n.length-0];break;case 28:v=new ADL.Modifier(n[n.length-1]);break;case 29:v=new ADL.Modifier(n[n.length-3],n[n.length-1]);break;case 30:v=n[n.length-1];break;case 31:v=n[n.length-0];break;case 32:v=n[n.length-1];break;case 33:v=n[n.length-1];break;case 34:v=n[n.length-1];break;case 35:v=n[n.length-2];break;case 36:v=null;break}if(_dbg_withtrace){__dbg_print("\tPopping "+l[q][1]+" off the stack...")}for(var m=0;m<l[q][1];m++){b.pop();n.pop()}f=-1;for(var m=0;m<k[b[b.length-1]].length;m+=2){if(k[b[b.length-1]][m]==l[q][0]){f=k[b[b.length-1]][m+1];break}}if(q==0){break}if(_dbg_withtrace){__dbg_print("\tPushing non-terminal "+p[l[q][0]])}b.push(f);n.push(v)}if(_dbg_withtrace){alert(_dbg_string);_dbg_string=new String()}}if(_dbg_withtrace){__dbg_print("\nParse complete.");alert(_dbg_string)}return e}ADL.version="0.3-9";function tabberObj(b){var a;this.div=null;this.classMain="tabber";this.classMainLive="tabberlive";this.classTab="tabbertab";this.classTabDefault="tabbertabdefault";this.classNav="tabbernav";this.classTabHide="tabbertabhide";this.classNavActive="tabberactive";this.titleElements=["h2","h3","h4","h5","h6"];this.titleElementsStripHTML=true;this.removeTitle=true;this.addLinkId=false;this.linkIdFormat="<tabberid>nav<tabnumberone>";for(a in b){this[a]=b[a]}this.REclassMain=new RegExp("\\b"+this.classMain+"\\b","gi");this.REclassMainLive=new RegExp("\\b"+this.classMainLive+"\\b","gi");this.REclassTab=new RegExp("\\b"+this.classTab+"\\b","gi");this.REclassTabDefault=new RegExp("\\b"+this.classTabDefault+"\\b","gi");this.REclassTabHide=new RegExp("\\b"+this.classTabHide+"\\b","gi");this.tabs=new Array();if(this.div){this.init(this.div);this.div=null}}tabberObj.prototype.init=function(f){var k,d,b,m,g=0,n,a,l,c,h;if(!document.getElementsByTagName){return false}if(f.id){this.id=f.id}this.tabs.length=0;k=f.childNodes;for(d=0;d<k.length;d++){if(k[d].className&&k[d].className.match(this.REclassTab)){m=new Object();m.div=k[d];this.tabs[this.tabs.length]=m;if(k[d].className.match(this.REclassTabDefault)){g=this.tabs.length-1}}}n=document.createElement("ul");n.className=this.classNav;for(d=0;d<this.tabs.length;d++){m=this.tabs[d];m.headingText=m.div.title;if(this.removeTitle){m.div.title=""}if(!m.headingText){for(b=0;b<this.titleElements.length;b++){h=m.div.getElementsByTagName(this.titleElements[b])[0];if(h){m.headingText=h.innerHTML;if(this.titleElementsStripHTML){m.headingText.replace(/<br>/gi," ");m.headingText=m.headingText.replace(/<[^>]+>/g,"")}break}}}if(!m.headingText){m.headingText=d+1}a=document.createElement("li");m.li=a;l=document.createElement("a");l.appendChild(document.createTextNode(m.headingText));l.href="javascript:void(null);";l.title=m.headingText;l.onclick=this.navClick;l.tabber=this;l.tabberIndex=d;if(this.addLinkId&&this.linkIdFormat){c=this.linkIdFormat;c=c.replace(/<tabberid>/gi,this.id);c=c.replace(/<tabnumberzero>/gi,d);c=c.replace(/<tabnumberone>/gi,d+1);c=c.replace(/<tabtitle>/gi,m.headingText.replace(/[^a-zA-Z0-9\-]/gi,""));l.id=c}a.appendChild(l);n.appendChild(a)}f.insertBefore(n,f.firstChild);f.className=f.className.replace(this.REclassMain,this.classMainLive);this.tabShow(g);if(typeof this.onLoad=="function"){this.onLoad({tabber:this})}return this};tabberObj.prototype.navClick=function(g){var d,b,c,f,e;b=this;if(!b.tabber){return false}c=b.tabber;f=b.tabberIndex;b.blur();if(typeof c.onClick=="function"){e={tabber:c,index:f,event:g};if(!g){e.event=window.event}d=c.onClick(e);if(d===false){return false}}c.tabShow(f);return false};tabberObj.prototype.tabHideAll=function(){var a;for(a=0;a<this.tabs.length;a++){this.tabHide(a)}};tabberObj.prototype.tabHide=function(a){var b;if(!this.tabs[a]){return false}b=this.tabs[a].div;if(!b.className.match(this.REclassTabHide)){b.className+=" "+this.classTabHide}this.navClearActive(a);return this};tabberObj.prototype.tabShow=function(a){var b;if(!this.tabs[a]){return false}this.tabHideAll();b=this.tabs[a].div;b.className=b.className.replace(this.REclassTabHide,"");this.navSetActive(a);if(typeof this.onTabDisplay=="function"){this.onTabDisplay({tabber:this,index:a})}return this};tabberObj.prototype.navSetActive=function(a){this.tabs[a].li.className=this.classNavActive;return this};tabberObj.prototype.navClearActive=function(a){this.tabs[a].li.className="";return this};function tabberAutomatic(d){var a,c,b;if(!d){d={}}a=new tabberObj(d);c=document.getElementsByTagName("div");for(b=0;b<c.length;b++){if(c[b].className&&c[b].className.match(a.REclassMain)){d.div=c[b];c[b].tabber=new tabberObj(d)}}return this}function tabberAutomaticOnLoad(b){var a;if(!b){b={}}a=window.onload;if(typeof window.onload!="function"){window.onload=function(){tabberAutomatic(b)}}else{window.onload=function(){a();tabberAutomatic(b)}}}if(typeof tabberOptions=="undefined"){tabberAutomaticOnLoad()}else{if(!tabberOptions.manualStartup){tabberAutomaticOnLoad(tabberOptions)}}if(!window.Node){window.Node=new Object();Node.ELEMENT_NODE=1;Node.ATTRIBUTE_NODE=2;Node.TEXT_NODE=3;Node.CDATA_SECTION_NODE=4;Node.ENTITY_REFERENCE_NODE=5;Node.ENTITY_NODE=6;Node.PROCESSING_INSTRUCTION_NODE=7;Node.COMMENT_NODE=8;Node.DOCUMENT_NODE=9;Node.DOCUMENT_TYPE_NODE=10;Node.DOCUMENT_FRAGMENT_NODE=11;Node.NOTATION_NODE=12}if(typeof decomposeVersion!="function"){function decomposeVersion(b){var a=b.match(/([0-9]+)\.([0-9]+)(-([0-9]+))?/);return{major:parseInt(a[1]),minor:parseInt(a[2]),build:parseInt(a[4])||0}}}if(typeof iRequire!="function"){function iRequire(d,a,c){var b=decomposeVersion(d.version);a=decomposeVersion(a);if((b.major<a.major)||(b.major==a.major&&b.minor<a.minor)||(b.major==a.major&&b.minor==a.minor&&b.build<a.build)){return false}if(c){c=decomposeVersion(c);if((b.major>c.major)||(b.major==c.major&&b.minor>c.minor)||(b.major==c.major&&b.minor==c.minor&&b.build>c.build)){return false}}return true}}if(!iRequire(ADL,"0.1-4")){alert("Canvas2D requires at least ADL version 0.1-4. Current ADL version = "+ADL.version)}if(!document.createElement("canvas").getContext&&!G_vmlCanvasManager.initElement){alert("You browser doesn't support the Canvas element. If you're using IE, ExplorerCanvas is required.")}else{if(typeof CanvasTextFunctions=="undefined"){alert("Canvas2D requires the CanvasText implementation.")}}function unless(b,a){if(!b){a()}}function max(d,c){return d<c?c:d}function min(d,c){return d<c?d:c}if(!Array.indexOf){Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return a}}return -1}}Array.prototype.contains=function(a){return this.indexOf(a)>-1};function getFontSize(a){var b=null;b=toPx(a,"px");if(b==null){b=toPx(a,"pt");if(b==null){b=toPx(a,"em");if(b==null){b=toPx(a,"pct");if(b!=null){return b}}else{return b}}else{return b}}else{return b}throw ("cannot get size from font specifier: "+a)}function toPx(b,e){if(!b){console.log("Common::toPx: require a valid font. Got: '"+b+"'");return}var d=[{pt:5.5,px:6,em:0.375,pct:37.5},{pt:6,px:8,em:0.5,pct:50},{pt:7,px:9,em:0.55,pct:55},{pt:7.5,px:10,em:0.625,pct:62.5},{pt:8,px:11,em:0.7,pct:70},{pt:9,px:12,em:0.75,pct:75},{pt:10,px:13,em:0.8,pct:80},{pt:10.5,px:14,em:0.875,pct:87.5},{pt:11,px:15,em:0.95,pct:95},{pt:12,px:16,em:1,pct:100},{pt:13,px:17,em:1.05,pct:105},{pt:13.5,px:18,em:1.125,pct:112.5},{pt:14,px:19,em:1.2,pct:120},{pt:14.5,px:20,em:1.25,pct:125},{pt:15,px:21,em:1.3,pct:130},{pt:16,px:22,em:1.4,pct:140},{pt:17,px:23,em:1.45,pct:145},{pt:18,px:24,em:1.5,pct:150},{pt:20,px:26,em:1.6,pct:160},{pt:22,px:29,em:1.8,pct:180},{pt:24,px:32,em:2,pct:200},{pt:26,px:35,em:2.2,pct:220},{pt:27,px:36,em:2.25,pct:225},{pt:28,px:37,em:2.3,pct:230},{pt:29,px:38,em:2.35,pct:235},{pt:30,px:40,em:2.45,pct:245},{pt:32,px:42,em:2.55,pct:255},{pt:34,px:45,em:2.75,pct:275},{pt:36,px:48,em:3,pct:300}];var a=b.match("(\\d+)"+e+"\\s*/");if(a==null){a=b.match("(\\d+)"+e+"\\s*");if(a!=null){a=a[1]}}else{a=a[1]}if(a!=null){for(var c=0;c<d.length;c++){if(d[c][e]==a){return d[c]["px"]}}}return null}function Timer(){this.now=new Date().getTime();this.stop=function(){return new Date().getTime()-this.now}}var Canvas2D={shapes:$H(),libraries:$H(),extensions:[],activate:function activate(d){var a=document.getElementById(d);if(a){var c=new Canvas2D.Manager();var a=c.setupBook(d);var b=a.addSheet();c.startAll();return b}throw (d+" does not reference a known id on the document.")},registerShape:function registerShape(b){b.prototype.__CLASS__=b;b.prototype.getClass=function a(){return this.__CLASS__};Canvas2D.Shape.manifestHandling.iterate(function(c,d){b[c]=d});b.getTypes().iterate(function(c){Canvas2D.shapes.set(c,b)});b.getLibraries().iterate(function(c){if(!Canvas2D.libraries.get(c)){Canvas2D.libraries.set(c,[])}Canvas2D.libraries.get(c).push(b)})},getBook:function(a){return Canvas2D.KickStarter.manager.getBook(a)}};Canvas2D.Factory={extensions:{all:{}}};Canvas2D.Factory.extensions.all.ShortHands={clear:function clear(){this.clearRect(0,0,this.canvas.width,this.canvas.height)},fillTextCenter:function fillTextCenter(d,a,e,c){var b=this.measureText(d)/2;this.fillText(d,a-b,e,c)},fillTextRight:function fillTextRight(d,a,e,c){var b=this.measureText(d);this.fillText(d,a-b,e,c)},strokeTextCenter:function strokeTextCenter(d,a,e,c){var b=this.measureText(d)/2;this.strokeText(d,a-b,e,c)},strokeTextRight:function strokeTextRight(d,a,e,c){var b=this.measureText(d);this.strokeText(d,a-b,e,c)},fillStrokeRect:function fillStrokeRect(d,c,b,a){this.fillRect(d,c,b,a);this.strokeRect(d,c,b,a)}};Canvas2D.Factory.extensions.all.EventHandling={on:function on(b,a){if(!this.eventHandlers){this.eventHandlers=[]}if(!this.eventHandlers[b]){this.eventHandlers[b]=[]}this.eventHandlers[b].push(a)},fireEvent:function fireEvent(a,b){if(!this.eventHandlers){return}if(this.eventHandlers[a]){this.eventHandlers[a].iterate(function(c){c(b)})}}};Canvas2D.Factory.extensions.all.ExtendedCanvasSupport={__extend__:function __extend__(a){var c=["useCrispLines","textDecoration","lineStyle"];var b=a.save;a.save=function(){var e={};var f=this;c.iterate(function(g){e[g]=f[g]});if(!this.savedValues){this.savedValues=[]}this.savedValues.push(e);b.apply(this)};var d=a.restore;a.restore=function(){if(!this.savedValues){return}var e=this.savedValues.pop();var f=this;c.iterate(function(g){f[g]=e[g]});d.apply(this)};return a}};Canvas2D.Factory.extensions.all.DashedLineSupport={__extend__:function __extend__(a){["_setCurrentXY","_plotPixel","_drawLine"].iterate(function(b){a[b]=Canvas2D.Factory.extensions.all.DashedLineSupport[b]});a.nativeMoveTo=a.moveTo;a.moveTo=function(b,c){a.nativeMoveTo.apply(this,arguments);this._setCurrentXY(b,c)};a.nativeLineTo=a.lineTo;a.lineTo=function(b,c){if(this.lineStyle=="dashed"){this._drawLine(this.currentX,this.currentY,b,c)}else{this.nativeLineTo.apply(this,arguments)}this._setCurrentXY(b,c)};return a},_setCurrentXY:function _setCurrentXY(a,b){if(!this.currentX){this.currentX=0}if(!this.currentY){this.currentY=0}this.currentX=a;this.currentY=b},_plotPixel:function _plotPixel(a,e,d){var b=this.strokeStyle;this.beginPath();this.strokeStyle=d;this.fillStyle=d;this.moveTo(a,e);this.nativeLineTo(a+1,e+1);this.stroke();this.closePath();this.strokeStyle=b},_drawLine:function _drawLine(g,s,e,q){g=Math.floor(g);e=Math.floor(e);s=Math.floor(s-1);q=Math.floor(q-1);this.stroke();var n=this.strokeStyle;var d=this.lineStyle;var o=Math.abs(q-s)>Math.abs(e-g);if(o){t=s;s=g;g=t;t=q;q=e;e=t}var l=Math.abs(e-g);var k=Math.abs(q-s);var m=0;var u=k;var f;var a;var r=g;var p=s;if(g<e){f=1}else{f=-1}if(s<q){a=1}else{a=-1}if(o){this._plotPixel(p,r,n)}else{this._plotPixel(r,p,n)}var b=0;while(r!=e){r=r+f;m=m+u;if(2*m>=l){p=p+a;m=m-l}var h=(d!="dashed"||++b%15)<10?n:"white";if(o){this._plotPixel(p,r,h)}else{this._plotPixel(r,p,h)}}}};Canvas2D.Factory.extensions.all.CrispLineSupport={__extend__:function __extend__(a){["strokeRect","moveTo","lineTo","rect"].iterate(function(b){var c=a[b];a[b]=function(d,k,e,g){if(!this.useCrispLines){return c.apply(this,arguments)}var f=Canvas2D.Factory.extensions.all.CrispLineSupport.makeCrisp(d,k,e,g,this.lineWidth);return c.apply(this,[f.x,f.y,f.w,f.h])}});return a},makeCrisp:function makeCrisp(m,k,a,f,e){var c=m;var l=k;var b=a;var g=f;var n=a;var d=f;if(e%2){c=Math.floor(m)+0.5;l=Math.floor(k)+0.5;if(typeof b!="undefined"){b=Math.floor(a)+0.5;g=Math.floor(f)+0.5}if(a%1!=0){n=Math.floor(a)}if(f%1!=0){d=Math.floor(f)}}else{c=Math.floor(m);l=Math.floor(k);if(typeof b!="undefined"){b=Math.floor(a);g=Math.floor(f)}if(a%1!=0){n=Math.floor(a)+0.5}if(f%1!=0){d=Math.floor(f)+0.5}}return{x:c,y:l,x1:c,y1:l,w:n,h:d,x2:b,y2:g}}};Canvas2D.Factory.extensions.all.TextDecorationSupport={decorateText:function decorateText(c,a,d,b){if(!this.textDecoration){return}this.save();this.useCrispLines=true;this.strokeStyle="black";this.textDecoration.toLowerCase().split(" ").iterate(function(f){var e=null;switch(f){case"underline":e=this.underlineText;break;case"overline":e=this.overlineText;break;case"line-through":e=this.linethroughText;break}if(e){this.beginPath();var g=this.measureText(c);if(g>b){g=b}e.call(this,c,a,d,g);this.stroke();this.closePath()}}.scope(this));this.restore()},underlineText:function underlineText(c,a,d,b){this.moveTo(a,d+3);this.lineTo(a+b,d+3)},overlineText:function overlineText(c,a,d,b){this.moveTo(a,d-getFontSize(this.font));this.lineTo(a+b,d-getFontSize(this.font))},linethroughText:function linethroughText(c,a,d,b){this.moveTo(a,d-(getFontSize(this.font)/2)+2);this.lineTo(a+b,d-(getFontSize(this.font)/2)+2)}};Canvas2D.Factory.extensions.all.MouseEvents={setupMouseEventHandlers:function setupMouseEventHandlers(){ProtoJS.Event.observe(this.canvas,"mousedown",this.handleMouseDown.scope(this));ProtoJS.Event.observe(this.canvas,"mouseup",this.handleMouseUp.scope(this));ProtoJS.Event.observe(document,"mousemove",this.handleMouseMove.scope(this));ProtoJS.Event.observe(this.canvas,"dblclick",this.handleDoubleClick.scope(this))},getLeft:function getLeft(){var a=this.canvas;var b=0;while(a!=null){b+=a.offsetLeft;a=a.offsetParent}return b},getTop:function getTop(){var a=this.canvas;var b=0;while(a!=null){b+=a.offsetTop;a=a.offsetParent}return b},getXY:function getXY(b){var a,c;if(ProtoJS.Browser.IE){a=event.clientX+document.body.scrollLeft;c=event.clientY+document.body.scrollTop}else{a=b.pageX;c=b.pageY}return{x:a-this.getLeft(),y:c-this.getTop()}},handleMouseDown:function handleMouseDown(a){this.mousepressed=true;var b=this.getXY(a);this.fireEvent("mousedown",b);this.mousePos=b},handleMouseUp:function handleMouseUp(a){this.mousepressed=false;var b=this.getXY(a);this.fireEvent("mouseup",b);this.mousePos=b},handleMouseMove:function handleMouseMove(b){if(this.mousepressed){this.handleMouseDrag(b)}var c=this.getXY(b);if(c){var a=this.mouseOver;this.mouseOver=(c.x>=0&&c.x<=this.canvas.width)&&(c.y>=0&&c.y<=this.canvas.height);if(this.mouseOver&&!a){this.fireEvent("mouseEnter")}if(!this.mouseOver&&a){this.fireEvent("mouseLeave")}}},handleMouseDrag:function handleMouseDrag(a){var b=this.getXY(a);this.fireEvent("mousedrag",{x:b.x,y:b.y,dx:b.x-this.mousePos.x,dy:b.y-this.mousePos.y});this.mousePos=b},handleDoubleClick:function handleDoubleClick(a){var b=this.getXY(a);this.fireEvent("dblclick",b);this.mousePos=b}};Canvas2D.Factory.extensions.TouchEvents={setupTouchEventHandlers:function setupTouchEventHandlers(){ProtoJS.Event.observe(this.canvas,"touchstart",this.handleTouchStart.scope(this));ProtoJS.Event.observe(this.canvas,"touchmove",this.handleTouchMove.scope(this));ProtoJS.Event.observe(this.canvas,"touchend",this.handleTouchEnd.scope(this))},handleTouchStart:function handleTouchStart(a){if(a.touches.length==1){this.handleMouseDown(a.touches[0]);a.preventDefault()}},handleTouchMove:function handleTouchMove(a){if(a.touches.length==1){this.handleMouseDrag(a.touches[0]);a.preventDefault()}},handleTouchEnd:function handleTouchEnd(a){this.handleMouseUp(a);a.preventDefault()}};Canvas2D.Factory.extensions.all.TextSupport={adjustToAlignment:function adjustToAlignment(a,b){switch(this.textAlign){case"center":a-=this.measureText(b)/2;break;case"right":a-=this.measureText(b);break}return a},getFontSize:function(){return getFontSize(this.font||Canvas2D.Sheet.Defaults.font)}};Canvas2D.Factory.extensions.CanvasText={fillText:function fillText(c,a,d,b){this.strokeText(c,a,d,b)},strokeText:function strokeText(c,a,d,b){this.beginPath();this.save();this.strokeStyle=this.fillStyle;a=this.adjustToAlignment(a,c);CanvasTextFunctions.draw(this,this.font,getFontSize(this.font),a,d,c);this.decorateText(c,a,d,b);this.restore();this.closePath()},measureText:function measureText(a){return CanvasTextFunctions.measure(this.font,getFontSize(this.font),a)}};Canvas2D.Factory.extensions.HTML5CanvasText={__extend__:function __extend__(d){var g=d.measureText;d.measureText=function c(h){return g.apply(this,arguments).width};var f=d.fillText;d.fillText=function e(l,h,m,k){k=k||this.measureText(l);f.apply(this,arguments);h=this.adjustToAlignment(h,l);this.decorateText(l,h,m,k)};var b=d.strokeText;d.strokeText=function a(l,h,m,k){k=k||this.measureText(l);b.apply(this,arguments);h=this.adjustToAlignment(h,l);this.decorateText(l,h,m,k)};return d}};Canvas2D.Factory.extensions.GeckoCanvasText={fillText:function fillText(c,a,d,b){a=this.adjustToAlignment(a,c);this._drawText(c,a,d,true);this.decorateText(c,a,d,b)},strokeText:function strokeText(c,a,d,b){a=this.adjustToAlignment(a,c);this._drawText(c,a,d,false);this.decorateText(c,a,d,b)},measureText:function measureText(b){this.save();this.mozTextStyle=this.font;var a=this.mozMeasureText(b);this.restore();return a},_drawText:function _drawText(c,a,d,b){this.save();this.beginPath();this.translate(a,d);this.mozTextStyle=this.font;this.mozPathText(c);if(b){this.fill()}else{this.stroke()}this.closePath();this.restore()}};Canvas2D.Factory.setup=function(b){if(!Canvas2D.initialized){Canvas2D.initialized=true;if(!window.CanvasRenderingContext2D){window.CanvasRenderingContext2D=document.createElement("canvas").getContext("2d").__proto__}else{window.CanvasRenderingContext2D=CanvasRenderingContext2D.prototype}}unless(b&&b.nodeType&&b.nodeType==1,function(){throw ("CanvasBase:initialize: expected HTMLElement")});try{var a=b.getContext("2d")}catch(c){throw ("Canvas2D: element is no HTML5 Canvas.")}if(a.strokeText&&a.fillText&&a.measureText){a=Canvas2D.Factory.extensions.HTML5CanvasText.__extend__(a)}else{if(a.mozMeasureText&&a.mozPathText){ProtoJS.mix(Canvas2D.Factory.extensions.GeckoCanvasText,a,true)}else{ProtoJS.mix(Canvas2D.Factory.extensions.CanvasText,a,true);if(ProtoJS.Browser.IE){Canvas2D.Book.prototype.addWaterMark=function(){}}}}if(ProtoJS.Browser.MobileSafari){ProtoJS.mix(Canvas2D.Factory.extensions.TouchEvents,a,true);a.setupTouchEventHandlers()}$H(Canvas2D.Factory.extensions.all).values().iterate(function(d){if(d.__extend__){a=d.__extend__(a)}else{ProtoJS.mix(d,a,true)}});$H(Canvas2D.Defaults.Canvas).iterate(function(d,e){a[d]=e});a.setupMouseEventHandlers();return a};ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D);Canvas2D.KeyboardDriver=Class.extend({init:function initialize(){this.currentKeysDown=[];ProtoJS.Event.observe(document,"keydown",this.handleKeyDownEvent.scope(this));ProtoJS.Event.observe(document,"keyup",this.handleKeyUpEvent.scope(this))},handleKeyDownEvent:function(b){var a=(b||window.event).keyCode;this.currentKeysDown.push(a);this.fireEvent("keydown",a)},handleKeyUpEvent:function handleKeyUpEvent(b){var a=(b||window.event).keyCode;this.currentKeysDown=this.currentKeysDown.remove(a);this.fireEvent("keyup",a)},getCurrentKeysDown:function getCurrentKeysDown(){return this.currentKeysDown},keyDown:function keyDown(a){return this.currentKeysDown.contains(a)}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.KeyboardDriver.prototype);Canvas2D.Keyboard=new Canvas2D.KeyboardDriver();Canvas2D.ImageManager={};Canvas2D.ImageManager.work=0;Canvas2D.ImageManager.load=function(c,b){var a=new Image();Canvas2D.ImageManager.work++;a.onload=function(){Canvas2D.ImageManager.work--;b()};a.src=c;return a};Canvas2D.ImageManager.isReady=function(){return Canvas2D.ImageManager.work==0};Canvas2D.Manager=Class.extend({init:function(){this.plugins=[];this.books=$H()},setupBook:function(a){return this.addBook(new Canvas2D.Book(a))},addBook:function(a){unless(a instanceof Canvas2D.Book,function(){throw ("Manager::addBook: book must be instance of Canvas2D.Book")});this.books.set(a.name,a);return a},getBook:function(a){return this.books.get(a)},startAll:function(){if(Canvas2D.ImageManager.isReady()){this.plugins.iterate(function(a){a.start()});this.books.values().iterate(function(a){a.start()})}else{this.startAll.scope(this).after(10)}}});Canvas2D.ADLVisitor=Class.extend({init:function(){this.errors=[]},visit:function(a,c){var d=a.type.toLowerCase();if(d=="root"){a.childrenAccept(this,c);return c}else{if(Canvas2D.shapes.get(d)){var b=Canvas2D.shapes.get(d).from(a,c);if(b){if(b.errors){b.errors.iterate(function(h){this.errors.push(h)}.scope(this))}else{if(b.warnings){b.warnings.iterate(function(h){this.errors.push(h)}.scope(this))}var f,e;if(a.annotation&&c.at){var g=a.annotation.data.split(",");f=parseInt(g[0]);e=parseInt(g[1]);c.at(f,e).add(b)}else{c.add(b)}a.childrenAccept(this,b)}}return a}else{this.errors.push("Unknown Construct Type: "+a.type);return c}}}});Canvas2D.Book=Class.extend({init:function(a){unless(a&&a.nodeType&&a.nodeType==Node.ELEMENT_NODE,function(){a=document.getElementById(a)});this.canvas=Canvas2D.Factory.setup(a);this.sheets=[];this.currentSheet=0;this.canvas.on("mousedown",function(c){this.fireEvent("mousedown");var b;if(b=this.getCurrentSheet()){b.handleMouseDown(c)}}.scope(this));this.canvas.on("mouseup",function(c){this.fireEvent("mouseup");var b;if(b=this.getCurrentSheet()){b.handleMouseUp(c)}}.scope(this));this.canvas.on("mousedrag",function(c){this.fireEvent("mousedrag");var b;if(b=this.getCurrentSheet()){b.handleMouseDrag(c)}}.scope(this));this.console=document.getElementById(a.id+"Console");this.source=document.getElementById(a.id+"Source");this.generated=document.getElementById(a.id+"Generated");this.name=a.id;this.setupExtensions();this.setupPlugins()},add:function(a){return this.addSheet(a)},addSheet:function(a){unless(a instanceof Canvas2D.Sheet,function(){a=new Canvas2D.Sheet()});a.setCanvas(this.canvas);a.on("change",this.rePublish.scope(this));a.on("newShape",this.log.scope(this));this.sheets.push(a);return a},setupExtensions:function(){this.extensions=new Hash();Canvas2D.extensions.iterate(function(a){this.extensions.set(a.name,a)}.scope(this))},setupPlugins:function(){this.plugins={};$H(Canvas2D.Book.plugins).iterate(function(a,c){var b=new (c)(this);this.plugins[a]=b;c.exposes.iterate(function(d){this[d]=function(g,f,e){this.plugins[a][d](g,f,e)}}.scope(this))}.scope(this))},log:function(a){if(this.console){this.console.value="["+(new Date).toLocaleString()+"] "+a+"\n"+this.console.value}},getCurrentSheet:function(){return this.sheets[this.currentSheet]},clear:function(){this.sheets.length=0},start:function(){this.stop();this.rePublish();this.publish()},stop:function(){if(this.nextPublish){window.clearTimeout(this.nextPublish)}},freeze:function(){this.wait=true},thaw:function(){this.wait=false},addWaterMark:function(){this.canvas.save();this.canvas.fillStyle="rgba(125,125,125,1)";this.canvas.textDecoration="none";this.canvas.rotate(Math.PI/2);var a="";this.extensions.iterate(function(b,c){a+=" + "+b});this.canvas.font="6pt Sans-Serif";this.canvas.textAlign="left";this.canvas.useCrispLines=false;this.canvas.lineStyle="solid";this.canvas.fillText("Canvas2D"+a+" / Christophe VG",3,(this.canvas.canvas.width*-1)+7+(ProtoJS.Browser.IE?4:0));this.canvas.restore()},load:function(c){var d=new ADL.Parser();var a;this.errors="";if((a=d.parse(c))){this.clear();this.freeze();var b=new Canvas2D.ADLVisitor();a.getRoot().accept(b,this);this.thaw();this.rePublish();if(b.errors.length>0){this.errors="ADLVisitor reported errors:";b.errors.iterate(function(e){this.log(e);this.errors+="\n   - "+e}.scope(this))}this.fireEvent("sourceLoaded");return true}else{this.log(d.errors);this.errors=d.errors;this.fireEvent("sourceLoaded");return false}},toADL:function(){var a="";this.sheets.iterate(function(b){a+=b.toADL()+"\n"});return a},rePublish:function(){this.rePublishNeeded=true},publish:function(){if(this.rePublishNeeded&&!this.wait){this.publishOnce();this.rePublishNeeded=false;this.afterPublish()}this.nextPublish=this.publish.scope(this).after(10)},publishOnce:function(){var a=new Timer();this.canvas.clear();if(this.getCurrentSheet()){this.beforeRender();this.getCurrentSheet().render();this.afterRender()}this.log("Canvas2D::publish: RenderTime: "+a.stop()+"ms")},afterPublish:function afterPublish(){this.addWaterMark();$H(this.plugins).iterate(function(a,b){if(b.afterPublish){b.afterPublish(this)}}.scope(this))},beforeRender:function beforeRender(){$H(this.plugins).iterate(function(a,b){if(b.beforeRender){b.beforeRender(this)}}.scope(this))},afterRender:function afterRender(){$H(this.plugins).iterate(function(a){if(a.afterRender){a.afterRender(this)}}.scope(this));this.updateExternalSource()},updateExternalSource:function updateExternalSource(){if(this.getCurrentSheet()){var a=this.getCurrentSheet().toADL();if(this.generated&&a!=this.generated.value){this.generated.value=a}this.fireEvent("sourceUpdated",a)}}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Book.prototype);Canvas2D.Book.plugins={};Canvas2D.ShapeCounter=0;Canvas2D.Shape=Class.extend({init:function initialize(b){b=b||{};b=this.preprocess(b);this.setProperties(b);this.getPropertyList().iterate(function a(e){var d=e.substr(0,1).toUpperCase()+e.substr(1);var c="get"+d;if(typeof this[c]=="undefined"){this[c]=function(){return this.getProperty(e)}}}.scope(this));this.postInitialize()},setParent:function setParent(a){this.parent=a},getParent:function getParent(){return this.parent},prepare:function prepare(a){},setProperties:function(b){this.getPropertyList().iterate(function a(c){this[c]=b[c]!=null?b[c]:null}.scope(this));if(!this.name){this.name="__shape__"+Canvas2D.ShapeCounter++}},getProperty:function getProperty(c){if(typeof this[c]=="undefined"){var b=c.substr(0,1).toUpperCase()+c.substr(1);var a="get"+b;return this[a]()}else{return this[c]!=null?this[c]:this.getPropertyDefault(c)}},getPropertyDefault:function getPropertyDefault(c){var a=null;this.getClassHierarchy().reverse().iterate(function b(d){if(a==null&&typeof d.Defaults[c]!="undefined"){a=d.Defaults[c]}});return a},toADL:function(a){return this.constructToString(this.asConstruct(),a)},asConstruct:function(){var a={__SHAPE__:this,annotation:{data:null},type:this.getType(),name:this.getName(),supers:[],modifiers:{},children:[],addModifiers:function(b){b.iterate(function(c){if(this.__SHAPE__.getProperty(c)){this.addModifier(c,this.__SHAPE__.getProperty(c))}}.scope(this))},addModifier:function(b,c){if(this.__SHAPE__.getPropertyDefault(b)!=c){this.modifiers[b]='"'+c+'"'}}};a.addModifiers(["label","labelPos","labelColor"]);return a},constructToString:function(a,e){if(a==null){return""}var b="";if(a.annotation&&a.annotation.data){b+=e+"[@"+a.annotation.data+"]\n"}b+=e+a.type+" "+a.name;a.supers.iterate(function(g){b+=" : "+g});$H(a.modifiers).iterate(function f(g,h){if(typeof h!="function"){b+=" +"+g;if(h){b+="="+h}}});if(a.children.length>0){b+=" {\n";var c=this;a.children.iterate(function d(g){b+=c.constructToString(g,e+"  ")+"\n"});b+=e+"}"}else{b+=";"}return b},delayRender:function(){return false},drawLabel:function(a,c,b){if(this.getLabel()&&this.getHeight()!=null&&this.getCenter()){c+=this.getCenter().left;switch(this.getLabelPos()){case"top":b+=-5;break;case"bottom":b+=this.getHeight()+11;break;case"center":default:b+=this.getCenter().top+2.5}a.save();a.fillStyle=this.getLabelColor();a.textAlign=this.getLabelAlign();a.font=this.getLabelFont();a.useCrispLines=this.getLabelUseCrispLines();a.fillText(this.getLabel(),c,b);a.restore()}},render:function(a,c,b){this.prepare(a);a.save();this.draw(a,c,b);this.drawLabel(a,c,b);a.restore()},getType:function(){throw ("Missing getType. Did you register the shape?")},getClasSHierarchy:function(){throw ("Missing getClassHierarchy. Did you register the shape?")},preprocess:function preprocess(a){return a},postInitialize:function postInitialize(){},draw:function draw(a,c,b){},hit:function hit(a,b){return false},hitArea:function hitArea(b,c,a,d){return false},getCenter:function getCenter(){return null},getPort:function getPort(a){return null}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Shape.prototype);Canvas2D.Shape.MANIFEST={name:"shape",properties:["name","label","labelPos","labelColor","labelAlign","labelFont","labelUseCrispLines","useCrispLines","topDown"]};Canvas2D.Shape.manifestHandling=$H({getManifest:function getManifest(){return this.MANIFEST||this.__CLASS__.MANIFEST},getType:function getType(){return this.getManifest().name},getTypes:function getTypes(){return[this.getType()].concat(this.getAliasses())},getPropertyPath:function getPropertyPath(){return this.getManifest().propertyPath||[]},getClassHierarchy:function getClassHierarchy(){var a=[Canvas2D.Shape].concat(this.getPropertyPath());a.push(this.getClass());return a},getLocalProperties:function getLocalProperties(){return this.getManifest().properties||[]},getPropertyList:function getPropertyList(){if(!this.allPropertiesCache){this.allPropertiesCache=[];this.getClassHierarchy().iterate(function a(b){this.allPropertiesCache=this.allPropertiesCache.concat(b.getLocalProperties())}.scope(this))}return this.allPropertiesCache},getAliasses:function getAliasses(){return this.getManifest().aliasses||[]},getLibraries:function getLibraries(){return this.getManifest().libraries||[]}});Canvas2D.Shape.manifestHandling.iterate(function(a,b){Canvas2D.Shape.prototype[a]=b;Canvas2D.Shape[a]=b});Canvas2D.Sheet=Class.extend({init:function init(a){a=a||{};this.name=a.name||"default";this.style=a.style||"static";this.clear();this.dirty=false;if(a.canvas){this.setCanvas(a.canvas)}Canvas2D.Keyboard.on("keyup",this.handleKeyDown.scope(this))},setCanvas:function setCanvas(a){this.canvas=a;this.wireCanvasDelegation();this.setupProperties()},wireCanvasDelegation:function wireCanvasDelegation(){if(!this.canvas){return}Canvas2D.Sheet.Operations.iterate(function(a){if(a=="restore"){this[a]=function(){this.canvas[a].apply(this.canvas,arguments);this.transferBackProperties();return}.scope(this)}else{this[a]=function(){this.transferProperties();return this.canvas[a].apply(this.canvas,arguments)}.scope(this)}}.scope(this))},setupProperties:function setupProperties(){Canvas2D.Sheet.Properties.iterate(function(a){this[a]=Canvas2D.Sheet.Defaults[a]||this.canvas[a]}.scope(this))},transferProperties:function(){Canvas2D.Sheet.Properties.iterate(function(a){this.canvas[a]=this[a]}.scope(this))},transferBackProperties:function(){Canvas2D.Sheet.Properties.iterate(function(a){this[a]=this.canvas[a]}.scope(this))},makeDirty:function(){this.dirty=true;this.fireEvent("change")},isDirty:function(){return this.dirty},clear:function(){this.positions=[];this.shapesMap={};this.positionsMap={};this.selectedShapes=[];this.fireEvent("change")},makeDynamic:function(){this.style="dynamic"},makeStatic:function(){this.style="static"},isDynamic:function(){return this.style=="dynamic"},isStatic:function(){return !this.isDynamic()},freeze:function(){this.fireEvent("freeze")},thaw:function(){this.fireEvent("thaw")},at:function(b,a){this.newTop=a;this.newLeft=b;return this},put:function(a){return this.add(a)},add:function(b){var a=new Canvas2D.Position(b,this.newLeft,this.newTop);b.on("change",this.makeDirty.scope(this));a.on("change",this.makeDirty.scope(this));this.newLeft=null;this.newTop=null;this.positions.push(a);this.shapesMap[b.getName().replace(/<.*$/,"")]=b;this.positionsMap[b.getName()]=a;this.fireEvent("newShape","added new shape"+(a.getLeft()!=null?"@"+a.getLeft()+","+a.getTop():""));this.makeDirty();return b},getPosition:function getPosition(a){return this.positionsMap[a.getName()]},hit:function(b,d){for(var c=this.positions.length-1;c>=0;c--){var a=this.positions[c];if(a.hit(b,d)){if(Canvas2D.Keyboard.keyDown(91)||Canvas2D.Keyboard.keyDown(17)){if(this.selectedShapes.contains(a)){this.selectedShapes.remove(a)}else{this.selectedShapes.push(a)}}else{if(!this.selectedShapes.contains(a)){this.selectedShapes=[a]}else{return}}this.fireEvent("shapeSelected",a);return}}this.selectedShapes=[]},hitArea:function(f,e,c,b){var a=(Canvas2D.Keyboard.keyDown(91)||Canvas2D.Keyboard.keyDown(17))?this.selectedShapes:[];for(var d=this.positions.length-1;d>=0;d--){if(this.positions[d].hitArea(f,e,c,b)){a.push(this.positions[d]);this.fireEvent("shapeSelected",this.positions[d])}}this.selectedShapes=a.unique()},handleMouseDown:function(a){if(!this.isDynamic()){return}this.hit(a.x,a.y);this.currentPos=a;this.makeDirty()},handleMouseUp:function(a){if(!this.isDynamic()){return}this.selectedShapes.iterate(function(b){this.fireEvent("shapesMoved","Shape moved to "+b.left+", "+b.top)}.scope(this));this.showSelection=false;this.makeDirty()},handleMouseDrag:function(a){if(!this.isDynamic()){return}if(!this.showSelection&&this.selectedShapes.length>0){this.moveCurrentSelection(a.dx,a.dy)}else{if(!this.currentPos){this.currentPos=a}this.showSelection=true;this.hitArea(this.currentPos.x,this.currentPos.y,a.x,a.y);this.selectionPos=a}this.makeDirty()},selectAllShapes:function(){this.selectedShapes=[];this.positions.iterate(function(a){this.selectedShapes.push(a)}.scope(this));this.makeDirty()},moveCurrentSelection:function(b,a){this.selectedShapes.iterate(function(c){c.move(b,a)}.scope(this))},handleKeyDown:function(a){if(Canvas2D.Keyboard.keyDown(16)){switch(a){case 37:this.moveCurrentSelection(-5,0);break;case 38:this.moveCurrentSelection(0,-5);break;case 39:this.moveCurrentSelection(5,0);break;case 40:this.moveCurrentSelection(0,5);break}}if((Canvas2D.Keyboard.keyDown(91)||Canvas2D.Keyboard.keyDown(17))&&a==65&&this.canvas.mouseOver){this.selectAllShapes()}},addSelectionOverlay:function(){if(this.showSelection){var c=this.selectionPos;var b=c.x-this.currentPos.x;var a=c.y-this.currentPos.y;this.canvas.fillStyle="rgba( 0, 0, 255, 0.1 )";this.canvas.fillRect(c.x<=this.currentPos.x?c.x:this.currentPos.x,c.y<=this.currentPos.y?c.y:this.currentPos.y,Math.abs(b),Math.abs(a))}},addSelectionMarkers:function(){this.selectedShapes.iterate(function(a){var b=a.getBox();this.canvas.fillStyle="rgba( 200, 200, 255, 1 )";[[b.left,b.top],[b.right,b.top],[b.left,b.bottom],[b.right,b.bottom]].iterate(function(c){this.canvas.beginPath();this.canvas.arc(c[0],c[1],5,0,Math.PI*2,true);this.canvas.fill()}.scope(this))}.scope(this))},render:function(){var a=[];this.positions.iterate(function(b){if(b.delayRender()){a.push(b)}else{b.render(this)}}.scope(this));a.iterate(function(b){b.render(this)}.scope(this));this.addSelectionOverlay();this.addSelectionMarkers()},toADL:function(){var a="";a+="Sheet "+this.name;a+=" +"+this.style+" {\n";this.positions.iterate(function(b){var c=b.toADL("  ");if(c){a+=c+"\n"}});a+="}";return a}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Sheet.prototype);Canvas2D.Sheet.Properties=["globalAlpha","globalCompositeOperation","strokeStyle","fillStyle","lineWidth","lineCap","lineJoin","miterLimit","shadowOffsetX","shadowOffsetY","shadowBlur","shadowColor","font","textAlign","textBaseline","lineStyle","useCrispLines","textDecoration"];Canvas2D.Sheet.Operations=["save","restore","scale","rotate","translate","transform","setTransform","createRadialGradient","createPattern","clearRect","fillRect","strokeRect","beginPath","closePath","moveTo","lineTo","quadraticCurveTo","bezierCurveTo","arcTo","rect","arc","fill","stroke","clip","isPointInPath","fillText","fillText","strokeText","strokeText","measureText","drawImage","createImageData","getImageData","putImageData","getFontSize","fillStrokeRect"];Canvas2D.Sheet.from=function(a,c){var d="static";var b=a.modifiers.get("style");if(b){d=b.value.value.toLowerCase()}a.modifiers.iterate(function(e,f){if(e.toLowerCase()=="static"||e.toLowerCase()=="dynamic"){d=e.toLowerCase()}});return new Canvas2D.Sheet({name:a.name,style:d})};Canvas2D.Sheet.MANIFEST={name:"sheet",properties:[],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Sheet);Canvas2D.Position=Class.extend({init:function(a,c,b){this.shape=a;this.left=c||null;this.top=b||null},toADL:function(a){var b="";if(this.left!=null&&this.top!=null){b=a+"[@"+this.left+","+this.top+"]\n"}return b+this.shape.toADL(a)},getLeft:function(){return this.left},getTop:function(){return this.top},getWidth:function(){return this.shape.getWidth()},getHeight:function(){return this.shape.getHeight()},getCenter:function(){var a=this.shape.getCenter();a.left+=this.left;a.top+=this.top;return a},getBox:function(){return{left:this.left,right:this.left+this.shape.getWidth(),top:this.top,bottom:this.top+this.shape.getHeight()}},getPort:function(a){var a=this.shape.getPort(a);a.left+=this.left;a.top+=this.top;return a},render:function(a){this.shape.render(a,this.left,this.top)},move:function(a,b){this.left+=a;this.top+=b;this.fireEvent("change","from "+this.left-a+","+this.top-b+" to "+this.left+","+this.top)},getName:function(){return this.shape.getName()},hit:function(a,d){var c=a-this.left;var b=d-this.top;if(c<0||b<0){return false}return this.shape.hit(c,b)},hitArea:function(g,f,c,b){var h=g-this.left;var e=f-this.top;var a=c-this.left;var d=b-this.top;return this.shape.hitArea(min(h,a),min(e,d),max(h,a),max(e,d))},delayRender:function(){return this.shape.delayRender()}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.Position.prototype);Canvas2D.Connector=Canvas2D.Shape.extend({preprocess:function preprocess(a){a=this._super(a);if(a.from==a.to){a.routing="recursive"}return a},getFrom:function(a){return a?a.getPosition(this.from):this.from},getTo:function(a){return a?a.getPosition(this.to):this.to},delayRender:function(){return true},isValid:function(){return this.to!=null&&this.from!=null},draw:function(a,c,b){if(!this.isValid()){return}a.save();a.useCrispLines=this.getUseCrispLines();a.strokeStyle=this.getLineColor();a.lineWidth=this.getLineWidth();a.lineStyle=this.getLineStyle();a.beginPath();switch(this.getRouting()){case"custom":this._custom(a);break;case"recursive":this._recursive(a);break;case"vertical":this._vertical(a);break;case"horizontal":this._horizontal(a);break;case"direct":default:this._direct(a)}a.stroke();a.closePath();a.restore()},_custom:function _custom(c){var b=this.getFrom(c);var d=this.getTo(c);var e=b.getPort(this.getRouteBegin());var a=d.getPort(this.getRouteEnd());a=this._draw_end_connector(c,a);e=this._draw_start_connector(c,e);switch(this.getRouteStyle()){case"corner":this._draw_corner(c,e,a);break;case"tree":this._draw_tree(c,e,a);break;case"direct":default:this._draw_direct(c,e,a)}},_draw_direct:function _draw_direct(b,c,a){b.lineTo(a.left,a.top)},_draw_corner:function _draw_corner(b,d,a){var c=this.getRouteBegin().substring(0,1);if(c=="n"||c=="s"){b.lineTo(d.left,a.top)}else{b.lineTo(a.left,d.top)}b.lineTo(a.left,a.top)},_draw_tree:function _draw_tree(d,f,b){var e=this.getRouteBegin().substring(0,1);var c=b.left-f.left;var a=b.top-f.top;if(e=="n"||e=="s"){d.lineTo(f.left,f.top+a/2);d.lineTo(b.left,f.top+a/2)}else{d.lineTo(f.left+c/2,f.top);d.lineTo(f.left+c/2,b.top)}d.lineTo(b.left,b.top)},_recursive:function _recursive(e){var b=this.getFrom(e);var h=b.getPort("e");var a=b.getPort("n");var c=parseInt(b.getWidth()/4);var f=parseInt(b.getHeight()/4);var g=30;this.draw_start_connector(e,b,"e",h.left,h.top-f);e.lineTo(h.left+g,h.top-f);e.lineTo(h.left+g,a.top-g);e.lineTo(a.left+c,a.top-g);this.draw_end_connector(e,b,"n",a.left+c,a.top);e.lineTo(a.left+c,a.top-g)},_draw_start_connector:function draw_start_connector(d,e){var b=null;var c=this.getRouteBegin();if(this.getBegin()){var a=this.getBegin();b=a[c]?a[c]:a[c.substring(0,1)]}return this._draw_connector(d,b,e.left,e.top)},_draw_end_connector:function draw_start_connector(d,e){var b=null;var c=this.getRouteEnd();if(this.getEnd()){var a=this.getEnd();b=a[c]?a[c]:a[c.substring(0,1)]}return this._draw_connector(d,b,e.left,e.top)},_direct:function(a){var c,b;c=this.getFrom(a).getCenter();b=this.getTo(a).getCenter();a.moveTo(c.left,c.top);a.lineTo(b.left,b.top)},draw_start_connector:function draw_start_connector(d,c,b,f,e){f=f||c.getPort(b).left;e=e||c.getPort(b).top;var a=null;if(this.getBegin()){a=this.getBegin()[b]}return this._draw_connector(d,a,f,e)},draw_end_connector:function start_connector(d,c,b,f,e){f=f||c.getPort(b).left;e=e||c.getPort(b).top;var a=null;if(this.getEnd()){a=this.getEnd()[b]}return this._draw_connector(d,a,f,e)},draw_connector:function(d,c,b,f,e){f=f||c.getPort(b).left;e=e||c.getPort(b).top;var a=null;if(c==this.getFrom(d)&&this.getBegin()){a=this.getBegin()[b]}if(c==this.getTo(d)&&this.getEnd()){a=this.getEnd()[b]}return this._draw_connector(d,a,f,e)},_draw_connector:function(c,b,e,d){c.moveTo(e,d);if(b){var a=c.lineStyle;c.lineStyle="solid";c.stroke();c.beginPath();c.moveTo(e,d);b.lines.iterate(function(f){if(f=="fill"){c.fillStyle="rgba( 0, 0, 0, 1 )";c.fill()}else{c.lineTo(e+f[0],d+f[1])}});c.stroke();c.beginPath();c.lineStyle=a;c.moveTo(e+b.end[0],d+b.end[1]);return{left:e+b.end[0],top:d+b.end[1]}}return{left:e,top:d}},initialBranchLength:function(b,a){return(a-b)/2},_vertical:function(b){var c,a;if(this.getFrom(b).getBox().top<this.getTo(b).getBox().top){c=this.getFrom(b);a=this.getTo(b)}else{c=this.getTo(b);a=this.getFrom(b)}if(a.getBox().top-c.getBox().bottom>=Canvas2D.Connector.Defaults.minTreeDist){this._vertical_tree(b,c,a)}else{if(a.getCenter().top-c.getBox().bottom>=Canvas2D.Connector.Defaults.minCornerDist){this._vertical_corner(b,c,a)}else{this._vertical_line(b,this.getFrom(b),this.getTo(b))}}},_vertical_tree:function(d,e,c){this.draw_connector(d,e,"s");var f=e.getPort("s");var b=c.getPort("n");var a=this.initialBranchLength(f.top,b.top);d.lineTo(f.left,f.top+a);d.lineTo(b.left,f.top+a);this.draw_connector(d,c,"n");d.lineTo(b.left,f.top+a)},_vertical_corner:function(c,e,b){this.draw_connector(c,e,"s");var f=e.getPort("s");var d=f.left<b.getPort("w").left?"w":"e";var a=b.getPort(d);c.lineTo(f.left,a.top);this.draw_connector(c,b,d);c.lineTo(f.left,a.top)},_vertical_line:function(d,g,f){var c,a;if(g.getBox().right<f.getBox().left){c="e";a="w"}else{c="w";a="e"}var e=g.getPort(c).top-((g.getPort(c).top-f.getPort(a).top)/2);var b=(f.getPort(a).left-g.getPort(c).left)/2;this.draw_connector(d,g,c,null,e);d.lineTo(g.getPort(c).left+b,e);this.draw_connector(d,f,a,null,e);d.lineTo(g.getPort(c).left+b,e)},_horizontal:function(b){var c,a;if(this.getFrom(b).getBox().left<this.getTo(b).getBox().left){c=this.getFrom(b);a=this.getTo(b)}else{c=this.getTo(b);a=this.getFrom(b)}if(a.getBox().left-c.getBox().right>=Canvas2D.Connector.Defaults.minTreeDist){this._horizontal_tree(b,c,a)}else{if(a.getCenter().left-c.getBox().right>=Canvas2D.Connector.Defaults.minCornerDist){this._horizontal_corner(b,c,a)}else{this._horizontal_line(b,this.getFrom(b),this.getTo(b))}}},_horizontal_tree:function(c,d,b){this.draw_connector(c,d,"e");var e=d.getPort("e");var a=b.getPort("w");var f=this.initialBranchLength(e.left,a.left);c.lineTo(e.left+f,e.top);c.lineTo(e.left+f,a.top);this.draw_connector(c,b,"w");c.lineTo(e.left+f,a.top)},_horizontal_corner:function(c,e,b){this.draw_connector(c,b,"w");var f=b.getPort("w");var d=f.top<e.getPort("n").top?"n":"s";var a=e.getPort(d);c.lineTo(a.left,f.top);this.draw_connector(c,e,d);c.lineTo(a.left,f.top)},_horizontal_line:function(e,g,f){var d,c;if(g.getBox().bottom<f.getBox().top){d="s";c="n"}else{d="n";c="s"}var a=g.getPort(d).left-((g.getPort(d).left-f.getPort(c).left)/2);var b=(f.getPort(c).top-g.getPort(d).top)/2;this.draw_connector(e,g,d,a);e.lineTo(a,g.getPort(d).top+b);this.draw_connector(e,f,c,a);e.lineTo(a,g.getPort(d).top+b)},hit:function(a,b){return false},asConstruct:function(){var a=this._super();if(this.getFrom()&&this.getTo()){a.modifiers[this.getFrom().getName()+"-"+this.getTo().getName()]=null}a.modifiers[this.getRouting()]=null;if(this.getRouting()=="custom"){a.annotation.data=this.getRouteStyle()+":"+this.getRouteBegin()+"-"+this.getRouteEnd()}a.addModifiers(["lineColor","lineStyle","lineWidth","begin","end"]);return a}});Canvas2D.Connector.from=function(b,c){var d={name:b.name};b.modifiers.iterate(function(g,h){if(h.value==null){if(g.contains("-")){var k=g.split("-");d.from=c.shapesMap[k[0]];d.to=c.shapesMap[k[1]]}else{d.routing=g;if(g=="custom"&&b.annotation&&b.annotation.data&&b.annotation.data.contains(":")&&b.annotation.data.contains("-")){var k=b.annotation.data.split(":");d.routeStyle=k[0];var f=k[1].split("-");d.routeBegin=f[0];d.routeEnd=f[1]}}}else{d[g]=(g=="from"||g=="to")?c.shapesMap[h.value.value]:h.value.value;if(g=="begin"||g=="end"){d[g]=Canvas2D.CustomConnectors[d[g]]}}});errors=[];warnings=[];if(!d.from){errors.push("Missing FROM connection-end on "+b.name)}if(!d.to){errors.push("Missing TO connection-end on "+b.name)}if(!["vertical","horizontal","direct","custom"].has(d.routing)){warnings.push("unknown routing: "+d.routing+", defaulting to direct.")}var a={};if(warnings.length>0){a.warnings=warnings}if(errors.length>0){a.errors=errors}else{var e=new Canvas2D.Connector(d);e.warnings=a.warnings;a=e}return a};Canvas2D.Connector.MANIFEST={name:"connector",aliasses:["link"],properties:["lineColor","lineStyle","lineWidth","from","to","begin","end","routing","routeStyle","routeBegin","routeEnd"],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Connector);Canvas2D.CustomConnectors={};Canvas2D.registerConnector=function registerConnector(b,a){Canvas2D.CustomConnectors[b]=a};Canvas2D.Line=Canvas2D.Shape.extend({getWidth:function(){return this.getDx()},getHeight:function(){return this.getDy()},draw:function(a,c,b){a.beginPath();a.strokeStyle=this.getColor();a.lineWidth=this.getLineWidth();a.lineStyle=this.getLineStyle();a.moveTo(c,b);a.lineTo(c+this.getDx(),b+this.getDy());a.stroke();a.lineStyle="solid";a.closePath()},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(a){switch(a){case"n":case"north":return{top:0,left:this.getWidth()/2};break;case"s":case"south":return{top:this.getHeight(),left:this.getWidth()/2};break;case"e":case"east":return{top:this.getHeight()/2,left:this.getWidth()};break;case"w":case"west":return{top:this.getHeight()/2,left:0};break}},getGeo:function(){return this.getWidth()&&this.getHeight()?this.getWidth()+"x"+this.getHeight():null},asConstruct:function(){var a=this._super();a.addModifiers(["geo","color"]);return a}});Canvas2D.Line.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="dx"||d=="dy"||d=="lineWidth"){e=parseInt(e)}else{if(e==""){e=d;d="color"}}c[d]=e});return new Canvas2D.Line(c)};Canvas2D.Line.MANIFEST={name:"line",properties:["color","dx","dy","lineWidth","lineStyle"],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Line);Canvas2D.LinePath=Canvas2D.Shape.extend({getWidth:function(){return this.dx},getHeight:function(){return this.dy},getStart:function(){return this.start},getMoves:function(){return this.moves},preprocess:function(d){if(d.start){var e=d.start.split(",");d.start={left:parseInt(e[0]),top:parseInt(e[1])}}else{d.start={left:0,top:0}}if(d.moves){var b=[];var c=max(0,d.start.left);var a=max(0,d.start.top);d.moves.split(";").iterate(function(f){var g=f.split(",");b.push({dx:parseInt(g[0]),dy:parseInt(g[1])});c=max(c,c+parseInt(g[0]));a=max(a,a+parseInt(g[1]))});d.moves=b;d.dx=c;d.dy=a}return d},draw:function(a,c,b){a.beginPath();a.strokeStyle=this.getColor();a.lineWidth=this.getLineWidth();a.lineStyle=this.getLineStyle();c+=this.start.left;b+=this.start.top;a.moveTo(c,b);this.getMoves().iterate(function(d){c=c+d.dx;b=b+d.dy;a.lineTo(c,b)});a.stroke();a.closePath()},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(a){switch(a){case"n":case"north":return{top:0,left:this.getWidth()/2};break;case"s":case"south":return{top:this.getHeight(),left:this.getWidth()/2};break;case"e":case"east":return{top:this.getHeight()/2,left:this.getWidth()};break;case"w":case"west":return{top:this.getHeight()/2,left:0};break}},getGeo:function(){return this.getWidth()&&this.getHeight()?this.getWidth()+"x"+this.getHeight():null},asConstruct:function(){var a=this._super();a.addModifiers(["geo","color"]);return a}});Canvas2D.LinePath.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="dx"||d=="dy"||d=="lineWidth"){e=parseInt(e)}else{if(e==""){e=d;d="color"}}c[d]=e});return new Canvas2D.LinePath(c)};Canvas2D.LinePath.MANIFEST={name:"linepath",properties:["dx","dy","start","moves","color","lineWidth","lineStyle"],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.LinePath);Canvas2D.Alias=Canvas2D.Shape.extend({});Canvas2D.Alias.mapper={sheet:function(a){return function(b,d){var c=Canvas2D.Sheet.from(b,d);return c}},connector:function(a){return function(c,e){var b=new ADL.Modifier("routing",new ADL.String("vertical"));c.modifiers.set(b.key,b);var d=Canvas2D.Connector.from(c,e);return d}},image:function(a){var b=a.modifiers;return function(c,e){b.iterate(function(f,g){c.modifiers.set(f,g)});var d=Canvas2D.Image.from(c,e);return d}}};Canvas2D.Alias.from=function(a,b){Canvas2D.registerShape({prototype:{},MANIFEST:{name:a.name,libraries:["Aliasses"]},from:Canvas2D.Alias.mapper[a.supers[0]](a,b)})};Canvas2D.Alias.MANIFEST={name:"alias",aliasses:["shape"],libraries:[]};Canvas2D.registerShape(Canvas2D.Alias);Canvas2D.CompositeShape=Canvas2D.Shape.extend({hasChildren:function hasChildren(){return this.getChildren().length>0},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getWidth:function getWidth(a){if(this.grows&&this.getParent().composition.widthGrows()&&!a){return this.getParent().getWidth(a)}if(this.hasChildren()){return max(this.composition.getWidth(),this.width)}return this.width},getHeight:function getHeight(a){if(this.grows&&this.getParent().composition.heightGrows()&&!a){return this.getParent().getHeight(a)}if(this.hasChildren()){return max(this.composition.getHeight(),this.height)}return this.height},getChildren:function getChildren(){if(!this.children){this.children=[]}return this.children},preprocess:function preprocess(b){b.composition=b.composition||"vertical-stack";var a=[];if(b.composition.contains(":")){a=b.composition.split(":");b.composition=a.shift()}b.composition=new Canvas2D.Compositors[b.composition](a,this);return b},draw:function(a,c,b){this.getChildren().iterate(function(f){var e=this.composition.getPosition(f,this.getChildren());f.render(a,c+e.left,b+e.top)}.scope(this))},prepare:function(a){this._super();if(this.hasChildren()){this.prepareChildren(a);this.composition.prepare()}},prepareChildren:function prepareChildren(a){this.getChildren().iterate(function(b){b.prepare(a)})},add:function add(a){a.topDown=true;this.getChildren().push(a);a.setParent(this)},asConstruct:function(){var a=this._super();return a}});Canvas2D.CompositeShape.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(""+e==""){e=d;d="composition"}c[d]=e});return new Canvas2D.CompositeShape(c)};Canvas2D.CompositeShape.MANIFEST={name:"compositeShape",aliasses:["group"],properties:["width","height","grows","composition","padding"]};Canvas2D.registerShape(Canvas2D.CompositeShape);Canvas2D.Compositors={"vertical-stack":Class.extend({init:function init(b,a){this.align=b.contains("left")?"left":b.contains("right")?"right":"center";this.shape=a},prepare:function prepare(){this.left=0;this.top=0},getPadding:function getPadding(){return parseInt(this.shape.padding?this.shape.padding:0)},getPosition:function(d){var a=this.getPadding();var b=this.shape.getWidth();if(this.align=="center"){a=(b-d.getWidth())/2}else{if(this.align=="right"){a=b-d.getWidth()-this.getPadding()}}var c=this.top;this.top+=d.getHeight();return{left:this.left+a,top:c+this.getPadding()}},getWidth:function getWidth(){var a=0;this.shape.getChildren().iterate(function(b){a=max(b.getWidth(b.grows),a)});return a+this.getPadding()*2},getHeight:function getHeight(){var a=0;this.shape.getChildren().iterate(function(b){a+=b.getHeight(b.grows)});return a+this.getPadding()*2},heightGrows:function heightGrows(){return false},widthGrows:function widthGrows(){return true}}),"horizontal-stack":Class.extend({init:function init(b,a){this.align=b.contains("top")?"top":b.contains("bottom")?"bottom":"center";this.shape=a},prepare:function prepare(){this.left=0;this.top=0},getPosition:function(d){var b=0;var a=this.shape.getHeight();if(this.align=="center"){b=(a-d.getHeight())/2}else{if(this.align=="bottom"){b=a-d.getHeight()}}var c=this.left;this.left+=d.getWidth();return{left:c,top:this.top+b}},getWidth:function getWidth(){var a=0;this.shape.getChildren().iterate(function(b){a+=b.getWidth(b.grows)});return a},getHeight:function getHeight(){var a=0;this.shape.getChildren().iterate(function(b){a=max(b.getHeight(b.grows),a)});return a},heightGrows:function heightGrows(){return true},widthGrows:function widthGrows(){return false}})};Canvas2D.Rectangle=Canvas2D.CompositeShape.extend({draw:function(b,e,d){b.useCrispLines=this.getUseCrispLines();b.lineWidth=this.getLineWidth();b.strokeStyle=this.getLineColor();b.fillStyle=this.getFillColor();var c=this.getWidth();var a=this.getHeight();b.fillRect(e,d,c,a);b.strokeRect(e,d,c,a);this._super(b,e,d)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(b){var a={nw:{left:0,top:0},nnw:{left:0.25,top:0},n:{left:0.5,top:0},nne:{left:0.75,top:0},ne:{left:1,top:0},ene:{left:1,top:0.25},e:{left:1,top:0.5},ese:{left:1,top:0.75},se:{left:1,top:1},sse:{left:0.75,top:1},s:{left:0.5,top:1},ssw:{left:0.25,top:1},sw:{left:0,top:1},wsw:{left:0,top:0.75},w:{left:0,top:0.5},wnw:{left:0,top:0.25}};if(!a[b]){return{left:0,top:0}}return{left:a[b].left*this.getWidth(),top:a[b].top*this.getHeight()}},getGeo:function(){return this.getWidth()&&this.getHeight()?this.getWidth()+"x"+this.getHeight():null},asConstruct:function(){var a=this._super();a.addModifiers(["geo","lineColor"]);return a}});Canvas2D.Rectangle.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="width"||d=="height"){e=parseInt(e)}if(d=="geo"){c.width=parseInt(e.split("x")[0]);c.height=parseInt(e.split("x")[1])}if(""+e==""){e=d;d="lineColor"}c[d]=e});return new Canvas2D.Rectangle(c)};Canvas2D.Rectangle.MANIFEST={name:"rectangle",aliasses:["box"],properties:["lineWidth","lineColor","fillColor"],propertyPath:[Canvas2D.CompositeShape],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Rectangle);Canvas2D.Text=Canvas2D.Rectangle.extend({prepare:function(a){a.useCrispLines=this.getUseCrispLines();a.strokeStyle=this.getColor();a.fillStyle=this.getColor();a.font=this.getFont();a.textAlign=this.getTextAlign();a.textDecoration=this.getTextDecoration();this.width=a.measureText(this.getText());this.height=a.getFontSize()},draw:function(a,c,b){if(this.getTopDown()){b+=this.getHeight()}a.fillText(this.getText(),c,b)},asConstruct:function(){var a=this._super();a.addModifiers(["color"]);return a}});Canvas2D.Text.from=function(a,c){var b={name:a.name,text:a.value.value};a.modifiers.iterate(function(d,e){e=(typeof e.value!="undefined"?e.value.value:"");b[d]=e});return new Canvas2D.Text(b)};Canvas2D.Text.MANIFEST={name:"text",properties:["text","color","font","textAlign","textDecoration"],propertyPath:[Canvas2D.Rectangle],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Text);Canvas2D.Image=Canvas2D.Rectangle.extend({getSource:function(){return this.src},getImage:function(){return this.image},postInitialize:function(){if(this.getSource()){this.image=Canvas2D.ImageManager.load(this.getSource(),this.updateSize.scope(this))}},updateSize:function(){this.width=this.image.width;this.height=this.image.height},draw:function(a,c,b){a.drawImage(this.getImage(),c,b)},asConstruct:function(){var a=this._super();a.addModifiers(["source"]);return a}});Canvas2D.Image.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){c[d]=e.value.value});return new Canvas2D.Image(c)};Canvas2D.Image.MANIFEST={name:"image",aliasses:["pic","picture"],properties:["src"],propertyPath:[Canvas2D.Rectangle],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Image);Canvas2D.Arrow=Canvas2D.Rectangle.extend({draw:function(a,c,b){a.useCrispLines=this.getUseCrispLines();a.lineWidth=this.getLineWidth();a.strokeStyle=this.getLineColor();a.fillStyle=this.getFillColor();a.fillRect(c,b,this.getWidth()-this.getArrowHeadWidth(),this.getHeight());a.strokeRect(c,b,this.getWidth()-this.getArrowHeadWidth(),this.getHeight());a.beginPath();a.moveTo(c+this.getWidth()-this.getArrowHeadWidth(),b);a.lineTo(c+this.getWidth()-this.getArrowHeadWidth(),b+(this.getHeight()/2)-(this.getArrowHeadHeight()/2));a.lineTo(c+this.getWidth(),b+(this.getHeight()/2));a.lineTo(c+this.getWidth()-this.getArrowHeadWidth(),b+(this.getHeight()/2)+(this.getArrowHeadHeight()/2));a.closePath();a.stroke();a.fill()},hit:function(a,b){return(this.getWidth()>=a&&this.getHeight()>=b)},hitArea:function(d,c,b,a){return !(0>b||this.getWidth()<d||0>a||this.getHeight()<c)},getCenter:function(){return{left:this.getWidth()/2,top:this.getHeight()/2}},getPort:function(a){switch(a){case"n":case"north":return{top:0,left:this.getWidth()/2};break;case"s":case"south":return{top:this.getHeight(),left:this.getWidth()/2};break;case"e":case"east":return{top:this.getHeight()/2,left:this.getWidth()};break;case"w":case"west":return{top:this.getHeight()/2,left:0};break}}});Canvas2D.Arrow.from=function(a,b){var c={name:a.name};a.modifiers.iterate(function(d,e){e=(e.value?e.value.value:"");if(d=="width"||d=="height"){e=parseInt(e)}if(d=="geo"){c.width=parseInt(e.split("x")[0]);c.height=parseInt(e.split("x")[1])}if(""+e==""){e=d;d="lineColor"}c[d]=e});return new Canvas2D.Arrow(c)};Canvas2D.Arrow.MANIFEST={name:"arrow",aliasses:["pointer"],properties:["width","height","arrowHeadWidth","arrowHeadHeight"],propertyPath:[Canvas2D.Rectangle],libraries:["Canvas2D"]};Canvas2D.registerShape(Canvas2D.Arrow);Canvas2D.Book.plugins.TabbedCanvas=Class.extend({init:function(a){this.book=a},makeTab:function(c,b,f){var e=document.createElement("div");e.className="tabbertab";e.style.height=(4+parseInt(b))+"px";var d=document.createElement("h2");var a=document.createTextNode(c);d.appendChild(a);e.appendChild(d);e.appendChild(f);return e},getAboutTab:function(){var d=this.book.canvas.canvas.width;var a=this.book.canvas.canvas.height;var c=document.createElement("div");c.className="Canvas2D-about";c.style.height=a+"px";c.style.width=(parseInt(d)-4)+"px";var b="";Canvas2D.extensions.iterate(function(e){b+="\n<hr>\n";b+="<b>Library: "+e.name+" "+e.version+"</b> by "+e.author+"<br>"+e.info});c.innerHTML='<span class="Canvas2D-about-text"><b>Canvas2D '+Canvas2D.version+'</b><br>Copyright &copy 2009, <a href="http://christophe.vg" target="_blank">Christophe VG</a> & <a href="http://thesoftwarefactory.be" target="_blank">The Software Factory</a><br>Visit <a href="http://thesoftwarefactory.be/wiki/Canvas2D" target="_blank">http://thesoftwarefactory.be/wiki/Canvas2D</a> for more info. Licensed under the <a href="http://thesoftwarefactory.be/wiki/BSD_License" target="_blank">BSD License</a>.'+b+"</span>";return this.makeTab("About",a,c)},getConsoleTab:function(){var b=this.book.canvas.canvas.width;var a=this.book.canvas.canvas.height;this.book.console=document.createElement("textarea");this.book.console.className="Canvas2D-console";this.book.console.style.height=a+"px";this.book.console.style.width=(parseInt(b)-4)+"px";return this.makeTab("Console",a,this.book.console)},getSourceTab:function(){var c=this.book.canvas.canvas.width;var a=this.book.canvas.canvas.height;var b=this.book.generated?this.book.generated.value:"";this.book.generated=document.createElement("textarea");this.book.generated.value=b;this.book.generated.className="Canvas2D-source";this.book.generated.style.height=a+"px";this.book.generated.style.width=(parseInt(c)-4)+"px";return this.makeTab("Source",a,this.book.generated)},applyTabber:function(){var d=this.book.canvas.canvas;this.tabber=document.createElement("div");this.tabber.className="tabber";this.tabber.style.width=(parseInt(d.width)+17)+"px";this.tabber.style.height=(parseInt(d.height)+37)+"px";d.parentNode.replaceChild(this.tabber,d);var b=document.createElement("div");b.className="tabbertab";var a=document.createElement("h2");var c=document.createTextNode("Diagram");a.appendChild(c);b.appendChild(a);b.appendChild(d);this.tabber.appendChild(b)},makeTabbed:function(a){if(!this.tabber){this.applyTabber()}if(!Object.isArray(a)){return}if(a.contains("console")){this.tabber.appendChild(this.getConsoleTab())}if(a.contains("source")){this.tabber.appendChild(this.getSourceTab())}if(a.contains("about")){this.tabber.appendChild(this.getAboutTab())}tabberAutomatic()}});Canvas2D.Book.plugins.TabbedCanvas.exposes=["makeTabbed"];Canvas2D.Book.plugins.AutoLayout=Class.extend({init:function(a){this.book=a;this.active=false},autoLayout:function autoLayout(a){this.strategy=a;this.strategy.start();this.active=true;this.book.rePublish()},beforeRender:function beforeRender(d){if(!this.active){return}var b=[];var a=$H();var e=0;d.getCurrentSheet().positions.iterate(function(c){if(!(c.shape instanceof Canvas2D.Connector)){b.push({position:c,x:c.left+c.shape.getWidth()/2,y:c.top+c.shape.getHeight()/2,s:c.shape.getWidth()>c.shape.getHeight()?c.shape.getWidth():c.shape.getHeight(),f1:0,f2:0,c:[]});a.set(c.shape.getName(),parseInt(e++))}});d.getCurrentSheet().positions.iterate(function(g){if(g.shape instanceof Canvas2D.Connector){var f=a.get(g.shape.getFrom(d.getCurrentSheet()).getName());var c=a.get(g.shape.getTo(d.getCurrentSheet()).getName());b[f].c.push(c);b[c].c.push(f)}});b=this.strategy.layout(b);if(b){b.iterate(function(c){c.position.left=c.x-c.position.shape.getWidth()/2;c.position.top=c.y-c.position.shape.getHeight()/2})}else{this.active=false}},afterPublish:function afterPublish(a){if(this.active){a.rePublish()}}});Canvas2D.Book.plugins.AutoLayout.exposes=["autoLayout"];var ForceLayoutStrategy=Class.extend({init:function initialize(a){this.max_repulsive_force_distance=a.max_repulsive_force_distance||50;this.k=a.k||20;this.c=a.c||0.05;this.max_movement=a.max_movement||10;this.max_iterations=a.max_iterations||1000;this.render=a.render||function(){};this.canContinue=a.canContinue||function(){return false}},getIterations:function getIterations(){return this.iteration},start:function start(){this.iteration=0},layout:function layout(a){this.elements=a;if(this.canContinue()){if(this.iteration<=this.max_iterations){this._layout();return this.elements}}return null},_layout:function layout(){this.iteration++;if(this.canContinue()){if(this.iteration<=this.max_iterations){this._layout_iteration()}else{console.log("max iterations ("+this.max_iterations+") reached.")}}},_layout_iteration:function _layout_iteration(){for(var d=0;d<this.elements.length;d++){this.elements[d].f1=0;this.elements[d].f2=0}for(var d=0;d<this.elements.length;d++){for(var e=0;e<this.elements.length;e++){if(d!==e){this._layout_repulsive(d,e)}}}for(var d=0;d<this.elements.length;d++){for(var e=0;e<this.elements.length;e++){if(d!==e&&this.elements[e].c.indexOf(d)>-1){this._layout_attractive(d,e)}}}for(var d=0;d<this.elements.length;d++){var c=this.c*this.elements[d].f1;var b=this.c*this.elements[d].f2;var a=this.max_movement;if(c>a){c=a}if(c<a*-1){c=a*-1}if(b>a){b=a}if(b<a*-1){b=a*-1}this.elements[d].x+=c;this.elements[d].y+=b}},_layout_repulsive:function _layout_repulsive(e,h){var b=this.elements[h].x-this.elements[e].x;var a=this.elements[h].y-this.elements[e].y;var f=b*b+a*a;if(f<0.01){b=Math.random()+0.1;a=Math.random()+0.1;f=b*b+a*a}var g=Math.sqrt(f);if(g<this.max_repulsive_force_distance){var c=this.k*this.k/g;this.elements[h].f1+=c*b/g;this.elements[h].f2+=c*a/g;this.elements[e].f1-=c*b/g;this.elements[e].f2-=c*a/g}},_layout_attractive:function _layout_attractive(e,k){var b=this.elements[k].x-this.elements[e].x;var a=this.elements[k].y-this.elements[e].y;var f=b*b+a*a;if(f<0.01){b=Math.random()+0.1;a=Math.random()+0.1;f=b*b+a*a}var h=Math.sqrt(f);if(h>this.max_repulsive_force_distance){h=this.max_repulsive_force_distance;f=h*h}var c=(f-this.k*this.k)/this.k;var g=this.elements[e].s;if(g<1){g=1}c*=Math.log(g)*0.5+1;this.elements[k].f1-=c*b/h;this.elements[k].f2-=c*a/h;this.elements[e].f1+=c*b/h;this.elements[e].f2+=c*a/h}});Canvas2D.KickStart={};Canvas2D.KickStart.Starter=Class.extend({init:function(){this.manager=new Canvas2D.Manager()},getTag:function(){return"Canvas2D"},makeInstance:function(a){return this.manager.setupBook(a)},start:function(){var m=document.getElementsByTagName("canvas");for(var k=0;k<m.length;k++){var d=m[k];var f=d.className;if(f.contains(this.getTag())){var b=d.id;var g=this.makeInstance(d);if(f.contains("Tabbed")){var l=[];if(f.contains("withSource")){l.push("source")}if(f.contains("withConsole")){l.push("console")}if(f.contains("withAbout")){l.push("about")}g.makeTabbed(l)}var e=document.getElementById(b+"Source");if(e){var a;try{a=e.firstChild.nodeValue}catch(h){a=e.value}g.load(a)}}}this.fireEvent("ready");this.manager.startAll()}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,Canvas2D.KickStart.Starter.prototype);Canvas2D.KickStarter=new Canvas2D.KickStart.Starter();ProtoJS.Event.observe(window,"load",function(){Canvas2D.KickStarter.start()});Canvas2D.KickStarter.on("ready",function(){Canvas2D.fireEvent("ready")});Canvas2D.Defaults={};Canvas2D.Defaults.Canvas={lineWidth:1,useCrispLines:true,lineStyle:"solid",strokeStyle:"black",fillStyle:"black",font:"10pt Sans-Serif",textAlign:"left",textBaseline:"alphabetic",textDecoration:"none"};Canvas2D.Sheet.Defaults={lineWidth:1,lineStyle:"solid",strokeStyle:"black",fillStyle:"black",font:"10pt Sans-Serif",textAlign:"left",textBaseline:"alphabetic",textDecoration:"none",shadowColor:"rgba(0,0,0,0.0)"};Canvas2D.Shape.Defaults={useCrispLines:true,label:"",labelFont:"7pt Sans-Serif",labelAlign:"center",labelPos:"center",labelColor:"black",labelUseCrispLines:false};Canvas2D.Rectangle.Defaults={useCrispLines:true,lineWidth:1,lineColor:"rgba(0,0,0,100)",fillColor:"rgba(255,255,255,0)",labelPos:"center",labelColor:"black",width:50,height:50};Canvas2D.Connector.Defaults={useCrispLines:true,lineWidth:1,lineColor:"black",lineStyle:"solid",begin:null,end:null,minTreeDist:30,minCornerDist:15};Canvas2D.Text.Defaults={useCrispLines:false,color:"black",font:"10pt Sans-Serif",textAlign:"left",textDecoration:"none"};Canvas2D.Line.Defaults={lineWidth:1,lineStyle:"solid",labelPos:"center",labelColor:"black",color:"black",dx:50,dy:50};Canvas2D.LinePath.Defaults={lineWidth:1,lineStyle:"solid",labelPos:"center",labelColor:"black",color:"black"};Canvas2D.Image.Defaults={};Canvas2D.Arrow.Defaults={};Canvas2D.CompositeShape.Defaults={};Canvas2D.version="0.3-33";var UMLCANVAS_VERSION="0.3-8";if(typeof decomposeVersion!="function"){function decomposeVersion(b){var a=b.match(/([0-9]+)\.([0-9]+)(-([0-9]+))?/);return{major:parseInt(a[1]),minor:parseInt(a[2]),build:parseInt(a[4])||0}}}if(typeof iRequire!="function"){function iRequire(d,a,c){var b=decomposeVersion(d.version);a=decomposeVersion(a);if((b.major<a.major)||(b.major==a.major&&b.minor<a.minor)||(b.major==a.major&&b.minor==a.minor&&b.build<a.build)){return false}if(c){c=decomposeVersion(c);if((b.major>c.major)||(b.major==c.major&&b.minor>c.minor)||(b.major==c.major&&b.minor==c.minor&&b.build>c.build)){return false}}return true}}if(!iRequire(Canvas2D,"0.2-5")){alert("UmlCanvas requires at least Canvas2D version 0.2-5. Current Canvas2D is "+Canvas2D.version)}var UmlCanvasBase=Class.extend({getModel:function getModel(a){a=a||"";return UmlCanvas.KickStarter.manager.getModel(a)},getPlugin:function getPlugin(a){a=a||"";return UmlCanvas.KickStarter.pluginManagerRepository.getManager(a)}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,UmlCanvasBase);var UmlCanvas=new UmlCanvasBase();UmlCanvas.version=UMLCANVAS_VERSION;UmlCanvas.activate=function activate(e){var c=document.getElementById(e);if(c){var d=new UmlCanvas.Manager();var b=d.setupModel(e);var a=b.addDiagram();d.startAll();return a}throw (e+" does not reference a known id on the document.")};ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,UmlCanvas);Canvas2D.extensions.push({name:"UmlCanvas",version:UMLCANVAS_VERSION,author:'<a href="http://christophe.vg">Christophe VG</a>',info:'Visit <a href="http://thesoftwarefactory.be/wiki/UmlCanvas">http://thesoftwarefactory.be/wiki/UmlCanvas</a> for more info.'});UmlCanvas.Config={};UmlCanvas.Config.Inspector={wireActivation:true};UmlCanvas.Config.Inspector.Icons={save:"http://static.thesoftwarefactory.be/images/icons/disk-black.png",reload:"http://static.thesoftwarefactory.be/images/icons/arrow-circle-315.png",left:"http://static.thesoftwarefactory.be/images/inspector/left.png",right:"http://static.thesoftwarefactory.be/images/inspector/right.png"};UmlCanvas.Config.HuC={repository_url:"http://hosted.umlcanvas.org/",repository_submit_url:"http://hosted.umlcanvas.org/submit/index.php"};UmlCanvas.Common={extractVisibility:function(a){var b=a.modifiers.get("visibility");if(b){return b.value.value}if(a.modifiers.get("public")){return"public"}if(a.modifiers.get("private")){return"private"}if(a.modifiers.get("protected")){return"protected"}return null},extractStatic:function(a){return a.modifiers.get("static")},extractAbstract:function(a){return a.modifiers.get("abstract")},determineVisibility:function(a){switch(a){case"__HIDE__":return"";case"protected":return"#";case"private":return"-";case"package":return"~"}return"+"}};UmlCanvas.Manager=Canvas2D.Manager.extend({setupModel:function(a){return this.addBook(new UmlCanvas.Model(a))},getModel:function(a){return this.getBook(a)}});UmlCanvas.Model=Canvas2D.Book.extend({addDiagram:function(a){unless(a instanceof UmlCanvas.Diagram,function(){a=new UmlCanvas.Diagram()});return this.addSheet(a)},getWidth:function getWidth(){return parseInt(this.canvas.canvas.width)},getHeight:function getHeight(){return parseInt(this.canvas.canvas.height)},getLeft:function getLeft(){return this.canvas.getLeft()},getTop:function getTop(){return this.canvas.getTop()},getPlugin:function getPlugin(a){return UmlCanvas.getPlugin(a).getInspector(this.name)},setSize:function setSize(b,a){this.canvas.canvas.width=b;this.canvas.canvas.height=a;this.rePublish()}});UmlCanvas.Diagram=Canvas2D.Sheet.extend({init:function(a){this._super(a);this.on("shapeSelected",this.handleElementSelected.scope(this));this.on("shapeChanged",this.handleElementChanged.scope(this))},handleElementSelected:function(a){if(a instanceof UmlCanvas.Interface){this.canvas.fireEvent("interfaceSelected",a.props)}else{if(a instanceof UmlCanvas.Class){this.canvas.fireEvent("classSelected",a.props)}}},handleElementChanged:function(a){if(a instanceof UmlCanvas.Interface){this.canvas.fireEvent("interfaceChanged",a.props)}else{if(a instanceof UmlCanvas.Class){this.canvas.fireEvent("classChanged",a.props)}}},addClass:function(a){return this.add(a)},getDiagramClass:function(a){return this.shapesMap[a.replace(/<.*$/,"")]},addRelation:function(a){return this.add(a)},toADL:function(){var a="";a+="Diagram "+this.name;a+=" +"+this.style+" {\n";this.positions.iterate(function(b){var c=b.toADL("  ");if(c){a+=c+"\n"}});a+="}";return a},asConstruct:function(){var a=this._super();this.shapes.iterate(function(b){a.push(b.asConstruct())});return a}});UmlCanvas.Diagram.from=function(a,d){var e="static";var b=a.modifiers.get("style");if(b){e=b.value.value.toLowerCase()}a.modifiers.iterate(function(f,g){if(f.toLowerCase()=="static"||f.toLowerCase()=="dynamic"){e=f.toLowerCase()}});var c=new UmlCanvas.Diagram({name:a.name,style:e});d.addDiagram(c);return c};UmlCanvas.Diagram.MANIFEST={name:"diagram",propertyPath:[Canvas2D.Sheet],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Diagram);UmlCanvas.Class=Canvas2D.Rectangle.extend({addSuper:function(a){if(!this.supers){this.supers=[]}this.supers.push(a)},postInitialize:function(a){this.attributes=new Array();this.operations=new Array();this.markUnprepared();this.config=UmlCanvas.Class.Defaults},prepare:function(c){if(this.prepared){return}var a=[this.getName(),"<<"+this.getStereotype()+">>"];this.attributes.iterate(function(g){a.push(g.toString())});this.operations.iterate(function(g){a.push(g.toString())});var d=0;c.font=this.getFont();a.iterate(function(g){var h=c.measureText(g);d=h>=d?h:d}.scope(this));this.width=(2*this.config.padding)+d;this.width=this.width<this.getMinimumWidth()?this.getMinimumWidth():this.width;var e=parseInt(this.getFont())+this.config.lineSpacing;var b=this.attributes.length>0?(this.attributes.length*e)+(2*this.config.compartmentSpacing):0;var f=this.operations.length>0?(this.operations.length*e)+(2*this.config.compartmentSpacing):0;this.height=b+f+2*e+(2*this.config.padding);this.prepared=true},markUnprepared:function(){this.prepared=false;this.fireEvent("changed")},add:function add(a){},addAttribute:function(a){if(!(a instanceof UmlCanvas.Attribute)){a=new UmlCanvas.Attribute(a)}this.attributes.push(a);this.markUnprepared();return a},addOperation:function(a){if(!(a instanceof UmlCanvas.Operation)){a=new UmlCanvas.Operation(a)}this.operations.push(a);this.markUnprepared();return a},draw:function(c,g,f){this.prepare(c);c.useCrispLines=this.config.useCrispLines;c.fillStyle=this.config.backgroundColor;c.strokeStyle=this.config.lineColor;c.lineWidth=this.config.lineWidth;var d=parseInt(this.getFont())+this.config.lineSpacing;var a=(this.config.padding+d*2+this.config.compartmentSpacing);c.fillStrokeRect(g,f,this.getWidth(),a);var e=0;if(this.attributes.length>0){e=(this.config.compartmentSpacing+(d*this.attributes.length)+this.config.compartmentSpacing);c.fillStrokeRect(g,f+a,this.getWidth(),e)}var h=0;if(this.operations.length>0){h=(this.config.compartmentSpacing+(d*this.operations.length)+this.config.padding);c.fillStrokeRect(g,f+a+e,this.getWidth(),h)}c.useCrispLines=this.getUseCrispLines();c.fillStyle=this.getFontColor();c.font=this.getFontForClassName();c.textAlign="center";if(this.getStereotype()){c.fillText("<<"+this.getStereotype()+">>",g+(this.getWidth()/2),f+(this.config.padding+parseInt(this.getFont())))}c.fillText(this.getName(),g+(this.getWidth()/2),f+(this.config.padding+parseInt(this.getFont())+(this.getStereotype()?d:0)));c.textAlign="left";c.font=this.getFont();for(var b=0;b<this.attributes.length;b++){c.strokeStyle=this.getFontColor();c.textDecoration=this.attributes[b].isStatic()?this.config.decorationStatic:this.config.decoration;c.fillText(this.attributes[b].toString(),g+this.config.padding,f+a+(d*(b+1)))}for(var b=0;b<this.operations.length;b++){c.font=this.getFontForOperationName(this.operations[b]);c.strokeStyle=this.getFontColor();c.textDecoration=this.operations[b].isStatic()?this.config.decorationStatic:this.config.decoration;c.fillText(this.operations[b].toString(),g+this.config.padding,f+a+e+(d*(b+1)))}},getFontForClassName:function(){return this.getIsAbstract()?this.config.fontAbstract:this.getFont()},getFontForOperationName:function(a){return a.isAbstract()?this.config.fontAbstract:this.getFont()},asConstruct:function asConstruct(){var a=this._super();delete a.modifiers.geo;delete a.modifiers[this.getFontColor()];if(this.getMinimumWidth()){a.modifiers.minimumSize=this.getMinimumWidth()}if(this.getSupers()){var b=[];this.getSupers().iterate(function(c){b.push(c.getName())});a.supers=b}if(this.getStereotype()){a.modifiers.stereotype='"'+this.getStereotype()+'"'}if(this.getIsAbstract()){a.modifiers["abstract"]=null}this.attributes.iterate(function(c){a.children.push(c.asConstruct())});this.operations.iterate(function(c){a.children.push(c.asConstruct())});return a}});UmlCanvas.Class.from=function(a,d){var e={};e.name=a.name;var g=a.modifiers.get("minimumWidth");if(g){e.minimumWidth=parseInt(g.value.value)}var b=a.modifiers.get("stereotype");if(b&&b.value){e.stereotype=b.value.value}e.isAbstract=a.modifiers.get("abstract")!=null;var f=new UmlCanvas.Class(e);var h=[];var c=[];if(a.supers&&a.supers.length>0){a.supers.iterate(function(l){var m=d.getDiagramClass(l.constructName);if(m){f.addSuper(m);var k;if(m instanceof UmlCanvas.Interface){k=new UmlCanvas.Realization({from:m,to:f})}else{k=new UmlCanvas.Inheritance({from:m,to:f})}d.addRelation(k)}else{c.push("unknown superclass: "+l.constructName+", referenced by "+a.name)}})}if(h.length>0){return{errors:h,warnings:c}}else{f.warnings=c.length>0?c:null;return f}};UmlCanvas.Class.MANIFEST={name:"class",properties:["stereotype","isAbstract","supers","font","fontColor","minimumWidth"],propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Class);UmlCanvas.Attribute=Class.extend({init:function(a){this.visibility=a.visibility;this.ztatic=a.isStatic;this.name=a.name;this.type=a.type},setParent:function setParent(){},getName:function(){return this.name},getType:function(){return this.type},getVisibility:function(){return this.visibility},isStatic:function(){return this.ztatic},toString:function(){return UmlCanvas.Common.determineVisibility(this.visibility)+this.name+(this.type?" : "+this.type.toString():"")},asConstruct:function(){var a={};if(this.getVisibility()){a[this.getVisibility()]=null}if(this.isStatic()){a["static"]=null}return{type:"Attribute",name:this.getName(),supers:this.getType()?[this.getType()]:[],modifiers:a,children:[]}}});UmlCanvas.Attribute.from=function(a,c){var d={name:a.name,type:a.supers[0]?a.supers[0].toString():null};var b=UmlCanvas.Common.extractVisibility(a);if(b){d.visibility=b}d.isStatic=UmlCanvas.Common.extractStatic(a);return c.addAttribute(d)};UmlCanvas.Attribute.MANIFEST={name:"attribute",aliasses:["property"]};Canvas2D.registerShape(UmlCanvas.Attribute);UmlCanvas.Operation=Class.extend({init:function(a){this.visibility=a.visibility;this.ztatic=a.isStatic;this.name=a.name;this.returnType=a.returnType;this.parameters=[];if(a.arguments){for(var b=0;b<a.arguments.length;b++){this.addParameter(a.arguments[b])}}this.abztract=a.isAbstract},setParent:function setParent(){},getName:function(){return this.name},getReturnType:function(){return this.returnType},getVisibility:function(){return this.visibility},isStatic:function(){return this.ztatic},isAbstract:function(){return this.abztract},addParameter:function(a){this.parameters.push(new UmlCanvas.Parameter(a))},toString:function(){var a=[];this.parameters.iterate(function(b){if(b.type){a.push(b.type.toString())}});return UmlCanvas.Common.determineVisibility(this.visibility)+this.name+"("+a.join(", ")+")"+(this.returnType?" : "+this.returnType.toString():"")},asConstruct:function(){var b=[];this.parameters.iterate(function(c){b.push(c.asConstruct())});var a={};if(this.getVisibility()){a[this.getVisibility()]=null}if(this.isAbstract()){a["abstract"]=null}if(this.isStatic()){a["static"]=null}return{type:"Operation",name:this.getName(),supers:this.getReturnType()?[this.getReturnType()]:[],modifiers:a,children:b}}});UmlCanvas.Operation.from=function(a,c){var d={name:a.name};if(a.supers[0]){d.returnType=a.supers[0].toString()}var b=UmlCanvas.Common.extractVisibility(a);if(b){d.visibility=b}d.isStatic=UmlCanvas.Common.extractStatic(a);d.isAbstract=UmlCanvas.Common.extractAbstract(a);return c.addOperation(d)};UmlCanvas.Operation.MANIFEST={name:"operation",aliasses:["method"]};Canvas2D.registerShape(UmlCanvas.Operation);UmlCanvas.Parameter=Class.extend({name:null,type:null,init:function(a){this.name=a.name;this.type=a.type},setparent:function setParent(){},getName:function(){return this.name},getType:function(){return this.type},toString:function(){return this.name+" : "+this.type},asConstruct:function(){return{type:"Argument",name:this.getName(),supers:this.getType()?[this.getType()]:[],modifiers:{},children:[]}}});UmlCanvas.Parameter.from=function(a,b){return b.addParameter(new UmlCanvas.Parameter({name:a.name,type:a.supers[0]||null}))};UmlCanvas.Parameter.MANIFEST={name:"parameter",aliasses:["argument"]};Canvas2D.registerShape(UmlCanvas.Parameter);UmlCanvas.ConnectorHeads={Triangle:{n:{lines:[[-5,-10],[+5,-10],[0,0]],end:[0,-10]},e:{lines:[[+10,+5],[+10,-5],[0,0]],end:[10,0]},s:{lines:[[+5,+10],[-5,+10],[0,0]],end:[0,10]},w:{lines:[[-10,-5],[-10,+5],[0,0]],end:[-10,0]}},Arrow:{n:{lines:[[-5,-10],[0,0],[+5,-10]],end:[0,0]},e:{lines:[[+10,+5],[0,0],[+10,-5]],end:[0,0]},s:{lines:[[+5,+10],[0,0],[-5,+10]],end:[0,0]},w:{lines:[[-10,-5],[0,0],[-10,+5]],end:[0,0]}},Diamond:{n:{lines:[[-5,-5],[0,-10],[+5,-5],[0,0]],end:[0,-10]},e:{lines:[[+5,+5],[+10,0],[+5,-5],[0,0]],end:[10,0]},s:{lines:[[+5,+5],[0,+10],[-5,+5],[0,0]],end:[0,10]},w:{lines:[[-5,-5],[-10,0],[-5,+5],[0,0]],end:[-10,0]}},FullDiamond:{n:{lines:[[-5,-5],[0,-10],[+5,-5],[0,0],"fill"],end:[0,-10]},e:{lines:[[+5,+5],[+10,0],[+5,-5],[0,0],"fill"],end:[10,0]},s:{lines:[[+5,+5],[0,+10],[-5,+5],[0,0],"fill"],end:[0,10]},w:{lines:[[-5,-5],[-10,0],[-5,+5],[0,0],"fill"],end:[-10,0]}}};UmlCanvas.Association=Canvas2D.Connector.extend({preprocess:function(a){a=this._super(a);this.srcName=a.sname;this.dstName=a.dname;if(a.kind&&a.kind=="aggregation"){a.begin=UmlCanvas.ConnectorHeads.Diamond}else{if(a.kind&&a.kind=="composition"){a.begin=UmlCanvas.ConnectorHeads.FullDiamond}else{if(a.navigability&&(a.navigability=="bi"||a.navigability=="source")){a.begin=UmlCanvas.ConnectorHeads.Arrow}}}if(a.navigability&&(a.navigability=="bi"||a.navigability=="destination")){a.end=UmlCanvas.ConnectorHeads.Arrow}a.routing=a.routing||"horizontal";return a},_determineChildModifiers:function _determineChildModifiers(a){var b=[];var c=a?this.end:this.begin;if(c==UmlCanvas.ConnectorHeads.Diamond){b.shared=null}else{if(c==UmlCanvas.ConnectorHeads.FullDiamond){b.composite=null}else{if(c==UmlCanvas.ConnectorHeads.Arrow){b.navigable=null}}}return b},asConstruct:function(){var a=this._super();a.modifiers=null;a.children.push({modifiers:this._determineChildModifiers(),supers:[this.from.getName()],children:[],type:"role",name:this.srcName});a.children.push({modifiers:this._determineChildModifiers(true),supers:[this.to.getName()],children:[],type:"role",name:this.dstName});return a}});UmlCanvas.Association.getNames=function(){return["association","relation"]};UmlCanvas.Association.from=function(a,b){var c={name:a.name};var e,d;var h=[];if(a.children&&a.children.length>1){child0=a.children[0];e=a.children[1]}else{h.push("association "+a.name+" needs two roles");return{errors:h}}c.kind="association";var g,f;if(e.modifiers.get("composition")||e.modifiers.get("composite")||e.modifiers.get("aggregation")||e.modifiers.get("shared")){g=e;f=child0}else{g=child0;f=e}if(g.modifiers.get("composition")||g.modifiers.get("composite")){c.kind="composition"}if(g.modifiers.get("aggregation")||g.modifiers.get("shared")){c.kind="aggregation"}if(g.modifiers.get("navigable")&&f.modifiers.get("navigable")){c.navigability="bi"}else{if(g.modifiers.get("navigable")){c.navigability="source"}else{if(f.modifiers.get("navigable")){c.navigability="destination"}}}c.style="vertical";if(a.annotation){if(a.annotation.data=="horizontal"){c.style="horizontal"}else{if(parts=a.annotation.data.match("([a-zA-Z]+):([nesw]+)-([nesw]+)")){c.routing="custom";c.routeStyle=parts[1];c.routeBegin=parts[2];c.routeEnd=parts[3]}}}c.sname=g.name;c.dname=f.name;c.from=b.getDiagramClass(g.supers[0].constructName);c.to=b.getDiagramClass(f.supers[0].constructName);if(!c.from){h.push("Unknown FROM property "+g.supers[0].constructName+"  on "+a.name)}if(!c.to){h.push("Unknown TO property "+f.supers[0].constructName+"  on "+a.name)}if(h.length>0){return{errors:h}}else{return new UmlCanvas.Association(c)}};UmlCanvas.Association.MANIFEST={name:"association",properties:["kind","navigability"],propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Association);UmlCanvas.Role=Class.extend({setparent:function setParent(){}});UmlCanvas.Role.from=function(a,b){return null};UmlCanvas.Role.MANIFEST={name:"role"};Canvas2D.registerShape(UmlCanvas.Role);UmlCanvas.Dependency=Canvas2D.Connector.extend({preprocess:function(a){a.end=UmlCanvas.ConnectorHeads.Arrow;a.lineStyle="dashed";a.routing=a.routing||"horizontal";this.srcName=a.sname;this.dstName=a.dname;return a},asConstruct:function(){var a=this._super();a.modifiers=null;a.children.push({supers:[this.from.getName()],children:[],type:"client",name:this.srcName});a.children.push({supers:[this.to.getName()],children:[],type:"supplier",name:this.dstName});return a}});UmlCanvas.Dependency.from=function(a,d){var e={name:a.name};var c,f;if(a.children&&a.children.length>0&&a.children[0].type=="client"){c=a.children[0];f=a.children[1]}else{c=a.children[1];f=a.children[0]}errors=[];if(!c){errors.push("missing dependency client")}if(!f){errors.push("missing dependency supplier")}if(errors.length>0){return{errors:errors}}e.style="horizontal";if(a.annotation){if(a.annotation.data=="vertical"){e.style="vertical"}else{if(a.annotation.data.contains(":")&&a.annotation.data.contains("-")){var g=a.annotation.data.split(":");e.routing="custom";e.routeStyle=g[0];var b=g[1].split("-");e.routeBegin=b[0];e.routeEnd=b[1]}}}e.sname=c.name;e.dname=f.name;e.from=d.getDiagramClass(c.supers[0].constructName);e.to=d.getDiagramClass(f.supers[0].constructName);if(!e.from){errors.push("Unknown FROM property "+c.supers[0].constructName+"  on "+a.name)}if(!e.to){errors.push("Unknown TO property "+f.supers[0].constructName+"  on "+a.name)}if(errors.length>0){return{errors:errors}}else{return new UmlCanvas.Dependency(e)}};UmlCanvas.Dependency.MANIFEST={name:"dependency",properties:["client","supplier"],propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Dependency);UmlCanvas.Client=Class.extend({});UmlCanvas.Supplier=Class.extend({});UmlCanvas.Client.from=function(a,b){return null};UmlCanvas.Supplier.from=function(a,b){return null};UmlCanvas.Client.MANIFEST={name:"client"};UmlCanvas.Supplier.MANIFEST={name:"supplier"};Canvas2D.registerShape(UmlCanvas.Client);Canvas2D.registerShape(UmlCanvas.Supplier);UmlCanvas.Interface=UmlCanvas.Class.extend({preprocess:function(a){a=this._super(a);if(a.stereotype){a.stereotype="interface "+a.stereotype}else{a.stereotype="interface"}a.isAbstract=true;return a},getFontForClassName:function(){return this.getFont()},getFontForOperationName:function(a){return this.getFont()},asConstruct:function(){var a=this._super();delete a.modifiers["abstract"];delete a.modifiers.stereotype;return a}});UmlCanvas.Interface.from=function(a,c){var d={};d.name=a.name;var f=a.modifiers.get("minimumWidth");if(f){d.minimumWidth=parseInt(f.value.value)}var b=a.modifiers.get("stereotype");if(b){d.stereotype=b.value.value}var e=new UmlCanvas.Interface(d);if(a.supers&&a.supers.length>0){a.supers.iterate(function(g){var h=c.getDiagramClass(g.constructName);e.addSuper(h);c.addRelation(new UmlCanvas.Inheritance({from:h,to:e}))})}return e};UmlCanvas.Interface.MANIFEST={name:"interface",propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle,UmlCanvas.Class],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Interface);UmlCanvas.Enumeration=UmlCanvas.Class.extend({preprocess:function(a){a=this._super(a);if(a.stereotype){a.stereotype="enumeration "+a.stereotype}else{a.stereotype="enumeration"}a.isAbstract=true;return a},addOperation:function(a){return null},getFontForClassName:function(){return this.getFont()},asConstruct:function(){var a=this._super();delete a.modifiers.isAbstract;delete a.modifiers.stereotype;return a}});UmlCanvas.Enumeration.from=function(a,c){var d={};d.name=a.name;var f=a.modifiers.get("minimumWidth");if(f){d.minimumWidth=parseInt(f.value.value)}var b=a.modifiers.get("stereotype");if(b){d.stereotype=b.value.value}var e=new UmlCanvas.Enumeration(d);if(a.supers&&a.supers.length>0){a.supers.iterate(function(h){var k=c.getDiagramClass(h.constructName);e.addSuper(k);var g;g=new UmlCanvas.Inheritance({from:k,to:e});c.addRelation(g)})}return e};UmlCanvas.Enumeration.MANIFEST={name:"enumeration",propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle,UmlCanvas.Class],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Enumeration);UmlCanvas.Inheritance=Canvas2D.Connector.extend({preprocess:function(a){a.begin=UmlCanvas.ConnectorHeads.Triangle;a.routing=a.routing||"vertical";return a},initialBranchLength:function(b,a){return 25},asConstruct:function asConstruct(){return null}});UmlCanvas.Inheritance.MANIFEST={name:"inheritance",propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Inheritance);UmlCanvas.Realization=Canvas2D.Connector.extend({preprocess:function(a){a.begin=UmlCanvas.ConnectorHeads.Triangle;a.lineStyle="dashed";a.routing=a.routing||"vertical";return a},initialBranchLength:function(b,a){return 25},asConstruct:function asConstruct(){return null}});UmlCanvas.Realization.MANIFEST={name:"realization",propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Realization);UmlCanvas.Note=Canvas2D.Rectangle.extend({prepare:function(a){if(this.prepared){return}this.width=this.getBoxWidth(a);this.height=this.getBoxHeight(a);this.prepared=true},postInitialize:function(a){this.config=UmlCanvas.Note.Defaults},draw:function(a,c,b){this.prepare(a);this.renderTextBox(a,c,b);this.renderText(a,c,b)},renderTextBox:function renderTextBox(a,c,b){a.fillStyle=this.config.backgroundColor;a.strokeStyle=this.config.lineColor;a.lineWidth=this.config.lineWidth;a.useCrispLines=this.config.useCrispLines;a.fillStrokeRect(c,b,this.getWidth(),this.getHeight())},renderText:function renderText(d,f,e){d.useCrispLines=false;d.font=this.config.font;d.fillStyle=this.config.fontColor;d.textAlign="left";d.lineStyle="solid";var b=this.getLines();for(var c=1,a=b.length;c<=a;++c){e+=this.config.padding;d.fillText(b[c-1],f+this.config.padding,e+(parseInt(this.config.font)*c))}},getBoxWidth:function getBoxWidth(a){var b=this.getWidth()+(this.config.padding*2);this.getLines().iterate(function(c){var d=a.measureText(c)+(this.config.padding*2);if(d>b){b=d}}.scope(this));return b},getBoxHeight:function getBoxHeight(a){var c=this.getHeight()+(this.config.padding*2);var b=this.getLines().length*(parseInt(this.config.font)+this.config.padding)+this.config.padding;return(c>b)?c:b},getLines:function getLines(){return this.getText().split("\\n")},asConstruct:function(){var a=this._super();delete a.modifiers.geo;if(this.getText()){a.modifiers.text='"'+this.getText()+'"'}if(this.getLinkedTo()){a.modifiers.linkedTo='"'+this.getLinkedTo()+'"'}return a}});UmlCanvas.Note.from=function(c,d){var f={};f.name=c.name;f.text=c.modifiers.get("text").value.value;var e=c.modifiers.get("width");if(e){f.width=parseInt(e.value.value)}var b=c.modifiers.get("height");if(b){f.height=b.value.value}var a=c.modifiers.get("linkedTo");if(a){f.linkedTo=a.value.value}var g=new UmlCanvas.Note(f);if(a){a.value.value.split(",").iterate(function(h){var k=d.getDiagramClass(h);d.addRelation(new UmlCanvas.NoteLink({note:g,element:k}))})}return g};UmlCanvas.Note.MANIFEST={name:"note",properties:["text","width","height","linkedTo"],propertyPath:[Canvas2D.CompositeShape,Canvas2D.Rectangle],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.Note);UmlCanvas.NoteLink=Canvas2D.Connector.extend({preprocess:function(a){a.routing=a.routing||"horizontal";a.lineStyle=a.lineStyle||"dashed";a.from=a.note;a.to=a.element;return a},asConstruct:function asConstruct(){return null}});UmlCanvas.NoteLink.MANIFEST={name:"notelink",propertyPath:[Canvas2D.Connector],libraries:["UmlCanvas"]};Canvas2D.registerShape(UmlCanvas.NoteLink);UmlCanvas.KickStart={plugins:{}};UmlCanvas.KickStart.Starter=Canvas2D.KickStart.Starter.extend({init:function init(){this.manager=new UmlCanvas.Manager();this.pluginManagerRepository=new UmlCanvas.KickStart.plugins.PluginManagerRepository();this.setupPluginsFactories()},setupPluginsFactories:function setupPluginsFactories(){$H(UmlCanvas.KickStart.plugins).iterate(function(a,c){if(c.Manager){var b=new (c.Manager)();this.pluginManagerRepository.setManager(a,b)}}.scope(this))},getTag:function(){return"UmlCanvas"},makeInstance:function(a){var c=this.manager.setupModel(a);var b=[];this.pluginManagerRepository.getManagers().iterate(function(e){var d=e.setup(c,this.pluginManagerRepository);if(typeof d!="undefined"){b.push(d)}}.scope(this));b.iterate(function(d){if(d.activate){d.activate(c)}}.scope(this));return c}});ProtoJS.Event.observe(window,"load",function(){UmlCanvas.KickStarter=new UmlCanvas.KickStart.Starter();UmlCanvas.KickStarter.on("ready",function(){UmlCanvas.fireEvent("ready")});UmlCanvas.KickStarter.start()});UmlCanvas.KickStart.plugins.PluginManagerRepository=Class.extend({init:function(){this.managers={}},setManager:function setManager(b,a){this.managers[b]=a},getManager:function getManager(a){return this.managers[a]},getManagers:function getManagers(){return $H(this.managers).values()}});UmlCanvas.widgetCount=0;UmlCanvas.Widget=Class.extend({init:function initialize(a){this.initProperties(a);this.setupCanvas();this.setupConsole();this.setupSource();this.setupGeneratedSource();this.setupEditor();this.setupErrors();this.setupAbout();UmlCanvas.on("ready",this.start.scope(this))},initProperties:function initProperties(a){this.umlcanvas=a;this.id=a.id;this.src=a.src||"";this.width=a.width||350;this.height=a.height||200},getElement:function getElement(a){return document.getElementById("UC_"+a+"_for_"+this.id)},setupCanvas:function setupCanvas(){this.canvas=this.umlcanvas},setupConsole:function setupConsole(){this.UmlCanvasConsole=this.getElement("console")},setupSource:function setupSource(){this.UmlCanvasSource=document.getElementById(this.id+"Source")||this.getElement("source");this.getLocalSource()},setupGeneratedSource:function setupGeneratedSource(){this.UmlCanvasGenerated=document.getElementById(this.id+"Generated")||this.getElement("generated")},setupEditor:function setupEditor(){this.UmlCanvasEditor=this.getElement("editorPane")},setupErrors:function setupErrors(){this.UmlCanvasErrors=this.getElement("errors")},setupAbout:function setupAbout(){this.UmlCanvasAbout=this.getElement("about");if(this.UmlCanvasAbout){var a="";Canvas2D.extensions.iterate(function(b){a+="\n<hr>\n";a+="<b>Library: "+b.name+" "+b.version+"</b> by "+b.author+"<br>"+b.info});this.UmlCanvasAbout.innerHTML="<b>Canvas2D "+Canvas2D.version+'</b><br>Copyright &copy 2009, <a href="http://christophe.vg" target="_blank">Christophe VG</a> & <a href="http://thesoftwarefactory.be" target="_blank">The Software Factory</a><br>Visit <a href="http://thesoftwarefactory.be/wiki/Canvas2D" target="_blank">http://thesoftwarefactory.be/wiki/Canvas2D</a> for more info. Licensed under the <a href="http://thesoftwarefactory.be/wiki/BSD_License" target="_blank">BSD License</a>.'+a}},updateCanvas:function updateCanvas(){var a=this.getEditorValue();if(this.inputIsDirty){if(a.replace(/^\s+|\s+$/g,"")!=""){this.updatingCanvas=true;this.loadUmlCanvas(a);if(this.UmlCanvasErrors){this.UmlCanvasErrors.value=this.UmlCanvas.errors}}this.inputIsDirty=false}},autoSave:function autoSave(){this.updateCanvas();setTimeout(this.autoSave.scope(this),100)},markDirty:function markDirty(){this.inputIsDirty=true},start:function start(){this.UmlCanvas=UmlCanvas.getModel(this.id);if(this.UmlCanvasConsole){this.UmlCanvas.console=this.UmlCanvasConsole}if(this.UmlCanvasEditor){this.UmlCanvasEditor.onkeydown=this.markDirty.scope(this);this.UmlCanvas.on("sourceUpdated",function(a){if(!this.updatingCanvas){this.setEditorValue(a);this.inputIsDirty=false}this.updatingCanvas=false}.scope(this));this.inputIsDirty=true;this.updatingCanvas=false;this.autoSave()}this.load()},setEditorValue:function setEditorValue(a){this.width=this.canvas.width;this.height=this.canvas.height;this.UmlCanvasEditor.value=a},getEditorValue:function getEditorValue(){return this.UmlCanvasEditor.value},load:function load(){if(this.src==""&&this.hasLocalSource()){this.getLocalSource()}this.loadUmlCanvas(this.src)},loadUmlCanvas:function loadUmlCanvas(a){if(a){this.canvas.width=this.width;this.canvas.height=this.height;this.UmlCanvas.load(a)}},hasLocalSource:function hasLocalSource(){return document.getElementById(this.id+"Source")!=null},getLocalSource:function getLocalSource(){if(this.UmlCanvasSource){this.src=this.UmlCanvasSource.value||this.UmlCanvasSource.innerHTML}}});UmlCanvas.Widget.activate=function UmlCanvas_Widget_insert(a){return new UmlCanvas.Widget(typeof a=="object"?a:{id:a})};UmlCanvas.KickStart.plugins.InspectorSheet=Class.extend({init:function init(a,b){this.label=a;if(b){this.element=b}else{this.element=document.createElement("div")}},getLabel:function getLabel(){return this.label},setLabel:function setLabel(a){this.label=a},getElement:function getElement(a){this.element.id="UC_"+this.getLabel()+"_for_"+a;this.element.className="UC_inspector_tab_content";this.element.style.resize="none";return this.element}});UmlCanvas.KickStart.plugins.Inspector=Class.extend({init:function init(a){this.umlcanvas=a;this.initSheets()},initSheets:function initSheets(){this.sheets={};this.sheetPositions=[];this.source=document.createElement("textarea");this.addSheet(0,"source",this.source);this.console=document.createElement("textarea");this.addSheet(1,"console",this.console);this.addSheet(2,"about")},activate:function activate(a){this.insertInspector();this.wireActivation()},getElement:function getElement(a){return document.getElementById("UC_inspector_"+a+"_for_"+this.umlcanvas.name)},getSheet:function getSheet(a){return this.sheets[a]},addSheet:function addSheet(b,a,d){var c=new UmlCanvas.KickStart.plugins.InspectorSheet(a,d);this.sheetPositions.splice(b,0,c);this.sheets[c.getLabel()]=c},removeSheet:function removeSheet(a){this.sheetPositions.splice(this.sheetPositions.indexOf(this.getSheet(a)),1);delete this.sheets[a]},insertInspector:function insertInspector(){this.insertInspectorHTML();this.wireResizeAndDragHandling();this.setupSheets();this.gotoTab("editor");this.resizeTo(0,0);this.moveTo(this.umlcanvas.getLeft(),this.umlcanvas.getTop());this.shownBefore=false;UmlCanvas.Widget.activate(this.umlcanvas.name)},insertInspectorHTML:function insertInspectorHTML(){this.inspector=document.createElement("DIV");this.inspector.id="UC_inspector_for_"+this.umlcanvas.name;this.inspector.className="UC_inspector";this.inspector.innerHTML='<table class="UC_inspector_header" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="UC_inspector_close" onclick="this.parentNode.parentNode.parentNode.parentNode.style.display=\'none\';"></td><td><h1 id="UC_inspector_header_for_'+this.umlcanvas.name+'">UmlCanvas Inspector</h1></td><td class="UC_inspector_corner"></td></tr></table><div id="UC_inspector_tabs_for_'+this.umlcanvas.name+'" class="UC_inspector_tabs"></div><div id="UC_inspector_content_for_'+this.umlcanvas.name+'"class="UC_inspector_content"></div><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="UC_inspector_status">'+UmlCanvas.version+'</td><td id="UC_inspector_resize_for_'+this.umlcanvas.name+'"class="UC_inspector_resize"></td></tr></table>';document.body.appendChild(this.inspector)},setupSheets:function setupSheets(){this.tabs=this.getElement("tabs");this.content=this.getElement("content");this.sheetPositions.iterate(function(a){var b=document.createElement("A");b.id="UC_inspector_tab_"+a.getLabel()+"_for_"+this.umlcanvas.name;b.href="javascript:";b.className="UC_inspector_tab";b.onclick=function(c){return function(){this.gotoTab(c)}.scope(this)}.scope(this)(a.getLabel());b.appendChild(document.createTextNode(a.getLabel()));this.tabs.appendChild(b);this.content.appendChild(a.getElement(this.umlcanvas.name))}.scope(this))},gotoTab:function gotoTab(a){if(this.currentTab){this.currentTab.className="UC_inspector_tab"}if(this.currentSheet){this.currentSheet.className="UC_inspector_tab_content"}this.currentTab=this.getElement("tab_"+a);this.currentSheet=document.getElementById("UC_"+a+"_for_"+this.umlcanvas.name);if(this.currentTab){this.currentTab.className="UC_inspector_tab_selected"}if(this.currentSheet){this.currentSheet.className="UC_inspector_tab_content_selected"}},wireResizeAndDragHandling:function wireResizeAndDragHandling(){ProtoJS.Event.observe(this.getElement("resize"),"mousedown",function(a){this.resizing=true;this.handleMouseDown(a)}.scope(this));ProtoJS.Event.observe(this.getElement("header"),"mousedown",function(a){this.handleMouseDown(a);this.dragging=true}.scope(this));ProtoJS.Event.observe(document,"mouseup",this.handleMouseUp.scope(this));ProtoJS.Event.observe(document,"mousemove",this.handleMouseMove.scope(this))},handleMouseDown:function handleMouseDown(a){if(a.preventDefault){a.preventDefault()}a.returnValue=false;this.currentPos=this.getXY(a)},handleMouseMove:function handleMouseMove(a){if(this.resizing||this.dragging){var b=this.getXY(a);if(this.resizing){this.resizeBy(b.x-this.currentPos.x,b.y-this.currentPos.y)}else{if(this.dragging){this.moveBy(b.x-this.currentPos.x,b.y-this.currentPos.y)}}this.currentPos=b}},handleMouseUp:function handleMouseMove(a){this.resizing=false;this.dragging=false},getXY:function getXY(b){var a,c;if(ProtoJS.Browser.IE){a=event.clientX+document.body.scrollLeft;c=event.clientY+document.body.scrollTop}else{a=b.pageX;c=b.pageY}return{x:a,y:c}},resizeBy:function resizeBy(b,a){this.resizeTo(parseInt(this.inspector.style.width)+b,parseInt(this.inspector.style.height)+a)},resizeTo:function resizeTo(a,c){this.inspector.style.width=(a>=300?a:300)+"px";this.inspector.style.height=(c>=150?c:150)+"px";var b=ProtoJS.Browser.IE?0:10;this.content.style.width=(parseInt(this.inspector.style.width)-b)+"px";this.content.style.height=(parseInt(this.inspector.style.height)-73)+"px";if(ProtoJS.Browser.IE){this.console.style.height=this.content.style.height}this.fireEvent("changeContentSize",{w:parseInt(this.content.style.width),h:parseInt(this.content.style.height)})},moveBy:function moveBy(b,a){this.moveTo(parseInt(this.inspector.style.left)+b,parseInt(this.inspector.style.top)+a)},moveTo:function resizeTo(a,b){this.inspector.style.left=(a>=0?a:0)+"px";this.inspector.style.top=(b>=0?b:0)+"px"},getWidth:function getWidth(){return parseInt(this.inspector.style.width)},getHeight:function getHeight(){return parseInt(this.inspector.style.height)},show:function show(){if(!this.shownBefore){this.resizeTo(this.umlcanvas.getWidth(),this.umlcanvas.getHeight());this.shownBefore=true}this.inspector.style.display="block"},hide:function hide(){this.inspector.style.display="none"},wireActivation:function wireActivation(){if(UmlCanvas.Config.Inspector.wireActivation){Canvas2D.Keyboard.on("keyup",function(a){if(this.umlcanvas.canvas.mouseOver&&a=="73"){this.show()}}.scope(this))}}});ProtoJS.mix(Canvas2D.Factory.extensions.all.EventHandling,UmlCanvas.KickStart.plugins.Inspector.prototype);UmlCanvas.KickStart.plugins.Inspector.Manager=Class.extend({init:function init(){this.inspectors=new Hash()},setup:function setup(c,a){if(c.canvas.canvas.className.contains("withoutInspector")){return}var b=new UmlCanvas.KickStart.plugins.Inspector(c,a);this.inspectors.set(c.name,b);return b},getInspector:function getInspector(a){return this.inspectors.get(a||"")}});var headID=document.getElementsByTagName("head")[0];var cssNode=document.createElement("link");cssNode.type="text/css";cssNode.rel="stylesheet";cssNode.href="http://static.thesoftwarefactory.be/css/inspector.css";cssNode.media="screen";headID.appendChild(cssNode);UmlCanvas.KickStart.plugins.HuC=Class.extend({init:function init(b,a){this.umlcanvas=b;this.pluginManagerRepository=a;this.initSheets();this.setupSource()},initSheets:function initSheets(){if(this.isInspectorAvailable()){if(inspector=this.getInspector()){with(inspector){addSheet(0,"editor",this.createEditorSheet());addSheet(1,"properties",this.createPropertiesSheet());removeSheet("source");on("changeContentSize",this.handleInspectorResize.scope(this))}}}},handleInspectorResize:function handleInspectorResize(a){if(a.h>24+75){this.editor.style.height=(a.h-24-75)+"px"}},getElement:function getElement(a){return document.getElementById("UC_"+a+"_for_"+this.umlcanvas.name)},getEditor:function getEditor(){return this.editor},createEditorSheet:function createEditorSheet(){var a=document.createElement("div");a.style.overflow="hidden";a.appendChild(this.createEditorToolbar());a.appendChild(this.createEditorTextPane());a.appendChild(this.createErrorTextPane());return a},createPropertiesSheet:function createPropertiesSheet(){var a=document.createElement("div");this.propertiesForm=document.createElement("form");this.propertiesForm.id="UC_propertiesForm_for_"+this.umlcanvas.name;var b=document.createElement("table");b.className="UC_inspector_properties";this.setupProperties();this.propertyFields={};this.props.iterate(function(h){var c=document.createElement("tbody");var e=document.createElement("tr");var d=document.createElement("th");var g=document.createElement("td");var f;if("string"==h.type&&100<h.maxlength){f=document.createElement("textarea")}else{if("string"==h.type||"integer"==h.type){f=document.createElement("input");f.name="text"}else{if("author"==h.id){f=document.createElement("a");f.href="http://hosted.umlcanvas.org";f.target="_blank"}}}d.innerHTML=h.label;f.id="UC_"+h.id+"_for_"+this.umlcanvas.name;ProtoJS.Event.observe(f,"blur",function(){this.validateField(f,h);this.updateDiagram()}.scope(this));g.appendChild(f);e.appendChild(d);e.appendChild(g);c.appendChild(e);b.appendChild(c);this.propertyFields[h.id]=f}.scope(this));this.propertiesForm.appendChild(b);a.appendChild(this.createEditorToolbar());a.appendChild(this.propertiesForm);return a},setupProperties:function setupProperties(){this.props=[{id:"name",label:"Name",type:"string",minlength:1,maxlength:25},{id:"descr",label:"Description",type:"string",minlength:1,maxlength:1000},{id:"width",label:"Width",type:"integer",minlength:2,maxlength:3},{id:"height",label:"Height",type:"integer",minlength:2,maxlength:3},{id:"notes",label:"Notes",type:"string",minlength:0,maxlength:1000},{id:"author",label:"Author",type:"link",minlength:0,maxlength:1000}]},validateFields:function validateFields(){var a=true;this.props.iterate(function(b){a=this.validateField(this.getElement(b.id),b)&&a}.scope(this));return a},validateField:function validateField(b,c){var a=true;if(c.type!="link"){b.style.backgroundColor="#FFF";if("integer"==c.type){if(isNaN(parseInt(b.value,10))){b.value=0}else{b.value=parseInt(b.value,10)}}if(b.value.length>c.maxlength){b.value=b.value.substring(0,c.maxlength)}if(b.value.length<c.minlength){b.style.backgroundColor="#faa";a=false}}return a},createEditorToolbar:function createEditorToolbar(){var a=new UmlCanvas.KickStart.plugins.HuC.Toolbar();a.addAction(UmlCanvas.Config.Inspector.Icons.save,"Save",function(){return function(){if(this.validateFields()){this.saveDiagram({id:this.umlcanvas.name,src:this.getEditor().value,name:this.getElement("name").value,descr:this.getElement("descr").value,width:this.getElement("width").value,height:this.getElement("height").value,notes:this.getElement("notes").value})}else{this.getInspector().gotoTab("properties")}}.scope(this)}.scope(this)());a.addAction(UmlCanvas.Config.Inspector.Icons.reload,"Reload",function(){return function(){var b=confirm("Do you want to reload this diagram? \n\nIf you reload this diagram, all changes made after your last save action will be lost.");if(b){this.loadDiagram()}}.scope(this)}.scope(this)());return a.getToolbar()},createEditorTextPane:function createEditorTextPane(){this.editor=document.createElement("textarea");this.editor.id="UC_editorPane_for_"+this.umlcanvas.name;this.editor.style.resize="none";this.editor.style.border="0px solid white";return this.editor},createErrorTextPane:function createErrorTextPane(){var a=document.createElement("textarea");a.id="UC_errors_for_"+this.umlcanvas.name;a.style.resize="none";a.style.height="75px";return a},isInspectorAvailable:function isInspectorAvailable(){return this.pluginManagerRepository.getManager("Inspector")!=null},getInspector:function getInspector(){return this.pluginManagerRepository.getManager("Inspector").getInspector(this.umlcanvas.name)},setupSource:function setupSource(){if(!this.hasLocalSource()){this.loadDiagram()}},hasLocalSource:function hasLocalSource(){return document.getElementById(this.umlcanvas.name+"Source")!=null},getCanvasElement:function getCanvasElement(){return this.umlcanvas},decodeHTMLSpecialCharacters:function decodeHTMLSpecialCharacters(a){return a.replace(/&quot;/g,'"')},loadDiagram:function loadDiagram(){if(this.umlcanvas.name==""){return this.loadProperties()}new ProtoJS.Ajax().fetch(UmlCanvas.Config.HuC.repository_url+this.umlcanvas.name+":json",function(a){this.umlcanvas.load(this.decodeHTMLSpecialCharacters(a.src));this.loadProperties(a);this.updateDiagram()}.scope(this))},loadProperties:function loadProperties(a){a=a||{width:this.getCanvasElement().getWidth(),height:this.getCanvasElement().getHeight()};this.propertiesForm.reset();$H(a).iterate(function(b){if(this.propertyFields[b]!=null){if("author"==b){this.propertyFields[b].innerHTML=a[b];this.propertyFields[b].href=UmlCanvas.Config.HuC.repository_url+"~"+a[b]}this.propertyFields[b].value=a[b]}}.scope(this))},updateDiagram:function updateDiagram(){this.getCanvasElement().setSize(this.propertyFields.width.value,this.propertyFields.height.value)},saveDiagram:function saveDiagram(d){var c=document.getElementById("submitForm");if(!c){c=document.createElement("form");c.id="submitForm";c.method="post";c.action=UmlCanvas.Config.HuC.repository_submit_url;c.target="formresult";this.submitFields={};for(var b in d){var a=document.createElement("input");this.submitFields[b]=a;a.type="hidden";a.name=b;c.appendChild(a)}document.body.appendChild(c)}for(var b in d){this.submitFields[b].value=d[b]}window.open("","formresult");c.submit()}});UmlCanvas.KickStart.plugins.HuC.Toolbar=Class.extend({init:function init(){this.toolbar=document.createElement("div");this.toolbar.className="UC_toolbar"},getToolbar:function getToolbar(){return this.toolbar},addAction:function addAction(d,b,c){var a=document.createElement("img");a.src=d;a.alt=b;a.onclick=c;this.toolbar.appendChild(a)}});UmlCanvas.KickStart.plugins.HuC.Manager=Class.extend({setup:function setup(b,a){return new UmlCanvas.KickStart.plugins.HuC(b,a)}});UmlCanvas.Defaults={};UmlCanvas.Class.Defaults={stereotype:"",supers:[],useCrispLines:true,font:"7pt Verdana",fontColor:"black",fontAbstract:"italic 7pt Verdana",abstractColor:"black",decoration:"none",decorationStatic:"underline",lineWidth:1,lineColor:"rgba(255,0,0,1)",backgroundColor:"rgba(255,255,200,1)",padding:5,lineSpacing:5,compartmentSpacing:3};UmlCanvas.Interface.Defaults={};UmlCanvas.Enumeration.Defaults={};UmlCanvas.Association.Defaults={};UmlCanvas.Dependency.Defaults={};UmlCanvas.Inheritance.Defaults={};UmlCanvas.Realization.Defaults={};UmlCanvas.Note.Defaults={text:"TODO",width:100,height:40,padding:5,font:"7pt Verdana",fontColor:"black",lineColor:"grey",backgroundColor:"rgba(240,240,240,1)",lineWidth:1,useCrispLines:true};UmlCanvas.NoteLink.Defaults={};UmlCanvas.Config={};UmlCanvas.Config.Inspector={wireActivation:true};UmlCanvas.Config.Inspector.Icons={save:"http://static.thesoftwarefactory.be/images/icons/disk-black.png",reload:"http://static.thesoftwarefactory.be/images/icons/arrow-circle-315.png",left:"http://static.thesoftwarefactory.be/images/inspector/left.png",right:"http://static.thesoftwarefactory.be/images/inspector/right.png"};UmlCanvas.Config.HuC={repository_url:"http://hosted.umlcanvas.org/",repository_submit_url:"http://hosted.umlcanvas.org/submit/index.php"};