text: 'use strict';var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"])_i["return"]();}finally{if(_d)throw _e;}}return _arr;}return function(arr,i){if(Array.isArray(arr)){return arr;}else if(Symbol.iterator in Object(arr)){return sliceIterator(arr,i);}else{throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var CSS=function(){function CSS(name,item){_classCallCheck(this,CSS);this.getSVGString=function(board){var str,pos,style,defs,value,filter,z;str="{";for(style in this.css){if(!this.css.hasOwnProperty(style)){continue;}if(style==="border"){pos=this.css[style].indexOf(" ");str=str+"stroke-width: "+this.css[style].substring(0,pos)+";";pos=this.css[style].indexOf(" ",pos+1);str=str+"stroke:"+this.css[style].substring(pos)+";";}else if(style==="background-color"){str=str+"fill: "+this.css[style]+";";}else if(style==="background"){value=CSS.getSubstring(this.css[style],"linear-gradient","(",")",",");if(value.length>0){defs=CSS.getDefs(board);if(value[0]==="45deg"){pos=1;filter=util.create({tag:"linearGradient","id":this.name,x1:"0%",x2:"100%",y1:"100%",y2:"0%"});}else{filter=util.create({tag:"linearGradient","id":this.name,x1:"0%",x2:"0%",y1:"100%",y2:"0%"});pos=0;}defs.appendChild(filter);while(pos<value.length){value[pos]=value[pos].trim();z=value[pos].lastIndexOf(" ");filter.appendChild(util.create({tag:"stop","offset":value[pos].substring(z+1),style:{"stop-color":value[pos].substring(0,z)}}));pos+=1;}str=str+"fill: url(#"+this.name+");";continue;}str=str+style+": "+this.css[style]+";";}else{str=str+style+": "+this.css[style]+";";}}str=str+"}";return str;};var i,value,border,prop,el;this.name=name;this.css={};if(!item){return;}el=window.getComputedStyle(item,null);border=el.getPropertyValue("border");for(i in el){prop=i;value=el.getPropertyValue(prop);if(value&&value!==""){if(border){if(prop==="border-bottom"||prop==="border-right"||prop==="border-top"||prop==="border-left"){if(value!==border){this.css[prop]=value;}}else if(prop==="border-color"||prop==="border-bottom-color"||prop==="border-right-color"||prop==="border-top-color"||prop==="border-left-color"){if(border.substring(border.length-value.length)!==value){this.css[prop]=value;}}else if(prop==="border-width"){if(border.substring(0,value.length)!==value){this.css[prop]=value;}}else{this.css[prop]=value;}}else{this.css[prop]=value;}}}}_createClass(CSS,[{key:"add",value:function add(key,value){this.css[key]=value;}},{key:"get",value:function get(key){var i;for(i in this.css){if(i===key){return this.css[key];}}return null;}},{key:"getNumber",value:function getNumber(key){return parseInt((this.get(key)||"0").replace("px",""),10);}}],[{key:"getDefs",value:function getDefs(board){var defs;if(board.getElementsByTagName("defs").length<1){defs=util.create({tag:"defs"});board.insertBefore(defs,board.childNodes[0]);}else{defs=board.getElementsByTagName("defs")[0];}return defs;}},{key:"getSubstring",value:function getSubstring(str,search,startChar,endChar,splitter){var pos,end,count=0,array=[];pos=str.indexOf(search);if(pos>0){end=str.indexOf(startChar,pos);pos=end+1;if(end>0){while(end<str.length){if(str.charAt(end)===startChar){count+=1;}if(str.charAt(end)===endChar){count-=1;if(count===0){if(splitter&&pos!==end){array.push(str.substring(pos,end).trim());}break;}}if(str.charAt(end)===splitter&&count===1){array.push(str.substring(pos,end).trim());pos=end+1;}end+=1;}if(splitter){return array;}return str.substring(pos,end);}return str.substring(pos);}return"";}},{key:"addStyle",value:function addStyle(board,styleName){var defs,style,css;if(styleName.baseVal||styleName.baseVal===""){styleName=styleName.baseVal;}if(!styleName){return;}defs=CSS.getDefs(board);if(defs.getElementsByTagName("style").length>0){style=defs.getElementsByTagName("style")[0];}else{style=util.create({tag:"style"});style.item={};defs.appendChild(style);}if(!style.item[styleName]){css=util.getStyle(styleName);style.item[styleName]=css;style.innerHTML=style.innerHTML+"\n."+styleName+css.getSVGString(board);}}},{key:"addStyles",value:function addStyles(board,item){if(!item){return;}var items,i,className=item.className;if(className){if(className.baseVal||className.baseVal===""){className=className.baseVal;}}if(className){items=className.split(" ");for(i=0;i<items.length;i+=1){CSS.addStyle(board,items[i].trim());}}for(i=0;i<item.childNodes.length;i+=1){this.addStyles(board,item.childNodes[i]);}}}]);return CSS;}();var util=function(){function util(){_classCallCheck(this,util);}_createClass(util,null,[{key:"getRandomInt",value:function getRandomInt(min,max){return Math.floor(Math.random()*(max-min+1))+min;}},{key:"createShape",value:function createShape(attrs){var xmlns=attrs.xmlns||'http://www.w3.org/2000/svg';var shape=document.createElementNS(xmlns,attrs.tag);for(var attr in attrs){if(attr!=='tag'){shape.setAttribute(attr,attrs[attr]);}}return shape;}},{key:"toPascalCase",value:function toPascalCase(value){value=value.charAt(0).toUpperCase()+value.substring(1).toLowerCase();return value;}},{key:"isSVG",value:function isSVG(tag){var i=void 0,list=['svg','path','polygon','polyline','line','rect','filter','feGaussianBlur','feOffset','feBlend','linearGradient','stop','text','symbol','textPath','defs','fegaussianblur','feoffset','feblend','circle','ellipse','g'];for(i=0;i<list.length;i+=1){if(list[i]===tag){return true;}}return false;}},{key:"create",value:function create(node){var style=void 0,item=void 0,xmlns=void 0,key=void 0,tag=void 0,k=void 0;if(document.createElementNS&&(this.isSVG(node.tag)||node.xmlns)){if(node.xmlns){xmlns=node.xmlns;}else{xmlns='http://www.w3.org/2000/svg';}if(node.tag==='img'&&xmlns){item=document.createElementNS(xmlns,'image');item.setAttribute('xmlns:xlink','http://www.w3.org/1999/xlink');item.setAttributeNS('http://www.w3.org/1999/xlink','href',node.src);}else{item=document.createElementNS(xmlns,node.tag);}}else{item=document.createElement(node.tag);}tag=node.tag.toLowerCase();for(key in node){if(!node.hasOwnProperty(key)){continue;}k=key.toLowerCase();if(node[key]===null){continue;}if(k==='tag'||k.charAt(0)==='$'||k==='model'){continue;}if(k.charAt(0)==='#'){item[k.substring(1)]=node[key];continue;}if(k==='rotate'){item.setAttribute('transform','rotate('+node[key]+','+node.model.x+','+node.model.y+')');continue;}if(k==='value'){if(!node[key]){continue;}if(tag!=='input'){if(tag==='text'){item.appendChild(document.createTextNode(node[key]));}else{item.innerHTML=node[key];}}else{item[key]=node[key];}continue;}if(k.indexOf('on')===0){this.bind(item,k.substring(2),node[key]);continue;}if(k.indexOf('-')>=0){item.style[key]=node[key];}else{if(k==='style'&&_typeof(node[key])==='object'){for(style in node[key]){if(!node[key].hasOwnProperty(style)){continue;}if(node[key][style]){if('transform'===style){item.style.transform=node[key][style];item.style.msTransform=item.style.MozTransform=item.style.WebkitTransform=item.style.OTransform=node[key][style];}else{item.style[style]=node[key][style];}}}}else{item.setAttribute(key,node[key]);}}}if(node.$parent){node.$parent.appendChild(item);}if(node.model){item.model=node.model;}return item;}},{key:"setSize",value:function setSize(item,width,height){var value=void 0;value=util.getValue(width);item.setAttribute("width",value);item.style.width=Math.ceil(value);value=util.getValue(height);item.setAttribute("height",value);item.style.height=Math.ceil(value);}},{key:"setPos",value:function setPos(item,x,y){if(item.x&&item.x.baseVal){item.style.left=x+"px";item.style.top=y+"px";}else{item.x=x;item.y=y;}}},{key:"getValue",value:function getValue(value){return parseInt(("0"+value).replace("px",""),10);}},{key:"isIE",value:function isIE(){return document.all&&!window["opera"];}},{key:"isFireFox",value:function isFireFox(){return navigator.userAgent.toLowerCase().indexOf('firefox')>-1;}},{key:"isOpera",value:function isOpera(){return navigator.userAgent.indexOf("Opera")>-1;}},{key:"getEventX",value:function getEventX(event){return this.isIE?window.event["clientX"]:event.pageX;}},{key:"getEventY",value:function getEventY(event){return this.isIE?window.event["clientY"]:event.pageY;}},{key:"getNumber",value:function getNumber(str){return parseInt((str||"0").replace("px",""),10);}},{key:"getStyle",value:function getStyle(styleProp){var i,style,diff,current,ref,el=document.createElement("div"),css;document.body.appendChild(el);css=new CSS(styleProp);ref=new CSS(styleProp,el).css;style=window.getComputedStyle(el,null);el.className=styleProp;current=new CSS(styleProp,el).css;diff=util.getNumber(style.getPropertyValue("border-width"));for(i in current){if(!current.hasOwnProperty(i)){continue;}if(i==="width"||i==="height"){if(util.getNumber(current[i])!==0&&util.getNumber(current[i])+diff*2!==util.getNumber(ref[i])){css.add(i,current[i]);}}else if(current[i]!==ref[i]){css.add(i,current[i]);}}document.body.removeChild(el);return css;}},{key:"sizeOf",value:function sizeOf(item,model,node){var board,rect,root;if(!item){return;}root=model.getRoot();board=root.$gui;if(board.tagName==="svg"){if(typeof item==='string'){item=util.create({tag:"text",$font:true,value:item});item.setAttribute("width","5px");}}else if(typeof item==='string'){item=document.createTextNode(item);}board.appendChild(item);rect=item.getBoundingClientRect();board.removeChild(item);if(node){if(node.getSize().isEmpty()){node.withSize(Math.ceil(rect.width),Math.ceil(rect.height));}}return rect;}},{key:"getColor",value:function getColor(style,defaultColor){if(style){if(style.toLowerCase()==="create"){return"#008000";}if(style.toLowerCase()==="nac"){return"#FE3E3E";}if(style.indexOf("#")===0){return style;}}if(defaultColor){return defaultColor;}return"#000";}},{key:"toJson",value:function toJson(ref){var result={};return util.copy(result,ref,false,false);}},{key:"copy",value:function copy(ref,src,full,replace){if(src){var _i=void 0;for(_i in src){if(!src.hasOwnProperty(_i)||typeof src[_i]==="function"){continue;}if(_i.charAt(0)==="$"){if(full){ref[_i]=src[_i];}continue;}if(_typeof(src[_i])==="object"){if(replace){ref[_i]=src[_i];continue;}if(!ref[_i]){if(src[_i]instanceof Array){ref[_i]=[];}else{ref[_i]={};}}util.copy(ref[_i],src[_i],full,false);}else{if(src[_i]===""){continue;}ref[_i]=src[_i];}}if(src.width){ref.$startWidth=src.width;}if(src.height){ref.$startHeight=src.height;}}return ref;}},{key:"Range",value:function Range(min,max,x,y){max.x=Math.max(max.x,x);max.y=Math.max(max.y,y);min.x=Math.min(min.x,x);min.y=Math.min(min.y,y);}},{key:"getPosition",value:function getPosition(m,n,entity,refCenter){var t=void 0,p=[],list=void 0,distance=[],min=999999999,position=void 0,i=void 0,step=15;var pos=entity.getPos();var size=entity.getSize();list=[Point.LEFT,Point.RIGHT];for(i=0;i<2;i+=1){t=this.getLRPosition(m,n,entity,list[i]);if(t.y>=pos.y&&t.y<=pos.y+size.y+1){t.y+=entity["$"+list[i]]*step;if(t.y>pos.y+size.y){t=util.getUDPosition(m,n,entity,Point.DOWN,step);}p.push(t);distance.push(Math.sqrt((refCenter.x-t.x)*(refCenter.x-t.x)+(refCenter.y-t.y)*(refCenter.y-t.y)));}}list=[Point.UP,Point.DOWN];for(i=0;i<2;i+=1){t=util.getUDPosition(m,n,entity,list[i]);if(t.x>=pos.x&&t.x<=pos.x+size.x+1){t.x+=entity["$"+list[i]]*step;if(t.x>pos.x+size.x){t=this.getLRPosition(m,n,entity,Point.RIGHT,step);}p.push(t);distance.push(Math.sqrt((refCenter.x-t.x)*(refCenter.x-t.x)+(refCenter.y-t.y)*(refCenter.y-t.y)));}}for(i=0;i<p.length;i+=1){if(distance[i]<min){min=distance[i];position=p[i];}}return position;}},{key:"getUDPosition",value:function getUDPosition(m,n,e,p,step){var pos=e.getPos();var size=e.getSize();var x=void 0,y=pos.y;if(p===Point.DOWN){y+=size.y;}x=(y-n)/m;if(step){x+=e["$"+p]*step;if(x<pos.x){x=pos.x;}else if(x>pos.x+size.x){x=pos.x+size.x;}}return new Point(x,y,p);}},{key:"getLRPosition",value:function getLRPosition(m,n,e,p,step){var pos=e.getPos();var size=e.getSize();var y=void 0,x=pos.x;if(p===Point.RIGHT){x+=size.x;}y=m*x+n;if(step){y+=e["$"+p]*step;if(y<pos.y){y=pos.y;}else if(y>pos.y+size.y){y=pos.y+size.y;}}return new Point(x,y,p);}}]);return util;}();var EventListener=function(){function EventListener(){_classCallCheck(this,EventListener);}_createClass(EventListener,[{key:"update",value:function update(event){this.onUpdate(event);}},{key:"onUpdate",get:function get(){return this._onUpdate;},set:function set(value){this._onUpdate=value;}}]);return EventListener;}();var Control=function(){function Control(owner){_classCallCheck(this,Control);this.closed=false;this.$owner=owner;}_createClass(Control,[{key:"createEventListener",value:function createEventListener(){return new EventListener();}},{key:"getRoot",value:function getRoot(){if(this.$owner){return this.$owner.getRoot();}return this;}},{key:"initControl",value:function initControl(data){}},{key:"getItem",value:function getItem(id){return null;}},{key:"hasItem",value:function hasItem(id){return false;}},{key:"setValue",value:function setValue(object,attribute,value){return false;}},{key:"propertyChange",value:function propertyChange(entity,property,oldValue,newValue){}},{key:"getId",value:function getId(){return this.id;}},{key:"load",value:function load(json){}},{key:"addItem",value:function addItem(source,entity){if(entity){if(!this.property||this.property===entity.property){entity.addListener(this);this.entity=entity;}}}},{key:"setProperty",value:function setProperty(property){if(!this.property){return;}var objId=property.split(".")[0];var object=this.$owner.getItem(objId);this.property=property;this.$lastProperty=null;if(this.entity){this.entity.removeListener(this);}if(object){object.addListener(this);this.entity=object;this.updateElement(object.values[this.lastProperty]);}}},{key:"updateElement",value:function updateElement(value){}},{key:"addListener",value:function addListener(eventListener){if(!this.eventListener){this.eventListener=new Set();}this.eventListener.add(eventListener);}},{key:"registerEvent",value:function registerEvent(eventType){if(!this.eventsToListen){this.eventsToListen=new Set();}if(this.eventsToListen.has(eventType)){return true;}else{this.eventsToListen.add(eventType);this.registerListenerOnHTMLObject(eventType);return true;}}},{key:"registerListenerOnHTMLObject",value:function registerListenerOnHTMLObject(eventType){return false;}},{key:"registerEventListener",value:function registerListener(eventType, htmlElement){var control=this;var listener=function listener(t){t.eventType=eventType;t.id=control.id;control.$owner.fireEvent(t);};htmlElement.addEventListener(eventType,listener);}},{key:"fireEvent",value:function fireEvent(evt){}},{key:"isClosed",value:function isClosed(){return this.closed;}},{key:"getShowed",value:function getShowed(){if(this.isClosed()){return this.$owner.getShowed();}return this;}},{key:"lastProperty",get:function get(){if(!this.property){return"";}if(!this.$lastProperty){var arr=this.property.split(".");this.$lastProperty=arr[arr.length-1];}return this.$lastProperty;}}]);return Control;}();Control.EVENT_CREATED="CREATED";var DiagramElement=function(_Control){_inherits(DiagramElement,_Control);function DiagramElement(owner,type,id){_classCallCheck(this,DiagramElement);var _this=_possibleConstructorReturn(this,(DiagramElement.__proto__||Object.getPrototypeOf(DiagramElement)).call(this,owner));_this.labelHeight=25;_this.labelFontSize=14;_this.attrHeight=20;_this.attrFontSize=12;_this.pos=new Point();_this.size=new Point();_this.isDraggable=true;_this.property=type;_this.id=id;return _this;}_createClass(DiagramElement,[{key:"getPos",value:function getPos(){return this.pos;}},{key:"getSize",value:function getSize(){return this.size;}},{key:"getCenter",value:function getCenter(){var pos=this.getPos();var size=this.getSize();return new Point(pos.x+size.x/2,pos.y+size.y/2);}},{key:"getCenterPosition",value:function getCenterPosition(p){var pos=this.getPos();var size=this.getSize();var offset=this["$"+p];var center=this.getCenter();if(p===Point.DOWN){return new Point(Math.min(center.x+offset,center.x),pos.y+size.y,Point.DOWN);}if(p===Point.UP){return new Point(Math.min(center.x+offset,center.x),pos.y,Point.UP);}if(p===Point.LEFT){return new Point(pos.x,Math.min(center.y+offset,pos.y+size.y),Point.LEFT);}if(p===Point.RIGHT){return new Point(pos.x+size.x,Math.min(center.y+offset,pos.y+size.y),Point.RIGHT);}}},{key:"createShape",value:function createShape(attrs){return util.createShape(attrs);}},{key:"withPos",value:function withPos(x,y){if(x&&y){this.pos=new Point(x,y);}else{if(typeof x!='undefined'){this.pos.x=x;}if(typeof y!='undefined'){this.pos.y=y;}}return this;}},{key:"withSize",value:function withSize(width,height){if(width&&height){this.size=new Point(width,height);}else{if(typeof width!='undefined'){this.size.x=width;}if(typeof height!='undefined'){this.size.y=height;}}return this;}},{key:"getShowed",value:function getShowed(){return _get(DiagramElement.prototype.__proto__||Object.getPrototypeOf(DiagramElement.prototype),"getShowed",this).call(this);}}]);return DiagramElement;}(Control);var Point=function(){function Point(x,y,pos){_classCallCheck(this,Point);this.x=0;this.y=0;this.pos="";this.x=Math.ceil(x||0);this.y=Math.ceil(y||0);this.pos=pos;}_createClass(Point,[{key:"add",value:function add(pos){this.x+=pos.x;this.y+=pos.y;return this;}},{key:"addNum",value:function addNum(x,y){this.x+=x;this.y+=y;return this;}},{key:"sum",value:function sum(pos){var sum=new Point(this.x,this.y);sum.add(pos);return sum;}},{key:"center",value:function center(posA,posB){var count=0;if(posA){this.x+=posA.x;this.y+=posA.y;count++;}if(posB){this.x+=posB.x;this.y+=posB.y;count++;}if(count>0){this.x=this.x/count;this.y=this.y/count;}}},{key:"isEmpty",value:function isEmpty(){return this.x<1&&this.y<1;}},{key:"size",value:function size(posA,posB){var x1=0,x2=0,y1=0,y2=0;if(posA){x1=posA.x;y1=posA.y;}if(posB){x2=posB.x;y2=posB.y;}if(x1>x2){this.x=x1-x2;}else{this.x=x2-x1;}if(y1>y2){this.y=y1-y2;}else{this.y=y2-y1;}}}]);return Point;}();Point.UP="UP";Point.LEFT="LEFT";Point.RIGHT="RIGHT";Point.DOWN="DOWN";var Line=function(_DiagramElement){_inherits(Line,_DiagramElement);function Line(){_classCallCheck(this,Line);return _possibleConstructorReturn(this,(Line.__proto__||Object.getPrototypeOf(Line)).apply(this,arguments));}_createClass(Line,[{key:"init",value:function init(data){}},{key:"getTyp",value:function getTyp(){return"SVG";}},{key:"getPos",value:function getPos(){var pos=new Point();pos.center(this.source,this.target);return pos;}},{key:"getSize",value:function getSize(){var pos=new Point();pos.size(this.source,this.target);return pos;}},{key:"withColor",value:function withColor(color){this.color=color;return this;}},{key:"withSize",value:function withSize(x,y){return this;}},{key:"withPath",value:function withPath(path,close,angle){var i=void 0,d="M"+path[0].x+" "+path[0].y;this.line=Line.FORMAT.PATH;for(i=1;i<path.length;i+=1){d=d+"L "+path[i].x+" "+path[i].y;}if(close){d=d+" Z";this.target=path[0];}else{this.target=path[path.length-1];}this.path=d;if(angle instanceof Number){this.angle=angle;}else if(angle){}return this;}},{key:"getSVG",value:function getSVG(){if(this.line==="PATH"){return util.create({tag:"path","d":this.path,"fill":this.color,stroke:"#000","stroke-width":"1px"});}var line=util.create({tag:"line",'x1':this.source.x,'y1':this.source.y,'x2':this.target.x,'y2':this.target.y,"stroke":util.getColor(this.color)});if(this.line&&this.line.toLowerCase()==="dotted"){line.setAttribute("stroke-miterlimit","4");line.setAttribute("stroke-dasharray","1,1");}return line;}}]);return Line;}(DiagramElement);Line.FORMAT={SOLID:"SOLID",DOTTED:"DOTTED",PATH:"PATH"};var Node=function(_DiagramElement2){_inherits(Node,_DiagramElement2);function Node(parent,id,type){_classCallCheck(this,Node);var _this3=_possibleConstructorReturn(this,(Node.__proto__||Object.getPrototypeOf(Node)).call(this,parent));_this3.edges=[];_this3.maxWidth=250;_this3.$LEFT=0;_this3.$RIGHT=0;_this3.$TOP=0;_this3.$DOWN=0;_this3.withSize(150,70);_this3.property=type||'Node';_this3.id=id;_this3.edges=[];return _this3;}_createClass(Node,[{key:"init",value:function init(data){if(data['x']&&data['y']){this.withPos(data['x'],data['y']);}if(data['width']||data['height']){this.withSize(data['width'],data['height']);}if(data['label']){this.label=data['label'];}return this;}},{key:"getSVG",value:function getSVG(){var pos=this.getPos();var size=this.getSize();var attr={tag:'rect',x:pos.x-size.x/2,y:pos.y-size.y/2,rx:4,ry:4,height:size.y,width:size.x,style:'fill:white;stroke:black;stroke-width:2'};var shape=this.createShape(attr);var attrText={tag:'text',x:pos.x,y:pos.y,'text-anchor':'middle','alignment-baseline':'middle','font-family':'Verdana','font-size':'14',fill:'black'};var text=this.createShape(attrText);text.textContent=this.id;var group=this.createShape({tag:'g',id:this.id});group.appendChild(shape);group.appendChild(text);return group;}},{key:"redrawEdges",value:function redrawEdges(){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=this.edges[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var edge=_step.value;edge.redraw();}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError;}}}}}]);return Node;}(DiagramElement);var Clazz=function(_Node){_inherits(Clazz,_Node);function Clazz(owner,id,type){_classCallCheck(this,Clazz);var _this4=_possibleConstructorReturn(this,(Clazz.__proto__||Object.getPrototypeOf(Clazz)).call(this,owner,id,type));_this4.attributes=[];_this4.methods=[];_this4.padding=10;_this4.getSize().y=_this4.labelHeight+_this4.padding*2;return _this4;}_createClass(Clazz,[{key:"init",value:function init(json){this.label=json.name||json.label||'New '+this.property;this.style=json.style||"flat";if(json['attributes']){var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator2=json['attributes'][Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=true){var attr=_step2.value;this.attributes.push(attr);this.getSize().y+=this.attrHeight;}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator2.return){_iterator2.return();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}}if(json['methods']){var _iteratorNormalCompletion3=true;var _didIteratorError3=false;var _iteratorError3=undefined;try{for(var _iterator3=json['methods'][Symbol.iterator](),_step3;!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=true){var method=_step3.value;this.methods.push(method);this.getSize().y+=this.attrHeight;}}catch(err){_didIteratorError3=true;_iteratorError3=err;}finally{try{if(!_iteratorNormalCompletion3&&_iterator3.return){_iterator3.return();}}finally{if(_didIteratorError3){throw _iteratorError3;}}}}return this;}},{key:"getModernStyle",value:function getModernStyle(){var width=void 0,height=void 0,id=void 0,size=void 0,z=void 0,item=void 0,rect=void 0,g=void 0,board=void 0,styleHeader=void 0,headerHeight=void 0,x=void 0,y=void 0;board=this.getRoot()["board"];styleHeader=util.getStyle("ClazzHeader");headerHeight=styleHeader.getNumber("height");width=0;height=10+headerHeight;if(this.property==="Object"||this.getRoot()["model"].getType().toLowerCase()==="objectdiagram"){id=this.id.charAt(0).toLowerCase()+this.id.slice(1);item="Object";}else{id=this.id;item="Clazz";if(this.counter){id+=" ("+this.counter+")";}}g=util.create({tag:"g",model:this});size=util.sizeOf(id,this);width=Math.max(width,size.width);if(this.attributes&&this.attributes.length>0){height=height+this.attributes.length*25;for(z=0;z<this.attributes.length;z+=1){width=Math.max(width,util.sizeOf(this.attributes[z],this).width);}}else{height+=20;}if(this.methods&&this.methods.length>0){height=height+this.methods.length*25;for(z=0;z<this.methods.length;z+=1){width=Math.max(width,util.sizeOf(this.methods[z],this).width);}}width+=20;var pos=this.getPos();y=pos.y;x=pos.x;rect={tag:"rect","width":width,"height":height,"x":x,"y":y,"class":item+" draggable","fill":"none"};g.appendChild(util.create(rect));g.appendChild(util.create({tag:"rect",rx:0,"x":x,"y":y,height:headerHeight,"width":width,"class":"ClazzHeader"}));item=util.create({tag:"text",$font:true,"class":"InfoText","text-anchor":"right","x":x+width/2-size.width/2,"y":y+headerHeight/2+size.height/2,"width":size.width});if(this.property==="Object"||this.getRoot()["model"].type.toLowerCase()==="objectdiagram"){item.setAttribute("text-decoration","underline");}item.appendChild(document.createTextNode(id));g.appendChild(item);g.appendChild(util.create({tag:"line",x1:x,y1:y+headerHeight,x2:x+width,y2:y+headerHeight,stroke:"#000"}));y+=headerHeight+20;if(this.attributes){for(z=0;z<this.attributes.length;z+=1){g.appendChild(util.create({tag:"text",$font:true,"text-anchor":"left","width":width,"x":x+10,"y":y,value:this.attributes[z]}));y+=20;}if(this.attributes.length>0){y-=10;}}if(this.methods&&this.methods.length>0){g.appendChild(util.create({tag:"line",x1:x,y1:y,x2:x+width,y2:y,stroke:"#000"}));y+=20;for(z=0;z<this.methods.length;z+=1){g.appendChild(util.create({tag:"text",$font:true,"text-anchor":"left","width":width,"x":x+10,"y":y,value:this.methods[z]}));y+=20;}}return g;}},{key:"getCanvas",value:function getCanvas(){return null;}},{key:"getSVG",value:function getSVG(){var pos=this.getPos();if(this.style=="modern"){return this.getModernStyle();}var nodeShape=this.createShape({tag:'rect',x:pos.x-this.getSize().x/2,y:pos.y-this.getSize().y/2,height:this.getSize().y,width:this.getSize().x,rx:1,ry:1,style:'fill:white;stroke:black;stroke-width:2'});var attrContent={tag:'rect',x:pos.x-this.getSize().x/2,y:pos.y-this.getSize().y/2,height:this.padding+this.attrHeight*this.attributes.length,width:this.getSize().x,style:'fill:white;stroke:black;stroke-width:2'};var contentShape=this.createShape(attrContent);var attrLabel={tag:'text',x:pos.x,y:pos.y-this.getSize().y/2+this.labelHeight/2,'text-anchor':'middle','alignment-baseline':'central','font-family':'Verdana','font-size':this.labelFontSize,'font-weight':'bold',fill:'black'};var label=this.createShape(attrLabel);label.textContent=this.label;var group=this.createShape({tag:'g',id:this.id,transform:'translate(0 0)'});group.appendChild(nodeShape);group.appendChild(contentShape);group.appendChild(label);if(this.attributes.length>0){var _y=pos.y-this.getSize().y/2+this.labelHeight+this.attrHeight/2+this.padding/2;var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=this.attributes[Symbol.iterator](),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var element=_step4.value;var attrText={tag:'text',x:pos.x-this.getSize().x/2+this.padding/2,y:_y,'text-anchor':'start','alignment-baseline':'middle','font-family':'Verdana','font-size':this.attrFontSize,fill:'black'};var text=this.createShape(attrText);text.textContent=element;group.appendChild(text);_y+=this.attrHeight;}}catch(err){_didIteratorError4=true;_iteratorError4=err;}finally{try{if(!_iteratorNormalCompletion4&&_iterator4.return){_iterator4.return();}}finally{if(_didIteratorError4){throw _iteratorError4;}}}}var height=this.attributes.length*this.attrHeight;var y=pos.y-this.getSize().y/2+this.labelHeight+height+this.attrHeight/2+this.padding/2;if(this.methods.length>0){y+=this.attrHeight/2;var _iteratorNormalCompletion5=true;var _didIteratorError5=false;var _iteratorError5=undefined;try{for(var _iterator5=this.methods[Symbol.iterator](),_step5;!(_iteratorNormalCompletion5=(_step5=_iterator5.next()).done);_iteratorNormalCompletion5=true){var _element=_step5.value;var _attrText={tag:'text',x:pos.x-this.getSize().x/2+this.padding/2,y:y,'text-anchor':'start','alignment-baseline':'middle','font-family':'Verdana','font-size':this.attrFontSize,fill:'black'};var _text=this.createShape(_attrText);_text.textContent=_element;group.appendChild(_text);y+=this.attrHeight;}}catch(err){_didIteratorError5=true;_iteratorError5=err;}finally{try{if(!_iteratorNormalCompletion5&&_iterator5.return){_iterator5.return();}}finally{if(_didIteratorError5){throw _iteratorError5;}}}}this.$viewElement=group;return group;}},{key:"getPropertyAsString",value:function getPropertyAsString(type){var value='';if(this[type]){var _iteratorNormalCompletion6=true;var _didIteratorError6=false;var _iteratorError6=undefined;try{for(var _iterator6=this[type][Symbol.iterator](),_step6; !(_iteratorNormalCompletion6=(_step6=_iterator6.next()).done); _iteratorNormalCompletion6=true){var property=_step6.value;value+=property+'\n';}}catch(err){_didIteratorError6=true;_iteratorError6=err;}finally{try{if(!_iteratorNormalCompletion6&&_iterator6.return){_iterator6.return();}}finally{if(_didIteratorError6){throw _iteratorError6;}}}}return value;}},{key:"convertStringToProperty",value:function convertStringToProperty(values,type){if(!this[type]){return false;}var properties=values.split(/\r?\n/);var newProperties=[];var _iteratorNormalCompletion7=true;var _didIteratorError7=false;var _iteratorError7=undefined;try{for(var _iterator7=properties[Symbol.iterator](),_step7;!(_iteratorNormalCompletion7=(_step7=_iterator7.next()).done);_iteratorNormalCompletion7=true){var property=_step7.value;if(property&&property.length>0){newProperties.push(property);}}}catch(err){_didIteratorError7=true;_iteratorError7=err;}finally{try{if(!_iteratorNormalCompletion7&&_iterator7.return){_iterator7.return();}}finally{if(_didIteratorError7){throw _iteratorError7;}}}var changed=false;if(this[type].length!==newProperties.length){changed=true;}else{for(var _i2=0;_i2<this[type].length;_i2++){if(!this[type][_i2]||!newProperties[_i2]||this[type][_i2]!==newProperties[_i2]){changed=true;}}}if(changed){this[type]=newProperties;this.getSize().y=this.labelHeight+this.padding*2+(this.attributes.length+this.methods.length)*this.attrHeight;}return changed;}}]);return Clazz;}(Node);var SO=function(_DiagramElement3){_inherits(SO,_DiagramElement3);function SO(owner){_classCallCheck(this,SO);return _possibleConstructorReturn(this,(SO.__proto__||Object.getPrototypeOf(SO)).call(this,owner));}_createClass(SO,[{key:"draw",value:function draw(typ){return null;}},{key:"getEvent",value:function getEvent(){return[];}},{key:"init",value:function init(data){this.property="SO";return this;}},{key:"getSVG",value:function getSVG(){}},{key:"withKeyValue",value:function withKeyValue(key,value){if(key==="typ"){this.property=value;}else if(key==="x"){this.withPos(value,null);}else if(key==="y"){this.withPos(null,value);}else if(key==="width"){this.withSize(value,null);}else if(key==="height"){this.withSize(null,value);}else{this[key]=value;}return this;}},{key:"event",value:function event(source,typ,value){return true;}}],[{key:"create",value:function create(element){var result=new SO(null);for(var key in element){if(element.hasOwnProperty(key)===false){continue;}result.withKeyValue(key,element[key]);}return result;}}]);return SO;}(DiagramElement);var _Symbol=function(_Node2){_inherits(_Symbol,_Node2);function _Symbol(owner,typ){_classCallCheck(this,_Symbol);var _this6=_possibleConstructorReturn(this,(_Symbol.__proto__||Object.getPrototypeOf(_Symbol)).call(this,owner,typ));_this6.$heightMax=0;_this6.$heightMin=0;return _this6;}_createClass(_Symbol,[{key:"draw",value:function draw(typ){return SymbolLibary.draw(this);}}]);return _Symbol;}(Node);var SymbolLibary=function(){function SymbolLibary(){_classCallCheck(this,SymbolLibary);}_createClass(SymbolLibary,null,[{key:"draw",value:function draw(node,parent){var symbol=void 0,fn=this[SymbolLibary.getName(node)];if(typeof fn==="function"){symbol=fn.apply(this,[node]);if(!parent){return SymbolLibary.createGroup(node,symbol);}return SymbolLibary.createGroup(node,symbol);}else if(node.property){symbol=new _Symbol(node,node.property);var pos=node.getPos();var size=node.getSize();symbol.withPos(pos.x,pos.y);symbol.withSize(size.x,size.y);symbol["value"]=node["value"];parent=node["$parent"];return SymbolLibary.draw(symbol,parent);}return null;}},{key:"upFirstChar",value:function upFirstChar(txt){return txt.charAt(0).toUpperCase()+txt.slice(1).toLowerCase();}},{key:"isSymbolName",value:function isSymbolName(typ){var fn=SymbolLibary["draw"+SymbolLibary.upFirstChar(typ)];return typeof fn==="function";}},{key:"isSymbol",value:function isSymbol(node){var fn=SymbolLibary[SymbolLibary.getName(node)];return typeof fn==="function";}},{key:"getName",value:function getName(node){if(node.property){return"draw"+SymbolLibary.upFirstChar(node.property);}if(node["src"]){return"draw"+SymbolLibary.upFirstChar(node["src"]);}return"drawNode";}},{key:"createImage",value:function createImage(node,model){var n=void 0,img=void 0;if(SymbolLibary.isSymbol(node)){return SymbolLibary.draw(null,node);}n={tag:"img",model:node,src:node["src"]};var size=node.getSize();if(size.isEmpty()==false){n.width=size.x;n.height=size.y;}else{n.xmlns="http://www.w3.org/1999/xhtml";}img=util.create(n);if(size.isEmpty()){model.appendImage(img);return null;}return img;}},{key:"createGroup",value:function createGroup(node,group){var func=void 0,y=void 0,yr=void 0,z=void 0,box=void 0,item=void 0,transform=void 0,i=void 0,offsetX=0,offsetY=0;var svg=void 0;if(node.property.toUpperCase()=="HTML"){svg=util.create({tag:"svg",style:{left:group.x+node.getPos().x,top:group.y+node.getPos().y,position:"absolute"}});}else{svg=util.create({tag:"g"});transform="translate("+group.pos.x+" "+group.pos.y+")";if(group.scale){transform+=" scale("+group.scale+")";}if(group.rotate){transform+=" rotate("+group.rotate+")";}svg.setAttribute('transform',transform);}for(i=0;i<group.items.length;i+=1){svg.appendChild(util.create(group.items[i]));}var elements=node["elements"];util.setSize(svg,group.width+node.getSize().x,group.height+node.getSize().y);node["$heightMin"]=node.getSize().y;if(elements){for(i=0;i<elements.length;i+=1){if(!elements[i]&&elements[i].length<1){elements.splice(i,1);i-=1;}}box=util.create({tag:"g"});z=elements.length*25+6;box.appendChild(util.create({tag:"rect",rx:0,x:offsetX,y:offsetY+28,width:60,height:z,stroke:"#000",fill:"#fff",opacity:"0.7"}));node["$heightMax"]=z+node["$heightMin"];svg["elements"]=elements;svg["activ"]=util.create({tag:"text",$font:true,"text-anchor":"left","width":60,"x":10+offsetX,"y":20,value:node["activText"]});svg.appendChild(svg.activ);y=offsetY+46;yr=offsetY+28;func=function func(event){svg.activ.textContent=event.currentTarget.value;};for(z=0;z<elements.length;z+=1){box.appendChild(util.create({tag:"text",$font:true,"text-anchor":"left","width":60,"x":10,"y":y,value:elements[z]}));item=box.appendChild(util.create({tag:"rect",rx:0,x:offsetX,y:yr,width:60,height:24,stroke:"none","class":"SVGChoice"}));item.value=elements[z];if(node["action"]){item.onclick=node["action"];}else{item.onclick=func;}y+=26;yr+=26;}svg.choicebox=box;}svg.tool=node;svg.onclick=function(){if(svg.status==="close"){svg.open();}else{svg.close();}};svg.close=function(){if(svg.status==="open"&&svg.choicebox){this.removeChild(svg.choicebox);}svg.status="close";svg.tool.size.height=svg.tool.heightMin;util.setSize(svg,svg.tool.size.x,svg.tool.size.y);};svg.open=function(){if(this.tagName==="svg"){return;}if(svg.status==="close"&&svg.choicebox){this.appendChild(svg.choicebox);}svg.status="open";svg.tool.size.height=svg.tool.heightMax;util.setSize(svg,svg.tool.width,svg.tool.height);};svg.close();return svg;}},{key:"addChild",value:function addChild(parent,json){var item=void 0;if(json.offsetLeft){item=json;}else{item=util.create(json);}item.setAttribute("class","draggable");parent.appendChild(item);}},{key:"all",value:function all(node){SymbolLibary.drawSmiley(node);SymbolLibary.drawDatabase(node);SymbolLibary.drawLetter(node);SymbolLibary.drawMobilephone(node);SymbolLibary.drawWall(node);SymbolLibary.drawActor(node);SymbolLibary.drawLamp(node);SymbolLibary.drawArrow(node);SymbolLibary.drawButton(node);SymbolLibary.drawDropdown(node);SymbolLibary.drawClassicon(node);SymbolLibary.drawEdgeicon(node);}},{key:"drawSmiley",value:function drawSmiley(node){return SO.create({x:node.getPos().x,y:node.getPos().y,width:50,height:52,items:[{tag:"path",d:"m49.01774,25.64542a24.5001,24.5 0 1 1 -49.0001,0a24.5001,24.5 0 1 1 49.0001,0z",stroke:"black",fill:"none"},{tag:"path",d:"m8,31.5c16,20 32,0.3 32,0.3"},{tag:"path",d:"m19.15,20.32a1.74,2.52 0 1 1 -3.49,0a1.74,2.52 0 1 1 3.49,0z"},{tag:"path",d:"m33,20.32a1.74,2.52 0 1 1 -3.48,0a1.74,2.52 0 1 1 3.48,0z"},{tag:"path",d:"m5.57,31.65c3.39,0.91 4.03,-2.20 4.03,-2.20"},{tag:"path",d:"m43,32c-3,0.91 -4,-2.20 -4.04,-2.20"}]});}},{key:"drawDatabase",value:function drawDatabase(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:25,height:40,items:[{tag:"path",d:"m0,6.26c0,-6.26 25.03,-6.26 25.03,0l0,25.82c0,6.26 -25.03,6.26 -25.03,0l0,-25.82z",stroke:"black",fill:"none"},{tag:"path",d:"m0,6.26c0,4.69 25.03,4.69 25.03,0m-25.03,2.35c0,4.69 25.03,4.69 25.03,0m-25.03,2.35c0,4.69 25.03,4.69 25.03,0",stroke:"black",fill:"none"}]});}},{key:"drawLetter",value:function drawLetter(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:25,height:17,items:[{tag:"path",stroke:"black",fill:"none",d:"m1,1l22,0l0,14l-22,0l0,-14z"},{tag:"path",stroke:"black",fill:"none",d:"m1.06,1.14l10.94,6.81l10.91,-6.91"}]});}},{key:"drawMobilephone",value:function drawMobilephone(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:25,height:50,items:[{tag:"path",d:"m 4.2 0.5 15.61 0c 2 0 3.7 1.65 3.7 3.7l 0 41.6c 0 2-1.65 3.7-3.7 3.7l-15.6 0c-2 0-3.7-1.6-3.7-3.7l 0-41.6c 0-2 1.6-3.7 3.7-3.7z",fill:"none",stroke:"black"},{tag:"path",d:"m 12.5 2.73a 0.5 0.5 0 1 1-1 0 0.5 0.5 0 1 1 1 0z"},{tag:"path",d:"m 14 46a 2 2 0 1 1-4 0 2 2 0 1 1 4 0z"},{tag:"path",d:"m 8 5 7 0"},{tag:"path",d:"m 1.63 7.54 20.73 0 0 34-20.73 0z"}]});}},{key:"drawWall",value:function drawWall(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:25,height:50,items:[{tag:"path",d:"m26,45.44l-5,3.56l-21,-9l0,-36.41l5,-3.56l20.96,9l-0,36.4z"},{tag:"path",stroke:"white",d:"m2.21,11l18.34,7.91m-14.46,-12.57l0,6.3m8.2,21.74l0,6.35m-8.6,-10l0,6.351m4.1,-10.67l0,6.3m4.8,-10.2l0,6.3m-8.87,-10.23l0,6.35m4.78,-10.22l0,6.35m-8,14.5l18.34,7.91m-18.34,-13.91l18.34,7.91m-18.34,-13.91l18.34,7.91m-18.34,-13.91l18.34,7.91m0,-13l0,34m-18.23,-41.84l18.3,8m0,0.11l5,-3.57"}]});}},{key:"drawActor",value:function drawActor(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:25,height:50,items:[{tag:"line",stroke:"#000",x1:"12",y1:"10",x2:"12",y2:"30"},{tag:"circle",stroke:"#000",cy:"5",cx:"12",r:"5"},{tag:"line",stroke:"#000",y2:"18",x2:"25",y1:"18",x1:"0"},{tag:"line",stroke:"#000",y2:"39",x2:"5",y1:"30",x1:"12"},{tag:"line",stroke:"#000",y2:"39",x2:"20",y1:"30",x1:"12"}]});}},{key:"drawLamp",value:function drawLamp(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:25,height:50,items:[{tag:"path",d:"m 22.47 10.58c-6.57 0-11.89 5.17-11.89 11.54 0 2.35 0.74 4.54 2 6.36 2 4 4.36 5.63 4.42 10.4l 11.15 0c 0.12-4.9 2.5-6.8 4.43-10.4 1.39-1.5 1.8-4.5 1.8-6.4 0-6.4-5.3-11.5-11.9-11.5z",fill:"white",stroke:"black"},{tag:"path",d:"m 18.4 40 8 0c 0.58 0 1 0.5 1 1 0 0.6-0.5 1-1 1l-8 0c-0.6 0-1-0.47-1-1 0-0.58 0.47-1 1-1z"},{tag:"path",d:"m 18.4 42.7 8 0c 0.58 0 1 0.47 1 1 0 0.58-0.47 1-1 1l-8 0c-0.58 0-1-0.47-1-1 0-0.58 0.46-1 1-1z"},{tag:"path",d:"m 18.4 45.3 8 0c 0.58 0 1 0.47 1 1 0 0.58-0.47 1-1 1l-8 0c-0.58 0-1-0.47-1-1 0-0.58 0.46-1 1-1z"},{tag:"path",d:"m 19.5 48c 0.37 0.8 1 1.3 1.9 1.7 0.6 0.3 1.5 0.3 2 0 0.8-0.3 1.4-0.8 1.9-1.8z"},{tag:"path",d:"m 6 37.5 4.2-4c 0.3-0.3 0.8-0.3 1 0 0.3 0.3 0.3 0.8 0 1.1l-4.2 4c-0.3 0.3-0.8 0.3-1.1 0-0.3-0.3-0.3-0.8 0-1z"},{tag:"path",d:"m 39 37.56-4.15-4c-0.3-0.3-0.8-0.3-1 0-0.3 0.3-0.3 0.8 0 1l 4.2 4c 0.3 0.3 0.8 0.3 1 0 0.3-0.3 0.3-0.8 0-1z"},{tag:"path",d:"m 38 23 5.8 0c 0.4 0 0.8-0.3 0.8-0.8 0-0.4-0.3-0.8-0.8-0.8l-5.8 0c-0.4 0-0.8 0.3-0.8 0.8 0 0.4 0.3 0.8 0.8 0.8z"},{tag:"path",d:"m 1.3 23 6 0c 0.4 0 0.8-0.3 0.8-0.8 0-0.4-0.3-0.8-0.8-0.8l-5.9 0c-0.4 0-0.8 0.3-0.8 0.8 0 0.4 0.3 0.8 0.8 0.8z"},{tag:"path",d:"m 34.75 11.2 4-4.1c 0.3-0.3 0.3-0.8 0-1-0.3-0.3-0.8-0.3-1 0l-4 4.1c-0.3 0.3-0.3 0.8 0 1 0.3 0.3 0.8 0.3 1 0z"},{tag:"path",d:"m 11.23 10-4-4c-0.3-0.3-0.8-0.3-1 0-0.3 0.3-0.3 0.8 0 1l 4.2 4c 0.3 0.3 0.8 0.3 1 0 0.3-0.3 0.3-0.8 0-1z"},{tag:"path",d:"m 21.64 1.3 0 5.8c 0 0.4 0.3 0.8 0.8 0.8 0.4 0 0.8-0.3 0.8-0.8l 0-5.8c 0-0.4-0.3-0.8-0.8-0.8-0.4 0-0.8 0.3-0.8 0.8z"},{tag:"path",d:"m 26.1 24.3c-0.5 0-1 0.2-1.3 0.4-1.1 0.6-2 3-2.27 3.5-0.26-0.69-1.14-2.9-2.2-3.5-0.7-0.4-2-0.7-2.5 0-0.6 0.8 0.2 2.2 0.9 2.9 1 0.9 3.9 0.9 3.9 0.9 0 0 0 0 0 0 0.54 0 2.8 0 3.7-0.9 0.7-0.7 1.5-2 0.9-2.9-0.2-0.3-0.7-0.4-1.2-0.4z"},{tag:"path",d:"m 22.5 28.57 0 10.7"}]});}},{key:"drawStop",value:function drawStop(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:30,height:30,items:[{tag:"path",fill:"#FFF","stroke-width":"2",stroke:"#B00",d:"m 6,6 a 14,14 0 1 0 0.06,-0.06 z m 0,0 20,21"}]});}},{key:"drawMin",value:function drawMin(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:20,height:20,items:[{tag:"path",fill:"white",stroke:"#000","stroke-width":0.2,"stroke-linejoin":"round",d:"m 0,0 19,0 0,19 -19,0 z"},{tag:"path",fill:"none",stroke:"#000","stroke-width":"1px","stroke-linejoin":"miter",d:"m 4,10 13,-0.04"}]});}},{key:"drawArrow",value:function drawArrow(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:10,height:9,rotate:node["rotate"],items:[{tag:"path",fill:"#000",stroke:"#000",d:"M 0,0 10,4 0,9 z"}]});}},{key:"drawMax",value:function drawMax(node){return SO.create({x:node.getPos().x||0,y:node.getPos().y||0,width:20,height:20,items:[{tag:"path",fill:"white",stroke:"#000","stroke-width":0.2,"stroke-linejoin":"round","stroke-dashoffset":2,"stroke-dasharray":"4.8,4.8",d:"m 0,0 4.91187,0 5.44643,0 9.11886,0 0,19.47716 -19.47716,0 0,-15.88809 z"},{tag:"path",fill:"none",stroke:"#000","stroke-width":"1px","stroke-linejoin":"miter",d:"m 4,10 6,0.006 0.02,5 0.01,-11 -0.03,6.02 c 2,-0.01 4,-0.002 6,0.01"}]});}},{key:"drawButton",value:function drawButton(node){var btnX,btnY,btnWidth,btnHeight,btnValue;btnX=node.getPos().x||0;btnY=node.getPos().y||0;btnWidth=node.getSize().x||60;btnHeight=node.getSize().y||28;btnValue=node["value"]||"";return SO.create({x:btnX,y:btnY,width:60,height:28,items:[{tag:"rect",rx:8,x:0,y:0,width:btnWidth,height:btnHeight,stroke:"#000",filter:"url(#drop-shadow)","class":"SVGBtn"},{tag:"text",$font:true,x:10,y:18,fill:"black",value:btnValue,"class":"hand"}]});}},{key:"drawDropdown",value:function drawDropdown(node){var btnX,btnY,btnWidth,btnHeight;btnX=node.getPos().x||0;btnY=node.getPos().y||0;btnWidth=node.getSize().x||60;btnHeight=node.getSize().y||28;return SO.create({x:btnX,y:btnY,width:btnWidth,height:btnHeight,items:[{tag:"rect",rx:0,x:0,y:0,width:btnWidth-20,height:btnHeight,stroke:"#000",fill:"none"},{tag:"rect",rx:2,x:btnWidth-20,y:0,width:20,height:28,stroke:"#000","class":"SVGBtn"},{tag:"path",style:"fill:#000000;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1",d:"m "+(btnWidth-15)+",13 10,0 L "+(btnWidth-10)+",20 z"}]});}},{key:"drawClassicon",value:function drawClassicon(node){var btnX=void 0,btnY=void 0,btnWidth=void 0,btnHeight=void 0;btnX=node.getPos().x||0;btnY=node.getPos().y||0;btnWidth=node.getSize().x||60;btnHeight=node.getSize().y||28;return SO.create({x:btnX,y:btnY,width:btnWidth,height:btnHeight,items:[{tag:"path",d:"m0,0l10.78832,0l0,4.49982l-10.78832,0.19999l0,9.19963l10.78832,0l0,-9.49962l-10.78832,0.19999l0,-4.59982z",style:"fill:none;stroke:#000000;"},{tag:"path",d:"m25.68807,0l10.78832,0l0,4.49982l-10.78832,0.19999l0,9.19963l10.78832,0l0,-9.49962l-10.78832,0.2l0,-4.59982z",style:"fill:none;stroke:#000000;"},{tag:"line",x1:11,y1:7,x2:25,y2:7,stroke:"#000"}]});}},{key:"drawEdgeicon",value:function drawEdgeicon(node){var btnX=void 0,btnY=void 0,btnWidth=void 0,btnHeight=void 0;btnX=node.getPos().x||0;btnY=node.getPos().y||0;btnWidth=node.getSize().x||30;btnHeight=node.getSize().y||35;return SO.create({x:btnX,y:btnY,width:btnWidth,height:btnHeight,items:[{tag:"path",d:"M2,10 20,10 20,35 2,35 Z M2,17 20,17 M20,10 28,5 28,9 M 28.5,4.7 24,4",style:"fill:none;stroke:#000000;transform:scale(0.4);"}]});}}]);return SymbolLibary;}();var BR=function(_Control2){_inherits(BR,_Control2);function BR(owner,data){_classCallCheck(this,BR);var _this7=_possibleConstructorReturn(this,(BR.__proto__||Object.getPrototypeOf(BR)).call(this,owner));_this7.createControl(document.getElementsByTagName("body")[0],data);return _this7;}_createClass(BR,[{key:"propertyChange",value:function propertyChange(entity,property,oldValue,newValue){}},{key:"createControl",value:function createControl(parent,data){var label=document.createElement("br");for(var attr in data){if(!data.hasOwnProperty(attr)){continue;}label.setAttribute(attr,data[attr]);}parent.appendChild(label);}},{key:"setProperty",value:function setProperty(property){}}]);return BR;}(Control);var Button=function(_Control3){_inherits(Button,_Control3);function Button(owner,data){_classCallCheck(this,Button);var _this8=_possibleConstructorReturn(this,(Button.__proto__||Object.getPrototypeOf(Button)).call(this,owner));_this8.createControl(document.getElementsByTagName("body")[0],data);return _this8;}_createClass(Button,[{key:"propertyChange",value:function propertyChange(entity,property,oldValue,newValue){}},{key:"createControl",value:function createControl(parent,data){if(typeof data==="string"){this.id=data;}else{this.id=data["id"];}this.$element=document.createElement("button");if(data instanceof Object){for(var attr in data){if(!data.hasOwnProperty(attr)){continue;}this.$element.setAttribute(attr,data[attr]);}}parent.appendChild(this.$element);}},{key:"setProperty",value:function setProperty(property){}}]);return Button;}(Control);var Div=function(_Control4){_inherits(Div,_Control4);function Div(owner,data){_classCallCheck(this,Div);var _this9=_possibleConstructorReturn(this,(Div.__proto__||Object.getPrototypeOf(Div)).call(this,owner));_this9.applyingChange=false;var id=void 0;if(typeof data==="string"){id=data;}else{id=data.id;_this9.className=data.class;_this9.property=data.property;}if(!id){return _possibleConstructorReturn(_this9);}_this9.id=id;var div=document.getElementById(id);if(!_this9.property){_this9.property=div.getAttribute("Property");}if(div instanceof HTMLDivElement){_this9.$element=div;}else{if(!div){_this9.$element=document.createElement("div");_this9.$element.setAttribute("id",_this9.id);_this9.$element.setAttribute("property",_this9.property);document.getElementsByTagName("body")[0].appendChild(_this9.$element);}else{return _possibleConstructorReturn(_this9);}}var objId=_this9.property.split(".")[0];var hasItem=_this9.$owner.hasItem(objId);if(hasItem){var item=_this9.$owner.getItem(objId);item.addListener(_this9);_this9.entity=item;}return _this9;}_createClass(Div,[{key:"controlChanged",value:function controlChanged(ev){this.$owner.setValue(this.entity,this.lastProperty,this.$element.innerHTML);}},{key:"propertyChange",value:function propertyChange(entity,property,oldValue,newValue){if(!this.applyingChange&&property==this.lastProperty){this.$element.innerHTML=newValue;}}},{key:"addItem",value:function addItem(source,entity){this.entity=entity;if(entity){if(!this.className||this.className===entity.property){if(entity.id==this.property.split(".")[0]){entity.addListener(this);}}}}}]);return Div;}(Control);var Form=function(_Control5){_inherits(Form,_Control5);function Form(owner,data){_classCallCheck(this,Form);var _this10=_possibleConstructorReturn(this,(Form.__proto__||Object.getPrototypeOf(Form)).call(this,owner));_this10.children=new Map();var id=void 0;if(typeof data==="string"){id=data;}else{id=data.id;}if(!id){return _possibleConstructorReturn(_this10);}_this10.id=id;var form=document.getElementById(id);if(form instanceof HTMLFormElement){_this10.$element=form;if(_this10.$element.hasAttribute("property")){_this10.property=_this10.$element.getAttribute("property");}}else{if(!form){_this10.$element=document.createElement("form");_this10.$element.setAttribute("id",_this10.id);if(data.hasOwnProperty("property")){_this10.property=data['property'];}for(var attr in data){if(data.hasOwnProperty(attr)===false){continue;}if(attr=="elements"){continue;}_this10.$element.setAttribute(attr,data[attr]);}document.getElementsByTagName("body")[0].appendChild(_this10.$element);}else{return _possibleConstructorReturn(_this10);}}var objId=_this10.property;var hasItem=_this10.$owner.hasItem(objId);if(hasItem){var item=_this10.$owner.getItem(objId);item.addListener(_this10);_this10.entity=item;}var _iteratorNormalCompletion8=true;var _didIteratorError8=false;var _iteratorError8=undefined;try{for(var _iterator8=data.elements[Symbol.iterator](),_step8;!(_iteratorNormalCompletion8=(_step8=_iterator8.next()).done);_iteratorNormalCompletion8=true){var field=_step8.value;if(field.hasOwnProperty("property")){var property=field["property"];property=_this10.property+'.'+property;field['property']=property;}if(!field.hasOwnProperty("class")){field['class']='input';}var control=_this10.$owner.load(field);_this10.children.set(control.getId(),control);}}catch(err){_didIteratorError8=true;_iteratorError8=err;}finally{try{if(!_iteratorNormalCompletion8&&_iterator8.return){_iterator8.return();}}finally{if(_didIteratorError8){throw _iteratorError8;}}}return _this10;}_createClass(Form,[{key:"createField",value:function createField(field){var control="input";if(field.hasOwnProperty("class")){control=field['class'];}var input=document.createElement(control);input.setAttribute("class",control);var id=void 0;if(!field.hasOwnProperty("id")){id=this.$owner.getId();field['id']=id;}if(field.hasOwnProperty("property")){var property=field["property"];property=this.id+'.'+property;input.setAttribute("property",property);}for(var attr in field){if(attr=="property"||attr=="class"||!field.hasOwnProperty(attr)){continue;}input.setAttribute(attr,field[attr]);}this.$element.appendChild(input);var newcontrol=this.$owner.load(field['id']);this.children.set(newcontrol.getId(),newcontrol);}},{key:"setProperty",value:function setProperty(id){this.property=id;var _iteratorNormalCompletion9=true;var _didIteratorError9=false;var _iteratorError9=undefined;try{for(var _iterator9=this.children[Symbol.iterator](),_step9;!(_iteratorNormalCompletion9=(_step9=_iterator9.next()).done);_iteratorNormalCompletion9=true){var _step9$value=_slicedToArray(_step9.value,2),_id=_step9$value[0],childControl=_step9$value[1];if(this.children.hasOwnProperty(_id)===false){continue;}if(childControl.property){childControl.setProperty(this.property+"."+childControl.lastProperty);}}}catch(err){_didIteratorError9=true;_iteratorError9=err;}finally{try{if(!_iteratorNormalCompletion9&&_iterator9.return){_iterator9.return();}}finally{if(_didIteratorError9){throw _iteratorError9;}}}}}]);return Form;}(Control);var Data=function(){function Data(){_classCallCheck(this,Data);this.$listener=[];this.values={};}_createClass(Data,[{key:"getValue",value:function getValue(attribute){return this.values[attribute];}},{key:"setValue",value:function setValue(attribute,newValue){var oldValue=this.values[attribute];this.values[attribute]=newValue;for(var _i3 in this.$listener){if(this.$listener.hasOwnProperty(_i3)===false){continue;}this.$listener[_i3].propertyChange(this,attribute,oldValue,newValue);}}},{key:"addListener",value:function addListener(control){this.$listener.push(control);}},{key:"removeListener",value:function removeListener(control){var pos=this.$listener.indexOf(control);if(pos>=0){this.$listener.splice(pos,1);}}}]);return Data;}();var Input=function(_Control6){_inherits(Input,_Control6);function Input(owner,data){_classCallCheck(this,Input);var _this11=_possibleConstructorReturn(this,(Input.__proto__||Object.getPrototypeOf(Input)).call(this,owner));_this11.applyingChange=false;_this11.initControl(data);return _this11;}_createClass(Input,[{key:"initControl",value:function initControl(data){var _this12=this;var id=void 0;if(typeof data==="string"){id=data;}else{id=data.id;if(data.type){this.type=data['type'];}else{this.type='text';}this.property=data['property'];}if(!id){return;}this.id=id;var inputField=document.getElementById(id);if(!this.property){if(inputField){if(inputField.hasAttribute("Property")){this.property=inputField.getAttribute("Property");}}}if(inputField instanceof HTMLInputElement){this.$element=inputField;this.type=inputField.type;}else{if(!inputField){this.$element=document.createElement("input");if(typeof data!=="string"){for(var attr in data){if(data.hasOwnProperty(attr)==false){continue;}this.$element.setAttribute(attr,data[attr]);}}else{if(this.type)this.$element.setAttribute("type",this.type);if(data.hasOwnProperty("class"))this.$element.setAttribute("class",data['class']);this.$element.setAttribute("id",this.id);this.$element.setAttribute("property",this.property);}document.getElementsByTagName("body")[0].appendChild(this.$element);}else{return;}}if(this.property){var objId=this.property.split(".")[0];var hasItem=this.$owner.hasItem(objId);if(hasItem){var item=this.$owner.getItem(objId);item.addListener(this);this.entity=item;}else{this.entity=new Data();}this.$element.onchange=function(ev){_this12.controlChanged(ev);};}else{this.entity=new Data();}}},{key:"controlChanged",value:function controlChanged(ev){if(this.$element.checkValidity()){this.$owner.setValue(this.entity,this.lastProperty,this.$element.value);}else{console.log("value does not match the pattern...");}}},{key:"propertyChange",value:function propertyChange(entity, property, oldValue, newValue){if(this.property&&!this.applyingChange&&property==this.lastProperty){this.$element.value=newValue;}}},{key:"addItem",value:function addItem(source, entity){if(this.property&&entity){if(entity.id==this.property.split(".")[0]){this.entity=entity;entity.addListener(this);}}}},{key:"updateElement",value:function updateElement(value){this.$element.value=value;}},{key:"registerListenerOnHTMLObject",value:function registerListenerOnHTMLObject(eventType){this.registerEventListener(eventType,this.$element);return true;}}]);return Input;}(Control);var Label=function(_Control7){_inherits(Label,_Control7);function Label(owner, data){_classCallCheck(this,Label);var _this13=_possibleConstructorReturn(this,(Label.__proto__||Object.getPrototypeOf(Label)).call(this,owner));_this13.createControl(document.getElementsByTagName("body")[0],data);return _this13;}_createClass(Label,[{key:"createControl",value:function createControl(parent, data){var label=document.createElement("label");for(var attr in data){if(!data.hasOwnProperty(attr)){continue;}if(attr=="textContent"){label.textContent=data['textContent'];}else{label.setAttribute(attr,data[attr]);}}parent.appendChild(label);}}]);return Label;}(Control);var BridgeElement=function BridgeElement(model){_classCallCheck(this,BridgeElement);this.model=model;this.id=model.id;BridgeElement.elementSet.add(this);};BridgeElement.elementSet=new Set();var Table=function(_Control8){_inherits(Table,_Control8);function Table(owner,data){_classCallCheck(this,Table);var _this14=_possibleConstructorReturn(this,(Table.__proto__||Object.getPrototypeOf(Table)).call(this,owner));_this14.columns=[];_this14.cells={};_this14.showedItems=[];_this14.itemsIds={};_this14.searchColumns=[];_this14.searchText=[];_this14.moveElement=null;_this14.isDrag=false;_this14.items=new Set();_this14.initControl(data);return _this14;}_createClass(Table,[{key:"initControl",value:function initControl(data){var id=void 0;if(typeof data==="string"){id=data;}else{id=data.id;if(data.property){this.property=data.property;}if(data.searchColumns){var _search=[];if(typeof data.searchColumns==="string"){_search=data.searchColumns.split(" ");}else{_search=data.searchColumns;}for(var z=0;z<_search.length;z++){var item=_search[z].trim();if(item.length>0){if(this.searchColumns.indexOf(item)<0){this.searchColumns.push(item);}}}}}if(!id){return;}if(this.$element){if(data["columns"]){for(var _i4 in data["columns"]){if(data["columns"].hasOwnProperty(_i4)===false){continue;}var col=new Column();var column=data["columns"][_i4];col.label=column.id;col.attribute=col["attribute"]||column.id;col.$element=document.createElement("th");col.$element.innerHTML=col.label;col.$element.draggable=true;col.$resize=document.createElement("div");col.$resize.classList.add("resize");col.$element.appendChild(col.$resize);this.addHeaderInfo(col);this.columns.push(col);this.tableOption.parentElement.insertBefore(col.$element,this.tableOption);}for(var _i5 in this.showedItems){var _item=this.showedItems[_i5];var _cell=void 0;while(_item.gui.children.length<this.columns.length){_cell=document.createElement("td");_item.gui.appendChild(_cell);}while(_item.gui.children.length>this.columns.length){_item.gui.removeChild(_item.gui.children[_item.gui.children.length-1]);}for(var c=0;c<this.columns.length;c++){var name=this.columns[c].attribute;var count=this.columns.length;_cell=_item.gui.children[c];_cell.innerHTML=_item.model.getValue(name);}}}return;}var table=document.getElementById(id);var headerrow=void 0;if(table){if(!this.property){this.property=table.getAttribute("property");}}else{table=document.createElement("table");document.getElementsByTagName("body")[0].appendChild(table);}this.$element=table;if(!this.$bodysection){this.$bodysection=document.createElement("tbody");table.appendChild(this.$bodysection);}if(data["classname"]){table.className=data["classname"];}else{table.className="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp";}this.id=id;table.id=id;table.setAttribute("type",this.constructor["name"].toLowerCase());var i=0;for(var _c in table.children){if(table.children.hasOwnProperty(_c)===false){continue;}var row=table.children[_c];if(row instanceof HTMLTableSectionElement){if(row.tagName=="THEAD"){headerrow=row;for(var r in row.children){if(row.children.hasOwnProperty(r)===false){continue;}this.parsingHeader(row.children[r]);}}else{for(var _r in row.children){if(row.children.hasOwnProperty(_r)===false){continue;}this.parsingData(row.children[_r]);}}}else{if(i==0){headerrow=row;this.parsingHeader(row);}else{this.parsingData(row);}}i++;}if(!headerrow||!this.$headersection){if(!this.$headersection){var header=table.getElementsByTagName("thead");if(header.length==0){this.$headersection=document.createElement("thead");table.appendChild(this.$headersection);}else{this.$headersection=header.item(0);}}if(!headerrow){headerrow=document.createElement("tr");this.$headersection.appendChild(headerrow);}}if(data["columns"]){for(var _i6 in data["columns"]){if(data["columns"].hasOwnProperty(_i6)===false){continue;}var _col=new Column();var _column=data["columns"][_i6];_col.label=_column.id;_col.attribute=_col["attribute"]||_column.id;_col.$element=document.createElement("th");_col.$element.innerHTML=_col.label;_col.$element.draggable=true;_col.$resize=document.createElement("div");_col.$resize.classList.add("resize");_col.$element.appendChild(_col.$resize);this.addHeaderInfo(_col);this.columns.push(_col);headerrow.appendChild(_col.$element);}this.tableOption=document.createElement("th");this.tableOption.classList.add("tableOption");headerrow.appendChild(this.tableOption);var context=this.addOptionItem(null,this.tableOption,true);var contentChild=this.addOptionItem("show",context,true);var simpleLink=this.addOptionItem("show",contentChild,false);}this.registerEvents(['mousemove','mousedown','mouseup','resize','dragstart','dragover','drop','dragend']);var searchBar=document.createElement("tr");var cell=document.createElement("td");cell.setAttribute("colspan",""+this.columns.length);searchBar.appendChild(cell);var search=document.createElement("input");search.className="search";var that=this;search.addEventListener('keyup',function(evt){that.search(evt.target["value"]);});cell.appendChild(search);if(this.resultColumn){if(this.resultColumn.startsWith("#")==false){this.countElement=document.createElement("div");searchBar.appendChild(this.countElement);}else{for(var _z=0;_z<this.$headersection.children.length;_z++){if(this.$headersection.children[_z].innerHTML===this.resultColumn){this.countColumn=this.$headersection.children[_z];this.countColumnPos=_z;break;}}}}var first=this.$headersection.children.item(0);this.$headersection.insertBefore(searchBar,first);}},{key:"addOptionItem",value:function addOptionItem(label,parent,sub){var labelControl=void 0;if(label){labelControl=document.createElement("a");labelControl.appendChild(document.createTextNode(label));labelControl.href="javascript:void(0);";parent.appendChild(labelControl);}if(sub){var _ret=function(){var context=document.createElement("div");context.classList.add("dropdown-content");context.style.setProperty("position","absolute");parent.appendChild(context);parent.addEventListener('click',function(){context.classList.toggle("show");},false);return{v:context};}();if((typeof _ret==="undefined"?"undefined":_typeof(_ret))==="object")return _ret.v;}return labelControl;}},{key:"registerEvents",value:function registerEvents(events){var _this15=this;var that=this;var _loop=function _loop(_i7){_this15.$element.addEventListener(events[_i7],function(evt){return that.tableEvent(events[_i7],evt);});};for(var _i7=0;_i7<events.length;_i7++){_loop(_i7);}}},{key:"tableEvent",value:function tableEvent(type,e){var button=0;var eventX=0;if(e instanceof MouseEvent){button=e.buttons;eventX=e.pageX;}if(type=='mouseup'){this.moveElement=null;}else if(type=='mousedown'||type=='resize'){this.moveElement=null;if(button==1){var c=void 0;for(c=0;c<this.columns.length;c++){if(this.columns[c].$resize===e.target){this.moveElement=this.columns[c];this.movePos=c;this.isDrag=false;break;}else if(this.columns[c].$element===e.target){this.moveElement=this.columns[c];this.movePos=c;this.isDrag=true;}}this.moveTimeStamp=e.timeStamp;this.moveX=eventX;}else{this.moveTimeStamp=0;}}else if(type=='mousemove'){if(button==1&&this.moveElement){if(this.moveTimeStamp&&e.timeStamp-this.moveTimeStamp<2000){if(this.isDrag){}else{var x=eventX-this.moveX;var width=this.moveElement.$element.offsetWidth;this.moveElement.$element.width=""+(width+x);e.stopPropagation();}}this.moveX=eventX;this.moveTimeStamp=e.timeStamp;}}else if(this.isDrag){this.columnDragEvent(type,e);}}},{key:"columnDragEvent",value:function columnDragEvent(type,e){if(type=='dragstart'){this.moveElement.$element.style.opacity='0.4';e.dataTransfer.effectAllowed='move';e.dataTransfer.setData('text/json',JSON.stringify(util.toJson(this.moveElement)));}else if(type=='dragenter'){}else if(type=='dragleave'){this.moveElement.$element.classList.remove('over');}else if(type=='dragover'){if(e.preventDefault){e.preventDefault();}for(var c=0;c<this.columns.length;c++){if(this.columns[c].$element==e.target){this.dragColumn=this.columns[c];this.dragPos=c;this.columns[c].$element.classList.add('over');}else{this.columns[c].$element.classList.remove('over');}}if(e.target==this.tableOption){this.tableOption.classList.add('over');this.dragPos=this.columns.length;}else{this.tableOption.classList.remove('over');}e.dataTransfer.dropEffect='move';}else if(type=='drop'){if(e.stopPropagation){e.stopPropagation();}if(this.movePos==this.dragPos){return;}this.columns.splice(this.movePos,1);if(this.movePos>=this.dragPos){this.columns.splice(this.dragPos,0,this.moveElement);}else{this.columns.splice(this.dragPos-1,0,this.moveElement);}var line=this.moveElement.$element.parentElement;line.removeChild(this.moveElement.$element);if(this.dragPos<this.columns.length){line.insertBefore(this.moveElement.$element,this.dragColumn.$element);}else{line.insertBefore(this.moveElement.$element,this.tableOption);}var oldElement=void 0;var newElement=void 0;for(var _i8=0;_i8<this.$bodysection.children.length;_i8++){line=this.$bodysection.children.item(_i8);oldElement=line.children.item(this.movePos);newElement=line.children.item(this.dragPos);line.removeChild(oldElement);line.insertBefore(oldElement,newElement);}}else if(type=='dragend'){this.moveElement.$element.style.opacity='1';for(var _i9=0;_i9<this.columns.length;_i9++){this.columns[_i9].$element.classList.remove('over');}this.tableOption.classList.remove('over');}}},{key:"parsingHeader",value:function parsingHeader(row){for(var _i10 in row.children){if(row.children.hasOwnProperty(_i10)===false){continue;}var column=row.children[_i10];var id=column.innerHTML.trim();var col=null;for(var c in this.columns){if(this.columns.hasOwnProperty(_i10)===false){continue;}if(this.columns[c].label==id){col=this.columns[c];col.$element=column;break;}}if(col===null){col=new Column();col.label=id;col.attribute=column.getAttribute("attribute");col.$element=column;this.columns.push(col);}this.addHeaderInfo(col);}}},{key:"addHeaderInfo",value:function addHeaderInfo(col){var element=col.$element;var that=this;element.classList.add("sort");element.addEventListener('click',function(){that.sort(col);},false);}},{key:"parsingData",value:function parsingData(row){var id=row.getAttribute("id");var item=this.$owner.getItem(id);for(var _i11 in row.children){if(row.children.hasOwnProperty(_i11)===false){continue;}var cell=row.children[_i11];var colAttribute=this.columns[_i11].attribute;if(colAttribute.indexOf("\.")<0){item[colAttribute]=cell.innerHTML.trim();}}}},{key:"propertyChange",value:function propertyChange(entity,property,oldValue,newValue){if(entity){if(this.property&&this.property!==entity.property){return;}}if(!entity.id){return;}var item=this.itemsIds[entity.id];var row=void 0;if(!item){item=new BridgeElement(entity);this.items.add(item);this.itemsIds[entity.id]=item;}row=this.cells[entity.id];if(row){item.gui=row;}if(this.searching(item)==false){return;}var cell=void 0;var showItem=false;if(!row){showItem=true;row=document.createElement("tr");var count=this.columns.length;for(var _i12=0;_i12<count;_i12++){cell=document.createElement("td");row.appendChild(cell);}this.cells[entity.id]=row;item.gui=row;}for(var c=0;c<this.columns.length;c++){var name=this.columns[c].attribute;if(name===property){cell=row.children[c];cell.innerHTML=newValue;}}if(showItem){this.showItem(item,true);}}},{key:"sort",value:function sort(column){if(this.sortColumn==column){if(this.direction==1){this.direction=-1;column.$element.classList.remove("asc");column.$element.classList.add("desc");}else{this.direction=1;column.$element.classList.remove("desc");column.$element.classList.add("asc");}}else{if(this.sortColumn!=null){this.sortColumn.$element.classList.remove("desc");this.sortColumn.$element.classList.remove("asc");}this.sortColumn=column;this.sortColumn.$element.classList.add("asc");this.direction=1;}var that=this;var sort=function sort(a,b){return that.sorting(a,b);};this.showedItems.sort(sort);var len=this.showedItems.length;var body=this.$bodysection;var i=0;while(i<len){var item=this.showedItems[i];if(i!=Table.indexOfChild(item)){break;}i=i+1;}while(body.children.length>i){body.removeChild(body.children.item(body.children.length-1));}while(i<len){var _item2=this.showedItems[i];body.appendChild(_item2.gui);i=i+1;}}},{key:"sorting",value:function sorting(a,b){var path=this.sortColumn.attribute.split(".");var itemA=a.model.values;var itemB=b.model.values;var check=this.sortColumn.attribute;for(var p=0;p<path.length;p++){check=path[p];if(itemA[check]){itemA=itemA[check];}else{return 0;}if(itemB[check]){itemB=itemB[check];}else{return 0;}}if(itemA!=itemB){if(this.direction==1){return itemA<itemB?-1:1;}return itemA<itemB?1:-1;}return 0;}},{key:"search",value:function search(origSearchText){if(!origSearchText){origSearchText="";}var searchText=origSearchText.trim().toLowerCase();if(searchText==this.lastSearchText&&searchText!=""){return 0;}var oldSearch=this.lastSearchText;this.lastSearchText=searchText;this.parseSearchArray();if(searchText!=""&&oldSearch!=null&&searchText.indexOf(oldSearch)>=0&&searchText.indexOf("|")<0){this.searchArray(this.showedItems);}else{this.searchSet(this.items);}this.refreshCounter();}},{key:"refreshCounter",value:function refreshCounter(){if(this.countColumn){this.countColumn.innerHTML=this.columns[this.countColumnPos].label+" ("+this.showedItems.length+")";}}},{key:"parseSearchArray",value:function parseSearchArray(){var pos=0;var split=[];var quote=false;for(var _i13=0;_i13<this.lastSearchText.length;_i13++){if(this.lastSearchText.charAt(_i13)==" "&&!quote){var txt=this.lastSearchText.substring(pos,_i13).trim();if(txt.length>0){split.push(txt);}pos=_i13+1;}else if(this.lastSearchText.charAt(_i13)=="\""){if(quote){var _txt=this.lastSearchText.substring(pos,_i13).trim();if(_txt.length>0){split.push(_txt);}pos=_i13+1;}else{pos=_i13+1;}quote=!quote;}}if(pos<this.lastSearchText.length){split.push(this.lastSearchText.substring(pos,this.lastSearchText.length).trim());}this.searchText=split;return split;}},{key:"searchArray",value:function searchArray(root){this.showedItems=[];for(var _i14=0;_i14<root.length;_i14++){var item=root[_i14];this.showItem(item,this.searching(item));}}},{key:"searchSet",value:function searchSet(root){this.showedItems=[];var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{for(var _iterator10=root[Symbol.iterator](),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){var item=_step10.value;var child=item;this.showItem(child,this.searching(child));}}catch(err){_didIteratorError10=true;_iteratorError10=err;}finally{try{if(!_iteratorNormalCompletion10&&_iterator10.return){_iterator10.return();}}finally{if(_didIteratorError10){throw _iteratorError10;}}}}},{key:"showItem",value:function showItem(item,visible){if(visible){this.showedItems.push(item);this.$bodysection.appendChild(item.gui);}else if(item.gui&&item.gui.parentElement){this.$bodysection.removeChild(item.gui);}}},{key:"searching",value:function searching(item){var fullText="";for(var _i15=0;_i15<this.searchColumns.length;_i15++){fullText=fullText+" "+item.model.getValue(this.searchColumns[_i15]);}fullText=fullText.trim().toLowerCase();for(var z=0;z<this.searchText.length;z++){if(""!=this.searchText[z]){var orSplit=void 0;if(this.searchText[z].indexOf("|")>0){orSplit=this.searchText[z].split("|");}else{orSplit=[this.searchText[z]];}var o=0;for(;o<orSplit.length;o++){var pos=orSplit[o].indexOf(":");if(orSplit[o].indexOf("#")==0&&pos>1){var _value=orSplit[o].substring(pos+1);var column=orSplit[o].substring(1,pos-1);var dataValue=item.model.getValue(column);if(dataValue){if(dataValue.toString().toLowerCase().indexOf(_value)>=0){break;}}}else if(orSplit[o].length>1&&orSplit[o].indexOf("-")==0){if(fullText.indexOf(orSplit[o].substring(1))<0){break;}}else if(fullText.indexOf(orSplit[o])>=0){break;}}if(o==orSplit.length){return false;}}}return true;}},{key:"getColumn",value:function getColumn(){return this.columns;}}],[{key:"indexOfChild",value:function indexOfChild(item){var i=0;var child=item.gui;while((child=child.previousSibling)!=null){i++;}return i;}}]);return Table;}(Control);var Column=function Column(){_classCallCheck(this,Column);};var nodes=Object.freeze({Node:Node,Clazz:Clazz,SO:SO,Symbol:_Symbol,SymbolLibary:SymbolLibary,BR:BR,Button:Button,Div:Div,Form:Form,Input:Input,Label:Label,Table:Table});var Adapter=function Adapter(){_classCallCheck(this,Adapter);this.id=null;};var Direction;(function(Direction){Direction[Direction["Up"]=0]="Up";Direction[Direction["Down"]=1]="Down";Direction[Direction["Left"]=2]="Left";Direction[Direction["Right"]=3]="Right";})(Direction||(Direction={}));var Edge=function(_DiagramElement4){_inherits(Edge,_DiagramElement4);function Edge(parent,id,type){_classCallCheck(this,Edge);var _this16=_possibleConstructorReturn(this,(Edge.__proto__||Object.getPrototypeOf(Edge)).call(this,parent));_this16.$points=[];_this16.property=type||'Edge';_this16.id=id;return _this16;}_createClass(Edge,[{key:"init",value:function init(data){}},{key:"withItem",value:function withItem(source,target){source.edges.push(this);target.edges.push(this);this.$sNode=source;this.$tNode=target;this.source=source.id;this.target=target.id;return this;}},{key:"getSVG",value:function getSVG(){var path="";if(this.$points.length>0){path='M';}for(var _i16=0; _i16<this.$points.length; _i16++){var point=new Point(this.$points[_i16].getPos().x,this.$points[_i16].getPos().y);if(_i16>0){path+='L';}path+=Math.floor(point.x)+' '+Math.floor(point.y)+' ';}var attr={tag:'path',id:this.id,d:path,stroke:'black','stroke-width':'3',fill:'none'};var shape=this.createShape(attr);this.$viewElement=shape;return shape;}},{key:"redraw",value:function redraw(){var a=this.getShortestPathIntersection(this.$sNode,this.$tNode.getPos());var b=this.getShortestPathIntersection(this.$tNode,this.$sNode.getPos());this.$viewElement.setAttribute('d',"M"+a.x+" "+a.y+" L"+b.x+" "+b.y);}},{key:"calc",value:function calc(board){var result=void 0,options=void 0,linetyp=void 0,sourcePos=void 0,targetPos=void 0,divisor=void 0,startNode=void 0,endNode=void 0;startNode=this.$sNode.getShowed();endNode=this.$tNode.getShowed();divisor=endNode.getCenter().x-startNode.getCenter().x;this.$points=[];if(divisor===0){if(startNode===endNode){return false;}if(startNode.getCenter().y<endNode.getCenter().y){sourcePos=startNode.getCenterPosition(Point.DOWN);targetPos=endNode.getCenterPosition(Point.UP);}else{sourcePos=startNode.getCenterPosition(Point.UP);targetPos=endNode.getCenterPosition(Point.DOWN);}}else{options=this.$owner["options"];if(options){linetyp=options.linetyp;}result=false;if(linetyp==="square"){result=this.calcSquareLine();}if(!result){this.$m=(endNode.getCenter().y-startNode.getCenter().y)/divisor;this.$n=startNode.getCenter().y-startNode.getCenter().x*this.$m;sourcePos=util.getPosition(this.$m,this.$n,startNode,endNode.getCenter());targetPos=util.getPosition(this.$m,this.$n,endNode,sourcePos);}}if(sourcePos&&targetPos){if(this.sourceInfo){this.calcInfoPos(sourcePos,startNode,this.sourceInfo);}if(this.targetInfo){this.calcInfoPos(targetPos,endNode,this.targetInfo);}startNode["$"+sourcePos.$id]+=1;endNode["$"+targetPos.$id]+=1;var line=new Line(this,this.lineStyle);line.source=sourcePos;line.target=targetPos;this.$points.push(line);if(this.info){this.info.withPos((sourcePos.x+targetPos.x)/2,(sourcePos.y+targetPos.y)/2);}}return true;}},{key:"addLineTo",value:function addLineTo(x1,y1,x2,y2){var start=void 0,end=void 0;if(!x2&&!y2){if(this.$points.length>0){start=this.$points[this.$points.length-1].target;end=new Point(start.x+x1,start.y+y1);}else{start=new Point(x1,y1);end=new Point(x1,y1);}}else{start=new Point(x1,y1);end=new Point(start.x+x2,start.y+y2);}var line=new Line(this,this.lineStyle);line.source=start;line.target=end;this.$points.push(line);}},{key:"addLine",value:function addLine(x1,y1,x2,y2){var start=void 0,end=void 0;if(!x2&&!y2){if(this.$points.length>0){start=this.$points[this.$points.length-1].target;end=new Point(x1,y1);}else{start=new Point(x1,y1);end=start;}}else{start=new Point(x1,y1);end=new Point(x2,y2);}var line=new Line(this,this.lineStyle);line.source=start;line.target=end;this.$points.push(line);}},{key:"calcInfoPos",value:function calcInfoPos(linePos,item,info){var newY=void 0,newX=void 0,spaceA=20,spaceB=0,step=15;if(item.$parent.options&&!item.$parent.options.rotatetext){spaceA=20;spaceB=10;}if(info.custom||info.getText().length<1){return;}newY=linePos.y;newX=linePos.x;var size=info.getSize();if(linePos.$id===Point.UP){newY=newY-size.y-spaceA;if(this.$m!==0){newX=(newY-this.$n)/this.$m+spaceB+item.$UP*step;}}else if(linePos.$id===Point.DOWN){newY=newY+spaceA;if(this.$m!==0){newX=(newY-this.$n)/this.$m+spaceB+item.$DOWN*step;}}else if(linePos.$id===Point.LEFT){newX=newX-size.x-item.$LEFT*step-spaceA;if(this.$m!==0){newY=this.$m*newX+this.$n;}}else if(linePos.$id===Point.RIGHT){newX+=item.$RIGHT*step+spaceA;if(this.$m!==0){newY=this.$m*newX+this.$n;}}info.withPos(Math.ceil(newX),Math.ceil(newY));}},{key:"calcSquareLine",value:function calcSquareLine(){var startPos=this.$sNode.getPos();var startSize=this.$sNode.getSize();var endPos=this.$tNode.getPos();var endSize=this.$tNode.getSize();if(startPos.y-40>endPos.y+endSize.y){this.addLineTo(startPos.x+startSize.x/2,startPos.y,0,-20);this.addLine(endPos.x+endSize.x/2,endPos.y+endSize.y+20);this.addLineTo(0,-20);return true;}if(endPos.y-40>startPos.y+startSize.y){this.addLineTo(startPos.x+startSize.x/2,startPos.y+startSize.y,0,+20);this.addLine(endPos.x+endSize.x/2,endPos.y-20);this.addLineTo(0,20);return true;}this.addLineTo(startPos.x+startSize.x/2,startPos.y,0,-20);this.addLine(endPos.x+endSize.x/2,endPos.y-20);this.addLineTo(0,20);return true;}},{key:"calcOffset",value:function calcOffset(){var i,z,min=new Point(999999999,999999999),max=new Point(0,0),item,svg,value,x,y;for(i=0;i<this.$points.length;i+=1){item=this.$points[i];if(item.typ==Line.FORMAT.PATH){value=document.createElement('div');svg=util.create({tag:"svg"});svg.appendChild(item.draw());value=svg.childNodes[0];x=y=0;if(!value.pathSegList){continue;}for(z=0;z<value.pathSegList.length;z+=1){item=value.pathSegList[z];switch(item.pathSegType){case SVGPathSeg.PATHSEG_MOVETO_ABS:case SVGPathSeg.PATHSEG_LINETO_ABS:case SVGPathSeg.PATHSEG_ARC_ABS:case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:x=item.x;y=item.y;break;case SVGPathSeg.PATHSEG_MOVETO_REL:case SVGPathSeg.PATHSEG_LINETO_REL:case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:case SVGPathSeg.PATHSEG_ARC_REL:x=x+item.x;y=y+item.y;break;}util.Range(min,max,x,y);}}else{util.Range(min,max,item.source.x,item.source.y);util.Range(min,max,item.target.x,item.target.y);}}return{x:min.x,y:min.y,width:max.x-min.x,height:max.y-min.y};}},{key:"getDirection",value:function getDirection(a,b){if(b.x<a.x){return 2;}if(b.x>a.x){return 3;}if(b.y<a.y){return 0;}if(b.y>a.y){return 1;}}},{key:"getShortestPathIntersection",value:function getShortestPathIntersection(node,point){var x=point.x;var y=point.y;var minX=node.getPos().x-node.getSize().x/2;var minY=node.getPos().y-node.getSize().y/2;var maxX=minX+node.getSize().x;var maxY=minY+node.getSize().y;var midX=(minX+maxX)/2;var midY=(minY+maxY)/2;var m=(midY-y)/(midX-x);if(x<=midX){var minXy=m*(minX-x)+y;if(minY<minXy&&minXy<maxY){return new Point(minX,minXy);}}if(x>=midX){var maxXy=m*(maxX-x)+y;if(minY<maxXy&&maxXy<maxY){return new Point(maxX,maxXy);}}if(y<=midY){var minYx=(minY-y)/m+x;if(minX<minYx&&minYx<maxX){return new Point(minYx,minY);}}if(y>=midY){var maxYx=(maxY-y)/m+x;if(minX<maxYx&&maxYx<maxX){return new Point(maxYx,maxY);}}}}]);return Edge;}(DiagramElement);var Aggregation=function(_Edge){_inherits(Aggregation,_Edge);function Aggregation(){_classCallCheck(this,Aggregation);return _possibleConstructorReturn(this,(Aggregation.__proto__||Object.getPrototypeOf(Aggregation)).apply(this,arguments));}_createClass(Aggregation,[{key:"getSVG",value:function getSVG(){var line=_get(Aggregation.prototype.__proto__||Object.getPrototypeOf(Aggregation.prototype),"getSVG",this).call(this);var endLine=this.$points[this.$points.length-1];var direction=this.getDirection(endLine.source,endLine.target);var x=endLine.getPos().x;var y=endLine.getPos().y;var path=void 0;switch(direction){case 0:path="M"+x+" "+(y-1)+" L"+(x+10)+" "+(y-11)+" L"+x+" "+(y-21)+" L"+(x-10)+" "+(y-11)+" Z";break;case 1:path="M"+x+" "+y+" L"+(x+10)+" "+(y-10)+" L"+x+" "+(y-20)+" L"+(x-10)+" "+(y-10)+" Z";break;case 2:path="M"+x+" "+y+" L"+(x-10)+" "+(y-10)+" L"+(x-20)+" "+y+" L"+(x-10)+" "+(y+10)+" Z";break;case 3:path="M"+x+" "+y+" L"+(x+10)+" "+(y-10)+" L"+(x+20)+" "+y+" L"+(x+10)+" "+(y+10)+" Z";break;}var attr={tag:'path',d:path,stroke:'black','stroke-width':'2',fill:'white'};var connector=this.createShape(attr);var group=this.createShape({tag:'g'});group.appendChild(line);group.appendChild(connector);return group;}}]);return Aggregation;}(Edge);var Composition=function(_Edge2){_inherits(Composition,_Edge2);function Composition(){_classCallCheck(this,Composition);return _possibleConstructorReturn(this,(Composition.__proto__||Object.getPrototypeOf(Composition)).apply(this,arguments));}return Composition;}(Edge);var Generalisation=function(_Edge3){_inherits(Generalisation,_Edge3);function Generalisation(){_classCallCheck(this,Generalisation);return _possibleConstructorReturn(this,(Generalisation.__proto__||Object.getPrototypeOf(Generalisation)).apply(this,arguments));}return Generalisation;}(Edge);var Implements=function(_Generalisation){_inherits(Implements,_Generalisation);function Implements(){_classCallCheck(this,Implements);return _possibleConstructorReturn(this,(Implements.__proto__||Object.getPrototypeOf(Implements)).apply(this,arguments));}return Implements;}(Generalisation);var Unidirectional=function(_Edge4){_inherits(Unidirectional,_Edge4);function Unidirectional(){_classCallCheck(this,Unidirectional);return _possibleConstructorReturn(this,(Unidirectional.__proto__||Object.getPrototypeOf(Unidirectional)).apply(this,arguments));}return Unidirectional;}(Edge);var edges=Object.freeze({get Direction(){return Direction;},Edge:Edge,Aggregation:Aggregation,Composition:Composition,Generalisation:Generalisation,Implements:Implements,Unidirectional:Unidirectional});var DagreLayout=function(){function DagreLayout(){_classCallCheck(this,DagreLayout);}_createClass(DagreLayout,[{key:"layout",value:function layout(graph){if(!window["dagre"]){return;}var model=graph.model;var g=new window["dagre"].graphlib.Graph();g.setGraph({marginx:0,marginy:0}).setDefaultEdgeLabel(function(){return{};});if(model.nodes){for(var id in model.nodes){var node=model.nodes[id];g.setNode(id,{width:node.getSize().x,height:node.getSize().y});}}if(model.edges){for(var _id2 in model.edges){var edge=model.edges[_id2];g.setEdge(edge.$sNode.id,edge.$tNode.id);}}window["dagre"].layout(g);g.nodes().forEach(function(v){model.nodes[v].pos.x=g.node(v).x;model.nodes[v].pos.y=g.node(v).y;});g.edges().forEach(function(e){for(var _id3 in model.edges){var _edge=model.edges[_id3];if(_edge.$sNode.id===e.v&&_edge.$tNode.id===e.w){var size=g.edge(e).points.length;for(var _i17=0;_i17<size;_i17++){var point=g.edge(e).points[_i17];_edge.addLine(point.x,point.y);}}}});}}]);return DagreLayout;}();var Random=function(){function Random(){_classCallCheck(this,Random);}_createClass(Random,[{key:"layout",value:function layout(graph){var model=graph.model;if(model.nodes){for(var id in model.nodes){var node=model.nodes[id];var pos=node.getPos();if(pos.x===0&&pos.y===0){var x=util.getRandomInt(0,graph.canvasSize.width);var y=util.getRandomInt(0,graph.canvasSize.height);node.withPos(x,y);}}}}}]);return Random;}();new DagreLayout();new Random();var layouts=Object.freeze({DagreLayout:DagreLayout,Random:Random});var Model=function(_DiagramElement5){_inherits(Model,_DiagramElement5);function Model(graph){_classCallCheck(this,Model);var _this22=_possibleConstructorReturn(this,(Model.__proto__||Object.getPrototypeOf(Model)).call(this,null));_this22.nodes={};_this22.edges={};_this22.counter=0;_this22.$graph=graph;return _this22;}_createClass(Model,[{key:"init",value:function init(data){data=data||{};this.property=data.type||'classdiagram';this.id='RootElement';if(data.nodes){var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=data.nodes[Symbol.iterator](),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){var node=_step11.value;this.addNode(node);}}catch(err){_didIteratorError11=true;_iteratorError11=err;}finally{try{if(!_iteratorNormalCompletion11&&_iterator11.return){_iterator11.return();}}finally{if(_didIteratorError11){throw _iteratorError11;}}}}if(data.edges){var _iteratorNormalCompletion12=true;var _didIteratorError12=false;var _iteratorError12=undefined;try{for(var _iterator12=data.edges[Symbol.iterator](),_step12;!(_iteratorNormalCompletion12=(_step12=_iterator12.next()).done);_iteratorNormalCompletion12=true){var edge=_step12.value;this.addEdge(edge);}}catch(err){_didIteratorError12=true;_iteratorError12=err;}finally{try{if(!_iteratorNormalCompletion12&&_iterator12.return){_iterator12.return();}}finally{if(_didIteratorError12){throw _iteratorError12;}}}}this.initCanvas();}},{key:"addElement",value:function addElement(type){type=util.toPascalCase(type);var id=this.getNewId(type);var element=this.getElement(type,id,{});if(element){return true;}return false;}},{key:"removeElement",value:function removeElement(id){if(this.nodes[id]){var node=this.nodes[id];delete this.nodes[id];var _iteratorNormalCompletion13=true;var _didIteratorError13=false;var _iteratorError13=undefined;try{for(var _iterator13=node.edges[Symbol.iterator](),_step13;!(_iteratorNormalCompletion13=(_step13=_iterator13.next()).done);_iteratorNormalCompletion13=true){var edge=_step13.value;delete this.edges[edge.id];}}catch(err){_didIteratorError13=true;_iteratorError13=err;}finally{try{if(!_iteratorNormalCompletion13&&_iterator13.return){_iterator13.return();}}finally{if(_didIteratorError13){throw _iteratorError13;}}}}else if(this.edges[id]){delete this.edges[id];}else{return false;}this.$graph.layout();return true;}},{key:"getSVG",value:function getSVG(){var size=10;var path="M"+-size+" 0 L"+ +size+" 0 M0 "+-size+" L0 "+ +size;var attr={tag:'path',id:'origin',d:path,stroke:'#999','stroke-width':'1',fill:'none'};var shape=this.createShape(attr);var attrText={tag:'text',x:0-size,y:0-size/1.5,'text-anchor':'end','font-family':'Verdana','font-size':'9',fill:'#999'};var text=this.createShape(attrText);text.textContent='(0, 0)';var group=this.createShape({tag:'g'});group.appendChild(shape);group.appendChild(text);return group;}},{key:"initCanvas",value:function initCanvas(){this.$graph.canvasSize={width:this.$graph.root.clientWidth,height:this.$graph.root.clientHeight};this.$graph.canvas=util.createShape({tag:'svg',id:'root',width:this.$graph.canvasSize.width,height:this.$graph.canvasSize.height});this.$viewElement=this.$graph.canvas;this.$graph.root.appendChild(this.$graph.canvas);var mousewheel='onwheel'in document.createElement('div')?'wheel':document.onmousewheel!==undefined?'mousewheel':'DOMMouseScroll';}},{key:"getNewId",value:function getNewId(prefix){this.counter++;var id=(prefix?prefix.toLowerCase()+'-':'')+Math.floor(Math.random()*100000);return id;}},{key:"addNode",value:function addNode(node){var type=node["type"]||node.property||'Node';type=util.toPascalCase(type);var id=this.getNewId(type);return this.getElement(type,id,node);}},{key:"findNodeById",value:function findNodeById(id){if(this.nodes[id]){return this.nodes[id];}return false;}},{key:"findNodeByLabel",value:function findNodeByLabel(label){for(var index in this.nodes){var node=this.nodes[index];if(node.label===label){return node;}}}},{key:"addEdge",value:function addEdge(edge){var type=edge.type||'Edge';type=util.toPascalCase(type);var id=this.getNewId(type);var newEdge=this.getElement(type,id,edge);var source=this.findNodeByLabel(edge.source)||this.addNode(new Node(this).init({label:edge.source}));var target=this.findNodeByLabel(edge.target)||this.addNode(new Node(this).init({label:edge.target}));newEdge.withItem(source,target);return newEdge;}},{key:"getElement",value:function getElement(type,id,data){if(this.$graph.nodeFactory[type]){var element=new this.$graph.nodeFactory[type](this,id,type);element.init(data);this.nodes[id]=element;return element;}if(this.$graph.edgeFactory[type]){var _element2=new this.$graph.edgeFactory[type](this,id,type);_element2.init(data);this.edges[id]=_element2;return _element2;}}}]);return Model;}(DiagramElement);var buttons={clazz:'<svg width="100%" height="100%" viewbox="0 0 550 450"><g><rect width="500" height="400" x="25" y="25" rx="5" ry="5" stroke-width="10" stroke="black" fill="none"/><rect width="500" height="125" x="25" y="180" stroke-width="7" stroke="black" fill="none"/><text x="275" y="140" text-anchor="middle" font-size="111">Class</text><text x="50" y="240" font-size="50">+ field: type</text><text x="50" y="360" font-size="50">+ method(type)</text></g></svg>',object:'<svg width="100%" height="100%" viewbox="0 0 550 450"><g><rect width="500" height="400" x="25" y="25" rx="5" ry="5" stroke-width="10" stroke="black" fill="none"/><text x="275" y="150" text-anchor="middle" font-size="111" text-decoration="underline">:Object</text><line x1="25" y1="275" x2="525" y2="275" stroke-width="7" stroke="black"/><text x="50" y="350" font-size="50">attribute = value</text></g></svg>',edge:'<svg width="100%" height="100%" viewbox="-100 0 600 500"><text x="125" y="250" font-size="140" text-anchor="middle" transform="rotate(-45 125 250)">Edge</text><polygon points="25,510 40,525 450,115 490,180 525,25 370,60 435,100"/></svg>'};var Palette=function(){function Palette(graph){_classCallCheck(this,Palette);this.graph=graph;var div=document.createElement('div');div.className='palette';document.body.appendChild(div);this.palette=div;this.addButtons();}_createClass(Palette,[{key:"addButtons",value:function addButtons(){var _this23=this;var _loop2=function _loop2(btn){var button=document.createElement('button');button.className='add'+btn+'Btn';button.innerHTML=buttons[btn];button.onclick=function(e){return _this23.graph.addElement(btn);};if(btn==='object'||btn==='edge'){button.disabled=true;}_this23.palette.appendChild(button);};for(var btn in buttons){_loop2(btn);}}}]);return Palette;}();;var EventBus=function(){function EventBus(){_classCallCheck(this,EventBus);}_createClass(EventBus,null,[{key:"register",value:function register(diagramElement){for(var _len=arguments.length,eventTypes=Array(_len>1?_len-1:0),_key=1; _key<_len; _key++){eventTypes[_key-1]=arguments[_key];}var _iteratorNormalCompletion14=true;var _didIteratorError14=false;var _iteratorError14=undefined;try{for(var _iterator14=eventTypes[Symbol.iterator](),_step14; !(_iteratorNormalCompletion14=(_step14=_iterator14.next()).done); _iteratorNormalCompletion14=true){var event=_step14.value;diagramElement.$viewElement.addEventListener(event,EventBus.publish.bind(null,diagramElement));}}catch(err){_didIteratorError14=true;_iteratorError14=err;}finally{try{if(!_iteratorNormalCompletion14&&_iterator14.return){_iterator14.return();}}finally{if(_didIteratorError14){throw _iteratorError14;}}}}},{key:"registerSVG",value:function registerSVG(diagramElement){for(var type in EventBus.handlers.keys()){console.log(type);}}},{key:"publish",value:function publish(element, event){var handlers=EventBus.handlers.get(event.type);if(handlers){var _iteratorNormalCompletion15=true;var _didIteratorError15=false;var _iteratorError15=undefined;try{for(var _iterator15=handlers[Symbol.iterator](),_step15;!(_iteratorNormalCompletion15=(_step15=_iterator15.next()).done);_iteratorNormalCompletion15=true){var handler=_step15.value;handler.handle(event,element);}}catch(err){_didIteratorError15=true;_iteratorError15=err;}finally{try{if(!_iteratorNormalCompletion15&&_iterator15.return){_iterator15.return();}}finally{if(_didIteratorError15){throw _iteratorError15;}}}}}},{key:"subscribe",value:function subscribe(handler){for(var _len2=arguments.length,eventTypes=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){eventTypes[_key2-1]=arguments[_key2];}var _iteratorNormalCompletion16=true;var _didIteratorError16=false;var _iteratorError16=undefined;try{for(var _iterator16=eventTypes[Symbol.iterator](),_step16;!(_iteratorNormalCompletion16=(_step16=_iterator16.next()).done);_iteratorNormalCompletion16=true){var event=_step16.value;var handlers=EventBus.handlers.get(event);if(handlers===null||handlers===undefined){handlers=[];EventBus.handlers.set(event,handlers);}handlers.push(handler);}}catch(err){_didIteratorError16=true;_iteratorError16=err;}finally{try{if(!_iteratorNormalCompletion16&&_iterator16.return){_iterator16.return();}}finally{if(_didIteratorError16){throw _iteratorError16;}}}}}]);return EventBus;}();EventBus.ELEMENTCREATE="ELEMENT:CREATE";EventBus.ELEMENTMOUSEDOWN="ELEMENT:MOUSEDOWN";EventBus.ELEMENTMOUSEUP="ELEMENT:MOUSEUP";EventBus.ELEMENTMOUSELEAVE="ELEMENT:MOUSELEAVE";EventBus.ELEMENTMOUSEMOVE="ELEMENT:MOUSEMOVE";EventBus.ELEMENTMOUSEWHEEL="ELEMENT:MOUSEWHEEL";EventBus.ELEMENTCLICK="ELEMENT:CLICK";EventBus.ELEMENTDRAG="ELEMENT:DRAG";EventBus.handlers=new Map();var Editor=function(){function Editor(graph){_classCallCheck(this,Editor);this.graph=graph;}_createClass(Editor,[{key:"isEnable",value:function isEnable(){return true;}},{key:"handle",value:function handle(event,element){var _this24=this;if(element instanceof Clazz){var clazz=element;var attributes=clazz.getPropertyAsString('attributes');var methods=clazz.getPropertyAsString('methods');var div=document.createElement('div');div.className='editor';div.innerHTML="<h2>Class Editor</h2><hr><div><h4>ID: "+clazz.id+"</h4></div><div><h3>Name:</h3><input id=\"input_name\" type=\"text\" value=\""+clazz.label+"\"></input></div><div class=\"attributes\"><h3>Attributes:</h3><textarea id=\"attributes_area\">"+attributes+"</textarea></div><div class=\"methods\"><h3>Methods:</h3><textarea id=\"methods_area\">"+methods+"</textarea></div>";var _buttons=document.createElement('div');_buttons.className='buttons';var okBtn=document.createElement('button');okBtn.innerHTML='OK';okBtn.onclick=function(e){return _this24.edit();};_buttons.appendChild(okBtn);var cancelBtn=document.createElement('button');cancelBtn.innerHTML='CANCEL';cancelBtn.onclick=function(e){return _this24.cancel();};_buttons.appendChild(cancelBtn);div.appendChild(_buttons);this.editorElement=div;this.clazz=clazz;document.body.appendChild(div);}return true;}},{key:"cancel",value:function cancel(){this.editorElement.remove();}},{key:"edit",value:function edit(){var hasChanged=false;var name=document.getElementById('input_name').value;if(name!==this.clazz.label){this.clazz.label=name;hasChanged=true;}var attributes=document.getElementById('attributes_area').value;hasChanged=this.clazz.convertStringToProperty(attributes,'attributes')||hasChanged;var methods=document.getElementById('methods_area').value;hasChanged=this.clazz.convertStringToProperty(methods,'methods')||hasChanged;if(hasChanged){this.graph.layout();}this.cancel();}}]);return Editor;}();var Drag=function(){function Drag(){_classCallCheck(this,Drag);this.dragging=false;this.reinsert=false;this.mouseOffset=new Point();this.svgRoot=document.getElementById('root');}_createClass(Drag,[{key:"handle",value:function handle(event, element){switch(event.type){case'mousedown':if(!this.dragging||element.id!=='RootElement'){this.element=element;this.svgElement=element.$viewElement;this.start(event,element);}break;case'mouseup':if(this.dragging){this.reset();}break;case'mousemove':if(this.dragging){this.drag(event,element);}break;case'mouseleave':if(this.dragging){this.reset();}break;default:break;}return true;}},{key:"isEnable",value:function isEnable(){return true;}},{key:"reset",value:function reset(){this.dragging=false;this.svgElement.style.cursor='pointer';this.svgRoot.style.cursor='default';}},{key:"start",value:function start(evt, element){this.dragging=true;this.mouseOffset.x=evt.clientX;this.mouseOffset.y=evt.clientY;if(this.element.id==='RootElement'){this.svgRoot.style.cursor='move';this.svgRoot.style.cursor='grabbing';this.svgRoot.style.cursor='-moz-grabbin';this.svgRoot.style.cursor='-webkit-grabbing';}else{this.reinsert=true;}}},{key:"drag",value:function drag(evt, element){if(this.reinsert){if(this.element.id!=='RootElement'){this.svgRoot.appendChild(this.svgElement);}this.reinsert=false;var dragEvent=new Event('drag');element.$viewElement.dispatchEvent(dragEvent);}if(element.id==='RootElement'){if(element.id!==this.element.id){return;}var model=this.element;var x=evt.clientX-this.mouseOffset.x;var y=evt.clientY-this.mouseOffset.y;var newOrigin=model.$graph.options.origin.add(new Point(x,y));var values=this.svgRoot.getAttribute('viewBox').split(' ');var newViewBox=newOrigin.x*-1+" "+newOrigin.y*-1+" "+values[2]+" "+values[3];this.svgRoot.setAttribute('viewBox',newViewBox);}else{var node=element;var translation=this.svgElement.getAttributeNS(null,'transform').slice(10,-1).split(' ');var sx=parseInt(translation[0]);var sy=parseInt(translation[1]);var transX=sx+evt.clientX-this.mouseOffset.x;var transY=sy+evt.clientY-this.mouseOffset.y;this.svgElement.setAttributeNS(null,'transform','translate('+transX+' '+transY+')');node.getPos().addNum(transX-sx,transY-sy);node.redrawEdges();}this.mouseOffset.x=evt.clientX;this.mouseOffset.y=evt.clientY;}}]);return Drag;}();var Select=function(){function Select(model){_classCallCheck(this,Select);this.padding=5;this.model=model;this.svgRoot=document.getElementById('root');var attrCircle={tag:'circle',cx:20,cy:20,r:17,stroke:'#888','stroke-width':2,fill:'#DDD'};var editPath='M6 20 L12 23 L33 23 L33 17 L12 17 Z M30 17 L30 23 M12 17 L12 23 M15 19 L28 19 M15 21 L28 21';var editAttr={tag:'path',d:editPath,stroke:'#000','stroke-width':1,fill:'white'};var editShape=util.createShape(editAttr);var editBkg=util.createShape(attrCircle);var editGroup=util.createShape({tag:'g',id:'edit',transform:'rotate(-45, 20, 20) translate(0 0)'});editGroup.appendChild(editBkg);editGroup.appendChild(editShape);this.editShape=editGroup;var deletePath='M12 12 L18 12 L18 11 L22 11 L22 12 L28 12 L28 14 L27 14 L27 29 L13 29 L13 14 L12 14 Z M13 14 L27 14 M20 17 L20 26 M17 16 L17 27 M23 16 L23 27';var deleteAttrPath={tag:'path',d:deletePath,stroke:'#000','stroke-width':1,fill:'white'};var deleteShape=util.createShape(deleteAttrPath);var deleteBkg=util.createShape(attrCircle);var deleteGroup=util.createShape({tag:'g',id:'trashcan',transform:'translate(0 0)'});deleteGroup.appendChild(deleteBkg);deleteGroup.appendChild(deleteShape);this.deleteShape=deleteGroup;}_createClass(Select,[{key:"handle",value:function handle(event,element){var _this25=this;event.stopPropagation();if(event.type==='drag'||event.srcElement.id==='background'||element===this.model){this.editShape.setAttributeNS(null,'visibility','hidden');this.deleteShape.setAttributeNS(null,'visibility','hidden');}else if(element instanceof Node){(function(){var e=element;if(document.getElementById('trashcan')===null){_this25.svgRoot.appendChild(_this25.deleteShape);}if(document.getElementById('edit')===null){_this25.svgRoot.appendChild(_this25.editShape);}_this25.editShape.setAttributeNS(null,'visibility','visible');_this25.deleteShape.setAttributeNS(null,'visibility','visible');var pos=e.getPos();var size=e.getSize();var x=pos.x+size.x/2+_this25.padding;var y=pos.y-size.y/2+_this25.padding/2;var editorEvent=new Event('editor');_this25.editShape.setAttributeNS(null,'transform',"rotate(-45, "+(x+20)+", "+(y+20)+") translate("+x+" "+y+")");_this25.editShape.onclick=function(e){return element.$viewElement.dispatchEvent(editorEvent);};_this25.deleteShape.setAttributeNS(null,'transform',"translate("+x+" "+(y+34+_this25.padding)+")");_this25.deleteShape.onclick=function(e){return _this25.model.removeElement(element.id);};})();}else if(element instanceof Edge){var _e=element;if(document.getElementById('trashcan')===null){this.svgRoot.appendChild(this.deleteShape);}this.editShape.setAttributeNS(null,'visibility','hidden');this.deleteShape.setAttributeNS(null,'visibility','visible');var _x=void 0,_y2=void 0;if(_e.$points.length===2){_x=(_e.$points[0].getPos().x+_e.$points[1].getPos().x)/2;_y2=(_e.$points[0].getPos().y+_e.$points[1].getPos().y)/2;}else{var _i18=Math.floor(_e.$points.length/2);_x=_e.$points[_i18].getPos().x;_y2=_e.$points[_i18].getPos().y;}this.deleteShape.setAttributeNS(null,'transform',"translate("+_x+" "+_y2+")");this.deleteShape.onclick=function(e){return _this25.model.removeElement(element.id);};}return true;}},{key:"isEnable",value:function isEnable(){return true;}}]);return Select;}();var Zoom=function(){function Zoom(){_classCallCheck(this,Zoom);this.svgRoot=document.getElementById('root');}_createClass(Zoom,[{key:"handle",value:function handle(e,element){var delta=e.deltaY||e.wheelDeltaY||-e.wheelDelta;var d=1+delta/1000;var values=this.svgRoot.getAttribute('viewBox').split(' ');var newViewBox=values[0]+" "+values[1]+" "+parseInt(values[2])*d+" "+parseInt(values[3])*d;this.svgRoot.setAttribute('viewBox',newViewBox);e.preventDefault();return true;}},{key:"isEnable",value:function isEnable(){return true;}}]);return Zoom;}();var Graph=function(_Control9){_inherits(Graph,_Control9);function Graph(json,options){_classCallCheck(this,Graph);var _this26=_possibleConstructorReturn(this,(Graph.__proto__||Object.getPrototypeOf(Graph)).call(this,null));var autoLayout=void 0;if((typeof json==="undefined"?"undefined":_typeof(json))==="object"&&json.constructor.name==="Bridge"){_this26.$owner=json;json=options["data"];options=options["options"];autoLayout=true;}json=json||{};_this26.options=options||{};if(json["init"]){return _possibleConstructorReturn(_this26);}if(!_this26.options.origin){_this26.options.origin=new Point(150,45);}_this26.initFactories();_this26.initCanvas();_this26.model=new Model(_this26);_this26.model.init(json);_this26.initFeatures(options.features);if(autoLayout){_this26.layout();}return _this26;}_createClass(Graph,[{key:"propertyChange",value:function propertyChange(entity,property,oldValue,newValue){}},{key:"addElement",value:function addElement(type){var success=this.model.addElement(type);if(success===true){this.layout();}return success;}},{key:"layout",value:function layout(){this.getLayout().layout(this,this.model);this.draw();}},{key:"draw",value:function draw(){this.clearCanvas();var model=this.model;var canvas=this.canvas;var max=new Point();if(model.nodes){for(var id in model.nodes){var node=model.nodes[id];var svg=node.getSVG();EventBus.registerSVG(svg);canvas.appendChild(svg);var temp=void 0;temp=node.getPos().x+node.getSize().x;if(temp>max.x){max.x=temp;}temp=node.getPos().y+node.getSize().y;if(temp>max.y){max.y=temp;}}}util.setSize(this.canvas,max.x,max.y);if(model.edges){for(var _id4 in model.edges){var edge=model.edges[_id4];var _svg=edge.getSVG();EventBus.registerSVG(_svg);canvas.appendChild(_svg);}}}},{key:"clearCanvas",value:function clearCanvas(){var canvas=this.canvas;while(canvas.firstChild){canvas.removeChild(canvas.firstChild);}canvas.appendChild(Graph.createPattern());var background=util.createShape({tag:'rect',id:'background',width:5000,height:5000,x:-1500,y:-1500,stroke:'#999','stroke-width':'1',fill:'url(#raster)'});canvas.appendChild(background);canvas.appendChild(this.model.getSVG());}},{key:"getLayout",value:function getLayout(){var layout=this.options.layout||'';if(this.layoutFactory[layout]){return new this.layoutFactory[layout]();}return new DagreLayout();}},{key:"initFactories",value:function initFactories(){var noder=nodes;this.nodeFactory={};for(var id in noder){if(noder.hasOwnProperty(id)===true){this.nodeFactory[id]=noder[id];}}var edger=edges;this.edgeFactory={};for(var _id5 in edger){if(edger.hasOwnProperty(_id5)===true){this.edgeFactory[_id5]=edger[_id5];}}var layouter=layouts;this.layoutFactory={};for(var _id6 in layouter){if(layouter.hasOwnProperty(_id6)===true){this.layoutFactory[_id6]=layouter[_id6];}}}},{key:"initCanvas",value:function initCanvas(){if(this.options.canvas){this.root=document.getElementById(this.options.canvas);}if(!this.root){this.root=document.createElement('div');this.root.setAttribute('class','diagram');document.body.appendChild(this.root);}}},{key:"initFeatures",value:function initFeatures(features){if(features){if(features.zoom){var mousewheel='onwheel'in document.createElement('div')?'wheel':document.onmousewheel!==undefined?'mousewheel':'DOMMouseScroll';EventBus.subscribe(new Zoom(),mousewheel);}if(features.editor){EventBus.subscribe(new Editor(this),'dblclick','editor');}if(features.drag){EventBus.subscribe(new Drag(),'mousedown','mouseup','mousemove','mouseleave');}if(features.select){EventBus.subscribe(new Select(this.model),'click','drag');}if(features.palette){new Palette(this);}}}}],[{key:"createPattern",value:function createPattern(){var defs=util.createShape({tag:'defs'});var pattern=util.createShape({tag:'pattern',id:'raster',patternUnits:'userSpaceOnUse',width:40,height:40});var path='M0 4 L0 0 L4 0 M36 0 L40 0 L40 4 M40 36 L40 40 L36 40 M4 40 L0 40 L0 36';var cross=util.createShape({tag:'path',d:path,stroke:'#DDD','stroke-width':1,fill:'none'});pattern.appendChild(cross);defs.appendChild(pattern);return defs;}}]);return Graph;}(Control);var Bridge=function(){function Bridge(){_classCallCheck(this,Bridge);this.listener=[];this.controlFactory={};this.controls={};this.adapters=new Map();this.items={};this.controlNo=1;this.online=true;this.language=navigator.language.toUpperCase();this.addListener=function(listener){this.listener.push(listener);};var i=void 0;var keys=Object.keys(nodes);for(i=0;i<keys.length;i++){this.addControl(nodes[keys[i]]);}this.addControl(Graph);var that=this;window.addEventListener('load',function(){var updateOnlineStatus=function updateOnlineStatus(){that.setOnline(navigator.onLine);};window.addEventListener('online',updateOnlineStatus);window.addEventListener('offline',updateOnlineStatus);});}_createClass(Bridge,[{key:"setOnline",value:function setOnline(value){this.online=value;if(this.toolBar.children[0]){this.toolBar.children[0].className=value?"online":"offline";}}},{key:"addToolbar",value:function addToolbar(){if(this.toolBar){return false;}this.toolBar=document.createElement("div");this.toolBar.className="onlineStatus";var child=document.createElement("div");child.className="online";this.toolBar.appendChild(child);child=document.createElement("div");child.className="lang";child.innerHTML=this.language;this.toolBar.appendChild(child);var body=document.getElementsByTagName("body")[0];body.insertBefore(this.toolBar,body.firstChild);this.setOnline(this.online);}},{key:"addControl",value:function addControl(control){if(control&&control.name){this.controlFactory[control.name.toLowerCase()]=control;}}},{key:"getId",value:function getId(){return"control"+this.controlNo++;}},{key:"load",value:function load(json){var className=void 0;var id=void 0;if((typeof json==="undefined"?"undefined":_typeof(json))==="object"){if(!json["id"]){json["id"]=this.getId();}if(json["class"]){className=json["class"].toLowerCase();}id=json["id"];if(json["prop"]||json["upd"]||json["rem"]){var newData=!this.hasItem(id);var item=this.getItem(id);if(className){item.property=className;}if(newData){for(var _i19 in this.controls){if(this.controls.hasOwnProperty(_i19)===false){continue;}this.controls[_i19].addItem(this,item);}}Bridge.addProperties(json["prop"],item);Bridge.addProperties(json["upd"],item);for(var adapter in this.adapters){this.adapters[adapter].update(JSON.stringify(json));}return item;}}else{id=json;var _item3=document.getElementById(id);if(_item3){className=_item3.getAttribute("class");if(className){className=className.toLowerCase();}else{className="";}}else{className=json;}}var control=void 0;if(this.controls[id]){control=this.controls[id];control.initControl(json);return control;}if(_typeof(this.controlFactory[className])==="object"||typeof this.controlFactory[className]==="function"){var obj=this.controlFactory[className];control=new obj(this,json);this.controls[control.id]=control;return control;}return null;}},{key:"propertyChange",value:function propertyChange(entity,property,oldValue,newValue){}},{key:"hasItem",value:function hasItem(id){return this.items[id]!=null;}},{key:"getItem",value:function getItem(id){var item=this.items[id];if(!item){item=new Data();item.id=id;this.items[id]=item;}return item;}},{key:"setValue",value:function setValue(object,attribute,value){var obj=void 0;var id=void 0;if(object instanceof String||typeof object==="string"){id=object.toString();obj=this.getItem(id);}else if(object.hasOwnProperty("id")){obj=object;id=object['id'];}else{console.log("object is neither Data nor String..");return false;}if(obj){}var upd={};upd[attribute]=value;this.load({'id':id,upd:upd});return true;}},{key:"getValue",value:function getValue(object,attribute){var obj=void 0;var id=void 0;if(object instanceof String||typeof object==="string"){id=object.toString();obj=this.getItem(id);}else if(object.hasOwnProperty("id")){obj=object;id=object['id'];}else{console.log("object is neither Data nor String..");return;}if(obj){if(obj.hasOwnProperty(attribute)){return obj[attribute];}else if(obj instanceof Data){return obj.getValue(attribute);}else{return null;}}}},{key:"getNumber",value:function getNumber(object, attribute){var defaultValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var res=this.getValue(object,attribute);if(typeof res==="number"){return res;}else if(typeof res==="string"){var number=Number(res);if(!Number.isNaN(number)){return number;}}return defaultValue;}},{key:"getControl",value:function getControl(controlId){return this.controls[controlId];}},{key:"registerEventListener",value:function registerListener(eventType, control, callBackfunction){if(typeof control==="string"){control=this.getControl(control);}if(!control){return null;}if(eventType){eventType=eventType.toLowerCase();}control.registerListenerOnHTMLObject(eventType);if(callBackfunction){var adapter=new DelegateAdapter();adapter.callBackfunction=callBackfunction;adapter.id=control.getId();this.addAdapter(adapter,eventType);}return control;}},{key:"addAdapter",value:function addAdapter(adapter, eventType){if(!eventType){eventType=null;}var handlers=this.adapters.get(eventType);if(handlers===null||handlers===undefined){handlers=[];this.adapters.set(eventType,handlers);}handlers.push(adapter);return adapter;}},{key:"fireEvent",value:function fireEvent(evt){var handlers=this.adapters.get(null);if(handlers){for(var _i20=0;_i20<handlers.length;_i20++){var adapter=handlers[_i20];if(adapter.id==null||adapter.id===evt["id"]){adapter.update(evt);}}}handlers=this.adapters.get(evt["eventType"]);if(handlers){for(var _i21=0;_i21<handlers.length;_i21++){var _adapter=handlers[_i21];if(_adapter.id==null||_adapter.id===evt["id"]){_adapter.update(evt);}}}}}],[{key:"addProperties",value:function addProperties(prop,item){if(!prop){return;}for(var property in prop){if(prop.hasOwnProperty(property)===false){continue;}if(prop[property]!=null&&""!==prop[property]){item.setValue(property,prop[property]);}}}}]);return Bridge;}();Bridge.version="0.42.01.1601007-1739";var DelegateAdapter=function(_Adapter){_inherits(DelegateAdapter,_Adapter);function DelegateAdapter(){_classCallCheck(this,DelegateAdapter);var _this27=_possibleConstructorReturn(this,(DelegateAdapter.__proto__||Object.getPrototypeOf(DelegateAdapter)).apply(this,arguments));_this27.executeFunction=function(string){var scope=window;var scopeSplit=string.split('.');for(var _i22=0;_i22<scopeSplit.length-1;_i22++){scope=scope[scopeSplit[_i22]];if(scope==undefined)return false;}var fn=scope[scopeSplit[scopeSplit.length-1]];if(typeof fn==='function'){fn.call(scope);return true;}return false;};return _this27;}_createClass(DelegateAdapter,[{key:"update",value:function update(evt){if(this.adapter){this.adapter.update(evt);return true;}else if(this.callBackfunction){return this.executeFunction(this.callBackfunction);}return false;}}]);return DelegateAdapter;}(Adapter);var bridge=new Bridge();var BridgeAdapter=function BridgeAdapter(){_classCallCheck(this,BridgeAdapter);this.bridge=new Bridge();};(function(){var bridgeloader=new BridgeAdapter();})();
  //# sourceMappingURL=output.js.map