f)},St=function(e,t,n,r,i,o,a,s){var l=[];!function(e,t,n,r,i){var o,a,s,l,u,c,d,f;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),o=(a=(3*n-t*t)/9)*a*a+(s/=54)*s,i[1]=0,d=t/3,o>0?(u=(u=s+Math.sqrt(o))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(o))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===o?(f=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*f-d,i[4]=i[2]=-(f+d)):(l=(a=-a)*a*a,l=Math.acos(s/Math.sqrt(l)),f=2*Math.sqrt(a),i[0]=-d+f*Math.cos(l/3),i[2]=-d+f*Math.cos((l+2*Math.PI)/3),i[4]=-d+f*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*a+4*i*i-4*i*a+a*a+r*r-4*r*o+2*r*s+4*o*o-4*o*s+s*s,9*n*i-3*n*n-3*n*a-6*i*i+3*i*a+9*r*o-3*r*r-3*r*s-6*o*o+3*o*s,3*n*n-6*n*i+n*a-n*e+2*i*i+2*i*e-a*e+3*r*r-6*r*o+r*s-r*t+2*o*o+2*o*t-s*t,1*n*i-n*n+n*e-i*e+r*o-r*r+r*t-o*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,f,h,p=-1,v=0;v=0?hl?(e-i)*(e-i)+(t-o)*(t-o):u-d},Ct=function(e,t,n){for(var r,i,o,a,s=0,l=0;l=e&&e>=o||r<=e&&e<=o))continue;(e-r)/(o-r)*(a-i)+i>t&&s++}return s%2!=0},Tt=function(e,t,n,r,i,o,a,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,f=Math.cos(-u),h=Math.sin(-u),p=0;p0){var v=Dt(c,-l);d=jt(v)}else d=c;return Ct(e,t,d)},jt=function(e){for(var t,n,r,i,o,a,s,l,u=new Array(e.length/2),c=0;c=0&&p<=1&&m.push(p),v>=0&&v<=1&&m.push(v),0===m.length)return[];var g=m[0]*s[0]+e,y=m[0]*s[1]+t;return m.length>1?m[0]==m[1]?[g,y]:[g,y,m[1]*s[0]+e,m[1]*s[1]+t]:[g,y]},Mt=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Rt=function(e,t,n,r,i,o,a,s,l){var u=e-i,c=n-e,d=a-i,f=t-o,h=r-t,p=s-o,v=d*f-p*u,m=c*f-h*u,g=p*c-d*h;if(0!==g){var y=v/g,b=m/g,x=-.001;return x<=y&&y<=1.001&&x<=b&&b<=1.001||l?[e+y*c,t+y*h]:[]}return 0===v||0===m?Mt(e,n,a)===a?[a,s]:Mt(e,n,i)===i?[i,o]:Mt(i,a,n)===n?[n,r]:[]:[]},It=function(e,t,n,r,i,o,a,s){var l,u,c,d,f,h,p=[],v=new Array(n.length),m=!0;if(null==o&&(m=!1),m){for(var g=0;g0){var y=Dt(v,-s);u=jt(y)}else u=v}else u=n;for(var b=0;bu&&(u=t)},f=function(e){return l[e]},h=0;h0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var _=r(w);b=b.id(),h[b]>h[g]+_&&(h[b]=h[g]+_,p.nodes.indexOf(b)<0?p.push(b):p.updateItem(b),u[b]=0,l[b]=[]),h[b]==h[g]+_&&(u[b]=u[b]+u[g],l[b].push(g))}else for(var E=0;E0;){for(var P=n.pop(),C=0;C0&&a.push(n[s]);0!==a.length&&i.push(r.collection(a))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:un,a=r,s=0;s=2?vn(e,t,n,0,fn,hn):vn(e,t,n,0,dn)},squaredEuclidean:function(e,t,n){return vn(e,t,n,0,fn)},manhattan:function(e,t,n){return vn(e,t,n,0,dn)},max:function(e,t,n){return vn(e,t,n,-1/0,pn)}};function gn(e,t,n,r,i,o){var a;return a=T(e)?e:mn[e]||mn.euclidean,0===t&&T(e)?a(i,o):a(t,n,r,i,o)}mn["squared-euclidean"]=mn.squaredEuclidean,mn.squaredeuclidean=mn.squaredEuclidean;var yn=Ae({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),bn=function(e){return yn(e)},xn=function(e,t,n,r,i){var o="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},a=n,s=t;return gn(e,r.length,o,(function(e){return r[e](t)}),a,s)},wn=function(e,t,n){for(var r=n.length,i=new Array(r),o=new Array(r),a=new Array(t),s=null,l=0;ln)return!1}return!0},kn=function(e,t,n){for(var r=0;ri&&(i=t[l][u],o=u);a[o].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var h,p=t[a],v=t[r[a]];h="dendrogram"===i.mode?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=h,e.splice(v.index,1),t[p.key]=h;for(var m=0;mn[v.key][g.key]&&(o=n[v.key][g.key])):"max"===i.linkage?(o=n[p.key][g.key],n[p.key][g.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 o=0,a=e.length-1;a>=0;a--){var s=e[a];i?isFinite(s)||(e[a]=-1/0,o++):e.splice(a,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!=0?e[u+1+o]:(e[u-1+o]+e[u+o])/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,o=t;o1&&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;ia&&(o=l,a=t[i*e+l])}o>0&&r.push(o)}for(var u=0;u=S?(P=S,S=T,C=j):T>P&&(P=T);for(var D=0;D0?1:0;E[_%u.minIterations*t+B]=F,L+=F}if(L>0&&(_>=u.minIterations-1||_==u.maxIterations-1)){for(var z=0,V=0;V0&&r.push(i);return r}(t,o,a),W=function(e,t,n){for(var r=Un(e,t,n),i=0;il&&(s=u,l=c)}n[i]=o[s]}return Un(e,t,n)}(t,r,U),q={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},Xn=function(){var e=this,t={},n=0,r=[],i=[],o=e.spawn(e),a=function a(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||a(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),o=o.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||a(n)}})),{cut:o,components:r}},$n={};[Ue,qe,He,Xe,Ke,Qe,nt,qt,Yt,$t,Zt,ln,Dn,Fn,qn,{hierholzer:function(e){if(!D(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,o=Hn(e),a=o.root,s=o.directed,l=this,u=!1;a&&(i=C(a)?this.filter(a)[0].id():a[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),o=e.outdegree(!0),a=i-o,s=o-i;1==a?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||a>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var f={found:!1,trail:void 0};if(u)return f;if(r&&n)if(s){if(i&&r!=i)return f;i=r}else{if(i&&r!=i&&n!=i)return f;i||(i=r)}else i||(i=l[0].id());var h=function(e){for(var t,n,r,i=e,o=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),o.unshift(t),o.unshift(i);return o},p=[],v=[];for(v=h(i);1!=v.length;)0==c[v[0]].length?(p.unshift(l.getElementById(v.shift())),p.unshift(l.getElementById(v.shift()))):v=h(v.shift()).concat(v);for(var m in p.unshift(l.getElementById(v.shift())),c)if(c[m].length)return f;return f.found=!0,f.trail=this.spawn(p,!0),f}},{hopcroftTarjanBiconnected:Yn,htbc:Yn,htb:Yn,hopcroftTarjanBiconnectedComponents:Yn},{tarjanStronglyConnected:Xn,tsc:Xn,tscc:Xn,tarjanStronglyConnectedComponents:Xn}].forEach((function(e){Q($n,e)}));var Kn=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))};Kn.prototype={fulfill:function(e){return Zn(this,1,"fulfillValue",e)},reject:function(e){return Zn(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Kn;return n.onFulfilled.push(er(e,r,"fulfill")),n.onRejected.push(er(t,r,"reject")),Qn(n),r.proxy}};var Zn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Qn(e)),e},Qn=function(e){1===e.state?Jn(e,"onFulfilled",e.fulfillValue):2===e.state&&Jn(e,"onRejected",e.rejectReason)},Jn=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){j(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],o=0,a=n.length;o0&&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}};cr.className=cr.classNames=cr.classes;var dr={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+"};dr.variable="(?:[\\w-.]|(?:\\\\"+dr.metaChar+"))+",dr.className="(?:[\\w-]|(?:\\\\"+dr.metaChar+"))+",dr.value=dr.string+"|"+dr.number,dr.id=dr.variable,function(){var e,t,n;for(e=dr.comparatorOp.split("|"),n=0;n=0||"="!==t&&(dr.comparatorOp+="|\\!"+t)}();var fr=0,hr=1,pr=2,vr=3,mr=4,gr=5,yr=6,br=7,xr=8,wr=9,_r=10,Er=11,Nr=12,kr=13,Sr=14,Pr=15,Cr=16,Tr=17,jr=18,Dr=19,Or=20,Ar=[{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*Z(e,t)}(e.selector,t.selector)})),Mr=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return Ce("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Ce("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Ce("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 e??""},t=function(t){return C(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,o){var a=r.type,s=r.value;switch(a){case fr:var l=e(s);return l.substring(0,l.length-1);case vr:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case gr:var d=r.operator,f=r.field;return"["+e(d)+f+"]";case mr:return"["+r.field+"]";case yr:var h=r.operator;return"[["+r.field+n(e(h))+t(s)+"]]";case br:return s;case xr:return"#"+s;case wr:return"."+s;case Tr:case Pr:return i(r.parent,o)+n(">")+i(r.child,o);case jr:case Cr:return i(r.ancestor,o)+" "+i(r.descendant,o);case Dr:var p=i(r.left,o),v=i(r.subject,o),m=i(r.right,o);return p+(p.length>0?" ":"")+v+m;case Or:return""}},i=function(e,t){return e.checks.reduce((function(n,i,o){return n+(t===e&&0===o?"$":"")+r(i,t)}),"")},o="",a=0;a1&&a=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(a||l||u)&&(i=a||s?""+e:"",o=""+n),u&&(e=i=i.toLowerCase(),n=o=o.toLowerCase()),t){case"*=":r=i.indexOf(o)>=0;break;case"$=":r=i.indexOf(o,i.length-o.length)>=0;break;case"^=":r=0===i.indexOf(o);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),o.add(u.id()),a&&r(i,o,u)}return e}function ei(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1],ei)},Qr.forEachUp=function(e){return Jr(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ti)},Qr.forEachUpAndDown=function(e){return Jr(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],ni)},Qr.ancestors=Qr.parents,($r=Kr={data:lr.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:lr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:lr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:lr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:lr.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:lr.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=$r.data,$r.removeAttr=$r.removeData;var ri,ii,oi=Kr,ai={};function si(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],o=i._private.edges,a=0;at})),minIndegree:li("indegree",(function(e,t){return et})),minOutdegree:li("outdegree",(function(e,t){return et}))}),Q(ai,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var f=0;f0,m=v;v&&(p=p[0]);var g=m?p.position():{x:0,y:0};void 0!==t?h.position(e,t+g[e]):void 0!==i&&h.position({x:i.x+g.x,y:i.y+g.y})}}else if(!o)return;return this}},ri.modelPosition=ri.point=ri.position,ri.modelPositions=ri.points=ri.positions,ri.renderedPoint=ri.renderedPosition,ri.relativePoint=ri.relativePosition;var di,fi,hi=ii;di=fi={},fi.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),o=t.x1*r+i.x,a=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:o,x2:a,y1:s,y2:l,w:a-o,h:l-s}},fi.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},fi.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")}},o=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),a=t.position;0!==o.w&&0!==o.h||((o={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=a.x-o.w/2,o.x2=a.x+o.w/2,o.y1=a.y-o.h/2,o.y2=a.y+o.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=g(i.width.val-o.w,s,l),f=d.biasDiff,h=d.biasComplementDiff,p=g(i.height.val-o.h,u,c),v=p.biasDiff,m=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}}(o.w,o.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(o.w,i.width.val),a.x=(-f+o.x1+o.x2+h)/2,t.autoHeight=Math.max(o.h,i.height.val),a.y=(-v+o.y1+o.y2+m)/2}function g(e,t,n){var r=0,i=0,o=t+n;return e>0&&o>0&&(r=t/o*e,i=n/o*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)},mi=function(e,t){return null==t?e:vi(e,t.x1,t.y1,t.x2,t.y2)},gi=function(e,t,n){return Ie(e,t,n)},yi=function(e,t,n){if(!t.cy().headless()){var r,i,o=t._private,a=o.rstyle,s=a.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=a.srcX,i=a.srcY):"target"===n?(r=a.tgtX,i=a.tgtY):(r=a.midX,i=a.midY);var l=o.arrowBounds=o.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,gt(u,1),vi(e,u.x1,u.y1,u.x2,u.y2)}}},bi=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,o=i.rstyle;if(t.pstyle(r+"label").strValue){var a,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),f=gi(o,"labelWidth",n),h=gi(o,"labelHeight",n),p=gi(o,"labelX",n),v=gi(o,"labelY",n),m=t.pstyle(r+"text-margin-x").pfValue,g=t.pstyle(r+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,_=t.pstyle("text-background-padding").pfValue,E=h,N=f,k=N/2,S=E/2;if(y)a=p-k,s=p+k,l=v-S,u=v+S;else{switch(c.value){case"left":a=p-N,s=p;break;case"center":a=p-k,s=p+k;break;case"right":a=p,s=p+N}switch(d.value){case"top":l=v-E,u=v;break;case"center":l=v-S,u=v+S;break;case"bottom":l=v,u=v+E}}a+=m-Math.max(x,w)-_-2,s+=m+Math.max(x,w)+_+2,l+=g-Math.max(x,w)-_-2,u+=g+Math.max(x,w)+_+2;var P=n||"main",C=i.labelBounds,T=C[P]=C[P]||{};T.x1=a,T.y1=l,T.x2=s,T.y2=u,T.w=s-a,T.h=u-l;var j=y&&"autorotate"===b.strValue,D=null!=b.pfValue&&0!==b.pfValue;if(j||D){var O=j?gi(i.rstyle,"labelAngle",n):b.pfValue,A=Math.cos(O),M=Math.sin(O),R=(a+s)/2,I=(l+u)/2;if(!y){switch(c.value){case"left":R=s;break;case"right":R=a}switch(d.value){case"top":I=u;break;case"bottom":I=l}}var L=function(e,t){return{x:(e-=R)*A-(t-=I)*M+R,y:e*M+t*A+I}},B=L(a,l),F=L(a,u),z=L(s,l),V=L(s,u);a=Math.min(B.x,F.x,z.x,V.x),s=Math.max(B.x,F.x,z.x,V.x),l=Math.min(B.y,F.y,z.y,V.y),u=Math.max(B.y,F.y,z.y,V.y)}var G=P+"Rot",U=C[G]=C[G]||{};U.x1=a,U.y1=l,U.x2=s,U.y2=u,U.w=s-a,U.h=u-l,vi(e,a,l,s,u),vi(i.labelBounds.all,a,l,s,u)}return e}},xi=function(e){var t=0,n=function(e){return(e?1:0)<(r=C[1].x)){var T=n;n=r,r=T}if(i>(o=C[1].y)){var j=i;i=o,o=j}vi(f,n-E,i-E,r+E,o+E)}}else if("bezier"===P||"unbundled-bezier"===P||"segments"===P||"taxi"===P){var D;switch(P){case"bezier":case"unbundled-bezier":D=m.bezierPts;break;case"segments":case"taxi":D=m.linePts}if(null!=D)for(var O=0;O(r=R.x)){var I=n;n=r,r=I}if((i=M.y)>(o=R.y)){var L=i;i=o,o=L}vi(f,n-=E,i-=E,r+=E,o+=E)}if(c&&t.includeEdges&&v&&(yi(f,e,"mid-source"),yi(f,e,"mid-target"),yi(f,e,"source"),yi(f,e,"target")),c&&"yes"===e.pstyle("ghost").value){var B=e.pstyle("ghost-offset-x").pfValue,F=e.pstyle("ghost-offset-y").pfValue;vi(f,f.x1+B,f.y1+F,f.x2+B,f.y2+F)}var z=h.bodyBounds=h.bodyBounds||{};bt(z,f),yt(z,g),gt(z,1),c&&(n=f.x1,r=f.x2,i=f.y1,o=f.y2,vi(f,n-_,i-_,r+_,o+_));var V=h.overlayBounds=h.overlayBounds||{};bt(V,f),yt(V,g),gt(V,1);var G=h.labelBounds=h.labelBounds||{};null!=G.all?((l=G.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):G.all=vt(),c&&t.includeLabels&&(t.includeMainLabels&&bi(f,e,null),v&&(t.includeSourceLabels&&bi(f,e,"source"),t.includeTargetLabels&&bi(f,e,"target")))}return f.x1=pi(f.x1),f.y1=pi(f.y1),f.x2=pi(f.x2),f.y2=pi(f.y2),f.w=pi(f.x2-f.x1),f.h=pi(f.y2-f.y1),f.w>0&&f.h>0&&b&&(yt(f,g),gt(f,1)),f}(e,Ei),r.bbCache=n,r.bbCachePosKey=a):n=r.bbCache,!o){var c=e.isNode();n=vt(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?mi(n,r.overlayBounds):mi(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?mi(n,r.labelBounds.all):(t.includeMainLabels&&mi(n,r.labelBounds.mainRot),t.includeSourceLabels&&mi(n,r.labelBounds.sourceRot),t.includeTargetLabels&&mi(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Ei={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,useCache:!0},Ni=xi(Ei),ki=Ae(Ei);fi.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=vt();var n=ki(e=e||Ei),r=this;if(r.cy().styleEnabled())for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:zi,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)a(s);return this},Gi.removeAllListeners=function(){return this.removeListener("*")},Gi.emit=Gi.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,j(t)||(t=[t]),qi(this,(function(e,o){null!=n&&(r=[{event:o.event,type:o.type,namespace:o.namespace,callback:n}],i=r.length);for(var a=function(n){var i=r[n];if(i.type===o.type&&(!i.namespace||i.namespace===o.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,o)){var a=[o];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,o=this[i],a=o._private.data.id;this[i]=void 0,this[e]=o,n.set(a,{ele:o,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&&C(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=s,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,o=0;o=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(D(e)){var i=e;r.applyBypass(this,i,false),this.emitAndNotify("style")}else if(C(e)){if(void 0===t){var o=this[0];return o?r.getStylePropertyValue(o,e):void 0}r.applyBypass(this,e,t,false),this.emitAndNotify("style")}else if(void 0===e){var a=this[0];return a?r.getRawStyle(a):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(c[0]),t.push(s[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)}}),go.neighbourhood=go.neighborhood,go.closedNeighbourhood=go.closedNeighborhood,go.openNeighbourhood=go.openNeighborhood,Q(go,{source:Zr((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Zr((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:wo({attr:"source"}),targets:wo({attr:"target"})}),Q(go,{edgesWith:Zr(_o(),"edgesWith"),edgesTo:Zr(_o({thisIsSrc:!0}),"edgesTo")}),Q(go,{connectedEdges:Zr((function(e){for(var t=[],n=0;n0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),go.componentsOf=go.components;var No=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new Be,o=!1;if(t){if(t.length>0&&D(t[0])&&!R(t[0])){o=!0;for(var a=[],s=new ze,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,o=i.cy(),a=o._private,s=[],l=[],u=0,c=i.length;u0){for(var I=e.length===i.length?i:new No(o,e),L=0;L0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},o=n._private.cy;function a(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),function(e){for(var t=e._private.edges,n=0;n0&&(e?E.emitAndNotify("remove"):t&&E.emit("remove"));for(var N=0;N=.001?function(t,r){for(var o=0;o0?i=l:r=l}while(Math.abs(s)>o&&++ud&&Math.abs(s.v)>d;);return o?function(e){return u[e*(u.length-1)|0]}:c}}(),To=function(e,t,n,r){var i=Po(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},jo={linear:function(e,t,n){return e+(t-e)*n},ease:To(.25,.1,.25,1),"ease-in":To(.42,0,1,1),"ease-out":To(0,0,.58,1),"ease-in-out":To(.42,0,.58,1),"ease-in-sine":To(.47,0,.745,.715),"ease-out-sine":To(.39,.575,.565,1),"ease-in-out-sine":To(.445,.05,.55,.95),"ease-in-quad":To(.55,.085,.68,.53),"ease-out-quad":To(.25,.46,.45,.94),"ease-in-out-quad":To(.455,.03,.515,.955),"ease-in-cubic":To(.55,.055,.675,.19),"ease-out-cubic":To(.215,.61,.355,1),"ease-in-out-cubic":To(.645,.045,.355,1),"ease-in-quart":To(.895,.03,.685,.22),"ease-out-quart":To(.165,.84,.44,1),"ease-in-out-quart":To(.77,0,.175,1),"ease-in-quint":To(.755,.05,.855,.06),"ease-out-quint":To(.23,1,.32,1),"ease-in-out-quint":To(.86,0,.07,1),"ease-in-expo":To(.95,.05,.795,.035),"ease-out-expo":To(.19,1,.22,1),"ease-in-out-expo":To(1,0,0,1),"ease-in-circ":To(.6,.04,.98,.335),"ease-out-circ":To(.075,.82,.165,1),"ease-in-out-circ":To(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return jo.linear;var r=Co(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":To};function Do(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var o=i(t,n,r);return null==e||((e.roundValue||e.color)&&(o=Math.round(o)),void 0!==e.min&&(o=Math.max(o,e.min)),void 0!==e.max&&(o=Math.min(o,e.max))),o}function Oo(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function Ao(e,t,n,r,i){var o=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var a=Oo(e,i),s=Oo(t,i);if(O(a)&&O(s))return Do(o,a,s,n,r);if(j(a)&&j(s)){for(var l=[],u=0;u0?("spring"===d&&f.push(a.duration),a.easingImpl=jo[d].apply(null,f)):a.easingImpl=jo[d]}var h,p=a.easingImpl;if(h=0===a.duration?1:(n-l)/a.duration,a.applying&&(h=a.progress),h<0?h=0:h>1&&(h=1),null==a.delay){var v=a.startPosition,m=a.position;if(m&&i&&!e.locked()){var g={};Ro(v.x,m.x)&&(g.x=Ao(v.x,m.x,h,p)),Ro(v.y,m.y)&&(g.y=Ao(v.y,m.y,h,p)),e.position(g)}var y=a.startPan,b=a.pan,x=o.pan,w=null!=b&&r;w&&(Ro(y.x,b.x)&&(x.x=Ao(y.x,b.x,h,p)),Ro(y.y,b.y)&&(x.y=Ao(y.y,b.y,h,p)),e.emit("pan"));var _=a.startZoom,E=a.zoom,N=null!=E&&r;N&&(Ro(_,E)&&(o.zoom=pt(o.minZoom,Ao(_,E,h,p),o.maxZoom)),e.emit("zoom")),(w||N)&&e.emit("viewport");var k=a.style;if(k&&k.length>0&&i){for(var S=0;S=0;t--){(0,e[t])()}e.splice(0,e.length)},c=o.length-1;c>=0;c--){var d=o[c],f=d._private;f.stopped?(o.splice(c,1),f.hooked=!1,f.playing=!1,f.started=!1,u(f.frames)):(f.playing||f.applying)&&(f.playing&&f.applying&&(f.applying=!1),f.started||Io(0,d,e),Mo(t,d,e,n),f.applying&&(f.applying=!1),u(f.frames),null!=f.step&&f.step(e),d.completed()&&(o.splice(c,1),f.hooked=!1,f.playing=!1,f.started=!1,u(f.completes)),s=!0)}return n||0!==o.length||0!==a.length||r.push(t),s}for(var o=!1,a=0;a0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Bo={animate:lr.animate(),animation:lr.animation(),animated:lr.animated(),clearQueue:lr.clearQueue(),delay:lr.delay(),delayAnimation:lr.delayAnimation(),stop:lr.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){Lo(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&ae((function(n){Lo(n,e),t()}))}()}}},Fo={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&&R(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}},zo=function(e){return C(e)?new Hr(e):e},Vo={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Vi(Fo,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,zo(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,zo(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,zo(t),n),this},once:function(e,t,n){return this.emitter().one(e,zo(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}};lr.eventAliasesOn(Vo);var Go={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)}};Go.jpeg=Go.jpg;var Uo={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=C(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var o=new r(Q({},e,{cy:t,eles:i}));return o}Se("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Se("A `name` must be specified to make a layout");else Se("Layout options must be specified to make a layout")}};Uo.createLayout=Uo.makeLayout=Uo.layout;var Wo={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)}};Ho.invalidateDimensions=Ho.resize;var Yo={collection:function(e,t){return C(e)?this.$(e):M(e)?e.collection():j(e)?(t||(t={}),new No(this,e,t.unique,t.removed)):new No(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}};Yo.elements=Yo.filter=Yo.$;var Xo={},$o="t";Xo.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(f||d&&h){var p=void 0;f&&h||f?p=u.properties:h&&(p=u.mappedProperties);for(var v=0;v1&&(m=1),s.color){var w=i.valueMin[0],_=i.valueMax[0],E=i.valueMin[1],N=i.valueMax[1],k=i.valueMin[2],S=i.valueMax[2],P=null==i.valueMin[3]?1:i.valueMin[3],C=null==i.valueMax[3]?1:i.valueMax[3],T=[Math.round(w+(_-w)*m),Math.round(E+(N-E)*m),Math.round(k+(S-k)*m),Math.round(P+(C-P)*m)];n={bypass:i.bypass,name:i.name,value:T,strValue:"rgb("+T[0]+", "+T[1]+", "+T[2]+")"}}else{if(!s.number)return!1;var j=i.valueMin+(i.valueMax-i.valueMin)*m;n=this.parse(i.name,j,i.bypass,f)}if(!n)return v(),!1;n.mapping=i,i=n;break;case a.data:for(var D=i.field.split("."),A=d.data,M=0;M0&&o>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(a).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:o,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)},Xo.checkTrigger=function(e,t,n,r,i,o){var a=this.properties[t],s=i(a);null!=s&&s(n,r)&&o(a)},Xo.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)}))},Xo.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||("curve-style"!==t||"bezier"!==n&&"bezier"!==r)&&("display"!==t||"none"!==n&&"none"!==r)||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Xo.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ko={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var o=0;ot.length?o.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(o.match(/^\s*$/))break;var l=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){Ce("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=l[0];var u=l[1];if("core"!==u)if(new Hr(u).invalid){Ce("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),a();continue}var c=l[2],d=!1;n=c;for(var f=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){Ce("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=h[0];var p=h[1],v=h[2];if(this.properties[p])i.parse(p,v)?(f.push({name:p,val:v}),s()):(Ce("Skipping property: Invalid property definition in: "+r),s());else Ce("Skipping property: Invalid property name in: "+r),s()}if(d){a();break}i.selector(u);for(var m=0;m=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var f=s.data;return{name:e,value:u,strValue:""+t,mapped:f,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var h=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var v=this.parse(e,c[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return Ce("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var m=p.value,g=v.value;if(!(m[0]!==g[0]||m[1]!==g[1]||m[2]!==g[2]||m[3]!==g[3]&&(null!=m[3]&&1!==m[3]||null!=g[3]&&1!==g[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:h,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var y;if(y=l?t.split(/\s+/):j(t)?t:[t],d.evenMultiple&&y.length%2!=0)return null;for(var b=[],x=[],w=[],_="",E=!1,N=0;N0?" ":"")+k.strValue}return d.validate&&!d.validate(b,x)?null:d.singleEnum&&E?1===b.length&&C(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:_,bypass:n,units:x}}var S,P,D=function(){for(var r=0;rd.max||d.strictMax&&t===d.max))return null;var L={name:e,value:t,strValue:""+t+(A||""),units:A,bypass:n};return d.unitless||"px"!==A&&"em"!==A?L.pfValue=t:L.pfValue="px"!==A&&A?this.getEmSizeInPixels()*t:t,"ms"!==A&&"s"!==A||(L.pfValue="ms"===A?t:1e3*t),"deg"!==A&&"rad"!==A||(L.pfValue="rad"===A?t:(S=t,Math.PI*S/180)),"%"===A&&(L.pfValue=t/100),L}if(d.propList){var B=[],F=""+t;if("none"===F);else{for(var z=F.split(/\s*,\s*|\s+/),V=0;V0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:a=(a=(a=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:a)=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,o=r.zoom,a=!1;if(r.zoomingEnabled||(a=!0),O(e)?n=e:D(e)&&(n=e.level,null!=e.position?t=rt(e.position,o,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(a=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;O(l.x)&&(t.pan.x=l.x,a=!1),O(l.y)&&(t.pan.y=l.y,a=!1),a||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(C(e)){var n=e;e=this.mutableElements().filter(n)}else M(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),o=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(o-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,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=w.getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("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}};aa.centre=aa.center,aa.autolockNodes=aa.autolock,aa.autoungrabifyNodes=aa.autoungrabify;var sa={data:lr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:lr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:lr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:lr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};sa.attr=sa.data,sa.removeAttr=sa.removeData;var la=function(e){var t=this,n=(e=Q({},e)).container;n&&!A(n)&&A(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 o=void 0!==w&&void 0!==n&&!e.headless,a=e;a.layout=Q({name:o?"grid":"null"},a.layout),a.renderer=Q({name:o?"canvas":"null"},a.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:a,elements:new No(this),listeners:[],aniEles:new No(this),data:a.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,a.zoomingEnabled),userZoomingEnabled:s(!0,a.userZoomingEnabled),panningEnabled:s(!0,a.panningEnabled),userPanningEnabled:s(!0,a.userPanningEnabled),boxSelectionEnabled:s(!0,a.boxSelectionEnabled),autolock:s(!1,a.autolock,a.autolockNodes),autoungrabify:s(!1,a.autoungrabify,a.autoungrabifyNodes),autounselectify:s(!1,a.autounselectify),styleEnabled:void 0===a.styleEnabled?o:a.styleEnabled,zoom:O(a.zoom)?a.zoom:1,pan:{x:D(a.pan)&&O(a.pan.x)?a.pan.x:0,y:D(a.pan)&&O(a.pan.y)?a.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,a.multiClickDebounceTime)};this.createEmitter(),this.selectionType(a.selectionType),this.zoomRange({min:a.minZoom,max:a.maxZoom});l.styleEnabled&&t.setStyle([]);var u=Q({},a,a.renderer);t.initRenderer(u);!function(e,t){if(e.some(z))return nr.all(e).then(t);t(e)}([a.style,a.elements],(function(e){var n=e[0],o=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(D(e)||j(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 o=Q({},t._private.options.layout);o.eles=t.elements(),t.layout(o).run()}(o,(function(){t.startAnimationLoop(),l.ready=!0,T(a.ready)&&t.on("ready",a.ready);for(var e=0;e0,u=vt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(M(n.roots))e=n.roots;else if(j(n.roots)){for(var c=[],d=0;d0;){var D=S.shift(),O=k(D,P);if(O)D.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(T);else if(null===O){Ce("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}N();var A=0;if(n.avoidOverlap)for(var R=0;R0&&g[0].length<=3?l/2:0),d=2*Math.PI/g[r].length*i;return 0===r&&1===g[0].length&&(c=1),{x:Y+c*Math.cos(d),y:X+c*Math.sin(d)}}return{x:Y+(i+1-(o+1)/2)*a,y:(r+1)*s}})),this};var pa={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 va(e){this.options=Q({},pa,e)}va.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,o=r.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var a,s=vt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/o.length:t.sweep)/Math.max(1,o.length-1),d=0,f=0;f1&&t.avoidOverlap){d*=1.75;var m=Math.cos(c)-Math.cos(0),g=Math.sin(c)-Math.sin(0),y=Math.sqrt(d*d/(m*m+g*g));a=Math.max(y,a)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),o=a*Math.cos(r),s=a*Math.sin(r);return{x:l+o,y:u+s}})),this};var ma,ga={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 ya(e){this.options=Q({},ga,e)}ya.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,o=i.nodes().not(":parent"),a=vt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=a.x1+a.w/2,l=a.y1+a.h/2,u=[],c=0,d=0;d0)Math.abs(y[0].value-x.value)>=m&&(y=[],g.push(y));y.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var _=g.length>0&&g[0].length>1,E=(Math.min(a.w,a.h)/2-w)/(g.length+_?1:0);w=Math.min(w,E)}for(var N=0,k=0;k1&&t.avoidOverlap){var T=Math.cos(C)-Math.cos(0),j=Math.sin(C)-Math.sin(0),D=Math.sqrt(w*w/(T*T+j*j));N=Math.max(D,N)}S.r=N,N+=w}if(t.equidistant){for(var O=0,A=0,M=0;M=e.numIter)&&(Pa(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&o(),ae(t)):(Fa(r,e),s())}()}else{for(;u;)u=a(l),l++;Fa(r,e),s()}return this},xa.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},xa.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var wa=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:vt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},a=n.eles.components(),s={},l=0;l0){o.graphSet.push(x);for(l=0;lr.count?0:r.graph},Ea=function e(t,n,r,i){var o=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*a)*i/(v=Math.sqrt(i*i+o*o)),l=u*o/v;else{var u,c=Oa(e,i,o),d=Oa(t,-1*i,-1*o),f=d.x-c.x,h=d.y-c.y,p=f*f+h*h,v=Math.sqrt(p);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/p)*f/v,l=u*h/v}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Da=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var o=e.maxY-t.minY;else o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},Oa=function(e,t,n){var r=e.positionX,i=e.positionY,o=e.height||1,a=e.width||1,s=n/t,l=o/a,u={};return 0===t&&0n?(u.x=r,u.y=i+o/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-a/2,u.y=i-a*n/2/t,u):0=l)?(u.x=r+o*t/2/n,u.y=i+o/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-o*t/2/n,u.y=i-o/2,u):u},Aa=function(e,t){for(var n=0;n1){var p=t.gravity*d/h,v=t.gravity*f/h;c.offsetX+=p,c.offsetY+=v}}}}},Ra=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 o=n[r++],a=e.idToIndex[o],s=e.layoutNodes[a],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},Ba=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],o=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,o=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,o=!0),(null==i.minY||t.minY-i.padTopp&&(d+=h+t.componentSpacing,c=0,f=0,h=0)}}},za={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 Va(e){this.options=Q({},za,e)}Va.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 o=vt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===o.h||0===o.w)r.nodes().layoutPositions(this,t,(function(e){return{x:o.x1,y:o.y1}}));else{var a=i.size(),s=Math.sqrt(a*o.h/o.w),l=Math.round(s),u=Math.round(o.w/o.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},f=t.rows,h=null!=t.cols?t.cols:t.columns;if(null!=f&&null!=h)l=f,u=h;else if(null!=f&&null==h)l=f,u=Math.ceil(a/l);else if(null==f&&null!=h)u=h,l=Math.ceil(a/u);else if(u*l>a){var p=c(),v=d();(p-1)*v>=a?c(p-1):(v-1)*p>=a&&d(v-1)}else for(;u*l=a?d(g+1):c(m+1)}var y=o.w/u,b=o.h/l;if(t.condense&&(y=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(D=0,j++)},A={},M=0;M(r=Pt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return m(n,r),!0}else if("bezier"===o.edgeType||"multibezier"===o.edgeType||"self"===o.edgeType||"compound"===o.edgeType)for(x=o.allpts,w=0;w+5(r=St(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return m(n,r),!0;y=y||i.source,b=b||i.target;var _=a.getArrowWidth(l,c),E=[{name:"source",x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:"target",x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:"mid-source",x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:"mid-target",x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}];for(w=0;w0&&(g(y),g(b))}function b(e,t,n){return Ie(e,t,n)}function x(n,r){var i,o=n._private,a=p;i=r?r+"-":"",n.boundingBox();var s=o.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(o.rscratch,"labelX",r),c=b(o.rscratch,"labelY",r),d=b(o.rscratch,"labelAngle",r),f=n.pstyle(i+"text-margin-x").pfValue,h=n.pstyle(i+"text-margin-y").pfValue,v=s.x1-a-f,g=s.x2+a-f,y=s.y1-a-h,x=s.y2+a-h;if(d){var w=Math.cos(d),_=Math.sin(d),E=function(e,t){return{x:(e-=u)*w-(t-=c)*_+u,y:e*_+t*w+c}},N=E(v,y),k=E(v,x),S=E(g,y),P=E(g,x),C=[N.x+f,N.y+h,S.x+f,S.y+h,P.x+f,P.y+h,k.x+f,k.y+h];if(Ct(e,t,C))return m(n),!0}else if(wt(s,e,t))return m(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var _=l[w];_.isNode()?g(_)||x(_):y(_)||x(_)||x(_,"source")||x(_,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,o,a=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),f=vt({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),h=0;h0?Math.max(e-t,0):Math.min(e+t,0)},P=S(N,_),C=S(k,E),T=!1;"auto"===m?v=Math.abs(P)>Math.abs(C)?i:r:m===l||m===s?(v=r,T=!0):m!==o&&m!==a||(v=i,T=!0);var j,D=v===r,O=D?C:P,A=D?k:N,M=lt(A),R=!1;(T&&(y||x)||!(m===s&&A<0||m===l&&A>0||m===o&&A>0||m===a&&A<0)||(O=(M*=-1)*Math.abs(O),R=!0),y)?j=(b<0?1+b:b)*O:j=(b<0?O:0)+b*M;var I=function(e){return Math.abs(e)=Math.abs(O)},L=I(j),B=I(Math.abs(O)-Math.abs(j));if((L||B)&&!R)if(D){var F=Math.abs(A)<=d/2,z=Math.abs(N)<=f/2;if(F){var V=(u.x1+u.x2)/2,G=u.y1,U=u.y2;n.segpts=[V,G,V,U]}else if(z){var W=(u.y1+u.y2)/2,q=u.x1,H=u.x2;n.segpts=[q,W,H,W]}else n.segpts=[u.x1,u.y2]}else{var Y=Math.abs(A)<=c/2,X=Math.abs(k)<=h/2;if(Y){var $=(u.y1+u.y2)/2,K=u.x1,Z=u.x2;n.segpts=[K,$,Z,$]}else if(X){var Q=(u.x1+u.x2)/2,J=u.y1,ee=u.y2;n.segpts=[Q,J,Q,ee]}else n.segpts=[u.x2,u.y1]}else if(D){var te=u.y1+j+(p?d/2*M:0),ne=u.x1,re=u.x2;n.segpts=[ne,te,re,te]}else{var ie=u.x1+j+(p?c/2*M:0),oe=u.y1,ae=u.y2;n.segpts=[ie,oe,ie,ae]}},ts.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,o=t.srcW,a=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=!O(n.startX)||!O(n.startY),f=!O(n.arrowStartX)||!O(n.arrowStartY),h=!O(n.endX)||!O(n.endY),p=!O(n.arrowEndX)||!O(n.arrowEndY),v=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),m=ut({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),g=mf.poolIndex()){var h=d;d=f,f=h}var p=s.srcPos=d.position(),v=s.tgtPos=f.position(),m=s.srcW=d.outerWidth(),g=s.srcH=d.outerHeight(),y=s.tgtW=f.outerWidth(),b=s.tgtH=f.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(d)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(f)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var _=0;_0){var G=u,U=ct(G,ot(t)),W=ct(G,ot(V)),q=U;if(W2)ct(G,{x:V[2],y:V[3]})0){var ie=c,oe=ct(ie,ot(t)),ae=ct(ie,ot(re)),se=oe;if(ae2)ct(ie,{x:re[2],y:re[3]})=u||y){c={cp:v,segment:g};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-f)/x.length,_=x.t1-x.t0,E=s?x.t0+_*w:x.t1-_*w;E=pt(0,E,1),t=ht(b.p0,b.p1,b.p2,E),i=function(e,t,n,r){var i=pt(0,r-.001,1),o=pt(0,r+.001,1),a=ht(e,t,n,i),s=ht(e,t,n,o);return ls(a,s)}(b.p0,b.p1,b.p2,E);break;case"straight":case"segments":case"haystack":for(var N,k,S,P,C=0,T=r.allpts.length,j=0;j+3=u));j+=2);var D=(u-k)/N;D=pt(0,D,1),t=function(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=ut(e,t),s=i/a,l=o/a;return n=n??0,r=null!=r?r:n*a,{x:e.x+s*r,y:e.y+l*r}}(S,P,D),i=ls(S,P)}a("labelX",n,t.x),a("labelY",n,t.y),a("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},as.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},as.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,a=e.pstyle("text-wrap").strValue,s=Ie(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==a?1:Math.max(s.length,1),u=i.height/l,c=u*o,d=i.width,f=i.height+(l-1)*(o-1)*u;Le(n.rstyle,"labelWidth",t,d),Le(n.rscratch,"labelWidth",t,d),Le(n.rstyle,"labelHeight",t,f),Le(n.rscratch,"labelHeight",t,f),Le(n.rscratch,"labelLineHeight",t,c)},as.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,a=function(e,r){return r?(Le(n.rscratch,e,t,r),r):Ie(n.rscratch,e,t)};if(!i)return"";"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=a("labelKey");if(null!=l&&a("labelWrapKey")===l)return a("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,f=[],h=/[\s\u200b]+/,p=d?"":" ",v=0;vc){for(var b=m.split(h),x="",w=0;wN)break;k+=i[P],P===i.length-1&&(S=!0)}return S||(k+="\u2026"),k}return i},as.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"}},as.calculateLabelDimensions=function(e,t){var n=ve(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var o=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue,s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!u){u=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=u.getContext("2d");var d=u.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}c.font="".concat(o," ").concat(l," ").concat(a,"px ").concat(s);for(var f=0,h=0,p=t.split("\n"),v=0;v1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var S=r(t);m&&(e.hoverData.tapholdCancelled=!0);o=!0,n(v,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var P=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||a.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(m){var C={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};y?y.emit(C):a.emit(C),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=v,v&&v.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(o=!0,a.panningEnabled()&&a.userPanningEnabled()){var T;if(e.hoverData.justStartedPan){var j=e.hoverData.mdownPos;T={x:(c[0]-j[0])*s,y:(c[1]-j[1])*s},e.hoverData.justStartedPan=!1}else T={x:b[0]*s,y:b[1]*s};a.panBy(T),a.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=y&&!y.pannable()){if(y&&y.pannable()&&y.active()&&y.unactivate(),y&&y.grabbed()||v==g||(g&&n(g,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),v&&n(v,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=v),y)if(m){if(a.boxSelectionEnabled()&&S)y&&y.grabbed()&&(d(x),y.emit("freeon"),x.emit("free"),e.dragData.didDrag&&(y.emit("dragfreeon"),x.emit("dragfree"))),P();else if(y&&y.grabbed()&&e.nodeIsDraggable(y)){var D=!e.dragData.didDrag;D&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||l(x,{inDragLayer:!0});var A={x:0,y:0};if(O(b[0])&&O(b[1])&&(A.x+=b[0],A.y+=b[1],D)){var M=e.hoverData.dragDelta;M&&O(M[0])&&O(M[1])&&(A.x+=M[0],A.y+=M[1])}e.hoverData.draggingEles=!0,x.silentShift(A).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();o=!0}else if(m){if(e.hoverData.dragging||!a.boxSelectionEnabled()||!S&&a.panningEnabled()&&a.userPanningEnabled()){if(!e.hoverData.selecting&&a.panningEnabled()&&a.userPanningEnabled()){i(y,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=ot(f),e.redrawHint("select",!0),e.redraw())}}else P();y&&y.pannable()&&y.active()&&y.unactivate()}return p[2]=c[0],p[3]=c[1],o?(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 o=e.cy,a=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,l=e.findNearestElement(a[0],a[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,f=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var h={originalEvent:i,type:"cxttapend",position:{x:a[0],y:a[1]}};if(c?c.emit(h):o.emit(h),!e.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:a[0],y:a[1]}};c?c.emit(p):o.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(l,["mouseup","tapend","vmouseup"],i,{x:a[0],y:a[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(n(c,["click","tap","vclick"],i,{x:a[0],y:a[1]}),b=!1,i.timeStamp-x<=o.multiClickDebounceTime()?(y&&clearTimeout(y),b=!0,x=null,n(c,["dblclick","dbltap","vdblclick"],i,{x:a[0],y:a[1]})):(y=setTimeout((function(){b||n(c,["oneclick","onetap","voneclick"],i,{x:a[0],y:a[1]})}),o.multiClickDebounceTime()),x=i.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(o.$(t).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=o.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===o.selectionType()||f?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):f||(o.$(t).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var v=o.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),v.length>0&&e.redrawHint("eles",!0),o.emit({type:"boxend",originalEvent:i,position:{x:a[0],y:a[1]}});var m=function(e){return e.selectable()&&!e.selected()};"additive"===o.selectionType()||f||o.$(t).unmerge(v).unselect(),v.emit("box").stdFilter(m).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var g=c&&c.grabbed();d(u),g&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[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 _,E,N,k,S,P,C,T,j,D,A,M,R,I=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),o=e.projectIntoViewport(t.clientX,t.clientY),a=[o[0]*r+i.x,o[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 s;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),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:a[0],y:a[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",I,!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||I(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 L,B,F,z,V,G,U,W=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},q=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",L=function(t){if(e.hasTouchStarted=!0,w(t)){h(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,o=e.touchData.earlier;if(t.touches[0]){var s=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=s[0],i[1]=s[1]}if(t.touches[1]){s=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=s[0],i[3]=s[1]}if(t.touches[2]){s=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=s[0],i[5]=s[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var u=e.findContainerClientCoords();j=u[0],D=u[1],A=u[2],M=u[3],_=t.touches[0].clientX-j,E=t.touches[0].clientY-D,N=t.touches[1].clientX-j,k=t.touches[1].clientY-D,R=0<=_&&_<=A&&0<=N&&N<=A&&0<=E&&E<=M&&0<=k&&k<=M;var f=r.pan(),p=r.zoom();S=W(_,E,N,k),P=q(_,E,N,k),T=[((C=[(_+N)/2,(E+k)/2])[0]-f.x)/p,(C[1]-f.y)/p];if(P<4e4&&!t.touches[2]){var v=e.findNearestElement(i[0],i[1],!0,!0),m=e.findNearestElement(i[2],i[3],!0,!0);return v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):m&&m.isNode()?(m.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=m):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 g=e.findNearestElements(i[0],i[1],!0,!0),y=g[0];if(null!=y&&(y.activate(),e.touchData.start=y,e.touchData.starts=g,e.nodeIsGrabbable(y))){var b=e.dragData.touchDragEles=r.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),y.selected()?(x=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),l(x,{addToList:b})):c(y,{addToList:b}),a(y);var O=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};y.emit(O("grabon")),x?x.forEach((function(e){e.emit(O("grab"))})):y.emit(O("grab"))}n(y,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==y&&(e.data.bgActivePosistion={x:s[0],y:s[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 I=e.touchData.startPosition=[],L=0;L=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-j,C=t.touches[0].clientY-D,A=t.touches[1].clientX-j,M=t.touches[1].clientY-D,I=q(x,C,A,M);if(I/P>=2.25||I>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var L={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(L),e.touchData.start=null):a.emit(L)}}if(r&&e.touchData.cxt){L={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(L):a.emit(L),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var B=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&B===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=B,B&&B.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,o[4]=1,o&&0!==o.length&&void 0!==o[0]?(o[2]=(s[0]+s[2]+s[4])/3,o[3]=(s[1]+s[3]+s[5])/3):(o[0]=(s[0]+s[2]+s[4])/3,o[1]=(s[1]+s[3]+s[5])/3,o[2]=(s[0]+s[2]+s[4])/3+1,o[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var F=0;F0&&!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",F=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",z=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var o=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var a,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(r.touches[0]){var f=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);u[0]=f[0],u[1]=f[1]}if(r.touches[1]){f=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);u[2]=f[0],u[3]=f[1]}if(r.touches[2]){f=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);u[4]=f[0],u[5]=f[1]}if(i&&i.unactivate(),e.touchData.cxt){if(a={originalEvent:r,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(a):s.emit(a),!e.touchData.cxtDragged){var h={originalEvent:r,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(h):s.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]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=s.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));o[0]=void 0,o[1]=void 0,o[2]=void 0,o[3]=void 0,o[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:u[0],y:u[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 v=e.dragData.touchDragEles;if(null!=i){var m=i._private.grabbed;d(v),e.redrawHint("drag",!0),e.redrawHint("eles",!0),m&&(i.emit("freeon"),v.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),v.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var g=e.findNearestElement(u[0],u[1],!0,!0);n(g,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]})}var y=e.touchData.startPosition[0]-u[0],b=y*y,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:u[0],y:u[1]}),V=!1,r.timeStamp-U<=s.multiClickDebounceTime()?(G&&clearTimeout(G),V=!0,U=null,n(i,["dbltap","vdblclick"],r,{x:u[0],y:u[1]})):(G=setTimeout((function(){V||n(i,["onetap","voneclick"],r,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),U=r.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var C=[u[0],u[1]],T=Math.pow(C[0]-e,2)+Math.pow(C[1]-t,2),j=1;j0)return v[0]}return null},f=Object.keys(c),h=0;h0?l:Et(i,o,e,t,n,r,a)},checkPoint:function(e,t,n,r,i,o,a){var s=Vt(r,i),l=2*s;if(Tt(e,t,this.points,o,a,r,i-l,[0,-1],n))return!0;if(Tt(e,t,this.points,o,a,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Ct(e,t,[o-u,a-c,o-u,a,o+u,a,o+u,a-c])||(!!Ot(e,t,l,l,o+r/2-s,a+i/2-s,n)||!!Ot(e,t,l,l,o-r/2+s,a+i/2-s,n))}}},ms.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Bt(3,0)),this.generateRoundPolygon("round-triangle",Bt(3,0)),this.generatePolygon("rectangle",Bt(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",Bt(5,0)),this.generateRoundPolygon("round-pentagon",Bt(5,0)),this.generatePolygon("hexagon",Bt(6,0)),this.generateRoundPolygon("round-hexagon",Bt(6,0)),this.generatePolygon("heptagon",Bt(7,0)),this.generateRoundPolygon("round-heptagon",Bt(7,0)),this.generatePolygon("octagon",Bt(8,0)),this.generateRoundPolygon("round-octagon",Bt(8,0));var r=new Array(20),i=zt(5,0),o=zt(5,Math.PI/5),a=.5*(3-Math.sqrt(5));a*=1.57;for(var s=0;s=e.deqFastCost*v)break}else if(i){if(h>=e.deqCost*l||h>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*ws)break;var m=e.deq(t,d,c);if(!(m.length>0))break;for(var g=0;g0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},Es=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ee;v(this,e),this.idsByKey=new Be,this.keyForId=new Be,this.cachesByLvl=new Be,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return g(e,[{key:"getIdsFor",value:function(e){null==e&&Se("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new ze,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 Be,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}(),Ns={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ks=Ae({getKey:null,doesEleInvalidateKey:Ee,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:_e,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ss=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=ks(t);Q(n,r),n.lookup=new Es(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Ps=Ss.prototype;Ps.reasons=Ns,Ps.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Ps.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Ps.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new c.default((function(e,t){return t.reqs-e.reqs}))},Ps.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Ps.getElement=function(e,t,n,r,i){var o=this,a=this.renderer,s=a.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!o.allowEdgeTxrCaching&&e.isEdge()||!o.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(st(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,f=a.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,f))return null;var h,p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(h=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var v=o.getTextureQueue(h),m=v[v.length-2],g=function(){return o.recycleTexture(h,d)||o.addTexture(h,d)};m||(m=v[v.length-1]),m||(m=g()),m.width-m.usedWidthr;P--)k=o.getElement(e,t,n,P,Ns.downscale);S()}else{var C;if(!x&&!w&&!_)for(var T=r-1;T>=-4;T--){var j=l.get(e,T);if(j){C=j;break}}if(b(C))return o.queueElement(e,r),C;m.context.translate(m.usedWidth,0),m.context.scale(u,u),this.drawElement(m.context,e,t,f,!1),m.context.scale(1/u,1/u),m.context.translate(-m.usedWidth,0)}return p={x:m.usedWidth,texture:m,level:r,scale:u,width:d,height:c,scaledLabelShown:f},m.usedWidth+=Math.ceil(d+8),m.eleCaches.push(p),l.set(e,r,p),o.checkTextureFullness(m),p},Ps.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Ps.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Me(t,e):e.fullnessChecks++},Ps.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Me(n,e),e.retired=!0;for(var i=e.eleCaches,o=0;o=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Re(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Me(r,o),n.push(o),o}},Ps.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),o=r[i];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,n.updateItem(o);else{var a={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(a),r[i]=a}},Ps.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],o=t.lookup,a=0;a<1&&n.size()>0;a++){var s=n.pop(),l=s.key,u=s.eles[0],c=o.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,Ns.dequeue)}}return i},Ps.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=we,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Ps.onDequeue=function(e){this.onDequeues.push(e)},Ps.offDequeue=function(e){Me(this.onDequeues,e)},Ps.setupDequeueing=_s({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 a,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var o=c.length-1;o>=0;o--){var a=c[o];a.invalid&&Me(c,a)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!a){a=vt();for(var t=0;t16e6)return null;var o=r.makeLayer(a,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,o)}else(void 0===t.insert||t.insert)&&c.unshift(o);return o};if(r.skipping&&!o)return null;for(var f=null,h=e.length/1,p=!o,v=0;v=h||!_t(f.bb,m.boundingBox()))&&!(f=d({insert:!0,after:f})))return null;s||p?r.queueLayer(f,m):r.drawEleInLayer(f,m,n,t),f.eles.push(m),y[n]=f}}return s||(p?null:c)},Ts.getEleLevelForLayerLevel=function(e,t){return e},Ts.drawEleInLayer=function(e,t,n,r){var i=this.renderer,o=e.context,a=t.boundingBox();0!==a.w&&0!==a.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(o,!1),i.drawCachedElement(o,t,null,null,n,true),i.setImgSmoothing(o,!0))},Ts.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(o.invalid)return!1;r+=o.eles.length}return r===t.length},Ts.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Ts.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=se(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Ts.invalidateLayer=function(e){if(this.lastInvalidationTime=se(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Me(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],o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],a=this,s=t._private.rscratch;if((!o||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,f=t.pstyle("line-style").value,h=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,v=u*c,m=u*c,g=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;"straight-triangle"===d?(a.eleStrokeStyle(e,t,n),a.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=h,e.lineCap=p,a.eleStrokeStyle(e,t,n),a.drawEdgePath(t,e,s.allpts,f),e.lineCap="butt")},y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;a.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var b=t.pstyle("ghost-offset-x").pfValue,x=t.pstyle("ghost-offset-y").pfValue,w=t.pstyle("ghost-opacity").value,_=v*w;e.translate(b,x),g(_),y(_),e.translate(-b,-x)}i&&a.drawEdgeUnderlay(e,t),g(),y(),i&&a.drawEdgeOverlay(e,t),a.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},Ys=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,o=i.usePaths(),a=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==a.edgeType||o?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,a.allpts,"solid")}}}};Hs.drawEdgeOverlay=Ys("overlay"),Hs.drawEdgeUnderlay=Ys("underlay"),Hs.drawEdgePath=function(e,t,n,r){var i,o=e._private.rscratch,a=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");o.pathCacheKey&&o.pathCacheKey===d?(i=t=o.pathCache,s=!0):(i=t=new Path2D,o.pathCacheKey=d,o.pathCache=i)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=c;break;case"solid":a.setLineDash([])}if(!s&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var f=2;f+35&&void 0!==arguments[5])||arguments[5],a=this;if(null==r){if(o&&!a.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=a.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),f=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!f||!f.value))return;e.textAlign="center",e.textBaseline="bottom"}var h,p=!n;n&&(h=n,e.translate(-h.x1,-h.y1)),null==i?(a.drawText(e,t,null,p,o),t.isEdge()&&(a.drawText(e,t,"source",p,o),a.drawText(e,t,"target",p,o))):a.drawText(e,t,i,p,o),n&&e.translate(h.x1,h.y1)},$s.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",o=t.pstyle("font-family").strValue,a=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+a+" "+i+" "+o,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},$s.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),o=Ie(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?o:0:"none"===i.strValue?0:i.pfValue},$s.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],o=t._private.rscratch,a=i?t.effectiveOpacity():1;if(!i||0!==a&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Ie(o,"labelX",n),c=Ie(o,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,i);var f,h=n?n+"-":"",p=Ie(o,"labelWidth",n),v=Ie(o,"labelHeight",n),m=t.pstyle(h+"text-margin-x").pfValue,g=t.pstyle(h+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(y&&(b="center",x="center"),u+=m,c+=g,0!==(f=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(f),u=0,c=0),x){case"top":break;case"center":c+=v/2;break;case"bottom":c+=v}var w=t.pstyle("text-background-opacity").value,_=t.pstyle("text-border-opacity").value,E=t.pstyle("text-border-width").pfValue,N=t.pstyle("text-background-padding").pfValue;if(w>0||E>0&&_>0){var k=u-N;switch(b){case"left":k-=p;break;case"center":k-=p/2}var S=c-v-N,P=p+2*N,C=v+2*N;if(w>0){var T=e.fillStyle,j=t.pstyle("text-background-color").value;e.fillStyle="rgba("+j[0]+","+j[1]+","+j[2]+","+w*a+")",0===t.pstyle("text-background-shape").strValue.indexOf("round")?function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),e.fill()}(e,k,S,P,C,2):e.fillRect(k,S,P,C),e.fillStyle=T}if(E>0&&_>0){var D=e.strokeStyle,O=e.lineWidth,A=t.pstyle("text-border-color").value,M=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+_*a+")",e.lineWidth=E,e.setLineDash)switch(M){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(k,S,P,C),"double"===M){var R=E/2;e.strokeRect(k+R,S+R,P-2*R,C-2*R)}e.setLineDash&&e.setLineDash([]),e.lineWidth=O,e.strokeStyle=D}}var I=2*t.pstyle("text-outline-width").pfValue;if(I>0&&(e.lineWidth=I),"wrap"===t.pstyle("text-wrap").value){var L=Ie(o,"labelWrapCachedLines",n),B=Ie(o,"labelLineHeight",n),F=p/2,z=this.getLabelJustification(t);switch("auto"===z||("left"===b?"left"===z?u+=-p:"center"===z&&(u+=-F):"center"===b?"left"===z?u+=-F:"right"===z&&(u+=F):"right"===b&&("center"===z?u+=F:"right"===z&&(u+=p))),x){case"top":case"center":case"bottom":c-=(L.length-1)*B}for(var V=0;V0&&e.strokeText(L[V],u,c),e.fillText(L[V],u,c),c+=B}else I>0&&e.strokeText(d,u,c),e.fillText(d,u,c);0!==f&&(e.rotate(-f),e.translate(-s,-l))}}};var Ks={drawNode:function(e,t,n){var r,i,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(O(d.x)&&O(d.y)&&(!s||t.visible())){var f,h,p=s?t.effectiveOpacity():1,v=l.usePaths(),m=!1,g=t.padding();r=t.width()+2*g,i=t.height()+2*g,n&&(h=n,e.translate(-h.x1,-h.y1));for(var y=t.pstyle("background-image").value,b=new Array(y.length),x=new Array(y.length),w=0,_=0;_0&&void 0!==arguments[0]?arguments[0]:P;l.eleFillStyle(e,t,n)},A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j;l.colorStrokeStyle(e,C[0],C[1],C[2],t)},M=t.pstyle("shape").strValue,R=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(d.x,d.y);var I=l.nodePathCache=l.nodePathCache||[],L=me("polygon"===M?M+","+R.join(","):M,""+i,""+r),B=I[L];null!=B?(f=B,m=!0,c.pathCache=f):(f=new Path2D,I[L]=c.pathCache=f)}var F=function(){if(!m){var n=d;v&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(f||e,n.x,n.y,r,i)}v?e.fill(f):e.fill()},z=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=u.backgrounding,o=0,a=0;a0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;l.hasPie(t)&&(l.drawPie(e,t,o),n&&(v||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i)))},G=function(){var t=(k>0?k:-k)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:p),n=k>0?0:255;0!==k&&(l.colorFillStyle(e,n,n,n,t),v?e.fill(f):e.fill())},U=function(){if(S>0){if(e.lineWidth=S,e.lineCap="butt",e.setLineDash)switch(T){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(v?e.stroke(f):e.stroke(),"double"===T){e.lineWidth=S/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(f):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var W=t.pstyle("ghost-offset-x").pfValue,q=t.pstyle("ghost-offset-y").pfValue,H=t.pstyle("ghost-opacity").value,Y=H*p;e.translate(W,q),D(H*P),F(),z(Y,!0),A(H*j),U(),V(0!==k||0!==S),z(Y,!1),G(Y),e.translate(-W,-q)}v&&e.translate(-d.x,-d.y),a&&l.drawNodeUnderlay(e,t,d,r,i),v&&e.translate(d.x,d.y),D(),F(),z(p,!0),A(),U(),V(0!==k||0!==S),z(p,!1),G(),v&&e.translate(-d.x,-d.y),l.drawElementText(e,t,null,o),a&&l.drawNodeOverlay(e,t,d,r,i),n&&e.translate(h.x1,h.y1)}}},Zs=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,o){if(n.visible()){var a=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,u=n.pstyle("".concat(e,"-shape")).value;if(s>0){if(r=r||n.position(),null==i||null==o){var c=n.padding();i=n.width()+2*c,o=n.height()+2*c}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*a,o+2*a),t.fill()}}}};Ks.drawNodeOverlay=Zs("overlay"),Ks.drawNodeUnderlay=Zs("underlay"),Ks.hasPie=function(e){return(e=e[0])._private.hasPie},Ks.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),o=t.pstyle("pie-size"),a=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(a=0,s=0),"%"===o.units?c*=o.pfValue:void 0!==o.pfValue&&(c=o.pfValue/2);for(var f=1;f<=i.pieBackgroundN;f++){var h=t.pstyle("pie-"+f+"-background-size").value,p=t.pstyle("pie-"+f+"-background-color").value,v=t.pstyle("pie-"+f+"-background-opacity").value*n,m=h/100;m+d>1&&(m=1-d);var g=1.5*Math.PI+2*Math.PI*d,y=g+2*Math.PI*m;0===h||d>=1||d+m>1||(e.beginPath(),e.moveTo(a,s),e.arc(a,s,c,g,y),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],v),e.fill(),d+=m)}};var Qs={};Qs.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},Qs.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;ia.minMbLowQualFrames&&(a.motionBlurPxRatio=a.mbPxRBlurry)),a.clearingMotionBlur&&(a.motionBlurPxRatio=1),a.textureDrawLastFrame&&!d&&(c[a.NODE]=!0,c[a.SELECT_BOX]=!0);var y=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),_={x:w.x,y:w.y},E={zoom:b,pan:{x:w.x,y:w.y}},N=a.prevViewport;void 0===N||E.zoom!==N.zoom||E.pan.x!==N.pan.x||E.pan.y!==N.pan.y||v&&!p||(a.motionBlurPxRatio=1),o&&(_=o),x*=s,_.x*=s,_.y*=s;var k=a.getCachedZSortedEles();function S(e,t,n,r,i){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",a.colorFillStyle(e,255,255,255,a.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=o}function P(e,r){var s,l,c,d;a.clearingMotionBlur||e!==u.bufferContexts[a.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[a.MOTIONBLUR_BUFFER_DRAG]?(s=_,l=x,c=a.canvasWidth,d=a.canvasHeight):(s={x:w.x*h,y:w.y*h},l=b*h,c=a.canvasWidth*h,d=a.canvasHeight*h),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?S(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),o&&e.translate(o.x,o.y),i&&e.scale(i,i)}if(d||(a.textureDrawLastFrame=!1),d){if(a.textureDrawLastFrame=!0,!a.textureCache){a.textureCache={},a.textureCache.bb=l.mutableElements().boundingBox(),a.textureCache.texture=a.data.bufferCanvases[a.TEXTURE_BUFFER];var C=a.data.bufferContexts[a.TEXTURE_BUFFER];C.setTransform(1,0,0,1,0,0),C.clearRect(0,0,a.canvasWidth*a.textureMult,a.canvasHeight*a.textureMult),a.render({forcedContext:C,drawOnlyNodeLayer:!0,forcedPxRatio:s*a.textureMult}),(E=a.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:a.canvasWidth,height:a.canvasHeight}).mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}c[a.DRAG]=!1,c[a.NODE]=!1;var T=u.contexts[a.NODE],j=a.textureCache.texture;E=a.textureCache.viewport;T.setTransform(1,0,0,1,0,0),f?S(T,0,0,E.width,E.height):T.clearRect(0,0,E.width,E.height);var D=y.core("outside-texture-bg-color").value,O=y.core("outside-texture-bg-opacity").value;a.colorFillStyle(T,D[0],D[1],D[2],O),T.fillRect(0,0,E.width,E.height);b=l.zoom();P(T,!1),T.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/s,E.height/E.zoom/s),T.drawImage(j,E.mpan.x,E.mpan.y,E.width/E.zoom/s,E.height/E.zoom/s)}else a.textureOnViewport&&!t&&(a.textureCache=null);var A=l.extent(),M=a.pinching||a.hoverData.dragging||a.swipePanning||a.data.wheelZooming||a.hoverData.draggingEles||a.cy.animated(),R=a.hideEdgesOnViewport&&M,I=[];if(I[a.NODE]=!c[a.NODE]&&f&&!a.clearedForMotionBlur[a.NODE]||a.clearingMotionBlur,I[a.NODE]&&(a.clearedForMotionBlur[a.NODE]=!0),I[a.DRAG]=!c[a.DRAG]&&f&&!a.clearedForMotionBlur[a.DRAG]||a.clearingMotionBlur,I[a.DRAG]&&(a.clearedForMotionBlur[a.DRAG]=!0),c[a.NODE]||n||r||I[a.NODE]){var L=f&&!I[a.NODE]&&1!==h;P(T=t||(L?a.data.bufferContexts[a.MOTIONBLUR_BUFFER_NODE]:u.contexts[a.NODE]),f&&!L?"motionBlur":void 0),R?a.drawCachedNodes(T,k.nondrag,s,A):a.drawLayeredElements(T,k.nondrag,s,A),a.debug&&a.drawDebugPoints(T,k.nondrag),n||f||(c[a.NODE]=!1)}if(!r&&(c[a.DRAG]||n||I[a.DRAG])){L=f&&!I[a.DRAG]&&1!==h;P(T=t||(L?a.data.bufferContexts[a.MOTIONBLUR_BUFFER_DRAG]:u.contexts[a.DRAG]),f&&!L?"motionBlur":void 0),R?a.drawCachedNodes(T,k.drag,s,A):a.drawCachedElements(T,k.drag,s,A),a.debug&&a.drawDebugPoints(T,k.drag),n||f||(c[a.DRAG]=!1)}if(a.showFps||!r&&c[a.SELECT_BOX]&&!n){if(P(T=t||u.contexts[a.SELECT_BOX]),1==a.selection[4]&&(a.hoverData.selecting||a.touchData.selecting)){b=a.cy.zoom();var B=y.core("selection-box-border-width").value/b;T.lineWidth=B,T.fillStyle="rgba("+y.core("selection-box-color").value[0]+","+y.core("selection-box-color").value[1]+","+y.core("selection-box-color").value[2]+","+y.core("selection-box-opacity").value+")",T.fillRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]),B>0&&(T.strokeStyle="rgba("+y.core("selection-box-border-color").value[0]+","+y.core("selection-box-border-color").value[1]+","+y.core("selection-box-border-color").value[2]+","+y.core("selection-box-opacity").value+")",T.strokeRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]))}if(u.bgActivePosistion&&!a.hoverData.selecting){b=a.cy.zoom();var F=u.bgActivePosistion;T.fillStyle="rgba("+y.core("active-bg-color").value[0]+","+y.core("active-bg-color").value[1]+","+y.core("active-bg-color").value[2]+","+y.core("active-bg-opacity").value+")",T.beginPath(),T.arc(F.x,F.y,y.core("active-bg-size").pfValue/b,0,2*Math.PI),T.fill()}var z=a.lastRedrawTime;if(a.showFps&&z){z=Math.round(z);var V=Math.round(1e3/z);T.setTransform(1,0,0,1,0,0),T.fillStyle="rgba(255, 0, 0, 0.75)",T.strokeStyle="rgba(255, 0, 0, 0.75)",T.lineWidth=1,T.fillText("1 frame = "+z+" ms = "+V+" fps",0,20);T.strokeRect(0,30,250,20),T.fillRect(0,30,250*Math.min(V/60,1),20)}n||(c[a.SELECT_BOX]=!1)}if(f&&1!==h){var G=u.contexts[a.NODE],U=a.data.bufferCanvases[a.MOTIONBLUR_BUFFER_NODE],W=u.contexts[a.DRAG],q=a.data.bufferCanvases[a.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!g?e.clearRect(0,0,a.canvasWidth,a.canvasHeight):S(e,0,0,a.canvasWidth,a.canvasHeight);var r=h;e.drawImage(t,0,0,a.canvasWidth*r,a.canvasHeight*r,0,0,a.canvasWidth,a.canvasHeight)};(c[a.NODE]||I[a.NODE])&&(H(G,U,I[a.NODE]),c[a.NODE]=!1),(c[a.DRAG]||I[a.DRAG])&&(H(W,q,I[a.DRAG]),c[a.DRAG]=!1)}a.prevViewport=E,a.clearingMotionBlur&&(a.clearingMotionBlur=!1,a.motionBlurCleared=!0,a.motionBlur=!0),f&&(a.motionBlurTimeout=setTimeout((function(){a.motionBlurTimeout=null,a.clearedForMotionBlur[a.NODE]=!1,a.clearedForMotionBlur[a.DRAG]=!1,a.motionBlur=!1,a.clearingMotionBlur=!d,a.mbFrames=0,c[a.NODE]=!0,c[a.DRAG]=!0,a.redraw()}),100)),t||l.emit("render")};for(var Js={drawPolygonPath:function(e,t,n,r,i,o){var a=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+a*o[0],n+s*o[1]);for(var l=1;l0&&o>0){f.clearRect(0,0,i,o),f.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*l,-n.y1*l),f.scale(l,l),this.drawElements(f,h),f.scale(1/l,1/l),f.translate(n.x1*l,n.y1*l);else{var p=t.pan(),v={x:p.x*l,y:p.y*l};l*=t.zoom(),f.translate(v.x,v.y),f.scale(l,l),this.drawElements(f,h),f.scale(1/l,1/l),f.translate(-v.x,-v.y)}e.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=e.bg,f.rect(0,0,i,o),f.fill())}return d},al.png=function(e){return ll(e,this.bufferCanvasImage(e),"image/png")},al.jpg=function(e){return ll(e,this.bufferCanvasImage(e),"image/jpeg")};var ul={nodeShapeImpl:function(e,t,n,r,i,o,a){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,o);case"polygon":return this.drawPolygonPath(t,n,r,i,o,a);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,o,a);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,o);case"barrel":return this.drawBarrelPath(t,n,r,i,o)}}},cl=fl,dl=fl.prototype;function fl(e){var t=this;t.data={canvases:new Array(dl.CANVAS_LAYERS),contexts:new Array(dl.CANVAS_LAYERS),canvasNeedsRedraw:new Array(dl.CANVAS_LAYERS),bufferCanvases:new Array(dl.BUFFER_COUNT),bufferContexts:new Array(dl.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 o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[n]=r;var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};_&&_.userAgent.match(/msie|trident|edge/i)&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var s=0;s{e.exports={graphlib:n(21943),layout:n(75499),debug:n(55856),util:{time:n(30345).time,notime:n(30345).notime},version:n(93404)}},55205:(e,t,n)=>{"use strict";var r=n(32692),i=n(50824);e.exports={run:function(e){var t="greedy"===e.graph().acyclicer?i(e,function(e){return function(t){return e.edge(t).weight}}(e)):function(e){var t=[],n={},i={};function o(a){r.has(i,a)||(i[a]=!0,n[a]=!0,r.forEach(e.outEdges(a),(function(e){r.has(n,e.w)?t.push(e):o(e.w)})),delete n[a])}return r.forEach(e.nodes(),o),t}(e);r.forEach(t,(function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r.uniqueId("rev"))}))},undo:function(e){r.forEach(e.edges(),(function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}}))}}},11555:(e,t,n)=>{var r=n(32692),i=n(30345);function o(e,t,n,r,o,a){var s={width:0,height:0,rank:a,borderType:t},l=o[t][a-1],u=i.addDummyNode(e,"border",s,n);o[t][a]=u,e.setParent(u,r),l&&e.setEdge(l,u,{weight:1})}e.exports=function(e){r.forEach(e.children(),(function t(n){var i=e.children(n),a=e.node(n);if(i.length&&r.forEach(i,t),r.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var s=a.minRank,l=a.maxRank+1;s{"use strict";var r=n(32692);function i(e){r.forEach(e.nodes(),(function(t){o(e.node(t))})),r.forEach(e.edges(),(function(t){o(e.edge(t))}))}function o(e){var t=e.width;e.width=e.height,e.height=t}function a(e){e.y=-e.y}function s(e){var t=e.x;e.x=e.y,e.y=t}e.exports={adjust:function(e){var t=e.graph().rankdir.toLowerCase();"lr"!==t&&"rl"!==t||i(e)},undo:function(e){var t=e.graph().rankdir.toLowerCase();"bt"!==t&&"rl"!==t||function(e){r.forEach(e.nodes(),(function(t){a(e.node(t))})),r.forEach(e.edges(),(function(t){var n=e.edge(t);r.forEach(n.points,a),r.has(n,"y")&&a(n)}))}(e);"lr"!==t&&"rl"!==t||(!function(e){r.forEach(e.nodes(),(function(t){s(e.node(t))})),r.forEach(e.edges(),(function(t){var n=e.edge(t);r.forEach(n.points,s),r.has(n,"x")&&s(n)}))}(e),i(e))}}},32278:e=>{function t(){var e={};e._next=e._prev=e,this._sentinel=e}function n(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function r(e,t){if("_next"!==e&&"_prev"!==e)return t}e.exports=t,t.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return n(t),t},t.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&n(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t},t.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,r)),n=n._prev;return"["+e.join(", ")+"]"}},55856:(e,t,n)=>{var r=n(32692),i=n(30345),o=n(21943).Graph;e.exports={debugOrdering:function(e){var t=i.buildLayerMatrix(e),n=new o({compound:!0,multigraph:!0}).setGraph({});return r.forEach(e.nodes(),(function(t){n.setNode(t,{label:t}),n.setParent(t,"layer"+e.node(t).rank)})),r.forEach(e.edges(),(function(e){n.setEdge(e.v,e.w,{},e.name)})),r.forEach(t,(function(e,t){var i="layer"+t;n.setNode(i,{rank:"same"}),r.reduce(e,(function(e,t){return n.setEdge(e,t,{style:"invis"}),t}))})),n}}},21943:(e,t,n)=>{var r;try{r=n(66960)}catch(i){}r||(r=window.graphlib),e.exports=r},50824:(e,t,n)=>{var r=n(32692),i=n(21943).Graph,o=n(32278);e.exports=function(e,t){if(e.nodeCount()<=1)return[];var n=function(e,t){var n=new i,a=0,s=0;r.forEach(e.nodes(),(function(e){n.setNode(e,{v:e,in:0,out:0})})),r.forEach(e.edges(),(function(e){var r=n.edge(e.v,e.w)||0,i=t(e),o=r+i;n.setEdge(e.v,e.w,o),s=Math.max(s,n.node(e.v).out+=i),a=Math.max(a,n.node(e.w).in+=i)}));var u=r.range(s+a+3).map((function(){return new o})),c=a+1;return r.forEach(n.nodes(),(function(e){l(u,c,n.node(e))})),{graph:n,buckets:u,zeroIdx:c}}(e,t||a),u=function(e,t,n){var r,i=[],o=t[t.length-1],a=t[0];for(;e.nodeCount();){for(;r=a.dequeue();)s(e,t,n,r);for(;r=o.dequeue();)s(e,t,n,r);if(e.nodeCount())for(var l=t.length-2;l>0;--l)if(r=t[l].dequeue()){i=i.concat(s(e,t,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return r.flatten(r.map(u,(function(t){return e.outEdges(t.v,t.w)})),!0)};var a=r.constant(1);function s(e,t,n,i,o){var a=o?[]:void 0;return r.forEach(e.inEdges(i.v),(function(r){var i=e.edge(r),s=e.node(r.v);o&&a.push({v:r.v,w:r.w}),s.out-=i,l(t,n,s)})),r.forEach(e.outEdges(i.v),(function(r){var i=e.edge(r),o=r.w,a=e.node(o);a.in-=i,l(t,n,a)})),e.removeNode(i.v),a}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}},75499:(e,t,n)=>{"use strict";var r=n(32692),i=n(55205),o=n(44125),a=n(28264),s=n(30345).normalizeRanks,l=n(32555),u=n(30345).removeEmptyRanks,c=n(60838),d=n(11555),f=n(84688),h=n(56571),p=n(89533),v=n(30345),m=n(21943).Graph;e.exports=function(e,t){var n=t&&t.debugTiming?v.time:v.notime;n("layout",(function(){var t=n(" buildLayoutGraph",(function(){return function(e){var t=new m({multigraph:!0,compound:!0}),n=S(e.graph());return t.setGraph(r.merge({},y,k(n,g),r.pick(n,b))),r.forEach(e.nodes(),(function(n){var i=S(e.node(n));t.setNode(n,r.defaults(k(i,x),w)),t.setParent(n,e.parent(n))})),r.forEach(e.edges(),(function(n){var i=S(e.edge(n));t.setEdge(n,r.merge({},E,k(i,_),r.pick(i,N)))})),t}(e)}));n(" runLayout",(function(){!function(e,t){t(" makeSpaceForEdgeLabels",(function(){!function(e){var t=e.graph();t.ranksep/=2,r.forEach(e.edges(),(function(n){var r=e.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),t(" removeSelfEdges",(function(){!function(e){r.forEach(e.edges(),(function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}}))}(e)})),t(" acyclic",(function(){i.run(e)})),t(" nestingGraph.run",(function(){c.run(e)})),t(" rank",(function(){a(v.asNonCompoundGraph(e))})),t(" injectEdgeLabelProxies",(function(){!function(e){r.forEach(e.edges(),(function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),i={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};v.addDummyNode(e,"edge-proxy",i,"_ep")}}))}(e)})),t(" removeEmptyRanks",(function(){u(e)})),t(" nestingGraph.cleanup",(function(){c.cleanup(e)})),t(" normalizeRanks",(function(){s(e)})),t(" assignRankMinMax",(function(){!function(e){var t=0;r.forEach(e.nodes(),(function(n){var i=e.node(n);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=r.max(t,i.maxRank))})),e.graph().maxRank=t}(e)})),t(" removeEdgeLabelProxies",(function(){!function(e){r.forEach(e.nodes(),(function(t){var n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))}))}(e)})),t(" normalize.run",(function(){o.run(e)})),t(" parentDummyChains",(function(){l(e)})),t(" addBorderSegments",(function(){d(e)})),t(" order",(function(){h(e)})),t(" insertSelfEdges",(function(){!function(e){var t=v.buildLayerMatrix(e);r.forEach(t,(function(t){var n=0;r.forEach(t,(function(t,i){var o=e.node(t);o.order=i+n,r.forEach(o.selfEdges,(function(t){v.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:o.rank,order:i+ ++n,e:t.e,label:t.label},"_se")})),delete o.selfEdges}))}))}(e)})),t(" adjustCoordinateSystem",(function(){f.adjust(e)})),t(" position",(function(){p(e)})),t(" positionSelfEdges",(function(){!function(e){r.forEach(e.nodes(),(function(t){var n=e.node(t);if("selfedge"===n.dummy){var r=e.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}}))}(e)})),t(" removeBorderNodes",(function(){!function(e){r.forEach(e.nodes(),(function(t){if(e.children(t).length){var n=e.node(t),i=e.node(n.borderTop),o=e.node(n.borderBottom),a=e.node(r.last(n.borderLeft)),s=e.node(r.last(n.borderRight));n.width=Math.abs(s.x-a.x),n.height=Math.abs(o.y-i.y),n.x=a.x+n.width/2,n.y=i.y+n.height/2}})),r.forEach(e.nodes(),(function(t){"border"===e.node(t).dummy&&e.removeNode(t)}))}(e)})),t(" normalize.undo",(function(){o.undo(e)})),t(" fixupEdgeLabelCoords",(function(){!function(e){r.forEach(e.edges(),(function(t){var n=e.edge(t);if(r.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(e)})),t(" undoCoordinateSystem",(function(){f.undo(e)})),t(" translateGraph",(function(){!function(e){var t=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,o=0,a=e.graph(),s=a.marginx||0,l=a.marginy||0;function u(e){var r=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,r-s/2),n=Math.max(n,r+s/2),i=Math.min(i,a-l/2),o=Math.max(o,a+l/2)}r.forEach(e.nodes(),(function(t){u(e.node(t))})),r.forEach(e.edges(),(function(t){var n=e.edge(t);r.has(n,"x")&&u(n)})),t-=s,i-=l,r.forEach(e.nodes(),(function(n){var r=e.node(n);r.x-=t,r.y-=i})),r.forEach(e.edges(),(function(n){var o=e.edge(n);r.forEach(o.points,(function(e){e.x-=t,e.y-=i})),r.has(o,"x")&&(o.x-=t),r.has(o,"y")&&(o.y-=i)})),a.width=n-t+s,a.height=o-i+l}(e)})),t(" assignNodeIntersects",(function(){!function(e){r.forEach(e.edges(),(function(t){var n,r,i=e.edge(t),o=e.node(t.v),a=e.node(t.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(v.intersectRect(o,n)),i.points.push(v.intersectRect(a,r))}))}(e)})),t(" reversePoints",(function(){!function(e){r.forEach(e.edges(),(function(t){var n=e.edge(t);n.reversed&&n.points.reverse()}))}(e)})),t(" acyclic.undo",(function(){i.undo(e)}))}(t,n)})),n(" updateInputGraph",(function(){!function(e,t){r.forEach(e.nodes(),(function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))})),r.forEach(e.edges(),(function(n){var i=e.edge(n),o=t.edge(n);i.points=o.points,r.has(o,"x")&&(i.x=o.x,i.y=o.y)})),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,t)}))}))};var g=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],x=["width","height"],w={width:0,height:0},_=["minlen","weight","width","height","labeloffset"],E={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},N=["labelpos"];function k(e,t){return r.mapValues(r.pick(e,t),Number)}function S(e){var t={};return r.forEach(e,(function(e,n){t[n.toLowerCase()]=e})),t}},32692:(e,t,n)=>{var r;try{r={cloneDeep:n(77179),constant:n(89203),defaults:n(73821),each:n(20678),filter:n(64663),find:n(26969),flatten:n(62923),forEach:n(77734),forIn:n(87514),has:n(45346),isUndefined:n(86474),last:n(77875),map:n(69107),mapValues:n(61230),max:n(56492),merge:n(88469),min:n(65071),minBy:n(76838),now:n(80231),pick:n(49335),range:n(38569),reduce:n(17682),sortBy:n(71635),uniqueId:n(61422),values:n(31682),zipObject:n(54142)}}catch(i){}r||(r=window._),e.exports=r},60838:(e,t,n)=>{var r=n(32692),i=n(30345);function o(e,t,n,a,s,l,u){var c=e.children(u);if(c.length){var d=i.addBorderNode(e,"_bt"),f=i.addBorderNode(e,"_bb"),h=e.node(u);e.setParent(d,u),h.borderTop=d,e.setParent(f,u),h.borderBottom=f,r.forEach(c,(function(r){o(e,t,n,a,s,l,r);var i=e.node(r),c=i.borderTop?i.borderTop:r,h=i.borderBottom?i.borderBottom:r,p=i.borderTop?a:2*a,v=c!==h?1:s-l[u]+1;e.setEdge(d,c,{weight:p,minlen:v,nestingEdge:!0}),e.setEdge(h,f,{weight:p,minlen:v,nestingEdge:!0})})),e.parent(u)||e.setEdge(t,d,{weight:0,minlen:s+l[u]})}else u!==t&&e.setEdge(t,u,{weight:0,minlen:n})}e.exports={run:function(e){var t=i.addDummyNode(e,"root",{},"_root"),n=function(e){var t={};function n(i,o){var a=e.children(i);a&&a.length&&r.forEach(a,(function(e){n(e,o+1)})),t[i]=o}return r.forEach(e.children(),(function(e){n(e,1)})),t}(e),a=r.max(r.values(n))-1,s=2*a+1;e.graph().nestingRoot=t,r.forEach(e.edges(),(function(t){e.edge(t).minlen*=s}));var l=function(e){return r.reduce(e.edges(),(function(t,n){return t+e.edge(n).weight}),0)}(e)+1;r.forEach(e.children(),(function(r){o(e,t,s,l,a,n,r)})),e.graph().nodeRankFactor=s},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,r.forEach(e.edges(),(function(t){e.edge(t).nestingEdge&&e.removeEdge(t)}))}}},44125:(e,t,n)=>{"use strict";var r=n(32692),i=n(30345);e.exports={run:function(e){e.graph().dummyChains=[],r.forEach(e.edges(),(function(t){!function(e,t){var n,r,o,a=t.v,s=e.node(a).rank,l=t.w,u=e.node(l).rank,c=t.name,d=e.edge(t),f=d.labelRank;if(u===s+1)return;for(e.removeEdge(t),o=0,++s;s{var r=n(32692);e.exports=function(e,t,n){var i,o={};r.forEach(n,(function(n){for(var r,a,s=e.parent(n);s;){if((r=e.parent(s))?(a=o[r],o[r]=s):(a=i,i=s),a&&a!==s)return void t.setEdge(a,s);s=r}}))}},15374:(e,t,n)=>{var r=n(32692);e.exports=function(e,t){return r.map(t,(function(t){var n=e.inEdges(t);if(n.length){var i=r.reduce(n,(function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}}),{sum:0,weight:0});return{v:t,barycenter:i.sum/i.weight,weight:i.weight}}return{v:t}}))}},3037:(e,t,n)=>{var r=n(32692),i=n(21943).Graph;e.exports=function(e,t,n){var o=function(e){var t;for(;e.hasNode(t=r.uniqueId("_root")););return t}(e),a=new i({compound:!0}).setGraph({root:o}).setDefaultNodeLabel((function(t){return e.node(t)}));return r.forEach(e.nodes(),(function(i){var s=e.node(i),l=e.parent(i);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(a.setNode(i),a.setParent(i,l||o),r.forEach(e[n](i),(function(t){var n=t.v===i?t.w:t.v,o=a.edge(n,i),s=r.isUndefined(o)?0:o.weight;a.setEdge(n,i,{weight:e.edge(t).weight+s})})),r.has(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))})),a}},29420:(e,t,n)=>{"use strict";var r=n(32692);function i(e,t,n){for(var i=r.zipObject(n,r.map(n,(function(e,t){return t}))),o=r.flatten(r.map(t,(function(t){return r.sortBy(r.map(e.outEdges(t),(function(t){return{pos:i[t.w],weight:e.edge(t).weight}})),"pos")})),!0),a=1;a0;)t%2&&(n+=l[t+1]),l[t=t-1>>1]+=e.weight;u+=e.weight*n}))),u}e.exports=function(e,t){for(var n=0,r=1;r{"use strict";var r=n(32692),i=n(61001),o=n(29420),a=n(37407),s=n(3037),l=n(4333),u=n(21943).Graph,c=n(30345);function d(e,t,n){return r.map(t,(function(t){return s(e,t,n)}))}function f(e,t){var n=new u;r.forEach(e,(function(e){var i=e.graph().root,o=a(e,i,n,t);r.forEach(o.vs,(function(t,n){e.node(t).order=n})),l(e,n,o.vs)}))}function h(e,t){r.forEach(t,(function(t){r.forEach(t,(function(t,n){e.node(t).order=n}))}))}e.exports=function(e){var t=c.maxRank(e),n=d(e,r.range(1,t+1),"inEdges"),a=d(e,r.range(t-1,-1,-1),"outEdges"),s=i(e);h(e,s);for(var l,u=Number.POSITIVE_INFINITY,p=0,v=0;v<4;++p,++v){f(p%2?n:a,p%4>=2),s=c.buildLayerMatrix(e);var m=o(e,s);m{"use strict";var r=n(32692);e.exports=function(e){var t={},n=r.filter(e.nodes(),(function(t){return!e.children(t).length})),i=r.max(r.map(n,(function(t){return e.node(t).rank}))),o=r.map(r.range(i+1),(function(){return[]}));var a=r.sortBy(n,(function(t){return e.node(t).rank}));return r.forEach(a,(function n(i){if(r.has(t,i))return;t[i]=!0;var a=e.node(i);o[a.rank].push(i),r.forEach(e.successors(i),n)})),o}},68522:(e,t,n)=>{"use strict";var r=n(32692);e.exports=function(e,t){var n={};return r.forEach(e,(function(e,t){var i=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};r.isUndefined(e.barycenter)||(i.barycenter=e.barycenter,i.weight=e.weight)})),r.forEach(t.edges(),(function(e){var t=n[e.v],i=n[e.w];r.isUndefined(t)||r.isUndefined(i)||(i.indegree++,t.out.push(n[e.w]))})),function(e){var t=[];function n(e){return function(t){t.merged||(r.isUndefined(t.barycenter)||r.isUndefined(e.barycenter)||t.barycenter>=e.barycenter)&&function(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function i(t){return function(n){n.in.push(t),0==--n.indegree&&e.push(n)}}for(;e.length;){var o=e.pop();t.push(o),r.forEach(o.in.reverse(),n(o)),r.forEach(o.out,i(o))}return r.map(r.filter(t,(function(e){return!e.merged})),(function(e){return r.pick(e,["vs","i","barycenter","weight"])}))}(r.filter(n,(function(e){return!e.indegree})))}},37407:(e,t,n)=>{var r=n(32692),i=n(15374),o=n(68522),a=n(52711);e.exports=function e(t,n,s,l){var u=t.children(n),c=t.node(n),d=c?c.borderLeft:void 0,f=c?c.borderRight:void 0,h={};d&&(u=r.filter(u,(function(e){return e!==d&&e!==f})));var p=i(t,u);r.forEach(p,(function(n){if(t.children(n.v).length){var i=e(t,n.v,s,l);h[n.v]=i,r.has(i,"barycenter")&&(o=n,a=i,r.isUndefined(o.barycenter)?(o.barycenter=a.barycenter,o.weight=a.weight):(o.barycenter=(o.barycenter*o.weight+a.barycenter*a.weight)/(o.weight+a.weight),o.weight+=a.weight))}var o,a}));var v=o(p,s);!function(e,t){r.forEach(e,(function(e){e.vs=r.flatten(e.vs.map((function(e){return t[e]?t[e].vs:e})),!0)}))}(v,h);var m=a(v,l);if(d&&(m.vs=r.flatten([d,m.vs,f],!0),t.predecessors(d).length)){var g=t.node(t.predecessors(d)[0]),y=t.node(t.predecessors(f)[0]);r.has(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+g.order+y.order)/(m.weight+2),m.weight+=2}return m}},52711:(e,t,n)=>{var r=n(32692),i=n(30345);function o(e,t,n){for(var i;t.length&&(i=r.last(t)).i<=n;)t.pop(),e.push(i.vs),n++;return n}e.exports=function(e,t){var n=i.partition(e,(function(e){return r.has(e,"barycenter")})),a=n.lhs,s=r.sortBy(n.rhs,(function(e){return-e.i})),l=[],u=0,c=0,d=0;a.sort((f=!!t,function(e,t){return e.barycentert.barycenter?1:f?t.i-e.i:e.i-t.i})),d=o(l,s,d),r.forEach(a,(function(e){d+=e.vs.length,l.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,d=o(l,s,d)}));var f;var h={vs:r.flatten(l,!0)};c&&(h.barycenter=u/c,h.weight=c);return h}},32555:(e,t,n)=>{var r=n(32692);e.exports=function(e){var t=function(e){var t={},n=0;function i(o){var a=n;r.forEach(e.children(o),i),t[o]={low:a,lim:n++}}return r.forEach(e.children(),i),t}(e);r.forEach(e.graph().dummyChains,(function(n){for(var r=e.node(n),i=r.edgeObj,o=function(e,t,n,r){var i,o,a=[],s=[],l=Math.min(t[n].low,t[r].low),u=Math.max(t[n].lim,t[r].lim);i=n;do{i=e.parent(i),a.push(i)}while(i&&(t[i].low>l||u>t[i].lim));o=i,i=r;for(;(i=e.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(e,t,i.v,i.w),a=o.path,s=o.lca,l=0,u=a[l],c=!0;n!==i.w;){if(r=e.node(n),c){for(;(u=a[l])!==s&&e.node(u).maxRank{"use strict";var r=n(32692),i=n(21943).Graph,o=n(30345);function a(e,t){var n={};return r.reduce(t,(function(t,i){var o=0,a=0,s=t.length,u=r.last(i);return r.forEach(i,(function(t,c){var d=function(e,t){if(e.node(t).dummy)return r.find(e.predecessors(t),(function(t){return e.node(t).dummy}))}(e,t),f=d?e.node(d).order:s;(d||t===u)&&(r.forEach(i.slice(a,c+1),(function(t){r.forEach(e.predecessors(t),(function(r){var i=e.node(r),a=i.order;!(as)&&l(n,t,u)}))}))}return r.reduce(t,(function(t,n){var o,a=-1,s=0;return r.forEach(n,(function(r,l){if("border"===e.node(r).dummy){var u=e.predecessors(r);u.length&&(o=e.node(u[0]).order,i(n,s,l,a,o),s=l,a=o)}i(n,s,n.length,o,t.length)})),n})),n}function l(e,t,n){if(t>n){var r=t;t=n,n=r}var i=e[t];i||(e[t]=i={}),i[n]=!0}function u(e,t,n){if(t>n){var i=t;t=n,n=i}return r.has(e[t],n)}function c(e,t,n,i){var o={},a={},s={};return r.forEach(t,(function(e){r.forEach(e,(function(e,t){o[e]=e,a[e]=e,s[e]=t}))})),r.forEach(t,(function(e){var t=-1;r.forEach(e,(function(e){var l=i(e);if(l.length){l=r.sortBy(l,(function(e){return s[e]}));for(var c=(l.length-1)/2,d=Math.floor(c),f=Math.ceil(c);d<=f;++d){var h=l[d];a[e]===e&&t{"use strict";var r=n(32692),i=n(30345),o=n(17828).positionX;e.exports=function(e){(function(e){var t=i.buildLayerMatrix(e),n=e.graph().ranksep,o=0;r.forEach(t,(function(t){var i=r.max(r.map(t,(function(t){return e.node(t).height})));r.forEach(t,(function(t){e.node(t).y=o+i/2})),o+=i+n}))})(e=i.asNonCompoundGraph(e)),r.forEach(o(e),(function(t,n){e.node(n).x=t}))}},86771:(e,t,n)=>{"use strict";var r=n(32692),i=n(21943).Graph,o=n(23834).slack;function a(e,t){return r.forEach(e.nodes(),(function n(i){r.forEach(t.nodeEdges(i),(function(r){var a=r.v,s=i===a?r.w:a;e.hasNode(s)||o(t,r)||(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))}))})),e.nodeCount()}function s(e,t){return r.minBy(t.edges(),(function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return o(t,n)}))}function l(e,t,n){r.forEach(e.nodes(),(function(e){t.node(e).rank+=n}))}e.exports=function(e){var t,n,r=new i({directed:!1}),u=e.nodes()[0],c=e.nodeCount();r.setNode(u,{});for(;a(r,e){"use strict";var r=n(23834).longestPath,i=n(86771),o=n(53284);e.exports=function(e){switch(e.graph().ranker){case"network-simplex":default:s(e);break;case"tight-tree":!function(e){r(e),i(e)}(e);break;case"longest-path":a(e)}};var a=r;function s(e){o(e)}},53284:(e,t,n)=>{"use strict";var r=n(32692),i=n(86771),o=n(23834).slack,a=n(23834).longestPath,s=n(21943).alg.preorder,l=n(21943).alg.postorder,u=n(30345).simplify;function c(e){e=u(e),a(e);var t,n=i(e);for(h(n),d(n,e);t=v(n);)g(n,e,t,m(n,e,t))}function d(e,t){var n=l(e,e.nodes());n=n.slice(0,n.length-1),r.forEach(n,(function(n){!function(e,t,n){var r=e.node(n),i=r.parent;e.edge(n,i).cutvalue=f(e,t,n)}(e,t,n)}))}function f(e,t,n){var i=e.node(n).parent,o=!0,a=t.edge(n,i),s=0;return a||(o=!1,a=t.edge(i,n)),s=a.weight,r.forEach(t.nodeEdges(n),(function(r){var a,l,u=r.v===n,c=u?r.w:r.v;if(c!==i){var d=u===o,f=t.edge(r).weight;if(s+=d?f:-f,a=n,l=c,e.hasEdge(a,l)){var h=e.edge(n,c).cutvalue;s+=d?-h:h}}})),s}function h(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,i,o){var a=n,s=e.node(i);return t[i]=!0,r.forEach(e.neighbors(i),(function(o){r.has(t,o)||(n=p(e,t,n,o,i))})),s.low=a,s.lim=n++,o?s.parent=o:delete s.parent,n}function v(e){return r.find(e.edges(),(function(t){return e.edge(t).cutvalue<0}))}function m(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var s=e.node(i),l=e.node(a),u=s,c=!1;s.lim>l.lim&&(u=l,c=!0);var d=r.filter(t.edges(),(function(t){return c===y(e,e.node(t.v),u)&&c!==y(e,e.node(t.w),u)}));return r.minBy(d,(function(e){return o(t,e)}))}function g(e,t,n,i){var o=n.v,a=n.w;e.removeEdge(o,a),e.setEdge(i.v,i.w,{}),h(e),d(e,t),function(e,t){var n=r.find(e.nodes(),(function(e){return!t.node(e).parent})),i=s(e,n);i=i.slice(1),r.forEach(i,(function(n){var r=e.node(n).parent,i=t.edge(n,r),o=!1;i||(i=t.edge(r,n),o=!0),t.node(n).rank=t.node(r).rank+(o?i.minlen:-i.minlen)}))}(e,t)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}e.exports=c,c.initLowLimValues=h,c.initCutValues=d,c.calcCutValue=f,c.leaveEdge=v,c.enterEdge=m,c.exchangeEdges=g},23834:(e,t,n)=>{"use strict";var r=n(32692);e.exports={longestPath:function(e){var t={};r.forEach(e.sources(),(function n(i){var o=e.node(i);if(r.has(t,i))return o.rank;t[i]=!0;var a=r.min(r.map(e.outEdges(i),(function(t){return n(t.w)-e.edge(t).minlen})));return a!==Number.POSITIVE_INFINITY&&null!=a||(a=0),o.rank=a}))},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}},30345:(e,t,n)=>{"use strict";var r=n(32692),i=n(21943).Graph;function o(e,t,n,i){var o;do{o=r.uniqueId(i)}while(e.hasNode(o));return n.dummy=t,e.setNode(o,n),o}function a(e){return r.max(r.map(e.nodes(),(function(t){var n=e.node(t).rank;if(!r.isUndefined(n))return n})))}e.exports={addDummyNode:o,simplify:function(e){var t=(new i).setGraph(e.graph());return r.forEach(e.nodes(),(function(n){t.setNode(n,e.node(n))})),r.forEach(e.edges(),(function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),t},asNonCompoundGraph:function(e){var t=new i({multigraph:e.isMultigraph()}).setGraph(e.graph());return r.forEach(e.nodes(),(function(n){e.children(n).length||t.setNode(n,e.node(n))})),r.forEach(e.edges(),(function(n){t.setEdge(n,e.edge(n))})),t},successorWeights:function(e){var t=r.map(e.nodes(),(function(t){var n={};return r.forEach(e.outEdges(t),(function(t){n[t.w]=(n[t.w]||0)+e.edge(t).weight})),n}));return r.zipObject(e.nodes(),t)},predecessorWeights:function(e){var t=r.map(e.nodes(),(function(t){var n={};return r.forEach(e.inEdges(t),(function(t){n[t.v]=(n[t.v]||0)+e.edge(t).weight})),n}));return r.zipObject(e.nodes(),t)},intersectRect:function(e,t){var n,r,i=e.x,o=e.y,a=t.x-i,s=t.y-o,l=e.width/2,u=e.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*u?(s<0&&(u=-u),n=u*a/s,r=u):(a<0&&(l=-l),n=l,r=l*s/a);return{x:i+n,y:o+r}},buildLayerMatrix:function(e){var t=r.map(r.range(a(e)+1),(function(){return[]}));return r.forEach(e.nodes(),(function(n){var i=e.node(n),o=i.rank;r.isUndefined(o)||(t[o][i.order]=n)})),t},normalizeRanks:function(e){var t=r.min(r.map(e.nodes(),(function(t){return e.node(t).rank})));r.forEach(e.nodes(),(function(n){var i=e.node(n);r.has(i,"rank")&&(i.rank-=t)}))},removeEmptyRanks:function(e){var t=r.min(r.map(e.nodes(),(function(t){return e.node(t).rank}))),n=[];r.forEach(e.nodes(),(function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)}));var i=0,o=e.graph().nodeRankFactor;r.forEach(n,(function(t,n){r.isUndefined(t)&&n%o!=0?--i:i&&r.forEach(t,(function(t){e.node(t).rank+=i}))}))},addBorderNode:function(e,t,n,r){var i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return o(e,"border",i,t)},maxRank:a,partition:function(e,t){var n={lhs:[],rhs:[]};return r.forEach(e,(function(e){t(e)?n.lhs.push(e):n.rhs.push(e)})),n},time:function(e,t){var n=r.now();try{return t()}finally{console.log(e+" time: "+(r.now()-n)+"ms")}},notime:function(e,t){return t()}}},93404:e=>{e.exports="0.8.5"},4329:e=>{e.exports=a,a.default=a,a.stable=c,a.stableStringify=c;var t="[...]",n="[Circular]",r=[],i=[];function o(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function a(e,t,n,a){var s;void 0===a&&(a=o()),l(e,"",0,[],void 0,0,a);try{s=0===i.length?JSON.stringify(e,t,n):JSON.stringify(e,f(t),n)}catch(c){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function s(e,t,n,o){var a=Object.getOwnPropertyDescriptor(o,n);void 0!==a.get?a.configurable?(Object.defineProperty(o,n,{value:e}),r.push([o,n,t,a])):i.push([t,n,e]):(o[n]=e,r.push([o,n,t]))}function l(e,r,i,o,a,u,c){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;dc.depthLimit)return void s(t,e,r,a);if(void 0!==c.edgesLimit&&i+1>c.edgesLimit)return void s(t,e,r,a);if(o.push(e),Array.isArray(e))for(d=0;dt?1:0}function c(e,t,n,a){void 0===a&&(a=o());var s,l=d(e,"",0,[],void 0,0,a)||e;try{s=0===i.length?JSON.stringify(l,t,n):JSON.stringify(l,f(t),n)}catch(c){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return s}function d(e,i,o,a,l,c,f){var h;if(c+=1,"object"==typeof e&&null!==e){for(h=0;hf.depthLimit)return void s(t,e,i,l);if(void 0!==f.edgesLimit&&o+1>f.edgesLimit)return void s(t,e,i,l);if(a.push(e),Array.isArray(e))for(h=0;h0)for(var r=0;r{var r=n(3150);e.exports={Graph:r.Graph,json:n(11430),alg:n(89757),version:r.version}},79535:(e,t,n)=>{var r=n(44434);e.exports=function(e){var t,n={},i=[];function o(i){r.has(n,i)||(n[i]=!0,t.push(i),r.each(e.successors(i),o),r.each(e.predecessors(i),o))}return r.each(e.nodes(),(function(e){t=[],o(e),t.length&&i.push(t)})),i}},97819:(e,t,n)=>{var r=n(44434);function i(e,t,n,o,a,s){r.has(o,t)||(o[t]=!0,n||s.push(t),r.each(a(t),(function(t){i(e,t,n,o,a,s)})),n&&s.push(t))}e.exports=function(e,t,n){r.isArray(t)||(t=[t]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],s={};return r.each(t,(function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);i(e,t,"post"===n,s,o,a)})),a}},61353:(e,t,n)=>{var r=n(4245),i=n(44434);e.exports=function(e,t,n){return i.transform(e.nodes(),(function(i,o){i[o]=r(e,o,t,n)}),{})}},4245:(e,t,n)=>{var r=n(44434),i=n(51011);e.exports=function(e,t,n,r){return function(e,t,n,r){var o,a,s={},l=new i,u=function(e){var t=e.v!==o?e.v:e.w,r=s[t],i=n(e),u=a.distance+i;if(i<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+i);u0&&(o=l.removeMin(),(a=s[o]).distance!==Number.POSITIVE_INFINITY);)r(o).forEach(u);return s}(e,String(t),n||o,r||function(t){return e.outEdges(t)})};var o=r.constant(1)},30937:(e,t,n)=>{var r=n(44434),i=n(59177);e.exports=function(e){return r.filter(i(e),(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])}))}},70086:(e,t,n)=>{var r=n(44434);e.exports=function(e,t,n){return function(e,t,n){var r={},i=e.nodes();return i.forEach((function(e){r[e]={},r[e][e]={distance:0},i.forEach((function(t){e!==t&&(r[e][t]={distance:Number.POSITIVE_INFINITY})})),n(e).forEach((function(n){var i=n.v===e?n.w:n.v,o=t(n);r[e][i]={distance:o,predecessor:e}}))})),i.forEach((function(e){var t=r[e];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[e],i=t[n],a=o[n],s=r.distance+i.distance;s{e.exports={components:n(79535),dijkstra:n(4245),dijkstraAll:n(61353),findCycles:n(30937),floydWarshall:n(70086),isAcyclic:n(47772),postorder:n(28494),preorder:n(50101),prim:n(53816),tarjan:n(59177),topsort:n(60750)}},47772:(e,t,n)=>{var r=n(60750);e.exports=function(e){try{r(e)}catch(t){if(t instanceof r.CycleException)return!1;throw t}return!0}},28494:(e,t,n)=>{var r=n(97819);e.exports=function(e,t){return r(e,t,"post")}},50101:(e,t,n)=>{var r=n(97819);e.exports=function(e,t){return r(e,t,"pre")}},53816:(e,t,n)=>{var r=n(44434),i=n(69955),o=n(51011);e.exports=function(e,t){var n,a=new i,s={},l=new o;function u(e){var r=e.v===n?e.w:e.v,i=l.priority(r);if(void 0!==i){var o=t(e);o0;){if(n=l.removeMin(),r.has(s,n))a.setEdge(n,s[n]);else{if(c)throw new Error("Input graph is not connected: "+e);c=!0}e.nodeEdges(n).forEach(u)}return a}},59177:(e,t,n)=>{var r=n(44434);e.exports=function(e){var t=0,n=[],i={},o=[];function a(s){var l=i[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach((function(e){r.has(i,e)?i[e].onStack&&(l.lowlink=Math.min(l.lowlink,i[e].index)):(a(e),l.lowlink=Math.min(l.lowlink,i[e].lowlink))})),l.lowlink===l.index){var u,c=[];do{u=n.pop(),i[u].onStack=!1,c.push(u)}while(s!==u);o.push(c)}}return e.nodes().forEach((function(e){r.has(i,e)||a(e)})),o}},60750:(e,t,n)=>{var r=n(44434);function i(e){var t={},n={},i=[];if(r.each(e.sinks(),(function a(s){if(r.has(n,s))throw new o;r.has(t,s)||(n[s]=!0,t[s]=!0,r.each(e.predecessors(s),a),delete n[s],i.push(s))})),r.size(t)!==e.nodeCount())throw new o;return i}function o(){}e.exports=i,i.CycleException=o,o.prototype=new Error},51011:(e,t,n)=>{var r=n(44434);function i(){this._arr=[],this._keyIndices={}}e.exports=i,i.prototype.size=function(){return this._arr.length},i.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},i.prototype.has=function(e){return r.has(this._keyIndices,e)},i.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},i.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},i.prototype.add=function(e,t){var n=this._keyIndices;if(e=String(e),!r.has(n,e)){var i=this._arr,o=i.length;return n[e]=o,i.push({key:e,priority:t}),this._decrease(o),!0}return!1},i.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},i.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)},i.prototype._heapify=function(e){var t=this._arr,n=2*e,r=n+1,i=e;n>1].priority{"use strict";var r=n(44434);e.exports=s;var i="\0",o="\0",a="\x01";function s(e){this._isDirected=!r.has(e,"directed")||e.directed,this._isMultigraph=!!r.has(e,"multigraph")&&e.multigraph,this._isCompound=!!r.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[o]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function l(e,t){e[t]?e[t]++:e[t]=1}function u(e,t){--e[t]||delete e[t]}function c(e,t,n,o){var s=""+t,l=""+n;if(!e&&s>l){var u=s;s=l,l=u}return s+a+l+a+(r.isUndefined(o)?i:o)}function d(e,t){return c(e,t.v,t.w,t.name)}s.prototype._nodeCount=0,s.prototype._edgeCount=0,s.prototype.isDirected=function(){return this._isDirected},s.prototype.isMultigraph=function(){return this._isMultigraph},s.prototype.isCompound=function(){return this._isCompound},s.prototype.setGraph=function(e){return this._label=e,this},s.prototype.graph=function(){return this._label},s.prototype.setDefaultNodeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultNodeLabelFn=e,this},s.prototype.nodeCount=function(){return this._nodeCount},s.prototype.nodes=function(){return r.keys(this._nodes)},s.prototype.sources=function(){var e=this;return r.filter(this.nodes(),(function(t){return r.isEmpty(e._in[t])}))},s.prototype.sinks=function(){var e=this;return r.filter(this.nodes(),(function(t){return r.isEmpty(e._out[t])}))},s.prototype.setNodes=function(e,t){var n=arguments,i=this;return r.each(e,(function(e){n.length>1?i.setNode(e,t):i.setNode(e)})),this},s.prototype.setNode=function(e,t){return r.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=o,this._children[e]={},this._children[o][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},s.prototype.node=function(e){return this._nodes[e]},s.prototype.hasNode=function(e){return r.has(this._nodes,e)},s.prototype.removeNode=function(e){var t=this;if(r.has(this._nodes,e)){var n=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],r.each(this.children(e),(function(e){t.setParent(e)})),delete this._children[e]),r.each(r.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],r.each(r.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},s.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(t))t=o;else{for(var n=t+="";!r.isUndefined(n);n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},s.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},s.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==o)return t}},s.prototype.children=function(e){if(r.isUndefined(e)&&(e=o),this._isCompound){var t=this._children[e];if(t)return r.keys(t)}else{if(e===o)return this.nodes();if(this.hasNode(e))return[]}},s.prototype.predecessors=function(e){var t=this._preds[e];if(t)return r.keys(t)},s.prototype.successors=function(e){var t=this._sucs[e];if(t)return r.keys(t)},s.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return r.union(t,this.successors(e))},s.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},s.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;r.each(this._nodes,(function(n,r){e(r)&&t.setNode(r,n)})),r.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))}));var i={};function o(e){var r=n.parent(e);return void 0===r||t.hasNode(r)?(i[e]=r,r):r in i?i[r]:o(r)}return this._isCompound&&r.each(t.nodes(),(function(e){t.setParent(e,o(e))})),t},s.prototype.setDefaultEdgeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultEdgeLabelFn=e,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return r.values(this._edgeObjs)},s.prototype.setPath=function(e,t){var n=this,i=arguments;return r.reduce(e,(function(e,r){return i.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r})),this},s.prototype.setEdge=function(){var e,t,n,i,o=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(e=a.v,t=a.w,n=a.name,2===arguments.length&&(i=arguments[1],o=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),e=""+e,t=""+t,r.isUndefined(n)||(n=""+n);var s=c(this._isDirected,e,t,n);if(r.has(this._edgeLabels,s))return o&&(this._edgeLabels[s]=i),this;if(!r.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[s]=o?i:this._defaultEdgeLabelFn(e,t,n);var u=function(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[s]=u,l(this._preds[t],e),l(this._sucs[e],t),this._in[t][s]=u,this._out[e][s]=u,this._edgeCount++,this},s.prototype.edge=function(e,t,n){var r=1===arguments.length?d(this._isDirected,arguments[0]):c(this._isDirected,e,t,n);return this._edgeLabels[r]},s.prototype.hasEdge=function(e,t,n){var i=1===arguments.length?d(this._isDirected,arguments[0]):c(this._isDirected,e,t,n);return r.has(this._edgeLabels,i)},s.prototype.removeEdge=function(e,t,n){var r=1===arguments.length?d(this._isDirected,arguments[0]):c(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],u(this._preds[t],e),u(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},s.prototype.inEdges=function(e,t){var n=this._in[e];if(n){var i=r.values(n);return t?r.filter(i,(function(e){return e.v===t})):i}},s.prototype.outEdges=function(e,t){var n=this._out[e];if(n){var i=r.values(n);return t?r.filter(i,(function(e){return e.w===t})):i}},s.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},3150:(e,t,n)=>{e.exports={Graph:n(69955),version:n(59127)}},11430:(e,t,n)=>{var r=n(44434),i=n(69955);function o(e){return r.map(e.nodes(),(function(t){var n=e.node(t),i=e.parent(t),o={v:t};return r.isUndefined(n)||(o.value=n),r.isUndefined(i)||(o.parent=i),o}))}function a(e){return r.map(e.edges(),(function(t){var n=e.edge(t),i={v:t.v,w:t.w};return r.isUndefined(t.name)||(i.name=t.name),r.isUndefined(n)||(i.value=n),i}))}e.exports={write:function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:o(e),edges:a(e)};r.isUndefined(e.graph())||(t.value=r.clone(e.graph()));return t},read:function(e){var t=new i(e.options).setGraph(e.value);return r.each(e.nodes,(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)})),r.each(e.edges,(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),t}}},44434:(e,t,n)=>{var r;try{r={clone:n(17953),constant:n(89203),each:n(20678),filter:n(64663),has:n(45346),isArray:n(55589),isEmpty:n(29787),isFunction:n(45563),isUndefined:n(86474),keys:n(62096),map:n(69107),reduce:n(17682),size:n(91039),transform:n(63604),union:n(27767),values:n(31682)}}catch(i){}r||(r=window._),e.exports=r},59127:e=>{e.exports="2.1.8"},97597:(e,t,n)=>{e.exports=n(79127)},79127:function(e,t){var n,r,i;(function(){var o,a,s,l,u,c,d,f,h,p,v,m,g,y,b;s=Math.floor,p=Math.min,a=function(e,t){return et?1:0},h=function(e,t,n,r,i){var o;if(null==n&&(n=0),null==i&&(i=a),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)u.push(t);return u}).apply(this).reverse(),l=[],r=0,i=o.length;rv;0<=v?++c:--c)m.push(u(e,n));return m},y=function(e,t,n,r){var i,o,s;for(null==r&&(r=a),i=e[n];n>t&&r(i,o=e[s=n-1>>1])<0;)e[n]=o,n=s;return e[n]=i},b=function(e,t,n){var r,i,o,s,l;for(null==n&&(n=a),i=e.length,l=t,o=e[t],r=2*t+1;r{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0});var r="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),i="undefined"!=typeof Map,o="undefined"!=typeof Set,a="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,s=r?Symbol.for("immer-nothing"):((n={})["immer-nothing"]=!0,n),l=r?Symbol.for("immer-draftable"):"__$immer_draftable",u=r?Symbol.for("immer-state"):"__$immer_state",c="undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator",d={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return"Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return"Unsupported patch operation: "+e},18:function(e){return"The plugin for '"+e+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+e+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(e){return"produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+e+"'"},22:function(e){return"'current' expects a draft, got: "+e},23:function(e){return"'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"};function f(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3?t.type_-4:t.type_:Array.isArray(e)?1:N(e)?2:k(e)?3:0}function x(e,t){return 2===b(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function w(e,t){return 2===b(e)?e.get(t):e[t]}function _(e,t,n){var r=b(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function E(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function N(e){return i&&e instanceof Map}function k(e){return o&&e instanceof Set}function S(e){return e.copy_||e.base_}function P(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=g(e);delete t[u];for(var n=m(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=T),Object.freeze(e),t&&y(e,(function(e,t){return C(t,!0)}),!0)),e}function T(){f(2)}function j(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}var D,O={};function A(e){var t=O[e];return t||f(18,e),t}function M(e,t){O[e]||(O[e]=t)}function R(){return D||f(0),D}function I(e,t){t&&(A("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function L(e){B(e),e.drafts_.forEach(z),e.drafts_=null}function B(e){e===D&&(D=e.parent_)}function F(e){return D={drafts_:[],parent_:D,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function z(e){var t=e[u];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function V(e,t){t.unfinalizedDrafts_=t.drafts_.length;var n=t.drafts_[0],r=void 0!==e&&e!==n;return t.immer_.useProxies_||A("ES5").willFinalizeES5_(t,e,r),r?(n[u].modified_&&(L(t),f(4)),p(e)&&(e=G(t,e),t.parent_||W(t,e)),t.patches_&&A("Patches").generateReplacementPatches_(n[u].base_,e,t.patches_,t.inversePatches_)):e=G(t,n,[]),L(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==s?e:void 0}function G(e,t,n){if(j(t))return t;var r=t[u];if(!r)return y(t,(function(i,o){return U(e,r,t,i,o,n)}),!0),t;if(r.scope_!==e)return t;if(!r.modified_)return W(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;var i=4===r.type_||5===r.type_?r.copy_=P(r.draft_):r.copy_;y(3===r.type_?new Set(i):i,(function(t,o){return U(e,r,i,t,o,n)})),W(e,i,!1),n&&e.patches_&&A("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function U(e,t,n,r,i,o){if(i===n&&f(5),h(i)){var a=G(e,i,o&&t&&3!==t.type_&&!x(t.assigned_,r)?o.concat(r):void 0);if(_(n,r,a),!h(a))return;e.canAutoFreeze_=!1}if(p(i)&&!j(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;G(e,i),t&&t.scope_.parent_||W(e,i)}}function W(e,t,n){void 0===n&&(n=!1),e.immer_.autoFreeze_&&e.canAutoFreeze_&&C(t,n)}var q={get:function(e,t){if(t===u)return e;var n=S(e);if(!x(n,t))return function(e,t,n){var r,i=X(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.draft_):void 0}(e,n,t);var r=n[t];return e.finalized_||!p(r)?r:r===Y(e.base_,t)?(K(e),e.copy_[t]=Q(e.scope_.immer_,r,e)):r},has:function(e,t){return t in S(e)},ownKeys:function(e){return Reflect.ownKeys(S(e))},set:function(e,t,n){var r=X(S(e),t);if(null==r?void 0:r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){var i=Y(S(e),t),o=null==i?void 0:i[u];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(E(n,i)&&(void 0!==n||x(e.base_,t)))return!0;K(e),$(e)}return e.copy_[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.copy_)||(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==Y(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,K(e),$(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor:function(e,t){var n=S(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){f(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.base_)},setPrototypeOf:function(){f(12)}},H={};function Y(e,t){var n=e[u];return(n?S(n):e)[t]}function X(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function $(e){e.modified_||(e.modified_=!0,e.parent_&&$(e.parent_))}function K(e){e.copy_||(e.copy_=P(e.base_))}y(q,(function(e,t){H[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),H.deleteProperty=function(e,t){return isNaN(parseInt(t))&&f(13),H.set.call(this,e,t,void 0)},H.set=function(e,t,n){return"length"!==t&&isNaN(parseInt(t))&&f(14),q.set.call(this,e[0],t,n,e[0])};var Z=function(){function e(e){var t=this;this.useProxies_=a,this.autoFreeze_=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,a=new Array(r>1?r-1:0),s=1;s1?r-1:0),o=1;o=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var i=A("Patches").applyPatches_;return h(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}();function Q(e,t,n){var r=N(t)?A("MapSet").proxyMap_(t,n):k(t)?A("MapSet").proxySet_(t,n):e.useProxies_?function(e,t){var n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:R(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,o=q;n&&(i=[r],o=H);var a=Proxy.revocable(i,o),s=a.revoke,l=a.proxy;return r.draft_=l,r.revoke_=s,l}(t,n):A("ES5").createES5Proxy_(t,n);return(n?n.scope_:R()).drafts_.push(r),r}function J(e){return h(e)||f(22,e),ee(e)}function ee(e){if(!p(e))return e;var t,n=e[u],r=b(e);if(n){if(!n.modified_&&(n.type_<4||!A("ES5").hasChanges_(n)))return n.base_;n.finalized_=!0,t=te(e,r),n.finalized_=!1}else t=te(e,r);return y(t,(function(e,r){n&&w(n.base_,e)===r||_(t,e,ee(r))})),3===r?new Set(t):t}function te(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return P(e)}function ne(){var e={};function t(t,n){var r=e[t];return r?r.enumerable=n:e[t]=r={configurable:!0,enumerable:n,get:function(){var e=this[u];return a(e),q.get(e,t)},set:function(e){var n=this[u];a(n),q.set(n,t,e)}},r}function n(e){for(var t=e.length-1;t>=0;t--){var n=e[t][u];if(!n.modified_)switch(n.type_){case 5:o(n)&&$(n);break;case 4:i(n)&&$(n)}}}function r(e){if(e&&"object"==typeof e){var t=e[u];if(t){var n=t.base_,i=t.draft_,a=t.assigned_,s=t.type_;if(4===s)y(i,(function(e){e!==u&&(void 0!==n[e]||x(n,e)?a[e]||r(i[e]):(a[e]=!0,$(t)))})),y(n,(function(e){void 0!==i[e]||x(i,e)||(a[e]=!1,$(t))}));else if(5===s){if(o(t)&&($(t),a.length=!0),i.length=0;i--){var o=r[i];if(o!==u){var a=t[o];if(void 0===a&&!x(t,o))return!0;var s=n[o],l=s&&s[u];if(l?l.base_!==a:!E(s,a))return!0}}var c=!!t[u];return r.length!==m(t).length+(c?0:1)}function o(e){var t=e.draft_;if(t.length!==e.base_.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r{"use strict";e.exports=n(86909)},94466:(e,t,n)=>{var r=n(65234)(n(83250),"DataView");e.exports=r},85208:(e,t,n)=>{var r=n(34440),i=n(84108),o=n(61085),a=n(77706),s=n(8636);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(90266),i=n(42875),o=n(45828),a=n(24115),s=n(67690);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(65234)(n(83250),"Map");e.exports=r},95678:(e,t,n)=>{var r=n(39016),i=n(62363),o=n(64348),a=n(53062),s=n(30262);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t{var r=n(65234)(n(83250),"Promise");e.exports=r},56616:(e,t,n)=>{var r=n(65234)(n(83250),"Set");e.exports=r},84546:(e,t,n)=>{var r=n(95678),i=n(83937),o=n(15009);function a(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t{var r=n(81998),i=n(93210),o=n(48603),a=n(38947),s=n(70885),l=n(98938);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=i,u.prototype.delete=o,u.prototype.get=a,u.prototype.has=s,u.prototype.set=l,e.exports=u},70861:(e,t,n)=>{var r=n(83250).Symbol;e.exports=r},3526:(e,t,n)=>{var r=n(83250).Uint8Array;e.exports=r},98001:(e,t,n)=>{var r=n(65234)(n(83250),"WeakMap");e.exports=r},82274:e=>{e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},84004:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n{var r=n(94365);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},99105:e=>{e.exports=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r{var r=n(18509),i=n(79312),o=n(55589),a=n(85778),s=n(5023),l=n(50922),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=o(e),c=!n&&i(e),d=!n&&!c&&a(e),f=!n&&!c&&!d&&l(e),h=n||c||d||f,p=h?r(e.length,String):[],v=p.length;for(var m in e)!t&&!u.call(e,m)||h&&("length"==m||d&&("offset"==m||"parent"==m)||f&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,v))||p.push(m);return p}},29233:e=>{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n{e.exports=function(e,t){for(var n=-1,r=t.length,i=e.length;++n{e.exports=function(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i{e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n{var r=n(86174)("length");e.exports=r},73532:(e,t,n)=>{var r=n(87500),i=n(58260);e.exports=function(e,t,n){(void 0!==n&&!i(e[t],n)||void 0===n&&!(t in e))&&r(e,t,n)}},93192:(e,t,n)=>{var r=n(87500),i=n(58260),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];o.call(e,t)&&i(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},18498:(e,t,n)=>{var r=n(58260);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},44265:(e,t,n)=>{var r=n(78618),i=n(62096);e.exports=function(e,t){return e&&r(t,i(t),e)}},31629:(e,t,n)=>{var r=n(78618),i=n(9882);e.exports=function(e,t){return e&&r(t,i(t),e)}},87500:(e,t,n)=>{var r=n(25595);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},18361:(e,t,n)=>{var r=n(19549),i=n(84004),o=n(93192),a=n(44265),s=n(31629),l=n(46502),u=n(32166),c=n(67272),d=n(52066),f=n(54357),h=n(55713),p=n(87493),v=n(82865),m=n(11908),g=n(84046),y=n(55589),b=n(85778),x=n(37613),w=n(93702),_=n(60693),E=n(62096),N=n(9882),k="[object Arguments]",S="[object Function]",P="[object Object]",C={};C[k]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C[P]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C[S]=C["[object WeakMap]"]=!1,e.exports=function e(t,n,T,j,D,O){var A,M=1&n,R=2&n,I=4&n;if(T&&(A=D?T(t,j,D,O):T(t)),void 0!==A)return A;if(!w(t))return t;var L=y(t);if(L){if(A=v(t),!M)return u(t,A)}else{var B=p(t),F=B==S||"[object GeneratorFunction]"==B;if(b(t))return l(t,M);if(B==P||B==k||F&&!D){if(A=R||F?{}:g(t),!M)return R?d(t,s(A,t)):c(t,a(A,t))}else{if(!C[B])return D?t:{};A=m(t,B,M)}}O||(O=new r);var z=O.get(t);if(z)return z;O.set(t,A),_(t)?t.forEach((function(r){A.add(e(r,n,T,r,t,O))})):x(t)&&t.forEach((function(r,i){A.set(i,e(r,n,T,i,t,O))}));var V=L?void 0:(I?R?h:f:R?N:E)(t);return i(V||t,(function(r,i){V&&(r=t[i=r]),o(A,i,e(r,n,T,i,t,O))})),A}},57890:(e,t,n)=>{var r=n(93702),i=Object.create,o=function(){function e(){}return function(t){if(!r(t))return{};if(i)return i(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=o},61701:(e,t,n)=>{var r=n(44003),i=n(96313)(r);e.exports=i},85117:(e,t,n)=>{var r=n(52624);e.exports=function(e,t,n){for(var i=-1,o=e.length;++i{var r=n(61701);e.exports=function(e,t){var n=[];return r(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}},44770:e=>{e.exports=function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o{var r=n(10111),i=n(67123);e.exports=function e(t,n,o,a,s){var l=-1,u=t.length;for(o||(o=i),s||(s=[]);++l0&&o(c)?n>1?e(c,n-1,o,a,s):r(s,c):a||(s[s.length]=c)}return s}},39943:(e,t,n)=>{var r=n(72545)();e.exports=r},44003:(e,t,n)=>{var r=n(39943),i=n(62096);e.exports=function(e,t){return e&&r(e,t,i)}},40548:(e,t,n)=>{var r=n(24007),i=n(86040);e.exports=function(e,t){for(var n=0,o=(t=r(t,e)).length;null!=e&&n{var r=n(10111),i=n(55589);e.exports=function(e,t,n){var o=t(e);return i(e)?o:r(o,n(e))}},69823:(e,t,n)=>{var r=n(70861),i=n(91339),o=n(25151),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?i(e):o(e)}},51669:e=>{e.exports=function(e,t){return e>t}},32586:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e,n){return null!=e&&t.call(e,n)}},62902:e=>{e.exports=function(e,t){return null!=e&&t in Object(e)}},94365:(e,t,n)=>{var r=n(44770),i=n(56963),o=n(45898);e.exports=function(e,t,n){return t==t?o(e,t,n):r(e,i,n)}},33016:(e,t,n)=>{var r=n(69823),i=n(50440);e.exports=function(e){return i(e)&&"[object Arguments]"==r(e)}},34662:(e,t,n)=>{var r=n(88968),i=n(50440);e.exports=function e(t,n,o,a,s){return t===n||(null==t||null==n||!i(t)&&!i(n)?t!=t&&n!=n:r(t,n,o,a,e,s))}},88968:(e,t,n)=>{var r=n(19549),i=n(14952),o=n(21080),a=n(86524),s=n(87493),l=n(55589),u=n(85778),c=n(50922),d="[object Arguments]",f="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,v,m,g){var y=l(e),b=l(t),x=y?f:s(e),w=b?f:s(t),_=(x=x==d?h:x)==h,E=(w=w==d?h:w)==h,N=x==w;if(N&&u(e)){if(!u(t))return!1;y=!0,_=!1}if(N&&!_)return g||(g=new r),y||c(e)?i(e,t,n,v,m,g):o(e,t,x,n,v,m,g);if(!(1&n)){var k=_&&p.call(e,"__wrapped__"),S=E&&p.call(t,"__wrapped__");if(k||S){var P=k?e.value():e,C=S?t.value():t;return g||(g=new r),m(P,C,n,v,g)}}return!!N&&(g||(g=new r),a(e,t,n,v,m,g))}},52275:(e,t,n)=>{var r=n(87493),i=n(50440);e.exports=function(e){return i(e)&&"[object Map]"==r(e)}},2972:(e,t,n)=>{var r=n(19549),i=n(34662);e.exports=function(e,t,n,o){var a=n.length,s=a,l=!o;if(null==e)return!s;for(e=Object(e);a--;){var u=n[a];if(l&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a{e.exports=function(e){return e!=e}},99817:(e,t,n)=>{var r=n(45563),i=n(28597),o=n(93702),a=n(55784),s=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,c=l.toString,d=u.hasOwnProperty,f=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||i(e))&&(r(e)?f:s).test(a(e))}},7170:(e,t,n)=>{var r=n(87493),i=n(50440);e.exports=function(e){return i(e)&&"[object Set]"==r(e)}},42448:(e,t,n)=>{var r=n(69823),i=n(66052),o=n(50440),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!a[r(e)]}},55833:(e,t,n)=>{var r=n(15640),i=n(9906),o=n(80229),a=n(55589),s=n(94437);e.exports=function(e){return"function"==typeof e?e:null==e?o:"object"==typeof e?a(e)?i(e[0],e[1]):r(e):s(e)}},41351:(e,t,n)=>{var r=n(32840),i=n(82825),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=[];for(var n in Object(e))o.call(e,n)&&"constructor"!=n&&t.push(n);return t}},71309:(e,t,n)=>{var r=n(93702),i=n(32840),o=n(84866),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=i(e),n=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&n.push(s);return n}},46718:e=>{e.exports=function(e,t){return e{var r=n(61701),i=n(30568);e.exports=function(e,t){var n=-1,o=i(e)?Array(e.length):[];return r(e,(function(e,r,i){o[++n]=t(e,r,i)})),o}},15640:(e,t,n)=>{var r=n(2972),i=n(72198),o=n(94656);e.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?o(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},9906:(e,t,n)=>{var r=n(34662),i=n(13546),o=n(56708),a=n(5130),s=n(18802),l=n(94656),u=n(86040);e.exports=function(e,t){return a(e)&&s(t)?l(u(e),t):function(n){var a=i(n,e);return void 0===a&&a===t?o(n,e):r(t,a,3)}}},92133:(e,t,n)=>{var r=n(19549),i=n(73532),o=n(39943),a=n(21241),s=n(93702),l=n(9882),u=n(11933);e.exports=function e(t,n,c,d,f){t!==n&&o(n,(function(o,l){if(f||(f=new r),s(o))a(t,n,l,c,e,d,f);else{var h=d?d(u(t,l),o,l+"",t,n,f):void 0;void 0===h&&(h=o),i(t,l,h)}}),l)}},21241:(e,t,n)=>{var r=n(73532),i=n(46502),o=n(21327),a=n(32166),s=n(84046),l=n(79312),u=n(55589),c=n(18268),d=n(85778),f=n(45563),h=n(93702),p=n(54256),v=n(50922),m=n(11933),g=n(36222);e.exports=function(e,t,n,y,b,x,w){var _=m(e,n),E=m(t,n),N=w.get(E);if(N)r(e,n,N);else{var k=x?x(_,E,n+"",e,t,w):void 0,S=void 0===k;if(S){var P=u(E),C=!P&&d(E),T=!P&&!C&&v(E);k=E,P||C||T?u(_)?k=_:c(_)?k=a(_):C?(S=!1,k=i(E,!0)):T?(S=!1,k=o(E,!0)):k=[]:p(E)||l(E)?(k=_,l(_)?k=g(_):h(_)&&!f(_)||(k=s(E))):S=!1}S&&(w.set(E,k),b(k,E,y,x,w),w.delete(E)),r(e,n,k)}}},54466:(e,t,n)=>{var r=n(29233),i=n(40548),o=n(55833),a=n(78068),s=n(53340),l=n(31525),u=n(20315),c=n(80229),d=n(55589);e.exports=function(e,t,n){t=t.length?r(t,(function(e){return d(e)?function(t){return i(t,1===e.length?e[0]:e)}:e})):[c];var f=-1;t=r(t,l(o));var h=a(e,(function(e,n,i){return{criteria:r(t,(function(t){return t(e)})),index:++f,value:e}}));return s(h,(function(e,t){return u(e,t,n)}))}},21785:(e,t,n)=>{var r=n(57121),i=n(56708);e.exports=function(e,t){return r(e,t,(function(t,n){return i(e,n)}))}},57121:(e,t,n)=>{var r=n(40548),i=n(32619),o=n(24007);e.exports=function(e,t,n){for(var a=-1,s=t.length,l={};++a{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},3293:(e,t,n)=>{var r=n(40548);e.exports=function(e){return function(t){return r(t,e)}}},24930:e=>{var t=Math.ceil,n=Math.max;e.exports=function(e,r,i,o){for(var a=-1,s=n(t((r-e)/(i||1)),0),l=Array(s);s--;)l[o?s:++a]=e,e+=i;return l}},34306:e=>{e.exports=function(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}},29735:(e,t,n)=>{var r=n(80229),i=n(20340),o=n(4173);e.exports=function(e,t){return o(i(e,t,r),e+"")}},32619:(e,t,n)=>{var r=n(93192),i=n(24007),o=n(5023),a=n(93702),s=n(86040);e.exports=function(e,t,n,l){if(!a(e))return e;for(var u=-1,c=(t=i(t,e)).length,d=c-1,f=e;null!=f&&++u{var r=n(89203),i=n(25595),o=n(80229),a=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:o;e.exports=a},53340:e=>{e.exports=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}},18509:e=>{e.exports=function(e,t){for(var n=-1,r=Array(e);++n{var r=n(70861),i=n(29233),o=n(55589),a=n(52624),s=r?r.prototype:void 0,l=s?s.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return i(t,e)+"";if(a(t))return l?l.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n}},21656:(e,t,n)=>{var r=n(62438),i=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(i,""):e}},31525:e=>{e.exports=function(e){return function(t){return e(t)}}},80135:(e,t,n)=>{var r=n(84546),i=n(45436),o=n(99105),a=n(77026),s=n(86262),l=n(77969);e.exports=function(e,t,n){var u=-1,c=i,d=e.length,f=!0,h=[],p=h;if(n)f=!1,c=o;else if(d>=200){var v=t?null:s(e);if(v)return l(v);f=!1,c=a,p=new r}else p=t?[]:h;e:for(;++u{var r=n(29233);e.exports=function(e,t){return r(t,(function(t){return e[t]}))}},36302:e=>{e.exports=function(e,t,n){for(var r=-1,i=e.length,o=t.length,a={};++r{e.exports=function(e,t){return e.has(t)}},84781:(e,t,n)=>{var r=n(80229);e.exports=function(e){return"function"==typeof e?e:r}},24007:(e,t,n)=>{var r=n(55589),i=n(5130),o=n(44041),a=n(99835);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:o(a(e))}},72962:(e,t,n)=>{var r=n(3526);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},46502:(e,t,n)=>{e=n.nmd(e);var r=n(83250),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i?r.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}},97037:(e,t,n)=>{var r=n(72962);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},3429:e=>{var t=/\w*$/;e.exports=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}},99349:(e,t,n)=>{var r=n(70861),i=r?r.prototype:void 0,o=i?i.valueOf:void 0;e.exports=function(e){return o?Object(o.call(e)):{}}},21327:(e,t,n)=>{var r=n(72962);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},88899:(e,t,n)=>{var r=n(52624);e.exports=function(e,t){if(e!==t){var n=void 0!==e,i=null===e,o=e==e,a=r(e),s=void 0!==t,l=null===t,u=t==t,c=r(t);if(!l&&!c&&!a&&e>t||a&&s&&u&&!l&&!c||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!c&&e{var r=n(88899);e.exports=function(e,t,n){for(var i=-1,o=e.criteria,a=t.criteria,s=o.length,l=n.length;++i=l?u:u*("desc"==n[i]?-1:1)}return e.index-t.index}},32166:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n{var r=n(93192),i=n(87500);e.exports=function(e,t,n,o){var a=!n;n||(n={});for(var s=-1,l=t.length;++s{var r=n(78618),i=n(44450);e.exports=function(e,t){return r(e,i(e),t)}},52066:(e,t,n)=>{var r=n(78618),i=n(94969);e.exports=function(e,t){return r(e,i(e),t)}},1622:(e,t,n)=>{var r=n(83250)["__core-js_shared__"];e.exports=r},66948:(e,t,n)=>{var r=n(29735),i=n(98132);e.exports=function(e){return r((function(t,n){var r=-1,o=n.length,a=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,s&&i(n[0],n[1],s)&&(a=o<3?void 0:a,o=1),t=Object(t);++r{var r=n(30568);e.exports=function(e,t){return function(n,i){if(null==n)return n;if(!r(n))return e(n,i);for(var o=n.length,a=t?o:-1,s=Object(n);(t?a--:++a{e.exports=function(e){return function(t,n,r){for(var i=-1,o=Object(t),a=r(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===n(o[l],l,o))break}return t}}},29301:(e,t,n)=>{var r=n(55833),i=n(30568),o=n(62096);e.exports=function(e){return function(t,n,a){var s=Object(t);if(!i(t)){var l=r(n,3);t=o(t),n=function(e){return l(s[e],e,s)}}var u=e(t,n,a);return u>-1?s[l?t[u]:u]:void 0}}},51523:(e,t,n)=>{var r=n(24930),i=n(98132),o=n(99558);e.exports=function(e){return function(t,n,a){return a&&"number"!=typeof a&&i(t,n,a)&&(n=a=void 0),t=o(t),void 0===n?(n=t,t=0):n=o(n),a=void 0===a?t{var r=n(56616),i=n(71607),o=n(77969),a=r&&1/o(new r([,-0]))[1]==1/0?function(e){return new r(e)}:i;e.exports=a},25595:(e,t,n)=>{var r=n(65234),i=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();e.exports=i},14952:(e,t,n)=>{var r=n(84546),i=n(1831),o=n(77026);e.exports=function(e,t,n,a,s,l){var u=1&n,c=e.length,d=t.length;if(c!=d&&!(u&&d>c))return!1;var f=l.get(e),h=l.get(t);if(f&&h)return f==t&&h==e;var p=-1,v=!0,m=2&n?new r:void 0;for(l.set(e,t),l.set(t,e);++p{var r=n(70861),i=n(3526),o=n(58260),a=n(14952),s=n(81140),l=n(77969),u=r?r.prototype:void 0,c=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,d,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new i(e),new i(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=s;case"[object Set]":var p=1&r;if(h||(h=l),e.size!=t.size&&!p)return!1;var v=f.get(e);if(v)return v==t;r|=2,f.set(e,t);var m=a(h(e),h(t),r,u,d,f);return f.delete(e),m;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}},86524:(e,t,n)=>{var r=n(54357),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,o,a,s){var l=1&n,u=r(e),c=u.length;if(c!=r(t).length&&!l)return!1;for(var d=c;d--;){var f=u[d];if(!(l?f in t:i.call(t,f)))return!1}var h=s.get(e),p=s.get(t);if(h&&p)return h==t&&p==e;var v=!0;s.set(e,t),s.set(t,e);for(var m=l;++d{var r=n(62923),i=n(20340),o=n(4173);e.exports=function(e){return o(i(e,void 0,r),e+"")}},20302:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},54357:(e,t,n)=>{var r=n(4468),i=n(44450),o=n(62096);e.exports=function(e){return r(e,o,i)}},55713:(e,t,n)=>{var r=n(4468),i=n(94969),o=n(9882);e.exports=function(e){return r(e,o,i)}},77570:(e,t,n)=>{var r=n(58949);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},72198:(e,t,n)=>{var r=n(18802),i=n(62096);e.exports=function(e){for(var t=i(e),n=t.length;n--;){var o=t[n],a=e[o];t[n]=[o,a,r(a)]}return t}},65234:(e,t,n)=>{var r=n(99817),i=n(67736);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},18490:(e,t,n)=>{var r=n(33540)(Object.getPrototypeOf,Object);e.exports=r},91339:(e,t,n)=>{var r=n(70861),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(l){}var i=a.call(e);return r&&(t?e[s]=n:delete e[s]),i}},44450:(e,t,n)=>{var r=n(82493),i=n(84506),o=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(e){return null==e?[]:(e=Object(e),r(a(e),(function(t){return o.call(e,t)})))}:i;e.exports=s},94969:(e,t,n)=>{var r=n(10111),i=n(18490),o=n(44450),a=n(84506),s=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,o(e)),e=i(e);return t}:a;e.exports=s},87493:(e,t,n)=>{var r=n(94466),i=n(72887),o=n(95747),a=n(56616),s=n(98001),l=n(69823),u=n(55784),c="[object Map]",d="[object Promise]",f="[object Set]",h="[object WeakMap]",p="[object DataView]",v=u(r),m=u(i),g=u(o),y=u(a),b=u(s),x=l;(r&&x(new r(new ArrayBuffer(1)))!=p||i&&x(new i)!=c||o&&x(o.resolve())!=d||a&&x(new a)!=f||s&&x(new s)!=h)&&(x=function(e){var t=l(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case v:return p;case m:return c;case g:return d;case y:return f;case b:return h}return t}),e.exports=x},67736:e=>{e.exports=function(e,t){return null==e?void 0:e[t]}},13544:(e,t,n)=>{var r=n(24007),i=n(79312),o=n(55589),a=n(5023),s=n(66052),l=n(86040);e.exports=function(e,t,n){for(var u=-1,c=(t=r(t,e)).length,d=!1;++u{var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return t.test(e)}},34440:(e,t,n)=>{var r=n(24545);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},84108:e=>{e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},61085:(e,t,n)=>{var r=n(24545),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(t,e)?t[e]:void 0}},77706:(e,t,n)=>{var r=n(24545),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:i.call(t,e)}},8636:(e,t,n)=>{var r=n(24545);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},82865:e=>{var t=Object.prototype.hasOwnProperty;e.exports=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},11908:(e,t,n)=>{var r=n(72962),i=n(97037),o=n(3429),a=n(99349),s=n(21327);e.exports=function(e,t,n){var l=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new l(+e);case"[object DataView]":return i(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(e,n);case"[object Map]":case"[object Set]":return new l;case"[object Number]":case"[object String]":return new l(e);case"[object RegExp]":return o(e);case"[object Symbol]":return a(e)}}},84046:(e,t,n)=>{var r=n(57890),i=n(18490),o=n(32840);e.exports=function(e){return"function"!=typeof e.constructor||o(e)?{}:r(i(e))}},67123:(e,t,n)=>{var r=n(70861),i=n(79312),o=n(55589),a=r?r.isConcatSpreadable:void 0;e.exports=function(e){return o(e)||i(e)||!!(a&&e&&e[a])}},5023:e=>{var t=/^(?:0|[1-9]\d*)$/;e.exports=function(e,n){var r=typeof e;return!!(n=n??9007199254740991)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e{var r=n(58260),i=n(30568),o=n(5023),a=n(93702);e.exports=function(e,t,n){if(!a(n))return!1;var s=typeof t;return!!("number"==s?i(n)&&o(t,n.length):"string"==s&&t in n)&&r(n[t],e)}},5130:(e,t,n)=>{var r=n(55589),i=n(52624),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(a.test(e)||!o.test(e)||null!=t&&e in Object(t))}},58949:e=>{e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},28597:(e,t,n)=>{var r,i=n(1622),o=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!o&&o in e}},32840:e=>{var t=Object.prototype;e.exports=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}},18802:(e,t,n)=>{var r=n(93702);e.exports=function(e){return e==e&&!r(e)}},90266:e=>{e.exports=function(){this.__data__=[],this.size=0}},42875:(e,t,n)=>{var r=n(18498),i=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():i.call(t,n,1),--this.size,!0)}},45828:(e,t,n)=>{var r=n(18498);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},24115:(e,t,n)=>{var r=n(18498);e.exports=function(e){return r(this.__data__,e)>-1}},67690:(e,t,n)=>{var r=n(18498);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}},39016:(e,t,n)=>{var r=n(85208),i=n(81998),o=n(72887);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||i),string:new r}}},62363:(e,t,n)=>{var r=n(77570);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},64348:(e,t,n)=>{var r=n(77570);e.exports=function(e){return r(this,e).get(e)}},53062:(e,t,n)=>{var r=n(77570);e.exports=function(e){return r(this,e).has(e)}},30262:(e,t,n)=>{var r=n(77570);e.exports=function(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}},81140:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},94656:e=>{e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},32924:(e,t,n)=>{var r=n(67997);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},24545:(e,t,n)=>{var r=n(65234)(Object,"create");e.exports=r},82825:(e,t,n)=>{var r=n(33540)(Object.keys,Object);e.exports=r},84866:e=>{e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},8690:(e,t,n)=>{e=n.nmd(e);var r=n(20302),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,a=o&&o.exports===i&&r.process,s=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(t){}}();e.exports=s},25151:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},33540:e=>{e.exports=function(e,t){return function(n){return e(t(n))}}},20340:(e,t,n)=>{var r=n(82274),i=Math.max;e.exports=function(e,t,n){return t=i(void 0===t?e.length-1:t,0),function(){for(var o=arguments,a=-1,s=i(o.length-t,0),l=Array(s);++a{var r=n(20302),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},11933:e=>{e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},83937:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},15009:e=>{e.exports=function(e){return this.__data__.has(e)}},77969:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},4173:(e,t,n)=>{var r=n(46739),i=n(37357)(r);e.exports=i},37357:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var i=t(),o=16-(i-r);if(r=i,o>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},93210:(e,t,n)=>{var r=n(81998);e.exports=function(){this.__data__=new r,this.size=0}},48603:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},38947:e=>{e.exports=function(e){return this.__data__.get(e)}},70885:e=>{e.exports=function(e){return this.__data__.has(e)}},98938:(e,t,n)=>{var r=n(81998),i=n(72887),o=n(95678);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!i||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new o(a)}return n.set(e,t),this.size=n.size,this}},45898:e=>{e.exports=function(e,t,n){for(var r=n-1,i=e.length;++r