UNPKG

webgme

Version:

Web-based Generic Modeling Environment

2 lines 177 kB
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.AutoRouterActionApplier=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){function replacer(key,value){return util.isUndefined(value)?""+value:util.isNumber(value)&&!isFinite(value)?value.toString():util.isFunction(value)||util.isRegExp(value)?value.toString():value}function truncate(s,n){return util.isString(s)?s.length<n?s:s.slice(0,n):s}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}function ok(value,message){value||fail(value,!0,message,"==",assert.ok)}function _deepEqual(actual,expected){if(actual===expected)return!0;if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return!1;for(var i=0;i<actual.length;i++)if(actual[i]!==expected[i])return!1;return!0}return util.isDate(actual)&&util.isDate(expected)?actual.getTime()===expected.getTime():util.isRegExp(actual)&&util.isRegExp(expected)?actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase:util.isObject(actual)||util.isObject(expected)?objEquiv(actual,expected):actual==expected}function isArguments(object){return"[object Arguments]"==Object.prototype.toString.call(object)}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return!1;if(a.prototype!==b.prototype)return!1;if(util.isPrimitive(a)||util.isPrimitive(b))return a===b;var aIsArgs=isArguments(a),bIsArgs=isArguments(b);if(aIsArgs&&!bIsArgs||!aIsArgs&&bIsArgs)return!1;if(aIsArgs)return a=pSlice.call(a),b=pSlice.call(b),_deepEqual(a,b);var key,i,ka=objectKeys(a),kb=objectKeys(b);if(ka.length!=kb.length)return!1;for(ka.sort(),kb.sort(),i=ka.length-1;i>=0;i--)if(ka[i]!=kb[i])return!1;for(i=ka.length-1;i>=0;i--)if(key=ka[i],!_deepEqual(a[key],b[key]))return!1;return!0}function expectedException(actual,expected){return actual&&expected?"[object RegExp]"==Object.prototype.toString.call(expected)?expected.test(actual):actual instanceof expected?!0:expected.call({},actual)===!0?!0:!1:!1}function _throws(shouldThrow,block,expected,message){var actual;util.isString(expected)&&(message=expected,expected=null);try{block()}catch(e){actual=e}if(message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:"."),shouldThrow&&!actual&&fail(actual,expected,"Missing expected exception"+message),!shouldThrow&&expectedException(actual,expected)&&fail(actual,expected,"Got unwanted exception"+message),shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual)throw actual}var util=require("util/"),pSlice=Array.prototype.slice,hasOwn=Object.prototype.hasOwnProperty,assert=module.exports=ok;assert.AssertionError=function(options){this.name="AssertionError",this.actual=options.actual,this.expected=options.expected,this.operator=options.operator,options.message?(this.message=options.message,this.generatedMessage=!1):(this.message=getMessage(this),this.generatedMessage=!0);var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,stackStartFunction);else{var err=new Error;if(err.stack){var out=err.stack,fn_name=stackStartFunction.name,idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(actual,expected,message){actual!=expected&&fail(actual,expected,message,"==",assert.equal)},assert.notEqual=function(actual,expected,message){actual==expected&&fail(actual,expected,message,"!=",assert.notEqual)},assert.deepEqual=function(actual,expected,message){_deepEqual(actual,expected)||fail(actual,expected,message,"deepEqual",assert.deepEqual)},assert.notDeepEqual=function(actual,expected,message){_deepEqual(actual,expected)&&fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)},assert.strictEqual=function(actual,expected,message){actual!==expected&&fail(actual,expected,message,"===",assert.strictEqual)},assert.notStrictEqual=function(actual,expected,message){actual===expected&&fail(actual,expected,message,"!==",assert.notStrictEqual)},assert["throws"]=function(block,error,message){_throws.apply(this,[!0].concat(pSlice.call(arguments)))},assert.doesNotThrow=function(block,message){_throws.apply(this,[!1].concat(pSlice.call(arguments)))},assert.ifError=function(err){if(err)throw err};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)hasOwn.call(obj,key)&&keys.push(key);return keys}},{"util/":5}],2:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],3:[function(require,module,exports){function cleanUpNextTick(){draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue()}function drainQueue(){if(!draining){var timeout=setTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,clearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var currentQueue,process=module.exports={},queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||setTimeout(drainQueue,0)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],4:[function(require,module,exports){module.exports=function(arg){return arg&&"object"==typeof arg&&"function"==typeof arg.copy&&"function"==typeof arg.fill&&"function"==typeof arg.readUInt8}},{}],5:[function(require,module,exports){(function(process,global){function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(ctx.depth=arguments[2]),arguments.length>=4&&(ctx.colors=arguments[3]),isBoolean(opts)?ctx.showHidden=opts:opts&&exports._extend(ctx,opts),isUndefined(ctx.showHidden)&&(ctx.showHidden=!1),isUndefined(ctx.depth)&&(ctx.depth=2),isUndefined(ctx.colors)&&(ctx.colors=!1),isUndefined(ctx.customInspect)&&(ctx.customInspect=!0),ctx.colors&&(ctx.stylize=stylizeWithColor),formatValue(ctx,obj,ctx.depth)}function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];return style?"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m":str}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};return array.forEach(function(val,idx){hash[val]=!0}),hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&(!value.constructor||value.constructor.prototype!==value)){var ret=value.inspect(recurseTimes,ctx);return isString(ret)||(ret=formatValue(ctx,ret,recurseTimes)),ret}var primitive=formatPrimitive(ctx,value);if(primitive)return primitive;var keys=Object.keys(value),visibleKeys=arrayToHash(keys);if(ctx.showHidden&&(keys=Object.getOwnPropertyNames(value)),isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0))return formatError(value);if(0===keys.length){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value))return ctx.stylize(RegExp.prototype.toString.call(value),"regexp");if(isDate(value))return ctx.stylize(Date.prototype.toString.call(value),"date");if(isError(value))return formatError(value)}var base="",array=!1,braces=["{","}"];if(isArray(value)&&(array=!0,braces=["[","]"]),isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)&&(base=" "+RegExp.prototype.toString.call(value)),isDate(value)&&(base=" "+Date.prototype.toUTCString.call(value)),isError(value)&&(base=" "+formatError(value)),0===keys.length&&(!array||0==value.length))return braces[0]+base+braces[1];if(0>recurseTimes)return isRegExp(value)?ctx.stylize(RegExp.prototype.toString.call(value),"regexp"):ctx.stylize("[Object]","special");ctx.seen.push(value);var output;return output=array?formatArray(ctx,value,recurseTimes,visibleKeys,keys):keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)}),ctx.seen.pop(),reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}return isNumber(value)?ctx.stylize(""+value,"number"):isBoolean(value)?ctx.stylize(""+value,"boolean"):isNull(value)?ctx.stylize("null","null"):void 0}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){for(var output=[],i=0,l=value.length;l>i;++i)hasOwnProperty(value,String(i))?output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),!0)):output.push("");return keys.forEach(function(key){key.match(/^\d+$/)||output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,!0))}),output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;if(desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]},desc.get?str=desc.set?ctx.stylize("[Getter/Setter]","special"):ctx.stylize("[Getter]","special"):desc.set&&(str=ctx.stylize("[Setter]","special")),hasOwnProperty(visibleKeys,key)||(name="["+key+"]"),str||(ctx.seen.indexOf(desc.value)<0?(str=isNull(recurseTimes)?formatValue(ctx,desc.value,null):formatValue(ctx,desc.value,recurseTimes-1),str.indexOf("\n")>-1&&(str=array?str.split("\n").map(function(line){return" "+line}).join("\n").substr(2):"\n"+str.split("\n").map(function(line){return" "+line}).join("\n"))):str=ctx.stylize("[Circular]","special")),isUndefined(name)){if(array&&key.match(/^\d+$/))return str;name=JSON.stringify(""+key),name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(name=name.substr(1,name.length-2),name=ctx.stylize(name,"name")):(name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),name=ctx.stylize(name,"string"))}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0,length=output.reduce(function(prev,cur){return numLinesEst++,cur.indexOf("\n")>=0&&numLinesEst++,prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);return length>60?braces[0]+(""===base?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]:braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNullOrUndefined(arg){return null==arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isSymbol(arg){return"symbol"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return isObject(re)&&"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return isObject(d)&&"[object Date]"===objectToString(d)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(arg){return"function"==typeof arg}function isPrimitive(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||"undefined"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return 10>n?"0"+n.toString(10):n.toString(10)}function timestamp(){var d=new Date,time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){for(var objects=[],i=0;i<arguments.length;i++)objects.push(inspect(arguments[i]));return objects.join(" ")}for(var i=1,args=arguments,len=args.length,str=String(f).replace(formatRegExp,function(x){if("%%"===x)return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}}),x=args[i];len>i;x=args[++i])str+=isNull(x)||!isObject(x)?" "+x:" "+inspect(x);return str},exports.deprecate=function(fn,msg){function deprecated(){if(!warned){if(process.throwDeprecation)throw new Error(msg);process.traceDeprecation?console.trace(msg):console.error(msg),warned=!0}return fn.apply(this,arguments)}if(isUndefined(global.process))return function(){return exports.deprecate(fn,msg).apply(this,arguments)};if(process.noDeprecation===!0)return fn;var warned=!1;return deprecated};var debugEnviron,debugs={};exports.debuglog=function(set){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),set=set.toUpperCase(),!debugs[set])if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else debugs[set]=function(){};return debugs[set]},exports.inspect=inspect,inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=require("./support/isBuffer");var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(origin,add){if(!add||!isObject(add))return origin;for(var keys=Object.keys(add),i=keys.length;i--;)origin[keys[i]]=add[keys[i]];return origin}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":4,_process:3,inherits:2}],6:[function(require,module,exports){function useColors(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function formatArgs(){var args=arguments,useColors=this.useColors;if(args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff),!useColors)return args;var c="color: "+this.color;args=[args[0],c,"color: inherit"].concat(Array.prototype.slice.call(args,1));var index=0,lastC=0;return args[0].replace(/%[a-z%]/g,function(match){"%%"!==match&&(index++,"%c"===match&&(lastC=index))}),args.splice(lastC,0,c),args}function log(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{null==namespaces?exports.storage.removeItem("debug"):exports.storage.debug=namespaces}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}return r}function localstorage(){try{return window.localStorage}catch(e){}}exports=module.exports=require("./debug"),exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:localstorage(),exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],exports.formatters.j=function(v){return JSON.stringify(v)},exports.enable(load())},{"./debug":7}],7:[function(require,module,exports){function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(namespace){function disabled(){}function enabled(){var self=enabled,curr=+new Date,ms=curr-(prevTime||curr);self.diff=ms,self.prev=prevTime,self.curr=curr,prevTime=curr,null==self.useColors&&(self.useColors=exports.useColors()),null==self.color&&self.useColors&&(self.color=selectColor());var args=Array.prototype.slice.call(arguments);args[0]=exports.coerce(args[0]),"string"!=typeof args[0]&&(args=["%o"].concat(args));var index=0;args[0]=args[0].replace(/%([a-z%])/g,function(match,format){if("%%"===match)return match;index++;var formatter=exports.formatters[format];if("function"==typeof formatter){var val=args[index];match=formatter.call(self,val),args.splice(index,1),index--}return match}),"function"==typeof exports.formatArgs&&(args=exports.formatArgs.apply(self,args));var logFn=enabled.log||exports.log||console.log.bind(console);logFn.apply(self,args)}disabled.enabled=!1,enabled.enabled=!0;var fn=exports.enabled(namespace)?enabled:disabled;return fn.namespace=namespace,fn}function enable(namespaces){exports.save(namespaces);for(var split=(namespaces||"").split(/[\s,]+/),len=split.length,i=0;len>i;i++)split[i]&&(namespaces=split[i].replace(/\*/g,".*?"),"-"===namespaces[0]?exports.skips.push(new RegExp("^"+namespaces.substr(1)+"$")):exports.names.push(new RegExp("^"+namespaces+"$")))}function disable(){exports.enable("")}function enabled(name){var i,len;for(i=0,len=exports.skips.length;len>i;i++)if(exports.skips[i].test(name))return!1;for(i=0,len=exports.names.length;len>i;i++)if(exports.names[i].test(name))return!0;return!1}function coerce(val){return val instanceof Error?val.stack||val.message:val}exports=module.exports=debug,exports.coerce=coerce,exports.disable=disable,exports.enable=enable,exports.enabled=enabled,exports.humanize=require("ms"),exports.names=[],exports.skips=[],exports.formatters={};var prevTime,prevColor=0},{ms:8}],8:[function(require,module,exports){function parse(str){if(str=""+str,!(str.length>1e4)){var match=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);if(match){var n=parseFloat(match[1]),type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function short(ms){return ms>=d?Math.round(ms/d)+"d":ms>=h?Math.round(ms/h)+"h":ms>=m?Math.round(ms/m)+"m":ms>=s?Math.round(ms/s)+"s":ms+"ms"}function long(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){return n>ms?void 0:1.5*n>ms?Math.floor(ms/n)+" "+name:Math.ceil(ms/n)+" "+name+"s"}var s=1e3,m=60*s,h=60*m,d=24*h,y=365.25*d;module.exports=function(val,options){return options=options||{},"string"==typeof val?parse(val):options["long"]?long(val):short(val)}},{}],9:[function(require,module,exports){"use strict";var AutoRouter=require("./AutoRouter"),assert=require("./AutoRouter.Utils").assert,AutoRouterActionApplier=function(){};AutoRouterActionApplier.AutoRouter=AutoRouter,AutoRouterActionApplier.prototype.init=function(){this._portSeparator=this._portSeparator||"_x_",this.autorouter=new AutoRouter,this.debugActionSequence="[",this._clearRecords()},AutoRouterActionApplier.prototype._clearRecords=function(){this._autorouterBoxes={},this._autorouterPorts={},this._autorouterPaths={},this._arPathId2Original={}},AutoRouterActionApplier.prototype._lookupItem=function(dictionary,array,indices){for(var index,id,i=2;i<arguments.length;i++)index=arguments[i],id=array[index],array[index]=dictionary[id]},AutoRouterActionApplier.prototype._fixArgs=function(command,args){var id;switch(command){case"move":this._lookupItem(this._autorouterBoxes,args,0),args[0]=args[0].box;break;case"getPathPoints":this._lookupItem(this._autorouterPaths,args,0);break;case"setPathCustomPoints":id=args[0].path,args[0].path=this._autorouterPaths[id];break;case"setBoxRect":this._lookupItem(this._autorouterBoxes,args,0);break;case"getBoxRect":this._lookupItem(this._autorouterBoxes,args,0),args[0]=args[0].box.id;break;case"updatePort":this._lookupItem(this._autorouterBoxes,args,0);break;case"setComponent":this._lookupItem(this._autorouterBoxes,args,0,1);break;case"addPath":this._fixPortArgs(args[0].src,args[0].dst),args.pop();break;case"remove":var item;id=args[0],this._autorouterBoxes[id]?item=this._autorouterBoxes[id]:this._autorouterPaths[id]&&(item=this._autorouterPaths[id]),args[0]=item;break;case"addBox":args.pop()}},AutoRouterActionApplier.prototype._fixPortArgs=function(port1,port2){for(var portId,portIds,arPortId,boxId,ports,i=arguments.length;i--;){ports=arguments[i],portIds=Object.keys(ports);for(var j=portIds.length;j--;)portId=portIds[j],boxId=ports[portId],arPortId=this.autorouter.getPortId(portId,this._autorouterBoxes[boxId]),ports[portId]=this._autorouterBoxes[boxId].ports[arPortId],assert(this._autorouterBoxes[boxId].ports[arPortId],"AR Port not found!")}},AutoRouterActionApplier.prototype._invokeAutoRouterMethod=function(command,args){try{return this._invokeAutoRouterMethodUnsafe(command,args)}catch(e){this.logger.error("AutoRouter."+command+" failed with error: "+e)}},AutoRouterActionApplier.prototype._invokeAutoRouterMethodUnsafe=function(command,args){var result,oldArgs=args.slice();return this._recordActions&&this._recordAction(command,args.slice()),this._fixArgs(command,args),result=this.autorouter[command].apply(this.autorouter,args),this._updateRecords(command,oldArgs,result),result},AutoRouterActionApplier.prototype._updateRecords=function(command,input,result){assert(input instanceof Array);var id,i,args=input.slice();switch(command){case"addPath":id=args.pop(),this._autorouterPaths[id]=result,this._arPathId2Original[result]=id;break;case"addBox":id=args.pop(),this._autorouterBoxes[id]=result,this._autorouterPorts[id]=[];var ids=Object.keys(result.ports);for(i=ids.length;i--;)this._autorouterPorts[id].push(result.ports[ids[i]]);break;case"remove":if(id=args[0],this._autorouterBoxes[id]){for(i=this._autorouterPorts[id]?this._autorouterPorts[id].length:0;i--;){var portId=id+this._portSeparator+this._autorouterPorts[id][i];delete this._autorouterBoxes[portId]}delete this._autorouterBoxes[id],delete this._autorouterPorts[id]}else if(this._autorouterPaths[id]){var arId=this._autorouterPaths[id];delete this._autorouterPaths[id],delete this._arPathId2Original[arId]}break;case"setComponent":var len,subCompId;id=args[0],len=id.length+this._portSeparator.length,subCompId=args[1].substring(len),-1===this._autorouterPorts[id].indexOf(subCompId)&&this._autorouterPorts[id].push(subCompId);break;case"updatePort":id=args[1].id}},AutoRouterActionApplier.prototype._recordAction=function(command,args){var action={action:command,args:args},circularFixer=function(key,value){return value&&value.owner?value.id:value};this.debugActionSequence+=JSON.stringify(action,circularFixer)+","},AutoRouterActionApplier.prototype._getActionSequence=function(){var index=this.debugActionSequence.lastIndexOf(","),result=this.debugActionSequence.substring(0,index)+"]";return result},module.exports=AutoRouterActionApplier},{"./AutoRouter":23,"./AutoRouter.Utils":22}],10:[function(require,module,exports){"use strict";var assert=require("assert"),CONSTANTS=require("./AutoRouter.Constants"),Utils=require("./AutoRouter.Utils"),ArPoint=require("./AutoRouter.Point"),ArRect=require("./AutoRouter.Rect"),AutoRouterPort=require("./AutoRouter.Port"),AutoRouterBox=function(){this.owner=null,this.rect=new ArRect,this.atomic=!1,this.selfPoints=[],this.ports=[],this.childBoxes=[],this.parent=null,this.id=null,this.calculateSelfPoints()};AutoRouterBox.prototype.calculateSelfPoints=function(){this.selfPoints=[],this.selfPoints.push(new ArPoint(this.rect.getTopLeft())),this.selfPoints.push(new ArPoint(this.rect.right,this.rect.ceil)),this.selfPoints.push(new ArPoint(this.rect.right,this.rect.floor)),this.selfPoints.push(new ArPoint(this.rect.left,this.rect.floor))},AutoRouterBox.prototype.deleteAllPorts=function(){for(var i=0;i<this.ports.length;i++)this.ports[i].destroy();this.ports=[],this.atomic=!1},AutoRouterBox.prototype.hasOwner=function(){return null!==this.owner},AutoRouterBox.prototype.createPort=function(){var port=new AutoRouterPort;return assert(null!==port,"ARBox.createPort: port !== null FAILED"),port},AutoRouterBox.prototype.hasNoPort=function(){return 0===this.ports.length},AutoRouterBox.prototype.isAtomic=function(){return this.atomic},AutoRouterBox.prototype.addPort=function(port){assert(null!==port,"ARBox.addPort: port !== null FAILED"),port.owner=this,this.ports.push(port),this.owner&&this.owner._addEdges(port)},AutoRouterBox.prototype.deletePort=function(port){if(assert(null!==port,"ARBox.deletePort: port !== null FAILED"),null!==port){var index=this.ports.indexOf(port),graph=this.owner;assert(-1!==index,"ARBox.deletePort: index !== -1 FAILED"),graph.deleteEdges(port),this.ports.splice(index,1),this.atomic=!1}},AutoRouterBox.prototype.isRectEmpty=function(){return this.rect.isRectEmpty()},AutoRouterBox.prototype.setRect=function(r){assert(r instanceof ArRect,"Invalthis.id arg in ARBox.setRect. Requires ArRect"),assert(r.getWidth()>=3&&r.getHeight()>=3,"ARBox.setRect: r.getWidth() >= 3 && r.getHeight() >= 3 FAILED!"),assert(r.getTopLeft().x>=CONSTANTS.ED_MINCOORD&&r.getTopLeft().y>=CONSTANTS.ED_MINCOORD,"ARBox.setRect: r.getTopLeft().x >= CONSTANTS.ED_MINCOORD && r.getTopLeft().y >= CONSTANTS.ED_MAXCOORD FAILED!"),assert(r.getBottomRight().x<=CONSTANTS.ED_MAXCOORD&&r.getBottomRight().y<=CONSTANTS.ED_MAXCOORD,"ARBox.setRect: r.getBottomRight().x <= CONSTANTS.ED_MAXCOORD && r.getBottomRight().y <= CONSTANTS.ED_MAXCOORD FAILED!"),assert(0===this.ports.length||this.atomic,"ARBox.setRect: this.ports.length === 0 || this.atomic FAILED!"),this.rect.assign(r),this.calculateSelfPoints(),this.atomic&&(assert(1===this.ports.length,"ARBox.setRect: this.ports.length === 1 FAILED!"),this.ports[0].setRect(r))},AutoRouterBox.prototype.shiftBy=function(offset){this.rect.add(offset);for(var i=this.ports.length;i--;)this.ports[i].shiftBy(offset);this.calculateSelfPoints()},AutoRouterBox.prototype.resetPortAvailability=function(){for(var i=this.ports.length;i--;)this.ports[i].resetAvailableArea()},AutoRouterBox.prototype.adjustPortAvailability=function(box){if(!box.hasAncestorWithId(this.id)&&!this.hasAncestorWithId(box.id))for(var i=this.ports.length;i--;)this.ports[i].adjustAvailableArea(box.rect)},AutoRouterBox.prototype.addChild=function(box){assert(-1===this.childBoxes.indexOf(box),"ARBox.addChild: box already is child of "+this.id),assert(box instanceof AutoRouterBox,"Child box must be of type AutoRouterBox"),this.childBoxes.push(box),box.parent=this},AutoRouterBox.prototype.removeChild=function(box){var i=this.childBoxes.indexOf(box);assert(-1!==i,"ARBox.removeChild: box isn't child of "+this.id),this.childBoxes.splice(i,1),box.parent=null},AutoRouterBox.prototype.hasAncestorWithId=function(id){for(var box=this;box;){if(box.id===id)return!0;box=box.parent}return!1},AutoRouterBox.prototype.getRootBox=function(){for(var box=this;box.parent;)box=box.parent;return box},AutoRouterBox.prototype.isBoxAt=function(point,nearness){return Utils.isPointIn(point,this.rect,nearness)},AutoRouterBox.prototype.isBoxClip=function(r){return Utils.isRectClip(this.rect,r)},AutoRouterBox.prototype.isBoxIn=function(r){return Utils.isRectIn(this.rect,r)},AutoRouterBox.prototype.destroy=function(){var i=this.childBoxes.length;for(this.parent&&this.parent.removeChild(this),this.owner=null,this.deleteAllPorts();i--;)this.childBoxes[i].destroy()},AutoRouterBox.prototype.assertValid=function(){for(var p=this.ports.length;p--;)this.ports[p].assertValid()},module.exports=AutoRouterBox},{"./AutoRouter.Constants":11,"./AutoRouter.Point":17,"./AutoRouter.Port":19,"./AutoRouter.Rect":20,"./AutoRouter.Utils":22,assert:1}],11:[function(require,module,exports){"use strict";var ArPoint=require("./AutoRouter.Point");module.exports={EMPTY_POINT:new ArPoint(-1e5,-1e5),ED_MAXCOORD:1e5,ED_MINCOORD:-2,ED_SMALLGAP:15,CONNECTIONCUSTOMIZATIONDATAVERSION:0,EMPTYCONNECTIONCUSTOMIZATIONDATAMAGIC:-1,DEBUG:!1,BUFFER:10,EDLS_S:15,EDLS_R:16,EDLS_D:1e5+2,PathEndOnDefault:0,PathEndOnTop:16,PathEndOnRight:32,PathEndOnBottom:64,PathEndOnLeft:128,PathEndMask:240,PathStartOnDefault:0,PathStartOnTop:256,PathStartOnRight:512,PathStartOnBottom:1024,PathStartOnLeft:2048,PathStartMask:3840,PathHighLighted:2,PathFixed:1,PathDefault:0,PathStateConnected:1,PathStateDefault:0,PortEndOnTop:1,PortEndOnRight:2,PortEndOnBottom:4,PortEndOnLeft:8,PortEndOnAll:15,PortStartOnTop:16,PortStartOnRight:32,PortStartOnBottom:64,PortStartOnLeft:128,PortStartOnAll:240,PortConnectOnAll:255,PortConnectToCenter:256,PortStartEndHorizontal:170,PortStartEndVertical:85,PortDefault:255,DirNone:-1,DirTop:0,DirRight:1,DirBottom:2,DirLeft:3,DirSkew:4,SimpleEdgeDisplacement:"EdgeDisplacement",CustomPointCustomization:"PointCustomization"}},{"./AutoRouter.Point":17}],12:[function(require,module,exports){"use strict";var assert=require("assert"),CONSTANTS=require("./AutoRouter.Constants"),Utils=require("./AutoRouter.Utils"),ArPoint=require("./AutoRouter.Point"),AutoRouterEdge=function(){this.owner=null,this.startpointPrev=null,this.startpoint=null,this.endpoint=null,this.endpointNext=null,this.positionY=0,this.positionX1=0,this.positionX2=0,this.bracketClosing=!1,this.bracketOpening=!1,this.orderPrev=null,this.orderNext=null,this.sectionX1=null, this.sectionX2=null,this.sectionNext=null,this.sectionDown=null,this.edgeFixed=!1,this.edgeCustomFixed=!1,this.edgeCanPassed=!1,this.edgeDirection=null,this.blockPrev=null,this.blockNext=null,this.blockTrace=null,this.closestPrev=null,this.closestNext=null};AutoRouterEdge.prototype.assign=function(otherEdge){return null!==otherEdge?(this.owner=otherEdge.owner,this.setStartPoint(otherEdge.startpoint,!1),this.setEndPoint(otherEdge.endpoint,null!==otherEdge.endpoint),this.startpointPrev=otherEdge.startpointPrev,this.endpointNext=otherEdge.endpointNext,this.positionY=otherEdge.positionY,this.positionX1=otherEdge.positionX1,this.positionX2=otherEdge.positionX2,this.bracketClosing=otherEdge.bracketClosing,this.bracketOpening=otherEdge.bracketOpening,this.orderNext=otherEdge.orderNext,this.orderPrev=otherEdge.orderPrev,this.sectionX1=otherEdge.sectionX1,this.sectionX2=otherEdge.sectionX2,this.setSectionNext(otherEdge.getSectionNext(!0)),this.setSectionDown(otherEdge.getSectionDown(!0)),this.edgeFixed=otherEdge.edgeFixed,this.edgeCustomFixed=otherEdge.edgeCustomFixed,this.setEdgeCanpassed(otherEdge.getEdgeCanpassed()),this.setDirection(otherEdge.getDirection()),this.setBlockPrev(otherEdge.getBlockPrev()),this.setBlockNext(otherEdge.getBlockNext()),this.setBlockTrace(otherEdge.getBlockTrace()),this.setClosestPrev(otherEdge.getClosestPrev()),this.setClosestNext(otherEdge.getClosestNext()),this):null},AutoRouterEdge.prototype.equals=function(otherEdge){return this===otherEdge},AutoRouterEdge.prototype.getStartPointPrev=function(){return null!==this.startpointPrev?this.startpointPrev||this.startpointPrev:null},AutoRouterEdge.prototype.isStartPointPrevNull=function(){return!this.startpointPrev},AutoRouterEdge.prototype.getStartPoint=function(){return null!==this.startpoint?new ArPoint(this.startpoint instanceof Array?this.startpoint:this.startpoint):CONSTANTS.EMPTY_POINT},AutoRouterEdge.prototype.isSameStartPoint=function(point){return this.startpoint===point},AutoRouterEdge.prototype.isStartPointNull=function(){return null===this.startpoint},AutoRouterEdge.prototype.setStartPoint=function(point,b){this.startpoint=point,b!==!1&&this.recalculateDirection()},AutoRouterEdge.prototype.setStartPointX=function(_x){this.startpoint.x=_x},AutoRouterEdge.prototype.setStartPointY=function(_y){this.startpoint.y=_y},AutoRouterEdge.prototype.getEndPoint=function(){return null!==this.endpoint?new ArPoint(this.endpoint instanceof Array?this.endpoint:this.endpoint):CONSTANTS.EMPTY_POINT},AutoRouterEdge.prototype.isEndPointNull=function(){return null===this.endpoint},AutoRouterEdge.prototype.setEndPoint=function(point,b){this.endpoint=point,b!==!1&&this.recalculateDirection()},AutoRouterEdge.prototype.setStartAndEndPoint=function(startPoint,endPoint){this.setStartPoint(startPoint,!1),this.setEndPoint(endPoint)},AutoRouterEdge.prototype.setEndPointX=function(_x){this.endpoint.x=_x},AutoRouterEdge.prototype.setEndPointY=function(_y){this.endpoint.y=_y},AutoRouterEdge.prototype.isEndPointNextNull=function(){return!this.endpointNext},AutoRouterEdge.prototype.getSectionNext=function(){return void 0!==this.sectionNext?this.sectionNext[0]:null},AutoRouterEdge.prototype.getSectionNextPtr=function(){return this.sectionNext&&this.sectionNext[0]||(this.sectionNext=[new AutoRouterEdge]),this.sectionNext},AutoRouterEdge.prototype.setSectionNext=function(nextSection){nextSection=nextSection instanceof Array?nextSection[0]:nextSection,this.sectionNext instanceof Array?this.sectionNext[0]=nextSection:this.sectionNext=[nextSection]},AutoRouterEdge.prototype.getSectionDown=function(){return void 0!==this.sectionDown?this.sectionDown[0]:null},AutoRouterEdge.prototype.getSectionDownPtr=function(){return this.sectionDown&&this.sectionDown[0]||(this.sectionDown=[new AutoRouterEdge]),this.sectionDown},AutoRouterEdge.prototype.setSectionDown=function(downSection){downSection=downSection instanceof Array?downSection[0]:downSection,this.sectionDown instanceof Array?this.sectionDown[0]=downSection:this.sectionDown=[downSection]},AutoRouterEdge.prototype.getEdgeCanpassed=function(){return this.edgeCanPassed},AutoRouterEdge.prototype.setEdgeCanpassed=function(ecp){this.edgeCanPassed=ecp},AutoRouterEdge.prototype.getDirection=function(){return this.edgeDirection},AutoRouterEdge.prototype.setDirection=function(dir){this.edgeDirection=dir},AutoRouterEdge.prototype.recalculateDirection=function(){assert(null!==this.startpoint&&null!==this.endpoint,"AREdge.recalculateDirection: this.startpoint !== null && this.endpoint !== null FAILED!"),this.edgeDirection=Utils.getDir(this.endpoint.minus(this.startpoint))},AutoRouterEdge.prototype.getBlockPrev=function(){return this.blockPrev},AutoRouterEdge.prototype.setBlockPrev=function(prevBlock){this.blockPrev=prevBlock},AutoRouterEdge.prototype.getBlockNext=function(){return this.blockNext},AutoRouterEdge.prototype.setBlockNext=function(nextBlock){this.blockNext=nextBlock},AutoRouterEdge.prototype.getBlockTrace=function(){return this.blockTrace},AutoRouterEdge.prototype.setBlockTrace=function(traceBlock){this.blockTrace=traceBlock},AutoRouterEdge.prototype.getClosestPrev=function(){return this.closestPrev},AutoRouterEdge.prototype.setClosestPrev=function(cp){this.closestPrev=cp},AutoRouterEdge.prototype.getClosestNext=function(){return this.closestNext},AutoRouterEdge.prototype.setClosestNext=function(cp){this.closestNext=cp},module.exports=AutoRouterEdge},{"./AutoRouter.Constants":11,"./AutoRouter.Point":17,"./AutoRouter.Utils":22,assert:1}],13:[function(require,module,exports){"use strict";var Logger=require("./AutoRouter.Logger"),assert=require("assert"),CONSTANTS=require("./AutoRouter.Constants"),Utils=require("./AutoRouter.Utils"),AutoRouterBox=(require("./AutoRouter.Path"),require("./AutoRouter.Port"),require("./AutoRouter.Box")),AutoRouterEdge=require("./AutoRouter.Edge"),_logger=new Logger("AutoRouter.EdgeList"),AutoRouterEdgeList=function(b){this.owner=null,this.ishorizontal=b,this.orderFirst=null,this.orderLast=null,this.sectionFirst=null,this.sectionBlocker=null,this.sectionPtr2Blocked=[],this._initOrder(),this._initSection()};AutoRouterEdgeList.prototype.contains=function(start,end){for(var startpoint,endpoint,currentEdge=this.orderFirst;currentEdge;){if(startpoint=currentEdge.startpoint,endpoint=currentEdge.endpoint,start.equals(startpoint)&&end.equals(endpoint))return!0;currentEdge=currentEdge.orderNext}return!1},AutoRouterEdgeList.prototype.destroy=function(){this.checkOrder(),this.checkSection()},AutoRouterEdgeList.prototype.addPathEdges=function(path){assert(path.owner===this.owner,"AREdgeList.addEdges: path.owner === owner FAILED!");var startpoint,endpoint,dir,edge,i,isPathAutoRouted=path.isAutoRouted(),hasCustomEdge=!1,customizedIndexes={},indexes=[];if(isPathAutoRouted)for(i=-1;++i<indexes.length;)hasCustomEdge=!0,customizedIndexes[indexes[i]]=0;else hasCustomEdge=!0;var indItr,goodAngle,skipEdge,isMoveable,isEdgeCustomFixed,startPort,endPort,isStartPortConnectToCenter,isEndPortConnectToCenter,isPathFixed,pointList=path.getPointList(),ptrsObject=pointList.getTailEdgePtrs(),currEdgeIndex=pointList.length-2,pos=ptrsObject.pos;for(startpoint=ptrsObject.start,endpoint=ptrsObject.end;pointList.length&&pos>=0;)dir=Utils.getDir(endpoint.minus(startpoint)),skipEdge=dir===CONSTANTS.DirNone?!0:!1,isMoveable=path.isMoveable(),isMoveable||dir===CONSTANTS.DirSkew||(goodAngle=Utils.isRightAngle(dir),assert(goodAngle,"AREdgeList.addEdges: Utils.isRightAngle (dir) FAILED!"),goodAngle||(skipEdge=!0)),!skipEdge&&Utils.isRightAngle(dir)&&Utils.isHorizontal(dir)===this.ishorizontal&&(edge=new AutoRouterEdge,edge.owner=path,edge.setStartAndEndPoint(startpoint,endpoint),edge.startpointPrev=pointList.getPointBeforeEdge(pos),edge.endpointNext=pointList.getPointAfterEdge(pos),hasCustomEdge?(isEdgeCustomFixed=!1,isPathAutoRouted?(indItr=customizedIndexes.indexOf(currEdgeIndex),isEdgeCustomFixed=indItr!==customizedIndexes.length-1):isEdgeCustomFixed=!0,edge.edgeCustomFixed=isEdgeCustomFixed):edge.edgeCustomFixed=dir===CONSTANTS.DirSkew,startPort=path.getStartPort(),assert(null!==startPort,"AREdgeList.addEdges: startPort !== null FAILED!"),isStartPortConnectToCenter=startPort.isConnectToCenter(),endPort=path.getEndPort(),assert(null!==endPort,"AREdgeList.addEdges: endPort !== null FAILED!"),isEndPortConnectToCenter=endPort.isConnectToCenter(),isPathFixed=path.isFixed()||!path.isAutoRouted(),edge.edgeFixed=edge.edgeCustomFixed||isPathFixed||edge.isStartPointPrevNull()&&isStartPortConnectToCenter||edge.isEndPointNextNull()&&isEndPortConnectToCenter,dir!==CONSTANTS.DirSkew?(this._positionLoadY(edge),this._positionLoadB(edge)):(edge.positionY=0,edge.bracketOpening=!1,edge.bracketClosing=!1),this.insert(edge)),ptrsObject=pointList.getPrevEdgePtrs(pos),pos=ptrsObject.pos,startpoint=ptrsObject.start,endpoint=ptrsObject.end,currEdgeIndex--;return!0},AutoRouterEdgeList.prototype.addPortEdges=function(port){var startpoint,endpoint,edge,selfPoints,startpointPrev,endpointNext,dir,i,canHaveStartEndPointHorizontal;if(assert(port.owner.owner===this.owner,"AREdgeList.addEdges: port.owner === (owner) FAILED!"),!port.isConnectToCenter()&&!port.owner.isAtomic())for(selfPoints=port.selfPoints,i=0;4>i;i++)startpointPrev=selfPoints[(i+3)%4],startpoint=selfPoints[i],endpoint=selfPoints[(i+1)%4],endpointNext=selfPoints[(i+2)%4],dir=Utils.getDir(endpoint.minus(startpoint)),assert(Utils.isRightAngle(dir),"AREdgeList.addEdges: Utils.isRightAngle (dir) FAILED!"),canHaveStartEndPointHorizontal=port.canHaveStartEndPointHorizontal(this.ishorizontal),Utils.isHorizontal(dir)===this.ishorizontal&&canHaveStartEndPointHorizontal&&(edge=new AutoRouterEdge,edge.owner=port,edge.setStartAndEndPoint(startpoint,endpoint),edge.startpointPrev=startpointPrev,edge.endpointNext=endpointNext,edge.edgeFixed=!0,this._positionLoadY(edge),this._positionLoadB(edge),edge.bracketClosing&&edge.addToPosition(.999),this.insert(edge))},AutoRouterEdgeList.prototype.addEdges=function(path){var selfPoints,startpoint,startpointPrev,endpointNext,endpoint,edge,dir,i;if(path instanceof AutoRouterBox){var box=path;for(assert(box.owner===this.owner,"AREdgeList.addEdges: box.owner === (owner) FAILED!"),selfPoints=box.selfPoints,i=0;4>i;i++)startpointPrev=selfPoints[(i+3)%4],startpoint=selfPoints[i],endpoint=selfPoints[(i+1)%4],endpointNext=selfPoints[(i+2)%4],dir=Utils.getDir(endpoint.minus(startpoint)),assert(Utils.isRightAngle(dir),"AREdgeList.addEdges: Utils.isRightAngle (dir) FAILED!"),Utils.isHorizontal(dir)===this.ishorizontal&&(edge=new AutoRouterEdge,edge.owner=box,edge.setStartAndEndPoint(startpoint,endpoint),edge.startpointPrev=startpointPrev,edge.endpointNext=endpointNext,edge.edgeFixed=!0,this._positionLoadY(edge),this._positionLoadB(edge),edge.bracketClosing&&edge.addToPosition(.999),this.insert(edge))}else if(path){var graph=path;for(assert(graph===this.owner,"AREdgeList.addEdges: graph === this.owner FAILED!"),selfPoints=graph.selfPoints,i=0;4>i;i++)startpointPrev=selfPoints[(i+3)%4],startpoint=selfPoints[i],endpoint=selfPoints[(i+1)%4],endpointNext=selfPoints[(i+2)%4],dir=Utils.getDir(endpoint.minus(startpoint)),assert(Utils.isRightAngle(dir),"AREdgeList.addEdges: Utils.isRightAngle (dir) FAILED!"),Utils.isHorizontal(dir)===this.ishorizontal&&(edge=new AutoRouterEdge,edge.owner=graph,edge.setStartAndEndPoint(startpoint,endpoint),edge.startpointPrev=startpointPrev,edge.endpointNext=endpointNext,edge.edgeFixed=!0,this._positionLoadY(edge),this.insert(edge))}},AutoRouterEdgeList.prototype.deleteEdges=function(object){for(var next,edge=this.orderFirst;null!==edge;)edge.owner===object?(next=edge.orderNext,this.remove(edge),edge=next):edge=edge.orderNext},AutoRouterEdgeList.prototype.deleteAllEdges=function(){for(;this.orderFirst;)this.remove(this.orderFirst)},AutoRouterEdgeList.prototype.getEdge=function(path,startpoint){for(var edge=this.orderFirst;null!==edge&&!edge.isSameStartPoint(startpoint);)edge=edge.orderNext;return assert(null!==edge,"AREdgeList.getEdge: edge !== null FAILED!"),edge},AutoRouterEdgeList.prototype.getEdgeByPointer=function(startpoint){for(var edge=this.orderFirst;null!==edge&&!edge.isSameStartPoint(startpoint);)edge=edge.orderNext;return assert(null!==edge,"AREdgeList.getEdgeByPointer: edge !== null FAILED!"),edge},AutoRouterEdgeList.prototype.setEdgeByPointer=function(pEdge,newEdge){assert(newEdge instanceof AutoRouterEdge,"AREdgeList.setEdgeByPointer: newEdge instanceof AutoRouterEdge FAILED!");for(var edge=this.sectionFirst;null!==edge&&pEdge!==edge;)edge=edge.getSectionDown();assert(null!==edge,"AREdgeList.setEdgeByPointer: edge !== null FAILED!"),edge=newEdge},AutoRouterEdgeList.prototype.getEdgeAt=function(point,nearness){for(var edge=this.orderFirst;edge;){if(Utils.isPointNearLine(point,edge.startpoint,edge.endpoint,nearness))return edge;edge=edge.orderNext}return null},AutoRouterEdgeList.prototype.dumpEdges=function(msg,logger){var edge=this.orderFirst,log=logger||_logger.debug,total=1;for(log(msg);null!==edge;)log(" "+edge.startpoint.x+", "+edge.startpoint.y+" "+edge.endpoint.x+", "+edge.endpoint.y+" ("+(edge.edgeFixed?"FIXED":"MOVEABLE")+") "+(edge.bracketClosing?"Bracket Closing":edge.bracketOpening?"Bracket Opening":"")),edge=edge.orderNext,total++;log("Total Edges: "+total)},AutoRouterEdgeList.prototype.getEdgeCount=function(){for(var edge=this.orderFirst,total=1;null!==edge;)edge=edge.orderNext,total++;return total},AutoRouterEdgeList.prototype._positionGetRealY=function(edge,y){return void 0===y?this.ishorizontal?(assert(edge.startpoint.y===edge.endpoint.y,"AREdgeList.position_GetRealY: edge.startpoint.y === edge.endpoint.y FAILED!"),edge.startpoint.y):(assert(edge.startpoint.x===edge.endpoint.x,"AREdgeList.position_GetRealY: edge.startpoint.x === edge.endpoint.x FAILED!"),edge.startpoint.x):(assert(null!==edge&&!edge.isStartPointNull()&&!edge.isEndPointNull(),"AREdgeList.position_GetRealY: edge !== null && !edge.isStartPointNull() && !edge.isEndPointNull() FAILED!"),void(this.ishorizontal?(assert(edge.startpoint.y===edge.endpoint.y,"AREdgeList.position_GetRealY: edge.startpoint.y === edge.endpoint.y FAILED!"),edge.setStartPointY(y),edge.setEndPointY(y)):(assert(edge.startpoint.x===edge.endpoint.x,"AREdgeList.position_GetRealY: edge.startpoint.x === edge.endpoint.x FAILED"),edge.setStartPointX(y),edge.setEndPointX(y))))},AutoRouterEdgeList.prototype._positionSetRealY=function(edge,y){edge instanceof Array&&(edge=edge[0]),assert(null!==edge&&!edge.isStartPointNull()&&!edge.isEndPointNull(),"AREdgeList.position_SetRealY: edge != null && !edge.isStartPointNull() && !edge.isEndPointNull() FAILED"),this.ishorizontal?(assert(edge.startpoint.y===edge.endpoint.y,"AREdgeList.position_SetRealY: edge.startpoint.y === edge.endpoint.y FAILED"),edge.setStartPointY(y),edge.setEndPointY(y)):(assert(edge.startpoint.x===edge.endpoint.x,"AREdgeList.position_SetRealY: edge.startpoint.x === edge.endpoint.x FAILED"),edge.setStartPointX(y),edge.setEndPointX(y))},AutoRouterEdgeList.prototype._positionGetRealX=function(edge){assert(null!==edge&&!edge.isStartPointNull()&&!edge.isEndPointNull(),"AREdgeList.position_GetRealX: edge !== null && !edge.isStartPointNull() && !edge.isEndPointNull() FAILED");var x1,x2;return this.ishorizontal?(assert(edge.startpoint.y===edge.endpoint.y,"AREdgeList.position_GetRealX: edge.startpoint.y === edge.endpoint.y FAILED"),edge.startpoint.x<edge.endpoint.x?(x1=edge.startpoint.x,x2=edge.endpoint.x):(x1=edge.endpoint.x,x2=edge.startpoint.x)):(assert(edge.startpoint.x===edge.endpoint.x,"AREdgeList.position_GetRealX: edge.startpoint.x === edge.endpoint.x FAILED"),edge.startpoint.y<edge.endpoint.y?(x1=edge.startpoint.y,x2=edge.endpoint.y):(x1=edge.endpoint.y,x2=edge.startpoint.y)),[x1,x2]},AutoRouterEdgeList.prototype._positionGetRealO=function(edge){assert(null!==edge&&!edge.isStartPointNull()&&!edge.isEndPointNull(),"AREdgeList.position_GetRealO: edge !== null && !edge.isStartPointNull() && !edge.isEndPointNull() FAILED");var o1,o2;return this.ishorizontal?(assert(edge.startpoint.y===edge.endpoint.y,"AREdgeList.position_GetRealO: edge.startpoint.y === edge.endpoint.y FAILED"),edge.startpoint.x<edge.endpoint.x?(o1=edge.isStartPointPrevNull()?0:edge.startpointPrev.y-edge.startpoint.y,o2=edge.isEndPointNextNull()?0:edge.endpointNext.y-edge.endpoint.y):(o1=edge.isEndPointNextNull()?0:edge.endpointNext.y-edge.endpoint.y,o2=edge.isStartPointPrevNull()?0:edge.startpointPrev.y-edge.startpoint.y)):(assert(edge.startpoint.x===edge.endpoint.x,"AREdgeList.position_GetRealO: edge.startpoint.x === edge.endpoint.x FAILED"),edge.startpoint.y<edge.endpoint.y?(o1=edge.isStartPointPrevNull()?0:edge.startpointPrev.x-edge.startpoint.x,o2=edge.isEndPointNextNull()?0:edge.endpointNext.x-edge.endpoint.x):(o1=edge.isEndPointNextNull()?0:edge.endpointNext.x-edge.endpoint.x,o2=edge.isStartPointPrevNull()?0:edge.startpointPrev.x-edge.startpoint.x)),[o1,o2]},AutoRouterEdgeList.prototype._positionLoadY=function(edge){assert(null!==edge&&null===edge.orderNext&&null===edge.orderPrev,"AREdgeList.position_LoadY: edge !== null && edge.orderNext === null && edge.orderPrev === null FAILED"),edge.positionY=this._positionGetRealY(edge)},AutoRouterEdgeList.prototype._positionLoadB=function(edge){assert(null!==edge,"AREdgeList.position_LoadB: edge !== null FAILED"),edge.bracketOpening=!edge.edgeFixed&&this._bracketIsOpening(edge),edge.bracketClosing=!edge.edgeFixed&&this._bracketIsClosing(edge)},AutoRouterEdgeList.prototype._positionAllStoreY=function(){for(var edge=this.orderFirst;edge;)this._positionSetRealY(edge,edge.positionY),edge=edge.orderNext},AutoRouterEdgeList.prototype._positionAllLoadX=function(){for(var pts,edge=this.orderFirst;edge;)pts=this._positionGetRealX(edge),edge.positionX1=pts[0],edge.positionX2=pts[1],edge=edge.orderNext},AutoRouterEdgeList.prototype._initOrder=function(){this.orderFirst=null,this.orderLast=null},AutoRouterEdgeList.prototype._checkOrder=function(){assert(null===this.orderFirst&&null===this.orde