=0?hu?(e-i)*(e-i)+(t-a)*(t-a):l-f},yt=function(e,t,n){for(var r,i,a,o,c=0,u=0;u=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&c++}return c%2!==0},wt=function(e,t,n,r,i,a,o,c,u){var l,s=new Array(n.length);null!=c[0]?(l=Math.atan(c[1]/c[0]),c[0]<0?l+=Math.PI/2:l=-l-Math.PI/2):l=c;for(var f,d=Math.cos(-l),h=Math.sin(-l),p=0;p0){var g=kt(s,-u);f=xt(g)}else f=s;return yt(e,t,f)},xt=function(e){for(var t,n,r,i,a,o,c,u,l=new Array(e.length/2),s=0;s=0&&p<=1&&b.push(p),g>=0&&g<=1&&b.push(g),0===b.length)return[];var v=b[0]*c[0]+e,m=b[0]*c[1]+t;return b.length>1?b[0]==b[1]?[v,m]:[v,m,b[1]*c[0]+e,b[1]*c[1]+t]:[v,m]},Ct=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Pt=function(e,t,n,r,i,a,o,c,u){var l=e-i,s=n-e,f=o-i,d=t-a,h=r-t,p=c-a,g=f*d-p*l,b=s*d-h*l,v=p*s-f*h;if(0!==v){var m=g/v,y=b/v,w=-.001;return w<=m&&m<=1.001&&w<=y&&y<=1.001||u?[e+m*s,t+m*h]:[]}return 0===g||0===b?Ct(e,n,o)===o?[o,c]:Ct(e,n,i)===i?[i,a]:Ct(i,o,n)===n?[n,r]:[]:[]},_t=function(e,t,n,r,i,a,o,c){var u,l,s,f,d,h,p=[],g=new Array(n.length),b=!0;if(null==a&&(b=!1),b){for(var v=0;v0){var m=kt(g,-c);l=xt(m)}else l=g}else l=n;for(var y=0;ys&&(s=t)},d=function(e){return l[e]},h=0;h0?w.edgesTo(y)[0]:y.edgesTo(w)[0];var k=r(x);y=y.id(),h[y]>h[v]+k&&(h[y]=h[v]+k,p.nodes.indexOf(y)<0?p.push(y):p.updateItem(y),s[y]=0,l[y]=[]),h[y]==h[v]+k&&(s[y]=s[y]+s[v],l[y].push(v))}else for(var S=0;S0;){for(var _=n.pop(),T=0;T0&&o.push(n[c]);0!==o.length&&i.push(r.collection(o))}return i}(s,u,t,r);return y=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Jt,o=r,c=0;c=2?on(e,t,n,0,nn,rn):on(e,t,n,0,tn)},squaredEuclidean:function(e,t,n){return on(e,t,n,0,nn)},manhattan:function(e,t,n){return on(e,t,n,0,tn)},max:function(e,t,n){return on(e,t,n,-1/0,an)}};function un(e,t,n,r,i,a){var o;return o=S(e)?e:cn[e]||cn.euclidean,0===t&&S(e)?o(i,a):o(t,n,r,i,a)}cn["squared-euclidean"]=cn.squaredEuclidean,cn.squaredeuclidean=cn.squaredEuclidean;var ln=Ee({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),sn=function(e){return ln(e)},fn=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,c=t;return un(e,r.length,a,(function(e){return r[e](t)}),o,c)},dn=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),c=null,u=0;un)return!1}return!0},bn=function(e,t,n){for(var r=0;ri&&(i=t[u][l],a=l);o[a].push(e[u])}for(var s=0;s=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var h,p=t[o],g=t[r[o]];h="dendrogram"===i.mode?{left:p,right:g,key:p.key}:{value:p.value.concat(g.value),key:p.key},e[p.index]=h,e.splice(g.index,1),t[p.key]=h;for(var b=0;bn[g.key][v.key]&&(a=n[g.key][v.key])):"max"===i.linkage?(a=n[p.key][v.key],n[p.key][v.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var a=0,o=e.length-1;o>=0;o--){var c=e[o];i?isFinite(c)||(e[o]=-1/0,a++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var u=e.length,l=Math.floor(u/2);return u%2!==0?e[l+1+a]:(e[l-1+a]+e[l+a])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=u,o=t[i*e+u])}a>0&&r.push(a)}for(var l=0;l=_?(T=_,_=j,O=R):j>T&&(T=j);for(var M=0;M0?1:0;S[k%l.minIterations*t+z]=B,D+=B}if(D>0&&(k>=l.minIterations-1||k==l.maxIterations-1)){for(var H=0,F=0;F0&&r.push(i);return r}(t,a,o),Y=function(e,t,n){for(var r=Nn(e,t,n),i=0;iu&&(c=l,u=s)}n[i]=a[c]}return Nn(e,t,n)}(t,r,V),W={},q=0;q1||o>1)&&(l=!0),s[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&s[t].push(e.id())}))}else f[t]=[void 0,e.target().id()]})):u.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?l=!0:r=t:n=t),s[t]=[],e.connectedEdges().forEach((function(e){return s[t].push(e.id())}))):f[t]=[e.source().id(),e.target().id()]}));var d={found:!1,trail:void 0};if(l)return d;if(r&&n)if(c){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=u[0].id());var h=function(e){for(var t,n,r,i=e,a=[e];s[i].length;)t=s[i].shift(),n=f[t][0],i!=(r=f[t][1])?(s[r]=s[r].filter((function(e){return e!=t})),i=r):c||i==n||(s[n]=s[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},p=[],g=[];for(g=h(i);1!=g.length;)0==s[g[0]].length?(p.unshift(u.getElementById(g.shift())),p.unshift(u.getElementById(g.shift()))):g=h(g.shift()).concat(g);for(var b in p.unshift(u.getElementById(g.shift())),s)if(s[b].length)return d;return d.found=!0,d.trail=this.spawn(p,!0),d}},Bn=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},c=function c(u,l,s){u===s&&(r+=1),t[l]={id:n,low:n++,cutVertex:!1};var f,d,h,p,g=e.getElementById(l).connectedEdges().intersection(e);0===g.size()?i.push(e.spawn(e.getElementById(l))):g.forEach((function(n){f=n.source().id(),d=n.target().id(),(h=f===l?d:f)!==s&&(p=n.id(),o[p]||(o[p]=!0,a.push({x:l,y:h,edge:n})),h in t?t[l].low=Math.min(t[l].low,t[h].id):(c(u,h,l),t[l].low=Math.min(t[l].low,t[h].low),t[l].id<=t[h].low&&(t[l].cutVertex=!0,function(n,r){for(var o=a.length-1,c=[],u=e.spawn();a[o].x!=n||a[o].y!=r;)c.push(a.pop().edge),o--;c.push(a.pop().edge),c.forEach((function(n){var r=n.connectedNodes().intersection(e);u.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);u.merge(n),t[r].cutVertex?u.merge(i.filter((function(e){return e.isLoop()}))):u.merge(i)}))})),i.push(u)}(l,h))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,c(n,n),t[n].cutVertex=r>1)}}));var u=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(u),components:i}},Hn=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(c){if(i.push(c),t[c]={index:n,low:n++,explored:!1},e.getElementById(c).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==c&&(n in t||o(n),t[n].explored||(t[c].low=Math.min(t[c].low,t[n].low)))})),t[c].index===t[c].low){for(var u=e.spawn();;){var l=i.pop();if(u.merge(e.getElementById(l)),t[l].low=t[c].index,t[l].explored=!0,l===c)break}var s=u.edgesWith(u),f=u.merge(s);r.push(f),a=a.difference(f)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:a,components:r}},Fn={};[Ne,Ae,De,Be,Fe,Ve,Ue,At,zt,Ht,Gt,Zt,kn,jn,An,zn,{hopcroftTarjanBiconnected:Bn,htbc:Bn,htb:Bn,hopcroftTarjanBiconnectedComponents:Bn},{tarjanStronglyConnected:Hn,tsc:Hn,tscc:Hn,tarjanStronglyConnectedComponents:Hn}].forEach((function(e){G(Fn,e)}));var Gn=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"===typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Gn.prototype={fulfill:function(e){return Vn(this,1,"fulfillValue",e)},reject:function(e){return Vn(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Gn;return n.onFulfilled.push(qn(e,r,"fulfill")),n.onRejected.push(qn(t,r,"reject")),Yn(n),r.proxy}};var Vn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Yn(e)),e},Yn=function(e){1===e.state?Wn(e,"onFulfilled",e.fulfillValue):2===e.state&&Wn(e,"onRejected",e.rejectReason)},Wn=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){E(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};nr.className=nr.classNames=nr.classes;var rr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:H,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};rr.variable="(?:[\\w-.]|(?:\\\\"+rr.metaChar+"))+",rr.className="(?:[\\w-]|(?:\\\\"+rr.metaChar+"))+",rr.value=rr.string+"|"+rr.number,rr.id=rr.variable,function(){var e,t,n;for(e=rr.comparatorOp.split("|"),n=0;n=0||"="!==t&&(rr.comparatorOp+="|\\!"+t)}();var ir=0,ar=1,or=2,cr=3,ur=4,lr=5,sr=6,fr=7,dr=8,hr=9,pr=10,gr=11,br=12,vr=13,mr=14,yr=15,wr=16,xr=17,kr=18,Sr=19,Er=20,Cr=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*F(e,t)}(e.selector,t.selector)})),Pr=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return ye("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return ye("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&ye("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return k(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,c=r.value;switch(o){case ir:var u=e(c);return u.substring(0,u.length-1);case cr:var l=r.field,s=r.operator;return"["+l+n(e(s))+t(c)+"]";case lr:var f=r.operator,d=r.field;return"["+e(f)+d+"]";case ur:return"["+r.field+"]";case sr:var h=r.operator;return"[["+r.field+n(e(h))+t(c)+"]]";case fr:return c;case dr:return"#"+c;case hr:return"."+c;case xr:case yr:return i(r.parent,a)+n(">")+i(r.child,a);case kr:case wr:return i(r.ancestor,a)+" "+i(r.descendant,a);case Sr:var p=i(r.left,a),g=i(r.subject,a),b=i(r.right,a);return p+(p.length>0?" ":"")+g+b;case Er:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),s=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),l=!0),(o||u||l)&&(i=o||c?""+e:"",a=""+n),l&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":f=!0,r=e>n;break;case">=":f=!0,r=e>=n;break;case"<":f=!0,r=e0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function qr(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Wr(this,e,t,qr)},Yr.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Wr(this,e,t,Ur)},Yr.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Wr(this,e,t,$r)},Yr.ancestors=Yr.parents,(Fr=Gr={data:er.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:er.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:er.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:er.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:er.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:er.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Fr.data,Fr.removeAttr=Fr.removeData;var Kr,Xr,Qr=Gr,Zr={};function Jr(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;ot})),minIndegree:ei("indegree",(function(e,t){return et})),minOutdegree:ei("outdegree",(function(e,t){return et}))}),G(Zr,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,s=l;l&&(u=u[0]);var f=s?u.position():{x:0,y:0};return i={x:c.x-f.x,y:c.y-f.y},void 0===e?i:i[e]}for(var d=0;d0,b=g;g&&(p=p[0]);var v=b?p.position():{x:0,y:0};void 0!==t?h.position(e,t+v[e]):void 0!==i&&h.position({x:i.x+v.x,y:i.y+v.y})}}else if(!a)return;return this}},Kr.modelPosition=Kr.point=Kr.position,Kr.modelPositions=Kr.points=Kr.positions,Kr.renderedPoint=Kr.renderedPosition,Kr.relativePoint=Kr.relativePosition;var ri,ii,ai=Xr;ri=ii={},ii.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,c=t.y1*r+i.y,u=t.y2*r+i.y;return{x1:a,x2:o,y1:c,y2:u,w:o-a,h:u-c}},ii.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},ii.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var c=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(c=100*c/i.width.val);var u=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(u=100*u/i.width.val);var l=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(l=100*l/i.height.val);var s=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(s=100*s/i.height.val);var f=v(i.width.val-a.w,c,u),d=f.biasDiff,h=f.biasComplementDiff,p=v(i.height.val-a.h,l,s),g=p.biasDiff,b=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+h)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+b)/2}function v(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ui=function(e,t){return null==t?e:ci(e,t.x1,t.y1,t.x2,t.y2)},li=function(e,t,n){return _e(e,t,n)},si=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,c=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var u=a.arrowBounds=a.arrowBounds||{},l=u[n]=u[n]||{};l.x1=r-c,l.y1=i-c,l.x2=r+c,l.y2=i+c,l.w=l.x2-l.x1,l.h=l.y2-l.y1,ut(l,1),ci(e,l.x1,l.y1,l.x2,l.y2)}}},fi=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,c,u,l,s=t.pstyle("text-halign"),f=t.pstyle("text-valign"),d=li(a,"labelWidth",n),h=li(a,"labelHeight",n),p=li(a,"labelX",n),g=li(a,"labelY",n),b=t.pstyle(r+"text-margin-x").pfValue,v=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),y=t.pstyle(r+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,x=t.pstyle("text-border-width").pfValue/2,k=t.pstyle("text-background-padding").pfValue,S=h,E=d,C=E/2,P=S/2;if(m)o=p-C,c=p+C,u=g-P,l=g+P;else{switch(s.value){case"left":o=p-E,c=p;break;case"center":o=p-C,c=p+C;break;case"right":o=p,c=p+E}switch(f.value){case"top":u=g-S,l=g;break;case"center":u=g-P,l=g+P;break;case"bottom":u=g,l=g+S}}o+=b-Math.max(w,x)-k-2,c+=b+Math.max(w,x)+k+2,u+=v-Math.max(w,x)-k-2,l+=v+Math.max(w,x)+k+2;var _=n||"main",T=i.labelBounds,O=T[_]=T[_]||{};O.x1=o,O.y1=u,O.x2=c,O.y2=l,O.w=c-o,O.h=l-u;var j=m&&"autorotate"===y.strValue,R=null!=y.pfValue&&0!==y.pfValue;if(j||R){var M=j?li(i.rstyle,"labelAngle",n):y.pfValue,I=Math.cos(M),N=Math.sin(M),L=(o+c)/2,A=(u+l)/2;if(!m){switch(s.value){case"left":L=c;break;case"right":L=o}switch(f.value){case"top":A=l;break;case"bottom":A=u}}var D=function(e,t){return{x:(e-=L)*I-(t-=A)*N+L,y:e*N+t*I+A}},z=D(o,u),B=D(o,l),H=D(c,u),F=D(c,l);o=Math.min(z.x,B.x,H.x,F.x),c=Math.max(z.x,B.x,H.x,F.x),u=Math.min(z.y,B.y,H.y,F.y),l=Math.max(z.y,B.y,H.y,F.y)}var G=_+"Rot",V=T[G]=T[G]||{};V.x1=o,V.y1=u,V.x2=c,V.y2=l,V.w=c-o,V.h=l-u,ci(e,o,u,c,l),ci(i.labelBounds.all,o,u,c,l)}return e}},di=function(e){var t=0,n=function(e){return(e?1:0)<(r=T[1].x)){var O=n;n=r,r=O}if(i>(a=T[1].y)){var j=i;i=a,a=j}ci(d,n-S,i-S,r+S,a+S)}}else if("bezier"===_||"unbundled-bezier"===_||"segments"===_||"taxi"===_){var R;switch(_){case"bezier":case"unbundled-bezier":R=b.bezierPts;break;case"segments":case"taxi":R=b.linePts}if(null!=R)for(var M=0;M(r=L.x)){var A=n;n=r,r=A}if((i=N.y)>(a=L.y)){var D=i;i=a,a=D}ci(d,n-=S,i-=S,r+=S,a+=S)}if(s&&t.includeEdges&&g&&(si(d,e,"mid-source"),si(d,e,"mid-target"),si(d,e,"source"),si(d,e,"target")),s&&"yes"===e.pstyle("ghost").value){var z=e.pstyle("ghost-offset-x").pfValue,B=e.pstyle("ghost-offset-y").pfValue;ci(d,d.x1+z,d.y1+B,d.x2+z,d.y2+B)}var H=h.bodyBounds=h.bodyBounds||{};st(H,d),lt(H,v),ut(H,1),s&&(n=d.x1,r=d.x2,i=d.y1,a=d.y2,ci(d,n-k,i-k,r+k,a+k));var F=h.overlayBounds=h.overlayBounds||{};st(F,d),lt(F,v),ut(F,1);var G=h.labelBounds=h.labelBounds||{};null!=G.all?((u=G.all).x1=1/0,u.y1=1/0,u.x2=-1/0,u.y2=-1/0,u.w=0,u.h=0):G.all=ot(),s&&t.includeLabels&&(t.includeMainLabels&&fi(d,e,null),g&&(t.includeSourceLabels&&fi(d,e,"source"),t.includeTargetLabels&&fi(d,e,"target")))}return d.x1=oi(d.x1),d.y1=oi(d.y1),d.x2=oi(d.x2),d.y2=oi(d.y2),d.w=oi(d.x2-d.x1),d.h=oi(d.y2-d.y1),d.w>0&&d.h>0&&y&&(lt(d,v),ut(d,1)),d}(e,gi),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,!a){var s=e.isNode();n=ot(),(t.includeNodes&&s||t.includeEdges&&!s)&&(t.includeOverlays?ui(n,r.overlayBounds):ui(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?ui(n,r.labelBounds.all):(t.includeMainLabels&&ui(n,r.labelBounds.mainRot),t.includeSourceLabels&&ui(n,r.labelBounds.sourceRot),t.includeTargetLabels&&ui(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},gi={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,useCache:!0},bi=di(gi),vi=Ee(gi);ii.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=ot();var n=vi(e=e||gi),r=this;if(r.cy().styleEnabled())for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:Mi,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;c--)o(c);return this},Ni.removeAllListeners=function(){return this.removeListener("*")},Ni.emit=Ni.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,E(t)||(t=[t]),Di(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&k(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;ir&&(r=c,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(C(e)){var i=e;r.applyBypass(this,i,false),this.emitAndNotify("style")}else if(k(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,false),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style(),r=this;if(void 0===e)for(var i=0;i0&&t.push(s[0]),t.push(c[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),ca.neighbourhood=ca.neighborhood,ca.closedNeighbourhood=ca.closedNeighborhood,ca.openNeighbourhood=ca.openNeighborhood,G(ca,{source:Vr((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Vr((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:fa({attr:"source"}),targets:fa({attr:"target"})}),G(ca,{edgesWith:Vr(da(),"edgesWith"),edgesTo:Vr(da({thisIsSrc:!0}),"edgesTo")}),G(ca,{connectedEdges:Vr((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),ca.componentsOf=ca.components;var pa=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(void 0!==e){var r=new Oe,i=!1;if(t){if(t.length>0&&C(t[0])&&!O(t[0])){i=!0;for(var a=[],o=new Re,c=0,u=t.length;c0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,c=[],u=[],l=0,s=i.length;l0){for(var z=e.length===i.length?i:new pa(a,e),B=0;B0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?_.emitAndNotify("remove"):t&&_.emit("remove"));for(var T=0;Tf&&Math.abs(c.v)>f;);return a?function(e){return l[e*(l.length-1)|0]}:s}}(),ma=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,c=10,u=11,l=1/(u-1),s="undefined"!==typeof Float32Array;if(4!==arguments.length)return!1;for(var f=0;f<4;++f)if("number"!==typeof arguments[f]||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var d=s?new Float32Array(u):new Array(u);function h(e,t){return 1-3*t+3*e}function p(e,t){return 3*t-6*e}function g(e){return 3*e}function b(e,t,n){return((h(t,n)*e+p(t,n))*e+g(t))*e}function v(e,t,n){return 3*h(t,n)*e*e+2*p(t,n)*e+g(t)}function m(t,r){for(var a=0;a0?i=u:r=u}while(Math.abs(a)>o&&++l=a?m(t,c):0===s?c:w(t,r,r+l)}var k=!1;function S(){k=!0,e===t&&n===r||y()}var E=function(i){return k||S(),e===t&&n===r?i:0===i?0:1===i?1:b(x(i),t,r)};E.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var C="generateBezier("+[e,t,n,r]+")";return E.toString=function(){return C},E}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},ya={linear:function(e,t,n){return e+(t-e)*n},ease:ma(.25,.1,.25,1),"ease-in":ma(.42,0,1,1),"ease-out":ma(0,0,.58,1),"ease-in-out":ma(.42,0,.58,1),"ease-in-sine":ma(.47,0,.745,.715),"ease-out-sine":ma(.39,.575,.565,1),"ease-in-out-sine":ma(.445,.05,.55,.95),"ease-in-quad":ma(.55,.085,.68,.53),"ease-out-quad":ma(.25,.46,.45,.94),"ease-in-out-quad":ma(.455,.03,.515,.955),"ease-in-cubic":ma(.55,.055,.675,.19),"ease-out-cubic":ma(.215,.61,.355,1),"ease-in-out-cubic":ma(.645,.045,.355,1),"ease-in-quart":ma(.895,.03,.685,.22),"ease-out-quart":ma(.165,.84,.44,1),"ease-in-out-quart":ma(.77,0,.175,1),"ease-in-quint":ma(.755,.05,.855,.06),"ease-out-quint":ma(.23,1,.32,1),"ease-in-out-quint":ma(.86,0,.07,1),"ease-in-expo":ma(.95,.05,.795,.035),"ease-out-expo":ma(.19,1,.22,1),"ease-in-out-expo":ma(1,0,0,1),"ease-in-circ":ma(.6,.04,.98,.335),"ease-out-circ":ma(.075,.82,.165,1),"ease-in-out-circ":ma(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return ya.linear;var r=va(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":ma};function wa(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function xa(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function ka(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=xa(e,i),c=xa(t,i);if(P(o)&&P(c))return wa(a,o,c,n,r);if(E(o)&&E(c)){for(var u=[],l=0;l0?("spring"===f&&d.push(o.duration),o.easingImpl=ya[f].apply(null,d)):o.easingImpl=ya[f]}var h,p=o.easingImpl;if(h=0===o.duration?1:(n-u)/o.duration,o.applying&&(h=o.progress),h<0?h=0:h>1&&(h=1),null==o.delay){var g=o.startPosition,b=o.position;if(b&&i&&!e.locked()){var v={};Ea(g.x,b.x)&&(v.x=ka(g.x,b.x,h,p)),Ea(g.y,b.y)&&(v.y=ka(g.y,b.y,h,p)),e.position(v)}var m=o.startPan,y=o.pan,w=a.pan,x=null!=y&&r;x&&(Ea(m.x,y.x)&&(w.x=ka(m.x,y.x,h,p)),Ea(m.y,y.y)&&(w.y=ka(m.y,y.y,h,p)),e.emit("pan"));var S=o.startZoom,E=o.zoom,C=null!=E&&r;C&&(Ea(S,E)&&(a.zoom=at(a.minZoom,ka(S,E,h,p),a.maxZoom)),e.emit("zoom")),(x||C)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&i){for(var _=0;_=0;t--){(0,e[t])()}e.splice(0,e.length)},s=a.length-1;s>=0;s--){var f=a[s],d=f._private;d.stopped?(a.splice(s,1),d.hooked=!1,d.playing=!1,d.started=!1,l(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||Ca(0,f,e),Sa(t,f,e,n),d.applying&&(d.applying=!1),l(d.frames),null!=d.step&&d.step(e),f.completed()&&(a.splice(s,1),d.hooked=!1,d.playing=!1,d.started=!1,l(d.completes)),c=!0)}return n||0!==a.length||0!==o.length||r.push(t),c}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var _a={animate:er.animate(),animation:er.animation(),animated:er.animated(),clearQueue:er.clearQueue(),delay:er.delay(),delayAnimation:er.delayAnimation(),stop:er.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){Pa(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&X((function(n){Pa(n,e),t()}))}()}}},Ta={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&O(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Oa=function(e){return k(e)?new zr(e):e},ja={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Ii(Ta,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Oa(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Oa(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Oa(t),n),this},once:function(e,t,n){return this.emitter().one(e,Oa(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};er.eventAliasesOn(ja);var Ra={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Ra.jpeg=Ra.jpg;var Ma={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=k(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var a=new r(G({},e,{cy:t,eles:i}));return a}ve("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else ve("A `name` must be specified to make a layout");else ve("Layout options must be specified to make a layout")}};Ma.createLayout=Ma.makeLayout=Ma.layout;var Ia={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};La.invalidateDimensions=La.resize;var Aa={collection:function(e,t){return k(e)?this.$(e):T(e)?e.collection():E(e)?new pa(this,e,t):new pa(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Aa.elements=Aa.filter=Aa.$;var Da={},za="t";Da.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(d||f&&h){var p=void 0;d&&h||d?p=l.properties:h&&(p=l.mappedProperties);for(var g=0;g1&&(b=1),c.color){var x=i.valueMin[0],k=i.valueMax[0],S=i.valueMin[1],E=i.valueMax[1],C=i.valueMin[2],_=i.valueMax[2],T=null==i.valueMin[3]?1:i.valueMin[3],O=null==i.valueMax[3]?1:i.valueMax[3],j=[Math.round(x+(k-x)*b),Math.round(S+(E-S)*b),Math.round(C+(_-C)*b),Math.round(T+(O-T)*b)];n={bypass:i.bypass,name:i.name,value:j,strValue:"rgb("+j[0]+", "+j[1]+", "+j[2]+")"}}else{if(!c.number)return!1;var R=i.valueMin+(i.valueMax-i.valueMin)*b;n=this.parse(i.name,R,i.bypass,d)}if(!n)return g(),!1;n.mapping=i,i=n;break;case o.data:for(var M=i.field.split("."),I=f.data,N=0;N0&&a>0){for(var c={},u=!1,l=0;l0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:c,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Da.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],c=i(o);null!=c&&c(n,r)&&a(o)},Da.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Da.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),"curve-style"!==t||"bezier"!==n&&"bezier"!==r||!i.triggersBoundsOfParallelBeziers||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Da.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ba={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?a.substr(t.length):""}function c(){n=n.length>r.length?n.substr(r.length):""}for(a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(a.match(/^\s*$/))break;var u=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){ye("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}t=u[0];var l=u[1];if("core"!==l)if(new zr(l).invalid){ye("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),o();continue}var s=u[2],f=!1;n=s;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!h){ye("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+s),f=!0;break}r=h[0];var p=h[1],g=h[2];if(this.properties[p])i.parse(p,g)?(d.push({name:p,val:g}),c()):(ye("Skipping property: Invalid property definition in: "+r),c());else ye("Skipping property: Invalid property name in: "+r),c()}if(f){o();break}i.selector(l);for(var b=0;b=7&&"d"===t[0]&&(l=new RegExp(c.data.regex).exec(t))){if(n)return!1;var d=c.data;return{name:e,value:l,strValue:""+t,mapped:d,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(s=new RegExp(c.mapData.regex).exec(t))){if(n)return!1;if(f.multiple)return!1;var h=c.mapData;if(!f.color&&!f.number)return!1;var p=this.parse(e,s[4]);if(!p||p.mapped)return!1;var g=this.parse(e,s[5]);if(!g||g.mapped)return!1;if(p.pfValue===g.pfValue||p.strValue===g.strValue)return ye("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(f.color){var b=p.value,v=g.value;if(b[0]===v[0]&&b[1]===v[1]&&b[2]===v[2]&&(b[3]===v[3]||(null==b[3]||1===b[3])&&(null==v[3]||1===v[3])))return!1}return{name:e,value:s,strValue:""+t,mapped:h,field:s[1],fieldMin:parseFloat(s[2]),fieldMax:parseFloat(s[3]),valueMin:p.value,valueMax:g.value,bypass:n}}}if(f.multiple&&"multiple"!==r){var m;if(m=u?t.split(/\s+/):E(t)?t:[t],f.evenMultiple&&m.length%2!==0)return null;for(var y=[],w=[],x=[],C="",_=!1,T=0;T0?" ":"")+O.strValue}return f.validate&&!f.validate(y,w)?null:f.singleEnum&&_?1===y.length&&k(y[0])?{name:e,value:y[0],strValue:y[0],bypass:n}:null:{name:e,value:y,pfValue:x,strValue:C,bypass:n,units:w}}var j,R,M=function(){for(var r=0;rf.max||f.strictMax&&t===f.max))return null;var z={name:e,value:t,strValue:""+t+(I||""),units:I,bypass:n};return f.unitless||"px"!==I&&"em"!==I?z.pfValue=t:z.pfValue="px"!==I&&I?this.getEmSizeInPixels()*t:t,"ms"!==I&&"s"!==I||(z.pfValue="ms"===I?t:1e3*t),"deg"!==I&&"rad"!==I||(z.pfValue="rad"===I?t:(j=t,Math.PI*j/180)),"%"===I&&(z.pfValue=t/100),z}if(f.propList){var B=[],F=""+t;if("none"===F);else{for(var G=F.split(/\s*,\s*|\s+/),Y=0;Y0&&u>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((c-2*t)/n.w,(u-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),P(e)?n=e:C(e)&&(n=e.level,null!=e.position?t=$e(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=c,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;P(u.x)&&(t.pan.x=u.x,o=!1),P(u.y)&&(t.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(k(e)){var n=e;e=this.mutableElements().filter(n)}else T(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container;return e.sizeCache=e.sizeCache||(t?function(){var e=g.getComputedStyle(t),n=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Ka.centre=Ka.center,Ka.autolockNodes=Ka.autolock,Ka.autoungrabifyNodes=Ka.autoungrabify;var Xa={data:er.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:er.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:er.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:er.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Xa.attr=Xa.data,Xa.removeAttr=Xa.removeData;var Qa=function(e){var t=this,n=(e=G({},e)).container;n&&!_(n)&&_(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==g&&void 0!==n&&!e.headless,o=e;o.layout=G({name:a?"grid":"null"},o.layout),o.renderer=G({name:a?"canvas":"null"},o.renderer);var c=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:o,elements:new pa(this),listeners:[],aniEles:new pa(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:c(!0,o.zoomingEnabled),userZoomingEnabled:c(!0,o.userZoomingEnabled),panningEnabled:c(!0,o.panningEnabled),userPanningEnabled:c(!0,o.userPanningEnabled),boxSelectionEnabled:c(!0,o.boxSelectionEnabled),autolock:c(!1,o.autolock,o.autolockNodes),autoungrabify:c(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:c(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:P(o.zoom)?o.zoom:1,pan:{x:C(o.pan)&&P(o.pan.x)?o.pan.x:0,y:C(o.pan)&&P(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:c(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});u.styleEnabled&&t.setStyle([]);var l=G({},o,o.renderer);t.initRenderer(l);!function(e,t){if(e.some(N))return $n.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(C(e)||E(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=G({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),u.ready=!0,S(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,l=ot(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(T(n.roots))e=n.roots;else if(E(n.roots)){for(var s=[],f=0;f0;){var M=O.shift(),I=_(M,j);if(I)M.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(R);else if(null===I){ye("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}P();var N=0;if(n.avoidOverlap)for(var L=0;L0&&v[0].length<=3?u/2:0),f=2*Math.PI/v[r].length*i;return 0===r&&1===v[0].length&&(s=1),{x:$+s*Math.cos(f),y:K+s*Math.sin(f)}}return{x:$+(i+1-(a+1)/2)*o,y:(r+1)*c}})),this};var ro={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function io(e){this.options=G({},ro,e)}io.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,c=ot(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u=c.x1+c.w/2,l=c.y1+c.h/2,s=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),f=0,d=0;d1&&t.avoidOverlap){f*=1.75;var b=Math.cos(s)-Math.cos(0),v=Math.sin(s)-Math.sin(0),m=Math.sqrt(f*f/(b*b+v*v));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*s*(i?1:-1),a=o*Math.cos(r),c=o*Math.sin(r);return{x:u+a,y:l+c}})),this};var ao,oo={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function co(e){this.options=G({},oo,e)}co.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=ot(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),c=o.x1+o.w/2,u=o.y1+o.h/2,l=[],s=0,f=0;f0)Math.abs(m[0].value-w.value)>=b&&(m=[],v.push(m));m.push(w)}var x=s+t.minNodeSpacing;if(!t.avoidOverlap){var k=v.length>0&&v[0].length>1,S=(Math.min(o.w,o.h)/2-x)/(v.length+k?1:0);x=Math.min(x,S)}for(var E=0,C=0;C1&&t.avoidOverlap){var O=Math.cos(T)-Math.cos(0),j=Math.sin(T)-Math.sin(0),R=Math.sqrt(x*x/(O*O+j*j));E=Math.max(R,E)}P.r=E,E+=x}if(t.equidistant){for(var M=0,I=0,N=0;N=e.numIter)&&(vo(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),X(t)):(Oo(r,e),c())}()}else{for(;l;)l=o(u),u++;Oo(r,e),c()}return this},lo.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},lo.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var so=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:ot(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=n.eles.components(),c={},u=0;u0){a.graphSet.push(w);for(u=0;ur.count?0:r.graph},ho=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var c=(l=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),u=l*a/g;else{var l,s=ko(e,i,a),f=ko(t,-1*i,-1*a),d=f.x-s.x,h=f.y-s.y,p=d*d+h*h,g=Math.sqrt(p);c=(l=(e.nodeRepulsion+t.nodeRepulsion)/p)*d/g,u=l*h/g}e.isLocked||(e.offsetX-=c,e.offsetY-=u),t.isLocked||(t.offsetX+=c,t.offsetY+=u)}},xo=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ko=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,c=n/t,u=a/o,l={};return 0===t&&0n?(l.x=r,l.y=i+a/2,l):0t&&-1*u<=c&&c<=u?(l.x=r-o/2,l.y=i-o*n/2/t,l):0=u)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(c<=-1*u||c>=u)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},So=function(e,t){for(var n=0;n1){var p=t.gravity*f/h,g=t.gravity*d/h;s.offsetX+=p,s.offsetY+=g}}}}},Co=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],c=e.layoutNodes[o],u=c.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},To=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopp&&(f+=h+t.componentSpacing,s=0,d=0,h=0)}}},jo={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ro(e){this.options=G({},jo,e)}Ro.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=ot(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),c=Math.sqrt(o*a.h/a.w),u=Math.round(c),l=Math.round(a.w/a.h*c),s=function(e){if(null==e)return Math.min(u,l);Math.min(u,l)==u?u=e:l=e},f=function(e){if(null==e)return Math.max(u,l);Math.max(u,l)==u?u=e:l=e},d=t.rows,h=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=h)u=d,l=h;else if(null!=d&&null==h)u=d,l=Math.ceil(o/u);else if(null==d&&null!=h)l=h,u=Math.ceil(o/l);else if(l*u>o){var p=s(),g=f();(p-1)*g>=o?s(p-1):(g-1)*p>=o&&f(g-1)}else for(;l*u=o?f(v+1):s(b+1)}var m=a.w/l,y=a.h/u;if(t.condense&&(m=0,y=0),t.avoidOverlap)for(var w=0;w=l&&(R=0,j++)},I={},N=0;N(r=mt(e,t,w[x],w[x+1],w[x+2],w[x+3])))return b(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(w=a.allpts,x=0;x+5(r=vt(e,t,w[x],w[x+1],w[x+2],w[x+3],w[x+4],w[x+5])))return b(n,r),!0;m=m||i.source,y=y||i.target;var k=o.getArrowWidth(u,s),S=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(x=0;x0&&(v(m),v(y))}function y(e,t,n){return _e(e,t,n)}function w(n,r){var i,a=n._private,o=p;i=r?r+"-":"",n.boundingBox();var c=a.labelBounds[r||"main"],u=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&u){var l=y(a.rscratch,"labelX",r),s=y(a.rscratch,"labelY",r),f=y(a.rscratch,"labelAngle",r),d=n.pstyle(i+"text-margin-x").pfValue,h=n.pstyle(i+"text-margin-y").pfValue,g=c.x1-o-d,v=c.x2+o-d,m=c.y1-o-h,w=c.y2+o-h;if(f){var x=Math.cos(f),k=Math.sin(f),S=function(e,t){return{x:(e-=l)*x-(t-=s)*k+l,y:e*k+t*x+s}},E=S(g,m),C=S(g,w),P=S(v,m),_=S(v,w),T=[E.x+d,E.y+h,P.x+d,P.y+h,_.x+d,_.y+h,C.x+d,C.y+h];if(yt(e,t,T))return b(n),!0}else if(dt(c,e,t))return b(n),!0}}n&&(u=u.interactive);for(var x=u.length-1;x>=0;x--){var k=u[x];k.isNode()?v(k)||w(k):m(k)||w(k)||w(k,"source")||w(k,"target")}return l},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,c=[],u=Math.min(e,n),l=Math.max(e,n),s=Math.min(t,r),f=Math.max(t,r),d=ot({x1:e=u,y1:t=s,x2:n=l,y2:r=f}),h=0;h0?Math.max(e-t,0):Math.min(e+t,0)},_=P(E,k),T=P(C,S),O=!1;"auto"===b?g=Math.abs(_)>Math.abs(T)?i:r:b===u||b===c?(g=r,O=!0):b!==a&&b!==o||(g=i,O=!0);var j,R=g===r,M=R?T:_,I=R?C:E,N=Je(I),L=!1;(O&&(m||w)||!(b===c&&I<0||b===u&&I>0||b===a&&I>0||b===o&&I<0)||(M=(N*=-1)*Math.abs(M),L=!0),m)?j=(y<0?1+y:y)*M:j=(y<0?M:0)+y*N;var A=function(e){return Math.abs(e)=Math.abs(M)},D=A(j),z=A(Math.abs(M)-Math.abs(j));if((D||z)&&!L)if(R){var B=Math.abs(I)<=f/2,H=Math.abs(E)<=d/2;if(B){var F=(l.x1+l.x2)/2,G=l.y1,V=l.y2;n.segpts=[F,G,F,V]}else if(H){var Y=(l.y1+l.y2)/2,W=l.x1,q=l.x2;n.segpts=[W,Y,q,Y]}else n.segpts=[l.x1,l.y2]}else{var U=Math.abs(I)<=s/2,$=Math.abs(C)<=h/2;if(U){var K=(l.y1+l.y2)/2,X=l.x1,Q=l.x2;n.segpts=[X,K,Q,K]}else if($){var Z=(l.x1+l.x2)/2,J=l.y1,ee=l.y2;n.segpts=[Z,J,Z,ee]}else n.segpts=[l.x2,l.y1]}else if(R){var te=l.y1+j+(p?f/2*N:0),ne=l.x1,re=l.x2;n.segpts=[ne,te,re,te]}else{var ie=l.x1+j+(p?s/2*N:0),ae=l.y1,oe=l.y2;n.segpts=[ie,ae,ie,oe]}},Wo.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,c=t.tgtW,u=t.tgtH,l=t.srcShape,s=t.tgtShape,f=!P(n.startX)||!P(n.startY),d=!P(n.arrowStartX)||!P(n.arrowStartY),h=!P(n.endX)||!P(n.endY),p=!P(n.arrowEndX)||!P(n.arrowEndY),g=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),b=et({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),v=bd.poolIndex()){var h=f;f=d,d=h}var p=c.srcPos=f.position(),g=c.tgtPos=d.position(),b=c.srcW=f.outerWidth(),v=c.srcH=f.outerHeight(),m=c.tgtW=d.outerWidth(),y=c.tgtH=d.outerHeight(),w=c.srcShape=n.nodeShapes[t.getNodeShape(f)],x=c.tgtShape=n.nodeShapes[t.getNodeShape(d)];c.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var k=0;k0){var G=l,V=tt(G,Xe(t)),Y=tt(G,Xe(F)),W=V;if(Y2)tt(G,{x:F[2],y:F[3]})0){var ie=s,ae=tt(ie,Xe(t)),oe=tt(ie,Xe(re)),ce=ae;if(oe2)tt(ie,{x:re[2],y:re[3]})=l||m){s={cp:g,segment:v};break}}if(s)break}var y=s.cp,w=s.segment,x=(l-d)/w.length,k=w.t1-w.t0,S=c?w.t0+k*x:w.t1-k*x;S=at(0,S,1),t=it(y.p0,y.p1,y.p2,S),i=function(e,t,n,r){var i=at(0,r-.001,1),a=at(0,r+.001,1),o=it(e,t,n,i),c=it(e,t,n,a);return Zo(o,c)}(y.p0,y.p1,y.p2,S);break;case"straight":case"segments":case"haystack":for(var E,C,P,_,T=0,O=r.allpts.length,j=0;j+3=l));j+=2);var R=(l-C)/E;R=at(0,R,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=et(e,t),c=i/o,u=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+c*r,y:e.y+u*r}}(P,_,R),i=Zo(P,_)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};l("source"),l("target"),this.applyLabelDimensions(e)}},Xo.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},Xo.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,c=_e(n.rscratch,"labelWrapCachedLines",t)||[],u="wrap"!==o?1:Math.max(c.length,1),l=i.height/u,s=l*a,f=i.width,d=i.height+(u-1)*(a-1)*l;Te(n.rstyle,"labelWidth",t,f),Te(n.rscratch,"labelWidth",t,f),Te(n.rstyle,"labelHeight",t,d),Te(n.rscratch,"labelHeight",t,d),Te(n.rscratch,"labelLineHeight",t,s)},Xo.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Te(n.rscratch,e,t,r),r):_e(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var c=e.pstyle("text-wrap").value;if("wrap"===c){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l=i.split("\n"),s=e.pstyle("text-max-width").pfValue,f="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],h=/[\s\u200b]+/,p=f?"":" ",g=0;gs){for(var y=b.split(h),w="",x=0;xE)break;C+=i[_],_===i.length-1&&(P=!0)}return P||(C+="\u2026"),C}return i},Xo.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},Xo.calculateLabelDimensions=function(e,t){var n=oe(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,c=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,l=this.labelCalcCanvas,s=this.labelCalcCanvasContext;if(!l){l=this.labelCalcCanvas=document.createElement("canvas"),s=this.labelCalcCanvasContext=l.getContext("2d");var f=l.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}s.font="".concat(a," ").concat(u," ").concat(o,"px ").concat(c);for(var d=0,h=0,p=t.split("\n"),g=0;g1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var _=r(t);b&&(e.hoverData.tapholdCancelled=!0);i=!0,n(g,["mousemove","vmousemove","tapdrag"],t,{x:s[0],y:s[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(b){var O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};m?m.emit(O):o.emit(O),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}}else if(e.hoverData.dragging){if(i=!0,o.panningEnabled()&&o.userPanningEnabled()){var j;if(e.hoverData.justStartedPan){var R=e.hoverData.mdownPos;j={x:(s[0]-R[0])*c,y:(s[1]-R[1])*c},e.hoverData.justStartedPan=!1}else j={x:y[0]*c,y:y[1]*c};o.panBy(j),o.emit("dragpan"),e.hoverData.dragged=!0}s=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==v||(v&&n(v,["mouseout","tapdragout"],t,{x:s[0],y:s[1]}),g&&n(g,["mouseover","tapdragover"],t,{x:s[0],y:s[1]}),e.hoverData.last=g),m)if(b){if(o.boxSelectionEnabled()&&_)m&&m.grabbed()&&(f(w),m.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),w.emit("dragfree"))),T();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var M=!e.dragData.didDrag;M&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||l(w,{inDragLayer:!0});var I={x:0,y:0};if(P(y[0])&&P(y[1])&&(I.x+=y[0],I.y+=y[1],M)){var N=e.hoverData.dragDelta;N&&P(N[0])&&P(N[1])&&(I.x+=N[0],I.y+=N[1])}e.hoverData.draggingEles=!0,w.silentShift(I).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(y[0]),t.push(y[1])):(t[0]+=y[0],t[1]+=y[1])}();i=!0}else if(b){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!_&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=Xe(d),e.redrawHint("select",!0),e.redraw())}}else T();m&&m.pannable()&&m.active()&&m.unactivate()}return p[2]=s[0],p[3]=s[1],i?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(window,"mouseup",(function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(i.clientX,i.clientY),c=e.selection,u=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,s=e.hoverData.down,d=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,s&&s.unactivate(),3===e.hoverData.which){var h={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(s?s.emit(h):a.emit(h),!e.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};s?s.emit(p):a.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(u,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(n(s,["click","tap","vclick"],i,{x:o[0],y:o[1]}),y=!1,i.timeStamp-w<=a.multiClickDebounceTime()?(m&&clearTimeout(m),y=!0,w=null,n(s,["dblclick","dbltap","vdblclick"],i,{x:o[0],y:o[1]})):(m=setTimeout((function(){y||n(s,["oneclick","onetap","voneclick"],i,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),w=i.timeStamp)),null!=s||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(a.$(t).unselect(["tapunselect"]),l.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=a.collection()),u!=s||e.dragData.didDrag||e.hoverData.selecting||null!=u&&u._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||d?u.selected()?u.unselect(["tapunselect"]):u.select(["tapselect"]):d||(a.$(t).unmerge(u).unselect(["tapunselect"]),u.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(c[0],c[1],c[2],c[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}});var b=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||d||a.$(t).unmerge(g).unselect(),g.emit("box").stdFilter(b).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!c[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var v=s&&s.grabbed();f(l),v&&(s.emit("freeon"),l.emit("free"),e.dragData.didDrag&&(s.emit("dragfreeon"),l.emit("dragfree")))}}c[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}}),!1);var k,S,E,C,_,T,O,j,R,M,I,N,L,A=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var c;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),c=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,c*=e.wheelSensitivity,1===t.deltaMode&&(c*=33);var u=n.zoom()*Math.pow(10,c);"gesturechange"===t.type&&(u=e.gestureStartZoom*t.scale),n.zoom({level:u,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",A,!0),e.registerBinding(window,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||A(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var D,z,B,H,F,G,V,Y=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},W=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",D=function(t){if(e.hasTouchStarted=!0,x(t)){h(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,f(e.dragData.touchDragEles);var u=e.findContainerClientCoords();R=u[0],M=u[1],I=u[2],N=u[3],k=t.touches[0].clientX-R,S=t.touches[0].clientY-M,E=t.touches[1].clientX-R,C=t.touches[1].clientY-M,L=0<=k&&k<=I&&0<=E&&E<=I&&0<=S&&S<=N&&0<=C&&C<=N;var d=r.pan(),p=r.zoom();_=Y(k,S,E,C),T=W(k,S,E,C),j=[((O=[(k+E)/2,(S+C)/2])[0]-d.x)/p,(O[1]-d.y)/p];if(T<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),b=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):b&&b.isNode()?(b.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=b):r.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])r.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var v=e.findNearestElements(i[0],i[1],!0,!0),m=v[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=v,e.nodeIsGrabbable(m))){var y=e.dragData.touchDragEles=r.collection(),w=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(w=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),l(w,{addToList:y})):s(m,{addToList:y}),c(m);var P=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(P("grabon")),w?w.forEach((function(e){e.emit(P("grab"))})):m.emit(P("grab"))}n(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var A=e.touchData.startPosition=[],D=0;D=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-R,O=t.touches[0].clientY-M,I=t.touches[1].clientX-R,N=t.touches[1].clientY-M,A=W(w,O,I,N);if(A/T>=2.25||A>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var D={originalEvent:t,type:"cxttapend",position:{x:c[0],y:c[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(D),e.touchData.start=null):o.emit(D)}}if(r&&e.touchData.cxt){D={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(D):o.emit(D),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var z=e.findNearestElement(c[0],c[1],!0,!0);e.touchData.cxtOver&&z===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.touchData.cxtOver=z,z&&z.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}else if(r&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(c[0]+c[2]+c[4])/3,i[3]=(c[1]+c[3]+c[5])/3):(i[0]=(c[0]+c[2]+c[4])/3,i[1]=(c[1]+c[3]+c[5])/3,i[2]=(c[0]+c[2]+c[4])/3+1,i[3]=(c[1]+c[3]+c[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var B=0;B0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",B=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",H=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,c=e.cy,u=c.zoom(),l=e.touchData.now,s=e.touchData.earlier;if(r.touches[0]){var d=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);l[0]=d[0],l[1]=d[1]}if(r.touches[1]){d=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);l[2]=d[0],l[3]=d[1]}if(r.touches[2]){d=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);l[4]=d[0],l[5]=d[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:r,type:"cxttapend",position:{x:l[0],y:l[1]}},i?i.emit(o):c.emit(o),!e.touchData.cxtDragged){var h={originalEvent:r,type:"cxttap",position:{x:l[0],y:l[1]}};i?i.emit(h):c.emit(h)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&c.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=c.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),c.emit({type:"boxend",originalEvent:r,position:{x:l[0],y:l[1]}});p.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var b=i._private.grabbed;f(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),b&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:l[0],y:l[1]}),i.unactivate(),e.touchData.start=null}else{var v=e.findNearestElement(l[0],l[1],!0,!0);n(v,["touchend","tapend","vmouseup","tapdragout"],r,{x:l[0],y:l[1]})}var m=e.touchData.startPosition[0]-l[0],y=m*m,w=e.touchData.startPosition[1]-l[1],x=(y+w*w)*u*u;e.touchData.singleTouchMoved||(i||c.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:l[0],y:l[1]}),F=!1,r.timeStamp-V<=c.multiClickDebounceTime()?(G&&clearTimeout(G),F=!0,V=null,n(i,["dbltap","vdblclick"],r,{x:l[0],y:l[1]})):(G=setTimeout((function(){F||n(i,["onetap","voneclick"],r,{x:l[0],y:l[1]})}),c.multiClickDebounceTime()),V=r.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&x2){for(var T=[l[0],l[1]],O=Math.pow(T[0]-e,2)+Math.pow(T[1]-t,2),j=1;j0)return g[0]}return null},d=Object.keys(s),h=0;h0?u:pt(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var c=Mt(r,i),u=2*c;if(wt(e,t,this.points,a,o,r,i-u,[0,-1],n))return!0;if(wt(e,t,this.points,a,o,r-u,i,[0,-1],n))return!0;var l=r/2+2*n,s=i/2+2*n;return!!yt(e,t,[a-l,o-s,a-l,o,a+l,o,a+l,o-s])||(!!St(e,t,u,u,a+r/2-c,o+i/2-c,n)||!!St(e,t,u,u,a-r/2+c,o+i/2-c,n))}}},oc.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Ot(3,0)),this.generateRoundPolygon("round-triangle",Ot(3,0)),this.generatePolygon("rectangle",Ot(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Ot(5,0)),this.generateRoundPolygon("round-pentagon",Ot(5,0)),this.generatePolygon("hexagon",Ot(6,0)),this.generateRoundPolygon("round-hexagon",Ot(6,0)),this.generatePolygon("heptagon",Ot(7,0)),this.generateRoundPolygon("round-heptagon",Ot(7,0)),this.generatePolygon("octagon",Ot(8,0)),this.generateRoundPolygon("round-octagon",Ot(8,0));var r=new Array(20),i=Rt(5,0),a=Rt(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var c=0;c=e.deqFastCost*g)break}else if(i){if(h>=e.deqCost*u||h>=e.deqAvgCost*c)break}else if(p>=e.deqNoDrawCost*fc)break;var b=e.deq(t,f,s);if(!(b.length>0))break;for(var v=0;v0&&(e.onDeqd(t,l),!i&&e.shouldRedraw(t,l,f,s)&&r())}),a(t))}}},hc=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pe;s(this,e),this.idsByKey=new Oe,this.keyForId=new Oe,this.cachesByLvl=new Oe,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return d(e,[{key:"getIdsFor",value:function(e){null==e&&ve("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Re,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new Oe,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),pc={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},gc=Ee({getKey:null,doesEleInvalidateKey:pe,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:he,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),bc=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=gc(t);G(n,r),n.lookup=new hc(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},vc=bc.prototype;vc.reasons=pc,vc.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},vc.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},vc.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new a((function(e,t){return t.reqs-e.reqs}))},vc.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},vc.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,c=o.cy.zoom(),u=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Ze(c*n))),r<-4)r=-4;else if(c>=7.99||r>3)return null;var l=Math.pow(2,r),s=t.h*l,f=t.w*l,d=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,d))return null;var h,p=u.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(h=s<=25?25:s<=50?50:50*Math.ceil(s/50),s>1024||f>1024)return null;var g=a.getTextureQueue(h),b=g[g.length-2],v=function(){return a.recycleTexture(h,f)||a.addTexture(h,f)};b||(b=g[g.length-1]),b||(b=v()),b.width-b.usedWidthr;_--)C=a.getElement(e,t,n,_,pc.downscale);P()}else{var T;if(!w&&!x&&!k)for(var O=r-1;O>=-4;O--){var j=u.get(e,O);if(j){T=j;break}}if(y(T))return a.queueElement(e,r),T;b.context.translate(b.usedWidth,0),b.context.scale(l,l),this.drawElement(b.context,e,t,d,!1),b.context.scale(1/l,1/l),b.context.translate(-b.usedWidth,0)}return p={x:b.usedWidth,texture:b,level:r,scale:l,width:f,height:s,scaledLabelShown:d},b.usedWidth+=Math.ceil(f+8),b.eleCaches.push(p),u.set(e,r,p),a.checkTextureFullness(b),p},vc.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},vc.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ce(t,e):e.fullnessChecks++},vc.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ce(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Pe(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Ce(r,a),n.push(a),a}},vc.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},vc.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<1&&n.size()>0;o++){var c=n.pop(),u=c.key,l=c.eles[0],s=a.hasCache(l,c.level);if(r[u]=null,!s){i.push(c);var f=t.getBoundingBox(l);t.getElement(l,f,e,c.level,pc.dequeue)}}return i},vc.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=de,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},vc.onDequeue=function(e){this.onDequeues.push(e)},vc.offDequeue=function(e){Ce(this.onDequeues,e)},vc.setupDequeueing=dc({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,c,u=r.layersByLevel,l=Math.pow(2,n),s=u[n]=u[n]||[];if(r.levelIsComplete(n,e))return s;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return c=u[t],!0},i=function(e){if(!c)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=s.length-1;a>=0;a--){var o=s[a];o.invalid&&Ce(s,o)}}();var f=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=ot();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var c=s.indexOf(i)+1;s.splice(c,0,a)}else(void 0===t.insert||t.insert)&&s.unshift(a);return a};if(r.skipping&&!a)return null;for(var d=null,h=e.length/1,p=!a,g=0;g=h||!ht(d.bb,b.boundingBox()))&&!(d=f({insert:!0,after:d})))return null;c||p?r.queueLayer(d,b):r.drawEleInLayer(d,b,n,t),d.eles.push(b),m[n]=d}}return c||(p?null:s)},yc.getEleLevelForLayerLevel=function(e,t){return e},yc.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,true),i.setImgSmoothing(a,!0))},yc.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},yc.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},yc.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=Q(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},yc.invalidateLayer=function(e){if(this.lastInvalidationTime=Q(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ce(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,c=t._private.rscratch;if((!a||t.visible())&&!c.badLine&&null!=c.allpts&&!isNaN(c.allpts[0])){var u;n&&(u=n,e.translate(-u.x1,-u.y1));var l=a?t.pstyle("opacity").value:1,s=a?t.pstyle("line-opacity").value:1,f=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,h=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,g=l*s,b=l*s,v=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;"straight-triangle"===f?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,c.allpts)):(e.lineWidth=h,e.lineCap=p,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,c.allpts,d),e.lineCap="butt")},m=function(){i&&o.drawEdgeOverlay(e,t)},y=function(){i&&o.drawEdgeUnderlay(e,t)},w=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;o.drawArrowheads(e,t,n)},x=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var k="yes"===t.pstyle("ghost").value;if(k){var S=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,C=t.pstyle("ghost-opacity").value,P=g*C;e.translate(S,E),v(P),w(P),e.translate(-S,-E)}y(),v(),w(),m(),x(),n&&e.translate(u.x1,u.y1)}}},Dc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,c=2*n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-color")).value;t.lineWidth=c,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,u[0],u[1],u[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Ac.drawEdgeOverlay=Dc("overlay"),Ac.drawEdgeUnderlay=Dc("underlay"),Ac.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,c=!1,u=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,s=e.pstyle("line-dash-offset").pfValue;if(u){var f=n.join("$");a.pathCacheKey&&a.pathCacheKey===f?(i=t=a.pathCache,c=!0):(i=t=new Path2D,a.pathCacheKey=f,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(l),o.lineDashOffset=s;break;case"solid":o.setLineDash([])}if(!c&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+35&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill()}Bc.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(Ze(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var c=t.pstyle("label");if(!c||!c.value)return;var u=o.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,s=t.pstyle("label"),f=t.pstyle("source-label"),d=t.pstyle("target-label");if(l||(!s||!s.value)&&(!f||!f.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var h,p=!n;n&&(h=n,e.translate(-h.x1,-h.y1)),null==i?(o.drawText(e,t,null,p,a),t.isEdge()&&(o.drawText(e,t,"source",p,a),o.drawText(e,t,"target",p,a))):o.drawText(e,t,i,p,a),n&&e.translate(h.x1,h.y1)},Bc.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,c=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*c,l=t.pstyle("color").value,s=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,l[0],l[1],l[2],c),this.colorStrokeStyle(e,s[0],s[1],s[2],u)},Bc.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=_e(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Bc.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,c=i?t.effectiveOpacity():1;if(!i||0!==c&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var u,l,s=_e(o,"labelX",n),f=_e(o,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(s)&&!isNaN(f)){this.setupTextStyle(e,t,i);var h,p=n?n+"-":"",g=_e(o,"labelWidth",n),b=_e(o,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,m=t.pstyle(p+"text-margin-y").pfValue,y=t.isEdge(),w=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(y&&(w="center",x="center"),s+=v,f+=m,0!==(h=r?this.getTextAngle(t,n):0)&&(u=s,l=f,e.translate(u,l),e.rotate(h),s=0,f=0),x){case"top":break;case"center":f+=b/2;break;case"bottom":f+=b}var k=t.pstyle("text-background-opacity").value,S=t.pstyle("text-border-opacity").value,E=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue;if(k>0||E>0&&S>0){var P=s-C;switch(w){case"left":P-=g;break;case"center":P-=g/2}var _=f-b-C,T=g+2*C,O=b+2*C;if(k>0){var j=e.fillStyle,R=t.pstyle("text-background-color").value;e.fillStyle="rgba("+R[0]+","+R[1]+","+R[2]+","+k*c+")";var M=t.pstyle("text-background-shape").strValue;0===M.indexOf("round")?Hc(e,P,_,T,O,2):e.fillRect(P,_,T,O),e.fillStyle=j}if(E>0&&S>0){var I=e.strokeStyle,N=e.lineWidth,L=t.pstyle("text-border-color").value,A=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+L[0]+","+L[1]+","+L[2]+","+S*c+")",e.lineWidth=E,e.setLineDash)switch(A){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=E/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(P,_,T,O),"double"===A){var D=E/2;e.strokeRect(P+D,_+D,T-2*D,O-2*D)}e.setLineDash&&e.setLineDash([]),e.lineWidth=N,e.strokeStyle=I}}var z=2*t.pstyle("text-outline-width").pfValue;if(z>0&&(e.lineWidth=z),"wrap"===t.pstyle("text-wrap").value){var B=_e(o,"labelWrapCachedLines",n),H=_e(o,"labelLineHeight",n),F=g/2,G=this.getLabelJustification(t);switch("auto"===G||("left"===w?"left"===G?s+=-g:"center"===G&&(s+=-F):"center"===w?"left"===G?s+=-F:"right"===G&&(s+=F):"right"===w&&("center"===G?s+=F:"right"===G&&(s+=g))),x){case"top":case"center":case"bottom":f-=(B.length-1)*H}for(var V=0;V0&&e.strokeText(B[V],s,f),e.fillText(B[V],s,f),f+=H}else z>0&&e.strokeText(d,s,f),e.fillText(d,s,f);0!==h&&(e.rotate(-h),e.translate(-u,-l))}}};var Fc={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],c=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],u=this,l=t._private,s=l.rscratch,f=t.position();if(P(f.x)&&P(f.y)&&(!c||t.visible())){var d,h,p=c?t.effectiveOpacity():1,g=u.usePaths(),b=!1,v=t.padding();r=t.width()+2*v,i=t.height()+2*v,n&&(h=n,e.translate(-h.x1,-h.y1));for(var m=t.pstyle("background-image"),y=m.value,w=new Array(y.length),x=new Array(y.length),k=0,S=0;S0&&void 0!==arguments[0]?arguments[0]:j;u.eleFillStyle(e,t,n)},L=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;u.colorStrokeStyle(e,R[0],R[1],R[2],t)},A=t.pstyle("shape").strValue,D=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(f.x,f.y);var z=u.nodePathCache=u.nodePathCache||[],B=ce("polygon"===A?A+","+D.join(","):A,""+i,""+r),H=z[B];null!=H?(d=H,b=!0,s.pathCache=d):(d=new Path2D,z[B]=s.pathCache=d)}var F=function(){if(!b){var n=f;g&&(n={x:0,y:0}),u.nodeShapes[u.getNodeShape(t)].draw(d||e,n.x,n.y,r,i)}g?e.fill(d):e.fill()},G=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=l.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasPie(t)&&(u.drawPie(e,t,a),n&&(g||u.nodeShapes[u.getNodeShape(t)].draw(e,f.x,f.y,r,i)))},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(u.colorFillStyle(e,r,r,r,n),g?e.fill(d):e.fill())},W=function(){if(O>0){if(e.lineWidth=O,e.lineCap="butt",e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(g?e.stroke(d):e.stroke(),"double"===M){e.lineWidth=O/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(d):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},q=function(){o&&u.drawNodeOverlay(e,t,f,r,i)},U=function(){o&&u.drawNodeUnderlay(e,t,f,r,i)},$=function(){u.drawElementText(e,t,null,a)},K="yes"===t.pstyle("ghost").value;if(K){var X=t.pstyle("ghost-offset-x").pfValue,Q=t.pstyle("ghost-offset-y").pfValue,Z=t.pstyle("ghost-opacity").value,J=Z*p;e.translate(X,Q),N(Z*j),F(),G(J,!0),L(Z*I),W(),V(0!==T||0!==O),G(J,!1),Y(J),e.translate(-X,-Q)}g&&e.translate(-f.x,-f.y),U(),g&&e.translate(f.x,f.y),N(),F(),G(p,!0),L(),W(),V(0!==T||0!==O),G(p,!1),Y(),g&&e.translate(-f.x,-f.y),$(),q(),n&&e.translate(h.x1,h.y1)}}},Gc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,a){if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,c=n.pstyle("".concat(e,"-opacity")).value,u=n.pstyle("".concat(e,"-color")).value,l=n.pstyle("".concat(e,"-shape")).value;if(c>0){if(r=r||n.position(),null==i||null==a){var s=n.padding();i=n.width()+2*s,a=n.height()+2*s}this.colorFillStyle(t,u[0],u[1],u[2],c),this.nodeShapes[l].draw(t,r.x,r.y,i+2*o,a+2*o),t.fill()}}}};Fc.drawNodeOverlay=Gc("overlay"),Fc.drawNodeUnderlay=Gc("underlay"),Fc.hasPie=function(e){return(e=e[0])._private.hasPie},Fc.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,c=r.y,u=t.width(),l=t.height(),s=Math.min(u,l)/2,f=0;this.usePaths()&&(o=0,c=0),"%"===a.units?s*=a.pfValue:void 0!==a.pfValue&&(s=a.pfValue/2);for(var d=1;d<=i.pieBackgroundN;d++){var h=t.pstyle("pie-"+d+"-background-size").value,p=t.pstyle("pie-"+d+"-background-color").value,g=t.pstyle("pie-"+d+"-background-opacity").value*n,b=h/100;b+f>1&&(b=1-f);var v=1.5*Math.PI+2*Math.PI*f,m=v+2*Math.PI*b;0===h||f>=1||f+b>1||(e.beginPath(),e.moveTo(o,c),e.arc(o,c,s,v,m),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],g),e.fill(),f+=b)}};var Vc={};Vc.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},Vc.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!f&&(s[o.NODE]=!0,s[o.SELECT_BOX]=!0);var m=u.style(),y=u.zoom(),w=void 0!==i?i:y,x=u.pan(),k={x:x.x,y:x.y},S={zoom:y,pan:{x:x.x,y:x.y}},E=o.prevViewport;void 0===E||S.zoom!==E.zoom||S.pan.x!==E.pan.x||S.pan.y!==E.pan.y||g&&!p||(o.motionBlurPxRatio=1),a&&(k=a),w*=c,k.x*=c,k.y*=c;var C=o.getCachedZSortedEles();function P(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function _(e,r){var c,u,s,f;o.clearingMotionBlur||e!==l.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==l.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(c=k,u=w,s=o.canvasWidth,f=o.canvasHeight):(c={x:x.x*h,y:x.y*h},u=y*h,s=o.canvasWidth*h,f=o.canvasHeight*h),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,s,f):t||void 0!==r&&!r||e.clearRect(0,0,s,f),n||(e.translate(c.x,c.y),e.scale(u,u)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(f||(o.textureDrawLastFrame=!1),f){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=u.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:c*o.textureMult}),(S=o.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}s[o.DRAG]=!1,s[o.NODE]=!1;var O=l.contexts[o.NODE],j=o.textureCache.texture;S=o.textureCache.viewport;O.setTransform(1,0,0,1,0,0),d?P(O,0,0,S.width,S.height):O.clearRect(0,0,S.width,S.height);var R=m.core("outside-texture-bg-color").value,M=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(O,R[0],R[1],R[2],M),O.fillRect(0,0,S.width,S.height);y=u.zoom();_(O,!1),O.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c),O.drawImage(j,S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c)}else o.textureOnViewport&&!t&&(o.textureCache=null);var I=u.extent(),N=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),L=o.hideEdgesOnViewport&&N,A=[];if(A[o.NODE]=!s[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,A[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),A[o.DRAG]=!s[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,A[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),s[o.NODE]||n||r||A[o.NODE]){var D=d&&!A[o.NODE]&&1!==h;_(O=t||(D?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:l.contexts[o.NODE]),d&&!D?"motionBlur":void 0),L?o.drawCachedNodes(O,C.nondrag,c,I):o.drawLayeredElements(O,C.nondrag,c,I),o.debug&&o.drawDebugPoints(O,C.nondrag),n||d||(s[o.NODE]=!1)}if(!r&&(s[o.DRAG]||n||A[o.DRAG])){D=d&&!A[o.DRAG]&&1!==h;_(O=t||(D?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:l.contexts[o.DRAG]),d&&!D?"motionBlur":void 0),L?o.drawCachedNodes(O,C.drag,c,I):o.drawCachedElements(O,C.drag,c,I),o.debug&&o.drawDebugPoints(O,C.drag),n||d||(s[o.DRAG]=!1)}if(o.showFps||!r&&s[o.SELECT_BOX]&&!n){if(_(O=t||l.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){y=o.cy.zoom();var z=m.core("selection-box-border-width").value/y;O.lineWidth=z,O.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",O.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),z>0&&(O.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",O.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(l.bgActivePosistion&&!o.hoverData.selecting){y=o.cy.zoom();var B=l.bgActivePosistion;O.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",O.beginPath(),O.arc(B.x,B.y,m.core("active-bg-size").pfValue/y,0,2*Math.PI),O.fill()}var H=o.lastRedrawTime;if(o.showFps&&H){H=Math.round(H);var F=Math.round(1e3/H);O.setTransform(1,0,0,1,0,0),O.fillStyle="rgba(255, 0, 0, 0.75)",O.strokeStyle="rgba(255, 0, 0, 0.75)",O.lineWidth=1,O.fillText("1 frame = "+H+" ms = "+F+" fps",0,20);O.strokeRect(0,30,250,20),O.fillRect(0,30,250*Math.min(F/60,1),20)}n||(s[o.SELECT_BOX]=!1)}if(d&&1!==h){var G=l.contexts[o.NODE],V=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],Y=l.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],q=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!v?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=h;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(s[o.NODE]||A[o.NODE])&&(q(G,V,A[o.NODE]),s[o.NODE]=!1),(s[o.DRAG]||A[o.DRAG])&&(q(Y,W,A[o.DRAG]),s[o.DRAG]=!1)}o.prevViewport=S,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!f,o.mbFrames=0,s[o.NODE]=!0,s[o.DRAG]=!0,o.redraw()}),100)),t||u.emit("render")};for(var Yc={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,c=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+c*a[1]);for(var u=1;u0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*u,-n.y1*u),d.scale(u,u),this.drawElements(d,h),d.scale(1/u,1/u),d.translate(n.x1*u,n.y1*u);else{var p=t.pan(),g={x:p.x*u,y:p.y*u};u*=t.zoom(),d.translate(g.x,g.y),d.scale(u,u),this.drawElements(d,h),d.scale(1/u,1/u),d.translate(-g.x,-g.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return f},Qc.png=function(e){return Jc(e,this.bufferCanvasImage(e),"image/png")},Qc.jpg=function(e){return Jc(e,this.bufferCanvasImage(e),"image/jpeg")};var eu={nodeShapeImpl:function(e,t,n,r,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},tu=ru,nu=ru.prototype;function ru(e){var t=this;t.data={canvases:new Array(nu.CANVAS_LAYERS),contexts:new Array(nu.CANVAS_LAYERS),canvasNeedsRedraw:new Array(nu.CANVAS_LAYERS),bufferCanvases:new Array(nu.BUFFER_COUNT),bufferContexts:new Array(nu.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",r="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=r,i.position="relative",i.zIndex="0",i.overflow="hidden";var a=e.cy.container();a.appendChild(t.data.canvasContainer),a.style[n]=r;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};b&&b.userAgent.match(/msie|trident|edge/i)&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var c=0;ct?1:0},h=function(e,t,n,r,i){var a;if(null==n&&(n=0),null==i&&(i=o),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)l.push(t);return l}.apply(this).reverse(),u=[],r=0,i=a.length;rg;0<=g?++s:--s)b.push(l(e,n));return b},m=function(e,t,n,r){var i,a,c;for(null==r&&(r=o),i=e[n];n>t&&r(i,a=e[c=n-1>>1])<0;)e[n]=a,n=c;return e[n]=i},y=function(e,t,n){var r,i,a,c,u;for(null==n&&(n=o),i=e.length,u=t,a=e[t],r=2*t+1;r=e.length)return{done:!0};var r=e[n++];return{value:[r,t.get(r)],done:!1}}}},function(){if(!Object.create||!Object.getOwnPropertyNames)return!1;var e="__proto__",t=Object.create(null);if(void 0!==t[e])return!1;if(0!=Object.getOwnPropertyNames(t).length)return!1;if(t[e]=42,42!==t[e])return!1;if(0==Object.getOwnPropertyNames(t).length)return!1;return!0}()||(e.prototype.createObject=function(){return{}},e.prototype.get=function(e){return this.obj[":"+e]},e.prototype.set=function(e,t){this.obj[":"+e]=t},e.prototype[UL]=function(e){delete this.obj[":"+e]},e.prototype.keys=function(){var e=[];for(var t in this.obj)58==t.charCodeAt(0)&&e.push(t.substring(1));return e});return e}()}()}function Ma(e,t){qx(),LM.dc(e,t)}function Ia(e,t){return Fb(e,t)}function Na(e,t){return e.a.B(t)}function La(e,t){return e.g[t.e]}function Aa(e,t){return e.i[t.e]}function Da(e,t){return e.j[t.e]}function za(e,t){return e.n[t.e]}function Ba(e,t){return e.o[t.e]}function Ha(e,t){return e>t?e:t}function Fa(e,t){return e>t?e:t}function Ga(e,t){return e>t?e:t}function Va(e,t){return et?1:0}function Yl(e){return null!=e?dS(e):0}function Wl(e){this.a=Wu(),this.b=e}function ql(e){this.a=Wu(),this.b=e}function Ul(e){this.a=e,ah.call(this,e)}function $l(){rs(),this.b=new Cn(this)}function Kl(){var e;Kl=a,e=new la(", "),Hh(VM),mA=new rh(e,e)}function Xl(){Xl=a,bA=new pl,gA=new Dl}function Ql(){Ql=a,wA=new g,xA=new b}function Zl(){Zl=a,SA=new Zc,EA=new Pl}function Jl(){Jl=a,jA=new gl,OA=new Es}function es(){es=a,UA=new y,$A=new w}function ts(e){e.g=new At,e.b=new At}function ns(e){e.a=new mt,e.c=new mt}function rs(){rs=a,JG=new Xe,ZG=new oh}function is(){Vo.call(this,"IS_NULL",2)}function as(){Hu.call(this,"Head",1)}function os(){Hu.call(this,"Tail",3)}function cs(e,t){mw.call(this,e,t,null)}function us(e,t){iC(e,0,e.length,t)}function ls(e,t){return Ad(t.a,e.a),e.a}function ss(e,t){return e.a*=t,e.b*=t,e}function fs(e,t){sg(),this.a=e,this.b=t}function ds(e,t){return e.a[t.d.k][t.k]}function hs(e,t){return e.a[t.d.k][t.k]}function ps(e,t){return so(function(e,t){var n,r;n=null,r=e.b;for(;r;)e.a.$b(t,r.d)>=0?r=r.a[1]:(n=r,r=r.a[0]);return n}(e.a,t))}function gs(e,t){return so(function(e,t){var n,r;n=null,r=e.b;for(;r;)e.a.$b(t,r.d)<=0?r=r.a[0]:(n=r,r=r.a[1]);return n}(e.a,t))}function bs(e,t){return Kd(fP(e.a,t),20)}function vs(e,t){return null!=e&&QE(e,t)}function ms(e){return e.a=t)throw new Pi}function Qd(e,t){return Hh(e),Hh(t),new hh(e,t)}function Zd(e,t){return Hh(e),Hh(t),new ph(e,t)}function Jd(e,t,n){return e=n+1&&e.splice(0,n+1);break}return e}(LM.ec(e))}function Th(e,t){var n;return(n=Wp(e,t)).g=2,n}function Oh(e,t){e.b=t.b,e.c=t.c,e.d=t.d,e.a=t.a}function jh(e){e.a.b=e.b,e.b.a=e.a,e.a=e.b=null}function Rh(e){return e.b.c.length+e.e.c.length}function Mh(e){return Array.isArray(e)&&e.ad===i}function Ih(e,t){return Ql(),-1!=Jx(new Qn(e),t)}function Nh(e,t,n,r,i,a){return eP(e,t,n,r,i,0,a)}function Lh(e,t,n){es(),ov.call(this,e.b,t,n,e.d)}function Ah(e,t){es(),ov.call(this,e.b,t,e.c,e.d)}function Dh(e,t,n){Im(t,e.c.length),ju(e.c,t,n)}function zh(e,t){return Nm(t,e.a.length),e.a[t]}function Bh(e){e.sort((function(e,t){return e-t}))}function Hh(e){if(null==e)throw new Xr;return e}function Fh(e){if(null==e)throw new Xr;this.a=e}function Gh(e,t,n){if(e.a!=t)throw new xi;e.a=n}function Vh(e,t){if(!e)throw new ua((ci(),t))}function Yh(e,t){if(!e)throw new Sa((ci(),t))}function Wh(e){if(null==e)throw new Xr;return e}function qh(e){ur.call(this,new pm),Tw(this,e)}function Uh(e){this.a=new Kc(e.Y()),Tw(this,e)}function $h(e){this.c=e,this.a=new $c(this.c.a)}function Kh(e){sg(),this.a=($g(),new er(Hh(e)))}function Xh(){(Xh=a)(),i$=!1,a$=!0}function Qh(){Qh=a,l$=Dm(nA,HM,24,256,0,1)}function Zh(){Zh=a,sV=xh(kh(new yS,(EM(),KF)),yG)}function Jh(){Jh=a,VH=new S,WH=new ch,YH=new E}function ep(e){return null!=e&&zp(e)&&!(e.ad===i)}function tp(e){return!Array.isArray(e)&&e.ad===i}function np(e,t){return Rs(t)?Bg(e,t):U_(e.d,t)}function rp(e,t){return vs(t,17)&&Qs(e,Kd(t,17))}function ip(e,t){return vs(t,17)&&function(e,t){if(t&&e.b[t.e]==t)return Up(e.b,t.e,null),--e.c,!0;return!1}(e,Kd(t,17))}function ap(e,t){var n;return wx(n=jS(e),t),n}function op(e,t){return!e&&(e=[]),e[e.length]=t,e}function cp(e,t,n){if(!e)throw new ua(function(e,t){var n,r,i,a;ci(),e=null==e?VM:e,e.length,t.length,n=new no,a=0,r=0;for(;r0),e.a.sb(e.c=--e.b)}function yp(e){e.b?yp(e.b):e.d.V()&&np(e.f.b,e.e)}function wp(e){if(vS(e.d),e.d.d!=e.c)throw new xi}function xp(e,t){if(t[VL]!=e[VL])throw new xi}function kp(e,t){return Ql(),Hh(e),Hh(t),new zo(e,t)}function Sp(e,t){sg(),$o.call(this,e,Wx(new Zn(t)))}function Ep(e,t,n,r){this.a=e,Bm.call(this,e,t,n,r)}function Cp(e){this.a=Math.cos(e),this.b=Math.sin(e)}function Pp(e,t,n){Vi.call(this,e),this.b=t,this.a=n}function _p(e){this.b=new At,this.a=new At,this.c=e}function Tp(e){this.c=new sa,this.a=new At,this.b=e}function Op(){Op=a,zA=new nn(!1),BA=new nn(!0)}function jp(e,t){return++e.d,e.c[e.c.length]=t,!0}function Rp(e,t){Vv(e.d,t,e.b.b,e.b),++e.a,e.c=null}function Mp(e,t){return null==e.a.db(t,e)}function Ip(e,t){return Qm(e.slice(0,t),e)}function Np(e,t){return Qm(new Array(t),e)}function Lp(e,t,n){var r;return r=e.b[t],e.b[t]=n,r}function Ap(e){return Ps(),_d(function(e){var t;return Kd((t=e.g)?t:e.g=new $t(e),20)}(e.a).mb(),(Zl(),SA))}function Dp(e){return Ql(),new zl(Fl(Zd(e.a,new p)))}function zp(e){return typeof e===BM||typeof e===qM}function Bp(e){r.setTimeout((function(){throw e}),0)}function Hp(e){return Hh(e),vs(e,345)?Kd(e,345):cC(e)}function Fp(e,t){return null==tk(e.a,t,(Xh(),i$))}function Gp(e,t){var n;return function(e,t){if(e<0||e>=t)throw new ca(function(e,t){if(e<0)return aO(dI,Fx(Ia(eA,1),hI,1,4,["index",lS(e)]));if(t<0)throw new ua(pI+t);return aO("%s (%s) must be less than size (%s)",Fx(Ia(eA,1),hI,1,4,["index",lS(e),lS(t)]))}(e,t))}(t,n=e.a.Y()),n-1-t}function Vp(e,t,n){var r;return r=Gy(e,t),function(e,t,n){if(n){var r=n.gc();n=r(n)}else n=void 0;e.a[t]=n}(e,t,n),r}function Yp(e,t,n){var r;return cw(n,r=Wp(e,t)),r}function Wp(e,t){var n;return(n=new uk).i=e,n.d=t,n}function qp(e,t,n){this.a=e,Hv(n,t),this.c=t,this.b=n}function Up(e,t,n){return function(e){if(!e)throw new $r}(null==n||function(e,t){switch(Iy(e)){case 5:return Rs(t);case 6:return js(t);case 7:return xf(t);case 0:return QE(t,e.__elementTypeId$);case 2:return zp(t)&&!(t.ad===i);case 1:return zp(t)&&!(t.ad===i)||QE(t,e.__elementTypeId$);default:return!0}}(e,n)),e[t]=n}function $p(e){e.a=null,e.e=null,Rm(e.b),e.d=0,++e.c}function Kp(e){return e.f||(e.f=new tu(e))}function Xp(e){return e.k||(e.k=new Gt(e))}function Qp(e){return e.e||(e.e=new ec(e))}function Zp(e){var t;return!(t=e.e)&&(e.e=t=e.gb()),t}function Jp(e){return e.c.f.d==e.d.f.d}function eg(e,t){var n;return ew(n=new Wv(e),t),n}function tg(e,t){return e.a+=String.fromCharCode(t),e}function ng(e){return!e.a&&e.d?e.d.b:e.a}function rg(e){return Xs(e)?0|e:e.l|e.m<<22}function ig(e,t){return Rs(t)?Cb(e,t):Ju(xb(e.d,t))}function ag(e){return vs(e,19)?Kd(e,19).Y():sm(e.mb())}function og(e){return e?new Uh((Kl(),e)):function(e){var t;return nw(t=new ea,e),t}(null.mb())}function cg(e,t){return Zu(e)===Zu(t)||null!=e&&xk(e,t)}function ug(e,t){return na(),Yx(oa(Lf(e)),oa(Lf(t)))}function lg(e){return Ps(),_d(e.a.bb().mb(),(Zl(),EA))}function sg(){sg=a,gd(),yA=new vv(($g(),$g(),h$))}function fg(){fg=a,gd(),TA=new Jc(($g(),$g(),g$))}function dg(e,t){if(null==e)throw new Pa((ci(),t))}function hg(e,t,n,r){e.g[t.e][n.e]=r,e.g[n.e][t.e]=r}function pg(e){Ml(-1!=e.c),e.d.vb(e.c),e.b=e.c,e.c=-1}function gg(e){this.c=e,this.b=e.a.b.a,Zs(e.a.c,this)}function bg(e){Cj.call(this,new Zn(e)),this.a=new sa}function vg(){Ri.call(this,new Ai(new Er)),this.a=this}function mg(){ky(),this.b=(Ps(),new Er),this.a=new Er}function yg(e){Sg(e.a),e.b=Dm(eA,hI,1,e.b.length,4,1)}function wg(e){return!e.b&&(e.b=new Za(e.c.W())),e.b}function xg(e,t){var n;return RR(e,t,n=new yt),n.d}function kg(e,t){var n;return(n=Wp("",e)).k=t,n.g=1,n}function Sg(e){var t;for(t=e.mb();t.G();)t.H(),t.I()}function Eg(e,t){return vs(t,79)&&Di(e.b,Kd(t,79).mc())}function Cg(e,t,n){return Rs(t)?Xb(e,t,n):c_(e.d,t,n)}function Pg(e,t,n,r){this.d=e,this.b=t,this.a=n,this.c=r}function _g(e,t,n,r){this.d=e,this.e=t,this.c=n,this.b=r}function Tg(e,t,n,r){this.a=e,this.c=t,this.b=n,this.d=r}function Og(e,t,n,r){Ao.call(this,e,t),this.a=n,this.b=r}function jg(e,t){return ci(),e==t?0:e0?1:0}function rb(e,t){return rx(function(e,t){return Rd(e.l&t.l,e.m&t.m,e.h&t.h)}(Xs(e)?dx(e):e,Xs(t)?dx(t):t))}function ib(e){return 0==e.b?null:(Ll(0!=e.b),tw(e,e.a.a))}function ab(e){e.d=e.d-15,e.b=e.b-15,e.c=e.c+15,e.a=e.a+15}function ob(e){this.b=e,this.c=e,e.e=null,e.c=null,this.a=1}function cb(e,t,n){this.d=e,this.b=new At,this.c=t,this.a=n}function ub(e,t){!function(e,t){e.a=t}(this,new nc(e.a,e.b)),function(e,t){e.b=t}(this,Ud(t))}function lb(e){ms(new Qn(gC(e.e)))&&(function(e){var t,n,r;for(r=new $h(new or(e.c).a);ys(r.a);)switch(r.b=lm(r.a),t=Kd((n=new Fu(r.c,r.b)).b.b[n.a.e],62),Kd(n.a,67).e){case 0:t.d=0,t.e=-(t.b+e.d);break;case 1:t.d=(e.e.e.j.a-t.c)/2,t.e=-(t.b+e.d);break;case 2:t.d=e.e.e.j.a-t.c,t.e=-(t.b+e.d);break;case 3:t.d=0,t.e=e.e.e.j.b+e.d;break;case 4:t.d=(e.e.e.j.a-t.c)/2,t.e=e.e.e.j.b+e.d;break;case 5:t.d=e.e.e.j.a-t.c,t.e=e.e.e.j.b+e.d;break;case 6:t.d=-(t.c+e.d),t.e=0;break;case 7:t.d=-(t.c+e.d),t.e=(e.e.e.j.b-t.b)/2;break;case 8:t.d=-(t.c+e.d),t.e=e.e.e.j.b-t.b;break;case 9:t.d=e.e.e.j.a+e.d,t.e=0;break;case 10:t.d=e.e.e.j.a+e.d,t.e=(e.e.e.j.b-t.b)/2;break;case 11:t.d=e.e.e.j.a+e.d,t.e=e.e.e.j.b-t.b;break;case 12:t.d=e.q.b+e.d,t.e=e.q.d+e.d;break;case 13:t.d=(e.e.e.j.a-t.c)/2,t.e=e.q.d+e.d;break;case 14:t.d=e.e.e.j.a-e.q.c-t.c-e.d,t.e=e.q.d+e.d;break;case 15:t.d=e.q.b+e.d,t.e=(e.e.e.j.b-t.b)/2;break;case 16:t.d=(e.e.e.j.a-t.c)/2,t.e=(e.e.e.j.b-t.b)/2;break;case 17:t.d=e.e.e.j.a-e.q.c-t.c-e.d,t.e=(e.e.e.j.b-t.b)/2;break;case 18:t.d=e.q.b+e.d,t.e=e.e.e.j.b-e.q.a-t.b-e.d;break;case 19:t.d=(e.e.e.j.a-t.c)/2,t.e=e.e.e.j.b-e.q.a-t.b-e.d;break;case 20:t.d=e.e.e.j.a-e.q.c-t.c-e.d,t.e=e.e.e.j.b-e.q.a-t.b-e.d}}(e),function(e){var t,n,r,i,a;for(r=new Qn(gC(e.e));r.a>>0).toString(16)}function Eb(e,t){return function(e,t){return Xh(),e==t?0:e?1:-1}(aa((Wh(e),e)),aa((Wh(t),t)))}function Cb(e,t){return null==t?Ju(xb(e.d,null)):Du(e.e,t)}function Pb(e,t,n){return new Vb(e.c,xj(e.b,function(e,t,n){return new __(e,!1,null,(Xl(),bA),!0,t,n)}(e.d,t,n)),e.a)}function _b(e){return 0|Math.max(Math.min(e,UM),-2147483648)}function Tb(e){this.e=e,this.b=this.e.a.entries(),this.a=[]}function Ob(e){this.c=e,this.b=new ck(new Gn(this.c.a).a)}function jb(e){this.b=(Ql(),Ql(),Ql(),wA),this.a=Kd(Hh(e),35)}function Rb(e,t,n){es(),Dd.call(this,e,t),null!=n&&(this.c=n)}function Mb(e,t,n){if(e<0||tn)throw new ca(function(e,t,n){if(e<0||e>n)return u_(e,n,"start index");if(t<0||t>n)return u_(t,n,"end index");return aO("end index (%s) must not be less than start index (%s)",Fx(Ia(eA,1),hI,1,4,[lS(t),lS(e)]))}(e,t,n))}function Ib(e,t){if(null==e)throw new Pa((ci(),t));return e}function Nb(e){if(!gS(e))throw new Si;return e.c=e.b,e.b.H()}function Lb(e){function t(){}return t.prototype=e||{},new t}function Ab(e){var t;return wx(t=new Ro(xx(e.length)),e),t}function Db(e){var t;t=e.c.b.b,e.b=t,e.a=e.c.b,t.a=e.c.b.b=e}function zb(e){this.b=null,!e&&(ru(),ru(),e=m$),this.a=e}function Bb(e){this.b=e,this.a=new av(this.b,this.b.c.length)}function Hb(e){return sg(),Hh(e),LE(e||qd(new Qn(null)))}function Fb(e,t){var n=e.a=e.a||[];return n[t]||(n[t]=e.Oc(t))}function Gb(e,t,n){var r;EC(t,n,e.c.length),r=n-t,So(e.c,t,r)}function Vb(e,t,n){Lo.call(this,t.a),this.c=e,this.b=t,this.a=n}function Yb(e){return $u(e.c),e.e=e.a=e.c,e.c=e.c.c,++e.d,e.a.f}function Wb(e){return $u(e.e),e.c=e.a=e.e,e.e=e.e.e,--e.d,e.a.f}function qb(e){return ix(Fx(Ia(WA,1),PN,10,0,[e.f.i,e.i,e.a]))}function Ub(){Ub=a,cV=sk((Xg(),Fx(Ia(lV,1),gI,193,0,[aV,oV])))}function $b(){$b=a,VG=sk((Dv(),Fx(Ia(XG,1),gI,175,0,[FG,GG])))}function Kb(){Kb=a,CV=sk((wv(),Fx(Ia(_V,1),gI,192,0,[EV,SV])))}function Xb(e,t,n){return null==t?c_(e.d,null,n):kS(e.e,t,n)}function Qb(e,t){return ip(e.a,t)?Lp(e,Kd(t,17).e,null):null}function Zb(e){return Hh(e),yC((Ql(),new zl(Fl(Zd(e.a,new p)))))}function Jb(e,t){var n,r;return r=up(e,t),n=e.a.ub(r),new qo(e,n)}function ev(e,t,n){var r;(r=new ct).b=t,r.a=n,++t.b,Ad(e.d,r)}function tv(e,t,n){e.d&&Xm(e.d.b,e),e.d=t,e.d&&Dh(e.d.b,n,e)}function nv(e,t,n){EC(t,n,e.Y()),this.c=e,this.a=t,this.b=n-t}function rv(e,t,n,r){this.d=e,this.b=t,this.a=n,this.c=r}function iv(e,t){Ri.call(this,Cw(Hh(e),Hh(t))),this.b=e,this.c=t}function av(e,t){this.a=e,Vn.call(this,e),Im(t,e.Y()),this.b=t}function ov(e,t,n,r){es(),Rb.call(this,e,t,n),null!=r&&(this.d=r)}function cv(e){return Ll(e.a2e3&&(AA=e,DA=r.setTimeout(go,10));if(0==LA++)return function(e){var t,n;if(e.a){n=null;do{t=e.a,e.a=null,n=$P(t,n)}while(e.a);e.a=n}}((fi(),NA)),!0;return!1}();try{return function(e,t,n){return e.apply(t,n)}(e,t,n)}finally{!function(e){e&&function(e){var t,n;if(e.b){n=null;do{t=e.b,e.b=null,n=$P(t,n)}while(e.b);e.b=n}}((fi(),NA)),--LA,e&&-1!=DA&&(!function(e){r.clearTimeout(e)}(DA),DA=-1)}(i)}}function bv(e){return vs(e,19)?Kd(e,19).V():!e.mb().G()}function vv(e){sg(),this.a=($g(),vs(e,63)?new eo(e):new ef(e))}function mv(){mv=a,eq=new Cu(fN,0),tq=new Cu("TOP_LEFT",1)}function yv(){yv=a,QV=new du("DOWN",0),ZV=new du("UP",1)}function wv(){wv=a,EV=new Fc("LAYER_SWEEP",0),SV=new Fc(wL,1)}function xv(){xv=a,MV=new lu("UPPER",0),RV=new lu("LOWER",1)}function kv(e,t){return!!vs(t,21)&&CC(e.a,Kd(t,21))}function Sv(e,t){return!!vs(t,21)&&CC(e.a,Kd(t,21))}function Ev(e,t){return!!vs(t,21)&&CC(e.a,Kd(t,21))}function Cv(e){var t;return Uk(t=new Gg,e),ly(t,(OM(),ez),null),t}function Pv(e,t){return t===e?"(this Map)":(ci(),null==t?VM:cC(t))}function _v(e,t,n,r){return vs(n,63)?new Cf(e,t,n,r):new Ep(e,t,n,r)}function Tv(){Tv=a,oB=sk((Ky(),Fx(Ia(TB,1),gI,149,0,[iB,rB,nB])))}function Ov(){Ov=a,ND=sk((Bk(),Fx(Ia(Bz,1),gI,166,0,[RD,jD,MD])))}function jv(){jv=a,pV=sk((Cy(),Fx(Ia(mV,1),gI,173,0,[hV,dV,fV])))}function Rv(e,t){var n;$g(),iC(n=e.ob(),0,n.length,t),function(e,t){var n,r;for(r=e.Y(),n=0;nt)throw new ca(u_(e,t,"index"));return e}function Fv(e,t,n){Hh(e),function(e){var t,n,r;for(Rv(e.c,e.a),r=new Qn(e.c);r.a>22&KI,e<0?XI:0)}function km(){km=a,lD=sk((Dk(),Fx(Ia(pD,1),gI,59,0,[oD,aD,iD,rD,cD])))}function Sm(){Sm=a,OB=sk(($R(),Fx(Ia(NB,1),gI,32,0,[PB,uB,cB,CB,_B])))}function Em(){Em=a,Uz=sk((WS(),Fx(Ia(eB,1),gI,100,0,[Wz,Yz,Fz,Gz,Vz])))}function Cm(){Cm=a,TV=xh(Ch(Ch(Ch(Eh(new yS,(EM(),lG)),bG),FF),QF),uG)}function Pm(e,t){var n;for(n=t.mb();n.G();)FO(e,Kd(n.H(),55),0,0)}function _m(e,t,n){var r;for(r=e.mb();r.G();)OO(Kd(r.H(),55),t,n)}function Tm(e,t,n){var r,i;for(r=0,i=0;it)throw new ca("Index: "+e+", Size: "+t)}function Nm(e,t){if(e<0||e>=t)throw new ca("Index: "+e+", Size: "+t)}function Lm(e,t){var n;return!!(n=pk(e,t.yb()))&&Ig(n.e,t.zb())}function Am(e,t){var n;return n=e.d,t>0?Kd(wh(n.a,t-1),9):null}function Dm(e,t,n,r,i,a){var o;return o=TC(i,r),9!=i&&Fx(Ia(e,a),t,n,i,o),o}function zm(e){var t;if(!kw(e))throw new Si;return e.d=1,t=e.c,e.c=null,t}function Bm(e,t,n,r){this.f=e,this.e=t,this.d=n,this.b=r,this.c=r?r.d:null}function Hm(e){var t;return t=Kd(wh(e.f,0),7),Kd(Dx(t,(CM(),Lq)),7)}function Fm(e){var t;return t=Kd(wh(e.f,0),7),Kd(Dx(t,(CM(),Lq)),7)}function Gm(){Gm=a,QU=sk(($S(),Fx(Ia(ZU,1),gI,153,0,[UU,KU,$U])))}function Vm(){Vm=a,n$=sk((Zw(),Fx(Ia(r$,1),gI,172,0,[JU,e$,t$])))}function Ym(){Ym=a,nD=sk((_E(),Fx(Ia(uD,1),gI,103,0,[XA,JA,eD,tD,QA,ZA])))}function Wm(){Wm=a,OD=sk((ZC(),Fx(Ia(ID,1),gI,133,0,[PD,ED,_D,kD,CD,SD])))}function qm(){qm=a,tB=sk((NC(),Fx(Ia(aB,1),gI,28,0,[Jz,Zz,Qz,$z,Xz,Kz])))}function Um(){Um=a,QG=sk((MP(),Fx(Ia(eV,1),gI,125,0,[$G,WG,KG,UG,qG,YG])))}function $m(){$m=a,KA=new Dd("de.cau.cs.kieler.labels.labelManager",null)}function Km(e,t){var n;return(n=new yt).c=!0,n.d=t.zb(),RR(e,t.yb(),n)}function Xm(e,t){var n;return-1!=(n=sy(e,t,0))&&(e.vb(n),!0)}function Qm(e,t){return 9!=Iy(t)&&Fx(My(t),t._c,t.__elementTypeId$,Iy(t),e),e}function Zm(e){return xp(e.c.a.c,e),Ll(e.b!=e.c.a.b),e.a=e.b,e.b=e.b.a,e.a}function Jm(e){Ml(!!e.c),xp(e.e,e),e.c.I(),e.c=null,e.b=vx(e),Zs(e.e,e)}function ey(e,t,n){Ri.call(this,Cw(Hh(e),Hh(t))),this.b=e,this.c=t,this.a=n}function ty(e,t,n,r){this.b=new jn(this),this.a=e,this.c=t,this.e=n,this.d=r}function ny(e){ok.call(this,e,0),kf(this),this.b.b=this.b,this.b.a=this.b}function ry(e,t){Gu.call(this,e,t),this.a=Dm(S$,hI,183,2,0,1),this.b=!0}function iy(e,t){return Rs(t)?null==t?!!xb(e.d,null):function(e,t){return!(void 0===To(e.a,t))}(e.e,t):!!xb(e.d,t)}function ay(e,t){return ja(),(e-t>0?e-t:-(e-t))<=UI||e==t||isNaN(e)&&isNaN(t)}function oy(e,t){return ja(),(e-t>0?e-t:-(e-t))<=UI||e==t||isNaN(e)&&isNaN(t)}function cy(e){var t,n;t=!0;do{n=t?wS(e):zS(e),t=!t}while(n);yx(e,e.d)}function uy(e,t,n){var r;if(null==t)throw new Xr;return r=Ng(e,t),function(e,t,n){if(n){var r=n.gc();e.a[t]=r(n)}else delete e.a[t]}(e,t,n),r}function ly(e,t,n){return!e.n&&(e.n=new Er),null==n?np(e.n,t):Cg(e.n,t,n),e}function sy(e,t,n){for(;n=e.a.c.length;)Ad(e.a,new fa);return Kd(wh(e.a,t),20)}function dy(e,t,n,r,i){var a;return cw(n,a=Wp(e,t)),a.g=i?8:0,a.f=r,a.e=i,a}function hy(e,t){var n;this.f=e,this.b=t,n=Kd(ig(e.b,t),126),this.c=n?n.b:null}function py(e,t){var n,r;for(n=0,r=t.length;n0&&(r+=function(e){var t,n,r,i,a,o,c,u,l,s,f,d,h,p,g,b,v,m,y,w,x,k,S;for(i=0,m=0,Ps(),v=new Er,r=new Er,a=new Er,S=new Er,function(e,t,n){var r,i,a,o,c,u,l,s,f,d,h;for(r=0,i=0,s=0;s0&&Cg(t,a,lS(r+=a.b.c.length+a.e.c.length));else{for(c=zP(u,($R(),cB)).mb();c.G();)r+=(a=Kd(c.H(),7)).b.c.length+a.e.c.length;for(o=zP(u,cB).mb();o.G();)(a=Kd(o.H(),7)).b.c.length+a.e.c.length>0&&Cg(t,a,lS(r))}for(l=e.length-1;l>=0;l--)if(Ks(Kd(Dx(u=e[l],(OM(),vz)),28)))for(d=zP(u,($R(),_B)).mb();d.G();)(f=Kd(d.H(),7)).b.c.length+f.e.c.length>0&&Cg(n,f,lS(i+=f.b.c.length+f.e.c.length));else{for(h=zP(u,($R(),_B)).mb();h.G();)i+=(f=Kd(h.H(),7)).b.c.length+f.e.c.length;for(d=zP(u,_B).mb();d.G();)(f=Kd(d.H(),7)).b.c.length+f.e.c.length>0&&Cg(n,f,lS(i))}}(e,a,S),t=null,b=0,k=0,y=!0,u=!0,d=0,p=e.length;dl.k&&(++t,h=!0),p&&l&&p.k>l.k&&(++t,g=!0),d&&c&&d.kc.k&&(++t,u=!0),d&&c&&d.kl.k&&(++t,s=!0),u&&s&&c==l&&--t)}}return t}(t)),r}function vy(e,t){var n;return(n=Kd(np(e.c,t),176))?(jh(n),n.e):null}function my(e){return bk(e,UM)>0?UM:bk(e,JM)<0?JM:rg(e)}function yy(e){return Kl(),By(e,"size"),rg(function(e,t){return bk(e,t)<0}(Lk(e,8),NI)?Lk(e,8):NI),new no}function wy(e){dd.call(this,(ci(),null==e?VM:cC(e)),vs(e,46)?Kd(e,46):null)}function xy(e){Cl(this),Vh(e>=0,"Initial capacity must not be negative")}function ky(){ky=a,LH=Ph(Ch(Ch(new yS,(EM(),sG)),ZF),aG),AH=Eh(new yS,nG)}function Sy(){Sy=a,wF=new Y,mF=new W,yF=new q,vF=new U,xF=new $,kF=new K}function Ey(){Ey=a,E$=new Hu("All",0),C$=new as,P$=new Ss,_$=new os}function Cy(){Cy=a,hV=new Hc(EL,0),dV=new Hc("LONGEST_PATH",1),fV=new Hc(wL,2)}function Py(){Py=a,GA=Rd(KI,KI,524287),VA=Rd(0,0,524288),xm(1),xm(2),YA=xm(0)}function _y(){_y=a,zG=sk((ET(),Fx(Ia(BG,1),gI,109,0,[AG,RG,NG,MG,IG,jG,LG,DG])))}function Ty(){Ty=a,qV=sk((uC(),Fx(Ia($V,1),gI,141,0,[WV,GV,VV,FV,YV])))}function Oy(){Oy=a,wW=sk((AC(),Fx(Ia(_W,1),gI,115,0,[gW,pW,vW,bW,mW])))}function jy(){jy=a,sU=sk((lC(),Fx(Ia(pU,1),gI,85,0,[uU,iU,aU,oU,cU])))}function Ry(e){vP(),function(e,t,n){e.a=1502^t,e.b=n^$L}(this,rg(rb(rx(function(e,t){var n,r,i,a,o;t&=63,n=e.h,(r=0!=(524288&n))&&(n|=-1048576),t<22?(o=n>>t,a=e.m>>t|n<<22-t,i=e.l>>t|e.m<<22-t):t<44?(o=r?XI:0,a=n>>t-22,i=e.m>>t-22|n<<44-t):(o=r?XI:0,a=r?KI:0,i=n>>t-44);return Rd(i&KI,a&KI,o&XI)}(Xs(e)?dx(e):e,24)),XL)),rg(rb(e,XL)))}function My(e){return Rs(e)?rA:js(e)?c$:xf(e)?o$:tp(e)||Mh(e)?e.$c:e.$c||IA}function Iy(e){return null==e.__elementTypeCategory$?9:e.__elementTypeCategory$}function Ny(e){var t,n;for(cu(),n=iN,t=0;tn&&(n=e[t]);return n}function Ly(e,t){var n;return(n=Kd(ig(e.b,t),106))||(n=t.rc(),Cg(e.b,t,n)),n}function Ay(e,t){var n;return(n=Kd(ig(e.c,t),176))?(Ws(e,n),n.e):null}function Dy(e,t,n,r){var i;(i=Kd(Ay(e.e,t),116)).b+=n,i.a+=r,$E(e.e,t,i),e.d=!0}function zy(e){var t;for(++e.a,t=e.c.a.length;e.a"+e.d.f+"("+e.d+")":"e_"+vf(e)}function $y(){$y=a,Hz=sk((D_(),Fx(Ia(qz,1),gI,41,0,[Rz,jz,Iz,zz,Dz,Az,Nz,Lz,Mz])))}function Ky(){Ky=a,iB=new yc("OUTSIDE",0),rB=new yc("INSIDE",1),nB=new yc("FIXED",2)}function Xy(){Xy=a,QW=new Eu(pN,0),ZW=new Eu("TOP",1),XW=new Eu("BOTTOM",2)}function Qy(){Qy=a,nY=new pu("CLASSIC",0),rY=new pu("IMPROVE_STRAIGHTNESS",1)}function Zy(){this.e=new sa,this.a=new qg,this.d=new sa,this.b=new At,this.c=new At}function Jy(e,t,n){this.b=t,this.a=e,this.c=n,Ad(this.a.e,this),Ad(this.b.b,this)}function ew(e,t){e.d=Va(e.d,t.d),e.c=Ha(e.c,t.c),e.a=Ha(e.a,t.a),e.b=Va(e.b,t.b)}function tw(e,t){var n;return n=t.c,t.a.b=t.b,t.b.a=t.a,t.a=t.b=null,t.c=null,--e.b,n}function nw(e,t){var n;for(Ql(),Hh(e),Hh(t),n=!1;t.G();)n|=e.ib(t.H());return n}function rw(e){var t;return xp(e.e,e),Ll(e.b),e.c=e.a,t=Kd(e.a.H(),21),e.b=vx(e),t}function iw(e){return JI=0x8000000000000000)return Py(),GA;i=!1,e<0&&(i=!0,e=-e);r=0,e>=ZI&&(e-=(r=_b(e/ZI))*ZI);n=0,e>=QI&&(e-=(n=_b(e/QI))*QI);return t=_b(e),a=Rd(t,n,r),i&&(o=1+~a.l&KI,c=~a.m+(0==o?1:0)&KI,u=~a.h+(0==o&&0==c?1:0)&XI,a.l=o,a.m=c,a.h=u),a}(e))}function aw(e){if(e){if(e.V())throw new Si;return e.sb(e.Y()-1)}return function(e){var t;for(Ql();;)if(t=e.H(),!e.G())return t}(null.mb())}function ow(e,t){var n;return t<(n=e.d).a.c.length-1?Kd(wh(n.a,t+1),9):null}function cw(e,t){if(e){t.k=e;var n=function(e){if(e.Tc())return null;var t=e.k;return MM[t]}(t);n?n.$c=t:MM[e]=[t]}}function uw(e,t){var n,r;r=!1;do{r|=n=e.i?Nx(e,t):Ix(e,t)}while(n);return r}function lw(e,t,n){var r,i;r=t;do{i=oa(e.n[r.k])+n,e.n[r.k]=i,r=e.a[r.k]}while(r!=t)}function sw(e,t){return Ib(e,"set1"),Ib(t,"set2"),ou(),new yd(e,new Io(t),t)}function fw(e){var t=/function(?:\s+([\w$]+))?\s*\(/.exec(e);return t&&t[1]||YM}function dw(){dw=a,lW=sk((QC(),Fx(Ia(hW,1),gI,123,0,[uW,cW,oW,iW,rW,aW])))}function hw(){hw=a,TW=sk((XC(),Fx(Ia(BW,1),gI,124,0,[EW,SW,PW,kW,CW,xW])))}function pw(){pw=a,s$=Fx(Ia(L$,1),WI,26,12,[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15])}function gw(){gw=a,hU=new _u(hN,0),fU=new _u("INPUT",1),dU=new _u("OUTPUT",2)}function bw(e){this.c=e,this.b=new ck(new Gn(e.b).a),this.a=null,this.d=(Ql(),Ql(),xA)}function vw(e){this.e=e,this.d=new Ro(xx(lp(this.e).Y())),this.c=this.e.a,this.b=this.e.c}function mw(e,t,n){this.c=e,$v.call(this),this.b=t,this.j=new _g(t.d,t.e,t.c,t.b),this.a=n}function yw(e,t){e.j>0&&e.c0&&0!=e.e&&yw(e.g,t/e.j*e.g.d))}function ww(e){return e.b.d.f.g==(JC(),fF)?Kd(Dx(e.b.d.f,(CM(),Lq)),7):e.b.d}function xw(e){return e.b.c.f.g==(JC(),fF)?Kd(Dx(e.b.c.f,(CM(),Lq)),7):e.b.c}function kw(e){switch(Uu(3!=e.d),e.d){case 2:return!1;case 0:return!0}return function(e){return e.d=3,e.c=function(e){for(var t;e.b.G();)if(t=e.b.H(),e.a.D(t))return t;return e.d=2,null}(e),2!=e.d&&(e.d=0,!0)}(e)}function Sw(e){switch(e.e){case 2:return $R(),_B;case 4:return $R(),cB;default:return e}}function Ew(e){switch(e.e){case 1:return $R(),CB;case 3:return $R(),uB;default:return e}}function Cw(e,t){var n;return $g(),n=new Kc(1),Rs(e)?Xb(n,e,t):c_(n.d,e,t),new rr(n)}function Pw(e,t){return e.g?(e.g=Pw(e.g,t),--e.a,e.j=Ak(e.j,t.c),dP(e)):e.e}function _w(e,t){return e.e?(e.e=_w(e.e,t),--e.a,e.j=Ak(e.j,t.c),dP(e)):e.g}function Tw(e,t){var n,r,i;for(Wh(t),n=!1,i=t.mb();i.G();)r=i.H(),n|=e.ib(r);return n}function Ow(e){var t,n;for(n=new Hr,t=e.b.mb();t.G();)Ld(n,Kd(t.H(),92).a);return n}function jw(e){var t,n,r;for(t=0,r=e.mb();r.G();)t+=(Wh(n=Lf(r.H())),n);return t/e.Y()}function Rw(e,t){var n;return(n=Kd(ig(e.c,t),200))||((n=new Jr).c=t,Cg(e.c,n.c,n)),n}function Mw(e,t){var n;return Wh(t),n=t.e,!e.b[n]&&(Up(e.b,n,t),++e.c,!0)}function Iw(e,t){var n,r;return n=1-t,r=e.a[n],e.a[n]=r.a[t],r.a[t]=e,e.b=!0,r.b=!1,r}function Nw(e,t){var n;return!!vs(t,10)&&(n=Kd(t,10),e.a==n.a&&e.b==n.b)}function Lw(e,t,n){return e.g=new Hw(t,n),jf(e,e.g,e.i),e.d=Ga(2,e.d),++e.a,e.j=Nk(e.j,n),e}function Aw(e,t,n){return e.e=new Hw(t,n),jf(e.f,e.e,e),e.d=Ga(2,e.d),++e.a,e.j=Nk(e.j,n),e}function Dw(e,t){var n=e.a,r=0;for(var i in n)n.hasOwnProperty(i)&&(t[r++]=i);return t}function zw(e,t){var n,r;for(Wh(t),r=t.bb().mb();r.G();)n=Kd(r.H(),21),e.db(n.yb(),n.zb())}function Bw(e,t,n){this.g=e,this.d=t,this.e=n,this.a=new At,function(e){var t,n,r,i,a;for(a=new Kf(e.d,e.e),i=BT(a);i.G();)for(r=Kd(i.H(),7),n=new Qn(e.e==($R(),_B)?r.b:r.e);n.a0),this.b=e,this.c=t,this.j=t,this.a=1,this.d=1,this.e=null,this.g=null}function Fw(e){return 1.4901161193847656e-8*X_(e,26)+11102230246251565e-32*X_(e,27)}function Gw(e){return vs(e,87)?dv(Kd(e,87)):vs(e,88)?Kd(e,88).a:vs(e,63)?new Li(e):new Jo(e)}function Vw(e){var t;return t=Kd(Dx(e,(CM(),kq)),32),e.g==(JC(),fF)&&(t==($R(),_B)||t==cB)}function Yw(e,t){return!!function(e,t){var n,r,i,a;for(n=Kd(Dx(t,(CM(),wq)),18),a=Kd(fP(oF,n),18),i=a.mb();i.G();)if(r=Kd(i.H(),18),!Kd(fP(e.a,r),20).V())return!1;return!0}(e,t)&&(M_(e.a,Kd(Dx(t,(CM(),wq)),18),t),!0)}function Ww(e,t){var n;if(t)for(n=0;n<6;n++)Kd(wh(e.a,n),18).jb(Kd(wh(t.a,n),19));return e}function qw(e,t){var n;return e.b?null:(n=function(e,t){return new Rf(e>0?e-1:e,t)}(e.e,e.f),Ld(e.a,n),n.g=e,e.d=t,n)}function Uw(e,t){var n,r;for(r=WE(e,0);r.b!=r.d.c;)(n=Kd(Bv(r),10)).a+=t.a,n.b+=t.b;return e}function $w(e,t){var n,r;for(n=0;n0?e.g?tx(e.g,t,n):0:e.c}function nx(e,t){var n,r;return!!e.c&&(r=e.g,(n=e.a.$b(t,r))>0|0==n&e.f==(Xl(),bA))}function rx(e){var t;return 0==(t=e.h)?e.l+e.m*QI:t==XI?e.l+e.m*QI-ZI:e}function ix(e){var t,n,r,i;for(t=new sa,r=0,i=e.length;r=i;a--)e[a+1]=e[a];e[i]=r}function sx(e,t,n,r){var i,a;for(i=function(e,t,n,r){var i,a,o,c;a=t,i=n-1;for(;a<=i;)if((c=e[o=a+i>>>1])r))return o;i=o-1}return-(a+1)}(e,t,n,r),i<0&&(i=-i-1),a=n-1;a>=i;a--)e[a+1]=e[a];e[i]=r}function fx(e,t){var n,r;for(Wh(t),r=t.mb();r.G();)if(n=r.H(),!e.kb(n))return!1;return!0}function dx(e){var t,n,r;return n=0,(r=e)<0&&(r+=ZI,n=XI),t=_b(r/QI),Rd(_b(r-t*QI),t,n)}function hx(e,t){return e.c.c=Dm(eA,hI,1,0,4,1),LP(e,e.e,t),LP(e,e.a,t),$g(),Rv(e.c,null),function(e){var t,n,r;for(t=0,r=new Qn(e.c);r.a0;r--)n|=oE(e,t,r-1,r);return n}function Nx(e,t){var n,r,i;for(n=!1,r=e.d[t].length,i=0;i1&&(Rv(t,e.b),function(e,t){var n,r,i,a,o,c,u,l,s;for(i=new At,u=new Qn(t);u.at?1:e==t?0:isNaN(e)?isNaN(t)?0:1:-1}function Wx(e){switch(e.Y()){case 0:return yA;case 1:return new Kh(e.mb().H());default:return new vv(e)}}function qx(){var e,t;qx=a,t=!(Error.stackTraceLimit||"stack"in new Error),e=new wt,LM=t?new l:e}function Ux(){Ux=a,kH=new Dd("intCoordinates",(Xh(),Xh(),i$)),SH=new vh("jsonObject"),EH=new nc(0,0)}function $x(){$x=a,_F=new Nc("MIRROR_X",0),TF=new Nc("TRANSPOSE",1),PF=new Nc("MIRROR_AND_TRANSPOSE",2)}function Kx(){Kx=a,fW=new wu(pN,0),sW=new wu("INCOMING_ONLY",1),dW=new wu("OUTGOING_ONLY",2)}function Xx(){return tM(),Fx(Ia($Y,1),gI,60,0,[PY,SY,kY,OY,TY,UY,qY,_Y,EY,CY,jY,YY,WY])}function Qx(){var e,t,n,r;for(Qx=a,HG=new HS($Y),n=0,r=(t=Xx()).length;n0)return Xd(t-1,e.a.c.length),Om(e.a,t-1);throw new ki}function ak(e){e.b.c.length-e.e.c.length<0?(qf(e,($R(),cB)),e.a.a=e.j.a):(qf(e,($R(),_B)),e.a.a=0)}function ok(e,t){Vh(e>=0,"Negative initial capacity"),Vh(t>=0,"Non-positive load factor"),Rm(this)}function ck(e){var t;this.e=e,this.d=new fm(this.e.e),this.a=this.d,this.b=vx(this),t=e[VL],this[VL]=t}function uk(){this.n=null,this.j=null,this.i=null,this.d=null,this.b=null,this.k=null,this.a=null}function lk(e){var t,n,r,i;for(i=1,n=0,r=e.length;n=48&&e<58?e-48:e>=97&&e<97?e-97+10:e>=65&&e<65?e-65+10:-1}function Ik(e){switch(gd(),e.Y()){case 0:return fg(),TA;case 1:return new fo(e.mb().H());default:return new Jc(e)}}function Nk(e,t){var n;return Xs(e)&&Xs(t)&&JI<(n=e+t)&&n>22),i=e.h+t.h+(r>>22),Rd(n&KI,r&KI,i&XI)}(Xs(e)?dx(e):e,Xs(t)?dx(t):t))}function Lk(e,t){var n;return Xs(e)&&Xs(t)&&JI<(n=e*t)&&n>13|(15&e.m)<<9,i=e.m>>4&8191,a=e.m>>17|(255&e.h)<<5,o=(1048320&e.h)>>8,c=8191&t.l,u=t.l>>13|(15&t.m)<<9,l=t.m>>4&8191,s=t.m>>17|(255&t.h)<<5,f=(1048320&t.h)>>8,b=r*c,v=i*c,m=a*c,y=o*c,0!=u&&(b+=n*u,v+=r*u,m+=i*u,y+=a*u);0!=l&&(v+=n*l,m+=r*l,y+=i*l);0!=s&&(m+=n*s,y+=r*s);return 0!=f&&(y+=n*f),h=((g=n*c)>>22)+(b>>9)+((262143&v)<<4)+((31&m)<<17),p=(v>>18)+(m>>5)+((4095&y)<<8),p+=(h+=(d=(g&KI)+((511&b)<<13))>>22)>>22,Rd(d&=KI,h&=KI,p&=XI)}(Xs(e)?dx(e):e,Xs(t)?dx(t):t))}function Ak(e,t){var n;return Xs(e)&&Xs(t)&&JI<(n=e-t)&&n>22),i=e.h-t.h+(r>>22),Rd(n&KI,r&KI,i&XI)}(Xs(e)?dx(e):e,Xs(t)?dx(t):t))}function Dk(){Dk=a,oD=new fc(hN,0),aD=new fc(sN,1),iD=new fc(lN,2),rD=new fc("DOWN",3),cD=new fc("UP",4)}function zk(){zk=a,yD=new hc(hN,0),vD=new hc("POLYLINE",1),bD=new hc("ORTHOGONAL",2),mD=new hc("SPLINES",3)}function Bk(){Bk=a,RD=new gc("INHERIT",0),jD=new gc("INCLUDE_CHILDREN",1),MD=new gc("SEPARATE_CHILDREN",2)}function Hk(){Hk=a,gV=Eh(kh(new yS,(EM(),BF)),iG),bV=xh(Eh(Sh(new yS,IF),RF),MF),vV=xh(Ch(new yS,NF),MF)}function Fk(){Fk=a,yV=Eh(kh(new yS,(EM(),BF)),iG),wV=xh(Eh(Sh(new yS,IF),RF),MF),xV=xh(Ch(new yS,NF),MF)}function Gk(e){this.a=new Al,this.d=new Al,this.b=new Al,this.c=new Al,this.g=new Al,this.i=new Al,this.f=e}function Vk(e,t,n,r,i,a){this.e=new At,this.f=(gw(),hU),Ad(this.e,e),this.d=t,this.a=n,this.b=r,this.f=i,this.c=a}function Yk(e,t,n,r,i){var a,o;for(o=e.mb();o.G();)(a=Kd(o.H(),33)).i.a=t.a,a.i.b=i?t.b:t.b+r.b-a.j.b,t.a+=a.j.a+n}function Wk(e,t){var n,r;for(Vd(),r=Dp(tP(e));gS(r);)if((n=Kd(Nb(r),12)).d.f==t||n.c.f==t)return n;return null}function qk(e,t,n){var r,i,a;for(r=0,a=WE(e,0);a.b!=a.d.c&&!((i=oa(Lf(Bv(a))))>n);)i>=t&&++r;return r}function Uk(e,t){var n;return t?((n=t.n?t.n:($g(),$g(),p$)).V()||(e.n?zw(e.n,n):e.n=new dl(n)),e):e}function $k(e,t,n){try{!function(e,t,n){if(Hh(t),n.G())for(il(t,e.C(n.H()));n.G();)il(t,e.c),il(t,e.C(n.H()))}(e,t,n)}catch(R$){throw vs(R$=vk(R$),181)?new wy(R$):Xk(R$)}return t}function Kk(e,t,n){try{!function(e,t,n){var r,i;if(Hh(t),n.G())for(i=Kd(n.H(),21),il(t,Os(e.a,i.yb())),il(t,e.b),il(t,Os(e.a,i.zb()));n.G();)il(t,e.a.c),r=Kd(n.H(),21),il(t,Os(e.a,r.yb())),il(t,e.b),il(t,Os(e.a,r.zb()))}(e,t,n)}catch(R$){throw vs(R$=vk(R$),181)?new wy(R$):Xk(R$)}return t}function Xk(e){var t;return vs(e,164)&&Zu((t=Kd(e,164)).b)!==Zu((oi(),NM))?Zu(t.b)===Zu(NM)?null:t.b:e}function Qk(e,t){var n;for(n=Kd(Dx(ng(e),(CM(),Hq)),9);n;){if(n==t)return!0;n=Kd(Dx(ng(n),Hq),9)}return!1}function Zk(e){switch(Kd(Dx(e,(CM(),_q)),140).e){case 1:ly(e,_q,(Xy(),XW));break;case 2:ly(e,_q,(Xy(),ZW))}}function Jk(e){switch(gd(),e.c){case 0:return fg(),TA;case 1:return new fo(JP(new $c(e)));default:return new Mi(e)}}function eS(e){var t,n;for(sg(),t=0,n=e.length;t-129&&e<128?(t=e+128,!(n=(Qh(),l$)[t])&&(n=l$[t]=new In(e)),n):new In(e)}function sS(e){var t,n;for(t=YC(e.b,e.d),n=UM;n>t;){if(yx(e,e.d),0==t){n=0;break}wS(e),zS(e),n=t,t=YC(e.b,e.d)}e.c=n}function fS(){var e,t,n;vP(),n=k$+++(Date.now?Date.now():(new Date).getTime()),e=_b(Math.floor(n*PL))&XL,t=_b(n-e*KL),this.a=1502^e,this.b=t^$L}function dS(e){return Rs(e)?TE(e):js(e)?_b((Wh(e),e)):xf(e)?aa((Wh(e),e))?1231:1237:tp(e)?e.v():(Mh(e),vf(e))}function hS(e,t,n,r){var i,a,o;for(o=0,a=BT(new Kf(t,r));a.G();)i=Kd(a.H(),7),Cg(e.i,i,lS(o++));Cg(n,t,lS(o))}function pS(e){var t;return(t=Kd(Dx(e,(OM(),YD)),59))==(Dk(),oD)?Kd(Dx(e,(CM(),iq)),15).a>=1?aD:rD:t}function gS(e){if(Hh(e.b),e.b.G())return!0;for(;e.a.G();)if(Hh(e.b=e.Wb(e.a.H())),e.b.G())return!0;return!1}function bS(e){return e.d==e.c.d&&e.i==e.g.d||(e.a.c=Dm(eA,hI,1,0,4,1),mx(e.a,e.c),mx(e.a,e.g),e.d=e.c.d,e.i=e.g.d),e.a}function vS(e){var t;if(e.b){if(vS(e.b),e.b.d!=e.c)throw new xi}else e.d.V()&&(t=Kd(ig(e.f.b,e.e),19))&&(e.d=t)}function mS(e,t,n,r,i){var a,o,c,u;for(Hx(t,u=wm(e),r,i,n),a=0,c=new Qn(u);c.at){uv(n);break}}Rp(n,t)}function kS(e,t,n){var r;return r=To(e.a,t),function(e,t,n){e.set(t,n)}(e.a,t,void 0===n?null:n),void 0===r?(++e.c,od(e.b)):++e.d,r}function SS(e,t,n){return(t-e<=0?0-(t-e):t-e)gL?e-n>gL:n-e>gL)}function ES(e){switch(e.e){case 0:return pW;case 1:return gW;case 2:return bW;case 3:return vW;default:return mW}}function CS(e,t){switch(t.e){case 2:return e.b;case 1:return e.c;case 4:return e.d;case 3:return e.a;default:return!1}}function PS(e){switch($R(),e.e){case 4:return uB;case 1:return cB;case 3:return CB;case 2:return _B;default:return PB}}function _S(e,t){if(t==e.c)return e.d;if(t==e.d)return e.c;throw new ua("Node "+t+" not part of edge "+e)}function TS(e,t){var n;return Qs(e.a,t)?Kd(Qs(e.a,t)?e.b[t.e]:null,62):(n=new Fr,Mw(e.a,t),Lp(e,t.e,n),n)}function OS(e,t){var n,r,i;for(i=e.g.tb(),n=0;i.G();){if((r=oa(Lf(i.H()))-t)>zL)return n;r>BL&&++n}return n}function jS(e){var t,n,r,i;return Mw(n=new th(t=Kd(ao((i=(r=e.$c).f)==dA?r:i),11),Kd(Np(t,t.length),11),0),e),n}function RS(e,t){var n,r;for(r=new Qn(t);r.a %s",Fx(Ia(eA,1),hI,1,4,[lS(t),lS(n)])),EC(t,n=n<(r=e.length)?n:r,r),n-t}function DS(e,t){var n,r,i;for(n=e,i=0;;){if(n==t)return i;if(!(r=Kd(Dx(n,(CM(),Hq)),9)))throw new qr;n=ng(r),++i}}function zS(e){var t,n,r;for(r=!1,n=e.d.length-1;n>=0;n--)e.j=(t=new IP(e.e,e.d,n,1),new nP(n,e.d,t)),r|=uw(e,n);return r}function BS(e){this.f=(Ps(),new Er),this.n=new Er,this.k=new Er,this.g=new ea,this.i=new CE((li(),PA)),this.j=e,function(e,t){var n,r,i,a,o;for(n=0,o=0,i=0,a=t.length;i0?e-t:-(e-t))<=UI||e==t||isNaN(e)&&isNaN(t)?0:et?1:kl(isNaN(e),isNaN(t)))>0}function XS(e,t){return ja(),ja(),((e-t>0?e-t:-(e-t))<=UI||e==t||isNaN(e)&&isNaN(t)?0:et?1:kl(isNaN(e),isNaN(t)))<0}function QS(e){var t,n;for(e.d||function(e){var t,n,r,i,a,o;if(i=e.g.tb(),r=e.b.tb(),e.e)for(n=0;nzL;){for(a=t,o=0;(t-a<=0?0-(t-a):t-a)i}(e.j,n,r)&&(Ki(e.j,e.d[t][n],e.d[t][r]),o=(a=e.d[t])[r],a[r]=a[n],a[n]=o,i=!0),i}function cE(e,t,n){var r,i,a,o,c;i=(c=ng(e)).a,r=Kd(Dx(c,(CM(),sq)),15).a,a=c.d,o=e.i,t&&(o.a=o.a-i.b-r-a.a),n&&(o.b=o.b-i.d-r-a.b)}function uE(e,t){var n,r,i;for(r=Dp(tP(e));gS(r);)return n=Kd(Nb(r),12),new Ht(Hh((i=Kd(t.B(n),9)).i.b+i.j.b/2));return ui(),ui(),iA}function lE(e){var t,n,r,i;for(n=Vj(e),t=dL,i=0,r=0;t>.5&&i<50;)t=Oo(sP(n,r=NT(n),!0).b),++i;return sP(e,r,!1)}function sE(e){var t,n,r,i;for(n=Vj(e),t=dL,i=0,r=0;t>.5&&i<50;)t=Oo(sP(n,r=IT(n),!0).a),++i;return sP(e,r,!1)}function fE(e){var t,n,r;for(this.a=new Al,this.e=new ea,this.f=0,n=0,r=e.length;n0),t.a.sb(t.c=--t.b))}function yE(e,t,n){nE(n,"Compound graph preprocessor",1),e.a=new Qc,Mj(e,t,null),function(e,t){var n,r,i,a,o,c,u;for(o=lp(e.a).mb();o.G();){if((a=Kd(o.H(),12)).b.c.length>0)for(Rv(r=new md(Kd(fP(e.a,a),18)),new un(t)),i=new av(a.b,0);i.b=e.b>>1)for(r=e.c,n=e.b;n>t;--n)r=r.b;else for(r=e.a.a,n=0;n0&&(i.b+=t),i}function UE(e,t){var n,r,i;for(i=new sa,r=e.mb();r.G();)OO(n=Kd(r.H(),55),0,i.b),i.b+=n.e.b+t,i.a=Ha(i.a,n.e.a);return i.a>0&&(i.a+=t),i}function $E(e,t,n){var r,i,a;return(i=Kd(ig(e.c,t),176))?(a=kd(i,n),Ws(e,i),a):(r=new dh(e,t,n),Cg(e.c,t,r),Db(r),null)}function KE(e,t){return!!function(e){switch(e.e){case 0:return LY;case 1:return MY;case 2:return RY;case 3:return zY;case 4:return DY;case 5:return VY;case 6:return GY;case 7:return AY;case 8:return IY;case 9:return NY;case 11:return HY;case 10:return BY;default:return FY}}(e.b).kb(t.c)&&(function(e){return e==_Y||e==EY}(e.b)?!(Jd(t.d,e.c,e.a)&&Jd(t.a,e.c,e.a)):Jd(t.d,e.c,e.a)&&Jd(t.a,e.c,e.a))}function XE(e){switch(e.e){case 8:return $R(),uB;case 9:return $R(),CB;case 10:return $R(),cB;case 11:return $R(),_B;default:return $R(),PB}}function QE(e,t){return Rs(e)?!!zM[t]:e._c?!!e._c[t]:js(e)?!!DM[t]:!!xf(e)&&!!AM[t]}function ZE(){Ux(),this.i=(Ps(),new Er),this.a=new Er,this.k=new Er,this.j=new Er,this.b=new Er,this.n=new Er,this.f=new Er,this.e=new Er}function JE(e,t){var n,r;t.a.R(e)||(r=Kd(Dx(e,(CM(),kq)),32),n=Kd(wh(e.f,0),7),r==($R(),uB)?qf(n,CB):r==CB&&qf(n,uB),t.a.db(e,t))}function eC(e){return Ga(1,Kd(Dx(e,(CM(),Wq)),24).a)*(e.c.f.g==(JC(),pF)&&e.d.f.g==pF?1:e.c.f.g==pF||e.d.f.g==pF?2:8)}function tC(e){var t,n,r,i;for(i=Kd(Dx(e,(CM(),Lq)),7),n=0,r=(t=Kd(aC(e.b,Dm(uF,tL,12,e.b.c.length,0,1)),47)).length;nr&&Up(t,r,null),t}function oC(e,t){var n,r;for(r=e.a.length,t.lengthr&&Up(t,r,null),t}function cC(e){return Rs(e)?e:js(e)?jo((Wh(e),e)):xf(e)?ks(aa((Wh(e),e))):tp(e)?e.w():Mh(e)?Sb(e):e.toString?e.toString():"[JavaScriptObject]"}function uC(){uC=a,WV=new su("SIMPLE",0),GV=new su(wL,1),VV=new su("LINEAR_SEGMENTS",2),FV=new su("BRANDES_KOEPF",3),YV=new su(EL,4)}function lC(){lC=a,uU=new Pu(pN,0),iU=new Pu("FIRST",1),aU=new Pu("FIRST_SEPARATE",2),oU=new Pu("LAST",3),cU=new Pu("LAST_SEPARATE",4)}function sC(){sC=a,mY=new st,bY=Eh(new yS,(EM(),XF)),vY=xh(Eh(new yS,hG),dG),pY=xh(Ch(Eh(Sh(new yS,JF),tG),rG),eG),gY=xh(Ch(new yS,rG),HF)}function fC(e){var t,n,r;for(n=new Wn(new Yn(e.d.a).a.bb().mb());n.a.G();)r=Kd(n.a.H(),21),Ad((t=Kd(r.yb(),12)).c.e,t),Ad(t.d.b,t)}function dC(e,t){var n,r;if(Il(t>0),(t&-t)==t)return _b(t*X_(e,31)*4.656612873077393e-10);do{r=(n=X_(e,31))%t}while(n-r+(t-1)<0);return _b(r)}function hC(e,t){if(e.c.f==t)return e.d.f;if(e.d.f==t)return e.c.f;throw new ua("Node "+t+" is neither source nor target of edge "+e)}function pC(e,t,n){return Il(e>=0&&e<=1114111),e>=KM?(t[n++]=55296+(e-KM>>10&1023)&XM,t[n]=56320+(e-KM&1023)&XM,2):(t[n]=e&XM,1)}function gC(e){var t,n;if(!e.a)for(e.a=Ns(Kd(e.e,9).c.c.length),n=new Qn(Kd(e.e,9).c);n.ai&&Up(t,i,null),t}function kC(e,t,n){if(n&&(t<0||t>n.a.c.length))throw new ua("index must be >= 0 and <= layer node count");e.d&&Xm(e.d.a,e),e.d=n,n&&Dh(n.a,t,e)}function SC(e,t,n,r,i,a,o,c){var u,l;r&&((u=r.a[0])&&SC(e,t,n,u,i,a,o,c),function(e,t,n,r,i,a,o){var c,u;if(t.Xc()&&((u=e.a.$b(n,r))<0||!i&&0==u))return!1;if(t.Yc()&&((c=e.a.$b(n,a))>0||!o&&0==c))return!1;return!0}(e,n,r.d,i,a,o,c)&&t.ib(r),(l=r.a[1])&&SC(e,t,n,l,i,a,o,c))}function EC(e,t,n){if(e<0)throw new ca(iI+e+" < 0");if(t>n)throw new ca("toIndex: "+t+" > size "+n);if(e>t)throw new ua(iI+e+" > toIndex: "+t)}function CC(e,t){var n,r,i;return n=t.yb(),i=t.zb(),r=e.cb(n),!!(Zu(i)===Zu(r)||null!=i&&xk(i,r))&&!(null==r&&!e.R(n))}function PC(e,t,n){var r;(r=t.c.f).g==(JC(),hF)?(ly(e,(CM(),Rq),Kd(Dx(r,Rq),7)),ly(e,Mq,Kd(Dx(r,Mq),7))):(ly(e,(CM(),Rq),t.c),ly(e,Mq,n.d))}function _C(e,t,n){var r,i,a,o;for(function(e){var t,n;for(null==e.g&&(e.g=_h(e)),t=0,n=e.g.length;tr&&e.charCodeAt(t-1)<=32;)--t;return r>0||t>19)!=(c=t.h>>19)?c-o:(r=e.h)!=(a=t.h)?r-a:(n=e.m)!=(i=t.m)?n-i:e.l-t.l}function zC(e){var t,n,r;for(n=new Wn(new Yn(e.p.a).a.bb().mb());n.a.G();)if(r=Kd(n.a.H(),21),(t=Kd(r.yb(),89)).e&&e.b[t.b]<0)return t;return null}function BC(e,t){var n,r,i,a,o;r=Va(e.d,t.d),a=Va(e.e,t.e),(i=Ha(e.d+e.c,t.d+t.c))=t.length)throw new ca("Greedy SwitchDecider: Free layer layer not in graph.");this.b=t[e],this.c=new ed(this.b),this.d=new ax(this.b)}function rP(e,t){var n;if(this.f=e,this.b=this.f.c,Hv(t,n=e.d),t>=(n/2|0))for(this.e=e.e,this.d=n;t++0;)hv(this);this.a=null}function iP(e){var t,n,r;for(n=new Qn(e.a.b);n.a0&&(e.g=kP(e.g)),xP(e);case 2:return Sl(e.e)<0&&(e.e=xP(e.e)),kP(e);default:return e.d=1+Ga(Bi(e.e),Bi(e.g)),e}}function hP(e,t){this.f=(Ps(),new Er),this.b=new Er,this.j=new Er,this.a=e,this.c=t,this.c>0&&k_(this,this.c-1,($R(),cB)),this.c0&&j_(e,t,n),0):(qu(0==n),0)}function bP(e,t){var n,r,i,a,o;for(i=Kd(Dx(t,(CM(),Xq)),15).a*Kd(Dx(t,(PM(),CU)),15).a,o=e[0].i.a+e[0].j.a,a=1;a=0;t--)x$[t]=r,r*=.5;for(n=1,e=24;e>=0;e--)w$[e]=n,n*=.5}function mP(e){for(;0!=e.g.c&&0!=e.d.c;)Us(e.g).c>Us(e.d).c?(e.i+=e.g.c,iE(e.d)):Us(e.d).c>Us(e.g).c?(e.e+=e.d.c,iE(e.g)):(e.i+=lh(e.g),e.e+=lh(e.d),iE(e.g),iE(e.d))}function yP(e){var t,n,r,i;for(i=new Ka("["),t=!1,r=e.mb();r.G();)n=r.H(),t?i.a+=", ":t=!0,ol(i,n===e?"(this Collection)":(ci(),null==n?VM:cC(n)));return i.a+="]",i.a}function wP(e){var t,n,r,i;for(i=new Ka("{"),t=!1,r=e.bb().mb();r.G();)n=Kd(r.H(),21),t?i.a+=", ":t=!0,ol(i,Pv(e,n.yb())),i.a+="=",ol(i,Pv(e,n.zb()));return i.a+="}",i.a}function xP(e){var t;return Uu(!!e.g),t=e.g,e.g=t.e,t.e=e,t.j=e.j,t.a=e.a,e.a=1+zi(e.e)+zi(e.g),e.j=Nk(Nk(e.c,Hi(e.e)),Hi(e.g)),e.d=1+Ga(Bi(e.e),Bi(e.g)),t.d=1+Ga(Bi(t.e),Bi(t.g)),t}function kP(e){var t;return Uu(!!e.e),t=e.e,e.e=t.g,t.g=e,t.j=e.j,t.a=e.a,e.a=1+zi(e.e)+zi(e.g),e.j=Nk(Nk(e.c,Hi(e.e)),Hi(e.g)),e.d=1+Ga(Bi(e.e),Bi(e.g)),t.d=1+Ga(Bi(t.e),Bi(t.g)),t}function SP(e){var t;ms(new Qn(OC(e.e)))&&((t=Kd(NS(e.e,(OM(),vz)),28))==(NC(),Kz)?function(e){var t,n,r,i,a;for(t=e.e.j,r=new Qn(OC(e));r.a=KM?(t=55296+(e-KM>>10&1023)&XM,n=56320+(e-KM&1023)&XM,String.fromCharCode(t)+""+String.fromCharCode(n)):String.fromCharCode(e&XM)}function VP(e,t,n,r){var i;Ad(e.c,new Pg(e,n,r,Kd(ig(e.k,n),24).a)),Jp(r)&&(t==e.e?r.d.f!=e.a&&r.c.f!=e.a:r.d.f!=e.e&&r.c.f!=e.e)&&(i=n==r.c?r.d:r.c,Ad(e.c,new Pg(e,i,r,Kd(ig(e.k,i),24).a)))}function YP(e,t){var n,r,i;if(t===e)return!0;if(!vs(t,57))return!1;if(i=Kd(t,57),e.Y()!=i.Y())return!1;for(r=i.bb().mb();r.G();)if(n=Kd(r.H(),21),!e._(n))return!1;return!0}function WP(e,t){var n,r,i;return Uk(r=new FE(e),t),ly(r,(CM(),xq),t),ly(r,(OM(),vz),(NC(),Kz)),ly(r,DD,(_E(),ZA)),dr(r,(JC(),fF)),hb(n=new GC,r),qf(n,($R(),_B)),hb(i=new GC,r),qf(i,cB),r}function qP(e,t){var n,r,i;for(i=UM,r=new Qn(bS(t));r.a0&&XP(e,a,n));t.k=0}function QP(e,t){if(0>t)throw new ua("Top must be smaller or equal to bottom.");if(0>e)throw new ua("Left must be smaller or equal to right.");this.d=0,this.c=e,this.a=t,this.b=0}function ZP(e){var t,n,r;if(0==e.length)throw new ua(HL);for(n=0,r=e.length;n",new ua(r.a)}function e_(e){var t,n,r,i,a;for(t=0,i=0,a=(r=e.b).length;i1)throw new ua("In straight hyperEdges there may be only one edge.");Ld((i=new Yn(n.a).a.bb().mb(),r=Kd(new Wn(i).a.H(),21),Kd(r.yb(),12)).a,new nc(t,e.b))}function h_(e,t,n){var r,i;if(this.f=e,Hv(n,i=(r=Kd(ig(e.b,t),126))?r.a:0),n>=(i/2|0))for(this.e=r?r.c:null,this.d=i;n++0;)Yb(this);this.b=t,this.a=null}function p_(t,r){"undefined"===qM?n(r):((typeof document!==SN||"object"===BM&&e.exports)&&H$(t(r)),typeof document===SN&&typeof self!==SN&&self.postMessage(r))}function g_(e,t){var n,r,i,a;"x"in e.a&&(i=Kd(Ng(e,"x"),104),t.i.a=i.a),"y"in e.a&&(a=Kd(Ng(e,"y"),104),t.i.b=a.a),jN in e.a&&(r=Kd(Ng(e,jN),104),t.j.a=r.a),RN in e.a&&(n=Kd(Ng(e,RN),104),t.j.b=n.a)}function b_(e,t,n){var r;Mm(this),t==(yb(),eW)?Mp(this.g,e.c):Mp(this.o,e.c),Mp(n==eW?this.g:this.o,e.d),Mp(this.c,e),EE(this,qb(e.c).b,r=qb(e.d).b,r),this.f=function(e,t){return $C(),(e-t<=0?0-(e-t):e-t)<.2}(qb(e.c).b,qb(e.d).b)}function v_(e,t,n){var r,i,a,o,c;for($g(),c=new xy((o=new Za(Kd(wh(t.a,n),18))).b.Y()),i=new nr(o.b.mb());i.b.G();)r=Kd(i.b.H(),37),(a=Kd(ig(e.a,r),31))||(a=vM(r),Cg(e.a,r,a)),c.c[c.c.length]=a;return c}function m_(e){var t,n;if(Uc(Kd(Dx(e,(OM(),vz)),28)))for(n=new Qn(e.f);n.at&&r.$b(e[a-1],e[a])>0;--a)o=e[a],Up(e,a,e[a-1]),Up(e,a-1,o)}(t,n,r,a);else if(y_(t,e,c=n+i,u=c+((o=r+i)-c>>1),-i,a),y_(t,e,u,o,-i,a),a.$b(e[u-1],e[u])<=0)for(;n=r||t upperEndpoint (%s)",Fx(Ia(eA,1),hI,1,4,[t,n])))}((c=e.$b(n,a))<=0,n,a),0==c&&qu(r!=(Xl(),bA)|o!=bA))}function T_(e){if(this.a=e,e.c.f.g==(JC(),fF))this.c=e.c,this.d=Kd(Dx(e.c.f,(CM(),kq)),32);else{if(e.d.f.g!=fF)throw new ua("Edge "+e+" is not an external edge.");this.c=e.d,this.d=Kd(Dx(e.d.f,(CM(),kq)),32)}}function O_(){O_=a,lY=Ch(new yS,(EM(),UF)),fY=Eh(new yS,XF),dY=xh(Eh(new yS,hG),dG),uY=xh(Ch(Eh(new yS,GF),VF),YF),hY=Eh(new yS,xG),sY=xh(new yS,$F),oY=xh(Ch(Eh(Sh(new yS,JF),tG),rG),eG),cY=xh(Ch(new yS,rG),HF)}function j_(e,t,n){var r,i,a,o;return By(n,YI),0==n?qC(e,t):(qu(bf(e.b,t)),(o=e.c.a)?(a=Dm(L$,WI,26,1,12,1),r=KO(o,e.d,t,n,a),Gh(e.c,o,r),a[0]):(e.d.$b(t,t),i=new Hw(t,n),jf(e.a,i,e.a),Gh(e.c,null,i),0))}function R_(e,t,n){var r,i,a,o,c;for(r=0,c=n,t||(r=n*(e.c.length-1),c*=-1),a=new Qn(e);a.a0&&((!cc(e.b.d)||!r.q.d)&&(!uc(e.b.d)||!r.q.b)&&(r.j.e-=0>a/2-.5?0:a/2-.5),(!cc(e.b.d)||!r.q.a)&&(!uc(e.b.d)||!r.q.c)&&(r.j.b+=0>a-1?0:a-1))}(e,t,n),a=new At,i=new Qn(e.b.a.b);i.a0&&((!cc(e.b.d)||!r.q.d)&&(!uc(e.b.d)||!r.q.b)&&(r.j.e+=0>a/2-.5?0:a/2-.5),(!cc(e.b.d)||!r.q.a)&&(!uc(e.b.d)||!r.q.c)&&(r.j.b-=a-1))}(e,t,n)}function N_(e,t){var n,r,i,a;for(e.c[t.k]=!0,Ad(e.a,t),a=new Qn(t.f);a.a(o=c+oa(e.b[e.f[i.k].k]))?n:o;return n-r}function F_(e){var t;return uy(t=new Wi,"type",new Fh((Wf(DH),DH.n))),uy(t,EN,new Fh(e.f)),e.b&&uy(t,"value",e.b),e.a&&uy(t,"context",e.a),uy(t,CN,new Fh(Ts(new la("\n"),new Vn(new Zn((null==e.g&&(e.g=_h(e)),e.g)))))),t}function G_(e,t){var n,r,i,a,o;if(t===e)return!0;if(!vs(t,20))return!1;if(o=Kd(t,20),e.Y()!=o.Y())return!1;for(a=o.mb(),r=e.mb();r.G();)if(n=r.H(),i=a.H(),!(Zu(n)===Zu(i)||null!=n&&xk(n,i)))return!1;return!0}function V_(e){!MA&&(MA=function(){var e=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F"];return e[34]='\\"',e[92]="\\\\",e[173]="\\u00ad",e[1536]="\\u0600",e[1537]="\\u0601",e[1538]="\\u0602",e[1539]="\\u0603",e[1757]="\\u06dd",e[1807]="\\u070f",e[6068]="\\u17b4",e[6069]="\\u17b5",e[8203]="\\u200b",e[8204]="\\u200c",e[8205]="\\u200d",e[8206]="\\u200e",e[8207]="\\u200f",e[8232]="\\u2028",e[8233]="\\u2029",e[8234]="\\u202a",e[8235]="\\u202b",e[8236]="\\u202c",e[8237]="\\u202d",e[8238]="\\u202e",e[8288]="\\u2060",e[8289]="\\u2061",e[8290]="\\u2062",e[8291]="\\u2063",e[8292]="\\u2064",e[8298]="\\u206a",e[8299]="\\u206b",e[8300]="\\u206c",e[8301]="\\u206d",e[8302]="\\u206e",e[8303]="\\u206f",e[65279]="\\ufeff",e[65529]="\\ufff9",e[65530]="\\ufffa",e[65531]="\\ufffb",e}());var t=e.replace(/[\x00-\x1f\xad\u0600-\u0603\u06dd\u070f\u17b4\u17b5\u200b-\u200f\u2028-\u202e\u2060-\u2064\u206a-\u206f\ufeff\ufff9-\ufffb"\\]/g,(function(e){return function(e,t){var n=MA[e.charCodeAt(0)];return null==n?e:n}(e)}));return'"'+t+'"'}function Y_(e,t){var n,r,i,a,o;for(r=new Wn(new Yn((1==t?GH:FH).a).a.bb().mb());r.a.G();)for(i=Kd(r.a.H(),21),n=Kd(i.yb(),59),o=Kd(fP(e.f.c,n),18).mb();o.G();)a=Kd(o.H(),27),Xm(e.b.b,a.b),Xm(e.b.a,Kd(a.b,25).f)}function W_(e,t,n){var r,i,a,o;if(nE(n,"Recursive layout",2),0!=t.b.c.length){for(o=1/t.b.c.length,a=new Qn(t.b);a.a=2147483648&&(r-=4294967296),r)}function Q_(e,t,n){var r,i,a;if(t!=n){r=t;do{Df(e,r.d),(a=Kd(Dx(r,(CM(),Hq)),9))&&(Hs(e,(i=r.a).b,i.d),Df(e,a.i),r=ng(a))}while(a);r=n;do{zf(e,r.d),(a=Kd(Dx(r,(CM(),Hq)),9))&&(Fs(e,(i=r.a).b,i.d),zf(e,a.i),r=ng(a))}while(a)}}function Z_(e,t){var n,r,i,a,o;for(n=new At,o=new nu,i=new Wn(new Yn(e.a).a.bb().mb());i.a.G();)a=Kd(i.a.H(),21),WO(o,(r=Kd(a.yb(),12)).c,r,null),WO(o,r.d,r,null);for(;o.a;)Ad(n,sj(o,t,Ks(Kd(Dx(t,(OM(),vz)),28))));return n}function J_(e,t){var n,r,i,a,o;for(r=new Wn(new Yn((1==t?GH:FH).a).a.bb().mb());r.a.G();)for(i=Kd(r.a.H(),21),n=Kd(i.yb(),59),o=Kd(fP(e.f.c,n),18).mb();o.G();)a=Kd(o.H(),27),Ad(e.b.b,Kd(a.b,25)),Ad(e.b.a,Kd(a.b,25).f)}function eT(e){var t,n,r,i,a,o;for(Vd(),Ps(),n=new pm,r=new Qn(e.e.c);r.a0&&i0):i<0&&-i0)}function iT(e,t,n,r,i){var a,o;Nw(ix(Fx(Ia(WA,1),PN,10,0,[i.f.i,i.i,i.a])),n)||(t.c==i?qs(t.a,0,new Qu(n)):Ld(t.a,new Qu(n)),r&&!Po(e.a,n)&&((o=Kd(Dx(t,(OM(),ez)),44))||(o=new Hr,ly(t,ez,o)),Vv(o,a=new Qu(n),o.c.b,o.c),Mp(e.a,a)))}function aT(e){var t,n,r,i,a,o;for(t=0,n=new Qn(e.a);n.a((o=qb(r.d).b)-a<=0?0-(o-a):o-a)?t:o-a<=0?0-(o-a):o-a);return t}function oT(e,t){var n,r,i;if(Zu(t)===Zu(Hh(e)))return!0;if(!vs(t,20))return!1;if(r=Kd(t,20),(i=e.Y())!=r.Y())return!1;if(vs(r,63)){for(n=0;n=0)return r;for(i=1,a=new Qn(t.f);a.a(o=cT(e,c))+1?i:o+1);return function(e,t,n){var r,i;for(r=(i=e.a.c).c.length;ru-n&&c=e.g.d?((t=e.f).e=Pw(e.e,t),t.g=e.g,t.a=e.a-1,t.j=Ak(e.j,n),dP(t)):((t=e.i).g=_w(e.g,t),t.e=e.e,t.a=e.a-1,t.j=Ak(e.j,n),dP(t)):e.e:e.g}function dT(e){var t,n,r,i,a,o;for(i=new Qn(e.a);i.aa.k?qf(o,CB):o.g==CB&&a.k>r.k&&qf(o,uB))}function hT(e,t,n){var r,i,a,o,c,u;for(u=e.b,a=0,i=new Qn(e.a.b);i.a0)return mT(e,t,n.g);if(0!=r)return Nk(Nk(t.ac(n.g),t._b(n)),mT(e,t,n.e));switch(e.b.f.e){case 0:return Nk(t._b(n),t.ac(n.g));case 1:return t.ac(n.g);default:throw new Sr}}function yT(e,t,n){var r;if(!n)return 0;if((r=e.d.$b(e.b.e,n.b))<0)return yT(e,t,n.e);if(0!=r)return Nk(Nk(t.ac(n.e),t._b(n)),yT(e,t,n.g));switch(e.b.d.e){case 0:return Nk(t._b(n),t.ac(n.e));case 1:return t.ac(n.e);default:throw new Sr}}function wT(e,t,n,r){var i,a,o,c;return dr(o=new FE(e),(JC(),hF)),ly(o,(CM(),Lq),t),ly(o,(OM(),vz),(NC(),Kz)),ly(o,Rq,n),ly(o,Mq,r),qf(a=new GC,($R(),_B)),hb(a,o),qf(c=new GC,cB),hb(c,o),gb(t,a),Uk(i=new Gg,t),ly(i,ez,null),bb(i,c),gb(i,r),o}function xT(e,t){var n,r,i,a,o,c,u,l;for(n=0,o=0,c=(a=e.j).length;o.5&&i<50;)t=Oo(sP(n,r=IT(n),!0).a),++i;return sP(e,(Wh(a=Lf(kE(Ud(e.g),Ud(e.g).b-1))),a-r),!1)}(f);break;case 2:case 4:f.a=y,m=function(e){var t,n,r,i,a;for(n=$O(Vj(e)),t=dL,i=0,r=0;t>.5&&i<50;)t=Oo(sP(n,r=NT(n),!0).b),++i;return sP(e,(Wh(a=Lf(kE(Ud(e.g),Ud(e.g).b-1))),a-r),!1)}(f);break;default:return null}return hr(f,new ZP(Fx(Ia(WA,1),PN,10,0,[u,y,m,p,b]))),f}(e.a.c,t,e.a.d,r,XE(e.b),n),Tw(e.a.a,QS(c)),o=EP(e.a.b,c.a,e.b),ab(i=new Wv((!c.k&&(c.k=new DP(Ow(c))),c.k))),o?eg(i,o):i}function ST(e,t){var n,r,i;for(n=new Qn(e.b);n.an.a&&(a=Ga(a,o.a-n.a-1));return a}function PT(e){var t,n;switch(t=Kd(Dx(e,(OM(),az)),15).a,n=Kd(Dx(e,oz),15).a,ly(e,oz,new Fn(t)),ly(e,az,new Fn(n)),Kd(Dx(e,DD),103).e){case 1:ly(e,DD,(_E(),tD));break;case 2:ly(e,DD,(_E(),QA));break;case 3:ly(e,DD,(_E(),JA));break;case 4:ly(e,DD,(_E(),eD))}}function _T(e,t,n){var r,i,a;for(a=new Qn(e.e);a.a0&&(r.b.c-=r.c,r.b.c<=0&&r.b.f>0&&Ld(t,r.b));for(i=new Qn(e.b);i.a0&&(r.a.f-=r.c,r.a.f<=0&&r.a.c>0&&Ld(n,r.a))}function TT(e,t,n){var r,i,a;for(a=new Qn(e.j);a.a0&&(r.b.e-=r.c,r.b.e<=0&&r.b.k>0&&Ld(t,r.b));for(i=new Qn(e.d);i.a0&&(r.a.k-=r.c,r.a.k<=0&&r.a.e>0&&Ld(n,r.a))}function OT(e,t){switch(e.e){case 1:switch(t.e){case 1:return TL;case 4:return.5;case 3:return OL;case 2:return jL}break;case 2:switch(t.e){case 1:return TL;case 2:return.5;case 3:return OL;case 4:return jL}break;default:throw new ua(_L)}return 0}function jT(e,t){var n,r,i,a;for(Ll((a=new av(e,0)).b0),a.a.sb(a.c=--a.b),cd(a,i),Ll(a.b1)&&(++a,++o);return!Ks(Kd(Dx(n,(OM(),vz)),28))&&c&&(++a,++o),Cg(i,n,lS(a)),o}function IT(e){var t,n,r,i,a,o,c,u,l,s;for(l=(s=(c=Kd((o=e.b.mb()).H(),92)).a.a)>zL,u=szL)&&!u)return jw(c.b);if(i&&u||r&&l)return(t=a/(a-s))*jw(n.b)+(1-t)*jw(c.b)}return 0}function NT(e){var t,n,r,i,a,o,c,u,l,s;for(l=(s=(c=Kd((o=e.b.mb()).H(),92)).a.b)>zL,u=szL)&&!u)return jw(c.b);if(i&&u||r&&l)return(t=a/(a-s))*jw(n.b)+(1-t)*jw(c.b)}return 0}function LT(e,t,n){var r,i;return r=0,Jp(t)?Po(e.g,t)?(pT(e.i,lS(Bf(e,t.c)),1),pT(e.i,lS(Bf(e,t.d)),1),ws(e.g,t),r+=RE(e,t,e.i)):(Mp(e.g,t),j_(e.i,lS(Bf(e,t.c)),1),j_(e.i,lS(Bf(e,t.d)),1)):(i=qC(e.i,lS(Kd(ig(e.k,n),24).a)),r+=e.g.a.Y()-i),r}function AT(e){switch(e.e){case 0:return _Y;case 1:return PY;case 2:return SY;case 3:return kY;case 4:return OY;case 5:return TY;case 6:return UY;case 7:return qY;case 8:return CY;case 9:return EY;case 10:return YY;case 11:return jY;default:return WY}}function DT(e){switch(e.e){case 0:return TY;case 1:return UY;case 2:return qY;case 3:return _Y;case 4:return PY;case 5:return SY;case 6:return kY;case 7:return OY;case 8:return CY;case 9:return EY;case 10:return YY;case 11:return jY;default:return WY}}function zT(e){switch(e.e){case 0:return SY;case 1:return kY;case 2:return OY;case 3:return TY;case 4:return UY;case 5:return qY;case 6:return _Y;case 7:return PY;case 8:return CY;case 9:return EY;case 10:return YY;case 11:return jY;default:return WY}}function BT(e){var t;switch(t=e.a.f,e.b){case 0:return new Qn(e.a.f);case 1:return kp(new Bb(t),WC(e));case 2:switch(e.c.e){case 2:case 1:return kp(new Qn(t),WC(e));case 3:case 4:return kp(new Bb(t),WC(e))}}throw new _a("PortOrder not implemented.")}function HT(e,t){var n;e.d&&(t.c!=e.e.c||function(e,t){return Xw(),e==$H&&t==KH||e==$H&&t==XH||e==QH&&t==XH||e==QH&&t==KH}(e.e.b,t.b))&&(Ad(e.f,e.d),e.a=e.d.d+e.d.c,e.d=null,e.e=null),!function(e){return e==$H||e==KH}(t.b)?e.b=t:e.c=t,(t.b==(Xw(),$H)&&!t.a||t.b==KH&&t.a||t.b==XH&&t.a||t.b==QH&&!t.a)&&e.c&&e.b&&(n=new _g(e.a,e.c.d,t.c-e.a,e.b.d-e.c.d),e.d=n,e.e=t)}function FT(e,t,n,r){this.e=e,this.j=Kd(Dx(e,(CM(),Qq)),134),this.f=Dm(bF,NN,9,t,0,1),this.b=Dm(c$,HM,184,t,6,1),this.a=Dm(bF,NN,9,t,0,1),this.d=Dm(c$,HM,184,t,6,1),this.i=Dm(bF,NN,9,t,0,1),this.g=Dm(c$,HM,184,t,6,1),this.n=Dm(c$,HM,184,t,6,1),this.k=n,this.c=r}function GT(e){if(!e.a.c||!e.a.d)throw new Ea((Wf(rV),rV.j+" must have a source and target "+(Wf(iV),iV.j+" specified.")));if(e.a.c==e.a.d)throw new Ea("Network simplex does not support self-loops: "+e.a+" "+e.a.c+" "+e.a.d);return jp(e.a.c.g,e.a),jp(e.a.d.c,e.a),e.a}function VT(e,t,n,r,i){r==($R(),cB)&&i==cB?Jg(e,t)>Jg(e,n)?e.d=zE(e,n):e.b=zE(e,t):r==_B&&i==_B?Jg(e,t)Jg(e,n)&&(e.d=zE(e,n),e.b=zE(e,t)):Jg(e,t)0&&a>0?t++:r>0?n++:a>0?i++:n++}Rv(e.f,new Ae)}function WT(e,t,n,r){var i,a,o,c,u;n.d.f!=t.f&&(dr(i=new FE(e),(JC(),hF)),ly(i,(CM(),Lq),n),ly(i,(OM(),vz),(NC(),Kz)),r.c[r.c.length]=i,hb(o=new GC,i),qf(o,($R(),_B)),hb(c=new GC,i),qf(c,cB),u=n.d,gb(n,o),Uk(a=new Gg,n),ly(a,ez,null),bb(a,c),gb(a,u),A_(i,o,c))}function qT(e){var t,n,r,i,a,o,c;for(i=dL,o=dL,a=null,n=new gg(new lr(e.e));n.b!=n.c.a.b;)if(1==Kd((t=Zm(n)).d,60).c&&(r=Kd(t.e,116).a,c=Kd(t.e,116).b,(i-r>gL||r-igL)&&(o=Kd(t.e,116).b,i=Kd(t.e,116).a,a=Kd(t.d,60),0==o&&0==i)))return a;return a}function UT(e,t){var n,r,i,a,o,c;return a=e.d,(c=Kd(Dx(e,(OM(),Oz)),15).a)<0&&ly(e,Oz,new Fn(c=0)),t.j.b=c,o=Math.floor(c/2),qf(r=new GC,($R(),_B)),hb(r,t),r.i.b=o,qf(i=new GC,cB),hb(i,t),i.i.b=o,gb(e,r),Uk(n=new Gg,e),ly(n,ez,null),bb(n,i),gb(n,a),function(e,t,n){var r;(r=t.c.f).g==(JC(),hF)?(ly(e,(CM(),Rq),Kd(Dx(r,Rq),7)),ly(e,Mq,Kd(Dx(r,Mq),7))):(ly(e,(CM(),Rq),t.c),ly(e,Mq,n.d))}(t,e,n),function(e,t){var n,r;for(r=new av(e.b,0);r.bzL&&(this.b.ib(n),c=!1),this.b.ib(u);c&&this.b.ib(n)}function QT(e){var t,n,r,i;if(function(e,t){var n,r,i,a,o,c,u;for(i=Dm(L$,WI,26,e.e.a.c.length,12,1),o=new Qn(e.e.a);o.a0){for($a(e.c);B_(e,Kd(cv(new Qn(e.e.a)),61))0?n:0,r.i.b=n+ld(e.a,a,c)):r.i.b=(Wh(o),o)),u=ld(e.a,a,c),r.i.ba?0:a)a?0:a:c,(0>(ua?0:a)a?0:a:c)),a=u,u+=o,r=Kd(wh(e.c,i),9),(n=new _l(l)).j.b=t.j.b,M_(e.b,t,n),Ad(r.c,n);Xm(e.g.c,t),Ad(e.i,new Ic(e,t))}function uO(e,t,n){var r,i,a,o,c,u;for(t.k=1,i=t.d,u=IS(t,(gw(),dU)).mb();u.G();)for(r=new Qn(Kd(u.H(),7).e);r.af+c&&r.I();for(o=new Qn(d);o.agL||r-i