var WireIt={defaultWireClass:"WireIt.BezierWire",wireClassFromXtype:function(A){return this.classFromXtype(A,this.defaultWireClass)},defaultTerminalClass:"WireIt.Terminal",terminalClassFromXtype:function(A){return this.classFromXtype(A,this.defaultTerminalClass)},defaultContainerClass:"WireIt.Container",containerClassFromXtype:function(A){return this.classFromXtype(A,this.defaultContainerClass)},classFromXtype:function(E,C){var D=(E||C).split(".");var A=window;for(var B=0;B<D.length;B++){A=A[D[B]]}if(!YAHOO.lang.isFunction(A)){throw new Error("WireIt unable to find klass from xtype: '"+E+"'")}return A},getIntStyle:function(B,A){var C=YAHOO.util.Dom.getStyle(B,A);return parseInt(C.substr(0,C.length-2),10)},sn:function(D,C,A){if(!D){return }var B;if(C){for(B in C){if(C.hasOwnProperty(B)){var E=C[B];if(typeof (E)=="function"){continue}if(B=="className"){B="class";D.className=E}if(E!==D.getAttribute(B)){if(E===false){D.removeAttribute(B)}else{D.setAttribute(B,E)}}}}}if(A){for(B in A){if(A.hasOwnProperty(B)){if(typeof (A[B])=="function"){continue}if(D.style[B]!=A[B]){D.style[B]=A[B]}}}}},cn:function(A,C,B,E){var D=document.createElement(A);this.sn(D,C,B);if(E){D.innerHTML=E}return D},indexOf:YAHOO.lang.isFunction(Array.prototype.indexOf)?function(B,A){return A.indexOf(B)}:function(C,A){for(var B=0;B<A.length;B++){if(A[B]==C){return B}}return -1},compact:YAHOO.lang.isFunction(Array.prototype.compact)?function(A){return A.compact()}:function(A){var C=[];for(var B=0;B<A.length;B++){if(A[B]){C.push(A[B])}}return C}};WireIt.util={};(function(){var A=YAHOO.util.Event,B=YAHOO.env.ua;WireIt.CanvasElement=function(C){this.element=document.createElement("canvas");C.appendChild(this.element);if(typeof (G_vmlCanvasManager)!="undefined"){this.element=G_vmlCanvasManager.initElement(this.element)}};WireIt.CanvasElement.prototype={getContext:function(C){return this.element.getContext(C||"2d")},destroy:function(){var C=this.element;if(YAHOO.util.Dom.inDocument(C)){C.parentNode.removeChild(C)}A.purgeElement(C,true)},SetCanvasRegion:B.ie?function(G,F,E,C){var D=this.element;WireIt.sn(D,null,{left:G+"px",top:F+"px",width:E+"px",height:C+"px"});D.getContext("2d").clearRect(0,0,E,C);this.element=D}:((B.webkit||B.opera)?function(F,J,C,K){var D=this.element;var H=WireIt.cn("canvas",{className:D.className||D.getAttribute("class"),width:C,height:K},{left:F+"px",top:J+"px"});var I=A.getListeners(D);for(var E in I){if(I.hasOwnProperty(E)){var G=I[E];A.addListener(H,G.type,G.fn,G.obj,G.adjust)}}A.purgeElement(D);D.parentNode.replaceChild(H,D);this.element=H}:function(F,E,D,C){WireIt.sn(this.element,{width:D,height:C},{left:F+"px",top:E+"px"})})}})();WireIt.Wire=function(D,C,B,A){this.parentEl=B;this.terminal1=D;this.terminal2=C;this.eventMouseClick=new YAHOO.util.CustomEvent("eventMouseClick");this.eventMouseIn=new YAHOO.util.CustomEvent("eventMouseIn");this.eventMouseOut=new YAHOO.util.CustomEvent("eventMouseOut");this.eventMouseMove=new YAHOO.util.CustomEvent("eventMouseMove");this.setOptions(A||{});WireIt.Wire.superclass.constructor.call(this,this.parentEl);YAHOO.util.Dom.addClass(this.element,this.className);if(this.label){this.renderLabel()}this.terminal1.addWire(this);this.terminal2.addWire(this)};YAHOO.lang.extend(WireIt.Wire,WireIt.CanvasElement,{xtype:"WireIt.Wire",className:"WireIt-Wire",cap:"round",bordercap:"round",width:3,borderwidth:1,color:"rgb(173, 216, 230)",bordercolor:"#0000ff",label:null,labelStyle:null,labelEditor:null,setOptions:function(B){for(var A in B){if(B.hasOwnProperty(A)){this[A]=B[A]}}},remove:function(){this.parentEl.removeChild(this.element);if(this.terminal1&&this.terminal1.removeWire){this.terminal1.removeWire(this)}if(this.terminal2&&this.terminal2.removeWire){this.terminal2.removeWire(this)}this.terminal1=null;this.terminal2=null;if(this.labelEl){if(this.labelField){this.labelField.destroy()}this.labelEl.innerHTML=""}},getOtherTerminal:function(A){return(A==this.terminal1)?this.terminal2:this.terminal1},draw:function(){var E=[4,4];var H=this.terminal1.getXY();var G=this.terminal2.getXY();var D=[Math.min(H[0],G[0])-E[0],Math.min(H[1],G[1])-E[1]];var B=[Math.max(H[0],G[0])+E[0],Math.max(H[1],G[1])+E[1]];this.min=D;this.max=B;var F=Math.abs(B[0]-D[0]);var C=Math.abs(B[1]-D[1]);H[0]=H[0]-D[0];H[1]=H[1]-D[1];G[0]=G[0]-D[0];G[1]=G[1]-D[1];this.SetCanvasRegion(D[0],D[1],F,C);var A=this.getContext();A.lineCap=this.bordercap;A.strokeStyle=this.bordercolor;A.lineWidth=this.width+this.borderwidth*2;A.beginPath();A.moveTo(H[0],H[1]);A.lineTo(G[0],G[1]);A.stroke();A.lineCap=this.cap;A.strokeStyle=this.color;A.lineWidth=this.width;A.beginPath();A.moveTo(H[0],H[1]);A.lineTo(G[0],G[1]);A.stroke()},redraw:function(){this.draw();if(this.label){this.positionLabel()}},renderLabel:function(){this.labelEl=WireIt.cn("div",{className:"WireIt-Wire-Label"},this.labelStyle);if(this.labelEditor){this.labelField=new inputEx.InPlaceEdit({parentEl:this.labelEl,editorField:this.labelEditor,animColors:{from:"#FFFF99",to:"#DDDDFF"}});this.labelField.setValue(this.label)}else{this.labelEl.innerHTML=this.label}this.element.parentNode.appendChild(this.labelEl)},setLabel:function(A){if(this.labelEditor){this.labelField.setValue(A)}else{this.labelEl.innerHTML=A}},positionLabel:function(){YAHOO.util.Dom.setStyle(this.labelEl,"left",(this.min[0]+this.max[0]-this.labelEl.clientWidth)/2);YAHOO.util.Dom.setStyle(this.labelEl,"top",(this.min[1]+this.max[1]-this.labelEl.clientHeight)/2)},wireDrawnAt:function(B,E){var A=this.getContext();var D=A.getImageData(B,E,1,1);var C=D.data;return !(C[0]===0&&C[1]===0&&C[2]===0&&C[3]===0)},onMouseMove:function(A,B){if(typeof this.mouseInState===undefined){this.mouseInState=false}if(this.wireDrawnAt(A,B)){if(!this.mouseInState){this.mouseInState=true;this.onWireIn(A,B)}this.onWireMove(A,B)}else{if(this.mouseInState){this.mouseInState=false;this.onWireOut(A,B)}}},onWireMove:function(A,B){this.eventMouseMove.fire(this,[A,B])},onWireIn:function(A,B){this.eventMouseIn.fire(this,[A,B])},onWireOut:function(A,B){this.eventMouseOut.fire(this,[A,B])},onClick:function(A,B){if(this.wireDrawnAt(A,B)){this.onWireClick(A,B)}},onWireClick:function(A,B){this.eventMouseClick.fire(this,[A,B])},getConfig:function(){var A={xtype:this.xtype};if(this.labelEditor){A.label=this.labelField.getValue()}return A}});WireIt.StepWire=function(D,C,B,A){WireIt.StepWire.superclass.constructor.call(this,D,C,B,A)};YAHOO.lang.extend(WireIt.StepWire,WireIt.Wire,{xtype:"WireIt.StepWire",draw:function(){var B=[4,4];var H=this.terminal1.getXY();var G=this.terminal2.getXY();var C=[Math.min(H[0],G[0])-B[0],Math.min(H[1],G[1])-B[1]];var E=[Math.max(H[0],G[0])+B[0],Math.max(H[1],G[1])+B[1]];var A=Math.abs(E[0]-C[0]);var I=Math.abs(E[1]-C[1]);H[0]=H[0]-C[0];H[1]=H[1]-C[1];G[0]=G[0]-C[0];G[1]=G[1]-C[1];var F=[G[0],G[1]];G[1]=H[1];this.SetCanvasRegion(C[0],C[1],A,I);var D=this.getContext();D.lineCap=this.bordercap;D.strokeStyle=this.bordercolor;D.lineWidth=this.width+this.borderwidth*2;D.beginPath();D.moveTo(H[0],H[1]);D.lineTo(G[0],G[1]);D.lineTo(F[0],F[1]);D.stroke();D.lineCap=this.cap;D.strokeStyle=this.color;D.lineWidth=this.width;D.beginPath();D.moveTo(H[0],H[1]);D.lineTo(G[0],G[1]);D.lineTo(F[0],F[1]);D.stroke()}});WireIt.ArrowWire=function(D,C,B,A){WireIt.ArrowWire.superclass.constructor.call(this,D,C,B,A)};YAHOO.lang.extend(WireIt.ArrowWire,WireIt.Wire,{xtype:"WireIt.ArrowWire",draw:function(){var j=7;var G=j+3;var Y=[4+G,4+G];var E=this.terminal1.getXY();var D=this.terminal2.getXY();var J=Math.sqrt(Math.pow(E[0]-D[0],2)+Math.pow(E[1]-D[1],2));var f=[Math.min(E[0],D[0])-Y[0],Math.min(E[1],D[1])-Y[1]];var g=[Math.max(E[0],D[0])+Y[0],Math.max(E[1],D[1])+Y[1]];this.min=f;this.max=g;var K=Math.abs(g[0]-f[0])+G;var V=Math.abs(g[1]-f[1])+G;E[0]=E[0]-f[0];E[1]=E[1]-f[1];D[0]=D[0]-f[0];D[1]=D[1]-f[1];this.SetCanvasRegion(f[0],f[1],K,V);var N=this.getContext();N.lineCap=this.bordercap;N.strokeStyle=this.bordercolor;N.lineWidth=this.width+this.borderwidth*2;N.beginPath();N.moveTo(E[0],E[1]);N.lineTo(D[0],D[1]);N.stroke();N.lineCap=this.cap;N.strokeStyle=this.color;N.lineWidth=this.width;N.beginPath();N.moveTo(E[0],E[1]);N.lineTo(D[0],D[1]);N.stroke();var R=E;var Q=D;var P=[0,0];var M=20;var T=(J===0)?0:1-(M/J);P[0]=Math.abs(R[0]+T*(Q[0]-R[0]));P[1]=Math.abs(R[1]+T*(Q[1]-R[1]));var m,l;var I=R[0]-Q[0];var U=R[1]-Q[1];var S=R[0]*Q[1]-R[1]*Q[0];if(I!==0){m=U/I;l=S/I}else{m=0}var L,O;if(m===0){L=0}else{L=-1/m}O=P[1]-L*P[0];var c=1+Math.pow(L,2);var Z=2*L*O-2*P[0]-2*P[1]*L;var X=-2*P[1]*O+Math.pow(P[0],2)+Math.pow(P[1],2)-Math.pow(j,2)+Math.pow(O,2);var k=Math.pow(Z,2)-4*c*X;if(k<0){return }var i=(-Z+Math.sqrt(k))/(2*c);var h=(-Z-Math.sqrt(k))/(2*c);var H=L*i+O;var F=L*h+O;if(R[1]==Q[1]){var e=(R[0]>Q[0])?1:-1;i=Q[0]+e*M;h=i;H-=j;F+=j}N.fillStyle=this.color;N.beginPath();N.moveTo(Q[0],Q[1]);N.lineTo(i,H);N.lineTo(h,F);N.fill();N.strokeStyle=this.bordercolor;N.lineWidth=this.borderwidth;N.beginPath();N.moveTo(Q[0],Q[1]);N.lineTo(i,H);N.lineTo(h,F);N.lineTo(Q[0],Q[1]);N.stroke()}});WireIt.BezierWire=function(D,C,B,A){WireIt.BezierWire.superclass.constructor.call(this,D,C,B,A)};YAHOO.lang.extend(WireIt.BezierWire,WireIt.Wire,{xtype:"WireIt.BezierWire",coeffMulDirection:100,draw:function(){var O=this.terminal1.getXY();var M=this.terminal2.getXY();var F=this.coeffMulDirection;var B=Math.sqrt(Math.pow(O[0]-M[0],2)+Math.pow(O[1]-M[1],2));if(B<F){F=B/2}var C=[this.terminal1.direction[0]*F,this.terminal1.direction[1]*F];var A=[this.terminal2.direction[0]*F,this.terminal2.direction[1]*F];var L=[];L[0]=O;L[1]=[O[0]+C[0],O[1]+C[1]];L[2]=[M[0]+A[0],M[1]+A[1]];L[3]=M;var H=[O[0],O[1]];var K=[O[0],O[1]];for(var I=1;I<L.length;I++){var D=L[I];if(D[0]<H[0]){H[0]=D[0]}if(D[1]<H[1]){H[1]=D[1]}if(D[0]>K[0]){K[0]=D[0]}if(D[1]>K[1]){K[1]=D[1]}}var G=[4,4];H[0]=H[0]-G[0];H[1]=H[1]-G[1];K[0]=K[0]+G[0];K[1]=K[1]+G[1];var E=Math.abs(K[0]-H[0]);var N=Math.abs(K[1]-H[1]);this.min=H;this.max=K;this.SetCanvasRegion(H[0],H[1],E,N);var J=this.getContext();for(I=0;I<L.length;I++){L[I][0]=L[I][0]-H[0];L[I][1]=L[I][1]-H[1]}J.lineCap=this.bordercap;J.strokeStyle=this.bordercolor;J.lineWidth=this.width+this.borderwidth*2;J.beginPath();J.moveTo(L[0][0],L[0][1]);J.bezierCurveTo(L[1][0],L[1][1],L[2][0],L[2][1],L[3][0],L[3][1]);J.stroke();J.lineCap=this.cap;J.strokeStyle=this.color;J.lineWidth=this.width;J.beginPath();J.moveTo(L[0][0],L[0][1]);J.bezierCurveTo(L[1][0],L[1][1],L[2][0],L[2][1],L[3][0],L[3][1]);J.stroke()}});WireIt.BezierArrowWire=function(D,C,B,A){WireIt.BezierArrowWire.superclass.constructor.call(this,D,C,B,A)};YAHOO.lang.extend(WireIt.BezierArrowWire,WireIt.BezierWire,{xtype:"WireIt.BezierArrowWire",draw:function(){var E=Math.round(this.width*1.5+20);var Q=Math.round(this.width*1.2+20);var r=E/2;var G=r+3;var F=[4+G,4+G];var q=this.terminal1.getXY();var n=this.terminal2.getXY();var w=this.coeffMulDirection;var P=Math.sqrt(Math.pow(q[0]-n[0],2)+Math.pow(q[1]-n[1],2));if(P<w){w=P/2}var k=[this.terminal1.direction[0]*w,this.terminal1.direction[1]*w];var j=[this.terminal2.direction[0]*w,this.terminal2.direction[1]*w];var O=[];O[0]=q;O[1]=[q[0]+k[0],q[1]+k[1]];O[2]=[n[0]+j[0],n[1]+j[1]];O[3]=n;var s=[q[0],q[1]];var R=[q[0],q[1]];for(var m=1;m<O.length;m++){var f=O[m];if(f[0]<s[0]){s[0]=f[0]}if(f[1]<s[1]){s[1]=f[1]}if(f[0]>R[0]){R[0]=f[0]}if(f[1]>R[1]){R[1]=f[1]}}s[0]=s[0]-F[0];s[1]=s[1]-F[1];R[0]=R[0]+F[0];R[1]=R[1]+F[1];var S=Math.abs(R[0]-s[0]);var Y=Math.abs(R[1]-s[1]);this.min=s;this.max=R;this.SetCanvasRegion(s[0],s[1],S,Y);var h=this.getContext();for(m=0;m<O.length;m++){O[m][0]=O[m][0]-s[0];O[m][1]=O[m][1]-s[1]}h.lineCap=this.bordercap;h.strokeStyle=this.bordercolor;h.lineWidth=this.width+this.borderwidth*2;h.beginPath();h.moveTo(O[0][0],O[0][1]);h.bezierCurveTo(O[1][0],O[1][1],O[2][0],O[2][1],O[3][0],O[3][1]+Q/2*this.terminal2.direction[1]);h.stroke();h.lineCap=this.cap;h.strokeStyle=this.color;h.lineWidth=this.width;h.beginPath();h.moveTo(O[0][0],O[0][1]);h.bezierCurveTo(O[1][0],O[1][1],O[2][0],O[2][1],O[3][0],O[3][1]+Q/2*this.terminal2.direction[1]);h.stroke();var X=O[2],V=n;var c=[0,0];var H=Q;var e=1-(H/P);c[0]=Math.abs(X[0]+e*(V[0]-X[0]));c[1]=Math.abs(X[1]+e*(V[1]-X[1]));var v,u;var D=X[0]-V[0];var U=X[1]-V[1];var T=X[0]*V[1]-X[1]*V[0];if(D!==0){v=U/D;u=T/D}else{v=0}var N,l;if(v===0){N=0}else{N=-1/v}l=c[1]-N*c[0];var L=1+Math.pow(N,2),J=2*N*l-2*c[0]-2*c[1]*N,I=-2*c[1]*l+Math.pow(c[0],2)+Math.pow(c[1],2)-Math.pow(r,2)+Math.pow(l,2),Z=Math.pow(J,2)-4*L*I;if(Z<0){return false}var M=(-J+Math.sqrt(Z))/(2*L),K=(-J-Math.sqrt(Z))/(2*L),y=N*M+l,x=N*K+l;if(X[1]==V[1]){var g=(X[0]>V[0])?1:-1;M=V[0]+g*H;K=M;y-=r;x+=r}h.fillStyle=this.color;h.beginPath();h.moveTo(V[0],V[1]);h.lineTo(M,y);h.lineTo(K,x);h.fill();h.strokeStyle=this.bordercolor;h.lineWidth=this.borderwidth;h.beginPath();h.moveTo(V[0],V[1]);h.lineTo(M,y);h.lineTo(K,x);h.lineTo(V[0],V[1]);h.stroke();return[q,n,X,V]}});(function(){var A=YAHOO.util;var C=YAHOO.lang,B="WireIt-";WireIt.TerminalProxy=function(E,D){this.terminal=E;this.termConfig=D||{};this.terminalProxySize=D.terminalProxySize||10;this.fakeTerminal=null;WireIt.TerminalProxy.superclass.constructor.call(this,this.terminal.el,undefined,{dragElId:"WireIt-TerminalProxy",resizeFrame:false,centerFrame:true})};A.DDM.mode=A.DDM.INTERSECT;C.extend(WireIt.TerminalProxy,YAHOO.util.DDProxy,{createFrame:function(){var E=this,D=document.body;if(!D||!D.firstChild){window.setTimeout(function(){E.createFrame()},50);return }var J=this.getDragEl(),I=YAHOO.util.Dom;if(!J){J=document.createElement("div");J.id=this.dragElId;var H=J.style;H.position="absolute";H.visibility="hidden";H.cursor="move";H.border="2px solid #aaa";H.zIndex=999;var F=this.terminalProxySize+"px";H.height=F;H.width=F;var G=document.createElement("div");I.setStyle(G,"height","100%");I.setStyle(G,"width","100%");I.setStyle(G,"background-color","#ccc");I.setStyle(G,"opacity","0");J.appendChild(G);D.insertBefore(J,D.firstChild)}},startDrag:function(){if(this.terminal.nMaxWires==1&&this.terminal.wires.length==1){this.terminal.wires[0].remove()}else{if(this.terminal.wires.length>=this.terminal.nMaxWires){return }}var E=this.terminalProxySize/2;this.fakeTerminal={direction:this.terminal.fakeDirection,pos:[200,200],addWire:function(){},removeWire:function(){},getXY:function(){var G=YAHOO.util.Dom.getElementsByClassName("WireIt-Layer");if(G.length>0){var H=YAHOO.util.Dom.getXY(G[0]);return[this.pos[0]-H[0]+E,this.pos[1]-H[1]+E]}return this.pos}};var F=this.terminal.parentEl.parentNode;if(this.terminal.container){F=this.terminal.container.layer.el}var D=WireIt.wireClassFromXtype(this.terminal.editingWireConfig.xtype);this.editingWire=new D(this.terminal,this.fakeTerminal,F,this.terminal.editingWireConfig);YAHOO.util.Dom.addClass(this.editingWire.element,B+"Wire-editing")},onDrag:function(F){if(!this.editingWire){return }if(this.terminal.container){var E=this.terminal.container.layer.el;var G=0;var D=0;if(E.offsetParent){do{G+=E.scrollLeft;D+=E.scrollTop;E=E.offsetParent}while(E)}this.fakeTerminal.pos=[F.clientX+G,F.clientY+D]}else{this.fakeTerminal.pos=(YAHOO.env.ua.ie)?[F.clientX,F.clientY]:[F.clientX+window.pageXOffset,F.clientY+window.pageYOffset]}this.editingWire.redraw()},endDrag:function(D){if(this.editingWire){this.editingWire.remove();this.editingWire=null}},onDragEnter:function(F,D){if(!this.editingWire){return }for(var E=0;E<D.length;E++){if(this.isValidWireTerminal(D[E])){D[E].terminal.setDropInvitation(true)}}},onDragOut:function(F,D){if(!this.editingWire){return }for(var E=0;E<D.length;E++){if(this.isValidWireTerminal(D[E])){D[E].terminal.setDropInvitation(false)}}},onDragDrop:function(L,J){var H;if(!this.editingWire){return }this.onDragOut(L,J);var N=null;for(H=0;H<J.length;H++){if(this.isValidWireTerminal(J[H])){N=J[H];break}}if(!N){return }this.editingWire.remove();this.editingWire=null;var G=false;for(H=0;H<this.terminal.wires.length;H++){if(this.terminal.wires[H].terminal1==this.terminal){if(this.terminal.wires[H].terminal2==N.terminal){G=true;break}}else{if(this.terminal.wires[H].terminal2==this.terminal){if(this.terminal.wires[H].terminal1==N.terminal){G=true;break}}}}if(G){return }var I=this.terminal.parentEl.parentNode;if(this.terminal.container){I=this.terminal.container.layer.el}var F=this.terminal;var E=N.terminal;if(E.alwaysSrc){F=N.terminal;E=this.terminal}var K=WireIt.wireClassFromXtype(F.wireConfig.xtype);var D=N.terminal,M;if(D.nMaxWires==1){if(D.wires.length>0){D.wires[0].remove()}M=new K(F,E,I,F.wireConfig);M.redraw()}else{if(D.wires.length<D.nMaxWires){M=new K(F,E,I,F.wireConfig);M.redraw()}}},isWireItTerminal:true,isValidWireTerminal:function(D){if(!D.isWireItTerminal){return false}if(this.termConfig.type){if(this.termConfig.allowedTypes){if(WireIt.indexOf(D.termConfig.type,this.termConfig.allowedTypes)==-1){return false}}else{if(this.termConfig.type!=D.termConfig.type){return false}}}else{if(D.termConfig.type){if(D.termConfig.allowedTypes){if(WireIt.indexOf(this.termConfig.type,D.termConfig.allowedTypes)==-1){return false}}else{if(this.termConfig.type!=D.termConfig.type){return false}}}}if(this.terminal.container){if(this.terminal.container.preventSelfWiring){if(D.terminal.container==this.terminal.container){return false}}}return true}})})();(function(){var B=YAHOO.util;var A=B.Event,D=YAHOO.lang,C="WireIt-";WireIt.Scissors=function(E,F){WireIt.Scissors.superclass.constructor.call(this,document.createElement("div"),F);this._terminal=E;this.initScissors()};WireIt.Scissors.visibleInstance=null;D.extend(WireIt.Scissors,YAHOO.util.Element,{initScissors:function(){this.hideNow();this.addClass(C+"Wire-scissors");this.appendTo(this._terminal.container?this._terminal.container.layer.el:this._terminal.el.parentNode.parentNode);this.on("mouseover",this.show,this,true);this.on("mouseout",this.hide,this,true);this.on("click",this.scissorClick,this,true);A.addListener(this._terminal.el,"mouseover",this.mouseOver,this,true);A.addListener(this._terminal.el,"mouseout",this.hide,this,true)},setPosition:function(){var E=this._terminal.getXY();this.setStyle("left",(E[0]+this._terminal.direction[0]*30-8)+"px");this.setStyle("top",(E[1]+this._terminal.direction[1]*30-8)+"px")},mouseOver:function(){if(this._terminal.wires.length>0){this.show()}},scissorClick:function(){this._terminal.removeAllWires();if(this.terminalTimeout){this.terminalTimeout.cancel()}this.hideNow()},show:function(){this.setPosition();this.setStyle("display","");if(WireIt.Scissors.visibleInstance&&WireIt.Scissors.visibleInstance!=this){if(WireIt.Scissors.visibleInstance.terminalTimeout){WireIt.Scissors.visibleInstance.terminalTimeout.cancel()}WireIt.Scissors.visibleInstance.hideNow()}WireIt.Scissors.visibleInstance=this;if(this.terminalTimeout){this.terminalTimeout.cancel()}},hide:function(){this.terminalTimeout=YAHOO.lang.later(700,this,this.hideNow)},hideNow:function(){WireIt.Scissors.visibleInstance=null;this.setStyle("display","none")}})})();(function(){var B=YAHOO.util;var A=B.Event,E=YAHOO.lang,C=B.Dom,D="WireIt-";WireIt.Terminal=function(H,G,F){this.name=null;this.parentEl=H;this.container=F;this.wires=[];this.setOptions(G);this.eventAddWire=new B.CustomEvent("eventAddWire");this.eventRemoveWire=new B.CustomEvent("eventRemoveWire");this.el=null;this.render();if(this.editable){this.dd=new WireIt.TerminalProxy(this,this.ddConfig);this.scissors=new WireIt.Scissors(this)}};WireIt.Terminal.prototype={xtype:"WireIt.Terminal",direction:[0,1],fakeDirection:[0,-1],editable:true,nMaxWires:Infinity,wireConfig:{},editingWireConfig:{},className:"WireIt-Terminal",connectedClassName:"WireIt-Terminal-connected",dropinviteClassName:"WireIt-Terminal-dropinvite",offsetPosition:null,alwaysSrc:false,ddConfig:false,setOptions:function(G){for(var F in G){if(G.hasOwnProperty(F)){this[F]=G[F]}}if(G.direction&&!G.fakeDirection){this.fakeDirection=[-G.direction[0],-G.direction[1]]}if(G.wireConfig&&!G.editingWireConfig){this.editingWireConfig=this.wireConfig}},setDropInvitation:function(F){if(F){C.addClass(this.el,this.dropinviteClassName)}else{C.removeClass(this.el,this.dropinviteClassName)}},render:function(){this.el=WireIt.cn("div",{className:this.className});if(this.name){this.el.title=this.name}this.setPosition(this.offsetPosition);this.parentEl.appendChild(this.el)},setPosition:function(G){if(G){this.el.style.left="";this.el.style.top="";this.el.style.right="";this.el.style.bottom="";if(E.isArray(G)){this.el.style.left=G[0]+"px";this.el.style.top=G[1]+"px"}else{if(E.isObject(G)){for(var F in G){if(G.hasOwnProperty(F)&&G[F]!==""){this.el.style[F]=G[F]+"px"}}}}}},addWire:function(F){this.wires.push(F);C.addClass(this.el,this.connectedClassName);this.eventAddWire.fire(F)},removeWire:function(G){var F=WireIt.indexOf(G,this.wires);if(F!=-1){this.wires[F].destroy();this.wires[F]=null;this.wires=WireIt.compact(this.wires);if(this.wires.length===0){C.removeClass(this.el,this.connectedClassName)}this.eventRemoveWire.fire(G)}},getXY:function(){var G=this.container&&this.container.layer?this.container.layer.el:document.body;var H=this.el;var I=0,F=0;if(H.offsetParent){do{I+=H.offsetLeft;F+=H.offsetTop;H=H.offsetParent}while(!!H&&H!=G)}return[I+15,F+15]},remove:function(){while(this.wires.length>0){this.wires[0].remove()}this.parentEl.removeChild(this.el);A.purgeElement(this.el);if(this.scissors){A.purgeElement(this.scissors.get("element"))}},getConnectedTerminals:function(){var F=[];if(this.wires){for(var G=0;G<this.wires.length;G++){F.push(this.wires[G].getOtherTerminal(this))}}return F},redrawAllWires:function(){if(this.wires){for(var F=0;F<this.wires.length;F++){this.wires[F].redraw()}}},removeAllWires:function(){while(this.wires.length>0){this.wires[0].remove()}}}})();WireIt.util.TerminalInput=function(C,B,A){WireIt.util.TerminalInput.superclass.constructor.call(this,C,B,A)};YAHOO.lang.extend(WireIt.util.TerminalInput,WireIt.Terminal,{xtype:"WireIt.TerminalInput",direction:[0,-1],fakeDirection:[0,1],nMaxWires:1,ddConfig:{type:"input",allowedTypes:["output"]}});WireIt.util.TerminalOutput=function(C,B,A){WireIt.util.TerminalOutput.superclass.constructor.call(this,C,B,A)};YAHOO.lang.extend(WireIt.util.TerminalOutput,WireIt.Terminal,{xtype:"WireIt.TerminalOutput",direction:[0,1],fakeDirection:[0,-1],ddConfig:{type:"output",allowedTypes:["input"]},alwaysSrc:true});WireIt.util.DD=function(D,C,A,B){if(!D){throw new Error("WireIt.util.DD needs at least terminals and id")}this._WireItTerminals=D;WireIt.util.DD.superclass.constructor.call(this,C,A,B)};YAHOO.extend(WireIt.util.DD,YAHOO.util.DD,{onDrag:function(C){var A=YAHOO.lang.isArray(this._WireItTerminals)?this._WireItTerminals:(this._WireItTerminals.isWireItTerminal?[this._WireItTerminals]:[]);for(var B=0;B<A.length;B++){A[B].redrawAllWires()}},setTerminals:function(A){this._WireItTerminals=A}});WireIt.util.DDResize=function(A,B){this.myConf=B||{};this.myConf.container=A;this.myConf.minWidth=this.myConf.minWidth||50;this.myConf.minHeight=this.myConf.minHeight||50;WireIt.util.DDResize.superclass.constructor.apply(this,[A.el,A.ddResizeHandle]);this.setHandleElId(A.ddResizeHandle);this.eventResize=new YAHOO.util.CustomEvent("eventResize")};YAHOO.extend(WireIt.util.DDResize,YAHOO.util.DragDrop,{onMouseDown:function(B){var A=this.getEl();this.startWidth=A.offsetWidth;this.startHeight=A.offsetHeight;this.startPos=[YAHOO.util.Event.getPageX(B),YAHOO.util.Event.getPageY(B)]},onDrag:function(F){var D=[YAHOO.util.Event.getPageX(F),YAHOO.util.Event.getPageY(F)];var A=D[0]-this.startPos[0];var G=D[1]-this.startPos[1];var E=Math.max(this.startWidth+A,this.myConf.minWidth);var C=Math.max(this.startHeight+G,this.myConf.minHeight);var B=this.getEl();B.style.width=E+"px";B.style.height=C+"px";this.myConf.container.redrawAllWires();this.eventResize.fire([E,C])}});(function(){var B=YAHOO.util;var C=B.Dom,A=B.Event,D="WireIt-";WireIt.Container=function(E,F){this.setOptions(E);this.layer=F;this.terminals=[];this.wires=[];this.el=null;this.bodyEl=null;this.eventAddWire=new B.CustomEvent("eventAddWire");this.eventRemoveWire=new B.CustomEvent("eventRemoveWire");this.eventFocus=new B.CustomEvent("eventFocus");this.eventBlur=new B.CustomEvent("eventBlur");this.render();if(E.terminals){this.initTerminals(E.terminals)}if(this.resizable){this.makeResizable()}if(this.draggable){this.makeDraggable()}};WireIt.Container.prototype={xtype:"WireIt.Container",draggable:true,position:[100,100],className:D+"Container",ddHandle:true,ddHandleClassName:D+"Container-ddhandle",resizable:true,resizeHandleClassName:D+"Container-resizehandle",close:true,closeButtonClassName:D+"Container-closebutton",groupable:true,preventSelfWiring:true,title:null,icon:null,width:null,height:null,setOptions:function(F){for(var E in F){if(F.hasOwnProperty(E)){this[E]=F[E]}}},makeResizable:function(){this.ddResize=new WireIt.util.DDResize(this);this.ddResize.eventResize.subscribe(this.onResize,this,true)},makeDraggable:function(){this.dd=new WireIt.util.DD(this.terminals,this.el);this.dd.setXConstraint(this.position[0]);this.dd.setYConstraint(this.position[1]);if(this.ddHandle){this.dd.setHandleElId(this.ddHandle)}if(this.resizable){this.dd.addInvalidHandleId(this.ddResizeHandle);this.ddResize.addInvalidHandleId(this.ddHandle)}},onResize:function(G,E){var F=E[0];WireIt.sn(this.bodyEl,null,{width:(F[0]-14)+"px",height:(F[1]-(this.ddHandle?44:14))+"px"})},render:function(){this.el=WireIt.cn("div",{className:this.className});if(this.width){this.el.style.width=this.width+"px"}if(this.height){this.el.style.height=this.height+"px"}A.addListener(this.el,"mousedown",this.onMouseDown,this,true);if(this.ddHandle){this.ddHandle=WireIt.cn("div",{className:this.ddHandleClassName});this.el.appendChild(this.ddHandle);if(this.icon){var E=WireIt.cn("img",{src:this.icon,className:"WireIt-Container-icon"});this.ddHandle.appendChild(E)}if(this.title){this.ddHandle.appendChild(WireIt.cn("span",{className:"floatleft"},null,this.title))}}this.bodyEl=WireIt.cn("div",{className:"body"});this.el.appendChild(this.bodyEl);if(this.resizable){this.ddResizeHandle=WireIt.cn("div",{className:this.resizeHandleClassName});this.el.appendChild(this.ddResizeHandle)}if(this.close){this.closeButton=WireIt.cn("div",{className:this.closeButtonClassName});if(this.ddHandle){this.ddHandle.appendChild(this.closeButton)}else{this.el.appendChild(this.closeButton)}A.addListener(this.closeButton,"click",this.onCloseButton,this,true)}if(this.groupable&&this.ddHandle){this.groupButton=WireIt.cn("div",{className:"WireIt-Container-groupbutton"});this.ddHandle.appendChild(this.groupButton);A.addListener(this.groupButton,"click",this.onGroupButton,this,true)}this.layer.el.appendChild(this.el);this.el.style.left=this.position[0]+"px";this.el.style.top=this.position[1]+"px"},setBody:function(E){if(typeof E=="string"){this.bodyEl.innerHTML=E}else{this.bodyEl.innerHTML="";this.bodyEl.appendChild(E)}},onMouseDown:function(E){if(this.layer){if(this.layer.focusedContainer&&this.layer.focusedContainer!=this){this.layer.focusedContainer.removeFocus()}this.setFocus();this.layer.focusedContainer=this}},setFocus:function(){C.addClass(this.el,D+"Container-focused");this.eventFocus.fire(this)},removeFocus:function(){C.removeClass(this.el,D+"Container-focused");this.eventBlur.fire(this)},onCloseButton:function(F,E){A.stopEvent(F);this.layer.removeContainer(this)},highlight:function(){this.el.style.border="2px solid blue"},dehighlight:function(){this.el.style.border=""},superHighlight:function(){this.el.style.border="4px outset blue"},remove:function(){this.removeAllTerminals();this.layer.el.removeChild(this.el);A.purgeElement(this.el)},initTerminals:function(F){for(var E=0;E<F.length;E++){this.addTerminal(F[E])}},addTerminal:function(G){var E=WireIt.terminalClassFromXtype(G.xtype);var F=new E(this.el,G,this);this.terminals.push(F);F.eventAddWire.subscribe(this.onAddWire,this,true);F.eventRemoveWire.subscribe(this.onRemoveWire,this,true);return F},onAddWire:function(F,E){var G=E[0];if(WireIt.indexOf(G,this.wires)==-1){this.wires.push(G);this.eventAddWire.fire(G)}},onRemoveWire:function(G,F){var H=F[0];var E=WireIt.indexOf(H,this.wires);if(E!=-1){this.eventRemoveWire.fire(H);this.wires[E]=null}this.wires=WireIt.compact(this.wires)},removeAllTerminals:function(){for(var E=0;E<this.terminals.length;E++){this.terminals[E].remove()}this.terminals=[]},redrawAllWires:function(){for(var E=0;E<this.terminals.length;E++){this.terminals[E].redrawAllWires()}},getXY:function(){var F=C.getXY(this.el);if(this.layer){var E=C.getXY(this.layer.el);F[0]-=E[0];F[1]-=E[1];F[0]+=this.layer.el.scrollLeft;F[1]+=this.layer.el.scrollTop}return F},getConfig:function(){return{position:this.getXY(),xtype:this.xtype}},getValue:function(){return{}},setValue:function(E){},getTerminal:function(E){var G;for(var F=0;F<this.terminals.length;F++){G=this.terminals[F];if(G.name==E){return G}}return null}}})();WireIt.Layer=function(B){this.setOptions(B);this.containers=[];this.wires=[];this.groups=[];this.el=null;this.eventChanged=new YAHOO.util.CustomEvent("eventChanged");this.eventAddWire=new YAHOO.util.CustomEvent("eventAddWire");this.eventRemoveWire=new YAHOO.util.CustomEvent("eventRemoveWire");this.eventAddContainer=new YAHOO.util.CustomEvent("eventAddContainer");this.eventRemoveContainer=new YAHOO.util.CustomEvent("eventRemoveContainer");this.eventContainerDragged=new YAHOO.util.CustomEvent("eventContainerDragged");this.eventContainerResized=new YAHOO.util.CustomEvent("eventContainerResized");this.render();if(B.containers){this.initContainers(B.containers)}if(B.wires){this.initWires(B.wires)}if(this.layerMap){this.layermap=new WireIt.LayerMap(this,this.layerMapOptions)}if(WireIt.Grouper){this.grouper=new WireIt.Grouper(this,this.grouper.baseConfigFunction);var C=this.grouper.rubberband;this.el.onmousedown=function(D){return C.layerMouseDown.call(C,D)};var A=this.grouper;this.el.addEventListener("mouseup",function(D){C.finish();A.rubberbandSelect.call(A)},false)}};WireIt.Layer.prototype={className:"WireIt-Layer",parentEl:null,layerMap:false,layerMapOptions:null,enableMouseEvents:true,grouper:null,setOptions:function(B){for(var A in B){if(B.hasOwnProperty(A)){this[A]=B[A]}}if(!this.parentEl){this.parentEl=document.body}},render:function(){this.el=WireIt.cn("div",{className:this.className});this.parentEl.appendChild(this.el)},initContainers:function(B){for(var A=0;A<B.length;A++){this.addContainer(B[A])}},initWires:function(B){for(var A=0;A<B.length;A++){this.addWire(B[A])}},setSuperHighlighted:function(B){this.unsetSuperHighlighted();for(var A in B){if(B.hasOwnProperty(A)){B[A].superHighlight()}}this.superHighlighted=B},unsetSuperHighlighted:function(){if(YAHOO.lang.isValue(this.superHighlighted)){for(var A in this.superHighlighted){if(this.superHighlighted.hasOwnProperty(A)){this.superHighlighted[A].highlight()}}}this.superHighlighted=null},addWire:function(B){var A=WireIt.wireClassFromXtype(B.xtype);var E=B.src;var G=B.tgt;var F=this.containers[E.moduleId].getTerminal(E.terminal);var D=this.containers[G.moduleId].getTerminal(G.terminal);var C=new A(F,D,this.el,B);C.redraw();return C},addContainer:function(C){var A=WireIt.containerClassFromXtype(C.xtype);var B=new A(C,this);return this.addContainerDirect(B)},addContainerDirect:function(A){this.containers.push(A);A.eventAddWire.subscribe(this.onAddWire,this,true);A.eventRemoveWire.subscribe(this.onRemoveWire,this,true);if(A.ddResize){A.ddResize.on("endDragEvent",function(){this.eventContainerResized.fire(A);this.eventChanged.fire(this)},this,true)}if(A.dd){A.dd.on("endDragEvent",function(){this.eventContainerDragged.fire(A);this.eventChanged.fire(this)},this,true)}this.eventAddContainer.fire(A);this.eventChanged.fire(this);return A},removeContainer:function(A){var B=WireIt.indexOf(A,this.containers);if(B!=-1){A.remove();this.containers[B]=null;this.containers=WireIt.compact(this.containers);this.eventRemoveContainer.fire(A);this.eventChanged.fire(this)}},removeGroup:function(F,C){var A=this.groups.indexOf(F),B;if(A!=-1){this.groups.splice(A,1)}if(C){if(YAHOO.lang.isValue(F.groupContainer)){this.removeContainer(F.groupContainer)}else{for(B in F.containers){if(F.containers.hasOwnProperty(B)){var E=F.containers[B].container;this.removeContainer(E)}}for(B in F.groups){if(F.containers.hasOwnProperty(B)){var D=F.groups[B].group;this.removeGroup(D)}}}}},onAddWire:function(B,A){var C=A[0];if(WireIt.indexOf(C,this.wires)==-1){this.wires.push(C);if(this.enableMouseEvents){YAHOO.util.Event.addListener(C.element,"mousemove",this.onWireMouseMove,this,true);YAHOO.util.Event.addListener(C.element,"click",this.onWireClick,this,true)}this.eventAddWire.fire(C);this.eventChanged.fire(this)}},onRemoveWire:function(C,B){var D=B[0];var A=WireIt.indexOf(D,this.wires);if(A!=-1){this.wires[A]=null;this.wires=WireIt.compact(this.wires);this.eventRemoveWire.fire(D);this.eventChanged.fire(this)}},clear:function(){while(this.containers.length>0){this.removeContainer(this.containers[0])}},removeAllContainers:function(){this.clear()},getWiring:function(){var B;var C={containers:[],wires:[]};for(B=0;B<this.containers.length;B++){C.containers.push(this.containers[B].getConfig())}for(B=0;B<this.wires.length;B++){var D=this.wires[B];var A=D.getConfig();A.src={moduleId:WireIt.indexOf(D.terminal1.container,this.containers),terminal:D.terminal1.name};A.tgt={moduleId:WireIt.indexOf(D.terminal2.container,this.containers),terminal:D.terminal2.name};C.wires.push(A)}return C},setWiring:function(B){this.clear();var A;if(YAHOO.lang.isArray(B.containers)){for(A=0;A<B.containers.length;A++){this.addContainer(B.containers[A])}}if(YAHOO.lang.isArray(B.wires)){for(A=0;A<B.wires.length;A++){this.addWire(B.wires[A])}}},_getMouseEvtPos:function(B){var C=YAHOO.util.Event.getTarget(B);var A=[C.offsetLeft,C.offsetTop];return[A[0]+B.layerX,A[1]+B.layerY]},onWireClick:function(J){var D=this._getMouseEvtPos(J);var H=D[0],F=D[1],G=this.wires.length,K;for(var I=0;I<G;I++){K=this.wires[I];var E=K.element.offsetLeft,C=K.element.offsetTop;if(H>=E&&H<E+K.element.width&&F>=C&&F<C+K.element.height){var B=H-E,A=F-C;K.onClick(B,A)}}},onWireMouseMove:function(J){var D=this._getMouseEvtPos(J);var H=D[0],F=D[1],G=this.wires.length,K;for(var I=0;I<G;I++){K=this.wires[I];var E=K.element.offsetLeft,C=K.element.offsetTop;if(H>=E&&H<E+K.element.width&&F>=C&&F<C+K.element.height){var B=H-E,A=F-C;K.onMouseMove(B,A)}}}};(function(){var B=YAHOO.util.Dom,A=YAHOO.util.Event;WireIt.LayerMap=function(D,C){this.layer=D;this.setOptions(C);if(typeof C.parentEl=="string"){this.parentEl=YAHOO.util.Dom.get(C.parentEl)}else{if(this.layer&&!this.parentEl){this.parentEl=this.layer.el}}WireIt.LayerMap.superclass.constructor.call(this,this.parentEl);this.element.className=this.className;this.initEvents();this.draw()};YAHOO.lang.extend(WireIt.LayerMap,WireIt.CanvasElement,{className:"WireIt-LayerMap",style:"rgba(0, 0, 200, 0.5)",parentEl:null,lineWidth:2,setOptions:function(D){for(var C in D){if(D.hasOwnProperty(C)){this[C]=D[C]}}},initEvents:function(){var C=this.layer;A.addListener(this.element,"mousedown",this.onMouseDown,this,true);A.addListener(this.element,"mouseup",this.onMouseUp,this,true);A.addListener(this.element,"mousemove",this.onMouseMove,this,true);A.addListener(this.element,"mouseout",this.onMouseUp,this,true);C.eventAddWire.subscribe(this.draw,this,true);C.eventRemoveWire.subscribe(this.draw,this,true);C.eventAddContainer.subscribe(this.draw,this,true);C.eventRemoveContainer.subscribe(this.draw,this,true);C.eventContainerDragged.subscribe(this.draw,this,true);C.eventContainerResized.subscribe(this.draw,this,true);A.addListener(this.layer.el,"scroll",this.onLayerScroll,this,true)},onMouseMove:function(D,C){A.stopEvent(D);if(this.isMouseDown){this.scrollLayer(D.clientX,D.clientY)}},onMouseUp:function(D,C){A.stopEvent(D);this.isMouseDown=false},onMouseDown:function(D,C){A.stopEvent(D);this.scrollLayer(D.clientX,D.clientY);this.isMouseDown=true},scrollLayer:function(E,D){var P=B.getXY(this.element);var R=[E-P[0],D-P[1]];var H=B.getRegion(this.element);var G=H.right-H.left-4;var K=H.bottom-H.top-4;var F=this.layer.el.scrollWidth;var N=this.layer.el.scrollHeight;var I=Math.floor(100*G/F)/100;var O=Math.floor(100*K/N)/100;var C=[R[0]/I,R[1]/O];var Q=B.getRegion(this.layer.el);var M=Q.right-Q.left;var J=Q.bottom-Q.top;var L=[Math.max(Math.floor(C[0]-M/2),0),Math.max(Math.floor(C[1]-J/2),0)];if(L[0]+M>F){L[0]=F-M}if(L[1]+J>N){L[1]=N-J}this.layer.el.scrollLeft=L[0];this.layer.el.scrollTop=L[1]},onLayerScroll:function(){if(this.scrollTimer){window.clearTimeout(this.scrollTimer)}var C=this;this.scrollTimer=window.setTimeout(function(){C.draw()},50)},draw:function(){var N=this.getContext();var E=B.getRegion(this.element);var D=E.right-E.left-4;var J=E.bottom-E.top-4;N.clearRect(0,0,D,J);var C=this.layer.el.scrollWidth;var L=this.layer.el.scrollHeight;var F=Math.floor(100*D/C)/100;var M=Math.floor(100*J/L)/100;var O=B.getRegion(this.layer.el);var K=O.right-O.left;var I=O.bottom-O.top;var H=this.layer.el.scrollLeft;var G=this.layer.el.scrollTop;N.strokeStyle="rgb(200, 50, 50)";N.lineWidth=1;N.strokeRect(H*F,G*M,K*F,I*M);N.fillStyle=this.style;N.strokeStyle=this.style;N.lineWidth=this.lineWidth;this.drawContainers(N,F,M);this.drawWires(N,F,M)},drawContainers:function(C,I,F){var H=this.layer.containers;var J=H.length,E,D=WireIt.getIntStyle,G;for(E=0;E<J;E++){G=H[E].el;C.fillRect(D(G,"left")*I,D(G,"top")*F,D(G,"width")*I,D(G,"height")*F)}},drawWires:function(G,D,F){var K=this.layer.wires;var C=K.length,E,I;for(E=0;E<C;E++){I=K[E];var J=I.terminal1.getXY(),H=I.terminal2.getXY();G.beginPath();G.moveTo(J[0]*D,J[1]*F);G.lineTo(H[0]*D,H[1]*F);G.closePath();G.stroke()}}})})();WireIt.ImageContainer=function(A,B){WireIt.ImageContainer.superclass.constructor.call(this,A,B)};YAHOO.lang.extend(WireIt.ImageContainer,WireIt.Container,{xtype:"WireIt.ImageContainer",resizable:false,ddHandle:false,className:"WireIt-Container WireIt-ImageContainer",image:null,render:function(){WireIt.ImageContainer.superclass.render.call(this);YAHOO.util.Dom.setStyle(this.bodyEl,"background-image","url("+this.image+")")}});WireIt.InOutContainer=function(A,B){WireIt.InOutContainer.superclass.constructor.call(this,A,B)};YAHOO.lang.extend(WireIt.InOutContainer,WireIt.Container,{xtype:"WireIt.InOutContainer",resizable:false,className:"WireIt-Container WireIt-InOutContainer",inputs:[],outputs:[],render:function(){WireIt.InOutContainer.superclass.render.call(this);for(var C=0;C<this.inputs.length;C++){var B=this.inputs[C];this.terminals.push({name:B,direction:[-1,0],offsetPosition:{left:-14,top:3+30*(C+1)},ddConfig:{type:"input",allowedTypes:["output"]}});this.bodyEl.appendChild(WireIt.cn("div",null,{lineHeight:"30px"},B))}for(C=0;C<this.outputs.length;C++){var A=this.outputs[C];this.terminals.push({name:A,direction:[1,0],offsetPosition:{right:-14,top:3+30*(C+1+this.inputs.length)},ddConfig:{type:"output",allowedTypes:["input"]},alwaysSrc:true});this.bodyEl.appendChild(WireIt.cn("div",null,{lineHeight:"30px",textAlign:"right"},A))}}});(function(){var A=YAHOO.lang;inputEx=function(B,D){var C=null,E;if(B.type){C=inputEx.getFieldClass(B.type);if(C===null){C=inputEx.StringField}}else{C=B.fieldClass?B.fieldClass:inputEx.StringField}if(A.isObject(B.inputParams)){E=new C(B.inputParams)}else{E=new C(B)}if(D){E.setParentField(D)}return E};A.augmentObject(inputEx,{VERSION:"0.5.0",spacerUrl:"images/space.gif",stateEmpty:"empty",stateRequired:"required",stateValid:"valid",stateInvalid:"invalid",messages:{required:"This field is required",invalid:"This field is invalid",valid:"This field is valid",defaultDateFormat:"m/d/Y",months:["January","February","March","April","May","June","July","August","September","October","November","December"],timeUnits:{SECOND:"seconds",MINUTE:"minutes",HOUR:"hours",DAY:"days",MONTH:"months",YEAR:"years"}},widget:{},mixin:{},regexps:{email:/^[a-z0-9!\#\$%&'\*\-\/=\?\+\-\^_`\{\|\}~]+(?:\.[a-z0-9!\#\$%&'\*\-\/=\?\+\-\^_`\{\|\}~]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,6}$/i,url:/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(\:[0-9]{1,5})?(([0-9]{1,5})?\/.*)?$/i,password:/^[0-9a-zA-Z\x20-\x7E]*$/},typeClasses:{},browserAutocomplete:true,registerType:function(C,E,B,F){if(!A.isString(C)){throw new Error("inputEx.registerType: first argument must be a string")}if(!A.isFunction(E)){throw new Error("inputEx.registerType: second argument must be a function")}this.typeClasses[C]=E;var D=[];if(A.isArray(B)){D=B}if(E.superclass&&!F&&A.isArray(E.superclass.constructor.groupOptions)){D=D.concat(E.superclass.constructor.groupOptions)}E.groupOptions=D},getFieldClass:function(B){return A.isFunction(this.typeClasses[B])?this.typeClasses[B]:null},getType:function(B){for(var C in this.typeClasses){if(this.typeClasses.hasOwnProperty(C)){if(this.typeClasses[C]==B){return C}}}return null},buildField:function(B){return inputEx(B)},sn:function(E,D,B){if(!E){return }var C;if(D){for(C in D){var G=D[C];if(A.isFunction(G)){continue}if(C=="className"){C="class";E.className=G}if(G!==E.getAttribute(C)){try{if(G===false){E.removeAttribute(C)}else{E.setAttribute(C,G)}}catch(F){}}}}if(B){for(C in B){if(A.isFunction(B[C])){continue}if(E.style[C]!=B[C]){E.style[C]=B[C]}}}},cn:function(B,F,C,H){if(B=="input"&&YAHOO.env.ua.ie){var E="<"+B;if(F!=="undefined"){for(var D in F){E+=" "+(D==="className"?"class":D)+'="'+F[D]+'"'}}E+="/>";return document.createElement(E)}else{var G=document.createElement(B);this.sn(G,F,C);if(H){G.innerHTML=H}return G}},indexOf:function(F,B,E){var C=B.length,D;if(!A.isFunction(E)){E=function(G,H){return G===H}}for(D=0;D<C;D++){if(E.call({},F,B[D])){return D}}return -1},compactArray:function(B){var E=[],C=B.length,D;for(D=0;D<C;D++){if(!A.isNull(B[D])&&!A.isUndefined(B[D])){E.push(B[D])}}return E},removeAccents:function(B){return B.replace(/[àáâãäå]/g,"a").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[òóôõö]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ñ]/g,"n").replace(/[ç]/g,"c").replace(/[œ]/g,"oe").replace(/[æ]/g,"ae")}})})();YAHOO.inputEx=inputEx;(function(){var B=YAHOO.util.Dom,C=YAHOO.lang,A=YAHOO.util;inputEx.Field=function(D){this.setOptions(D||{});this.render();this.updatedEvt=new A.CustomEvent("updated",this);this.initEvents();if(!C.isUndefined(this.options.value)){this.setValue(this.options.value,false)}if(D.parentEl){if(C.isString(D.parentEl)){B.get(D.parentEl).appendChild(this.getEl())}else{D.parentEl.appendChild(this.getEl())}}};inputEx.Field.prototype={setOptions:function(D){this.options={};this.options.name=D.name;this.options.value=D.value;this.options.id=D.id||B.generateId();this.options.label=D.label;this.options.description=D.description;this.options.messages={};this.options.messages.required=(D.messages&&D.messages.required)?D.messages.required:inputEx.messages.required;this.options.messages.invalid=(D.messages&&D.messages.invalid)?D.messages.invalid:inputEx.messages.invalid;this.options.className=D.className?D.className:"inputEx-Field";this.options.required=C.isUndefined(D.required)?false:D.required;this.options.showMsg=C.isUndefined(D.showMsg)?false:D.showMsg},render:function(){this.divEl=inputEx.cn("div",{className:"inputEx-fieldWrapper"});if(this.options.id){this.divEl.id=this.options.id}if(this.options.required){B.addClass(this.divEl,"inputEx-required")}if(this.options.label){this.labelDiv=inputEx.cn("div",{id:this.divEl.id+"-label",className:"inputEx-label","for":this.divEl.id+"-field"});this.labelEl=inputEx.cn("label");this.labelEl.appendChild(document.createTextNode(this.options.label));this.labelDiv.appendChild(this.labelEl);this.divEl.appendChild(this.labelDiv)}this.fieldContainer=inputEx.cn("div",{className:this.options.className});this.renderComponent();if(this.options.description){this.fieldContainer.appendChild(inputEx.cn("div",{id:this.divEl.id+"-desc",className:"inputEx-description"},null,this.options.description))}this.divEl.appendChild(this.fieldContainer);this.divEl.appendChild(inputEx.cn("div",null,{clear:"both"}," "))},fireUpdatedEvt:function(){var D=this;setTimeout(function(){D.updatedEvt.fire(D.getValue(),D)},50)},renderComponent:function(){},getEl:function(){return this.divEl},initEvents:function(){},getValue:function(){},setValue:function(E,D){this.setClassFromState();if(D!==false){this.fireUpdatedEvt()}},setClassFromState:function(){var D;if(this.previousState){D="inputEx-"+((this.previousState==inputEx.stateRequired)?inputEx.stateInvalid:this.previousState);B.removeClass(this.divEl,D)}var E=this.getState();if(!(E==inputEx.stateEmpty&&B.hasClass(this.divEl,"inputEx-focused"))){D="inputEx-"+((E==inputEx.stateRequired)?inputEx.stateInvalid:E);B.addClass(this.divEl,D)}if(this.options.showMsg){this.displayMessage(this.getStateString(E))}this.previousState=E},getStateString:function(D){if(D==inputEx.stateRequired){return this.options.messages.required}else{if(D==inputEx.stateInvalid){return this.options.messages.invalid}else{return""}}},getState:function(){if(this.isEmpty()){return this.options.required?inputEx.stateRequired:inputEx.stateEmpty}return this.validate()?inputEx.stateValid:inputEx.stateInvalid},validate:function(){return true},onFocus:function(E){var D=this.getEl();B.removeClass(D,"inputEx-empty");B.addClass(D,"inputEx-focused")},onBlur:function(D){B.removeClass(this.getEl(),"inputEx-focused");this.setClassFromState()},onChange:function(D){this.fireUpdatedEvt()},close:function(){},disable:function(){},enable:function(){},focus:function(){},destroy:function(){var D=this.getEl();this.updatedEvt.unsubscribeAll();A.Event.purgeElement(D,true);if(B.inDocument(D)){D.parentNode.removeChild(D)}},displayMessage:function(F){if(!this.fieldContainer){return }if(!this.msgEl){this.msgEl=inputEx.cn("div",{className:"inputEx-message"});try{var D=this.divEl.getElementsByTagName("div");this.divEl.insertBefore(this.msgEl,D[(D.length-1>=0)?D.length-1:0])}catch(E){alert(E)}}this.msgEl.innerHTML=F},show:function(){this.divEl.style.display=""},hide:function(){this.divEl.style.display="none"},clear:function(D){this.setValue(C.isUndefined(this.options.value)?"":this.options.value,D)},isEmpty:function(){return this.getValue()===""},setParentField:function(D){this.parentField=D},getParentField:function(){return this.parentField}};inputEx.Field.groupOptions=[{type:"string",label:"Label",name:"label",value:""},{type:"string",label:"Name",name:"name",value:""},{type:"string",label:"Description",name:"description",value:""},{type:"boolean",label:"Required?",name:"required",value:false},{type:"boolean",label:"Show messages",name:"showMsg",value:false}]})();(function(){var A=YAHOO.lang;inputEx.BaseField=inputEx.Field;inputEx.Field=function(B){inputEx.Field.superclass.constructor.call(this,B)};A.extend(inputEx.Field,inputEx.BaseField,{setOptions:function(B){inputEx.Field.superclass.setOptions.call(this,B);this.options.wirable=A.isUndefined(B.wirable)?false:B.wirable;this.options.container=B.container;B.container=null},render:function(){inputEx.Field.superclass.render.call(this);if(this.options.wirable){this.renderTerminal()}},renderTerminal:function(){var B=inputEx.cn("div",{className:"WireIt-InputExTerminal"});this.divEl.insertBefore(B,this.fieldContainer);this.terminal=new WireIt.Terminal(B,{name:this.options.name,direction:[-1,0],fakeDirection:[0,1],ddConfig:{type:"input",allowedTypes:["output"]},nMaxWires:1},this.options.container);if(this.options.container){this.options.container.terminals.push(this.terminal)}this.terminal.eventAddWire.subscribe(this.onAddWire,this,true);this.terminal.eventRemoveWire.subscribe(this.onRemoveWire,this,true)},onAddWire:function(B,C){this.options.container.onAddWire(B,C);this.disable();this.el.value="[wired]"},onRemoveWire:function(B,C){this.options.container.onRemoveWire(B,C);this.enable();this.el.value=""}});inputEx.Field.groupOptions=inputEx.BaseField.groupOptions.concat([{type:"boolean",label:"Wirable",name:"wirable",value:false}])})();WireIt.FormContainer=function(A,B){WireIt.FormContainer.superclass.constructor.call(this,A,B)};YAHOO.lang.extend(WireIt.FormContainer,WireIt.Container,{xtype:"WireIt.FormContainer",fields:[],legend:null,collapsible:false,render:function(){WireIt.FormContainer.superclass.render.call(this);this.renderForm()},renderForm:function(){this.setBackReferenceOnFieldOptionsRecursively(this.fields);var A={parentEl:this.bodyEl,fields:this.fields,legend:this.legend,collapsible:this.collapsible};this.form=new inputEx.Group(A);if(this.form.legend){YAHOO.util.Event.addListener(this.form.legend,"click",function(){var C=this;for(var B=0;B<this.form.inputs.length;B++){var D=this.form.inputs[B];if(D.terminal){D.terminal.getXY=function(){if(YAHOO.util.Dom.hasClass(C.form.fieldset,"inputEx-Collapsed")){return C.getXY()}else{return WireIt.Terminal.prototype.getXY.call(this)}}}}this.redrawAllWires()},this,true)}},setBackReferenceOnFieldOptionsRecursively:function(D,A){if(YAHOO.lang.isUndefined(A)){A=this}for(var C=0;C<D.length;C++){var B=D[C];B.container=A;if(B.fields&&typeof B.fields=="object"){this.setBackReferenceOnFieldOptionsRecursively(B.fields)}if(B.elementType){B.elementType.container=A;if(B.elementType.fields&&typeof B.elementType.fields=="object"){this.setBackReferenceOnFieldOptionsRecursively(B.elementType.fields)}}}},getValue:function(){return this.form.getValue()},setValue:function(A){this.form.setValue(A)}});(function(){var C=YAHOO.lang,B=YAHOO.util.Dom,A=YAHOO.util.Event;inputEx.Group=function(D){inputEx.Group.superclass.constructor.call(this,D);if(!this.options.value){this.runFieldsInteractions()}};C.extend(inputEx.Group,inputEx.Field,{setOptions:function(D){inputEx.Group.superclass.setOptions.call(this,D);this.options.className=D.className||"inputEx-Group";this.options.fields=D.fields;this.options.flatten=D.flatten;this.options.legend=D.legend||"";this.options.collapsible=C.isUndefined(D.collapsible)?false:D.collapsible;this.options.collapsed=C.isUndefined(D.collapsed)?false:D.collapsed;this.options.disabled=C.isUndefined(D.disabled)?false:D.disabled;this.inputs=[];this.inputsNames={}},render:function(){this.divEl=inputEx.cn("div",{className:this.options.className});if(this.options.id){this.divEl.id=this.options.id}this.renderFields(this.divEl);if(this.options.disabled){this.disable()}},renderFields:function(F){this.fieldset=inputEx.cn("fieldset");this.legend=inputEx.cn("legend",{className:"inputEx-Group-legend"});if(this.options.collapsible){var H=inputEx.cn("div",{className:"inputEx-Group-collapseImg"},null," ");this.legend.appendChild(H);inputEx.sn(this.fieldset,{className:"inputEx-Expanded"})}if(!C.isUndefined(this.options.legend)&&this.options.legend!==""){this.legend.appendChild(inputEx.cn("span",null,null," "+this.options.legend))}if(this.options.collapsible||(!C.isUndefined(this.options.legend)&&this.options.legend!=="")){this.fieldset.appendChild(this.legend)}for(var E=0;E<this.options.fields.length;E++){var D=this.options.fields[E];if(!D){throw new Error("inputEx.Form: One of the provided fields is undefined ! (check trailing comma)")}var G=this.renderField(D);this.fieldset.appendChild(G.getEl())}if(this.options.collapsed){this.toggleCollapse()}F.appendChild(this.fieldset)},renderField:function(E){var D=inputEx(E,this);this.inputs.push(D);if(D.options.name){this.inputsNames[D.options.name]=D}if(!this.hasInteractions&&E.interactions){this.hasInteractions=true}D.updatedEvt.subscribe(this.onChange,this,true);return D},initEvents:function(){if(this.options.collapsible){A.addListener(this.legend,"click",this.toggleCollapse,this,true)}},toggleCollapse:function(){if(B.hasClass(this.fieldset,"inputEx-Expanded")){B.replaceClass(this.fieldset,"inputEx-Expanded","inputEx-Collapsed")}else{B.replaceClass(this.fieldset,"inputEx-Collapsed","inputEx-Expanded")}},validate:function(){var E=true;for(var F=0;F<this.inputs.length;F++){var D=this.inputs[F];D.setClassFromState();var G=D.getState();if(G==inputEx.stateRequired||G==inputEx.stateInvalid){E=false}}return E},getFieldsStates:function(){var D,E,I,H,G={fields:{},validate:true};for(var F=0;F<this.inputs.length;F++){D=this.inputs[F];E=D.options.name;I=D.getState();H=D.getStateString(I);G.fields[E]={};G.fields[E].valid=true;G.fields[E].message=H;if(I==inputEx.stateRequired||I==inputEx.stateInvalid){G.fields[E].valid=false;G.validate=false}}return G},enable:function(){for(var D=0;D<this.inputs.length;D++){this.inputs[D].enable()}},disable:function(){for(var D=0;D<this.inputs.length;D++){this.inputs[D].disable()}},setValue:function(G,E){if(!G){return }for(var F=0;F<this.inputs.length;F++){var H=this.inputs[F];var D=H.options.name;if(D&&!C.isUndefined(G[D])){H.setValue(G[D],false)}else{H.clear(false)}}this.runFieldsInteractions();if(E!==false){this.fireUpdatedEvt()}},getValue:function(){var F={};for(var E=0;E<this.inputs.length;E++){var D=this.inputs[E].getValue();if(this.inputs[E].options.name){if(this.inputs[E].options.flatten&&C.isObject(D)){C.augmentObject(F,D)}else{F[this.inputs[E].options.name]=D}}}return F},close:function(){for(var D=0;D<this.inputs.length;D++){this.inputs[D].close()}},focus:function(){if(this.inputs.length>0){this.inputs[0].focus()}},getFieldByName:function(D){if(!this.inputsNames.hasOwnProperty(D)){return null}return this.inputsNames[D]},onChange:function(E,F){var G=F[0];var D=F[1];this.runInteractions(D,G);this.fireUpdatedEvt()},runAction:function(D,F){var E=this.getFieldByName(D.name);if(YAHOO.lang.isFunction(E[D.action])){E[D.action].call(E)}else{if(YAHOO.lang.isFunction(D.action)){D.action.call(E,F)}else{throw new Error("action "+D.action+" is not a valid action for field "+D.name)}}},runInteractions:function(E,J){var G=inputEx.indexOf(E,this.inputs);var I=this.options.fields[G];if(YAHOO.lang.isUndefined(I.interactions)){return }var K=I.interactions;for(var H=0;H<K.length;H++){var D=K[H];if(D.valueTrigger===J){for(var F=0;F<D.actions.length;F++){this.runAction(D.actions[F],J)}}}},runFieldsInteractions:function(){if(this.hasInteractions){for(var D=0;D<this.inputs.length;D++){this.runInteractions(this.inputs[D],this.inputs[D].getValue())}}},clear:function(D){for(var E=0;E<this.inputs.length;E++){this.inputs[E].clear(false)}if(D!==false){this.fireUpdatedEvt()}},setErrors:function(F){var E,D;if(YAHOO.lang.isArray(F)){for(E=0;E<F.length;E++){D=F[E][0];value=F[E][1];if(this.inputsNames[D]){if(this.inputsNames[D].options.showMsg){this.inputsNames[D].displayMessage(value);B.replaceClass(this.inputsNames[D].divEl,"inputEx-valid","inputEx-invalid")}}}}else{if(YAHOO.lang.isObject(F)){for(D in F){if(F.hasOwnProperty(D)){if(this.inputsNames[D]){if(this.inputsNames[D].options.showMsg){this.inputsNames[D].displayMessage(F[D]);B.replaceClass(this.inputsNames[D].divEl,"inputEx-valid","inputEx-invalid")}}}}}}},destroy:function(){var D,E,F;for(D=0,E=this.inputs.length;D<E;D++){F=this.inputs[D];F.destroy()}inputEx.Group.superclass.destroy.call(this)}});inputEx.registerType("group",inputEx.Group,[{type:"string",label:"Name",name:"name",value:""},{type:"string",label:"Legend",name:"legend"},{type:"boolean",label:"Collapsible",name:"collapsible",value:false},{type:"boolean",label:"Collapsed",name:"collapsed",value:false},{type:"list",label:"Fields",name:"fields",elementType:{type:"type"}}],true)})();(function(){var A=YAHOO.lang;inputEx.visus={trimpath:function(D,E){if(!TrimPath){alert("TrimPath is not on the page. Please load inputex/lib/trimpath-template.js");return null}var C=TrimPath.parseTemplate(D.template);var B=C.process(E);return B},func:function(B,C){return B.func(C)},dump:function(B,C){return A.dump(C)}};inputEx.renderVisu=function(H,D,E){var B=H||{};var I=B.visuType||"dump";if(!inputEx.visus.hasOwnProperty(I)){throw new Error("inputEx: no visu for visuType: "+I)}var F=inputEx.visus[I];if(!A.isFunction(F)){throw new Error("inputEx: no visu for visuType: "+I)}var J=null;try{J=F(B,D)}catch(G){throw new Error("inputEx: error while running visu "+I+" : "+G.message)}var C=null;if(E){if(A.isString(E)){C=YAHOO.util.Dom.get(E)}else{C=E}}if(C){if(YAHOO.lang.isObject(J)&&J.tagName){C.innerHTML="";C.appendChild(J)}else{C.innerHTML=J}}return J}})();(function(){var B=YAHOO.util,D=YAHOO.lang,A=B.Event,C=B.Dom;inputEx.widget.Button=function(E){this.setOptions(E||{});if(!!this.options.parentEl){this.render(this.options.parentEl)}};D.augmentObject(inputEx.widget.Button.prototype,{setOptions:function(E){this.options={};this.options.id=D.isString(E.id)?E.id:C.generateId();this.options.className=E.className||"inputEx-Button";this.options.parentEl=D.isString(E.parentEl)?C.get(E.parentEl):E.parentEl;this.options.type=(E.type==="link"||E.type==="submit-link")?E.type:"submit";this.options.value=E.value;this.options.disabled=!!E.disabled;if(D.isFunction(E.onClick)){this.options.onClick={fn:E.onClick,scope:this}}else{if(D.isObject(E.onClick)){this.options.onClick={fn:E.onClick.fn,scope:E.onClick.scope||this}}}},render:function(F){var E;if(this.options.type==="link"||this.options.type==="submit-link"){this.el=inputEx.cn("a",{className:this.options.className,id:this.options.id,href:"#"});C.addClass(this.el,this.options.type==="link"?"inputEx-Button-Link":"inputEx-Button-Submit-Link");E=inputEx.cn("span",null,null,this.options.value);this.el.appendChild(E)}else{this.el=inputEx.cn("input",{type:"submit",value:this.options.value,className:this.options.className,id:this.options.id});C.addClass(this.el,"inputEx-Button-Submit")}F.appendChild(this.el);if(this.options.disabled){this.disable()}this.initEvents();return this.el},initEvents:function(){this.clickEvent=new B.CustomEvent("click");this.submitEvent=new B.CustomEvent("submit");A.addListener(this.el,"click",function(F){var E;A.stopEvent(F);if(this.disabled){E=false}else{E=this.clickEvent.fire()}if(this.options.type==="link"){E=false}if(E){this.submitEvent.fire()}},this,true);if(this.options.onClick){this.clickEvent.subscribe(this.options.onClick.fn,this.options.onClick.scope,true)}},disable:function(){this.disabled=true;C.addClass(this.el,"inputEx-Button-disabled");if(this.options.type==="submit"){this.el.disabled=true}},enable:function(){this.disabled=false;C.removeClass(this.el,"inputEx-Button-disabled");if(this.options.type==="submit"){this.el.disabled=false}},destroy:function(){this.clickEvent.unsubscribeAll();this.submitEvent.unsubscribeAll();B.Event.purgeElement(this.el,true);if(C.inDocument(this.el)){this.el.parentNode.removeChild(this.el)}}})})();(function(){var C=YAHOO.lang,A=YAHOO.util.Event,B=YAHOO.util.Dom;inputEx.StringField=function(D){inputEx.StringField.superclass.constructor.call(this,D);if(this.options.typeInvite){this.updateTypeInvite()}};C.extend(inputEx.StringField,inputEx.Field,{setOptions:function(D){inputEx.StringField.superclass.setOptions.call(this,D);this.options.regexp=D.regexp;this.options.size=D.size;this.options.maxLength=D.maxLength;this.options.minLength=D.minLength;this.options.typeInvite=D.typeInvite;this.options.readonly=D.readonly;this.options.autocomplete=C.isUndefined(D.autocomplete)?inputEx.browserAutocomplete:(D.autocomplete===false||D.autocomplete==="off")?false:true;this.options.trim=(D.trim===true)?true:false},renderComponent:function(){this.wrapEl=inputEx.cn("div",{className:"inputEx-StringField-wrapper"});var D={};D.type="text";D.id=this.divEl.id?this.divEl.id+"-field":YAHOO.util.Dom.generateId();if(this.options.size){D.size=this.options.size}if(this.options.name){D.name=this.options.name}if(this.options.readonly){D.readonly="readonly"}if(this.options.maxLength){D.maxLength=this.options.maxLength}D.autocomplete=this.options.autocomplete?"on":"off";this.el=inputEx.cn("input",D);this.wrapEl.appendChild(this.el);this.fieldContainer.appendChild(this.wrapEl)},initEvents:function(){A.addListener(this.el,"change",this.onChange,this,true);if(YAHOO.env.ua.ie){var D=this.el;new YAHOO.util.KeyListener(this.el,{keys:[13]},{fn:function(){D.blur();D.focus()}}).enable()}A.addFocusListener(this.el,this.onFocus,this,true);A.addBlurListener(this.el,this.onBlur,this,true);A.addListener(this.el,"keypress",this.onKeyPress,this,true);A.addListener(this.el,"keyup",this.onKeyUp,this,true)},getValue:function(){var D;D=(this.options.typeInvite&&this.el.value==this.options.typeInvite)?"":this.el.value;if(this.options.trim){D=YAHOO.lang.trim(D)}return D},setValue:function(E,D){this.el.value=(C.isNull(E)||C.isUndefined(E))?"":E;inputEx.StringField.superclass.setValue.call(this,E,D)},validate:function(){var E=this.getValue();if(E===""){return !this.options.required}var D=true;if(this.options.regexp){D=D&&E.match(this.options.regexp)}if(this.options.minLength){D=D&&E.length>=this.options.minLength}return D},disable:function(){this.el.disabled=true},enable:function(){this.el.disabled=false},focus:function(){if(!!this.el&&!C.isUndefined(this.el.focus)){this.el.focus()}},getStateString:function(D){if(D==inputEx.stateInvalid&&this.options.minLength&&this.el.value.length<this.options.minLength){return inputEx.messages.stringTooShort[0]+this.options.minLength+inputEx.messages.stringTooShort[1]}return inputEx.StringField.superclass.getStateString.call(this,D)},setClassFromState:function(){inputEx.StringField.superclass.setClassFromState.call(this);if(this.options.typeInvite){this.updateTypeInvite()}},updateTypeInvite:function(){if(!B.hasClass(this.divEl,"inputEx-focused")){if(this.isEmpty()){B.addClass(this.divEl,"inputEx-typeInvite");this.el.value=this.options.typeInvite}else{B.removeClass(this.divEl,"inputEx-typeInvite")}}else{if(B.hasClass(this.divEl,"inputEx-typeInvite")){this.el.value="";this.previousState=null;B.removeClass(this.divEl,"inputEx-typeInvite")}}},onFocus:function(D){inputEx.StringField.superclass.onFocus.call(this,D);if(this.options.typeInvite){this.updateTypeInvite()}},onKeyPress:function(D){},onKeyUp:function(D){}});inputEx.messages.stringTooShort=["This field should contain at least "," numbers or characters"];inputEx.registerType("string",inputEx.StringField,[{type:"string",label:"Type invite",name:"typeInvite",value:""},{type:"integer",label:"Size",name:"size",value:20},{type:"integer",label:"Min. length",name:"minLength",value:0}])})();(function(){var A=YAHOO.lang;inputEx.mixin.choice={addChoice:function(D){var C,B,E;if(!A.isObject(D)){D={value:D}}C={value:D.value,label:A.isString(D.label)?D.label:""+D.value,visible:true};C.node=this.createChoiceNode(C);B=this.getChoicePosition({position:D.position,label:D.before||D.after});if(B===-1){B=this.choicesList.length}else{if(A.isString(D.after)){B+=1}}this.choicesList.splice(B,0,C);this.appendChoiceNode(C.node,B);if(!!D.selected){E=this;setTimeout(function(){E.setValue(C.value)},0)}return C},removeChoice:function(D){var B,C;B=this.getChoicePosition(D);if(B===-1){throw new Error("SelectField : invalid or missing position, label or value in removeChoice")}C=this.choicesList[B];if(this.getValue()===C.value){this.clear()}this.choicesList.splice(B,1);this.removeChoiceNode(C.node)},hideChoice:function(D){var B,C;B=this.getChoicePosition(D);if(B!==-1){C=this.choicesList[B];if(C.visible){C.visible=false;if(this.getValue()===C.value){this.clear()}this.removeChoiceNode(C.node)}}},showChoice:function(D){var B,C;B=this.getChoicePosition(D);if(B!==-1){C=this.choicesList[B];if(!C.visible){C.visible=true;this.appendChoiceNode(C.node,B)}}},disableChoice:function(E,D){var B,C;if(A.isUndefined(D)||!A.isBoolean(D)){D=true}B=this.getChoicePosition(E);if(B!==-1){C=this.choicesList[B];this.disableChoiceNode(C.node);if(D&&this.getValue()===C.value){this.clear()}}},enableChoice:function(D){var B,C;B=this.getChoicePosition(D);if(B!==-1){C=this.choicesList[B];this.enableChoiceNode(C.node)}},getChoicePosition:function(C){var D,B=-1;D=this.choicesList.length;if(A.isNumber(C.position)&&C.position>=0&&C.position<D){B=parseInt(C.position,10)}else{if(!A.isUndefined(C.value)){B=inputEx.indexOf(C.value,this.choicesList,function(F,E){return E.value===F})}else{if(A.isString(C.label)){B=inputEx.indexOf(C.label,this.choicesList,function(E,F){return F.label===E})}}}return B}}}());(function(){var A=YAHOO.util.Event,B=YAHOO.lang;inputEx.SelectField=function(C){inputEx.SelectField.superclass.constructor.call(this,C)};B.extend(inputEx.SelectField,inputEx.Field,{setOptions:function(C){var D,E;inputEx.SelectField.superclass.setOptions.call(this,C);this.options.choices=B.isArray(C.choices)?C.choices:[];if(B.isArray(C.selectValues)){for(D=0,E=C.selectValues.length;D<E;D+=1){this.options.choices.push({value:C.selectValues[D],label:""+((C.selectOptions&&!B.isUndefined(C.selectOptions[D]))?C.selectOptions[D]:C.selectValues[D])})}}},renderComponent:function(){var C,D;this.el=inputEx.cn("select",{id:this.divEl.id?this.divEl.id+"-field":YAHOO.util.Dom.generateId(),name:this.options.name||""});this.choicesList=[];for(C=0,D=this.options.choices.length;C<D;C+=1){this.addChoice(this.options.choices[C])}this.fieldContainer.appendChild(this.el)},initEvents:function(){A.addListener(this.el,"change",this.onChange,this,true);A.addFocusListener(this.el,this.onFocus,this,true);A.addBlurListener(this.el,this.onBlur,this,true)},setValue:function(H,D){var E,G,C,F,I=false;for(E=0,G=this.choicesList.length;E<G;E+=1){if(this.choicesList[E].visible){C=this.choicesList[E];if(H===C.value){C.node.selected="selected";I=true;break}else{if(B.isUndefined(F)){F=E}}}}if(!I&&!B.isUndefined(F)){C=this.choicesList[F];C.node.selected="selected";H=C.value}inputEx.SelectField.superclass.setValue.call(this,H,D)},getValue:function(){var C;if(this.el.selectedIndex>=0){C=inputEx.indexOf(this.el.childNodes[this.el.selectedIndex],this.choicesList,function(E,D){return E===D.node});return this.choicesList[C].value}else{return""}},disable:function(){this.el.disabled=true},enable:function(){this.el.disabled=false},createChoiceNode:function(C){return inputEx.cn("option",{value:C.value},null,C.label)},removeChoiceNode:function(C){this.el.removeChild(C)},disableChoiceNode:function(C){C.disabled="disabled"},enableChoiceNode:function(C){C.removeAttribute("disabled")},appendChoiceNode:function(E,C){var F,D;F=0;for(D=0;D<C;D+=1){if(this.choicesList[D].visible){F+=1}}if(F<this.el.childNodes.length){YAHOO.util.Dom.insertBefore(E,this.el.childNodes[F])}else{this.el.appendChild(E)}}});B.augmentObject(inputEx.SelectField.prototype,inputEx.mixin.choice);inputEx.registerType("select",inputEx.SelectField,[{type:"list",name:"choices",label:"Choices",elementType:{type:"group",fields:[{label:"Value",name:"value",value:""},{label:"Label",name:"label"}]},value:[],required:true}])}());(function(){inputEx.EmailField=function(A){inputEx.EmailField.superclass.constructor.call(this,A)};YAHOO.lang.extend(inputEx.EmailField,inputEx.StringField,{setOptions:function(A){inputEx.EmailField.superclass.setOptions.call(this,A);this.options.messages.invalid=inputEx.messages.invalidEmail;this.options.regexp=inputEx.regexps.email;this.options.fixdomain=(YAHOO.lang.isUndefined(A.fixdomain)?false:!!A.fixdomain)},validateDomain:function(){var F,D,A,C,H,E,B,J;A=this.getValue();C=A.split("@")[1];H=[["gmail.com","gmail.com.br","_gmail.com","g-mail.com","g.mail.com","g_mail.com","gamail.com","gamil.com","gemail.com","ggmail.com","gimail.com","gmai.com","gmail.cim","gmail.co","gmaill.com","gmain.com","gmaio.com","gmal.com","gmali.com","gmeil.com","gmial.com","gmil.com","gtmail.com","igmail.com","gmail.fr"],["hotmail.co.uk","hotmail.com.uk"],["hotmail.com","hotmail.com.br","hotmail.br","0hotmail.com","8hotmail.com","_hotmail.com","ahotmail.com","ghotmail.com","gotmail.com","hatmail.com","hhotmail.com","ho0tmail.com","hogmail.com","hoimail.com","hoitmail.com","homail.com","homtail.com","hootmail.com","hopmail.com","hoptmail.com","hormail.com","hot.mail.com","hot_mail.com","hotail.com","hotamail.com","hotamil.com","hotemail.com","hotimail.com","hotlmail.com","hotmaail.com","hotmael.com","hotmai.com","hotmaial.com","hotmaiil.com","hotmail.acom","hotmail.bom","hotmail.ccom","hotmail.cm","hotmail.co","hotmail.coml","hotmail.comm","hotmail.con","hotmail.coom","hotmail.copm","hotmail.cpm","hotmail.lcom","hotmail.ocm","hotmail.om","hotmail.xom","hotmail2.com","hotmail_.com","hotmailc.com","hotmaill.com","hotmailo.com","hotmaio.com","hotmaiol.com","hotmais.com","hotmal.com","hotmall.com","hotmamil.com","hotmaol.com","hotmayl.com","hotmeil.com","hotmial.com","hotmil.com","hotmmail.com","hotmnail.com","hotmsil.com","hotnail.com","hotomail.com","hottmail.com","hotymail.com","hoymail.com","hptmail.com","htmail.com","htomail.com","ohotmail.com","otmail.com","rotmail.com","shotmail.com","hotmain.com"],["hotmail.fr","hotmail.ffr","hotmail.frr","hotmail.fr.br","hotmail.br","0hotmail.fr","8hotmail.fr","_hotmail.fr","ahotmail.fr","ghotmail.fr","gotmail.fr","hatmail.fr","hhotmail.fr","ho0tmail.fr","hogmail.fr","hoimail.fr","hoitmail.fr","homail.fr","homtail.fr","hootmail.fr","hopmail.fr","hoptmail.fr","hormail.fr","hot.mail.fr","hot_mail.fr","hotail.fr","hotamail.fr","hotamil.fr","hotemail.fr","hotimail.fr","hotlmail.fr","hotmaail.fr","hotmael.fr","hotmai.fr","hotmaial.fr","hotmaiil.fr","hotmail.frl","hotmail.frm","hotmail2.fr","hotmail_.fr","hotmailc.fr","hotmaill.fr","hotmailo.fr","hotmaio.fr","hotmaiol.fr","hotmais.fr","hotmal.fr","hotmall.fr","hotmamil.fr","hotmaol.fr","hotmayl.fr","hotmeil.fr","hotmial.fr","hotmil.fr","hotmmail.fr","hotmnail.fr","hotmsil.fr","hotnail.fr","hotomail.fr","hottmail.fr","hotymail.fr","hoymail.fr","hptmail.fr","htmail.fr","htomail.fr","ohotmail.fr","otmail.fr","rotmail.fr","shotmail.fr","hotmain.fr"],["yahoo.co.in","yaho.co.in","yahoo.co.cn","yahoo.co.n","yahoo.co.on","yahoo.coin","yahoo.com.in","yahoo.cos.in","yahoo.oc.in","yaoo.co.in","yhoo.co.in"],["yahoo.com.br","1yahoo.com.br","5yahoo.com.br","_yahoo.com.br","ayhoo.com.br","tahoo.com.br","uahoo.com.br","yagoo.com.br","yahho.com.br","yaho.com.br","yahoo.cm.br","yahoo.co.br","yahoo.com.ar","yahoo.com.b","yahoo.com.be","yahoo.com.ber","yahoo.com.bl","yahoo.com.brr","yahoo.com.brv","yahoo.com.bt","yahoo.com.nr","yahoo.coml.br","yahoo.con.br","yahoo.om.br","yahool.com.br","yahooo.com.br","yahoou.com.br","yaoo.com.br","yaroo.com.br","yhaoo.com.br","yhoo.com.br","yuhoo.com.br"],["yahoo.com","yahoomail.com","_yahoo.com","ahoo.com","ayhoo.com","eyahoo.com","hahoo.com","sahoo.com","yahho.com","yaho.com","yahol.com","yahoo.co","yahoo.con","yahoo.vom","yahoo0.com","yahoo1.com","yahool.com","yahooo.com","yahoou.com","yahoow.com","yahopo.com","yaloo.com","yaoo.com","yaroo.com","yayoo.com","yhaoo.com","yhoo.com","yohoo.com"],["yahoo.fr","yahoomail.fr","_yahoo.fr","ahoo.fr","ayhoo.fr","eyahoo.fr","hahoo.fr","sahoo.fr","yahho.fr","yaho.fr","yahol.fr","yahoo.co","yahoo.con","yahoo.vom","yahoo0.fr","yahoo1.fr","yahool.fr","yahooo.fr","yahoou.fr","yahoow.fr","yahopo.fr","yaloo.fr","yaoo.fr","yaroo.fr","yayoo.fr","yhaoo.fr","yhoo.fr","yohoo.fr"],["wanadoo.fr","wanadoo.frr","wanadoo.ffr","wanado.fr","wanadou.fr","wanadop.fr","wandoo.fr","wanaoo.fr","wannadoo.fr","wanadoo.com","wananadoo.fr","wanadoo.fe","wanaddo.fr","wanadoo.orange","waqnadoo.fr","wandaoo.fr","wannado.fr"],["msn.com","mns.com","msn.co"],["aol.com","aoel.com","aol.co"]];for(F=0,E=H.length;F<E;F++){B=H[F];for(D=0,J=B.length;D<J;D++){if(B.indexOf(C)===0){if(C===B[D]){return true}}else{if(C===B[D]){var I=YAHOO.util.Dom.generateId();var G=this;YAHOO.util.Event.addListener(I,"click",function(M){YAHOO.util.Event.stopEvent(M);var L=new RegExp(C,"i");var K=A.replace(L,B[0]);G.setValue(K)});this.options.messages.invalid=inputEx.messages.didYouMeant+"<a href='' id='"+I+"' style='color:blue;'>@"+B[0]+" ?</a>";return false}}}}return true},validate:function(){var A=inputEx.EmailField.superclass.validate.call(this);if(!!this.options.fixdomain){this.options.messages.invalid=inputEx.messages.invalidEmail;return A&&this.validateDomain()}else{return A}},getValue:function(){var A;A=inputEx.EmailField.superclass.getValue.call(this);return inputEx.removeAccents(A.toLowerCase())}});inputEx.messages.invalidEmail="Invalid email, ex: sample@test.com";inputEx.messages.didYouMeant="Did you mean : ";inputEx.registerType("email",inputEx.EmailField,[])})();(function(){var A=YAHOO.lang;inputEx.UrlField=function(B){inputEx.UrlField.superclass.constructor.call(this,B)};A.extend(inputEx.UrlField,inputEx.StringField,{setOptions:function(B){inputEx.UrlField.superclass.setOptions.call(this,B);this.options.className=B.className?B.className:"inputEx-Field inputEx-UrlField";this.options.messages.invalid=inputEx.messages.invalidUrl;this.options.favicon=A.isUndefined(B.favicon)?(("https:"==document.location.protocol)?false:true):B.favicon;this.options.size=B.size||50;this.options.regexp=inputEx.regexps.url},render:function(){inputEx.UrlField.superclass.render.call(this);this.el.size=this.options.size;if(!this.options.favicon){YAHOO.util.Dom.addClass(this.el,"nofavicon")}if(this.options.favicon){this.favicon=inputEx.cn("img",{src:inputEx.spacerUrl});this.fieldContainer.insertBefore(this.favicon,this.fieldContainer.childNodes[0]);YAHOO.util.Event.addListener(this.favicon,"click",function(){this.focus()},this,true)}},setClassFromState:function(){inputEx.UrlField.superclass.setClassFromState.call(this);if(this.options.favicon){this.updateFavicon((this.previousState==inputEx.stateValid)?this.getValue():null)}},updateFavicon:function(C){var B=C?C.match(/https?:\/\/[^\/]*/)+"/favicon.ico":inputEx.spacerUrl;if(B!=this.favicon.src){inputEx.sn(this.favicon,null,{visibility:"hidden"});this.favicon.src=B;if(this.timer){clearTimeout(this.timer)}var D=this;this.timer=setTimeout(function(){D.displayFavicon()},1000)}},displayFavicon:function(){inputEx.sn(this.favicon,null,{visibility:(this.favicon.naturalWidth!=0)?"visible":"hidden"})}});inputEx.messages.invalidUrl="Invalid URL, ex: http://www.test.com";inputEx.registerType("url",inputEx.UrlField,[{type:"boolean",label:"Display favicon",name:"favicon",value:true}])})();(function(){var C=YAHOO.lang,A=YAHOO.util.Event,B=YAHOO.util.Dom;inputEx.ListField=function(D){this.subFields=[];inputEx.ListField.superclass.constructor.call(this,D)};C.extend(inputEx.ListField,inputEx.Field,{setOptions:function(D){inputEx.ListField.superclass.setOptions.call(this,D);this.options.className=D.className?D.className:"inputEx-Field inputEx-ListField";this.options.sortable=C.isUndefined(D.sortable)?false:D.sortable;this.options.elementType=D.elementType||{type:"string"};this.options.useButtons=C.isUndefined(D.useButtons)?false:D.useButtons;this.options.unique=C.isUndefined(D.unique)?false:D.unique;this.options.listAddLabel=D.listAddLabel||inputEx.messages.listAddLink;this.options.listRemoveLabel=D.listRemoveLabel||inputEx.messages.listRemoveLink;this.options.maxItems=D.maxItems;this.options.minItems=D.minItems},renderComponent:function(){if(this.options.useButtons){this.addButton=inputEx.cn("img",{src:inputEx.spacerUrl,className:"inputEx-ListField-addButton"});this.fieldContainer.appendChild(this.addButton)}this.fieldContainer.appendChild(inputEx.cn("span",null,{marginLeft:"4px"},this.options.listLabel));this.childContainer=inputEx.cn("div",{className:"inputEx-ListField-childContainer"});this.fieldContainer.appendChild(this.childContainer);if(!this.options.useButtons){this.addButton=inputEx.cn("a",{className:"inputEx-List-link"},null,this.options.listAddLabel);this.fieldContainer.appendChild(this.addButton)}},initEvents:function(){A.addListener(this.addButton,"click",this.onAddButton,this,true)},validate:function(){var F=true;var J={};var D=this.subFields.length;if(C.isNumber(this.options.minItems)&&D<this.options.minItems){F=false}if(C.isNumber(this.options.maxItems)&&D>this.options.maxItems){F=false}for(var G=0;G<D&&F;G++){var E=this.subFields[G];E.setClassFromState();var H=E.getState();if(H==inputEx.stateRequired||H==inputEx.stateInvalid){F=false}if(this.options.unique){var I=C.dump(E.getValue());if(J[I]){F=false}else{J[I]=true}}}return F},setValue:function(G,D){if(!C.isArray(G)){throw new Error("inputEx.ListField.setValue expected an array, got "+(typeof G))}for(var F=0;F<G.length;F++){if(F==this.subFields.length){this.addElement(G[F])}else{this.subFields[F].setValue(G[F],false)}}var E=this.subFields.length-G.length;if(E>0){for(F=0;F<E;F++){this.removeElement(G.length)}}inputEx.ListField.superclass.setValue.call(this,G,D)},getValue:function(){var D=[];for(var E=0;E<this.subFields.length;E++){D[E]=this.subFields[E].getValue()}return D},addElement:function(E){var D=this.renderSubField(E);this.subFields.push(D);return D},onAddButton:function(E){A.stopEvent(E);if(C.isNumber(this.options.maxItems)&&this.subFields.length>=this.options.maxItems){return }var D=this.addElement();D.focus();this.fireUpdatedEvt()},renderSubField:function(K){var G=inputEx.cn("div"),E;if(this.options.useButtons){E=inputEx.cn("img",{src:inputEx.spacerUrl,className:"inputEx-ListField-delButton"});A.addListener(E,"click",this.onDelete,this,true);G.appendChild(E)}var J=C.merge({},this.options.elementType);if(C.isObject(J.inputParams)&&!C.isUndefined(K)){J.inputParams.value=K}else{if(!C.isUndefined(K)){J.value=K}}var H=inputEx(J,this);var F=H.getEl();B.setStyle(F,"margin-left","4px");B.setStyle(F,"float","left");G.appendChild(F);H.updatedEvt.subscribe(this.onChange,this,true);if(this.options.sortable){var I=inputEx.cn("div",{className:"inputEx-ListField-Arrow inputEx-ListField-ArrowUp"});A.addListener(I,"click",this.onArrowUp,this,true);var D=inputEx.cn("div",{className:"inputEx-ListField-Arrow inputEx-ListField-ArrowDown"});A.addListener(D,"click",this.onArrowDown,this,true);G.appendChild(I);G.appendChild(D)}if(!this.options.useButtons){E=inputEx.cn("a",{className:"inputEx-List-link"},null,this.options.listRemoveLabel);A.addListener(E,"click",this.onDelete,this,true);G.appendChild(E)}G.appendChild(inputEx.cn("div",null,{clear:"both"}));this.childContainer.appendChild(G);return H},onArrowUp:function(J){var G=A.getTarget(J).parentNode;var E=null;var F=-1;for(var H=1;H<G.parentNode.childNodes.length;H++){var D=G.parentNode.childNodes[H];if(D==G){E=G.parentNode.childNodes[H-1];F=H;break}}if(E){var K=this.childContainer.removeChild(G);var I=this.childContainer.insertBefore(K,E);var L=this.subFields[F];this.subFields[F]=this.subFields[F-1];this.subFields[F-1]=L;if(this.arrowAnim){this.arrowAnim.stop(true)}this.arrowAnim=new YAHOO.util.ColorAnim(I,{backgroundColor:{from:"#eeee33",to:"#eeeeee"}},0.4);this.arrowAnim.onComplete.subscribe(function(){B.setStyle(I,"background-color","")});this.arrowAnim.animate();this.fireUpdatedEvt()}},onArrowDown:function(J){var F=A.getTarget(J).parentNode;var E=-1;var I=null;for(var G=0;G<F.parentNode.childNodes.length;G++){var D=F.parentNode.childNodes[G];if(D==F){I=F.parentNode.childNodes[G+1];E=G;break}}if(I){var K=this.childContainer.removeChild(F);var H=B.insertAfter(K,I);var L=this.subFields[E];this.subFields[E]=this.subFields[E+1];this.subFields[E+1]=L;if(this.arrowAnim){this.arrowAnim.stop(true)}this.arrowAnim=new YAHOO.util.ColorAnim(H,{backgroundColor:{from:"#eeee33",to:"#eeeeee"}},1);this.arrowAnim.onComplete.subscribe(function(){B.setStyle(H,"background-color","")});this.arrowAnim.animate();this.fireUpdatedEvt()}},onDelete:function(H){A.stopEvent(H);if(C.isNumber(this.options.minItems)&&this.subFields.length<=this.options.minItems){return }var E=A.getTarget(H).parentNode;var D=-1;var G=E.childNodes[this.options.useButtons?1:0];for(var F=0;F<this.subFields.length;F++){if(this.subFields[F].getEl()==G){D=F;break}}if(D!=-1){this.removeElement(D)}this.fireUpdatedEvt()},removeElement:function(E){var D=this.subFields[E].getEl().parentNode;this.subFields[E]=undefined;this.subFields=inputEx.compactArray(this.subFields);D.parentNode.removeChild(D)}});inputEx.registerType("list",inputEx.ListField,[{type:"string",label:"List label",name:"listLabel",value:""},{type:"type",label:"List element type",required:true,name:"elementType"}]);inputEx.messages.listAddLink="Add";inputEx.messages.listRemoveLink="remove"})();(function(){var C=YAHOO.lang,A=YAHOO.util.Event,B=YAHOO.util.Dom;inputEx.CheckBox=function(D){inputEx.CheckBox.superclass.constructor.call(this,D)};C.extend(inputEx.CheckBox,inputEx.Field,{setOptions:function(D){inputEx.CheckBox.superclass.setOptions.call(this,D);this.options.className=D.className?D.className:"inputEx-Field inputEx-CheckBox";this.options.rightLabel=D.rightLabel||"";this.sentValues=D.sentValues||[true,false];this.options.sentValues=this.sentValues;this.checkedValue=this.sentValues[0];this.uncheckedValue=this.sentValues[1]},renderComponent:function(){var D=this.divEl.id?this.divEl.id+"-field":YAHOO.util.Dom.generateId();this.el=inputEx.cn("input",{id:D,type:"checkbox"});this.fieldContainer.appendChild(this.el);this.rightLabelEl=inputEx.cn("label",{"for":D,className:"inputEx-CheckBox-rightLabel"},null,this.options.rightLabel);this.fieldContainer.appendChild(this.rightLabelEl);this.hiddenEl=inputEx.cn("input",{type:"hidden",name:this.options.name||"",value:this.uncheckedValue});this.fieldContainer.appendChild(this.hiddenEl)},initEvents:function(){if(YAHOO.env.ua.ie){A.addListener(this.el,"click",function(D){YAHOO.lang.later(10,this,function(){this.onChange(D)})},this,true)}else{A.addListener(this.el,"change",this.onChange,this,true)}A.addFocusListener(this.el,this.onFocus,this,true);A.addBlurListener(this.el,this.onBlur,this,true)},onChange:function(D){this.hiddenEl.value=this.el.checked?this.checkedValue:this.uncheckedValue;inputEx.CheckBox.superclass.onChange.call(this,D)},getValue:function(){return this.el.checked?this.checkedValue:this.uncheckedValue},setValue:function(E,D){if(E===this.checkedValue||(typeof (E)=="string"&&typeof (this.checkedValue)=="boolean"&&E===String(this.checkedValue))){this.hiddenEl.value=this.checkedValue;this.el.checked=true;if(YAHOO.env.ua.ie===6){this.el.setAttribute("defaultChecked","checked")}}else{this.hiddenEl.value=this.uncheckedValue;this.el.checked=false;if(YAHOO.env.ua.ie===6){this.el.removeAttribute("defaultChecked")}}inputEx.CheckBox.superclass.setValue.call(this,E,D)},disable:function(){this.el.disabled=true},enable:function(){this.el.disabled=false}});inputEx.registerType("boolean",inputEx.CheckBox,[{type:"string",label:"Right Label",name:"rightLabel"}])})();(function(){var A=YAHOO.util.Event;inputEx.Textarea=function(B){inputEx.Textarea.superclass.constructor.call(this,B)};YAHOO.lang.extend(inputEx.Textarea,inputEx.StringField,{setOptions:function(B){inputEx.Textarea.superclass.setOptions.call(this,B);this.options.rows=B.rows||6;this.options.cols=B.cols||23;this.options.readonly=!!B.readonly},renderComponent:function(){this.wrapEl=inputEx.cn("div",{className:"inputEx-StringField-wrapper"});var B={};B.id=this.divEl.id?this.divEl.id+"-field":YAHOO.util.Dom.generateId();B.rows=this.options.rows;B.cols=this.options.cols;if(this.options.name){B.name=this.options.name}if(this.options.readonly){B.readonly="readonly"}this.el=inputEx.cn("textarea",B,null,this.options.value);this.wrapEl.appendChild(this.el);this.fieldContainer.appendChild(this.wrapEl)},validate:function(){var B=inputEx.Textarea.superclass.validate.call(this);if(this.options.maxLength){B=B&&this.getValue().length<=this.options.maxLength}return B},getStateString:function(B){if(B==inputEx.stateInvalid&&this.options.minLength&&this.el.value.length<this.options.minLength){return inputEx.messages.stringTooShort[0]+this.options.minLength+inputEx.messages.stringTooShort[1]}else{if(B==inputEx.stateInvalid&&this.options.maxLength&&this.el.value.length>this.options.maxLength){return inputEx.messages.stringTooLong[0]+this.options.maxLength+inputEx.messages.stringTooLong[1]}}return inputEx.Textarea.superclass.getStateString.call(this,B)},insert:function(E){var D,C,B;if(document.selection){this.el.focus();D=document.selection.createRange();D.text=E}else{if(this.el.selectionStart||this.el.selectionStart=="0"){C=this.el.selectionStart;B=this.el.selectionEnd;this.el.value=this.el.value.substring(0,C)+E+this.el.value.substring(B,this.el.value.length)}else{this.el.value+=E}}}});inputEx.messages.stringTooLong=["This field should contain at most "," numbers or characters"];inputEx.registerType("text",inputEx.Textarea,[{type:"integer",label:"Rows",name:"rows",value:6},{type:"integer",label:"Cols",name:"cols",value:23}])})();(function(){var D=YAHOO.lang,A=YAHOO.util.Event,B=YAHOO.util.Dom,C="inputEx-InPlaceEdit-";inputEx.InPlaceEdit=function(E){inputEx.InPlaceEdit.superclass.constructor.call(this,E)};D.extend(inputEx.InPlaceEdit,inputEx.Field,{setOptions:function(E){inputEx.InPlaceEdit.superclass.setOptions.call(this,E);this.options.visu=E.visu;this.options.editorField=E.editorField;this.options.buttonTypes=E.buttonTypes||{ok:"submit",cancel:"link"};this.options.animColors=E.animColors||null},renderComponent:function(){this.renderVisuDiv();this.renderEditor()},renderEditor:function(){this.editorContainer=inputEx.cn("div",{className:C+"editor"},{display:"none"});this.editorField=inputEx(this.options.editorField,this);var E=this.editorField.getEl();this.editorContainer.appendChild(E);B.addClass(E,C+"editorDiv");this.okButton=new inputEx.widget.Button({type:this.options.buttonTypes.ok,parentEl:this.editorContainer,value:inputEx.messages.okEditor,className:"inputEx-Button "+C+"OkButton",onClick:{fn:this.onOkEditor,scope:this}});this.cancelLink=new inputEx.widget.Button({type:this.options.buttonTypes.cancel,parentEl:this.editorContainer,value:inputEx.messages.cancelEditor,className:"inputEx-Button "+C+"CancelLink",onClick:{fn:this.onCancelEditor,scope:this}});this.editorContainer.appendChild(inputEx.cn("div",null,{clear:"both"}));this.fieldContainer.appendChild(this.editorContainer)},onVisuMouseOver:function(E){if(this.colorAnim){this.colorAnim.stop(true)}inputEx.sn(this.formattedContainer,null,{backgroundColor:this.options.animColors.from})},onVisuMouseOut:function(E){if(this.colorAnim){this.colorAnim.stop(true)}this.colorAnim=new YAHOO.util.ColorAnim(this.formattedContainer,{backgroundColor:this.options.animColors},1);this.colorAnim.onComplete.subscribe(function(){B.setStyle(this.formattedContainer,"background-color","")},this,true);this.colorAnim.animate()},renderVisuDiv:function(){this.formattedContainer=inputEx.cn("div",{className:"inputEx-InPlaceEdit-visu"});if(D.isFunction(this.options.formatDom)){this.formattedContainer.appendChild(this.options.formatDom(this.options.value))}else{if(D.isFunction(this.options.formatValue)){this.formattedContainer.innerHTML=this.options.formatValue(this.options.value)}else{this.formattedContainer.innerHTML=D.isUndefined(this.options.value)?inputEx.messages.emptyInPlaceEdit:this.options.value}}this.fieldContainer.appendChild(this.formattedContainer)},initEvents:function(){A.addListener(this.formattedContainer,"click",this.openEditor,this,true);if(this.options.animColors){A.addListener(this.formattedContainer,"mouseover",this.onVisuMouseOver,this,true);A.addListener(this.formattedContainer,"mouseout",this.onVisuMouseOut,this,true)}if(this.editorField.el){A.addListener(this.editorField.el,"keyup",this.onKeyUp,this,true);A.addListener(this.editorField.el,"keydown",this.onKeyDown,this,true)}},onKeyUp:function(E){if(E.keyCode==13){this.onOkEditor(E)}if(E.keyCode==27){this.onCancelEditor(E)}},onKeyDown:function(E){if(E.keyCode==9){this.onOkEditor(E)}},onOkEditor:function(G){A.stopEvent(G);var F=this.editorField.getValue();this.setValue(F);this.editorContainer.style.display="none";this.formattedContainer.style.display="";var E=this;setTimeout(function(){E.updatedEvt.fire(F)},50)},onCancelEditor:function(E){A.stopEvent(E);this.editorContainer.style.display="none";this.formattedContainer.style.display=""},openEditor:function(){var E=this.getValue();this.editorContainer.style.display="";this.formattedContainer.style.display="none";if(!D.isUndefined(E)){this.editorField.setValue(E)}this.editorField.focus();if(this.editorField.el&&D.isFunction(this.editorField.el.setSelectionRange)&&(!!E&&!!E.length)){this.editorField.el.setSelectionRange(0,E.length)}},getValue:function(){var E=(this.editorContainer.style.display=="");return E?this.editorField.getValue():this.value},setValue:function(F,E){this.value=F;if(D.isUndefined(F)||F==""){inputEx.renderVisu(this.options.visu,inputEx.messages.emptyInPlaceEdit,this.formattedContainer)}else{inputEx.renderVisu(this.options.visu,this.value,this.formattedContainer)}if(this.editorContainer.style.display==""){this.editorField.setValue(F)}inputEx.InPlaceEdit.superclass.setValue.call(this,F,E)},close:function(){this.editorContainer.style.display="none";this.formattedContainer.style.display=""}});inputEx.messages.emptyInPlaceEdit="(click to edit)";inputEx.messages.cancelEditor="cancel";inputEx.messages.okEditor="Ok";inputEx.registerType("inplaceedit",inputEx.InPlaceEdit,[{type:"type",label:"Editor",name:"editorField"}])})();(function(){var A=YAHOO.util.Event,B=YAHOO.util.Dom,C=YAHOO.lang;inputEx.TypeField=function(D){inputEx.TypeField.superclass.constructor.call(this,D);this.updateFieldValue()};C.extend(inputEx.TypeField,inputEx.Field,{renderComponent:function(){this.fieldValueWrapper=inputEx.cn("div",{className:"inputEx-TypeField-FieldValueWrapper"});this.fieldContainer.appendChild(this.fieldValueWrapper);this.propertyPanel=inputEx.cn("div",{className:"inputEx-TypeField-PropertiesPanel"},{display:"none"});var D=[];for(var E in inputEx.typeClasses){if(inputEx.typeClasses.hasOwnProperty(E)){D.push({value:E})}}this.typeSelect=new inputEx.SelectField({label:"Type",choices:D,parentEl:this.propertyPanel});this.groupOptionsWrapper=inputEx.cn("div");this.propertyPanel.appendChild(this.groupOptionsWrapper);this.button=inputEx.cn("div",{className:"inputEx-TypeField-EditButton"});this.button.appendChild(this.propertyPanel);this.fieldContainer.appendChild(this.button);this.rebuildGroupOptions()},initEvents:function(){inputEx.TypeField.superclass.initEvents.call(this);A.addListener(this.button,"click",this.onTogglePropertiesPanel,this,true);A.addListener(this.propertyPanel,"click",function(D){A.stopPropagation(D)},this,true);this.typeSelect.updatedEvt.subscribe(this.rebuildGroupOptions,this,true)},rebuildGroupOptions:function(){try{var D=null;if(this.group){D=this.group.getValue();this.group.close();this.group.destroy();this.groupOptionsWrapper.innerHTML=""}var G=inputEx.getFieldClass(this.typeSelect.getValue());var E={fields:G.groupOptions,parentEl:this.groupOptionsWrapper};this.group=new inputEx.Group(E);if(D){this.group.setValue({name:D.name,label:D.label})}this.group.updatedEvt.subscribe(this.onChangeGroupOptions,this,true);this.updateFieldValue()}catch(F){if(YAHOO.lang.isObject(window.console)&&YAHOO.lang.isFunction(window.console["log"])){console.log("inputEx.TypeField.rebuildGroupOptions: ",F)}}},onTogglePropertiesPanel:function(){if(this.propertyPanel.style.display=="none"){this.propertyPanel.style.display="";B.addClass(this.button,"opened")}else{this.propertyPanel.style.display="none";B.removeClass(this.button,"opened")}},onChangeGroupOptions:function(){this.updateFieldValue();this.fireUpdatedEvt()},updateFieldValue:function(){try{if(this.fieldValue){this.fieldValue.close();this.fieldValue.destroy();delete this.fieldValue;this.fieldValueWrapper.innerHTML=""}var E=this.group.getValue();E.type=this.getValue().type;E.parentEl=this.fieldValueWrapper;this.fieldValue=inputEx(E,this);this.fieldValue.updatedEvt.subscribe(this.fireUpdatedEvt,this,true)}catch(D){console.log("Error while updateFieldValue",D.message)}},setValue:function(E,D){this.typeSelect.setValue(E.type,false);this.rebuildGroupOptions();if(C.isObject(E.inputParams)){this.group.setValue(E.inputParams,false)}else{this.group.setValue(E,false)}this.updateFieldValue();if(C.isObject(E.inputParams)&&!C.isUndefined(E.inputParams.value)){this.fieldValue.setValue(E.inputParams.value)}else{if(!C.isUndefined(E.value)){this.fieldValue.setValue(E.value)}}if(D!==false){this.fireUpdatedEvt()}},getValue:function(){var I=function(K,N){var J,L=K.groupOptions.length,M;for(J=0;J<L;J++){M=K.groupOptions[J];if(C.isObject(M.inputParams)&&M.inputParams.name==N){return M.inputParams.value}else{if(M.name==N){return M.value}}}return undefined};var E=this.group.getValue();var H=inputEx.getFieldClass(this.typeSelect.getValue());for(var G in E){if(E.hasOwnProperty(G)){var F=I(H,G);var D=E[G];if(F==D){E[G]=undefined}}}E.type=this.typeSelect.getValue();if(this.fieldValue){E.value=this.fieldValue.getValue()}return E}});inputEx.registerType("type",inputEx.TypeField,[])})();(function(){var C=YAHOO.util,G=YAHOO.lang;var B=C.Event,D=C.Dom,A=C.Connect,F=G.JSON,E=YAHOO.widget;WireIt.BaseEditor=function(H){this.el=D.get(H.parentEl);this.setOptions(H);this.render()};WireIt.BaseEditor.defaultOptions={layoutOptions:{units:[{position:"top",height:57,body:"top"},{position:"left",width:200,resize:true,body:"left",gutter:"5px",collapse:true,collapseSize:25,header:"Modules",scroll:true,animate:true},{position:"center",body:"center",gutter:"5px"},{position:"right",width:320,resize:true,body:"right",gutter:"5px",collapse:true,collapseSize:25,animate:true}]},propertiesFields:[{type:"string",name:"name",label:"Title",typeInvite:"Enter a title"},{type:"text",name:"description",label:"Description",cols:30,rows:4}],accordionViewParams:{collapsible:true,expandable:true,width:"auto",expandItem:0,animationSpeed:"0.3",animate:true,effect:YAHOO.util.Easing.easeBothStrong}};WireIt.BaseEditor.prototype={setOptions:function(H){this.options={};this.options.propertiesFields=H.propertiesFields||WireIt.BaseEditor.defaultOptions.propertiesFields;this.options.layoutOptions=H.layoutOptions||WireIt.BaseEditor.defaultOptions.layoutOptions;this.options.accordionViewParams=H.accordionViewParams||WireIt.BaseEditor.defaultOptions.accordionViewParams},render:function(){this.renderHelpPanel();this.layout=new E.Layout(this.el,this.options.layoutOptions);this.layout.render();this.renderPropertiesAccordion();this.renderButtons();this.renderSavedStatus();this.renderPropertiesForm()},renderHelpPanel:function(){this.helpPanel=new E.Panel("helpPanel",{fixedcenter:true,draggable:true,visible:false,modal:true});this.helpPanel.render()},renderAlertPanel:function(){this.alertPanel=new E.Panel("WiringEditor-alertPanel",{fixedcenter:true,draggable:true,width:"500px",visible:false,modal:true});this.alertPanel.setHeader("Message");this.alertPanel.setBody("<div id='alertPanelBody'></div><button id='alertPanelButton'>Ok</button>");this.alertPanel.render(document.body);B.addListener("alertPanelButton","click",function(){this.alertPanel.hide()},this,true)},renderButtons:function(){var I=D.get("toolbar");var H=new E.Button({label:"New",id:"WiringEditor-newButton",container:I});H.on("click",this.onNew,this,true);var K=new E.Button({label:"Load",id:"WiringEditor-loadButton",container:I});K.on("click",this.load,this,true);var J=new E.Button({label:"Save",id:"WiringEditor-saveButton",container:I});J.on("click",this.onSave,this,true);var M=new E.Button({label:"Delete",id:"WiringEditor-deleteButton",container:I});M.on("click",this.onDelete,this,true);var L=new E.Button({label:"Help",id:"WiringEditor-helpButton",container:I});L.on("click",this.onHelp,this,true)},renderSavedStatus:function(){this.savedStatusEl=WireIt.cn("div",{className:"savedStatus",title:"Not saved"},{display:"none"},"*");D.get("toolbar").appendChild(this.savedStatusEl)},onSave:function(){this.save()},save:function(){},alert:function(H){if(!this.alertPanel){this.renderAlertPanel()}D.get("alertPanelBody").innerHTML=H;this.alertPanel.show()},onHelp:function(){this.helpPanel.show()},renderPropertiesAccordion:function(){this.accordionView=new YAHOO.widget.AccordionView("accordionView",this.options.accordionViewParams)},renderPropertiesForm:function(){this.propertiesForm=new inputEx.Group({parentEl:YAHOO.util.Dom.get("propertiesForm"),fields:this.options.propertiesFields});this.propertiesForm.updatedEvt.subscribe(function(){this.markUnsaved()},this,true)},markSaved:function(){this.savedStatusEl.style.display="none"},markUnsaved:function(){this.savedStatusEl.style.display=""},isSaved:function(){return(this.savedStatusEl.style.display=="none")}}})();(function(){var A=YAHOO.util,C=YAHOO.lang,B=A.Dom;WireIt.ModuleProxy=function(E,D){this._WiringEditor=D;WireIt.ModuleProxy.superclass.constructor.call(this,E,"module",{dragElId:"moduleProxy"});this.isTarget=false};C.extend(WireIt.ModuleProxy,YAHOO.util.DDProxy,{startDrag:function(F){WireIt.ModuleProxy.superclass.startDrag.call(this,F);var D=this.getDragEl(),E=this.getEl();D.innerHTML=E.innerHTML;D.className=E.className},endDrag:function(D){},onDragDrop:function(H,F){var I=F[0],G=F[0]._layer,E=this.getDragEl(),J=B.getXY(E),D=B.getXY(G.el);this._WiringEditor.addModule(this._module,[J[0]-D[0]+G.el.scrollLeft,J[1]-D[1]+G.el.scrollTop])}})})();(function(){var C=YAHOO.util,F=YAHOO.lang;var B=C.Event,D=C.Dom,A=C.Connect,E=YAHOO.widget;WireIt.WiringEditor=function(G){this.modulesByName={};WireIt.WiringEditor.superclass.constructor.call(this,G);if(this.adapter.init&&YAHOO.lang.isFunction(this.adapter.init)){this.adapter.init()}this.load()};F.extend(WireIt.WiringEditor,WireIt.BaseEditor,{setOptions:function(J){WireIt.WiringEditor.superclass.setOptions.call(this,J);this.modules=J.modules||[];for(var K=0;K<this.modules.length;K++){var G=this.modules[K];this.modulesByName[G.name]=G}this.adapter=J.adapter||WireIt.WiringEditor.adapters.JsonRpc;this.options.languageName=J.languageName||"anonymousLanguage";this.options.layerOptions={};var L=J.layerOptions||{};this.options.layerOptions.parentEl=L.parentEl?L.parentEl:D.get("center");this.options.layerOptions.layerMap=YAHOO.lang.isUndefined(L.layerMap)?true:L.layerMap;this.options.layerOptions.layerMapOptions=L.layerMapOptions||{parentEl:"layerMap"};this.options.modulesAccordionViewParams=YAHOO.lang.merge({collapsible:true,expandable:true,width:"auto",expandItem:0,animationSpeed:"0.3",animate:true,effect:YAHOO.util.Easing.easeBothStrong},J.modulesAccordionViewParams||{});var H=this;var I=function(M){return(M=="Group")?({xtype:"WireIt.GroupFormContainer",title:"Group",collapsible:true,fields:[],legend:"Inner group fields",getBaseConfigFunction:I}):H.modulesByName[M].container};this.options.layerOptions.grouper={baseConfigFunction:I}},render:function(){WireIt.WiringEditor.superclass.render.call(this);this.layer=new WireIt.Layer(this.options.layerOptions);this.layer.eventChanged.subscribe(this.onLayerChanged,this,true);this.renderModulesAccordion();this.buildModulesList()},renderModulesAccordion:function(){if(!D.get("modulesAccordionView")){D.get("left").appendChild(WireIt.cn("ul",{id:"modulesAccordionView"}));var G=WireIt.cn("li");G.appendChild(WireIt.cn("h2",null,null,"Main"));var I=WireIt.cn("div");I.appendChild(WireIt.cn("div",{id:"module-category-main"}));G.appendChild(I);D.get("modulesAccordionView").appendChild(G)}this.modulesAccordionView=new YAHOO.widget.AccordionView("modulesAccordionView",this.options.modulesAccordionViewParams);for(var H=1,J=this.modulesAccordionView.getPanels().length;H<J;H++){this.modulesAccordionView.openPanel(H)}},buildModulesList:function(){var G=this.modules;for(var H=0;H<G.length;H++){this.addModuleToList(G[H])}if(!this.ddTarget){this.ddTarget=new YAHOO.util.DDTarget(this.layer.el,"module");this.ddTarget._layer=this.layer}},addModuleToList:function(H){try{var L=WireIt.cn("div",{className:"WiringEditor-module"});if(H.description){L.title=H.description}if(H.container.icon){L.appendChild(WireIt.cn("img",{src:H.container.icon}))}L.appendChild(WireIt.cn("span",null,null,H.name));var K=new WireIt.ModuleProxy(L,this);K._module=H;var J=H.category||"main";var I=D.get("module-category-"+J);if(!I){this.modulesAccordionView.addPanel({label:J,content:"<div id='module-category-"+J+"'></div>"});this.modulesAccordionView.openPanel(this.modulesAccordionView._panels.length-1);I=D.get("module-category-"+J)}I.appendChild(L)}catch(G){console.log(G)}},getCurrentGrouper:function(G){return G.currentGrouper},addModule:function(J,M){try{var L=J.container;L.position=M;L.title=J.name;var H=this;L.getGrouper=function(){return H.getCurrentGrouper(H)};var G=this.layer.addContainer(L);var K=J.category||"main";D.addClass(G.el,"WiringEditor-module-category-"+K.replace(/ /g,"-"));D.addClass(G.el,"WiringEditor-module-"+J.name.replace(/ /g,"-"))}catch(I){this.alert("Error Layer.addContainer: "+I.message);if(window.console&&YAHOO.lang.isFunction(console.log)){console.log(I)}}},save:function(){var G=this.getValue();if(G.name===""){this.alert("Please choose a name");return }this.tempSavedWiring={name:G.name,working:G.working,language:this.options.languageName};this.adapter.saveWiring(this.tempSavedWiring,{success:this.saveModuleSuccess,failure:this.saveModuleFailure,scope:this})},saveModuleSuccess:function(G){this.markSaved();this.alert("Saved !")},saveModuleFailure:function(G){this.alert("Unable to save the wiring : "+G)},onNew:function(){if(!this.isSaved()){if(!confirm("Warning: Your work is not saved yet ! Press ok to continue anyway.")){return }}this.preventLayerChangedEvent=true;this.layer.clear();this.propertiesForm.clear(false);this.markSaved();this.preventLayerChangedEvent=false},onDelete:function(){if(confirm("Are you sure you want to delete this wiring ?")){var G=this.getValue();this.adapter.deleteWiring({name:G.name,language:this.options.languageName},{success:function(H){this.onNew();this.alert("Deleted !")},failure:function(H){this.alert("Unable to delete wiring: "+H)},scope:this})}},renderLoadPanel:function(){if(!this.loadPanel){this.loadPanel=new E.Panel("WiringEditor-loadPanel",{fixedcenter:true,draggable:true,width:"500px",visible:false,modal:true});this.loadPanel.setHeader("Select the wiring to load");this.loadPanel.setBody("Filter: <input type='text' id='loadFilter' /><div id='loadPanelBody'></div>");this.loadPanel.render(document.body);B.onAvailable("loadFilter",function(){B.addListener("loadFilter","keyup",this.inputFilterTimer,this,true)},this,true)}},inputFilterTimer:function(){if(this.inputFilterTimeout){clearTimeout(this.inputFilterTimeout);this.inputFilterTimeout=null}var G=this;this.inputFilterTimeout=setTimeout(function(){G.updateLoadPanelList(D.get("loadFilter").value)},500)},updateLoadPanelList:function(I){var K=WireIt.cn("ul");if(F.isArray(this.pipes)){for(var H=0;H<this.pipes.length;H++){var G=this.pipes[H];this.pipesByName[G.name]=G;if(!I||I===""||G.name.match(new RegExp(I,"i"))){K.appendChild(WireIt.cn("li",null,{cursor:"pointer"},G.name))}}}var J=D.get("loadPanelBody");YAHOO.util.Event.purgeElement(J,true);J.innerHTML="";J.appendChild(K);B.addListener(K,"click",function(M,L){this.loadPipe(B.getTarget(M).innerHTML)},this,true)},load:function(){this.adapter.listWirings({language:this.options.languageName},{success:function(G){this.onLoadSuccess(G)},failure:function(G){this.alert("Unable to load the wirings: "+G)},scope:this})},onLoadSuccess:function(K){this.pipes=K;this.pipesByName={};this.renderLoadPanel();this.updateLoadPanelList();if(!this.afterFirstRun){var I=window.location.search.substr(1).split("&");var J={};for(var H=0;H<I.length;H++){var G=I[H].split("=");J[G[0]]=window.decodeURIComponent(G[1])}this.afterFirstRun=true;if(J.autoload){this.loadPipe(J.autoload);return }}this.loadPanel.show()},getPipeByName:function(H){var J=this.pipes.length,G;for(var I=0;I<J;I++){if(this.pipes[I].name==H){return this.pipes[I].working}}return null},loadPipe:function(I){if(!this.isSaved()){if(!confirm("Warning: Your work is not saved yet ! Press ok to continue anyway.")){return }}try{this.preventLayerChangedEvent=true;if(this.loadPanel){this.loadPanel.hide()}var M=this.getPipeByName(I),K;if(!M){this.alert("The wiring '"+I+"' was not found.");return }this.layer.clear();this.propertiesForm.setValue(M.properties,false);if(F.isArray(M.modules)){for(K=0;K<M.modules.length;K++){var G=M.modules[K];if(this.modulesByName[G.name]){var L=this.modulesByName[G.name].container;YAHOO.lang.augmentObject(G.config,L);G.config.title=G.name;var H=this.layer.addContainer(G.config);D.addClass(H.el,"WiringEditor-module-"+G.name);H.setValue(G.value)}else{throw new Error("WiringEditor: module '"+G.name+"' not found !")}}if(F.isArray(M.wires)){for(K=0;K<M.wires.length;K++){this.layer.addWire(M.wires[K])}}}this.markSaved();this.preventLayerChangedEvent=false}catch(J){this.alert(J);if(window.console&&YAHOO.lang.isFunction(console.log)){console.log(J)}}},onLayerChanged:function(){if(!this.preventLayerChangedEvent){this.markUnsaved()}},getValue:function(){var H;var I={modules:[],wires:[],properties:null};for(H=0;H<this.layer.containers.length;H++){I.modules.push({name:this.layer.containers[H].title,value:this.layer.containers[H].getValue(),config:this.layer.containers[H].getConfig()})}for(H=0;H<this.layer.wires.length;H++){var J=this.layer.wires[H];var G=J.getConfig();G.src={moduleId:WireIt.indexOf(J.terminal1.container,this.layer.containers),terminal:J.terminal1.name};G.tgt={moduleId:WireIt.indexOf(J.terminal2.container,this.layer.containers),terminal:J.terminal2.name};I.wires.push(G)}I.properties=this.propertiesForm.getValue();return{name:I.properties.name,working:I}}});WireIt.WiringEditor.adapters={}})();(function(){var C=YAHOO.util,G=YAHOO.lang;var B=C.Event,D=C.Dom,A=C.Connect,F=G.JSON,E=YAHOO.widget;WireIt.Group=function(H,J,I){this.containers=[];this.groups=[];this.properties={};this.layer=J;this.grouper=H;this.events={};this.events.containerAdded=new YAHOO.util.CustomEvent("containerAdded");this.events.containerRemoved=new YAHOO.util.CustomEvent("containerRemoved");this.events.groupAdded=new YAHOO.util.CustomEvent("groupAdded");this.events.groupRemoved=new YAHOO.util.CustomEvent("groupRemoved");this.events.groupEmptied=new YAHOO.util.CustomEvent("groupEmptied");this.events.stateChanged=new YAHOO.util.CustomEvent("stateChanged");this.stateChangeFunc=function(K,L){this.events.stateChanged.fire({event:K,objects:L})};this.events.containerAdded.subscribe(this.stateChangeFunc,this,true);this.events.containerRemoved.subscribe(this.stateChangeFunc,this,true);this.events.groupAdded.subscribe(this.stateChangeFunc,this,true);this.events.groupRemoved.subscribe(this.stateChangeFunc,this,true);this.events.containerRemoved.subscribe(this.checkGroupEmpty,this,true);this.events.groupRemoved.subscribe(this.checkGroupEmpty,this,true);this.collapsing=false;J.eventRemoveContainer.subscribe(function(K,L){if(!this.collapsing){this.removeContainer.call(this,L[0])}},this,true)};WireIt.Group.prototype={collapse:function(N){if(G.isValue(this.groupContainer)){return this.groupContainer}for(var T in this.groups){var K=this.groups[T];K.group.collapse.call(K.group,true)}var H=WireIt.GroupUtils.getMap(this);var O=WireIt.GroupUtils.getCollapsedConfig(this,H);var I=[];WireIt.GroupUtils.addAllContainers(this,I);var S=WireIt.GroupUtils.serialiseGroup(this,I);var J=WireIt.GroupUtils.getInternalModuleConfig(I,O.center);var P=function(U){return I.indexOf(U)};var L=function(X,V,U){var Y;if(X=="container"){Y=H.containerMap}else{Y=H.groupMap}var W=Y[V].terminals[U];if(G.isObject(W)){return W.externalName}else{var Z=Y[V].fields[U];if(G.isObject(Z)&&Z.fieldConfig.wirable){return Z.externalName}}};var R=WireIt.GroupUtils.getWireConfig(this,P,L);var Q=this.layer.addContainer({xtype:"WireIt.GroupFormContainer",title:"Group",collapsible:false,fields:O.fields,terminals:O.terminals,legend:null,getBaseConfigFunction:this.grouper.baseConfigFunction,groupConfig:{group:S,center:O.center,modules:J,wires:R.internal,map:WireIt.GroupUtils.getExternalToInternalMap(H)},position:O.position});this.addExternalWires(Q,R.external);this.collapsing=true;var M;for(M in this.containers){this.layer.removeContainer(this.containers[M].container)}for(M in this.groups){WireIt.GroupUtils.removeGroupFromLayer(this.groups[M].group,this.layer)}this.collapsing=false;Q.group=this;this.containers=[];this.groups=[];this.groupContainer=Q;this.properties.expanded=G.isValue(N)?N:false;return Q},checkGroupEmpty:function(){if(!G.isValue(this.groupContainer)&&this.containers.length==0&&this.groups.length==0){this.events.groupEmptied.fire(this)}},expand:function(){if(G.isValue(this.groupContainer)){this.groupContainer.expand()}},addContainer:function(H,J){if(!G.isObject(J)){J={fields:{},terminals:{}}}var I={container:H,overrides:J};this.containers.push(I);H.group=this;H.eventAddWire.subscribe(this.stateChangeFunc,this,true);H.eventRemoveWire.subscribe(this.stateChangeFunc,this,true);this.events.containerAdded.fire(I)},addGroup:function(I,J){if(!G.isObject(J)){J={fields:{},terminals:{}}}var H={group:I,overrides:J};this.groups.push(H);I.group=this;I.events.stateChanged.subscribe(this.stateChangeFunc,this,true);I.events.groupEmptied.subscribe(function(){this.removeGroup(I)},this,true);this.events.containerAdded.fire(H)},removeContainer:function(H,I){if(!G.isValue(I)){I=WireIt.GroupUtils.firstTestSucess(this.containers,function(J){return J.container==H})}if(I!=-1){this.containers.splice(I,1);H.group=null;this.events.containerRemoved.fire(H)}},removeGroup:function(I,H){if(!G.isValue(H)){H=WireIt.GroupUtils.firstTestSucess(this.groups,function(J){return J.group==I})}if(H!=-1){I.group=null;this.events.groupRemoved.fire(this.groups.splice(H,1))}},unGroup:function(){if(G.isValue(this.groupContainer)){this.expand()}var I={};I.containers=[];G.augmentObject(I.containers,this.containers);I.groups=[];G.augmentObject(I.groups,this.groups);for(var J in I.containers){var L=I.containers[J];this.removeContainer(L.container);if(G.isValue(this.group)){this.group.addContainer(L.container,L.overrides)}}for(var H in I.groups){var K=I.groups[H];this.removeGroup(K.group);if(G.isValue(this.group)){this.group.addGroup(K.group,K.overrides)}}if(G.isValue(this.group)){this.group.removeGroup(this);this.group=null}else{this.layer.removeGroup(this)}this.events.stateChanged.fire(this)},generateUI:function(I,K){if(!G.isValue(I)){I=WireIt.GroupUtils.getMap(this)}listRows=[];var R={};var N={};var M=this.layer;var S=this;var P=function(m,k,W,l,h,U,Z,b,X){var a=function(n){d=[];for(var f=0;f<4;f++){var o=WireIt.cn("td");d.push(o);n.appendChild(o)}return d};var Y=WireIt.cn("tr");Y.onmouseover=W;Y.onmouseout=l;var c=[];var V=WireIt.cn("input",{type:"checkbox"});V.checked=(typeof h=="undefined")?"":h;V.disabled=Z;c.push(V);var j=WireIt.cn("input",{type:"text"});j.value=(typeof U=="undefined")?"":U;c.push(j);var d=a(Y);d[0].innerHTML=m;d[1].appendChild(V);d[2].appendChild(j);if(b){var T=WireIt.cn("select");T.appendChild(WireIt.cn("option",{value:"top"},{},"Top"));T.appendChild(WireIt.cn("option",{value:"bottom"},{},"Bottom"));T.appendChild(WireIt.cn("option",{value:"left"},{},"Left"));T.appendChild(WireIt.cn("option",{value:"right"},{},"Right"));if(G.isValue(X)){T.value=X}c.push(T);d[3].appendChild(T)}else{d[3].align="center";d[3].innerHTML="---"}listRows.push(Y);for(var e in c){var g=c[e];g.onfocus=W;g.onblur=l;g.onchange=K}return{visible:V,externalName:j,side:T}};var J=function(W,d,U,T,X,e,b){var c=false;var Z=false;var V=false;var a=X[W];if(!G.isValue(a)){var Y=P(W,T,function(){e(T)},function(){b(T)},d.visible||U.visible,G.isValue(U.rename)?U.rename:"",G.isValue(d.forceVisible)?d.forceVisible:false,true,U.side);return Y}};var H=function(V,W,U,T,X,c,a){var b=false;var Z=false;if(W.fieldConfig.wirable){X[V]=true}var Y=P(V,T,function(){c(T)},function(){a(T)},U.visible||W.visible,G.isValue(U.rename)?U.rename:"",G.isValue(W.forceVisible)?W.forceVisible:false);return Y};var O=[];var L=[];var Q=function(X,j,Y,b,g){for(var V in X){var h=X[V];var f={};var e=V;var a={};var k={};for(var d in h.fields){var Z=h.fields[d];var T=j[V].container.getValue();if(T[d]==undefined||(T[d]!=undefined&&T[d]!="[wired]")){a[d]=H(d,Z,WireIt.GroupUtils.valueOr(j[V].overrides.fields[d],{}),V,f,b,g)}}for(var U in h.terminals){var i=h.terminals[U];var W=J(U,i,WireIt.GroupUtils.valueOr(j[V].overrides.terminals[U],{}),V,f,b,g);if(G.isValue(W)){k[U]=W}}Y.push({fields:a,terminals:k})}};Q(I.containerMap,this.containers,O,function(T){S.layer.setSuperHighlighted([S.containers[T].container])},function(T){S.layer.unsetSuperHighlighted()});Q(I.groupMap,this.groups,L,function(T){var U=[];WireIt.GroupUtils.applyToContainers(S.groups[T].group,true,function(V){U.push(V)});S.layer.setSuperHighlighted(U)},function(T){S.layer.unsetSuperHighlighted()});return{listRows:listRows,containerUIMap:O,groupUIMap:L}},getAndCheckOverrides:function(N,J){var I={};G.augmentObject(I,this);I.containers=[];I.groups=[];var P=WireIt.GroupUtils.getOverridesFromUI(N,J);for(var M in this.containers){var O={};O.container=this.containers[M].container;O.overrides=P.containerOverrides[M];I.containers[M]=O}for(var Q in this.groups){var L={};L.group=this.groups[Q].group;L.overrides=P.groupOverrides[Q];I.groups[Q]=L}var H;try{H=WireIt.GroupUtils.getMap(I)}catch(K){if(G.isObject(K)&&G.isValue(K.type)&&K.type=="MappingError"){return{overrides:P,valid:false,error:K}}else{throw K}}return{overrides:P,valid:true}},setGroupOptions:function(K){for(var I in K.containerOverrides){var J=K.containerOverrides[I];this.containers[I].overrides=J}for(var H in K.groupOverrides){var J=K.groupOverrides[I];this.groups[H].overrides=J}},addExternalWires:function(M,I){var L=this.layer;for(var O in I){var H=I[O];var K={};K.moduleId=this.layer.containers.indexOf(M);K.terminal=H.externalName;var N={};N.moduleId=this.layer.containers.indexOf(H.externalTerminal.container);N.terminal=H.externalTerminal.options.name;var J={};if(H.groupIsSource){J.src=K;J.tgt=N}else{J.src=N;J.tgt=K}this.layer.addWire(J)}}}})();(function(){var B=YAHOO.util,D=YAHOO.lang;var A=B.Event,C=B.Dom;WireIt.Grouper=function(F,E){this.layer=F;this.baseConfigFunction=E;this.containers=[];this.groups=[];this.setupWidget(C.get("groupConfig"));F.eventRemoveContainer.subscribe(function(G,H){this.removeContainer(H[0])},this,true);F.eventAddContainer.subscribe(function(H,G){var I=this.display;G[0].eventFocus.subscribe(function(K,L){var J=L[0];if(D.isValue(J.group)){this.showGroup(J.group)}else{this.deselectGroup();this.hideGroupConfigure()}},this,true)},this,true);this.rubberband=new WireIt.RubberBand(this);this.rubberband.style={};this.rubberband.style.position="absolute"};WireIt.Grouper.prototype={setupWidget:function(I){this.display={};this.display.mainDiv=I;this.display.buttonsElement=WireIt.cn("div");I.appendChild(this.display.buttonsElement);var F=WireIt.cn("button",{},{},"Collapse");F.id="groupConfigCollapseButton";this.display.buttonsElement.appendChild(F);A.addListener("groupConfigCollapseButton","click",this.groupCollapse,this,true);var H=WireIt.cn("select");this.display.groupSelect=H;H.id="groupConfigGroupSelect";this.display.buttonsElement.appendChild(H);A.addListener("groupConfigGroupSelect","change",function(){this.selectGroup.call(this,H)},this,true);var G=WireIt.cn("button",{},{},"Ungroup");G.id="groupUngroupButton";this.display.buttonsElement.appendChild(G);A.addListener("groupUngroupButton","click",this.unGroup,this,true);var E=WireIt.cn("div");I.appendChild(E);var J=WireIt.cn("table",{id:"groupPanelBodyList"});this.display.list=J;E.appendChild(J);var K=WireIt.cn("tr");this.display.listHeadRow=K;J.appendChild(K);K.appendChild(WireIt.cn("th",{},{},"Name"));K.appendChild(WireIt.cn("th",{},{},"Visible"));K.appendChild(WireIt.cn("th",{},{},"New name"));K.appendChild(WireIt.cn("th",{},{},"Show"));this.hideGroupConfigure()},setDisplay:function(F){this.display.list.innerHTML="";this.display.list.appendChild(this.display.listHeadRow);for(var E in F){this.display.list.appendChild(F[E])}},groupCollapse:function(){if(D.isValue(this.selectedGroup)){this.selectedGroup.collapse()}},selectGroup:function(E){var F=E.selectedIndex;if(F>=0&&D.isArray(this.selectedGroups)&&F<this.selectedGroups.length){var G=this.selectedGroups[F];this.showGroupConfigure(G)}else{alert("index wrong ("+F+")")}},unGroup:function(){if(D.isValue(this.selectedGroup)){var E=this.selectedGroup;this.deselectGroup();E.unGroup()}},setGroupOptions:function(){var E=this.display.containerUIMap;var F=this.display.groupUIMap;var G=this.selectedGroup;var H=G.getAndCheckOverrides(E,F);if(H.valid){G.setGroupOptions(H.overrides)}else{alert("Validation error, "+H.error.message)}},addContainer:function(E){if(D.isValue(E.group)){var F=WireIt.GroupUtils.getOuterGroup(E.group);this.addGroup(F)}else{if(this.containers.indexOf(E)==-1){this.containers.push(E);E.addedToGroup()}}},removeContainer:function(E,F){if(!D.isValue(F)){F=this.containers.indexOf(E)}if(F!=-1){this.containers.splice(F,1);E.removedFromGroup()}},addGroup:function(F){if(this.groups.indexOf(F)==-1){this.groups.push(F);var E=function(G){WireIt.GroupUtils.applyToContainers(G,true,function(H){H.addedToGroup()})};E(F);F.events.groupEmptied.subscribe(function(){this.removeGroup(F)},this,true);F.events.containerAdded.subscribe(function(G,H){H[0].addedToGroup()},this,true);F.events.groupAdded.subscribe(function(H,G){E(G[0])},this,true);F.events.containerRemoved.subscribe(function(G,H){this.addContainer(H[0])},this,true);F.events.groupRemoved.subscribe(function(H,G){this.addGroup(G[0])},this,true)}},removeGroup:function(H,F){if(!D.isValue(F)){F=this.groups.indexOf(H)}if(F!=-1){this.groups.splice(F,1);var G=[];WireIt.GroupUtils.addAllContainers(H,G);for(var E in G){G[E].removedFromGroup()}}},toggle:function(E){if(D.isValue(E.group)){var H=WireIt.GroupUtils.getOuterGroup(E.group);var G=this.groups.indexOf(H);if(G==-1){this.addGroup(H)}else{this.removeGroup(H,G)}}else{var F=this.containers.indexOf(E);if(F==-1){this.addContainer(E)}else{this.removeContainer(E,F)}}},makeGroup:function(){if(this.containers.length>0||this.groups.length>0){var K=new WireIt.Group(this,this.layer);var L=[];var G=[];for(var F in this.containers){var J=this.containers[F];K.addContainer(J);G.push(J)}for(var M in this.groups){var H=this.groups[M];K.addGroup(H);this.layer.removeGroup(H);L.push(H)}for(var I in G){this.removeContainer(G[I])}for(var E in L){this.removeGroup(L[E])}this.layer.groups.push(K);K.events.groupEmptied.subscribe(function(){this.layer.removeGroup.call(this.layer,K)},this,true);this.showGroup(K,true)}},showGroup:function(F,G){var E;if(G){E=F}else{E=WireIt.GroupUtils.getOuterGroup(F)}this.showGroupConfigure.call(this,E);this.setupSelectedGroups(F)},setupSelectedGroups:function(H){var E=[];this.selectedGroups=E;var G=this.display;G.groupSelect.innerHTML="";var F=this.selectedGroup;WireIt.GroupUtils.getOuterGroup(H,function(J){var I=WireIt.cn("option",{value:"N"+E.length},{},"N"+E.length);E.push(J);G.groupSelect.appendChild(I);if(F==J){I.selected=true}})},showGroupConfigure:function(H,G){if(!D.isValue(H)||D.isValue(H.groupContainer)){hideGroupConfigure()}else{var E=this;var F=H.generateUI(G,function(){E.setGroupOptions.call(E)});this.setDisplay(F.listRows);this.setSelectedGroup(H);this.display.containerUIMap=F.containerUIMap;this.display.groupUIMap=F.groupUIMap;H.events.stateChanged.subscribe(function(){this.deselectGroup();this.hideGroupConfigure()},this,true);this.display.mainDiv.style.display="block"}},hideGroupConfigure:function(){this.display.mainDiv.style.display="none"},setSelectedGroup:function(E){this.deselectGroup();this.selectedGroup=E;WireIt.GroupUtils.applyToContainers(this.selectedGroup,true,function(F){F.highlight()})},deselectGroup:function(){if(D.isValue(this.selectedGroup)){WireIt.GroupUtils.applyToContainers(this.selectedGroup,true,function(E){E.dehighlight()})}this.selectedGroup=null},rubberbandSelect:function(){for(var F in this.layer.containers){var I=this.layer.containers[F];var H=this.getContainerCorners(I);var E=true;for(var G in H){E&=this.rubberband.pointIsInside(H[G].x,H[G].y)}if(E){this.addContainer(I)}}},getContainerCorners:function(E){var I=E.el.offsetTop;var F=I+E.el.offsetHeight;var H=E.el.offsetLeft;var G=H+E.el.offsetWidth;return[{x:H,y:I},{x:H,y:F},{x:G,y:I},{x:G,y:F}]}}})();(function(){var B=YAHOO.util,E=YAHOO.lang;var C=B.Dom,A=B.Event,D="WireIt-";WireIt.GroupFormContainer=function(F,G){WireIt.GroupFormContainer.superclass.constructor.call(this,F,G);this.getBaseConfig=this.options.getBaseConfigFunction;this.positionTerminals()};YAHOO.lang.extend(WireIt.GroupFormContainer,WireIt.FormContainer,{setOptions:function(F){WireIt.GroupFormContainer.superclass.setOptions.call(this,F);this.options.getBaseConfigFunction=F.getBaseConfigFunction;this.options.groupConfig=F.groupConfig},render:function(){WireIt.GroupFormContainer.superclass.render.call(this);this.renderExpand()},positionTerminals:function(){var K={};for(var T in this.options.terminals){var U=this.options.terminals[T];var F=U.side;if(!E.isValue(F)){F="top"}if(!E.isArray(K[F])){K[F]=[]}K[F].push(U)}var R=30;var W=function(X){return R*(X-1)};var G=function(d,b,Y){var X=W(b);var a=X/2;var c=Y/2;c-=a-d*R;var Z=R/2;return c-Z};var P=this.el.offsetHeight;var Q=this.el.offsetWidth;var N=Math.max(WireIt.GroupUtils.valueOr(K.top,[]).length,WireIt.GroupUtils.valueOr(K.bottom,[]).length);var L=Math.max(WireIt.GroupUtils.valueOr(K.left,[]).length,WireIt.GroupUtils.valueOr(K.right,[]).length);if(P<W(L)){this.bodyEl.style.minHeight=new String(W(L))+"px";P=this.el.offsetHeight}if(Q<W(N)){this.bodyEl.style.minWidth=new String(W(N))+"px";Q=this.el.offsetWidth}for(var F in K){var M=K[F];var J=M.length;var S,H,O;if(F=="left"||F=="right"){S="top";O=P}else{S="left";O=Q}H=F;for(var T=0;T<J;T++){var V=this.getTerminal(M[T].name);var I=new Object();I[H]=-15;I[S]=new String(G(T,J,O));V.setPosition(I)}}},renderExpand:function(){this.unGroupButton=WireIt.cn("div",{className:"WireIt-Container-ungroupbutton"});A.addListener(this.unGroupButton,"click",this.expand,this,true);this.ddHandle.appendChild(this.unGroupButton)},expand:function(){var V=function(b,a){return parseInt(b)+parseInt(a)};var I=this.layer.containers.length;var X=this.getConfig();var Z=[X.position[0],X.position[1]];var U=[];for(var P in this.options.groupConfig.modules){var R=this.options.groupConfig.modules[P];var N=this.getBaseConfig(R.name);var F=YAHOO.lang.JSON.parse(YAHOO.lang.JSON.stringify(R.config));YAHOO.lang.augmentObject(F,N);F.title=R.name;var G=this.translatePosition(F.position,Z);F.position=G;var O=this.layer.addContainer(F);O.setValue(R.value);U.push(O)}var L=function(j,a){var i=a;if(!E.isValue(i)){i=new WireIt.Group(this.group.grouper,this.layer)}i.properties=j.properties;if(E.isValue(j.groupContainer)){i.groupContainer=U[j.groupContainer];i.groupContainer.group=i}else{i.containers=[];i.groups=[];for(var d in j.containers){var h=j.containers[d];var f=U[h.container];i.containers.push({container:f,overrides:h.overrides});f.group=this.group}for(var k in j.groups){var b=j.groups[k];var e=L.call(this,b.group);i.groups.push({group:e,overrides:b.overrides});e.group=this.group}}return i};var K=L.call(this,this.options.groupConfig.group,this.group);var J=function(d,a){for(var c in d){var b=d[c];if(b.options.name==a){return b}}};var Q=this;var S=function(c,b,e){for(var g in c.wires){var a=c.wires[g];var f={};var d={moduleId:V(I,b),terminal:e};if(a.terminal1==c){f.src=d;f.tgt={moduleId:Q.layer.containers.indexOf(a.terminal2.container),terminal:a.terminal2.options.name}}else{f.tgt=d;f.src={moduleId:Q.layer.containers.indexOf(a.terminal1.container),terminal:a.terminal1.options.name}}Q.layer.addWire(f)}};var W=function(d,a,c){for(var h in d.fields){var g=d.fields[h];var i=Q.form.inputsNames[h];var e=a(g.containerId,g.name);e.setValue(i.getValue());if(E.isObject(i.terminal)){S(i.terminal,V(c,g.containerId),g.name)}}for(var b in d.terminals){var j=d.terminals[b];var k=J(Q.terminals,b);S(k,V(c,j.containerId),j.name)}};W(this.options.groupConfig.map.containerMap,function(b,a){return K.containers[b].container.form.inputsNames[a]},0);W(this.options.groupConfig.map.groupMap,function(b,a){return K.groups[b].group.groupContainer.form.inputsNames[a]},K.containers.length);for(var Y in this.options.groupConfig.wires){var M=this.options.groupConfig.wires[Y];this.layer.addWire({src:{moduleId:V(I,M.src.moduleId),terminal:M.src.terminal},tgt:{moduleId:V(I,M.tgt.moduleId),terminal:M.tgt.terminal}})}this.layer.removeContainer(this);this.group.groupContainer=null;var H=0;for(H=0;H<K.groups.length;H++){var T=K.groups[H].group;if(T.properties.expanded&&E.isValue(T.groupContainer)){T.groupContainer.expand()}}this.group.grouper.showGroup.call(this.group.grouper,this.group)},translatePosition:function(G,F){return[Math.max(0,G[0]+F[0]),Math.max(0,G[1]+F[1])]},getConfig:function(){var F=WireIt.GroupFormContainer.superclass.getConfig.call(this);E.augmentObject(F,{fields:this.options.fields,terminals:this.options.terminals,groupConfig:this.options.groupConfig});return F}})})();(function(){var C=YAHOO.util,G=YAHOO.lang;var B=C.Event,D=C.Dom,A=C.Connect,F=G.JSON,E=YAHOO.widget;WireIt.GroupUtils={applyToContainers:function(M,I,L,K){if(!G.isValue(K)){K=this}if(G.isValue(M.groupContainer)){L.call(K,M.groupContainer)}else{for(var J in M.containers){L.call(K,M.containers[J].container)}if(I){for(var H in M.groups){WireIt.GroupUtils.applyToContainers(M.groups[H].group,I,L,K)}}}},valueOr:function(H,I){return G.isValue(H)?H:I},removeGroupFromLayer:function(J,I){J.collapsing=true;if(G.isValue(J.groupContainer)){I.removeContainer(J.groupContainer)}else{for(var H in J.containers){I.removeContainer(J.containers[H])}for(var H in J.groups){WireIt.GroupUtils.removeGroupFromLayer(J.groups[H],I)}}J.collapsing=false},getOuterGroup:function(K,H){var I=K;var J=I;do{I=J;J=J.group;if(G.isFunction(H)){H(I)}}while(G.isValue(J));return I},addAllContainers:function(K,J){if(G.isObject(K.groupContainer)){J.push(K.groupContainer)}else{for(var I in K.containers){J.push(K.containers[I].container)}for(var H in K.groups){WireIt.GroupUtils.addAllContainers(K.groups[H].group,J)}}},serialiseGroup:function(M,L){var I={};I.properties={};G.augmentObject(I.properties,M.properties);if(G.isValue(M.groupContainer)){I.groupContainer=L.indexOf(M.groupContainer)}else{I.containers=[];I.groups=[];for(var J in M.containers){I.containers.push({container:L.indexOf(M.containers[J].container),overrides:M.containers[J].overrides})}for(var H in M.groups){var K=M.groups[H];I.groups.push({group:WireIt.GroupUtils.serialiseGroup(K.group,L),overrides:K.overrides})}}return I},getCollapsedConfig:function(K,J){if(!G.isObject(J)){J=WireIt.GroupUtils.getMap(K)}var L=[];var M=[];var I=function(V){for(var Q in V){var T=V[Q];for(var S in T.fields){var R=T.fields[S];if(R.visible){var N={};G.augmentObject(N,R.fieldConfig);N.name=R.externalName;N.label=R.externalName;G.augmentObject(N,R.fieldConfig);L.push(N)}}for(var P in T.terminals){var U=T.terminals[P];if(U.visible){var O={};O.name=U.externalName;O.side=U.side;G.augmentObject(O,U.terminalConfig);M.push(O)}}}};if(G.isValue(J.groupContainerMap)){I([J.groupContainerMap])}else{I(J.containerMap);I(J.groupMap)}var H=this.workOutCenter(K);return{fields:L,terminals:M,position:H,center:H}},workOutCenter:function(N){var L={};var M=function(P){var R,Q;R=P[0];Q=P[1];if((typeof L.left=="undefined")||L.left>R){L.left=R}if((typeof L.right=="undefined")||L.right<R){L.right=R}if((typeof L.top=="undefined")||L.top>Q){L.top=Q}if((typeof L.bottom=="undefined")||L.bottom<Q){L.bottom=Q}};if(G.isObject(N.groupContainer)){M(N.groupContainer.getConfig().position)}else{for(var J in N.containers){var O=N.containers[J].container;var I=O.getConfig();M(I.position)}for(var H in N.groups){var K=N.groups[H].group;M(WireIt.GroupUtils.workOutCenter(K))}}return[((L.right+L.left)/2),((L.top+L.bottom)/2)]},getExternalToInternalMap:function(H){var O={fields:{},terminals:{}};var I={fields:{},terminals:{}};for(var K in H.containerMap){var N=H.containerMap[K];for(var L in N.fields){var M=N.fields[L];if(M.visible){O.fields[M.externalName]={containerId:K,name:L}}}for(var J in N.terminals){var P=N.terminals[J];if(P.visible){O.terminals[P.externalName]={containerId:K,name:J}}}}for(var K in H.groupMap){var N=H.groupMap[K];for(var L in N.fields){var M=N.fields[L];if(M.visible){I.fields[M.externalName]={containerId:K,name:L}}}for(var J in N.terminals){var P=N.terminals[J];if(P.visible){I.terminals[P.externalName]={containerId:K,name:J}}}}return{containerMap:O,groupMap:I}},getOverridesFromUI:function(P,I){containerOverrides=[];groupOverrides=[];for(var L in P){var Q=P[L];var R={fields:{},terminals:{}};for(var N in Q.fields){var O=Q.fields[N];var H={};H.visible=O.visible.checked;var J=O.externalName.value;if(J.length>0){H.rename=J}R.fields[N]=H}for(var K in Q.terminals){var S=Q.terminals[K];var H={};H.visible=S.visible.checked;var J=S.externalName.value;if(J.length>0){H.rename=J}H.side=S.side.value;R.terminals[K]=H}containerOverrides.push(R)}for(var T in I){var M=I[L];var R={fields:{},terminals:{}};for(var N in M.fields){var O=M.fields[N];var H={};H.visible=O.visible.checked;var J=O.externalName.value;if(J.length>0){H.rename=J}R.fields[N]=H}for(var K in M.terminals){var S=M.terminals[K];var H={};H.visible=S.visible.checked;var J=S.externalName.value;if(J.length>0){H.rename=J}H.side=S.side.value;R.terminals[K]=H}}return{containerOverrides:containerOverrides,groupOverrides:groupOverrides}},getMap:function(T){if(G.isValue(T.groupContainer)){var H={fields:[],terminals:[]};var K=function(U){return U==T.groupContainer};for(var L in T.groupContainer.form.inputConfigs){var R=T.groupContainer.form.inputConfigs[L];var O={};G.augmentObject(O,R);var N={fieldConfig:O};if(this.isFieldExternal(T.groupContainer.form.inputs[L],K)){N.externalName=R.name;N.visible=true}H.fields.push(N)}for(var M in T.groupContainer.options.terminals){var I=T.groupContainer.options.terminals[M];var S={terminalConfig:I};if(this.isTerminalExternal(T.groupContainer.terminals[M],K)){S.visible=true;S.externalName=I.name}H.terminals.push(S)}return{groupContainerMap:H}}var Q={terminals:{},fields:{}};var P={};var J={};this.generateFieldMap(T,Q,P,J);this.generateTerminalMap(T,Q,P,J);this.generateDefaultFieldNames(P,Q);this.generateDefaultFieldNames(J,Q);this.generateDefaultTerminalNames(P,Q);this.generateDefaultTerminalNames(J,Q);return{containerMap:P,groupMap:J}},generateDefaultTerminalNames:function(L,H){for(var J in L){var M=L[J];for(var I in M.terminals){var K=M.terminals[I];if(K.visible&&!G.isValue(K.externalName)){K.externalName=this.generateFreshName(I,H.terminals);H.terminals[K.externalName]=true}}}},generateDefaultFieldNames:function(M,H){for(var I in M){var N=M[I];for(var L in N.fields){var K=N.fields[L];if(K.visible&&!G.isValue(K.externalName)){if(K.fieldConfig.wirable){var J={};G.augmentObject(J,H.fields);G.augmentObject(J,H.terminals);K.externalName=WireIt.GroupUtils.generateFreshName(L,J);H.fields[K.externalName]=true;H.terminals[K.externalName]=true}else{K.externalName=WireIt.GroupUtils.generateFreshName(L,H.fields);H.fields[K.externalName]=true}}}}},generateTerminalMap:function(L,I,X,V){var P=this;var Q=function(h,k,j,i,f){for(var g in h){var l=h[g];var d=l.name;var e=k[d];var c={terminalConfig:l};if(G.isObject(e)&&e.visible){c.visible=true;if(G.isValue(e.rename)){if(G.isValue(j.terminals[e.rename])){throw {type:"MappingError",message:"Two identical terminal names specified ("+e.rename+")"}}j.terminals[e.rename]=true;c.externalName=e.rename}c.side=e.side}if(i(d)){c.visible=true;c.forceVisible=true}f[d]=c}};var b=[];WireIt.GroupUtils.addAllContainers(L,b);var Y=function(c){for(var d in b){if(c==b[d]){return true}}return false};for(var H in L.containers){var J=L.containers[H];var Z=J.container;var K=J.overrides;var M={};var U=G.isArray(Z.options.terminals)?Z.options.terminals:[];var T=function(c){var f;for(var e in Z.terminals){var d=Z.terminals[e];if(d.options.name==c){f=d;break}}return P.isTerminalExternal(f,Y)};Q(U,K.terminals,I,T,M,Z.options.title);X[H].terminals=M}for(var O in L.groups){var R=L.groups[O];var W=R.group;var K=R.overrides;var S={};var a=WireIt.GroupUtils.getMap(W);var U=WireIt.GroupUtils.getCollapsedConfig(W,a).terminals;var T;if(G.isValue(W.groupContainer)){T=function(c){var f;for(var e in W.groupContainer.terminals){var d=W.groupContainer.terminals[e];if(d.options.name==c){f=d;break}}return P.isTerminalExternal(f,Y)}}else{var N=WireIt.GroupUtils.getExternalToInternalMap(a);T=function(d){for(var c in N.containerMap.terminals){var h=N.containerMap.terminals[c];var g;for(var f in W.containers[h.containerId].terminals){var e=W.containers[h.containerId].terminals[f];if(e.options.name==d){g=e;break}}if(P.isTerminalExternal(g,Y)){return true}}return false}}Q(U,K.terminals,I,T,S);V[O].terminals=S}},isFieldExternal:function(I,H){if(G.isValue(I)){return this.isTerminalExternal(I.terminal,H)}},isTerminalExternal:function(J,I){if(G.isValue(J)){for(var K in J.wires){var H=J.wires[K];if((H.terminal1!=J&&!I(H.terminal1.container))||(H.terminal2!=J&&!I(H.terminal2.container))){return true}}}return false},generateFieldMap:function(M,I,W,U){var Q=this;var a=[];WireIt.GroupUtils.addAllContainers(M,a);var X=function(b){for(var c in a){if(b==a[c]){return true}}return false};for(var H in M.containers){var K=M.containers[H];var Y=K.container;var L=K.overrides;var N={};if(G.isObject(Y.form)){var O=Y.form.inputConfigs;var T=function(b){return Q.isFieldExternal.call(Q,Y.form.inputsNames[b],X)};this.mergeFieldOverrides(O,L.fields,I,T,N)}W[H]={};W[H].fields=N}for(var P in M.groups){var R=M.groups[P];var V=R.group;var L=R.overrides;var S={};var Z=WireIt.GroupUtils.getMap(V);var O=WireIt.GroupUtils.getCollapsedConfig(V,Z).fields;var T;if(G.isValue(V.groupContainer)){T=function(b){return Q.isFieldExternal.call(Q,V.groupContainer.form.inputsNames[b],X)}}else{var J;J=function(c,h,g){if(!G.isValue(g)){g=WireIt.GroupUtils.getMap(h)}var b=WireIt.GroupUtils.getExternalToInternalMap(g);var d=b.containerMap.fields[c];if(G.isValue(d)){var e=h.containers[d.containerId].container.form.inputsNames[d.name];if(Q.isFieldExternal.call(Q,e,X)){return true}}else{var d=b.groupMap.fields[c];if(G.isValue(d)){return J(c,h.groups[d.containerId].group)}}return false};T=function(b){return J(b,V,Z)}}this.mergeFieldOverrides(O,L.fields,I,T,S);U[P]={};U[P].fields=S}},generateFreshName:function(J,H){var L=function(N){return G.isValue(H[N])};var I=J;if(L(I)){var K=1;var M=I;do{I=M+K;K++}while(L(I))}H[I]=true;return I},mergeFieldOverrides:function(L,Q,P,O,K){for(var M in L){var N=L[M];var I=N.name;var J=Q[I];var H={fieldConfig:N};if(G.isObject(J)&&J.visible){H.visible=true;if(G.isValue(J.rename)){if(G.isValue(P.fields[J.rename])){throw {type:"MappingError",message:"Two identical field names specified ("+J.rename+")"}}P.fields[J.rename]=true;if(N.wirable){P.terminals[I]=true}H.externalName=J.rename}}if(O(I)){H.visible=true;H.forceVisible=true}K[I]=H}},generateFields:function(Q,S,O){var U=[];var P=[];var R=[];var N={};var L=function(b,c){N[b]=true;if(c.wirable){R[b]=true}};for(var T in Q){var X=Q[T];for(var M in X){var Y=X[M];var W=new String(T);var J=new String(Y.name);var I=W+J+"";var V=S.fields[I];var a=O.fields[I];var Z={};if(G.isObject(V)&&V.visible){if(G.isValue(V.rename)){var K={};G.augmentObject(K,Y,{label:V.rename,name:V.rename});U.push(K);L(V.rename,Y)}else{P.push(Y)}}else{if(a){P.push(Y)}}}}for(var M in P){var Y=P[M];var H=this.generateNextName(Y.name,N);L(H,Y);var K={};G.augmentObject(K,Y);K.name=H;U.push(K)}return{fields:U,usedTerminalNames:R}},generateTerminals:function(N,Q,O,P){var R=[];var I=[];for(var S in N){var J=N[S];for(var K in J){var T=J[K];var H=Q.terminals[S+T.name];var M=O.terminals[S+T.name];if(G.isObject(H)&&H.visible){if(G.isValue(H.rename)){var L={};G.augmentObject(L,T);L.name=H.rename;P[H.rename]=true;R.push(L)}else{I.push(T)}}else{if(M){I.push(T)}}}}for(var K in I){var T=I[K];var U=this.generateNextName(T.name,P);P[U]=true;var L={};G.augmentObject(L,T);L.name=U;R.push(L)}return R},generateNextName:function(J,H){var L=function(N){return G.isValue(H[N])};var I=J;if(L(I)){var K=1;var M=I;do{I=M+K;K++}while(L(I))}H[I]=true;return I},getExternalTerminalName:function(J,K,L,M){for(var I in terminalMap){var H=terminalMap[I];if(H.name==internalTerminal.options.name&&H.moduleId==internalModuleId){return I}}throw {type:"MappingError",message:"Couldn't find internal terminal's external name"}},fieldConfigsFromModules:function(L,J){var I={};for(var P in L){var K=L[P];var H={};G.augmentObject(H,K.config);G.augmentObject(H,J(K.name));if(G.isArray(H.fields)){var N=[];for(var M in H.fields){var O=H.fields[M];N.push(O)}I[P]=N}}return I},fieldConfigsFromContainers:function(L){var J={};for(var I in L){var N=L[I];if(G.isObject(N.form)){var H=[];for(var M in N.form.inputConfigs){var K=N.form.inputConfigs[M];H.push(K)}J[I]=H}}return J},terminalConfigsFromModules:function(L,J){var I={};for(var O in L){var K=L[O];var H={};G.augmentObject(H,K.config);G.augmentObject(H,J(K.name));if(G.isArray(H.terminals)){var N=[];for(var M in H.terminals){var P=H.terminals[M];N.push(P)}I[O]=N}}return I},getInternalModuleConfig:function(L,I){var K=[];for(var J in L){var M=L[J];var H=M.getConfig();H.position[0]=H.position[0]-I[0];H.position[1]=H.position[1]-I[1];K.push({name:M.options.title,value:M.getValue(),config:H})}return K},getWireConfig:function(K,I,H){var L=[];var J=[];this.addWireConfig(K,I,H,L,J);return{external:L,internal:J}},addWireConfig:function(N,M,I,R,Q,O){var L=function(W,V){var U=false;var X;for(var T in W){X=W[T];if(X.src.moduleId==V.src.moduleId&&X.tgt.moduleId==V.tgt.moduleId&&X.src.terminal==V.src.terminal&&X.tgt.terminal==V.tgt.terminal){U=true;break}}if(!U){W.push(V)}};var P=function(Y,U){for(var W in Y.wires){var b=Y.wires[W];var a=M(b.terminal1.container);var T=M(b.terminal2.container);if(a!=-1&&T!=-1){L(Q,{src:{moduleId:a,terminal:b.terminal1.options.name},tgt:{moduleId:T,terminal:b.terminal2.options.name}})}else{var X={};var Z,V;if(a==-1){X.groupIsSource=false;Z=b.terminal1;V=b.terminal2}else{X.groupIsSource=true;Z=b.terminal2;V=b.terminal1}X.externalName=U(V.options.name);X.groupTerminal=V;X.externalTerminal=Z;R.push(X)}}};if(!G.isValue(O)){O=0}if(G.isValue(N.groupContainer)){P(N.groupContainer,function(T){return I("group",O,T)})}else{for(var H in N.containers){var K=N.containers[H].container;P(K,function(T){return I("container",H,T)})}for(var S in N.groups){var J=N.groups[S].group;this.addWireConfig(J,M,I,R,Q,parseInt(S)+O)}}},firstTestSucess:function(H,J){var I;for(I=0;I<H.length;I++){if(J(H[I])){return I}}return -1}}})();(function(){var C=YAHOO.util,G=YAHOO.lang;var B=C.Event,D=C.Dom,A=C.Connect,F=G.JSON,E=YAHOO.widget;WireIt.RubberBand=function(I){WireIt.RubberBand.superclass.constructor.call(this,I.layer.el);this.grouper=I;var H=this;this.scrollThreshold=150;this.scrollAmount=20;this.directions={};I.layer.el.addEventListener("mousemove",function(N){var M=H.grouper.layer.el;var L=M.getBoundingClientRect();var K=N.clientX-L.left;var J=N.clientY-L.top;H.lastX=K+M.scrollLeft;H.lastY=J+M.scrollTop;H.directions={};if(K<H.scrollThreshold){H.directions.left=true}else{if((L.right-N.clientX)<H.scrollThreshold){H.directions.right=true}}if(J<H.scrollThreshold){H.directions.up=true}else{if((L.bottom-N.clientY)<H.scrollThreshold){H.directions.down=true}}},false)};WireIt.RubberBand.defaultDelay=50;YAHOO.lang.extend(WireIt.RubberBand,WireIt.CanvasElement,{layerMouseDown:function(L){var K=this.grouper.layer.el;var J=K.getBoundingClientRect();var I=L.clientX-J.left;var H=L.clientY-J.top;if(I<K.clientWidth&&H<K.clientHeight){this.start()}},start:function(){this.show();this.SetCanvasRegion(0,0,this.grouper.layer.el.scrollWidth,this.grouper.layer.el.scrollHeight);var H=this.getContext();H.beginPath();H.moveTo(this.lastX,this.lastY);this.startX=this.lastX;this.startY=this.lastY;this.timer=YAHOO.lang.later(WireIt.RubberBand.defaultDelay,this,function(){this.nextPoint(this.lastX,this.lastY);this.scroll(this.directions)},0,true)},scroll:function(I){var H=this.grouper.layer.el;if(I.left){H.scrollLeft=Math.max(0,H.scrollLeft-this.scrollAmount)}else{if(I.right){H.scrollLeft=Math.min(H.scrollWidth,H.scrollLeft+this.scrollAmount)}}if(I.up){H.scrollTop=Math.max(0,H.scrollTop-this.scrollAmount)}else{if(I.down){H.scrollTop=Math.min(H.scrollHeight,H.scrollTop+this.scrollAmount)}}},finish:function(){if(G.isObject(this.timer)){this.timer.cancel();this.timer=null;var H=this.getContext();this.nextPoint(this.startX,this.startY);YAHOO.lang.later(1000,this,this.hide,0,false)}},hide:function(){if(!G.isValue(this.element.style)){this.element.style={}}this.element.style.display="none"},show:function(){if(!G.isValue(this.element.style)){this.element.style={}}this.element.style.display=""},nextPoint:function(I,J){if(G.isValue(I)&&G.isValue(J)){var H=this.getContext();H.lineCap="round";H.strokeStyle="green";H.lineWidth="3";H.lineTo(I,J);H.stroke()}},pointIsInside:function(H,I){return(this.getContext().isPointInPath(H,I))}})})();