@abi-software/map-side-bar 2.4.2-beta.7 → 2.4.2-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -490,12 +490,13 @@ Licensed under The MIT License (http://opensource.org/licenses/MIT)
490
490
  */var y3=function(e,t){this.recycle(e,t)};function Qc(){return!1}function Qf(){return!0}y3.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Qc,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Qf:Qc):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*r+a.x,y:n.y*r+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Qf;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Qf;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Qf,this.stopPropagation()},isDefaultPrevented:Qc,isPropagationStopped:Qc,isImmediatePropagationStopped:Qc};var v3=/^([^.]+)(\.(?:[^.]+))?$/,gse=".*",b3={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},w3=Object.keys(b3),yse={};function ep(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yse,t=arguments.length>1?arguments[1]:void 0,n=0;n<w3.length;n++){var r=w3[n];this[r]=e[r]||b3[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Ma=ep.prototype,x3=function(e,t,n,r,a,i,s){Ft(r)&&(a=r,r=null),s&&(i==null?i=s:i=He({},i,s));for(var l=mt(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!Oa(c)){var d=c.match(v3);if(d){var f=d[1],h=d[2]?d[2]:null,m=t(e,c,f,h,r,a,i);if(m===!1)break}}}},k3=function(e,t){return e.addEventFields(e.context,t),new y3(t.type,t)},vse=function(e,t,n){if(Rte(n)){t(e,n);return}else if(ot(n)){t(e,k3(e,n));return}for(var r=mt(n)?n:n.split(/\s+/),a=0;a<r.length;a++){var i=r[a];if(!Oa(i)){var s=i.match(v3);if(s){var l=s[1],u=s[2]?s[2]:null,c=k3(e,{type:l,namespace:u,target:e.context});t(e,c)}}}};Ma.on=Ma.addListener=function(e,t,n,r,a){return x3(this,function(i,s,l,u,c,d,f){Ft(d)&&i.listeners.push({event:s,callback:d,type:l,namespace:u,qualifier:c,conf:f})},e,t,n,r,a),this},Ma.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Ma.removeListener=Ma.off=function(e,t,n,r){var a=this;this.emitting!==0&&(this.listeners=Wne(this.listeners));for(var i=this.listeners,s=function(u){var c=i[u];x3(a,function(d,f,h,m,p,g){if((c.type===h||e==="*")&&(!m&&c.namespace!==".*"||c.namespace===m)&&(!p||d.qualifierCompare(c.qualifier,p))&&(!g||c.callback===g))return i.splice(u,1),!1},e,t,n,r)},l=i.length-1;l>=0;l--)s(l);return this},Ma.removeAllListeners=function(){return this.removeListener("*")},Ma.emit=Ma.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,mt(t)||(t=[t]),vse(this,function(i,s){n!=null&&(r=[{event:s.event,type:s.type,namespace:s.namespace,callback:n}],a=r.length);for(var l=function(c){var d=r[c];if(d.type===s.type&&(!d.namespace||d.namespace===s.namespace||d.namespace===gse)&&i.eventMatches(i.context,d,s)){var f=[s];t!=null&&Xne(f,t),i.beforeEmit(i.context,d,s),d.conf&&d.conf.one&&(i.listeners=i.listeners.filter(function(p){return p!==d}));var h=i.callbackContext(i.context,d,s),m=d.callback.apply(h,f);i.afterEmit(i.context,d,s),m===!1&&(s.stopPropagation(),s.preventDefault())}},u=0;u<a;u++)l(u);i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,t)},e),this.emitting--,this};var bse={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&Pc(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},tp=function(e){return Ve(e)?new Ia(e):e},C3={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new ep(bse,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=tp(t),a=0;a<this.length;a++){var i=this[a];i.emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=tp(t),a=0;a<this.length;a++){var i=this[a];i.emitter().removeListener(e,r,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,n){for(var r=tp(t),a=0;a<this.length;a++){var i=this[a];i.emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=tp(t),a=0;a<this.length;a++){var i=this[a];i.emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var r=this[n];r.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};dt.eventAliasesOn(C3);var E3={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(Ve(e)||ur(e))return new Ia(e).filter(this);if(Ft(e)){for(var n=this.spawn(),r=this,a=0;a<r.length;a++){var i=r[a],s=t?e.apply(t,[i,a,r]):e(i,a,r);s&&n.push(i)}return n}return this.spawn()},not:function(e){if(e){Ve(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n],a=e.has(r);a||t.push(r)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Ve(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,a=e,i=this.length<e.length,s=i?r:a,l=i?a:r,u=0;u<s.length;u++){var c=s[u];l.has(c)&&n.push(c)}return n},xor:function(e){var t=this._private.cy;Ve(e)&&(e=t.$(e));var n=this.spawn(),r=this,a=e,i=function(s,l){for(var u=0;u<s.length;u++){var c=s[u],d=c._private.data.id,f=l.hasElementWithId(d);f||n.push(c)}};return i(r,a),i(a,r),n},diff:function(e){var t=this._private.cy;Ve(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),a=this.spawn(),i=this,s=e,l=function(u,c,d){for(var f=0;f<u.length;f++){var h=u[f],m=h._private.data.id,p=c.hasElementWithId(m);p?a.merge(h):d.push(h)}};return l(i,s,n),l(s,i,r),{left:n,right:r,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(Ve(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),a=0;a<e.length;a++){var i=e[a],s=!this.has(i);s&&r.push(i)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&Ve(e)){var r=e;e=n.mutableElements().filter(r)}for(var a=t.map,i=0;i<e.length;i++){var s=e[i],l=s._private.data.id,u=!a.has(l);if(u){var c=this.length++;this[c]=s,a.set(l,{ele:s,index:c})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),r=this._private,a=r.map;this[e]=void 0,a.delete(n);var i=e===this.length-1;if(this.length>1&&!i){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[e]=l,a.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map,a=r.get(n);if(!a)return this;var i=a.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&Ve(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,a=0;a<r.length;a++){var i=r[a],s=t?e.apply(t,[i,a,r]):e(i,a,r);n.push(s)}return n},reduce:function(e,t){for(var n=t,r=this,a=0;a<r.length;a++)n=e(n,r[a],a,r);return n},max:function(e,t){for(var n=-1/0,r,a=this,i=0;i<a.length;i++){var s=a[i],l=t?e.apply(t,[s,i,a]):e(s,i,a);l>n&&(n=l,r=s)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,a=this,i=0;i<a.length;i++){var s=a[i],l=t?e.apply(t,[s,i,a]):e(s,i,a);l<n&&(n=l,r=s)}return{value:n,ele:r}}},it=E3;it.u=it["|"]=it["+"]=it.union=it.or=it.add,it["\\"]=it["!"]=it["-"]=it.difference=it.relativeComplement=it.subtract=it.not,it.n=it["&"]=it["."]=it.and=it.intersection=it.intersect,it["^"]=it["(+)"]=it["(-)"]=it.symmetricDifference=it.symdiff=it.xor,it.fnFilter=it.filterFn=it.stdFilter=it.filter,it.complement=it.abscomp=it.absoluteComplement;var wse={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},S3=function(e,t){var n=e.cy(),r=n.hasCompoundNodes();function a(c){var d=c.pstyle("z-compound-depth");return d.value==="auto"?r?c.zDepth():0:d.value==="bottom"?-1:d.value==="top"?C0:0}var i=a(e)-a(t);if(i!==0)return i;function s(c){var d=c.pstyle("z-index-compare");return d.value==="auto"&&c.isNode()?1:0}var l=s(e)-s(t);if(l!==0)return l;var u=e.pstyle("z-index").value-t.pstyle("z-index").value;return u!==0?u:e.poolIndex()-t.poolIndex()},np={forEach:function(e,t){if(Ft(e))for(var n=this.length,r=0;r<n;r++){var a=this[r],i=t?e.apply(t,[a,r,this]):e(a,r,this);if(i===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t==null&&(t=r),e==null&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var a=e;a>=0&&a<t&&a<r;a++)n.push(this[a]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Ft(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(S3)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if(n==="nodes"){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:C0-1}else{var a=t.source,i=t.target,s=a.zDepth(),l=i.zDepth();return Math.max(s,l,0)}}}};np.each=np.forEach;var xse=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":en(Symbol))!=e&&en(Symbol.iterator)!=e;t&&(np[Symbol.iterator]=function(){var n=this,r={value:void 0,done:!1},a=0,i=this.length;return RS({next:function(){return a<i?r.value=n[a++]:(r.value=void 0,r.done=!0),r}},Symbol.iterator,function(){return this})})};xse();var kse=gn({nodeDimensionsIncludeLabels:!1}),rp={layoutDimensions:function(e){e=kse(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(w){return!w.isParent()}),a=this.cy(),i=t.eles,s=function(w){return w.id()},l=Ac(n,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(w,C,k){var E={x:C.x1+C.w/2,y:C.y1+C.h/2},S={x:(k.x-E.x)*w,y:(k.y-E.y)*w};return{x:E.x+S.x,y:E.y+S.y}},c=t.spacingFactor&&t.spacingFactor!==1,d=function(){if(!c)return null;for(var w=er(),C=0;C<r.length;C++){var k=r[C],E=l(k,C);Cre(w,E.x,E.y)}return w},f=d(),h=Ac(function(w,C){var k=l(w,C);if(c){var E=Math.abs(t.spacingFactor);k=u(E,f,k)}return t.transform!=null&&(k=t.transform(w,k)),k},s);if(t.animate){for(var m=0;m<r.length;m++){var p=r[m],g=h(p,m),v=t.animateFilter==null||t.animateFilter(p,m);if(v){var y=p.animation({position:g,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else p.position(g)}if(t.fit){var b=a.animation({fit:{boundingBox:i.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}else if(t.zoom!==void 0&&t.pan!==void 0){var x=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}e.animations.forEach(function(w){return w.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),qs.all(e.animations.map(function(w){return w.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(h),t.fit&&a.fit(t.eles,t.padding),t.zoom!=null&&a.zoom(t.zoom),t.pan&&a.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(He({},e,{eles:this}))}};rp.createLayout=rp.makeLayout=rp.layout;function _3(e,t,n){var r=n._private,a=r.styleCache=r.styleCache||[],i;return(i=a[e])!=null||(i=a[e]=t(n)),i}function op(e,t){return e=_i(e),function(n){return _3(e,t,n)}}function ap(e,t){e=_i(e);var n=function(r){return t.call(r)};return function(){var r=this[0];if(r)return _3(e,n,r)}}var yn={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(r){return r._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(r){t(r),r.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var r=t.hasCompoundNodes(),a=this;e=!!(e||e===void 0),r&&(a=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=a;return e?i.emitAndNotify("style"):i.emit("style"),a.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return a??(t?r.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(ot(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(Ve(e))if(t===void 0){var s=this[0];return s?a.getStylePropertyValue(s,e):void 0}else a.applyBypass(this,e,t,r),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?a.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(e===void 0)for(var i=0;i<a.length;i++){var s=a[i];r.removeAllBypasses(s,n)}else{e=e.split(/\s+/);for(var l=0;l<a.length;l++){var u=a[l];r.removeBypasses(u,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,a=n.pstyle("opacity").value;if(!t)return a;var i=r.data.parent?n.parents():null;if(i)for(var s=0;s<i.length;s++){var l=i[s],u=l.pstyle("opacity").value;a=u*a}return a}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();if(t)return n?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function W0(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var a=0;a<r.length;a++){var i=r[a];if(!t(i))return!1}return!0}function G0(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],s=a.hasCompoundNodes();if(i){var l=i._private;if(!t(i))return!1;if(i.isNode())return!s||W0(i,r);var u=l.source,c=l.target;return n(u)&&(!s||W0(u,n))&&(u===c||n(c)&&(!s||W0(c,n)))}}}var Qs=op("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});yn.takesUpSpace=ap("takesUpSpace",G0({ok:Qs}));var Cse=op("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&Qs(e)}),Ese=op("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&Qs(e)});yn.interactive=ap("interactive",G0({ok:Cse,parentOk:Ese,edgeOkViaNode:Qs})),yn.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var Sse=op("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&Qs(e)}),_se=Qs;yn.visible=ap("visible",G0({ok:Sse,edgeOkViaNode:_se})),yn.hidden=function(){var e=this[0];if(e)return!e.visible()},yn.isBundledBezier=ap("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),yn.bypass=yn.css=yn.style,yn.renderedCss=yn.renderedStyle,yn.removeBypass=yn.removeCss=yn.removeStyle,yn.pstyle=yn.parsedStyle;var Va={};function B3(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(t.length===1&&Ft(t[0])){var i=t[0];this.on(e.event,i)}else if(t.length===0||t.length===1&&mt(t[0])){for(var s=t.length===1?t[0]:null,l=0;l<this.length;l++){var u=this[l],c=!e.ableField||u._private[e.ableField],d=u._private[e.field]!=e.value;if(e.overrideAble){var f=e.overrideAble(u);if(f!==void 0&&(c=f,!f))return this}c&&(u._private[e.field]=e.value,d&&n.push(u))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),s&&h.emit(s)}return this}}function el(e){Va[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},Va[e.on]=B3({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),Va[e.off]=B3({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}el({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),el({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),el({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),el({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),Va.deselect=Va.unselect,Va.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},el({field:"active",on:"activate",off:"unactivate"}),el({field:"pannable",on:"panify",off:"unpanify"}),Va.inactive=function(){var e=this[0];if(e)return!e._private.active};var _n={},T3=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var i=n[a];if(i.isNode()){for(var s=!1,l=i.connectedEdges(),u=0;u<l.length;u++){var c=l[u],d=c.source(),f=c.target();if(e.noIncomingEdges&&f===i&&d!==i||e.noOutgoingEdges&&d===i&&f!==i){s=!0;break}}s||r.push(i)}}return this.spawn(r,!0).filter(t)}},O3=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var i=n[a];if(i.isNode())for(var s=i.connectedEdges(),l=0;l<s.length;l++){var u=s[l],c=u.source(),d=u.target();e.outgoing&&c===i?(r.push(u),r.push(d)):e.incoming&&d===i&&(r.push(u),r.push(c))}}return this.spawn(r,!0).filter(t)}},N3=function(e){return function(t){for(var n=this,r=[],a={};;){var i=e.outgoing?n.outgoers():n.incomers();if(i.length===0)break;for(var s=!1,l=0;l<i.length;l++){var u=i[l],c=u.id();a[c]||(a[c]=!0,r.push(u),s=!0)}if(!s)break;n=i}return this.spawn(r,!0).filter(t)}};_n.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},He(_n,{roots:T3({noIncomingEdges:!0}),leaves:T3({noOutgoingEdges:!0}),outgoers:Or(O3({outgoing:!0}),"outgoers"),successors:N3({outgoing:!0}),incomers:Or(O3({incoming:!0}),"incomers"),predecessors:N3({incoming:!0})}),He(_n,{neighborhood:Or(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],i=a.connectedEdges(),s=0;s<i.length;s++){var l=i[s],u=l.source(),c=l.target(),d=a===u?c:u;d.length>0&&t.push(d[0]),t.push(l[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)}}),_n.neighbourhood=_n.neighborhood,_n.closedNeighbourhood=_n.closedNeighborhood,_n.openNeighbourhood=_n.openNeighborhood,He(_n,{source:Or(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:Or(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:$3({attr:"source"}),targets:$3({attr:"target"})});function $3(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r],i=a._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}He(_n,{edgesWith:Or(F3(),"edgesWith"),edgesTo:Or(F3({thisIsSrc:!0}),"edgesTo")});function F3(e){return function(t){var n=[],r=this._private.cy,a=e||{};Ve(t)&&(t=r.$(t));for(var i=0;i<t.length;i++)for(var s=t[i]._private.edges,l=0;l<s.length;l++){var u=s[l],c=u._private.data,d=this.hasElementWithId(c.source)&&t.hasElementWithId(c.target),f=t.hasElementWithId(c.source)&&this.hasElementWithId(c.target),h=d||f;h&&((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!d||a.thisIsTgt&&!f)||n.push(u))}return this.spawn(n,!0)}}He(_n,{connectedEdges:Or(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];if(a.isNode())for(var i=a._private.edges,s=0;s<i.length;s++){var l=i[s];t.push(l)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:Or(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];a.isEdge()&&(t.push(a.source()[0]),t.push(a.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:Or(P3(),"parallelEdges"),codirectedEdges:Or(P3({codirected:!0}),"codirectedEdges")});function P3(e){var t={codirected:!1};return e=He({},t,e),function(n){for(var r=[],a=this.edges(),i=e,s=0;s<a.length;s++)for(var l=a[s],u=l._private,c=u.source,d=c._private.data.id,f=u.data.target,h=c._private.edges,m=0;m<h.length;m++){var p=h[m],g=p._private.data,v=g.target,y=g.source,b=v===f&&y===d,x=d===v&&f===y;(i.codirected&&b||!i.codirected&&(b||x))&&r.push(p)}return this.spawn(r,!0).filter(n)}}He(_n,{components:function(e){var t=this,n=t.cy(),r=n.collection(),a=e==null?t.nodes():e.nodes(),i=[];e!=null&&a.empty()&&(a=e.sources());var s=function(u,c){r.merge(u),a.unmerge(u),c.merge(u)};if(a.empty())return t.spawn();var l=function(){var u=n.collection();i.push(u);var c=a[0];s(c,u),t.bfs({directed:!1,roots:c,visit:function(d){return s(d,u)}}),u.forEach(function(d){d.connectedEdges().forEach(function(f){t.has(f)&&u.has(f.source())&&u.has(f.target())&&u.merge(f)})})};do l();while(a.length>0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),_n.componentsOf=_n.components;var vn=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){It("A collection must have a reference to the core");return}var a=new go,i=!1;if(!t)t=[];else if(t.length>0&&ot(t[0])&&!Pc(t[0])){i=!0;for(var s=[],l=new Rs,u=0,c=t.length;u<c;u++){var d=t[u];d.data==null&&(d.data={});var f=d.data;if(f.id==null)f.id=u5();else if(e.hasElementWithId(f.id)||l.has(f.id))continue;var h=new Af(e,d,!1);s.push(h),l.add(f.id)}t=s}this.length=0;for(var m=0,p=t.length;m<p;m++){var g=t[m][0];if(g!=null){var v=g._private.data.id;(!n||!a.has(v))&&(n&&a.set(v,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(y){this.lazyMap=y},rebuildMap:function(){for(var y=this.lazyMap=new go,b=this.eles,x=0;x<b.length;x++){var w=b[x];y.set(w.id(),{index:x,ele:w})}}},n&&(this._private.map=a),i&&!r&&this.restore()},wt=Af.prototype=vn.prototype=Object.create(Array.prototype);wt.instanceString=function(){return"collection"},wt.spawn=function(e,t){return new vn(this.cy(),e,t)},wt.spawnSelf=function(){return this.spawn(this)},wt.cy=function(){return this._private.cy},wt.renderer=function(){return this._private.cy.renderer()},wt.element=function(){return this[0]},wt.collection=function(){return US(this)?this:new vn(this._private.cy,[this])},wt.unique=function(){return new vn(this._private.cy,this,!0)},wt.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},wt.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new vn(t)},wt.$id=wt.getElementById,wt.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).index},wt.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},wt.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},wt.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(ot(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.data;if(t.isEdge()){var i=!1,s={},l=e.data.source,u=e.data.target;l!=null&&l!=a.source&&(s.source=""+l,i=!0),u!=null&&u!=a.target&&(s.target=""+u,i=!0),i&&(t=t.move(s))}else{var c="parent"in e.data,d=e.data.parent;c&&(d!=null||a.parent!=null)&&d!=a.parent&&(d===void 0&&(d=null),d!=null&&(d=""+d),t=t.move({parent:d}))}}e.position&&t.position(e.position);var f=function(p,g,v){var y=e[p];y!=null&&y!==r[p]&&(y?t[g]():t[v]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var h={data:mo(r.data),position:mo(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var m=0;return r.classes.forEach(function(p){return h.classes+=m++===0?p:" "+p}),h}}},wt.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e},wt.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],a=r.json(),i=new Af(e,a,!1);t.push(i)}return new vn(e,t)},wt.copy=wt.clone,wt.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),a=r._private,i=[],s=[],l,u=0,c=n.length;u<c;u++){var d=n[u];t&&!d.removed()||(d.isNode()?i.push(d):s.push(d))}l=i.concat(s);var f,h=function(){l.splice(f,1),f--};for(f=0;f<l.length;f++){var m=l[f],p=m._private,g=p.data;if(m.clearTraversalCache(),!(!t&&!p.removed)){if(g.id===void 0)g.id=u5();else if(Ee(g.id))g.id=""+g.id;else if(Oa(g.id)||!Ve(g.id)){It("Can not create element with invalid string ID `"+g.id+"`"),h();continue}else if(r.hasElementWithId(g.id)){It("Can not create second element with ID `"+g.id+"`"),h();continue}}var v=g.id;if(m.isNode()){var y=p.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(m.isEdge()){for(var b=m,x=["source","target"],w=x.length,C=!1,k=0;k<w;k++){var E=x[k],S=g[E];Ee(S)&&(S=g[E]=""+g[E]),S==null||S===""?(It("Can not create edge `"+v+"` with unspecified "+E),C=!0):r.hasElementWithId(S)||(It("Can not create edge `"+v+"` with nonexistant "+E+" `"+S+"`"),C=!0)}if(C){h();continue}var _=r.getElementById(g.source),N=r.getElementById(g.target);_.same(N)?_._private.edges.push(b):(_._private.edges.push(b),N._private.edges.push(b)),b._private.source=_,b._private.target=N}p.map=new go,p.map.set(v,{ele:m,index:0}),p.removed=!1,t&&r.addToPool(m)}for(var T=0;T<i.length;T++){var O=i[T],P=O._private.data;Ee(P.parent)&&(P.parent=""+P.parent);var F=P.parent,D=F!=null;if(D||O._private.parent){var $=O._private.parent?r.collection().merge(O._private.parent):r.getElementById(F);if($.empty())P.parent=void 0;else if($[0].removed())ut("Node added with missing parent, reference to parent removed"),P.parent=void 0,O._private.parent=null;else{for(var L=!1,I=$;!I.empty();){if(O.same(I)){L=!0,P.parent=void 0;break}I=I.parent()}L||($[0]._private.children.push(O),O._private.parent=$[0],a.hasCompoundNodes=!0)}}}if(l.length>0){for(var z=l.length===n.length?n:new vn(r,l),G=0;G<z.length;G++){var q=z[G];q.isNode()||(q.parallelEdges().clearTraversalCache(),q.source().clearTraversalCache(),q.target().clearTraversalCache())}var X;a.hasCompoundNodes?X=r.collection().merge(z).merge(z.connectedNodes()).merge(z.parent()):X=z,X.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?z.emitAndNotify("add"):t&&z.emit("add")}return n},wt.removed=function(){var e=this[0];return e&&e._private.removed},wt.inside=function(){var e=this[0];return e&&!e._private.removed},wt.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],a={},i=n._private.cy;function s(F){for(var D=F._private.edges,$=0;$<D.length;$++)u(D[$])}function l(F){for(var D=F._private.children,$=0;$<D.length;$++)u(D[$])}function u(F){var D=a[F.id()];t&&F.removed()||D||(a[F.id()]=!0,F.isNode()?(r.push(F),s(F),l(F)):r.unshift(F))}for(var c=0,d=n.length;c<d;c++){var f=n[c];u(f)}function h(F,D){var $=F._private.edges;$a($,D),F.clearTraversalCache()}function m(F){F.clearTraversalCache()}var p=[];p.ids={};function g(F,D){D=D[0],F=F[0];var $=F._private.children,L=F.id();$a($,D),D._private.parent=null,p.ids[L]||(p.ids[L]=!0,p.push(F))}n.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var v=0;v<r.length;v++){var y=r[v];if(y.isEdge()){var b=y.source()[0],x=y.target()[0];h(b,y),h(x,y);for(var w=y.parallelEdges(),C=0;C<w.length;C++){var k=w[C];m(k),k.isBundledBezier()&&k.dirtyBoundingBoxCache()}}else{var E=y.parent();E.length!==0&&g(E,y)}t&&(y._private.removed=!0)}var S=i._private.elements;i._private.hasCompoundNodes=!1;for(var _=0;_<S.length;_++){var N=S[_];if(N.isParent()){i._private.hasCompoundNodes=!0;break}}var T=new vn(this.cy(),r);T.size()>0&&(e?T.emitAndNotify("remove"):t&&T.emit("remove"));for(var O=0;O<p.length;O++){var P=p[O];(!t||!P.removed())&&P.updateStyle()}return T},wt.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,i=function(m){return m==null?m:""+m};if(e.source!==void 0||e.target!==void 0){var s=i(e.source),l=i(e.target),u=s!=null&&t.hasElementWithId(s),c=l!=null&&t.hasElementWithId(l);(u||c)&&(t.batch(function(){n.remove(r,a),n.emitAndNotify("moveout");for(var m=0;m<n.length;m++){var p=n[m],g=p._private.data;p.isEdge()&&(u&&(g.source=s),c&&(g.target=l))}n.restore(r,a)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var d=i(e.parent),f=d===null||t.hasElementWithId(d);if(f){var h=d===null?void 0:d;t.batch(function(){var m=n.remove(r,a);m.emitAndNotify("moveout");for(var p=0;p<n.length;p++){var g=n[p],v=g._private.data;g.isNode()&&(v.parent=h)}m.restore(r,a)}),n.emitAndNotify("move")}}return this},[L5,Lie,Yf,La,Ys,Qie,Zf,mse,C3,E3,wse,np,rp,yn,Va,_n].forEach(function(e){He(wt,e)});var Bse={add:function(e){var t,n=this;if(ur(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var a=[],i=0;i<r.length;i++){var s=r[i];a.push(s.json())}t=new vn(n,a)}}else if(mt(e)){var l=e;t=new vn(n,l)}else if(ot(e)&&(mt(e.nodes)||mt(e.edges))){for(var u=e,c=[],d=["nodes","edges"],f=0,h=d.length;f<h;f++){var m=d[f],p=u[m];if(mt(p))for(var g=0,v=p.length;g<v;g++){var y=He({group:m},p[g]);c.push(y)}}t=new vn(n,c)}else{var b=e;t=new Af(n,b).collection()}return t},remove:function(e){if(!ur(e)&&Ve(e)){var t=e;e=this.$(t)}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function Tse(e,t,n,r){var a=4,i=.001,s=1e-7,l=10,u=11,c=1/(u-1),d=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=d?new Float32Array(u):new Array(u);function m(N,T){return 1-3*T+3*N}function p(N,T){return 3*T-6*N}function g(N){return 3*N}function v(N,T,O){return((m(T,O)*N+p(T,O))*N+g(T))*N}function y(N,T,O){return 3*m(T,O)*N*N+2*p(T,O)*N+g(T)}function b(N,T){for(var O=0;O<a;++O){var P=y(T,e,n);if(P===0)return T;var F=v(T,e,n)-N;T-=F/P}return T}function x(){for(var N=0;N<u;++N)h[N]=v(N*c,e,n)}function w(N,T,O){var P,F,D=0;do F=T+(O-T)/2,P=v(F,e,n)-N,P>0?O=F:T=F;while(Math.abs(P)>s&&++D<l);return F}function C(N){for(var T=0,O=1,P=u-1;O!==P&&h[O]<=N;++O)T+=c;--O;var F=(N-h[O])/(h[O+1]-h[O]),D=T+F*c,$=y(D,e,n);return $>=i?b(N,D):$===0?D:w(N,T,T+c)}var k=!1;function E(){k=!0,(e!==t||n!==r)&&x()}var S=function(N){return k||E(),e===t&&n===r?N:N===0?0:N===1?1:v(C(N),t,r)};S.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var _="generateBezier("+[e,t,n,r]+")";return S.toString=function(){return _},S}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Ose=function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,i){var s={x:r.x+i.dx*a,v:r.v+i.dv*a,tension:r.tension,friction:r.friction};return{dx:s.v,dv:e(s)}}function n(r,a){var i={dx:r.v,dv:e(r)},s=t(r,a*.5,i),l=t(r,a*.5,s),u=t(r,a,l),c=1/6*(i.dx+2*(s.dx+l.dx)+u.dx),d=1/6*(i.dv+2*(s.dv+l.dv)+u.dv);return r.x=r.x+c*a,r.v=r.v+d*a,r}return function r(a,i,s){var l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1/1e4,f=16/1e3,h,m,p;for(a=parseFloat(a)||500,i=parseFloat(i)||20,s=s||null,l.tension=a,l.friction=i,h=s!==null,h?(c=r(a,i),m=c/s*f):m=f;p=n(p||l,m),u.push(1+p.x),c+=16,Math.abs(p.x)>d&&Math.abs(p.v)>d;);return h?function(g){return u[g*(u.length-1)|0]}:c}}(),xt=function(e,t,n,r){var a=Tse(e,t,n,r);return function(i,s,l){return i+(s-i)*a(l)}},ip={linear:function(e,t,n){return e+(t-e)*n},ease:xt(.25,.1,.25,1),"ease-in":xt(.42,0,1,1),"ease-out":xt(0,0,.58,1),"ease-in-out":xt(.42,0,.58,1),"ease-in-sine":xt(.47,0,.745,.715),"ease-out-sine":xt(.39,.575,.565,1),"ease-in-out-sine":xt(.445,.05,.55,.95),"ease-in-quad":xt(.55,.085,.68,.53),"ease-out-quad":xt(.25,.46,.45,.94),"ease-in-out-quad":xt(.455,.03,.515,.955),"ease-in-cubic":xt(.55,.055,.675,.19),"ease-out-cubic":xt(.215,.61,.355,1),"ease-in-out-cubic":xt(.645,.045,.355,1),"ease-in-quart":xt(.895,.03,.685,.22),"ease-out-quart":xt(.165,.84,.44,1),"ease-in-out-quart":xt(.77,0,.175,1),"ease-in-quint":xt(.755,.05,.855,.06),"ease-out-quint":xt(.23,1,.32,1),"ease-in-out-quint":xt(.86,0,.07,1),"ease-in-expo":xt(.95,.05,.795,.035),"ease-out-expo":xt(.19,1,.22,1),"ease-in-out-expo":xt(1,0,0,1),"ease-in-circ":xt(.6,.04,.98,.335),"ease-out-circ":xt(.075,.82,.165,1),"ease-in-out-circ":xt(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return ip.linear;var r=Ose(e,t,n);return function(a,i,s){return a+(i-a)*r(s)}},"cubic-bezier":xt};function A3(e,t,n,r,a){if(r===1||t===n)return n;var i=a(t,n,r);return e==null||((e.roundValue||e.color)&&(i=Math.round(i)),e.min!==void 0&&(i=Math.max(i,e.min)),e.max!==void 0&&(i=Math.min(i,e.max))),i}function I3(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function tl(e,t,n,r,a){var i=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var s=I3(e,a),l=I3(t,a);if(Ee(s)&&Ee(l))return A3(i,s,l,n,r);if(mt(s)&&mt(l)){for(var u=[],c=0;c<l.length;c++){var d=s[c],f=l[c];if(d!=null&&f!=null){var h=A3(i,d,f,n,r);u.push(h)}else u.push(f)}return u}}function Nse(e,t,n,r){var a=!r,i=e._private,s=t._private,l=s.easing,u=s.startTime,c=r?e:e.cy(),d=c.style();if(!s.easingImpl)if(l==null)s.easingImpl=ip.linear;else{var f;if(Ve(l)){var h=d.parse("transition-timing-function",l);f=h.value}else f=l;var m,p;Ve(f)?(m=f,p=[]):(m=f[1],p=f.slice(2).map(function(z){return+z})),p.length>0?(m==="spring"&&p.push(s.duration),s.easingImpl=ip[m].apply(null,p)):s.easingImpl=ip[m]}var g=s.easingImpl,v;if(s.duration===0?v=1:v=(n-u)/s.duration,s.applying&&(v=s.progress),v<0?v=0:v>1&&(v=1),s.delay==null){var y=s.startPosition,b=s.position;if(b&&a&&!e.locked()){var x={};eu(y.x,b.x)&&(x.x=tl(y.x,b.x,v,g)),eu(y.y,b.y)&&(x.y=tl(y.y,b.y,v,g)),e.position(x)}var w=s.startPan,C=s.pan,k=i.pan,E=C!=null&&r;E&&(eu(w.x,C.x)&&(k.x=tl(w.x,C.x,v,g)),eu(w.y,C.y)&&(k.y=tl(w.y,C.y,v,g)),e.emit("pan"));var S=s.startZoom,_=s.zoom,N=_!=null&&r;N&&(eu(S,_)&&(i.zoom=Hc(i.minZoom,tl(S,_,v,g),i.maxZoom)),e.emit("zoom")),(E||N)&&e.emit("viewport");var T=s.style;if(T&&T.length>0&&a){for(var O=0;O<T.length;O++){var P=T[O],F=P.name,D=P,$=s.startStyle[F],L=d.properties[$.name],I=tl($,D,v,g,L);d.overrideBypass(e,F,I)}e.emit("style")}}return s.progress=v,v}function eu(e,t){return e==null||t==null?!1:Ee(e)&&Ee(t)?!0:!!(e&&t)}function $se(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function D3(e,t){var n=t._private.aniEles,r=[];function a(d,f){var h=d._private,m=h.animation.current,p=h.animation.queue,g=!1;if(m.length===0){var v=p.shift();v&&m.push(v)}for(var y=function(C){for(var k=C.length-1;k>=0;k--){var E=C[k];E()}C.splice(0,C.length)},b=m.length-1;b>=0;b--){var x=m[b],w=x._private;if(w.stopped){m.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,y(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||$se(d,x,e),Nse(d,x,e,f),w.applying&&(w.applying=!1),y(w.frames),w.step!=null&&w.step(e),x.completed()&&(m.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,y(w.completes)),g=!0)}return!f&&m.length===0&&p.length===0&&r.push(d),g}for(var i=!1,s=0;s<n.length;s++){var l=n[s],u=a(l);i=i||u}var c=a(t,!0);(i||c)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Fse={animate:dt.animate(),animation:dt.animation(),animated:dt.animated(),clearQueue:dt.clearQueue(),delay:dt.delay(),delayAnimation:dt.delayAnimation(),stop:dt.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&$f(function(r){D3(r,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(r,a){D3(a,e)},n.beforeRenderPriorities.animations):t()}},Pse={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&Pc(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},sp=function(e){return Ve(e)?new Ia(e):e},L3={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new ep(Pse,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,sp(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,sp(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,sp(t),n),this},once:function(e,t,n){return this.emitter().one(e,sp(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}};dt.eventAliasesOn(L3);var X0={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};X0.jpeg=X0.jpg;var lp={layout:function(e){var t=this;if(e==null){It("Layout options must be specified to make a layout");return}if(e.name==null){It("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension("layout",n);if(r==null){It("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;Ve(e.eles)?a=t.$(e.eles):a=e.eles!=null?e.eles:t.$();var i=new r(He({},e,{cy:t,eles:a}));return i}};lp.createLayout=lp.makeLayout=lp.layout;var Ase={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();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?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 e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){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;r<n.length;r++){var a=n[r],i=e[a],s=t.getElementById(a);s.data(i)}})}},Ise=gn({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Y0={renderTo:function(e,t,n,r){var a=this._private.renderer;return a.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(n==null){It("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&ut("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=Ise(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Y0.invalidateDimensions=Y0.resize;var cp={collection:function(e,t){return Ve(e)?this.$(e):ur(e)?e.collection():mt(e)?(t||(t={}),new vn(this,e,t.unique,t.removed)):new vn(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.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}};cp.elements=cp.filter=cp.$;var Bn={},tu="t",Dse="f";Bn.apply=function(e){for(var t=this,n=t._private,r=n.cy,a=r.collection(),i=0;i<e.length;i++){var s=e[i],l=t.getContextMeta(s);if(!l.empty){var u=t.getContextStyle(l),c=t.applyContextStyle(l,u,s);s._private.appliedInitStyle?t.updateTransitions(s,c.diffProps):s._private.appliedInitStyle=!0;var d=t.updateStyleHints(s);d&&a.push(s)}}return a},Bn.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,i=r[a];if(i)return i;for(var s=[],l={},u=0;u<n.length;u++){var c=n[u],d=e[u]===tu,f=t[u]===tu,h=d!==f,m=c.mappedProperties.length>0;if(h||f&&m){var p=void 0;h&&m||h?p=c.properties:m&&(p=c.mappedProperties);for(var g=0;g<p.length;g++){for(var v=p[g],y=v.name,b=!1,x=u+1;x<n.length;x++){var w=n[x],C=t[x]===tu;if(C&&(b=w.properties[v.name]!=null,b))break}!l[y]&&!b&&(l[y]=!0,s.push(y))}}}return r[a]=s,s},Bn.getContextMeta=function(e){for(var t=this,n="",r,a=e._private.styleCxtKey||"",i=0;i<t.length;i++){var s=t[i],l=s.selector&&s.selector.matches(e);l?n+=tu:n+=Dse}return r=t.getPropertiesDiff(a,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},Bn.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var a={_private:{key:t}},i=0;i<n.length;i++){var s=n[i],l=t[i]===tu;if(l)for(var u=0;u<s.properties.length;u++){var c=s.properties[u];a[c.name]=c}}return r[t]=a,a},Bn.applyContextStyle=function(e,t,n){for(var r=this,a=e.diffPropNames,i={},s=r.types,l=0;l<a.length;l++){var u=a[l],c=t[u],d=n.pstyle(u);if(!c)if(d)d.bypass?c={name:u,deleteBypassed:!0}:c={name:u,delete:!0};else continue;if(d!==c){if(c.mapped===s.fn&&d!=null&&d.mapping!=null&&d.mapping.value===c.value){var f=d.mapping,h=f.fnValue=c.value(n);if(h===f.prevFnValue)continue}var m=i[u]={prev:d};r.applyParsedProperty(n,c),m.next=n.pstyle(u),m.next&&m.next.bypass&&(m.next=m.next.bypassed)}}return{diffProps:i}},Bn.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(Z,de,be){return n.getPropertiesHash(Z,de,be)},s=t.styleKey;if(e.removed())return!1;var l=t.group==="nodes",u=e._private.style;r=Object.keys(u);for(var c=0;c<a.length;c++){var d=a[c];t.styleKeys[d]=[Ls,Rc]}for(var f=function(Z,de){return t.styleKeys[de][0]=Mc(Z,t.styleKeys[de][0])},h=function(Z,de){return t.styleKeys[de][1]=Vc(Z,t.styleKeys[de][1])},m=function(Z,de){f(Z,de),h(Z,de)},p=function(Z,de){for(var be=0;be<Z.length;be++){var Be=Z.charCodeAt(be);f(Be,de),h(Be,de)}},g=2e9,v=function(Z){return-128<Z&&Z<128&&Math.floor(Z)!==Z?g-(Z*1024|0):Z},y=0;y<r.length;y++){var b=r[y],x=u[b];if(x!=null){var w=this.properties[b],C=w.type,k=w.groupKey,E=void 0;w.hashOverride!=null?E=w.hashOverride(e,x):x.pfValue!=null&&(E=x.pfValue);var S=w.enums==null?x.value:null,_=E!=null,N=S!=null,T=_||N,O=x.units;if(C.number&&T&&!C.multiple){var P=_?E:S;m(v(P),k),!_&&O!=null&&p(O,k)}else p(x.strValue,k)}}for(var F=[Ls,Rc],D=0;D<a.length;D++){var $=a[D],L=t.styleKeys[$];F[0]=Mc(L[0],F[0]),F[1]=Vc(L[1],F[1])}t.styleKey=zne(F[0],F[1]);var I=t.styleKeys;t.labelDimsKey=Na(I.labelDimensions);var z=i(e,["label"],I.labelDimensions);if(t.labelKey=Na(z),t.labelStyleKey=Na(Ff(I.commonLabel,z)),!l){var G=i(e,["source-label"],I.labelDimensions);t.sourceLabelKey=Na(G),t.sourceLabelStyleKey=Na(Ff(I.commonLabel,G));var q=i(e,["target-label"],I.labelDimensions);t.targetLabelKey=Na(q),t.targetLabelStyleKey=Na(Ff(I.commonLabel,q))}if(l){var X=t.styleKeys,te=X.nodeBody,le=X.nodeBorder,ue=X.nodeOutline,ne=X.backgroundImage,oe=X.compound,U=X.pie,K=[te,le,ue,ne,oe,U].filter(function(Z){return Z!=null}).reduce(Ff,[Ls,Rc]);t.nodeKey=Na(K),t.hasPie=U!=null&&U[0]!==Ls&&U[1]!==Rc}return s!==t.styleKey},Bn.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},Bn.applyParsedProperty=function(e,t){var n=this,r=t,a=e._private.style,i,s=n.types,l=n.properties[r.name].type,u=r.bypass,c=a[r.name],d=c&&c.bypass,f=e._private,h="mapping",m=function(X){return X==null?null:X.pfValue!=null?X.pfValue:X.value},p=function(){var X=m(c),te=m(r);n.checkTriggers(e,r.name,X,te)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",u)),r.delete)return a[r.name]=void 0,p(),!0;if(r.deleteBypassed)return c?c.bypass?(c.bypassed=void 0,p(),!0):!1:(p(),!0);if(r.deleteBypass)return c?c.bypass?(a[r.name]=c.bypassed,p(),!0):!1:(p(),!0);var g=function(){ut("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case s.mapData:{for(var v=r.field.split("."),y=f.data,b=0;b<v.length&&y;b++){var x=v[b];y=y[x]}if(y==null)return g(),!1;var w;if(Ee(y)){var C=r.fieldMax-r.fieldMin;C===0?w=0:w=(y-r.fieldMin)/C}else return ut("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+y+"` for `"+e.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),l.color){var k=r.valueMin[0],E=r.valueMax[0],S=r.valueMin[1],_=r.valueMax[1],N=r.valueMin[2],T=r.valueMax[2],O=r.valueMin[3]==null?1:r.valueMin[3],P=r.valueMax[3]==null?1:r.valueMax[3],F=[Math.round(k+(E-k)*w),Math.round(S+(_-S)*w),Math.round(N+(T-N)*w),Math.round(O+(P-O)*w)];i={bypass:r.bypass,name:r.name,value:F,strValue:"rgb("+F[0]+", "+F[1]+", "+F[2]+")"}}else if(l.number){var D=r.valueMin+(r.valueMax-r.valueMin)*w;i=this.parse(r.name,D,r.bypass,h)}else return!1;if(!i)return g(),!1;i.mapping=r,r=i;break}case s.data:{for(var $=r.field.split("."),L=f.data,I=0;I<$.length&&L;I++){var z=$[I];L=L[z]}if(L!=null&&(i=this.parse(r.name,L,r.bypass,h)),!i)return g(),!1;i.mapping=r,r=i;break}case s.fn:{var G=r.value,q=r.fnValue!=null?r.fnValue:G(e);if(r.prevFnValue=q,q==null)return ut("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(i=this.parse(r.name,q,r.bypass,h),!i)return ut("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;i.mapping=mo(r),r=i;break}case void 0:break;default:return!1}return u?(d?r.bypassed=c.bypassed:r.bypassed=c,a[r.name]=r):d?c.bypassed=r:a[r.name]=r,p(),!0},Bn.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var a=r._private.style,i=Object.keys(a),s=0;s<i.length;s++){var l=i[s],u=a[l];u!=null&&(u.bypass?u.bypassed=null:a[l]=null)}}},Bn.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()},Bn.updateTransitions=function(e,t){var n=this,r=e._private,a=e.pstyle("transition-property").value,i=e.pstyle("transition-duration").pfValue,s=e.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var l={},u=!1,c=0;c<a.length;c++){var d=a[c],f=e.pstyle(d),h=t[d];if(h){var m=h.prev,p=m,g=h.next!=null?h.next:f,v=!1,y=void 0,b=1e-6;p&&(Ee(p.pfValue)&&Ee(g.pfValue)?(v=g.pfValue-p.pfValue,y=p.pfValue+b*v):Ee(p.value)&&Ee(g.value)?(v=g.value-p.value,y=p.value+b*v):mt(p.value)&&mt(g.value)&&(v=p.value[0]!==g.value[0]||p.value[1]!==g.value[1]||p.value[2]!==g.value[2],y=p.strValue),v&&(l[d]=g.strValue,this.applyBypass(e,d,y),u=!0))}}if(!u)return;r.transitioning=!0,new qs(function(x){s>0?e.delayAnimation(s).play().promise().then(x):x()}).then(function(){return e.animation({style:l,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},Bn.checkTrigger=function(e,t,n,r,a,i){var s=this.properties[t],l=a(s);l!=null&&l(n,r)&&i(s)},Bn.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},Bn.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),a.triggersBoundsOfParallelBeziers&&t==="curve-style"&&(n==="bezier"||r==="bezier")&&e.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),a.triggersBoundsOfConnectedEdges&&t==="display"&&(n==="none"||r==="none")&&e.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},Bn.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var nu={};nu.applyBypass=function(e,t,n,r){var a=this,i=[],s=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var l=0;l<a.properties.length;l++){var u=a.properties[l],c=u.name,d=this.parse(c,n,!0);d&&i.push(d)}}else if(Ve(t)){var f=this.parse(t,n,!0);f&&i.push(f)}else if(ot(t)){var h=t;r=n;for(var m=Object.keys(h),p=0;p<m.length;p++){var g=m[p],v=h[g];if(v===void 0&&(v=h[Tf(g)]),v!==void 0){var y=this.parse(g,v,!0);y&&i.push(y)}}}else return!1;if(i.length===0)return!1;for(var b=!1,x=0;x<e.length;x++){for(var w=e[x],C={},k=void 0,E=0;E<i.length;E++){var S=i[E];if(r){var _=w.pstyle(S.name);k=C[S.name]={prev:_}}b=this.applyParsedProperty(w,mo(S))||b,r&&(k.next=w.pstyle(S.name))}b&&this.updateStyleHints(w),r&&this.updateTransitions(w,C,s)}return b},nu.overrideBypass=function(e,t,n){t=w0(t);for(var r=0;r<e.length;r++){var a=e[r],i=a._private.style[t],s=this.properties[t].type,l=s.color,u=s.mutiple,c=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(a,t,n):(i.value=n,i.pfValue!=null&&(i.pfValue=n),l?i.strValue="rgb("+n.join(",")+")":u?i.strValue=n.join(" "):i.strValue=""+n,this.updateStyleHints(a)),this.checkTriggers(a,t,c,n)}},nu.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},nu.removeBypasses=function(e,t,n){for(var r=!0,a=0;a<e.length;a++){for(var i=e[a],s={},l=0;l<t.length;l++){var u=t[l],c=this.properties[u],d=i.pstyle(c.name);if(!(!d||!d.bypass)){var f="",h=this.parse(u,f,!0),m=s[c.name]={prev:d};this.applyParsedProperty(i,h),m.next=i.pstyle(c.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,s,r)}};var Z0={};Z0.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1},Z0.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var yo={};yo.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},yo.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],s=n.getStylePropertyValue(e,i.name,t);s!=null&&(r[i.name]=s,r[Tf(i.name)]=s)}return r}},yo.getIndexedStyle=function(e,t,n,r){var a=e.pstyle(t)[n][r];return a??e.cy().style().getDefaultProperty(t)[n][0]},yo.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var a=r.properties[t];a.alias&&(a=a.pointsTo);var i=a.type,s=e.pstyle(a.name);if(s){var l=s.value,u=s.units,c=s.strValue;if(n&&i.number&&l!=null&&Ee(l)){var d=e.cy().zoom(),f=function(g){return g*d},h=function(g,v){return f(g)+v},m=mt(l),p=m?u.every(function(g){return g!=null}):u!=null;return p?m?l.map(function(g,v){return h(g,u[v])}).join(" "):h(l,u):m?l.map(function(g){return Ve(g)?g:""+f(g)}).join(" "):""+f(l)}else if(c!=null)return c}return null}},yo.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r],i=a.name,s=e.pstyle(i);s!==void 0&&(ot(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(n[i]=s)}return n},yo.getPropsList=function(e){var t=this,n=[],r=e,a=t.properties;if(r)for(var i=Object.keys(r),s=0;s<i.length;s++){var l=i[s],u=r[l],c=a[l]||a[w0(l)],d=this.parse(c.name,u);d&&n.push(d)}return n},yo.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),a,i,s,l,u,c;for(u=0;u<t.length;u++)if(a=t[u],i=e.pstyle(a,!1),i!=null)if(i.pfValue!=null)r[0]=Mc(l,r[0]),r[1]=Vc(l,r[1]);else for(s=i.strValue,c=0;c<s.length;c++)l=s.charCodeAt(c),r[0]=Mc(l,r[0]),r[1]=Vc(l,r[1]);return r},yo.getPropertiesHash=yo.getNonDefaultPropertiesHash;var up={};up.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,i=r.style||r.css,s=Object.keys(i);t.selector(a);for(var l=0;l<s.length;l++){var u=s[l],c=i[u];t.css(u,c)}}return t},up.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},up.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,i={},s=0;s<a.length;s++){var l=a[s];i[l.name]=l.strValue}e.push({selector:r?r.toString():"core",style:i})}return e};var J0={};J0.appendFromString=function(e){var t=this,n=this,r=""+e,a,i,s;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function l(){r.length>a.length?r=r.substr(a.length):r=""}function u(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var c=r.match(/^\s*$/);if(c)break;var d=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){ut("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}a=d[0];var f=d[1];if(f!=="core"){var h=new Ia(f);if(h.invalid){ut("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),l();continue}}var m=d[2],p=!1;i=m;for(var g=[];;){var v=i.match(/^\s*$/);if(v)break;var y=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){ut("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+m),p=!0;break}s=y[0];var b=y[1],x=y[2],w=t.properties[b];if(!w){ut("Skipping property: Invalid property name in: "+s),u();continue}var C=n.parse(b,x);if(!C){ut("Skipping property: Invalid property definition in: "+s),u();continue}g.push({name:b,val:x}),u()}if(p){l();break}n.selector(f);for(var k=0;k<g.length;k++){var E=g[k];n.css(E.name,E.val)}l()}return n},J0.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var bn={};(function(){var e=nn,t=Ute,n=Kte,r=Wte,a=Gte,i=function(U){return"^"+U+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(U){var K=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+a;return"^"+U+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+K+")\\s*\\,\\s*("+K+")\\)$"},l=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];bn.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:l,singleRegexMatchValue:!0},urls:{regexes:l,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(U,K){switch(U.length){case 2:return K[0]!=="deg"&&K[0]!=="rad"&&K[1]!=="deg"&&K[1]!=="rad";case 1:return Ve(U[0])||K[0]==="deg"||K[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(U){var K=U.length;return K===1||K===2||K===4}}};var u={zeroNonZero:function(U,K){return(U==null||K==null)&&U!==K||U==0&&K!=0?!0:U!=0&&K==0},any:function(U,K){return U!=K},emptyNonEmpty:function(U,K){var Z=Oa(U),de=Oa(K);return Z&&!de||!Z&&de}},c=bn.types,d=[{name:"label",type:c.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any}],f=[{name:"source-label",type:c.text,triggersBounds:u.any},{name:"source-text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:c.size,triggersBounds:u.any}],h=[{name:"target-label",type:c.text,triggersBounds:u.any},{name:"target-text-rotation",type:c.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:c.size,triggersBounds:u.any}],m=[{name:"font-family",type:c.fontFamily,triggersBounds:u.any},{name:"font-style",type:c.fontStyle,triggersBounds:u.any},{name:"font-weight",type:c.fontWeight,triggersBounds:u.any},{name:"font-size",type:c.size,triggersBounds:u.any},{name:"text-transform",type:c.textTransform,triggersBounds:u.any},{name:"text-wrap",type:c.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:c.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:c.size,triggersBounds:u.any},{name:"text-outline-width",type:c.size,triggersBounds:u.any},{name:"line-height",type:c.positiveNumber,triggersBounds:u.any}],p=[{name:"text-valign",type:c.valign,triggersBounds:u.any},{name:"text-halign",type:c.halign,triggersBounds:u.any},{name:"color",type:c.color},{name:"text-outline-color",type:c.color},{name:"text-outline-opacity",type:c.zeroOneNumber},{name:"text-background-color",type:c.color},{name:"text-background-opacity",type:c.zeroOneNumber},{name:"text-background-padding",type:c.size,triggersBounds:u.any},{name:"text-border-opacity",type:c.zeroOneNumber},{name:"text-border-color",type:c.color},{name:"text-border-width",type:c.size,triggersBounds:u.any},{name:"text-border-style",type:c.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:c.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:c.justification}],g=[{name:"events",type:c.bool,triggersZOrder:u.any},{name:"text-events",type:c.bool,triggersZOrder:u.any}],v=[{name:"display",type:c.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:c.visibility,triggersZOrder:u.any},{name:"opacity",type:c.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:c.zeroOneNumber},{name:"min-zoomed-font-size",type:c.size},{name:"z-compound-depth",type:c.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:c.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:c.number,triggersZOrder:u.any}],y=[{name:"overlay-padding",type:c.size,triggersBounds:u.any},{name:"overlay-color",type:c.color},{name:"overlay-opacity",type:c.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:c.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:c.cornerRadius}],b=[{name:"underlay-padding",type:c.size,triggersBounds:u.any},{name:"underlay-color",type:c.color},{name:"underlay-opacity",type:c.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:c.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:c.cornerRadius}],x=[{name:"transition-property",type:c.propList},{name:"transition-duration",type:c.time},{name:"transition-delay",type:c.time},{name:"transition-timing-function",type:c.easing}],w=function(U,K){return K.value==="label"?-U.poolIndex():K.pfValue},C=[{name:"height",type:c.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"width",type:c.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"shape",type:c.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:c.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:c.cornerRadius},{name:"background-color",type:c.color},{name:"background-fill",type:c.fill},{name:"background-opacity",type:c.zeroOneNumber},{name:"background-blacken",type:c.nOneOneNumber},{name:"background-gradient-stop-colors",type:c.colors},{name:"background-gradient-stop-positions",type:c.percentages},{name:"background-gradient-direction",type:c.gradientDirection},{name:"padding",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:c.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:c.boundsExpansion,triggersBounds:u.any}],k=[{name:"border-color",type:c.color},{name:"border-opacity",type:c.zeroOneNumber},{name:"border-width",type:c.size,triggersBounds:u.any},{name:"border-style",type:c.borderStyle},{name:"border-cap",type:c.lineCap},{name:"border-join",type:c.lineJoin},{name:"border-dash-pattern",type:c.numbers},{name:"border-dash-offset",type:c.number},{name:"border-position",type:c.linePosition}],E=[{name:"outline-color",type:c.color},{name:"outline-opacity",type:c.zeroOneNumber},{name:"outline-width",type:c.size,triggersBounds:u.any},{name:"outline-style",type:c.borderStyle},{name:"outline-offset",type:c.size,triggersBounds:u.any}],S=[{name:"background-image",type:c.urls},{name:"background-image-crossorigin",type:c.bgCrossOrigin},{name:"background-image-opacity",type:c.zeroOneNumbers},{name:"background-image-containment",type:c.bgContainment},{name:"background-image-smoothing",type:c.bools},{name:"background-position-x",type:c.bgPos},{name:"background-position-y",type:c.bgPos},{name:"background-width-relative-to",type:c.bgRelativeTo},{name:"background-height-relative-to",type:c.bgRelativeTo},{name:"background-repeat",type:c.bgRepeat},{name:"background-fit",type:c.bgFit},{name:"background-clip",type:c.bgClip},{name:"background-width",type:c.bgWH},{name:"background-height",type:c.bgWH},{name:"background-offset-x",type:c.bgPos},{name:"background-offset-y",type:c.bgPos}],_=[{name:"position",type:c.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:c.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:c.size,triggersBounds:u.any},{name:"min-width-bias-left",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:c.size,triggersBounds:u.any},{name:"min-height-bias-top",type:c.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:c.sizeMaybePercent,triggersBounds:u.any}],N=[{name:"line-style",type:c.lineStyle},{name:"line-color",type:c.color},{name:"line-fill",type:c.fill},{name:"line-cap",type:c.lineCap},{name:"line-opacity",type:c.zeroOneNumber},{name:"line-dash-pattern",type:c.numbers},{name:"line-dash-offset",type:c.number},{name:"line-outline-width",type:c.size},{name:"line-outline-color",type:c.color},{name:"line-gradient-stop-colors",type:c.colors},{name:"line-gradient-stop-positions",type:c.percentages},{name:"curve-style",type:c.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:c.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:c.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:c.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:c.size,triggersBounds:u.any},{name:"control-point-distances",type:c.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:c.numbers,triggersBounds:u.any},{name:"segment-distances",type:c.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:c.numbers,triggersBounds:u.any},{name:"segment-radii",type:c.numbers,triggersBounds:u.any},{name:"radius-type",type:c.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:c.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:c.size,triggersBounds:u.any},{name:"taxi-direction",type:c.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:c.number,triggersBounds:u.any},{name:"edge-distances",type:c.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:c.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:c.angle,triggersBounds:u.any},{name:"loop-sweep",type:c.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:c.size,triggersBounds:u.any},{name:"target-distance-from-node",type:c.size,triggersBounds:u.any}],T=[{name:"ghost",type:c.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:c.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:c.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:c.zeroOneNumber}],O=[{name:"selection-box-color",type:c.color},{name:"selection-box-opacity",type:c.zeroOneNumber},{name:"selection-box-border-color",type:c.color},{name:"selection-box-border-width",type:c.size},{name:"active-bg-color",type:c.color},{name:"active-bg-opacity",type:c.zeroOneNumber},{name:"active-bg-size",type:c.size},{name:"outside-texture-bg-color",type:c.color},{name:"outside-texture-bg-opacity",type:c.zeroOneNumber}],P=[];bn.pieBackgroundN=16,P.push({name:"pie-size",type:c.sizeMaybePercent});for(var F=1;F<=bn.pieBackgroundN;F++)P.push({name:"pie-"+F+"-background-color",type:c.color}),P.push({name:"pie-"+F+"-background-size",type:c.percent}),P.push({name:"pie-"+F+"-background-opacity",type:c.zeroOneNumber});var D=[],$=bn.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:c.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:c.color},{name:"arrow-fill",type:c.arrowFill},{name:"arrow-width",type:c.arrowWidth}].forEach(function(U){$.forEach(function(K){var Z=K+"-"+U.name,de=U.type,be=U.triggersBounds;D.push({name:Z,type:de,triggersBounds:be})})},{});var L=bn.properties=[].concat(g,x,v,y,b,T,p,m,d,f,h,C,k,E,S,P,_,N,D,O),I=bn.propertyGroups={behavior:g,transition:x,visibility:v,overlay:y,underlay:b,ghost:T,commonLabel:p,labelDimensions:m,mainLabel:d,sourceLabel:f,targetLabel:h,nodeBody:C,nodeBorder:k,nodeOutline:E,backgroundImage:S,pie:P,compound:_,edgeLine:N,edgeArrow:D,core:O},z=bn.propertyGroupNames={},G=bn.propertyGroupKeys=Object.keys(I);G.forEach(function(U){z[U]=I[U].map(function(K){return K.name}),I[U].forEach(function(K){return K.groupKey=U})});var q=bn.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];bn.propertyNames=L.map(function(U){return U.name});for(var X=0;X<L.length;X++){var te=L[X];L[te.name]=te}for(var le=0;le<q.length;le++){var ue=q[le],ne=L[ue.pointsTo],oe={name:ue.name,alias:!0,pointsTo:ne};L.push(oe),L[ue.name]=oe}})(),bn.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},bn.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=He({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,c){for(var d=1;d<=bn.pieBackgroundN;d++){var f=c.name.replace("{{i}}",d),h=c.value;u[f]=h}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,c){return bn.arrowPrefixes.forEach(function(d){var f=d+"-"+c.name,h=c.value;u[f]=h}),u},{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,s=t[i],l=this.parse(i,s);n[i]=l}}return e.defaultProperties=n,e.defaultProperties},bn.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var dp={};dp.parse=function(e,t,n,r){var a=this;if(Ft(t))return a.parseImplWarn(e,t,n,r);var i=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,s=n?"t":"f",l=""+t,u=a5(e,l,s,i),c=a.propCache=a.propCache||[],d;return(d=c[u])||(d=c[u]=a.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(d=mo(d),d&&(d.value=mo(d.value))),d},dp.parseImplWarn=function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return!a&&t!=null&&ut("The style property `".concat(e,": ").concat(t,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&t==="label"&&ut("The style value of `label` is deprecated for `"+a.name+"`"),a},dp.parseImpl=function(e,t,n,r){var a=this;e=w0(e);var i=a.properties[e],s=t,l=a.types;if(!i||t===void 0)return null;i.alias&&(i=i.pointsTo,e=i.name);var u=Ve(t);u&&(t=t.trim());var c=i.type;if(!c)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(Ft(t))return{name:e,value:t,strValue:"fn",mapped:l.fn,bypass:n};var d,f;if(!(!u||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(d=new RegExp(l.data.regex).exec(t))){if(n)return!1;var h=l.data;return{name:e,value:d,strValue:""+t,mapped:h,field:d[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(f=new RegExp(l.mapData.regex).exec(t))){if(n||c.multiple)return!1;var m=l.mapData;if(!(c.color||c.number))return!1;var p=this.parse(e,f[4]);if(!p||p.mapped)return!1;var g=this.parse(e,f[5]);if(!g||g.mapped)return!1;if(p.pfValue===g.pfValue||p.strValue===g.strValue)return ut("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(c.color){var v=p.value,y=g.value,b=v[0]===y[0]&&v[1]===y[1]&&v[2]===y[2]&&(v[3]===y[3]||(v[3]==null||v[3]===1)&&(y[3]==null||y[3]===1));if(b)return!1}return{name:e,value:f,strValue:""+t,mapped:m,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:p.value,valueMax:g.value,bypass:n}}}if(c.multiple&&r!=="multiple"){var x;if(u?x=t.split(/\s+/):mt(t)?x=t:x=[t],c.evenMultiple&&x.length%2!==0)return null;for(var w=[],C=[],k=[],E="",S=!1,_=0;_<x.length;_++){var N=a.parse(e,x[_],n,"multiple");S=S||Ve(N.value),w.push(N.value),k.push(N.pfValue!=null?N.pfValue:N.value),C.push(N.units),E+=(_>0?" ":"")+N.strValue}return c.validate&&!c.validate(w,C)?null:c.singleEnum&&S?w.length===1&&Ve(w[0])?{name:e,value:w[0],strValue:w[0],bypass:n}:null:{name:e,value:w,pfValue:k,strValue:E,bypass:n,units:C}}var T=function(){for(var U=0;U<c.enums.length;U++){var K=c.enums[U];if(K===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(c.number){var O,P="px";if(c.units&&(O=c.units),c.implicitUnits&&(P=c.implicitUnits),!c.unitless)if(u){var F="px|em"+(c.allowPercent?"|\\%":"");O&&(F=O);var D=t.match("^("+nn+")("+F+")?$");D&&(t=D[1],O=D[2]||P)}else(!O||c.implicitUnits)&&(O=P);if(t=parseFloat(t),isNaN(t)&&c.enums===void 0)return null;if(isNaN(t)&&c.enums!==void 0)return t=s,T();if(c.integer&&!Lte(t)||c.min!==void 0&&(t<c.min||c.strictMin&&t===c.min)||c.max!==void 0&&(t>c.max||c.strictMax&&t===c.max))return null;var $={name:e,value:t,strValue:""+t+(O||""),units:O,bypass:n};return c.unitless||O!=="px"&&O!=="em"?$.pfValue=t:$.pfValue=O==="px"||!O?t:this.getEmSizeInPixels()*t,(O==="ms"||O==="s")&&($.pfValue=O==="ms"?t:1e3*t),(O==="deg"||O==="rad")&&($.pfValue=O==="rad"?t:yre(t)),O==="%"&&($.pfValue=t/100),$}else if(c.propList){var L=[],I=""+t;if(I!=="none"){for(var z=I.split(/\s*,\s*|\s+/),G=0;G<z.length;G++){var q=z[G].trim();a.properties[q]?L.push(q):ut("`"+q+"` is not a valid property name")}if(L.length===0)return null}return{name:e,value:L,strValue:L.length===0?"none":L.join(" "),bypass:n}}else if(c.color){var X=ene(t);return X?{name:e,value:X,pfValue:X,strValue:"rgb("+X[0]+","+X[1]+","+X[2]+")",bypass:n}:null}else if(c.regex||c.regexes){if(c.enums){var te=T();if(te)return te}for(var le=c.regexes?c.regexes:[c.regex],ue=0;ue<le.length;ue++){var ne=new RegExp(le[ue]),oe=ne.exec(t);if(oe)return{name:e,value:c.singleRegexMatchValue?oe[1]:oe,strValue:""+t,bypass:n}}return null}else return c.string?{name:e,value:""+t,strValue:""+t,bypass:n}:c.enums?T():null};var Tn=function e(t){if(!(this instanceof e))return new e(t);if(!b0(t)){It("A style must have a core reference");return}this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()},On=Tn.prototype;On.instanceString=function(){return"style"},On.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this},On.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},On.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},On.selector=function(e){var t=e==="core"?null:new Ia(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},On.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var a=e.properties[r],i=n[a.name];i===void 0&&(i=n[Tf(a.name)]),i!==void 0&&this.cssRule(a.name,i)}else t.length===2&&this.cssRule(t[0],t[1]);return this},On.style=On.css,On.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n);var a=!this[r].selector;a&&(this._private.coreStyle[n.name]=n)}return this},On.append=function(e){return qS(e)?e.appendToStyle(this):mt(e)?this.appendFromJson(e):Ve(e)&&this.appendFromString(e),this},Tn.fromJson=function(e,t){var n=new Tn(e);return n.fromJson(t),n},Tn.fromString=function(e,t){return new Tn(e).fromString(t)},[Bn,nu,Z0,yo,up,J0,bn,dp].forEach(function(e){He(On,e)}),Tn.types=On.types,Tn.properties=On.properties,Tn.propertyGroups=On.propertyGroups,Tn.propertyGroupNames=On.propertyGroupNames,Tn.propertyGroupKeys=On.propertyGroupKeys;var Lse={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return qS(e)?t.style=e.generateStyle(this):mt(e)?t.style=Tn.fromJson(this,e):Ve(e)?t.style=Tn.fromString(this,e):t.style=Tn(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Rse="single",Pi={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=Rse),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,r,a,i,s;switch(e.length){case 0:return t;case 1:if(Ve(e[0]))return n=e[0],t[n];if(ot(e[0])){if(!this._private.panningEnabled)return this;a=e[0],i=a.x,s=a.y,Ee(i)&&(t.x=i),Ee(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n==="x"||n==="y")&&Ee(r)&&(t[n]=r),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n=arguments,r=this._private.pan,a,i,s,l,u;if(!this._private.panningEnabled)return this;switch(n.length){case 1:ot(e)&&(s=n[0],l=s.x,u=s.y,Ee(l)&&(r.x+=l),Ee(u)&&(r.y+=u),this.emit("pan viewport"));break;case 2:a=e,i=t,(a==="x"||a==="y")&&Ee(i)&&(r[a]+=i),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(Ee(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(Ve(e)){var r=e;e=this.$(r)}else if(Vte(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else ur(e)||(e=this.mutableElements());if(!(ur(e)&&e.empty())){n=n||e.boundingBox();var i=this.width(),s=this.height(),l;if(t=Ee(t)?t:0,!isNaN(i)&&!isNaN(s)&&i>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((i-2*t)/n.w,(s-2*t)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(i-l*(n.x1+n.x2))/2,y:(s-l*(n.y1+n.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return Ee(e)&&Ee(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):Ee(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:Ee(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,a,i,s=!1;if(t.zoomingEnabled||(s=!0),Ee(e)?i=e:ot(e)&&(i=e.level,e.position!=null?a=If(e.position,r,n):e.renderedPosition!=null&&(a=e.renderedPosition),a!=null&&!t.panningEnabled&&(s=!0)),i=i>t.maxZoom?t.maxZoom:i,i=i<t.minZoom?t.minZoom:i,s||!Ee(i)||i===r||a!=null&&(!Ee(a.x)||!Ee(a.y)))return null;if(a!=null){var l=n,u=r,c=i,d={x:-c/u*(a.x-l.x)+a.x,y:-c/u*(a.y-l.y)+a.y};return{zoomed:!0,panned:!0,zoom:c,pan:d}}else return{zoomed:!0,panned:!1,zoom:i,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,n=!0,r=!0,a=[],i=!1,s=!1;if(!e)return this;if(Ee(e.zoom)||(n=!1),ot(e.pan)||(r=!1),!n&&!r)return this;if(n){var l=e.zoom;l<t.minZoom||l>t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=l,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;Ee(u.x)&&(t.pan.x=u.x,s=!1),Ee(u.y)&&(t.pan.y=u.y,s=!1),s||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.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(Ve(e)){var n=e;e=this.mutableElements().filter(n)}else ur(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),a=this.width(),i=this.height();t=t===void 0?this._private.zoom:t;var s={x:(a-t*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var r=n.window().getComputedStyle(t),a=function(i){return parseFloat(r.getPropertyValue(i))};return{width:t.clientWidth-a("padding-left")-a("padding-right"),height:t.clientHeight-a("padding-top")-a("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){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Pi.centre=Pi.center,Pi.autolockNodes=Pi.autolock,Pi.autoungrabifyNodes=Pi.autoungrabify;var ru={data:dt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:dt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:dt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:dt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ru.attr=ru.data,ru.removeAttr=ru.removeData;var ou=function(e){var t=this;e=He({},e);var n=e.container;n&&!Bf(n)&&Bf(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r=r||{},r&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=tn!==void 0&&n!==void 0&&!e.headless,s=e;s.layout=He({name:i?"grid":"null"},s.layout),s.renderer=He({name:i?"canvas":"null"},s.renderer);var l=function(h,m,p){return m!==void 0?m:p!==void 0?p:h},u=this._private={container:n,ready:!1,options:s,elements:new vn(this),listeners:[],aniEles:new vn(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,s.zoomingEnabled),userZoomingEnabled:l(!0,s.userZoomingEnabled),panningEnabled:l(!0,s.panningEnabled),userPanningEnabled:l(!0,s.userPanningEnabled),boxSelectionEnabled:l(!0,s.boxSelectionEnabled),autolock:l(!1,s.autolock,s.autolockNodes),autoungrabify:l(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?i:s.styleEnabled,zoom:Ee(s.zoom)?s.zoom:1,pan:{x:ot(s.pan)&&Ee(s.pan.x)?s.pan.x:0,y:ot(s.pan)&&Ee(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var c=function(h,m){var p=h.some(zte);if(p)return qs.all(h).then(m);m(h)};u.styleEnabled&&t.setStyle([]);var d=He({},s,s.renderer);t.initRenderer(d);var f=function(h,m,p){t.notifications(!1);var g=t.mutableElements();g.length>0&&g.remove(),h!=null&&(ot(h)||mt(h))&&t.add(h),t.one("layoutready",function(y){t.notifications(!0),t.emit(y),t.one("load",m),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var v=He({},t._private.options.layout);v.eles=t.elements(),t.layout(v).run()};c([s.style,s.elements],function(h){var m=h[0],p=h[1];u.styleEnabled&&t.style().append(m),f(p,function(){t.startAnimationLoop(),u.ready=!0,Ft(s.ready)&&t.on("ready",s.ready);for(var g=0;g<a.length;g++){var v=a[g];t.on("ready",v)}r&&(r.readies=[]),t.emit("ready")},s.done)})},fp=ou.prototype;He(fp,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return tn;var t=this._private.container.ownerDocument;return t===void 0||t==null?tn:t.defaultView||tn},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!Bf(e)&&Bf(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(He({},r,r.renderer,{name:r.renderer.name==="null"?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return mo(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),a=function(b){return t.getElementById(b.id())};if(ot(e)){if(t.startBatch(),e.elements){var i={},s=function(b,x){for(var w=[],C=[],k=0;k<b.length;k++){var E=b[k];if(!E.data.id){ut("cy.json() cannot handle elements without an ID attribute");continue}var S=""+E.data.id,_=t.getElementById(S);i[S]=!0,_.length!==0?C.push({ele:_,json:E}):(x&&(E.group=x),w.push(E))}t.add(w);for(var N=0;N<C.length;N++){var T=C[N],O=T.ele,P=T.json;O.json(P)}};if(mt(e.elements))s(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var c=l[u],d=e.elements[c];mt(d)&&s(d,c)}var f=t.collection();r.filter(function(b){return!i[b.id()]}).forEach(function(b){b.isParent()?f.merge(b):b.remove()}),f.forEach(function(b){return b.children().move({parent:null})}),f.forEach(function(b){return a(b).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],m=0;m<h.length;m++){var p=h[m];e[p]!=null&&t[p](e[p])}return t.endBatch(),this}else{var g=!!e,v={};g?v.elements=this.elements().map(function(b){return b.json()}):(v.elements={},r.forEach(function(b){var x=b.group();v.elements[x]||(v.elements[x]=[]),v.elements[x].push(b.json())})),this._private.styleEnabled&&(v.style=t.style().json()),v.data=mo(t.data());var y=n.options;return v.zoomingEnabled=n.zoomingEnabled,v.userZoomingEnabled=n.userZoomingEnabled,v.zoom=n.zoom,v.minZoom=n.minZoom,v.maxZoom=n.maxZoom,v.panningEnabled=n.panningEnabled,v.userPanningEnabled=n.userPanningEnabled,v.pan=mo(n.pan),v.boxSelectionEnabled=n.boxSelectionEnabled,v.renderer=mo(y.renderer),v.hideEdgesOnViewport=y.hideEdgesOnViewport,v.textureOnViewport=y.textureOnViewport,v.wheelSensitivity=y.wheelSensitivity,v.motionBlur=y.motionBlur,v.multiClickDebounceTime=y.multiClickDebounceTime,v}}}),fp.$id=fp.getElementById,[Bse,Fse,L3,X0,lp,Ase,Y0,cp,Lse,Pi,ru].forEach(function(e){He(fp,e)});var Mse={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort: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}},Vse={maximal:!1,acyclic:!1},nl=function(e){return e.scratch("breadthfirst")},R3=function(e,t){return e.scratch("breadthfirst",t)};function M3(e){this.options=He({},Mse,Vse,e)}M3.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().filter(function(pe){return!pe.isParent()}),i=r,s=t.directed,l=t.acyclic||t.maximal||t.maximalAdjustments>0,u=er(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),c;if(ur(t.roots))c=t.roots;else if(mt(t.roots)){for(var d=[],f=0;f<t.roots.length;f++){var h=t.roots[f],m=n.getElementById(h);d.push(m)}c=n.collection(d)}else if(Ve(t.roots))c=n.$(t.roots);else if(s)c=a.roots();else{var p=r.components();c=n.collection();for(var g=function(pe){var xe=p[pe],ge=xe.maxDegree(!1),Ce=xe.filter(function(Oe){return Oe.degree(!1)===ge});c=c.add(Ce)},v=0;v<p.length;v++)g(v)}var y=[],b={},x=function(pe,xe){y[xe]==null&&(y[xe]=[]);var ge=y[xe].length;y[xe].push(pe),R3(pe,{index:ge,depth:xe})},w=function(pe,xe){var ge=nl(pe),Ce=ge.depth,Oe=ge.index;y[Ce][Oe]=null,x(pe,xe)};i.bfs({roots:c,directed:t.directed,visit:function(pe,xe,ge,Ce,Oe){var Ae=pe[0],Se=Ae.id();x(Ae,Oe),b[Se]=!0}});for(var C=[],k=0;k<a.length;k++){var E=a[k];b[E.id()]||C.push(E)}var S=function(pe){for(var xe=y[pe],ge=0;ge<xe.length;ge++){var Ce=xe[ge];if(Ce==null){xe.splice(ge,1),ge--;continue}R3(Ce,{depth:pe,index:ge})}},_=function(){for(var pe=0;pe<y.length;pe++)S(pe)},N=function(pe,xe){for(var ge=nl(pe),Ce=pe.incomers().filter(function(B){return B.isNode()&&r.has(B)}),Oe=-1,Ae=pe.id(),Se=0;Se<Ce.length;Se++){var Le=Ce[Se],De=nl(Le);Oe=Math.max(Oe,De.depth)}if(ge.depth<=Oe){if(!t.acyclic&&xe[Ae])return null;var ze=Oe+1;return w(pe,ze),xe[Ae]=ze,!0}return!1};if(s&&l){var T=[],O={},P=function(pe){return T.push(pe)},F=function(){return T.shift()};for(a.forEach(function(pe){return T.push(pe)});T.length>0;){var D=F(),$=N(D,O);if($)D.outgoers().filter(function(pe){return pe.isNode()&&r.has(pe)}).forEach(P);else if($===null){ut("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}_();var L=0;if(t.avoidOverlap)for(var I=0;I<a.length;I++){var z=a[I],G=z.layoutDimensions(t),q=G.w,X=G.h;L=Math.max(L,q,X)}var te={},le=function(pe){if(te[pe.id()])return te[pe.id()];for(var xe=nl(pe).depth,ge=pe.neighborhood(),Ce=0,Oe=0,Ae=0;Ae<ge.length;Ae++){var Se=ge[Ae];if(!(Se.isEdge()||Se.isParent()||!a.has(Se))){var Le=nl(Se);if(Le!=null){var De=Le.index,ze=Le.depth;if(!(De==null||ze==null)){var B=y[ze].length;ze<xe&&(Ce+=De/B,Oe++)}}}}return Oe=Math.max(1,Oe),Ce=Ce/Oe,Oe===0&&(Ce=0),te[pe.id()]=Ce,Ce},ue=function(pe,xe){var ge=le(pe),Ce=le(xe),Oe=ge-Ce;return Oe===0?GS(pe.id(),xe.id()):Oe};t.depthSort!==void 0&&(ue=t.depthSort);for(var ne=0;ne<y.length;ne++)y[ne].sort(ue),S(ne);for(var oe=[],U=0;U<C.length;U++)oe.push(C[U]);y.unshift(oe),_();for(var K=0,Z=0;Z<y.length;Z++)K=Math.max(y[Z].length,K);var de={x:u.x1+u.w/2,y:u.x1+u.h/2},be=y.reduce(function(pe,xe){return Math.max(pe,xe.length)},0),Be=function(pe){var xe=nl(pe),ge=xe.depth,Ce=xe.index,Oe=y[ge].length,Ae=Math.max(u.w/((t.grid?be:Oe)+1),L),Se=Math.max(u.h/(y.length+1),L),Le=Math.min(u.w/2/y.length,u.h/2/y.length);if(Le=Math.max(Le,L),t.circle){var De=Le*ge+Le-(y.length>0&&y[0].length<=3?Le/2:0),ze=2*Math.PI/y[ge].length*Ce;return ge===0&&y[0].length===1&&(De=1),{x:de.x+De*Math.cos(ze),y:de.y+De*Math.sin(ze)}}else{var B={x:de.x+(Ce+1-(Oe+1)/2)*Ae,y:(ge+1)*Se};return B}};return r.nodes().layoutPositions(this,t,Be),this};var zse={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*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 V3(e){this.options=He({},zse,e)}V3.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var s=er(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=t.sweep===void 0?2*Math.PI-2*Math.PI/i.length:t.sweep,c=u/Math.max(1,i.length-1),d,f=0,h=0;h<i.length;h++){var m=i[h],p=m.layoutDimensions(t),g=p.w,v=p.h;f=Math.max(f,g,v)}if(Ee(t.radius)?d=t.radius:i.length<=1?d=0:d=Math.min(s.h,s.w)/2-f,i.length>1&&t.avoidOverlap){f*=1.75;var y=Math.cos(c)-Math.cos(0),b=Math.sin(c)-Math.sin(0),x=Math.sqrt(f*f/(y*y+b*b));d=Math.max(x,d)}var w=function(C,k){var E=t.startAngle+k*c*(a?1:-1),S=d*Math.cos(E),_=d*Math.sin(E),N={x:l.x+S,y:l.y+_};return N};return r.nodes().layoutPositions(this,t,w),this};var jse={fit:!0,padding:30,startAngle:3/2*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 z3(e){this.options=He({},jse,e)}z3.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),s=er(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],c=0,d=0;d<i.length;d++){var f=i[d],h=void 0;h=t.concentric(f),u.push({value:h,node:f}),f._private.scratch.concentric=h}i.updateStyle();for(var m=0;m<i.length;m++){var p=i[m],g=p.layoutDimensions(t);c=Math.max(c,g.w,g.h)}u.sort(function(pe,xe){return xe.value-pe.value});for(var v=t.levelWidth(i),y=[[]],b=y[0],x=0;x<u.length;x++){var w=u[x];if(b.length>0){var C=Math.abs(b[0].value-w.value);C>=v&&(b=[],y.push(b))}b.push(w)}var k=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,S=Math.min(s.w,s.h)/2-k,_=S/(y.length+E?1:0);k=Math.min(k,_)}for(var N=0,T=0;T<y.length;T++){var O=y[T],P=t.sweep===void 0?2*Math.PI-2*Math.PI/O.length:t.sweep,F=O.dTheta=P/Math.max(1,O.length-1);if(O.length>1&&t.avoidOverlap){var D=Math.cos(F)-Math.cos(0),$=Math.sin(F)-Math.sin(0),L=Math.sqrt(k*k/(D*D+$*$));N=Math.max(L,N)}O.r=N,N+=k}if(t.equidistant){for(var I=0,z=0,G=0;G<y.length;G++){var q=y[G],X=q.r-z;I=Math.max(I,X)}z=0;for(var te=0;te<y.length;te++){var le=y[te];te===0&&(z=le.r),le.r=z,z+=I}}for(var ue={},ne=0;ne<y.length;ne++)for(var oe=y[ne],U=oe.dTheta,K=oe.r,Z=0;Z<oe.length;Z++){var de=oe[Z],be=t.startAngle+(n?1:-1)*U*Z,Be={x:l.x+K*Math.cos(be),y:l.y+K*Math.sin(be)};ue[de.node.id()]=Be}return a.nodes().layoutPositions(this,t,function(pe){var xe=pe.id();return ue[xe]}),this};var Q0,Hse={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function pp(e){this.options=He({},Hse,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(a){var i=a.source().data("id"),s=a.target().data("id"),l=t.some(function(c){return c.data("id")===i}),u=t.some(function(c){return c.data("id")===s});return!l||!u});this.options.eles=this.options.eles.not(r)}pp.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:"layoutstart",layout:n}),e.debug===!0?Q0=!0:Q0=!1;var r=Use(t,n,e);Q0&&Wse(r),e.randomize&&Gse(r);var a=Wo(),i=function(){Xse(r,t,e),e.fit===!0&&t.fit(e.padding)},s=function(f){return!(n.stopped||f>=e.numIter||(Yse(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},l=function(){if(e.animate===!0||e.animate===!1)i(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var f=e.eles.nodes(),h=j3(r,e,f);f.layoutPositions(n,e,h)}},u=0,c=!0;if(e.animate===!0){var d=function f(){for(var h=0;c&&h<e.refresh;)c=s(u),u++,h++;if(!c)U3(r,e),l();else{var m=Wo();m-a>=e.animationThreshold&&i(),$f(f)}};d()}else{for(;c;)c=s(u),u++;U3(r,e),l()}return this},pp.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},pp.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Use=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=er(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},l=n.eles.components(),u={},c=0;c<l.length;c++)for(var d=l[c],f=0;f<d.length;f++){var h=d[f];u[h.id()]=c}for(var c=0;c<s.nodeSize;c++){var m=a[c],p=m.layoutDimensions(n),g={};g.isLocked=m.locked(),g.id=m.data("id"),g.parentId=m.data("parent"),g.cmptId=u[m.id()],g.children=[],g.positionX=m.position("x"),g.positionY=m.position("y"),g.offsetX=0,g.offsetY=0,g.height=p.w,g.width=p.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(m.style("padding")),g.padRight=parseFloat(m.style("padding")),g.padTop=parseFloat(m.style("padding")),g.padBottom=parseFloat(m.style("padding")),g.nodeRepulsion=Ft(n.nodeRepulsion)?n.nodeRepulsion(m):n.nodeRepulsion,s.layoutNodes.push(g),s.idToIndex[g.id]=c}for(var v=[],y=0,b=-1,x=[],c=0;c<s.nodeSize;c++){var m=s.layoutNodes[c],w=m.parentId;w!=null?s.layoutNodes[s.idToIndex[w]].children.push(m.id):(v[++b]=m.id,x.push(m.id))}for(s.graphSet.push(x);y<=b;){var C=v[y++],k=s.idToIndex[C],h=s.layoutNodes[k],E=h.children;if(E.length>0){s.graphSet.push(E);for(var c=0;c<E.length;c++)v[++b]=E[c]}}for(var c=0;c<s.graphSet.length;c++)for(var S=s.graphSet[c],f=0;f<S.length;f++){var _=s.idToIndex[S[f]];s.indexToGraph[_]=c}for(var c=0;c<s.edgeSize;c++){var N=r[c],T={};T.id=N.data("id"),T.sourceId=N.data("source"),T.targetId=N.data("target");var O=Ft(n.idealEdgeLength)?n.idealEdgeLength(N):n.idealEdgeLength,P=Ft(n.edgeElasticity)?n.edgeElasticity(N):n.edgeElasticity,F=s.idToIndex[T.sourceId],D=s.idToIndex[T.targetId],$=s.indexToGraph[F],L=s.indexToGraph[D];if($!=L){for(var I=qse(T.sourceId,T.targetId,s),z=s.graphSet[I],G=0,g=s.layoutNodes[F];z.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],G++;for(g=s.layoutNodes[D];z.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],G++;O*=G*n.nestingFactor}T.idealLength=O,T.elasticity=P,s.layoutEdges.push(T)}return s},qse=function(e,t,n){var r=Kse(e,t,0,n);return 2>r.count?0:r.graph},Kse=function e(t,n,r,a){var i=a.graphSet[r];if(-1<i.indexOf(t)&&-1<i.indexOf(n))return{count:2,graph:r};for(var s=0,l=0;l<i.length;l++){var u=i[l],c=a.idToIndex[u],d=a.layoutNodes[c].children;if(d.length!==0){var f=a.indexToGraph[a.idToIndex[d[0]]],h=e(t,n,f,a);if(h.count!==0)if(h.count===1){if(s++,s===2)break}else return h}}return{count:s,graph:r}},Wse,Gse=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];i.children.length===0&&!i.isLocked&&(i.positionX=Math.random()*n,i.positionY=Math.random()*r)}},j3=function(e,t,n){var r=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(i){var s=e.layoutNodes[e.idToIndex[i.data("id")]];a.x1=Math.min(a.x1,s.positionX),a.x2=Math.max(a.x2,s.positionX),a.y1=Math.min(a.y1,s.positionY),a.y2=Math.max(a.y2,s.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(i,s){var l=e.layoutNodes[e.idToIndex[i.data("id")]];if(t.boundingBox){var u=(l.positionX-a.x1)/a.w,c=(l.positionY-a.y1)/a.h;return{x:r.x1+u*r.w,y:r.y1+c*r.h}}else return{x:l.positionX,y:l.positionY}}},Xse=function(e,t,n){var r=n.layout,a=n.eles.nodes(),i=j3(e,n,a);a.positions(i),e.ready!==!0&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},Yse=function(e,t,n){Zse(e,t),ele(e),tle(e,t),nle(e),rle(e)},Zse=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],a=r.length,i=0;i<a;i++)for(var s=e.layoutNodes[e.idToIndex[r[i]]],l=i+1;l<a;l++){var u=e.layoutNodes[e.idToIndex[r[l]]];Jse(s,u,e,t)}},H3=function(e){return-e+2*e*Math.random()},Jse=function(e,t,n,r){var a=e.cmptId,i=t.cmptId;if(!(a!==i&&!n.isCompound)){var s=t.positionX-e.positionX,l=t.positionY-e.positionY,u=1;s===0&&l===0&&(s=H3(u),l=H3(u));var c=Qse(e,t,s,l);if(c>0)var v=r.nodeOverlap*c,g=Math.sqrt(s*s+l*l),y=v*s/g,b=v*l/g;else var d=hp(e,s,l),f=hp(t,-1*s,-1*l),h=f.x-d.x,m=f.y-d.y,p=h*h+m*m,g=Math.sqrt(p),v=(e.nodeRepulsion+t.nodeRepulsion)/p,y=v*h/g,b=v*m/g;e.isLocked||(e.offsetX-=y,e.offsetY-=b),t.isLocked||(t.offsetX+=y,t.offsetY+=b)}},Qse=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else var a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else var i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},hp=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,s=e.width||1,l=n/t,u=i/s,c={};return t===0&&0<n||t===0&&0>n?(c.x=r,c.y=a+i/2,c):0<t&&-1*u<=l&&l<=u?(c.x=r+s/2,c.y=a+s*n/2/t,c):0>t&&-1*u<=l&&l<=u?(c.x=r-s/2,c.y=a-s*n/2/t,c):0<n&&(l<=-1*u||l>=u)?(c.x=r+i*t/2/n,c.y=a+i/2,c):(0>n&&(l<=-1*u||l>=u)&&(c.x=r-i*t/2/n,c.y=a-i/2),c)},ele=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],a=e.idToIndex[r.sourceId],i=e.layoutNodes[a],s=e.idToIndex[r.targetId],l=e.layoutNodes[s],u=l.positionX-i.positionX,c=l.positionY-i.positionY;if(!(u===0&&c===0)){var d=hp(i,u,c),f=hp(l,-1*u,-1*c),h=f.x-d.x,m=f.y-d.y,p=Math.sqrt(h*h+m*m),g=Math.pow(r.idealLength-p,2)/r.elasticity;if(p!==0)var v=g*h/p,y=g*m/p;else var v=0,y=0;i.isLocked||(i.offsetX+=v,i.offsetY+=y),l.isLocked||(l.offsetX-=v,l.offsetY-=y)}}},tle=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var a=e.graphSet[r],i=a.length;if(r===0)var u=e.clientHeight/2,c=e.clientWidth/2;else var s=e.layoutNodes[e.idToIndex[a[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]],u=l.positionX,c=l.positionY;for(var d=0;d<i;d++){var f=e.layoutNodes[e.idToIndex[a[d]]];if(!f.isLocked){var h=u-f.positionX,m=c-f.positionY,p=Math.sqrt(h*h+m*m);if(p>n){var g=t.gravity*h/p,v=t.gravity*m/p;f.offsetX+=g,f.offsetY+=v}}}}},nle=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],s=e.idToIndex[i],l=e.layoutNodes[s],u=l.children;if(0<u.length&&!l.isLocked){for(var c=l.offsetX,d=l.offsetY,f=0;f<u.length;f++){var h=e.layoutNodes[e.idToIndex[u[f]]];h.offsetX+=c,h.offsetY+=d,n[++a]=u[f]}l.offsetX=0,l.offsetY=0}}},rle=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var a=ole(r.offsetX,r.offsetY,e.temperature);r.positionX+=a.x,r.positionY+=a.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,ale(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},ole=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var a={x:n*e/r,y:n*t/r};else var a={x:e,y:t};return a},ale=function e(t,n){var r=t.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],i=!1;if((a.maxX==null||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,i=!0),(a.minX==null||t.minX-a.padLeft<a.minX)&&(a.minX=t.minX-a.padLeft,i=!0),(a.maxY==null||t.maxY+a.padBottom>a.maxY)&&(a.maxY=t.maxY+a.padBottom,i=!0),(a.minY==null||t.minY-a.padTop<a.minY)&&(a.minY=t.minY-a.padTop,i=!0),i)return e(a,n)}},U3=function(e,t){for(var n=e.layoutNodes,r=[],a=0;a<n.length;a++){var i=n[a],s=i.cmptId,l=r[s]=r[s]||[];l.push(i)}for(var u=0,a=0;a<r.length;a++){var c=r[a];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var d=0;d<c.length;d++){var f=c[d];c.x1=Math.min(c.x1,f.positionX-f.width/2),c.x2=Math.max(c.x2,f.positionX+f.width/2),c.y1=Math.min(c.y1,f.positionY-f.height/2),c.y2=Math.max(c.y2,f.positionY+f.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,u+=c.w*c.h}}r.sort(function(y,b){return b.w*b.h-y.w*y.h});for(var h=0,m=0,p=0,g=0,v=Math.sqrt(u)*e.clientWidth/e.clientHeight,a=0;a<r.length;a++){var c=r[a];if(c){for(var d=0;d<c.length;d++){var f=c[d];f.isLocked||(f.positionX+=h-c.x1,f.positionY+=m-c.y1)}h+=c.w+t.componentSpacing,p+=c.w+t.componentSpacing,g=Math.max(g,c.h),p>v&&(m+=g+t.componentSpacing,h=0,p=0,g=0)}}},ile={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 q3(e){this.options=He({},ile,e)}q3.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=er(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(i.h===0||i.w===0)r.nodes().layoutPositions(this,t,function(te){return{x:i.x1,y:i.y1}});else{var s=a.size(),l=Math.sqrt(s*i.h/i.w),u=Math.round(l),c=Math.round(i.w/i.h*l),d=function(te){if(te==null)return Math.min(u,c);var le=Math.min(u,c);le==u?u=te:c=te},f=function(te){if(te==null)return Math.max(u,c);var le=Math.max(u,c);le==u?u=te:c=te},h=t.rows,m=t.cols!=null?t.cols:t.columns;if(h!=null&&m!=null)u=h,c=m;else if(h!=null&&m==null)u=h,c=Math.ceil(s/u);else if(h==null&&m!=null)c=m,u=Math.ceil(s/c);else if(c*u>s){var p=d(),g=f();(p-1)*g>=s?d(p-1):(g-1)*p>=s&&f(g-1)}else for(;c*u<s;){var v=d(),y=f();(y+1)*v>=s?f(y+1):d(v+1)}var b=i.w/c,x=i.h/u;if(t.condense&&(b=0,x=0),t.avoidOverlap)for(var w=0;w<a.length;w++){var C=a[w],k=C._private.position;(k.x==null||k.y==null)&&(k.x=0,k.y=0);var E=C.layoutDimensions(t),S=t.avoidOverlapPadding,_=E.w+S,N=E.h+S;b=Math.max(b,_),x=Math.max(x,N)}for(var T={},O=function(te,le){return!!T["c-"+te+"-"+le]},P=function(te,le){T["c-"+te+"-"+le]=!0},F=0,D=0,$=function(){D++,D>=c&&(D=0,F++)},L={},I=0;I<a.length;I++){var z=a[I],G=t.position(z);if(G&&(G.row!==void 0||G.col!==void 0)){var q={row:G.row,col:G.col};if(q.col===void 0)for(q.col=0;O(q.row,q.col);)q.col++;else if(q.row===void 0)for(q.row=0;O(q.row,q.col);)q.row++;L[z.id()]=q,P(q.row,q.col)}}var X=function(te,le){var ue,ne;if(te.locked()||te.isParent())return!1;var oe=L[te.id()];if(oe)ue=oe.col*b+b/2+i.x1,ne=oe.row*x+x/2+i.y1;else{for(;O(F,D);)$();ue=D*b+b/2+i.x1,ne=F*x+x/2+i.y1,P(F,D),$()}return{x:ue,y:ne}};a.layoutPositions(this,t,X)}return this};var sle={ready:function(){},stop:function(){}};function ey(e){this.options=He({},sle,e)}ey.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},ey.prototype.stop=function(){return this};var lle={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor: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 K3(e){this.options=He({},lle,e)}K3.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=Ft(e.positions);function a(i){if(e.positions==null)return fre(i.position());if(r)return e.positions(i);var s=e.positions[i._private.data.id];return s??null}return n.layoutPositions(this,e,function(i,s){var l=a(i);return i.locked()||l==null?!1:l}),this};var cle={fit:!0,padding:30,boundingBox: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 W3(e){this.options=He({},cle,e)}W3.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=er(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),a=function(i,s){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,a),this};var ule=[{name:"breadthfirst",impl:M3},{name:"circle",impl:V3},{name:"concentric",impl:z3},{name:"cose",impl:pp},{name:"grid",impl:q3},{name:"null",impl:ey},{name:"preset",impl:K3},{name:"random",impl:W3}];function G3(e){this.options=e,this.notifications=0}var X3=function(){},Y3=function(){throw new Error("A headless instance can not render images")};G3.prototype={recalculateRenderedStyle:X3,notify:function(){this.notifications++},init:X3,isHeadless:function(){return!0},png:Y3,jpg:Y3};var ty={};ty.arrowShapeWidth=.3,ty.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(u,c,d,f,h,m,p){var g=h.x-d/2-p,v=h.x+d/2+p,y=h.y-d/2-p,b=h.y+d/2+p,x=g<=u&&u<=v&&y<=c&&c<=b;return x},r=function(u,c,d,f,h){var m=u*Math.cos(f)-c*Math.sin(f),p=u*Math.sin(f)+c*Math.cos(f),g=m*d,v=p*d,y=g+h.x,b=v+h.y;return{x:y,y:b}},a=function(u,c,d,f){for(var h=[],m=0;m<u.length;m+=2){var p=u[m],g=u[m+1];h.push(r(p,g,c,d,f))}return h},i=function(u){for(var c=[],d=0;d<u.length;d++){var f=u[d];c.push(f.x,f.y)}return c},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},l=function(u,c){Ve(c)&&(c=e[c]),e[u]=He({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(d,f,h,m,p,g){var v=i(a(this.points,h+2*g,m,p)),y=tr(d,f,v);return y},roughCollide:n,draw:function(d,f,h,m){var p=a(this.points,f,h,m);t.arrowShapeImpl("polygon")(d,p)},spacing:function(d){return 0},gap:s},c)};l("none",{collide:Pf,roughCollide:Pf,draw:E0,spacing:l5,gap:l5}),l("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),l("arrow","triangle"),l("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(u,c,d,f,h){var m=a(this.points,c,d,f),p=this.controlPoint,g=r(p[0],p[1],c,d,f);t.arrowShapeImpl(this.name)(u,m,g)},gap:function(u){return s(u)*.8}}),l("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,c,d,f,h,m,p){var g=i(a(this.points,d+2*p,f,h)),v=i(a(this.pointsTee,d+2*p,f,h)),y=tr(u,c,g)||tr(u,c,v);return y},draw:function(u,c,d,f,h){var m=a(this.points,c,d,f),p=a(this.pointsTee,c,d,f);t.arrowShapeImpl(this.name)(u,m,p)}}),l("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,c,d,f,h,m,p){var g=h,v=Math.pow(g.x-u,2)+Math.pow(g.y-c,2)<=Math.pow((d+2*p)*this.radius,2),y=i(a(this.points,d+2*p,f,h));return tr(u,c,y)||v},draw:function(u,c,d,f,h){var m=a(this.pointsTr,c,d,f);t.arrowShapeImpl(this.name)(u,m,f.x,f.y,this.radius*c)},spacing:function(u){return t.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),l("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,c){var d=this.baseCrossLinePts.slice(),f=c/u,h=3,m=5;return d[h]=d[h]-f,d[m]=d[m]-f,d},collide:function(u,c,d,f,h,m,p){var g=i(a(this.points,d+2*p,f,h)),v=i(a(this.crossLinePts(d,m),d+2*p,f,h)),y=tr(u,c,g)||tr(u,c,v);return y},draw:function(u,c,d,f,h){var m=a(this.points,c,d,f),p=a(this.crossLinePts(c,h),c,d,f);t.arrowShapeImpl(this.name)(u,m,p)}}),l("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return s(u)*.525}}),l("circle",{radius:.15,collide:function(u,c,d,f,h,m,p){var g=h,v=Math.pow(g.x-u,2)+Math.pow(g.y-c,2)<=Math.pow((d+2*p)*this.radius,2);return v},draw:function(u,c,d,f,h){t.arrowShapeImpl(this.name)(u,f.x,f.y,this.radius*c)},spacing:function(u){return t.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),l("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),l("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),l("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),l("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var Ai={};Ai.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],s=r[4],l=n.pan(),u=n.zoom(),c=((e-a)/s-l.x)/u,d=((t-i)/s-l.y)/u;return[c,d]},Ai.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(v){return parseFloat(n.getPropertyValue(v))},a={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},i={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},s=e.clientWidth,l=e.clientHeight,u=a.left+a.right,c=a.top+a.bottom,d=i.left+i.right,f=t.width/(s+d),h=s-u,m=l-c,p=t.left+a.left+i.left,g=t.top+a.top+i.top;return this.containerBB=[p,g,h,m,f]},Ai.invalidateContainerClientCoordsCache=function(){this.containerBB=null},Ai.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},Ai.findNearestElements=function(e,t,n,r){var a=this,i=this,s=i.getCachedZSortedEles(),l=[],u=i.cy.zoom(),c=i.cy.hasCompoundNodes(),d=(r?24:8)/u,f=(r?8:2)/u,h=(r?8:2)/u,m=1/0,p,g;n&&(s=s.interactive);function v(E,S){if(E.isNode()){if(g)return;g=E,l.push(E)}if(E.isEdge()&&(S==null||S<m))if(p){if(p.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value&&p.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value){for(var _=0;_<l.length;_++)if(l[_].isEdge()){l[_]=E,p=E,m=S??m;break}}}else l.push(E),p=E,m=S??m}function y(E){var S=E.outerWidth()+2*f,_=E.outerHeight()+2*f,N=S/2,T=_/2,O=E.position(),P=E.pstyle("corner-radius").value==="auto"?"auto":E.pstyle("corner-radius").pfValue,F=E._private.rscratch;if(O.x-N<=e&&e<=O.x+N&&O.y-T<=t&&t<=O.y+T){var D=i.nodeShapes[a.getNodeShape(E)];if(D.checkPoint(e,t,0,S,_,O.x,O.y,P,F))return v(E,0),!0}}function b(E){var S=E._private,_=S.rscratch,N=E.pstyle("width").pfValue,T=E.pstyle("arrow-scale").value,O=N/2+d,P=O*O,F=O*2,D=S.source,$=S.target,L;if(_.edgeType==="segments"||_.edgeType==="straight"||_.edgeType==="haystack"){for(var I=_.allpts,z=0;z+3<I.length;z+=2)if(Sre(e,t,I[z],I[z+1],I[z+2],I[z+3],F)&&P>(L=Nre(e,t,I[z],I[z+1],I[z+2],I[z+3])))return v(E,L),!0}else if(_.edgeType==="bezier"||_.edgeType==="multibezier"||_.edgeType==="self"||_.edgeType==="compound"){for(var I=_.allpts,z=0;z+5<_.allpts.length;z+=4)if(_re(e,t,I[z],I[z+1],I[z+2],I[z+3],I[z+4],I[z+5],F)&&P>(L=Ore(e,t,I[z],I[z+1],I[z+2],I[z+3],I[z+4],I[z+5])))return v(E,L),!0}for(var D=D||S.source,$=$||S.target,G=a.getArrowWidth(N,T),q=[{name:"source",x:_.arrowStartX,y:_.arrowStartY,angle:_.srcArrowAngle},{name:"target",x:_.arrowEndX,y:_.arrowEndY,angle:_.tgtArrowAngle},{name:"mid-source",x:_.midX,y:_.midY,angle:_.midsrcArrowAngle},{name:"mid-target",x:_.midX,y:_.midY,angle:_.midtgtArrowAngle}],z=0;z<q.length;z++){var X=q[z],te=i.arrowShapes[E.pstyle(X.name+"-arrow-shape").value],le=E.pstyle("width").pfValue;if(te.roughCollide(e,t,G,X.angle,{x:X.x,y:X.y},le,d)&&te.collide(e,t,G,X.angle,{x:X.x,y:X.y},le,d))return v(E),!0}c&&l.length>0&&(y(D),y($))}function x(E,S,_){return Zr(E,S,_)}function w(E,S){var _=E._private,N=h,T;S?T=S+"-":T="",E.boundingBox();var O=_.labelBounds[S||"main"],P=E.pstyle(T+"label").value,F=E.pstyle("text-events").strValue==="yes";if(!(!F||!P)){var D=x(_.rscratch,"labelX",S),$=x(_.rscratch,"labelY",S),L=x(_.rscratch,"labelAngle",S),I=E.pstyle(T+"text-margin-x").pfValue,z=E.pstyle(T+"text-margin-y").pfValue,G=O.x1-N-I,q=O.x2+N-I,X=O.y1-N-z,te=O.y2+N-z;if(L){var le=Math.cos(L),ue=Math.sin(L),ne=function(be,Be){return be=be-D,Be=Be-$,{x:be*le-Be*ue+D,y:be*ue+Be*le+$}},oe=ne(G,X),U=ne(G,te),K=ne(q,X),Z=ne(q,te),de=[oe.x+I,oe.y+z,K.x+I,K.y+z,Z.x+I,Z.y+z,U.x+I,U.y+z];if(tr(e,t,de))return v(E),!0}else if(zs(O,e,t))return v(E),!0}}for(var C=s.length-1;C>=0;C--){var k=s[C];k.isNode()?y(k)||w(k):b(k)||w(k)||w(k,"source")||w(k,"target")}return l},Ai.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,r),c=Math.max(t,r);e=s,n=l,t=u,r=c;for(var d=er({x1:e,y1:t,x2:n,y2:r}),f=0;f<a.length;f++){var h=a[f];if(h.isNode()){var m=h,p=m.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});T0(d,p)&&!y5(p,d)&&i.push(m)}else{var g=h,v=g._private,y=v.rscratch;if(y.startX!=null&&y.startY!=null&&!zs(d,y.startX,y.startY)||y.endX!=null&&y.endY!=null&&!zs(d,y.endX,y.endY))continue;if(y.edgeType==="bezier"||y.edgeType==="multibezier"||y.edgeType==="self"||y.edgeType==="compound"||y.edgeType==="segments"||y.edgeType==="haystack"){for(var b=v.rstyle.bezierPts||v.rstyle.linePts||v.rstyle.haystackPts,x=!0,w=0;w<b.length;w++)if(!Ere(d,b[w])){x=!1;break}x&&i.push(g)}else(y.edgeType==="haystack"||y.edgeType==="straight")&&i.push(g)}}return i};var mp={};mp.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType==="haystack",r=t.edgeType==="bezier",a=t.edgeType==="multibezier",i=t.edgeType==="segments",s=t.edgeType==="compound",l=t.edgeType==="self",u,c,d,f,h,m,y,b;if(n?(d=t.haystackPts[0],f=t.haystackPts[1],h=t.haystackPts[2],m=t.haystackPts[3]):(d=t.arrowStartX,f=t.arrowStartY,h=t.arrowEndX,m=t.arrowEndY),y=t.midX,b=t.midY,i)u=d-t.segpts[0],c=f-t.segpts[1];else if(a||s||l||r){var p=t.allpts,g=ln(p[0],p[2],p[4],.1),v=ln(p[1],p[3],p[5],.1);u=d-g,c=f-v}else u=d-y,c=f-b;t.srcArrowAngle=Df(u,c);var y=t.midX,b=t.midY;if(n&&(y=(d+h)/2,b=(f+m)/2),u=h-d,c=m-f,i){var p=t.allpts;if(p.length/2%2===0){var x=p.length/2,w=x-2;u=p[x]-p[w],c=p[x+1]-p[w+1]}else if(t.isRound)u=t.midVector[1],c=-t.midVector[0];else{var x=p.length/2-1,w=x-2;u=p[x]-p[w],c=p[x+1]-p[w+1]}}else if(a||s||l){var p=t.allpts,C=t.ctrlpts,k,E,S,_;if(C.length/2%2===0){var N=p.length/2-1,T=N+2,O=T+2;k=ln(p[N],p[T],p[O],0),E=ln(p[N+1],p[T+1],p[O+1],0),S=ln(p[N],p[T],p[O],1e-4),_=ln(p[N+1],p[T+1],p[O+1],1e-4)}else{var T=p.length/2-1,N=T-2,O=T+2;k=ln(p[N],p[T],p[O],.4999),E=ln(p[N+1],p[T+1],p[O+1],.4999),S=ln(p[N],p[T],p[O],.5),_=ln(p[N+1],p[T+1],p[O+1],.5)}u=S-k,c=_-E}if(t.midtgtArrowAngle=Df(u,c),t.midDispX=u,t.midDispY=c,u*=-1,c*=-1,i){var p=t.allpts;if(p.length/2%2!==0&&!t.isRound){var x=p.length/2-1,P=x+2;u=-(p[P]-p[x]),c=-(p[P+1]-p[x+1])}}if(t.midsrcArrowAngle=Df(u,c),i)u=h-t.segpts[t.segpts.length-2],c=m-t.segpts[t.segpts.length-1];else if(a||s||l||r){var p=t.allpts,F=p.length,g=ln(p[F-6],p[F-4],p[F-2],.9),v=ln(p[F-5],p[F-3],p[F-1],.9);u=h-g,c=m-v}else u=h-y,c=m-b;t.tgtArrowAngle=Df(u,c)},mp.getArrowWidth=mp.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(e*13.37,.9),29)*t,n[e+", "+t]=r,r)};var ny,ry,vo={},$r={},Z3,J3,Ii,gp,Yo,Di,Li,bo,rl,yp,Q3,e4,oy,ay,t4,n4=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},dle=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},fle=function(e,t,n,r,a){if(e!==t4?n4(t,e,vo):dle($r,vo),n4(t,n,$r),Z3=vo.nx*$r.ny-vo.ny*$r.nx,J3=vo.nx*$r.nx-vo.ny*-$r.ny,Yo=Math.asin(Math.max(-1,Math.min(1,Z3))),Math.abs(Yo)<1e-6){ny=t.x,ry=t.y,Li=rl=0;return}Ii=1,gp=!1,J3<0?Yo<0?Yo=Math.PI+Yo:(Yo=Math.PI-Yo,Ii=-1,gp=!0):Yo>0&&(Ii=-1,gp=!0),t.radius!==void 0?rl=t.radius:rl=r,Di=Yo/2,yp=Math.min(vo.len/2,$r.len/2),a?(bo=Math.abs(Math.cos(Di)*rl/Math.sin(Di)),bo>yp?(bo=yp,Li=Math.abs(bo*Math.sin(Di)/Math.cos(Di))):Li=rl):(bo=Math.min(yp,rl),Li=Math.abs(bo*Math.sin(Di)/Math.cos(Di))),oy=t.x+$r.nx*bo,ay=t.y+$r.ny*bo,ny=oy-$r.ny*Li*Ii,ry=ay+$r.nx*Li*Ii,Q3=t.x+vo.nx*bo,e4=t.y+vo.ny*bo,t4=t};function r4(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function iy(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(fle(e,t,n,r,a),{cx:ny,cy:ry,radius:Li,startX:Q3,startY:e4,stopX:oy,stopY:ay,startAngle:vo.ang+Math.PI/2*Ii,endAngle:$r.ang-Math.PI/2*Ii,counterClockwise:gp})}var Nn={};Nn.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,a=t.vectorNormInverse,i,s=e.pstyle("source-endpoint"),l=e.pstyle("target-endpoint"),u=s.units!=null&&l.units!=null,c=function(w,C,k,E){var S=E-C,_=k-w,N=Math.sqrt(_*_+S*S);return{x:-S/N,y:_/N}},d=e.pstyle("edge-distances").value;switch(d){case"node-position":i=n;break;case"intersection":i=r;break;case"endpoints":{if(u){var f=this.manualEndptToPx(e.source()[0],s),h=Yr(f,2),m=h[0],p=h[1],g=this.manualEndptToPx(e.target()[0],l),v=Yr(g,2),y=v[0],b=v[1],x={x1:m,y1:p,x2:y,y2:b};a=c(m,p,y,b),i=x}else ut("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=r;break}}return{midptPts:i,vectorNormInverse:a}},Nn.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var i=Math.random()*2*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var s=r.source,l=r.target,u=s.position(),c=l.position(),d=s.width(),f=l.width(),h=s.height(),m=l.height(),p=n.pstyle("haystack-radius").value,g=p/2;a.haystackPts=a.allpts=[a.source.x*d*g+u.x,a.source.y*h*g+u.y,a.target.x*f*g+c.x,a.target.y*m*g+c.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Nn.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),i=e.pstyle("segment-radii"),s=e.pstyle("radius-type"),l=Math.min(r.pfValue.length,a.pfValue.length),u=i.pfValue[i.pfValue.length-1],c=s.pfValue[s.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var d=0;d<l;d++){var f=r.pfValue[d],h=a.pfValue[d],m=1-f,p=f,g=this.findMidptPtsEtc(e,t),v=g.midptPts,y=g.vectorNormInverse,b={x:v.x1*m+v.x2*p,y:v.y1*m+v.y2*p};n.segpts.push(b.x+y.x*h,b.y+y.y*h),n.radii.push(i.pfValue[d]!==void 0?i.pfValue[d]:u),n.isArcRadius.push((s.pfValue[d]!==void 0?s.pfValue[d]:c)==="arc-radius")}},Nn.findLoopPoints=function(e,t,n,r){var a=e._private.rscratch,i=t.dirCounts,s=t.srcPos,l=e.pstyle("control-point-distances"),u=l?l.pfValue[0]:void 0,c=e.pstyle("loop-direction").pfValue,d=e.pstyle("loop-sweep").pfValue,f=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=n,m=f;r&&(h=0,m=u);var p=c-Math.PI/2,g=p-d/2,v=p+d/2,y=c+"_"+d;h=i[y]===void 0?i[y]=0:++i[y],a.ctrlpts=[s.x+Math.cos(g)*1.4*m*(h/3+1),s.y+Math.sin(g)*1.4*m*(h/3+1),s.x+Math.cos(v)*1.4*m*(h/3+1),s.y+Math.sin(v)*1.4*m*(h/3+1)]},Nn.findCompoundLoopPoints=function(e,t,n,r){var a=e._private.rscratch;a.edgeType="compound";var i=t.srcPos,s=t.tgtPos,l=t.srcW,u=t.srcH,c=t.tgtW,d=t.tgtH,f=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),m=h?h.pfValue[0]:void 0,p=n,g=f;r&&(p=0,g=m);var v=50,y={x:i.x-l/2,y:i.y-u/2},b={x:s.x-c/2,y:s.y-d/2},x={x:Math.min(y.x,b.x),y:Math.min(y.y,b.y)},w=.5,C=Math.max(w,Math.log(l*.01)),k=Math.max(w,Math.log(c*.01));a.ctrlpts=[x.x,x.y-(1+Math.pow(v,1.12)/100)*g*(p/3+1)*C,x.x-(1+Math.pow(v,1.12)/100)*g*(p/3+1)*k,x.y]},Nn.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},Nn.findBezierPoints=function(e,t,n,r,a){var i=e._private.rscratch,s=e.pstyle("control-point-step-size").pfValue,l=e.pstyle("control-point-distances"),u=e.pstyle("control-point-weights"),c=l&&u?Math.min(l.value.length,u.value.length):1,d=l?l.pfValue[0]:void 0,f=u.value[0],h=r;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var m=0;m<c;m++){var p=(.5-t.eles.length/2+n)*s*(a?-1:1),g=void 0,v=h5(p);h&&(d=l?l.pfValue[m]:s,f=u.value[m]),r?g=d:g=d!==void 0?v*d:void 0;var y=g!==void 0?g:p,b=1-f,x=f,w=this.findMidptPtsEtc(e,t),C=w.midptPts,k=w.vectorNormInverse,E={x:C.x1*b+C.x2*x,y:C.y1*b+C.y2*x};i.ctrlpts.push(E.x+k.x*y,E.y+k.y*y)}},Nn.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",s="rightward",l="downward",u="upward",c="auto",d=t.posPts,f=t.srcW,h=t.srcH,m=t.tgtW,p=t.tgtH,g=e.pstyle("edge-distances").value,v=g!=="node-position",y=e.pstyle("taxi-direction").value,b=y,x=e.pstyle("taxi-turn"),w=x.units==="%",C=x.pfValue,k=C<0,E=e.pstyle("taxi-turn-min-distance").pfValue,S=v?(f+m)/2:0,_=v?(h+p)/2:0,N=d.x2-d.x1,T=d.y2-d.y1,O=function(Pe,Ie){return Pe>0?Math.max(Pe-Ie,0):Math.min(Pe+Ie,0)},P=O(N,S),F=O(T,_),D=!1;b===c?y=Math.abs(P)>Math.abs(F)?a:r:b===u||b===l?(y=r,D=!0):(b===i||b===s)&&(y=a,D=!0);var $=y===r,L=$?F:P,I=$?T:N,z=h5(I),G=!1;!(D&&(w||k))&&(b===l&&I<0||b===u&&I>0||b===i&&I>0||b===s&&I<0)&&(z*=-1,L=z*Math.abs(L),G=!0);var q;if(w){var X=C<0?1+C:C;q=X*L}else{var te=C<0?L:0;q=te+C*z}var le=function(Pe){return Math.abs(Pe)<E||Math.abs(Pe)>=Math.abs(L)},ue=le(q),ne=le(Math.abs(L)-Math.abs(q)),oe=ue||ne;if(oe&&!G)if($){var U=Math.abs(I)<=h/2,K=Math.abs(N)<=m/2;if(U){var Z=(d.x1+d.x2)/2,de=d.y1,be=d.y2;n.segpts=[Z,de,Z,be]}else if(K){var Be=(d.y1+d.y2)/2,pe=d.x1,xe=d.x2;n.segpts=[pe,Be,xe,Be]}else n.segpts=[d.x1,d.y2]}else{var ge=Math.abs(I)<=f/2,Ce=Math.abs(T)<=p/2;if(ge){var Oe=(d.y1+d.y2)/2,Ae=d.x1,Se=d.x2;n.segpts=[Ae,Oe,Se,Oe]}else if(Ce){var Le=(d.x1+d.x2)/2,De=d.y1,ze=d.y2;n.segpts=[Le,De,Le,ze]}else n.segpts=[d.x2,d.y1]}else if($){var B=d.y1+q+(v?h/2*z:0),M=d.x1,Y=d.x2;n.segpts=[M,B,Y,B]}else{var Q=d.x1+q+(v?f/2*z:0),ee=d.y1,he=d.y2;n.segpts=[Q,ee,Q,he]}if(n.isRound){var ae=e.pstyle("taxi-radius").value,ye=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(ae),n.isArcRadius=new Array(n.segpts.length/2).fill(ye)}},Nn.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,i=t.srcW,s=t.srcH,l=t.tgtW,u=t.tgtH,c=t.srcShape,d=t.tgtShape,f=t.srcCornerRadius,h=t.tgtCornerRadius,m=t.srcRs,p=t.tgtRs,g=!Ee(n.startX)||!Ee(n.startY),v=!Ee(n.arrowStartX)||!Ee(n.arrowStartY),y=!Ee(n.endX)||!Ee(n.endY),b=!Ee(n.arrowEndX)||!Ee(n.arrowEndY),x=3,w=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=x*w,k=Bi({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=k<C,S=Bi({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),_=S<C,N=!1;if(g||v||E){N=!0;var T={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},O=Math.sqrt(T.x*T.x+T.y*T.y),P={x:T.x/O,y:T.y/O},F=Math.max(i,s),D={x:n.ctrlpts[0]+P.x*2*F,y:n.ctrlpts[1]+P.y*2*F},$=c.intersectLine(r.x,r.y,i,s,D.x,D.y,0,f,m);E?(n.ctrlpts[0]=n.ctrlpts[0]+P.x*(C-k),n.ctrlpts[1]=n.ctrlpts[1]+P.y*(C-k)):(n.ctrlpts[0]=$[0]+P.x*C,n.ctrlpts[1]=$[1]+P.y*C)}if(y||b||_){N=!0;var L={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},I=Math.sqrt(L.x*L.x+L.y*L.y),z={x:L.x/I,y:L.y/I},G=Math.max(i,s),q={x:n.ctrlpts[0]+z.x*2*G,y:n.ctrlpts[1]+z.y*2*G},X=d.intersectLine(a.x,a.y,l,u,q.x,q.y,0,h,p);_?(n.ctrlpts[0]=n.ctrlpts[0]+z.x*(C-S),n.ctrlpts[1]=n.ctrlpts[1]+z.y*(C-S)):(n.ctrlpts[0]=X[0]+z.x*C,n.ctrlpts[1]=X[1]+z.y*C)}N&&this.findEndpoints(e)}},Nn.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,a;t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,a=.5,t.midX=ln(t.allpts[r],t.allpts[r+2],t.allpts[r+4],a),t.midY=ln(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],a))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments"){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var i=2;i+3<t.allpts.length;i+=2){var s=t.radii[i/2-1],l=t.isArcRadius[i/2-1];t.roundCorners.push(iy({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:s},{x:t.allpts[i+2],y:t.allpts[i+3]},s,l))}}if(t.segpts.length%4===0){var u=t.segpts.length/2,c=u-2;t.midX=(t.segpts[c]+t.segpts[u])/2,t.midY=(t.segpts[c+1]+t.segpts[u+1])/2}else{var d=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[d],t.midY=t.segpts[d+1];else{var f={x:t.segpts[d],y:t.segpts[d+1]},h=t.roundCorners[d/2],m=[f.x-h.cx,f.y-h.cy],p=h.radius/Math.sqrt(Math.pow(m[0],2)+Math.pow(m[1],2));m=m.map(function(g){return g*p}),t.midX=h.cx+m[0],t.midY=h.cy+m[1],t.midVector=m}}}},Nn.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||Ee(t.startX)&&Ee(t.startY)&&Ee(t.endX)&&Ee(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,ut("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},Nn.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy,a=r.hasCompoundNodes(),i={map:new go,get:function(k){var E=this.map.get(k[0]);return E!=null?E.get(k[1]):null},set:function(k,E){var S=this.map.get(k[0]);S==null&&(S=new go,this.map.set(k[0],S)),S.set(k[1],E)}},s=[],l=[],u=0;u<e.length;u++){var c=e[u],d=c._private,f=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(f==="haystack"){l.push(c);continue}var h=f==="unbundled-bezier"||f.endsWith("segments")||f==="straight"||f==="straight-triangle"||f.endsWith("taxi"),m=f==="unbundled-bezier"||f==="bezier",p=d.source,g=d.target,v=p.poolIndex(),y=g.poolIndex(),b=[v,y].sort(),x=i.get(b);x==null&&(x={eles:[]},i.set(b,x),s.push(b)),x.eles.push(c),h&&(x.hasUnbundled=!0),m&&(x.hasBezier=!0)}}for(var w=function(k){var E=s[k],S=i.get(E),_=void 0;if(!S.hasUnbundled){var N=S.eles[0].parallelEdges().filter(function(Y){return Y.isBundledBezier()});S0(S.eles),N.forEach(function(Y){return S.eles.push(Y)}),S.eles.sort(function(Y,Q){return Y.poolIndex()-Q.poolIndex()})}var T=S.eles[0],O=T.source(),P=T.target();if(O.poolIndex()>P.poolIndex()){var F=O;O=P,P=F}var D=S.srcPos=O.position(),$=S.tgtPos=P.position(),L=S.srcW=O.outerWidth(),I=S.srcH=O.outerHeight(),z=S.tgtW=P.outerWidth(),G=S.tgtH=P.outerHeight(),q=S.srcShape=n.nodeShapes[t.getNodeShape(O)],X=S.tgtShape=n.nodeShapes[t.getNodeShape(P)],te=S.srcCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,le=S.tgtCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,ue=S.tgtRs=P._private.rscratch,ne=S.srcRs=O._private.rscratch;S.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var oe=0;oe<S.eles.length;oe++){var U=S.eles[oe],K=U[0]._private.rscratch,Z=U.pstyle("curve-style").value,de=Z==="unbundled-bezier"||Z.endsWith("segments")||Z.endsWith("taxi"),be=!O.same(U.source());if(!S.calculatedIntersection&&O!==P&&(S.hasBezier||S.hasUnbundled)){S.calculatedIntersection=!0;var Be=q.intersectLine(D.x,D.y,L,I,$.x,$.y,0,te,ne),pe=S.srcIntn=Be,xe=X.intersectLine($.x,$.y,z,G,D.x,D.y,0,le,ue),ge=S.tgtIntn=xe,Ce=S.intersectionPts={x1:Be[0],x2:xe[0],y1:Be[1],y2:xe[1]},Oe=S.posPts={x1:D.x,x2:$.x,y1:D.y,y2:$.y},Ae=xe[1]-Be[1],Se=xe[0]-Be[0],Le=Math.sqrt(Se*Se+Ae*Ae),De=S.vector={x:Se,y:Ae},ze=S.vectorNorm={x:De.x/Le,y:De.y/Le},B={x:-ze.y,y:ze.x};S.nodesOverlap=!Ee(Le)||X.checkPoint(Be[0],Be[1],0,z,G,$.x,$.y,le,ue)||q.checkPoint(xe[0],xe[1],0,L,I,D.x,D.y,te,ne),S.vectorNormInverse=B,_={nodesOverlap:S.nodesOverlap,dirCounts:S.dirCounts,calculatedIntersection:!0,hasBezier:S.hasBezier,hasUnbundled:S.hasUnbundled,eles:S.eles,srcPos:$,tgtPos:D,srcW:z,srcH:G,tgtW:L,tgtH:I,srcIntn:ge,tgtIntn:pe,srcShape:X,tgtShape:q,posPts:{x1:Oe.x2,y1:Oe.y2,x2:Oe.x1,y2:Oe.y1},intersectionPts:{x1:Ce.x2,y1:Ce.y2,x2:Ce.x1,y2:Ce.y1},vector:{x:-De.x,y:-De.y},vectorNorm:{x:-ze.x,y:-ze.y},vectorNormInverse:{x:-B.x,y:-B.y}}}var M=be?_:S;K.nodesOverlap=M.nodesOverlap,K.srcIntn=M.srcIntn,K.tgtIntn=M.tgtIntn,K.isRound=Z.startsWith("round"),a&&(O.isParent()||O.isChild()||P.isParent()||P.isChild())&&(O.parents().anySame(P)||P.parents().anySame(O)||O.same(P)&&O.isParent())?t.findCompoundLoopPoints(U,M,oe,de):O===P?t.findLoopPoints(U,M,oe,de):Z.endsWith("segments")?t.findSegmentsPoints(U,M):Z.endsWith("taxi")?t.findTaxiPoints(U,M):Z==="straight"||!de&&S.eles.length%2===1&&oe===Math.floor(S.eles.length/2)?t.findStraightEdgePoints(U):t.findBezierPoints(U,M,oe,de,be),t.findEndpoints(U),t.tryToCorrectInvalidPoints(U,M),t.checkForInvalidEdgeWarning(U),t.storeAllpts(U),t.storeEdgeProjections(U),t.calculateArrowAngles(U),t.recalculateEdgeLabelProjections(U),t.calculateLabelAngles(U)}},C=0;C<s.length;C++)w(C);this.findHaystackPoints(l)}};function o4(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}Nn.getSegmentPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if(n==="segments")return this.recalculateRenderedStyle(e),o4(t.segpts)},Nn.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return this.recalculateRenderedStyle(e),o4(t.ctrlpts)},Nn.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var au={};au.manualEndptToPx=function(e,t){var n=this,r=e.position(),a=e.outerWidth(),i=e.outerHeight(),s=e._private.rscratch;if(t.value.length===2){var l=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(l[0]=l[0]*a),t.units[1]==="%"&&(l[1]=l[1]*i),l[0]+=r.x,l[1]+=r.y,l}else{var u=t.pfValue[0];u=-Math.PI/2+u;var c=2*Math.max(a,i),d=[r.x+Math.cos(u)*c,r.y+Math.sin(u)*c];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,a,i,d[0],d[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,s)}},au.findEndpoints=function(e){var t=this,n,r=e.source()[0],a=e.target()[0],i=r.position(),s=a.position(),l=e.pstyle("target-arrow-shape").value,u=e.pstyle("source-arrow-shape").value,c=e.pstyle("target-distance-from-node").pfValue,d=e.pstyle("source-distance-from-node").pfValue,f=r._private.rscratch,h=a._private.rscratch,m=e.pstyle("curve-style").value,p=e._private.rscratch,g=p.edgeType,v=m==="taxi",y=g==="self"||g==="compound",b=g==="bezier"||g==="multibezier"||y,x=g!=="bezier",w=g==="straight"||g==="segments",C=g==="segments",k=b||x||w,E=y||v,S=e.pstyle("source-endpoint"),_=E?"outside-to-node":S.value,N=r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,T=e.pstyle("target-endpoint"),O=E?"outside-to-node":T.value,P=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue;p.srcManEndpt=S,p.tgtManEndpt=T;var F,D,$,L;if(b){var I=[p.ctrlpts[0],p.ctrlpts[1]],z=x?[p.ctrlpts[p.ctrlpts.length-2],p.ctrlpts[p.ctrlpts.length-1]]:I;F=z,D=I}else if(w){var G=C?p.segpts.slice(0,2):[s.x,s.y],q=C?p.segpts.slice(p.segpts.length-2):[i.x,i.y];F=q,D=G}if(O==="inside-to-node")n=[s.x,s.y];else if(T.units)n=this.manualEndptToPx(a,T);else if(O==="outside-to-line")n=p.tgtIntn;else if(O==="outside-to-node"||O==="outside-to-node-or-label"?$=F:(O==="outside-to-line"||O==="outside-to-line-or-label")&&($=[i.x,i.y]),n=t.nodeShapes[this.getNodeShape(a)].intersectLine(s.x,s.y,a.outerWidth(),a.outerHeight(),$[0],$[1],0,P,h),O==="outside-to-node-or-label"||O==="outside-to-line-or-label"){var X=a._private.rscratch,te=X.labelWidth,le=X.labelHeight,ue=X.labelX,ne=X.labelY,oe=te/2,U=le/2,K=a.pstyle("text-valign").value;K==="top"?ne-=U:K==="bottom"&&(ne+=U);var Z=a.pstyle("text-halign").value;Z==="left"?ue-=oe:Z==="right"&&(ue+=oe);var de=qc($[0],$[1],[ue-oe,ne-U,ue+oe,ne-U,ue+oe,ne+U,ue-oe,ne+U],s.x,s.y);if(de.length>0){var be=i,Be=Ti(be,Ms(n)),pe=Ti(be,Ms(de)),xe=Be;if(pe<Be&&(n=de,xe=pe),de.length>2){var ge=Ti(be,{x:de[2],y:de[3]});ge<xe&&(n=[de[2],de[3]])}}}var Ce=zf(n,F,t.arrowShapes[l].spacing(e)+c),Oe=zf(n,F,t.arrowShapes[l].gap(e)+c);if(p.endX=Oe[0],p.endY=Oe[1],p.arrowEndX=Ce[0],p.arrowEndY=Ce[1],_==="inside-to-node")n=[i.x,i.y];else if(S.units)n=this.manualEndptToPx(r,S);else if(_==="outside-to-line")n=p.srcIntn;else if(_==="outside-to-node"||_==="outside-to-node-or-label"?L=D:(_==="outside-to-line"||_==="outside-to-line-or-label")&&(L=[s.x,s.y]),n=t.nodeShapes[this.getNodeShape(r)].intersectLine(i.x,i.y,r.outerWidth(),r.outerHeight(),L[0],L[1],0,N,f),_==="outside-to-node-or-label"||_==="outside-to-line-or-label"){var Ae=r._private.rscratch,Se=Ae.labelWidth,Le=Ae.labelHeight,De=Ae.labelX,ze=Ae.labelY,B=Se/2,M=Le/2,Y=r.pstyle("text-valign").value;Y==="top"?ze-=M:Y==="bottom"&&(ze+=M);var Q=r.pstyle("text-halign").value;Q==="left"?De-=B:Q==="right"&&(De+=B);var ee=qc(L[0],L[1],[De-B,ze-M,De+B,ze-M,De+B,ze+M,De-B,ze+M],i.x,i.y);if(ee.length>0){var he=s,ae=Ti(he,Ms(n)),ye=Ti(he,Ms(ee)),Pe=ae;if(ye<ae&&(n=[ee[0],ee[1]],Pe=ye),ee.length>2){var Ie=Ti(he,{x:ee[2],y:ee[3]});Ie<Pe&&(n=[ee[2],ee[3]])}}}var W=zf(n,D,t.arrowShapes[u].spacing(e)+d),fe=zf(n,D,t.arrowShapes[u].gap(e)+d);p.startX=fe[0],p.startY=fe[1],p.arrowStartX=W[0],p.arrowStartY=W[1],k&&(!Ee(p.startX)||!Ee(p.startY)||!Ee(p.endX)||!Ee(p.endY)?p.badLine=!0:p.badLine=!1)},au.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},au.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var sy={};function ple(e,t,n){for(var r=function(u,c,d,f){return ln(u,c,d,f)},a=t._private,i=a.rstyle.bezierPts,s=0;s<e.bezierProjPcts.length;s++){var l=e.bezierProjPcts[s];i.push({x:r(n[0],n[2],n[4],l),y:r(n[1],n[3],n[5],l)})}}sy.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)ple(this,e,n.allpts.slice(a,a+6))}else if(r==="segments")for(var i=t.rstyle.linePts=[],a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]});else if(r==="haystack"){var s=n.haystackPts;t.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},sy.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var wo={};wo.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!Oa(t)){var n,r,a=e._private,i=e.width(),s=e.height(),l=e.padding(),u=e.position(),c=e.pstyle("text-halign").strValue,d=e.pstyle("text-valign").strValue,f=a.rscratch,h=a.rstyle;switch(c){case"left":n=u.x-i/2-l;break;case"right":n=u.x+i/2+l;break;default:n=u.x}switch(d){case"top":r=u.y-s/2-l;break;case"bottom":r=u.y+s/2+l;break;default:r=u.y}f.labelX=n,f.labelY=r,h.labelX=n,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var a4=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n=n*-1),n},i4=function(e,t){var n=t.x-e.x,r=t.y-e.y;return a4(n,r)},hle=function(e,t,n,r){var a=Hc(0,r-.001,1),i=Hc(0,r+.001,1),s=Vs(e,t,n,a),l=Vs(e,t,n,i);return i4(s,l)};wo.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,a=this,i={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(i.mid||i.source||i.target){t={x:r.midX,y:r.midY};var s=function(d,f,h){Fa(n.rscratch,d,f,h),Fa(n.rstyle,d,f,h)};s("labelX",null,t.x),s("labelY",null,t.y);var l=a4(r.midDispX,r.midDispY);s("labelAutoAngle",null,l);var u=function d(){if(d.cache)return d.cache;for(var f=[],h=0;h+5<r.allpts.length;h+=4){var m={x:r.allpts[h],y:r.allpts[h+1]},p={x:r.allpts[h+2],y:r.allpts[h+3]},g={x:r.allpts[h+4],y:r.allpts[h+5]};f.push({p0:m,p1:p,p2:g,startDist:0,length:0,segments:[]})}var v=n.rstyle.bezierPts,y=a.bezierProjPcts.length;function b(E,S,_,N,T){var O=Bi(S,_),P=E.segments[E.segments.length-1],F={p0:S,p1:_,t0:N,t1:T,startDist:P?P.startDist+P.length:0,length:O};E.segments.push(F),E.length+=O}for(var x=0;x<f.length;x++){var w=f[x],C=f[x-1];C&&(w.startDist=C.startDist+C.length),b(w,w.p0,v[x*y],0,a.bezierProjPcts[0]);for(var k=0;k<y-1;k++)b(w,v[x*y+k],v[x*y+k+1],a.bezierProjPcts[k],a.bezierProjPcts[k+1]);b(w,v[x*y+y-1],w.p2,a.bezierProjPcts[y-1],1)}return d.cache=f},c=function(d){var f,h=d==="source";if(i[d]){var m=e.pstyle(d+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var p=u(),g,v=0,y=0,b=0;b<p.length;b++){for(var x=p[h?b:p.length-1-b],w=0;w<x.segments.length;w++){var C=x.segments[h?w:x.segments.length-1-w],k=b===p.length-1&&w===x.segments.length-1;if(v=y,y+=C.length,y>=m||k){g={cp:x,segment:C};break}}if(g)break}var E=g.cp,S=g.segment,_=(m-v)/S.length,N=S.t1-S.t0,T=h?S.t0+N*_:S.t1-N*_;T=Hc(0,T,1),t=Vs(E.p0,E.p1,E.p2,T),f=hle(E.p0,E.p1,E.p2,T);break}case"straight":case"segments":case"haystack":{for(var O=0,P,F,D,$,L=r.allpts.length,I=0;I+3<L&&(h?(D={x:r.allpts[I],y:r.allpts[I+1]},$={x:r.allpts[I+2],y:r.allpts[I+3]}):(D={x:r.allpts[L-2-I],y:r.allpts[L-1-I]},$={x:r.allpts[L-4-I],y:r.allpts[L-3-I]}),P=Bi(D,$),F=O,O+=P,!(O>=m));I+=2);var z=m-F,G=z/P;G=Hc(0,G,1),t=bre(D,$,G),f=i4(D,$);break}}s("labelX",d,t.x),s("labelY",d,t.y),s("labelAutoAngle",d,f)}};c("source"),c("target"),this.applyLabelDimensions(e)}},wo.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},wo.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),i=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,l=Zr(n.rscratch,"labelWrapCachedLines",t)||[],u=s!=="wrap"?1:Math.max(l.length,1),c=a.height/u,d=c*i,f=a.width,h=a.height+(u-1)*(i-1)*c;Fa(n.rstyle,"labelWidth",t,f),Fa(n.rscratch,"labelWidth",t,f),Fa(n.rstyle,"labelHeight",t,h),Fa(n.rscratch,"labelHeight",t,h),Fa(n.rscratch,"labelLineHeight",t,d)},wo.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,s=function(X,te){return te?(Fa(n.rscratch,X,t,te),te):Zr(n.rscratch,X,t)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var l=e.pstyle("text-wrap").value;if(l==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c="​",d=a.split(`
491
491
  `),f=e.pstyle("text-max-width").pfValue,h=e.pstyle("text-overflow-wrap").value,m=h==="anywhere",p=[],g=/[\s\u200b]+|$/g,v=0;v<d.length;v++){var y=d[v],b=this.calculateLabelDimensions(e,y),x=b.width;if(m){var w=y.split("").join(c);y=w}if(x>f){var C=y.matchAll(g),k="",E=0,S=zS(C),_;try{for(S.s();!(_=S.n()).done;){var N=_.value,T=N[0],O=y.substring(E,N.index);E=N.index+T.length;var P=k.length===0?O:k+O+T,F=this.calculateLabelDimensions(e,P),D=F.width;D<=f?k+=O+T:(k&&p.push(k),k=O+T)}}catch(X){S.e(X)}finally{S.f()}k.match(/^[\s\u200b]+$/)||p.push(k)}else p.push(y)}s("labelWrapCachedLines",p),a=s("labelWrapCachedText",p.join(`
492
492
  `)),s("labelWrapKey",u)}else if(l==="ellipsis"){var $=e.pstyle("text-max-width").pfValue,L="",I="…",z=!1;if(this.calculateLabelDimensions(e,a).width<$)return a;for(var G=0;G<a.length;G++){var q=this.calculateLabelDimensions(e,L+a[G]+I).width;if(q>$)break;L+=a[G],G===a.length-1&&(z=!0)}return z||(L+=I),L}return a},wo.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t},wo.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),a=r.document,i=_i(t,e._private.labelDimsKey),s=n.labelDimCache||(n.labelDimCache=[]),l=s[i];if(l!=null)return l;var u=0,c=e.pstyle("font-style").strValue,d=e.pstyle("font-size").pfValue,f=e.pstyle("font-family").strValue,h=e.pstyle("font-weight").strValue,m=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!m){m=this.labelCalcCanvas=a.createElement("canvas"),p=this.labelCalcCanvasContext=m.getContext("2d");var g=m.style;g.position="absolute",g.left="-9999px",g.top="-9999px",g.zIndex="-1",g.visibility="hidden",g.pointerEvents="none"}p.font="".concat(c," ").concat(h," ").concat(d,"px ").concat(f);for(var v=0,y=0,b=t.split(`
493
- `),x=0;x<b.length;x++){var w=b[x],C=p.measureText(w),k=Math.ceil(C.width),E=d;v=Math.max(k,v),y+=E}return v+=u,y+=u,s[i]={width:v,height:y}},wo.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,a=e.isEdge(),i=t?t+"-":"",s=e.pstyle(i+"text-rotation"),l=s.strValue;return l==="none"?0:a&&l==="autorotate"?r.labelAutoAngle:l==="autorotate"?0:s.pfValue},wo.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,a=r.rscratch;a.labelAngle=t.calculateLabelAngle(e),n&&(a.sourceLabelAngle=t.calculateLabelAngle(e,"source"),a.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var s4={},l4=28,c4=!1;s4.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<l4||e.height()<l4))return c4||(ut("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),c4=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var vp={};vp.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(i),s)for(var l=0;l<i.length;l++){var u=i[l],c=u._private,d=c.rstyle;d.clean=!1,d.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(i){var s=i.target;r(s)}).on("style.* background.*",function(i){var s=i.target;r(s,!1)});var a=function(i){if(i){var s=n.onUpdateEleCalcsFns;t.cleanStyle();for(var l=0;l<t.length;l++){var u=t[l],c=u._private.rstyle;u.isNode()&&!c.cleanConnected&&(r(u.connectedEdges()),c.cleanConnected=!0)}if(s)for(var d=0;d<s.length;d++){var f=s[d];f(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)},vp.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)},vp.recalculateRenderedStyle=function(e,t){var n=function(x){return x._private.rstyle.cleanConnected},r=[],a=[];if(!this.destroyed){t===void 0&&(t=!0);for(var i=0;i<e.length;i++){var s=e[i],l=s._private,u=l.rstyle;s.isEdge()&&(!n(s.source())||!n(s.target()))&&(u.clean=!1),!(t&&u.clean||s.removed())&&s.pstyle("display").value!=="none"&&(l.group==="nodes"?a.push(s):r.push(s),u.clean=!0)}for(var c=0;c<a.length;c++){var d=a[c],f=d._private,h=f.rstyle,m=d.position();this.recalculateNodeLabelProjection(d),h.nodeX=m.x,h.nodeY=m.y,h.nodeW=d.pstyle("width").pfValue,h.nodeH=d.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var g=r[p],v=g._private,y=v.rstyle,b=v.rscratch;y.srcX=b.arrowStartX,y.srcY=b.arrowStartY,y.tgtX=b.arrowEndX,y.tgtY=b.arrowEndY,y.midX=b.midX,y.midY=b.midY,y.labelAngle=b.labelAngle,y.sourceLabelAngle=b.sourceLabelAngle,y.targetLabelAngle=b.targetLabelAngle}}};var bp={};bp.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],a=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):a.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},bp.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},bp.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(S3),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var u4={};[Ai,mp,Nn,au,sy,wo,s4,vp,bp].forEach(function(e){He(u4,e)});var d4={};d4.getCachedImage=function(e,t,n){var r=this,a=r.imageCache=r.imageCache||{},i=a[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;i=a[e]=a[e]||{};var s=i.image=new Image;s.addEventListener("load",n),s.addEventListener("error",function(){s.error=!0});var l="data:",u=e.substring(0,l.length).toLowerCase()===l;return u||(t=t==="null"?null:t,s.crossOrigin=t),s.src=e,s};var ol={};ol.registerBinding=function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]),i=this.binder(e);return i.on.apply(i,a)},ol.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||Mte(e);if(t.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch{}t.supportsPassiveEvents=a}var s=function(l,u,c){var d=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(d[2]={capture:c??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:d}),(e.addEventListener||e.on).apply(e,d),this};return{on:s,addEventListener:s,addListener:s,bind:s}},ol.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},ol.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},ol.load=function(){var e=this,t=e.cy.window(),n=function(B){return B.selected()},r=function(B,M,Y,Q){B==null&&(B=e.cy);for(var ee=0;ee<M.length;ee++){var he=M[ee];B.emit({originalEvent:Y,type:he,position:Q})}},a=function(B){return B.shiftKey||B.metaKey||B.ctrlKey},i=function(B,M){var Y=!0;if(e.cy.hasCompoundNodes()&&B&&B.pannable())for(var Q=0;M&&Q<M.length;Q++){var B=M[Q];if(B.isNode()&&B.isParent()&&!B.pannable()){Y=!1;break}}else Y=!0;return Y},s=function(B){B[0]._private.grabbed=!0},l=function(B){B[0]._private.grabbed=!1},u=function(B){B[0]._private.rscratch.inDragLayer=!0},c=function(B){B[0]._private.rscratch.inDragLayer=!1},d=function(B){B[0]._private.rscratch.isGrabTarget=!0},f=function(B){B[0]._private.rscratch.isGrabTarget=!1},h=function(B,M){var Y=M.addToList,Q=Y.has(B);!Q&&B.grabbable()&&!B.locked()&&(Y.merge(B),s(B))},m=function(B,M){if(B.cy().hasCompoundNodes()&&!(M.inDragLayer==null&&M.addToList==null)){var Y=B.descendants();M.inDragLayer&&(Y.forEach(u),Y.connectedEdges().forEach(u)),M.addToList&&h(Y,M)}},p=function(B,M){M=M||{};var Y=B.cy().hasCompoundNodes();M.inDragLayer&&(B.forEach(u),B.neighborhood().stdFilter(function(Q){return!Y||Q.isEdge()}).forEach(u)),M.addToList&&B.forEach(function(Q){h(Q,M)}),m(B,M),y(B,{inDragLayer:M.inDragLayer}),e.updateCachedGrabbedEles()},g=p,v=function(B){B&&(e.getCachedZSortedEles().forEach(function(M){l(M),c(M),f(M)}),e.updateCachedGrabbedEles())},y=function(B,M){if(!(M.inDragLayer==null&&M.addToList==null)&&B.cy().hasCompoundNodes()){var Y=B.ancestors().orphans();if(!Y.same(B)){var Q=Y.descendants().spawnSelf().merge(Y).unmerge(B).unmerge(B.descendants()),ee=Q.connectedEdges();M.inDragLayer&&(ee.forEach(u),Q.forEach(u)),M.addToList&&Q.forEach(function(he){h(he,M)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},x=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";x?(e.removeObserver=new MutationObserver(function(B){for(var M=0;M<B.length;M++){var Y=B[M],Q=Y.removedNodes;if(Q)for(var ee=0;ee<Q.length;ee++){var he=Q[ee];if(he===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(B){e.destroy()});var C=Nf(function(){e.cy.resize()},100);x&&(e.styleObserver=new MutationObserver(C),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",C),w&&(e.resizeObserver=new ResizeObserver(C),e.resizeObserver.observe(e.container));var k=function(B,M){for(;B!=null;)M(B),B=B.parentNode},E=function(){e.invalidateContainerClientCoordsCache()};k(e.container,function(B){e.registerBinding(B,"transitionend",E),e.registerBinding(B,"animationend",E),e.registerBinding(B,"scroll",E)}),e.registerBinding(e.container,"contextmenu",function(B){B.preventDefault()});var S=function(){return e.selection[4]!==0},_=function(B){for(var M=e.findContainerClientCoords(),Y=M[0],Q=M[1],ee=M[2],he=M[3],ae=B.touches?B.touches:[B],ye=!1,Pe=0;Pe<ae.length;Pe++){var Ie=ae[Pe];if(Y<=Ie.clientX&&Ie.clientX<=Y+ee&&Q<=Ie.clientY&&Ie.clientY<=Q+he){ye=!0;break}}if(!ye)return!1;for(var W=e.container,fe=B.target,ie=fe.parentNode,we=!1;ie;){if(ie===W){we=!0;break}ie=ie.parentNode}return!!we};e.registerBinding(e.container,"mousedown",function(B){if(_(B)&&!(e.hoverData.which===1&&B.which!==1)){B.preventDefault(),b(),e.hoverData.capture=!0,e.hoverData.which=B.which;var M=e.cy,Y=[B.clientX,B.clientY],Q=e.projectIntoViewport(Y[0],Y[1]),ee=e.selection,he=e.findNearestElements(Q[0],Q[1],!0,!1),ae=he[0],ye=e.dragData.possibleDragElements;e.hoverData.mdownPos=Q,e.hoverData.mdownGPos=Y;var Pe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var we=e.hoverData.down;we?we.emit({originalEvent:B,type:"taphold",position:{x:Q[0],y:Q[1]}}):M.emit({originalEvent:B,type:"taphold",position:{x:Q[0],y:Q[1]}})}},e.tapholdDuration)};if(B.which==3){e.hoverData.cxtStarted=!0;var Ie={originalEvent:B,type:"cxttapstart",position:{x:Q[0],y:Q[1]}};ae?(ae.activate(),ae.emit(Ie),e.hoverData.down=ae):M.emit(Ie),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(B.which==1){ae&&ae.activate();{if(ae!=null&&e.nodeIsGrabbable(ae)){var W=function(we){return{originalEvent:B,type:we,position:{x:Q[0],y:Q[1]}}},fe=function(we){we.emit(W("grab"))};if(d(ae),!ae.selected())ye=e.dragData.possibleDragElements=M.collection(),g(ae,{addToList:ye}),ae.emit(W("grabon")).emit(W("grab"));else{ye=e.dragData.possibleDragElements=M.collection();var ie=M.$(function(we){return we.isNode()&&we.selected()&&e.nodeIsGrabbable(we)});p(ie,{addToList:ye}),ae.emit(W("grabon")),ie.forEach(fe)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=ae,e.hoverData.downs=he,e.hoverData.downTime=new Date().getTime()}r(ae,["mousedown","tapstart","vmousedown"],B,{x:Q[0],y:Q[1]}),ae==null?(ee[4]=1,e.data.bgActivePosistion={x:Q[0],y:Q[1]},e.redrawHint("select",!0),e.redraw()):ae.pannable()&&(ee[4]=1),Pe()}ee[0]=ee[2]=Q[0],ee[1]=ee[3]=Q[1]}},!1),e.registerBinding(t,"mousemove",function(B){var M=e.hoverData.capture;if(!(!M&&!_(B))){var Y=!1,Q=e.cy,ee=Q.zoom(),he=[B.clientX,B.clientY],ae=e.projectIntoViewport(he[0],he[1]),ye=e.hoverData.mdownPos,Pe=e.hoverData.mdownGPos,Ie=e.selection,W=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(W=e.findNearestElement(ae[0],ae[1],!0,!1));var fe=e.hoverData.last,ie=e.hoverData.down,we=[ae[0]-Ie[2],ae[1]-Ie[3]],nt=e.dragData.possibleDragElements,Qe;if(Pe){var lt=he[0]-Pe[0],ft=lt*lt,gt=he[1]-Pe[1],qt=gt*gt,Tt=ft+qt;e.hoverData.isOverThresholdDrag=Qe=Tt>=e.desktopTapThreshold2}var Ot=a(B);Qe&&(e.hoverData.tapholdCancelled=!0);var Kt=function(){var Fn=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Fn.length===0?(Fn.push(we[0]),Fn.push(we[1])):(Fn[0]+=we[0],Fn[1]+=we[1])};Y=!0,r(W,["mousemove","vmousemove","tapdrag"],B,{x:ae[0],y:ae[1]});var Wt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||Q.emit({originalEvent:B,type:"boxstart",position:{x:ae[0],y:ae[1]}}),Ie[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Qe){var Rt={originalEvent:B,type:"cxtdrag",position:{x:ae[0],y:ae[1]}};ie?ie.emit(Rt):Q.emit(Rt),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||W!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:B,type:"cxtdragout",position:{x:ae[0],y:ae[1]}}),e.hoverData.cxtOver=W,W&&W.emit({originalEvent:B,type:"cxtdragover",position:{x:ae[0],y:ae[1]}}))}}else if(e.hoverData.dragging){if(Y=!0,Q.panningEnabled()&&Q.userPanningEnabled()){var $n;if(e.hoverData.justStartedPan){var xn=e.hoverData.mdownPos;$n={x:(ae[0]-xn[0])*ee,y:(ae[1]-xn[1])*ee},e.hoverData.justStartedPan=!1}else $n={x:we[0]*ee,y:we[1]*ee};Q.panBy($n),Q.emit("dragpan"),e.hoverData.dragged=!0}ae=e.projectIntoViewport(B.clientX,B.clientY)}else if(Ie[4]==1&&(ie==null||ie.pannable())){if(Qe){if(!e.hoverData.dragging&&Q.boxSelectionEnabled()&&(Ot||!Q.panningEnabled()||!Q.userPanningEnabled()))Wt();else if(!e.hoverData.selecting&&Q.panningEnabled()&&Q.userPanningEnabled()){var kn=i(ie,e.hoverData.downs);kn&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ie[4]=0,e.data.bgActivePosistion=Ms(ye),e.redrawHint("select",!0),e.redraw())}ie&&ie.pannable()&&ie.active()&&ie.unactivate()}}else{if(ie&&ie.pannable()&&ie.active()&&ie.unactivate(),(!ie||!ie.grabbed())&&W!=fe&&(fe&&r(fe,["mouseout","tapdragout"],B,{x:ae[0],y:ae[1]}),W&&r(W,["mouseover","tapdragover"],B,{x:ae[0],y:ae[1]}),e.hoverData.last=W),ie)if(Qe){if(Q.boxSelectionEnabled()&&Ot)ie&&ie.grabbed()&&(v(nt),ie.emit("freeon"),nt.emit("free"),e.dragData.didDrag&&(ie.emit("dragfreeon"),nt.emit("dragfree"))),Wt();else if(ie&&ie.grabbed()&&e.nodeIsDraggable(ie)){var yt=!e.dragData.didDrag;yt&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(nt,{inDragLayer:!0});var Nt={x:0,y:0};if(Ee(we[0])&&Ee(we[1])&&(Nt.x+=we[0],Nt.y+=we[1],yt)){var Lt=e.hoverData.dragDelta;Lt&&Ee(Lt[0])&&Ee(Lt[1])&&(Nt.x+=Lt[0],Nt.y+=Lt[1])}e.hoverData.draggingEles=!0,nt.silentShift(Nt).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else Kt();Y=!0}if(Ie[2]=ae[0],Ie[3]=ae[1],Y)return B.stopPropagation&&B.stopPropagation(),B.preventDefault&&B.preventDefault(),!1}},!1);var N,T,O;e.registerBinding(t,"mouseup",function(B){if(!(e.hoverData.which===1&&B.which!==1&&e.hoverData.capture)){var M=e.hoverData.capture;if(M){e.hoverData.capture=!1;var Y=e.cy,Q=e.projectIntoViewport(B.clientX,B.clientY),ee=e.selection,he=e.findNearestElement(Q[0],Q[1],!0,!1),ae=e.dragData.possibleDragElements,ye=e.hoverData.down,Pe=a(B);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,ye&&ye.unactivate(),e.hoverData.which===3){var Ie={originalEvent:B,type:"cxttapend",position:{x:Q[0],y:Q[1]}};if(ye?ye.emit(Ie):Y.emit(Ie),!e.hoverData.cxtDragged){var W={originalEvent:B,type:"cxttap",position:{x:Q[0],y:Q[1]}};ye?ye.emit(W):Y.emit(W)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(he,["mouseup","tapend","vmouseup"],B,{x:Q[0],y:Q[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(r(ye,["click","tap","vclick"],B,{x:Q[0],y:Q[1]}),T=!1,B.timeStamp-O<=Y.multiClickDebounceTime()?(N&&clearTimeout(N),T=!0,O=null,r(ye,["dblclick","dbltap","vdblclick"],B,{x:Q[0],y:Q[1]})):(N=setTimeout(function(){T||r(ye,["oneclick","onetap","voneclick"],B,{x:Q[0],y:Q[1]})},Y.multiClickDebounceTime()),O=B.timeStamp)),ye==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(B)&&(Y.$(n).unselect(["tapunselect"]),ae.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=ae=Y.collection()),he==ye&&!e.dragData.didDrag&&!e.hoverData.selecting&&he!=null&&he._private.selectable&&(e.hoverData.dragging||(Y.selectionType()==="additive"||Pe?he.selected()?he.unselect(["tapunselect"]):he.select(["tapselect"]):Pe||(Y.$(n).unmerge(he).unselect(["tapunselect"]),he.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var fe=Y.collection(e.getAllInBox(ee[0],ee[1],ee[2],ee[3]));e.redrawHint("select",!0),fe.length>0&&e.redrawHint("eles",!0),Y.emit({type:"boxend",originalEvent:B,position:{x:Q[0],y:Q[1]}});var ie=function(nt){return nt.selectable()&&!nt.selected()};Y.selectionType()==="additive"||Pe||Y.$(n).unmerge(fe).unselect(),fe.emit("box").stdFilter(ie).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!ee[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var we=ye&&ye.grabbed();v(ae),we&&(ye.emit("freeon"),ae.emit("free"),e.dragData.didDrag&&(ye.emit("dragfreeon"),ae.emit("dragfree")))}}ee[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,e.hoverData.which=null}}},!1);var P=function(B){if(!e.scrollingPage){var M=e.cy,Y=M.zoom(),Q=M.pan(),ee=e.projectIntoViewport(B.clientX,B.clientY),he=[ee[0]*Y+Q.x,ee[1]*Y+Q.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||S()){B.preventDefault();return}if(M.panningEnabled()&&M.userPanningEnabled()&&M.zoomingEnabled()&&M.userZoomingEnabled()){B.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);var ae;B.deltaY!=null?ae=B.deltaY/-250:B.wheelDeltaY!=null?ae=B.wheelDeltaY/1e3:ae=B.wheelDelta/1e3,ae=ae*e.wheelSensitivity;var ye=B.deltaMode===1;ye&&(ae*=33);var Pe=M.zoom()*Math.pow(10,ae);B.type==="gesturechange"&&(Pe=e.gestureStartZoom*B.scale),M.zoom({level:Pe,renderedPosition:{x:he[0],y:he[1]}}),M.emit(B.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",P,!0),e.registerBinding(t,"scroll",function(B){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(B){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||B.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(B){e.hasTouchStarted||P(B)},!0),e.registerBinding(e.container,"mouseout",function(B){var M=e.projectIntoViewport(B.clientX,B.clientY);e.cy.emit({originalEvent:B,type:"mouseout",position:{x:M[0],y:M[1]}})},!1),e.registerBinding(e.container,"mouseover",function(B){var M=e.projectIntoViewport(B.clientX,B.clientY);e.cy.emit({originalEvent:B,type:"mouseover",position:{x:M[0],y:M[1]}})},!1);var F,D,$,L,I,z,G,q,X,te,le,ue,ne,oe=function(B,M,Y,Q){return Math.sqrt((Y-B)*(Y-B)+(Q-M)*(Q-M))},U=function(B,M,Y,Q){return(Y-B)*(Y-B)+(Q-M)*(Q-M)},K;e.registerBinding(e.container,"touchstart",K=function(B){if(e.hasTouchStarted=!0,!!_(B)){b(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var M=e.cy,Y=e.touchData.now,Q=e.touchData.earlier;if(B.touches[0]){var ee=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);Y[0]=ee[0],Y[1]=ee[1]}if(B.touches[1]){var ee=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);Y[2]=ee[0],Y[3]=ee[1]}if(B.touches[2]){var ee=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);Y[4]=ee[0],Y[5]=ee[1]}if(B.touches[1]){e.touchData.singleTouchMoved=!0,v(e.dragData.touchDragEles);var he=e.findContainerClientCoords();X=he[0],te=he[1],le=he[2],ue=he[3],F=B.touches[0].clientX-X,D=B.touches[0].clientY-te,$=B.touches[1].clientX-X,L=B.touches[1].clientY-te,ne=0<=F&&F<=le&&0<=$&&$<=le&&0<=D&&D<=ue&&0<=L&&L<=ue;var ae=M.pan(),ye=M.zoom();I=oe(F,D,$,L),z=U(F,D,$,L),G=[(F+$)/2,(D+L)/2],q=[(G[0]-ae.x)/ye,(G[1]-ae.y)/ye];var Pe=200,Ie=Pe*Pe;if(z<Ie&&!B.touches[2]){var W=e.findNearestElement(Y[0],Y[1],!0,!0),fe=e.findNearestElement(Y[2],Y[3],!0,!0);W&&W.isNode()?(W.activate().emit({originalEvent:B,type:"cxttapstart",position:{x:Y[0],y:Y[1]}}),e.touchData.start=W):fe&&fe.isNode()?(fe.activate().emit({originalEvent:B,type:"cxttapstart",position:{x:Y[0],y:Y[1]}}),e.touchData.start=fe):M.emit({originalEvent:B,type:"cxttapstart",position:{x:Y[0],y:Y[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(B.touches[2])M.boxSelectionEnabled()&&B.preventDefault();else if(!B.touches[1]&&B.touches[0]){var ie=e.findNearestElements(Y[0],Y[1],!0,!0),we=ie[0];if(we!=null&&(we.activate(),e.touchData.start=we,e.touchData.starts=ie,e.nodeIsGrabbable(we))){var nt=e.dragData.touchDragEles=M.collection(),Qe=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),we.selected()?(Qe=M.$(function(Tt){return Tt.selected()&&e.nodeIsGrabbable(Tt)}),p(Qe,{addToList:nt})):g(we,{addToList:nt}),d(we);var lt=function(Tt){return{originalEvent:B,type:Tt,position:{x:Y[0],y:Y[1]}}};we.emit(lt("grabon")),Qe?Qe.forEach(function(Tt){Tt.emit(lt("grab"))}):we.emit(lt("grab"))}r(we,["touchstart","tapstart","vmousedown"],B,{x:Y[0],y:Y[1]}),we==null&&(e.data.bgActivePosistion={x:ee[0],y:ee[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(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&r(e.touchData.start,["taphold"],B,{x:Y[0],y:Y[1]})},e.tapholdDuration)}if(B.touches.length>=1){for(var ft=e.touchData.startPosition=[null,null,null,null,null,null],gt=0;gt<Y.length;gt++)ft[gt]=Q[gt]=Y[gt];var qt=B.touches[0];e.touchData.startGPosition=[qt.clientX,qt.clientY]}}},!1);var Z;e.registerBinding(t,"touchmove",Z=function(B){var M=e.touchData.capture;if(!(!M&&!_(B))){var Y=e.selection,Q=e.cy,ee=e.touchData.now,he=e.touchData.earlier,ae=Q.zoom();if(B.touches[0]){var ye=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ee[0]=ye[0],ee[1]=ye[1]}if(B.touches[1]){var ye=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ee[2]=ye[0],ee[3]=ye[1]}if(B.touches[2]){var ye=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ee[4]=ye[0],ee[5]=ye[1]}var Pe=e.touchData.startGPosition,Ie;if(M&&B.touches[0]&&Pe){for(var W=[],fe=0;fe<ee.length;fe++)W[fe]=ee[fe]-he[fe];var ie=B.touches[0].clientX-Pe[0],we=ie*ie,nt=B.touches[0].clientY-Pe[1],Qe=nt*nt,lt=we+Qe;Ie=lt>=e.touchTapThreshold2}if(M&&e.touchData.cxt){B.preventDefault();var ft=B.touches[0].clientX-X,gt=B.touches[0].clientY-te,qt=B.touches[1].clientX-X,Tt=B.touches[1].clientY-te,Ot=U(ft,gt,qt,Tt),Kt=Ot/z,Wt=150,Rt=Wt*Wt,$n=1.5,xn=$n*$n;if(Kt>=xn||Ot>=Rt){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var kn={originalEvent:B,type:"cxttapend",position:{x:ee[0],y:ee[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(kn),e.touchData.start=null):Q.emit(kn)}}if(M&&e.touchData.cxt){var kn={originalEvent:B,type:"cxtdrag",position:{x:ee[0],y:ee[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(kn):Q.emit(kn),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var yt=e.findNearestElement(ee[0],ee[1],!0,!0);(!e.touchData.cxtOver||yt!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:B,type:"cxtdragout",position:{x:ee[0],y:ee[1]}}),e.touchData.cxtOver=yt,yt&&yt.emit({originalEvent:B,type:"cxtdragover",position:{x:ee[0],y:ee[1]}}))}else if(M&&B.touches[2]&&Q.boxSelectionEnabled())B.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||Q.emit({originalEvent:B,type:"boxstart",position:{x:ee[0],y:ee[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,Y[4]=1,!Y||Y.length===0||Y[0]===void 0?(Y[0]=(ee[0]+ee[2]+ee[4])/3,Y[1]=(ee[1]+ee[3]+ee[5])/3,Y[2]=(ee[0]+ee[2]+ee[4])/3+1,Y[3]=(ee[1]+ee[3]+ee[5])/3+1):(Y[2]=(ee[0]+ee[2]+ee[4])/3,Y[3]=(ee[1]+ee[3]+ee[5])/3),e.redrawHint("select",!0),e.redraw();else if(M&&B.touches[1]&&!e.touchData.didSelect&&Q.zoomingEnabled()&&Q.panningEnabled()&&Q.userZoomingEnabled()&&Q.userPanningEnabled()){B.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Nt=e.dragData.touchDragEles;if(Nt){e.redrawHint("drag",!0);for(var Lt=0;Lt<Nt.length;Lt++){var Fn=Nt[Lt]._private;Fn.grabbed=!1,Fn.rscratch.inDragLayer=!1}}var ko=e.touchData.start,ft=B.touches[0].clientX-X,gt=B.touches[0].clientY-te,qt=B.touches[1].clientX-X,Tt=B.touches[1].clientY-te,j=oe(ft,gt,qt,Tt),re=j/I;if(ne){var _e=ft-F,Me=gt-D,Mt=qt-$,Cn=Tt-L,Pn=(_e+Mt)/2,Gt=(Me+Cn)/2,$t=Q.zoom(),Co=$t*re,ji=Q.pan(),Sp=q[0]*$t+ji.x,_p=q[1]*$t+ji.y,Bp={x:-Co/$t*(Sp-ji.x-Pn)+Sp,y:-Co/$t*(_p-ji.y-Gt)+_p};if(ko&&ko.active()){var Nt=e.dragData.touchDragEles;v(Nt),e.redrawHint("drag",!0),e.redrawHint("eles",!0),ko.unactivate().emit("freeon"),Nt.emit("free"),e.dragData.didDrag&&(ko.emit("dragfreeon"),Nt.emit("dragfree"))}Q.viewport({zoom:Co,pan:Bp,cancelOnFailedZoom:!0}),Q.emit("pinchzoom"),I=j,F=ft,D=gt,$=qt,L=Tt,e.pinching=!0}if(B.touches[0]){var ye=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ee[0]=ye[0],ee[1]=ye[1]}if(B.touches[1]){var ye=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ee[2]=ye[0],ee[3]=ye[1]}if(B.touches[2]){var ye=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ee[4]=ye[0],ee[5]=ye[1]}}else if(B.touches[0]&&!e.touchData.didSelect){var fr=e.touchData.start,uu=e.touchData.last,yt;if(!e.hoverData.draggingEles&&!e.swipePanning&&(yt=e.findNearestElement(ee[0],ee[1],!0,!0)),M&&fr!=null&&B.preventDefault(),M&&fr!=null&&e.nodeIsDraggable(fr))if(Ie){var Nt=e.dragData.touchDragEles,Tp=!e.dragData.didDrag;Tp&&p(Nt,{inDragLayer:!0}),e.dragData.didDrag=!0;var Hi={x:0,y:0};if(Ee(W[0])&&Ee(W[1])&&(Hi.x+=W[0],Hi.y+=W[1],Tp)){e.redrawHint("eles",!0);var Vn=e.touchData.dragDelta;Vn&&Ee(Vn[0])&&Ee(Vn[1])&&(Hi.x+=Vn[0],Hi.y+=Vn[1])}e.hoverData.draggingEles=!0,Nt.silentShift(Hi).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==he[0]&&e.touchData.startPosition[1]==he[1]&&e.redrawHint("eles",!0),e.redraw()}else{var Vn=e.touchData.dragDelta=e.touchData.dragDelta||[];Vn.length===0?(Vn.push(W[0]),Vn.push(W[1])):(Vn[0]+=W[0],Vn[1]+=W[1])}if(r(fr||yt,["touchmove","tapdrag","vmousemove"],B,{x:ee[0],y:ee[1]}),(!fr||!fr.grabbed())&&yt!=uu&&(uu&&uu.emit({originalEvent:B,type:"tapdragout",position:{x:ee[0],y:ee[1]}}),yt&&yt.emit({originalEvent:B,type:"tapdragover",position:{x:ee[0],y:ee[1]}})),e.touchData.last=yt,M)for(var Lt=0;Lt<ee.length;Lt++)ee[Lt]&&e.touchData.startPosition[Lt]&&Ie&&(e.touchData.singleTouchMoved=!0);if(M&&(fr==null||fr.pannable())&&Q.panningEnabled()&&Q.userPanningEnabled()){var wy=i(fr,e.touchData.starts);wy&&(B.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Ms(e.touchData.startPosition)),e.swipePanning?(Q.panBy({x:W[0]*ae,y:W[1]*ae}),Q.emit("dragpan")):Ie&&(e.swipePanning=!0,Q.panBy({x:ie*ae,y:nt*ae}),Q.emit("dragpan"),fr&&(fr.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var ye=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ee[0]=ye[0],ee[1]=ye[1]}}for(var fe=0;fe<ee.length;fe++)he[fe]=ee[fe];M&&B.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var de;e.registerBinding(t,"touchcancel",de=function(B){var M=e.touchData.start;e.touchData.capture=!1,M&&M.unactivate()});var be,Be,pe,xe;if(e.registerBinding(t,"touchend",be=function(B){var M=e.touchData.start,Y=e.touchData.capture;if(Y)B.touches.length===0&&(e.touchData.capture=!1),B.preventDefault();else return;var Q=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var ee=e.cy,he=ee.zoom(),ae=e.touchData.now,ye=e.touchData.earlier;if(B.touches[0]){var Pe=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ae[0]=Pe[0],ae[1]=Pe[1]}if(B.touches[1]){var Pe=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ae[2]=Pe[0],ae[3]=Pe[1]}if(B.touches[2]){var Pe=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ae[4]=Pe[0],ae[5]=Pe[1]}M&&M.unactivate();var Ie;if(e.touchData.cxt){if(Ie={originalEvent:B,type:"cxttapend",position:{x:ae[0],y:ae[1]}},M?M.emit(Ie):ee.emit(Ie),!e.touchData.cxtDragged){var W={originalEvent:B,type:"cxttap",position:{x:ae[0],y:ae[1]}};M?M.emit(W):ee.emit(W)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!B.touches[2]&&ee.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var fe=ee.collection(e.getAllInBox(Q[0],Q[1],Q[2],Q[3]));Q[0]=void 0,Q[1]=void 0,Q[2]=void 0,Q[3]=void 0,Q[4]=0,e.redrawHint("select",!0),ee.emit({type:"boxend",originalEvent:B,position:{x:ae[0],y:ae[1]}});var ie=function(Wt){return Wt.selectable()&&!Wt.selected()};fe.emit("box").stdFilter(ie).select().emit("boxselect"),fe.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(M!=null&&M.unactivate(),B.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!B.touches[1]&&!B.touches[0]&&!B.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var we=e.dragData.touchDragEles;if(M!=null){var nt=M._private.grabbed;v(we),e.redrawHint("drag",!0),e.redrawHint("eles",!0),nt&&(M.emit("freeon"),we.emit("free"),e.dragData.didDrag&&(M.emit("dragfreeon"),we.emit("dragfree"))),r(M,["touchend","tapend","vmouseup","tapdragout"],B,{x:ae[0],y:ae[1]}),M.unactivate(),e.touchData.start=null}else{var Qe=e.findNearestElement(ae[0],ae[1],!0,!0);r(Qe,["touchend","tapend","vmouseup","tapdragout"],B,{x:ae[0],y:ae[1]})}var lt=e.touchData.startPosition[0]-ae[0],ft=lt*lt,gt=e.touchData.startPosition[1]-ae[1],qt=gt*gt,Tt=ft+qt,Ot=Tt*he*he;e.touchData.singleTouchMoved||(M||ee.$(":selected").unselect(["tapunselect"]),r(M,["tap","vclick"],B,{x:ae[0],y:ae[1]}),Be=!1,B.timeStamp-xe<=ee.multiClickDebounceTime()?(pe&&clearTimeout(pe),Be=!0,xe=null,r(M,["dbltap","vdblclick"],B,{x:ae[0],y:ae[1]})):(pe=setTimeout(function(){Be||r(M,["onetap","voneclick"],B,{x:ae[0],y:ae[1]})},ee.multiClickDebounceTime()),xe=B.timeStamp)),M!=null&&!e.dragData.didDrag&&M._private.selectable&&Ot<e.touchTapThreshold2&&!e.pinching&&(ee.selectionType()==="single"?(ee.$(n).unmerge(M).unselect(["tapunselect"]),M.select(["tapselect"])):M.selected()?M.unselect(["tapunselect"]):M.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var Kt=0;Kt<ae.length;Kt++)ye[Kt]=ae[Kt];e.dragData.didDrag=!1,B.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),B.touches.length<2&&(B.touches.length===1&&(e.touchData.startGPosition=[B.touches[0].clientX,B.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var ge=[],Ce=function(B){return{clientX:B.clientX,clientY:B.clientY,force:1,identifier:B.pointerId,pageX:B.pageX,pageY:B.pageY,radiusX:B.width/2,radiusY:B.height/2,screenX:B.screenX,screenY:B.screenY,target:B.target}},Oe=function(B){return{event:B,touch:Ce(B)}},Ae=function(B){ge.push(Oe(B))},Se=function(B){for(var M=0;M<ge.length;M++){var Y=ge[M];if(Y.event.pointerId===B.pointerId){ge.splice(M,1);return}}},Le=function(B){var M=ge.filter(function(Y){return Y.event.pointerId===B.pointerId})[0];M.event=B,M.touch=Ce(B)},De=function(B){B.touches=ge.map(function(M){return M.touch})},ze=function(B){return B.pointerType==="mouse"||B.pointerType===4};e.registerBinding(e.container,"pointerdown",function(B){ze(B)||(B.preventDefault(),Ae(B),De(B),K(B))}),e.registerBinding(e.container,"pointerup",function(B){ze(B)||(Se(B),De(B),be(B))}),e.registerBinding(e.container,"pointercancel",function(B){ze(B)||(Se(B),De(B),de(B))}),e.registerBinding(e.container,"pointermove",function(B){ze(B)||(B.preventDefault(),Le(B),De(B),Z(B))})}};var Zo={};Zo.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(n,r,a,i,s,l){this.renderer.nodeShapeImpl("polygon",n,r,a,i,s,this.points)},intersectLine:function(n,r,a,i,s,l,u,c){return qc(s,l,this.points,n,r,a/2,i/2,u)},checkPoint:function(n,r,a,i,s,l,u,c){return Go(n,r,this.points,l,u,i,s,[0,-1],a)}}},Zo.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,s,l){return Fre(a,i,e,t,n/2+s,r/2+s)},checkPoint:function(e,t,n,r,a,i,s,l){return Oi(e,t,r,a,i,s,n)}}},Zo.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(n,r,a,i,s,l,u){if(l[u]!==void 0&&l[u+"-cx"]===n&&l[u+"-cy"]===r)return l[u];l[u]=new Array(t.length/2),l[u+"-cx"]=n,l[u+"-cy"]=r;var c=a/2,d=i/2;s=s==="auto"?w5(a,i):s;for(var f=new Array(t.length/2),h=0;h<t.length/2;h++)f[h]={x:n+c*t[h*2],y:r+d*t[h*2+1]};var m,p,g,v,y=f.length;for(p=f[y-1],m=0;m<y;m++)g=f[m%y],v=f[(m+1)%y],l[u][m]=iy(p,g,v,s),p=g,g=v;return l[u]},draw:function(n,r,a,i,s,l,u){this.renderer.nodeShapeImpl("round-polygon",n,r,a,i,s,this.points,this.getOrCreateCorners(r,a,i,s,l,u,"drawCorners"))},intersectLine:function(n,r,a,i,s,l,u,c,d){return Pre(s,l,this.points,n,r,a,i,u,this.getOrCreateCorners(n,r,a,i,c,d,"corners"))},checkPoint:function(n,r,a,i,s,l,u,c,d){return $re(n,r,this.points,l,u,i,s,this.getOrCreateCorners(l,u,i,s,c,d,"corners"))}}},Zo.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,s,l){return v5(a,i,e,t,n,r,s,l)},checkPoint:function(e,t,n,r,a,i,s,l){var u=r/2,c=a/2;l=l==="auto"?Ni(r,a):l,l=Math.min(u,c,l);var d=l*2;return!!(Go(e,t,this.points,i,s,r,a-d,[0,-1],n)||Go(e,t,this.points,i,s,r-d,a,[0,-1],n)||Oi(e,t,d,d,i-u+l,s-c+l,n)||Oi(e,t,d,d,i+u-l,s-c+l,n)||Oi(e,t,d,d,i+u-l,s+c-l,n)||Oi(e,t,d,d,i-u+l,s+c-l,n))}}},Zo.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:$0(),points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,null,i)},generateCutTrianglePts:function(e,t,n,r,a){var i=a==="auto"?this.cornerLength:a,s=t/2,l=e/2,u=n-l,c=n+l,d=r-s,f=r+s;return{topLeft:[u,d+i,u+i,d,u+i,d+i],topRight:[c-i,d,c,d+i,c-i,d+i],bottomRight:[c,f-i,c-i,f,c-i,f-i],bottomLeft:[u+i,f,u,f-i,u+i,f-i]}},intersectLine:function(e,t,n,r,a,i,s,l){var u=this.generateCutTrianglePts(n+2*s,r+2*s,e,t,l),c=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return qc(a,i,c,e,t)},checkPoint:function(e,t,n,r,a,i,s,l){var u=l==="auto"?this.cornerLength:l;if(Go(e,t,this.points,i,s,r,a-2*u,[0,-1],n)||Go(e,t,this.points,i,s,r-2*u,a,[0,-1],n))return!0;var c=this.generateCutTrianglePts(r,a,i,s);return tr(e,t,c.topLeft)||tr(e,t,c.topRight)||tr(e,t,c.bottomRight)||tr(e,t,c.bottomLeft)}}},Zo.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,s,l){var u=.15,c=.5,d=.85,f=this.generateBarrelBezierPts(n+2*s,r+2*s,e,t),h=function(p){var g=Vs({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},u),v=Vs({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},c),y=Vs({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},d);return[p[0],p[1],g.x,g.y,v.x,v.y,y.x,y.y,p[4],p[5]]},m=[].concat(h(f.topLeft),h(f.topRight),h(f.bottomRight),h(f.bottomLeft));return qc(a,i,m,e,t)},generateBarrelBezierPts:function(e,t,n,r){var a=t/2,i=e/2,s=n-i,l=n+i,u=r-a,c=r+a,d=F0(e,t),f=d.heightOffset,h=d.widthOffset,m=d.ctrlPtOffsetPct*e,p={topLeft:[s,u+f,s+m,u,s+h,u],topRight:[l-h,u,l-m,u,l,u+f],bottomRight:[l,c-f,l-m,c,l-h,c],bottomLeft:[s+h,c,s+m,c,s,c-f]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,a,i,s,l){var u=F0(r,a),c=u.heightOffset,d=u.widthOffset;if(Go(e,t,this.points,i,s,r,a-2*c,[0,-1],n)||Go(e,t,this.points,i,s,r-2*d,a,[0,-1],n))return!0;for(var f=this.generateBarrelBezierPts(r,a,i,s),h=function(k,E,S){var _=S[4],N=S[2],T=S[0],O=S[5],P=S[1],F=Math.min(_,T),D=Math.max(_,T),$=Math.min(O,P),L=Math.max(O,P);if(F<=k&&k<=D&&$<=E&&E<=L){var I=Are(_,N,T),z=Bre(I[0],I[1],I[2],k),G=z.filter(function(q){return 0<=q&&q<=1});if(G.length>0)return G[0]}return null},m=Object.keys(f),p=0;p<m.length;p++){var g=m[p],v=f[g],y=h(e,t,v);if(y!=null){var b=v[5],x=v[3],w=v[1],C=ln(b,x,w,y);if(v.isTop&&C<=t||v.isBottom&&t<=C)return!0}}return!1}}},Zo.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,s,l){var u=e-(n/2+s),c=t-(r/2+s),d=c,f=e+(n/2+s),h=Pa(a,i,e,t,u,c,f,d,!1);return h.length>0?h:v5(a,i,e,t,n,r,s,l)},checkPoint:function(e,t,n,r,a,i,s,l){l=l==="auto"?Ni(r,a):l;var u=2*l;if(Go(e,t,this.points,i,s,r,a-u,[0,-1],n)||Go(e,t,this.points,i,s,r-u,a,[0,-1],n))return!0;var c=r/2+2*n,d=a/2+2*n,f=[i-c,s-d,i-c,s,i+c,s,i+c,s-d];return!!(tr(e,t,f)||Oi(e,t,u,u,i+r/2-l,s+a/2-l,n)||Oi(e,t,u,u,i-r/2+l,s+a/2-l,n))}}},Zo.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Mn(3,0)),this.generateRoundPolygon("round-triangle",Mn(3,0)),this.generatePolygon("rectangle",Mn(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",Mn(5,0)),this.generateRoundPolygon("round-pentagon",Mn(5,0)),this.generatePolygon("hexagon",Mn(6,0)),this.generateRoundPolygon("round-hexagon",Mn(6,0)),this.generatePolygon("heptagon",Mn(7,0)),this.generateRoundPolygon("round-heptagon",Mn(7,0)),this.generatePolygon("octagon",Mn(8,0)),this.generateRoundPolygon("round-octagon",Mn(8,0));var r=new Array(20);{var a=N0(5,0),i=N0(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var l=0;l<i.length/2;l++)i[l*2]*=s,i[l*2+1]*=s;for(var l=0;l<20/4;l++)r[l*4]=a[l*2],r[l*4+1]=a[l*2+1],r[l*4+2]=i[l*2],r[l*4+3]=i[l*2+1]}r=b5(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}e.makePolygon=function(c){var d=c.join("$"),f="polygon-"+d,h;return(h=this[f])?h:t.generatePolygon(f,c)}};var iu={};iu.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},iu.redraw=function(e){e=e||d5();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},iu.beforeRender=function(e,t){if(!this.destroyed){t==null&&It("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,a){return a.priority-r.priority})}};var f4=function(e,t,n){for(var r=e.beforeRenderCallbacks,a=0;a<r.length;a++)r[a].fn(t,n)};iu.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function r(a){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){f4(e,!0,a);var i=Wo();e.render(e.renderOptions);var s=e.lastDrawTime=Wo();e.averageRedrawTime===void 0&&(e.averageRedrawTime=s-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var l=s-i;e.redrawTotalTime+=l,e.lastRedrawTime=l,e.averageRedrawTime=e.averageRedrawTime/2+l/2,e.requestedFrame=!1}else f4(e,!1,a);e.skipFrame=!1,$f(r)}};$f(n)}};var mle=function(e){this.init(e)},p4=mle,al=p4.prototype;al.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],al.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,s="__________cytoscape_stylesheet",l="__________cytoscape_container",u=a.getElementById(s)!=null;if(n.className.indexOf(l)<0&&(n.className=(n.className||"")+" "+l),!u){var c=a.createElement("style");c.id=s,c.textContent="."+l+" { position: relative; }",i.insertBefore(c,i.children[0])}var d=r.getComputedStyle(n),f=d.getPropertyValue("position");f==="static"&&ut("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=Ee(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},al.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},al.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,a=r.target;(a.off||a.removeEventListener).apply(a,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},al.isHeadless=function(){return!1},[ty,u4,d4,ol,Zo,iu].forEach(function(e){He(al,e)});var ly=1e3/60,h4={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Nf(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),a=function(s,l){var u=Wo(),c=n.averageRedrawTime,d=n.lastRedrawTime,f=[],h=n.cy.extent(),m=n.getPixelRatio();for(s||n.flushRenderedStyleQueue();;){var p=Wo(),g=p-u,v=p-l;if(d<ly){var y=ly-(s?c:0);if(v>=e.deqFastCost*y)break}else if(s){if(g>=e.deqCost*d||g>=e.deqAvgCost*c)break}else if(v>=e.deqNoDrawCost*ly)break;var b=e.deq(t,m,h);if(b.length>0)for(var x=0;x<b.length;x++)f.push(b[x]);else break}f.length>0&&(e.onDeqd(t,f),!s&&e.shouldRedraw(t,f,m,h)&&r())},i=e.priority||E0;n.beforeRender(a,i(t))}}}},gle=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pf;y0(this,e),this.idsByKey=new go,this.keyForId=new go,this.cachesByLvl=new go,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return v0(e,[{key:"getIdsFor",value:function(t){t==null&&It("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new Rs,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);return r!==a}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,a=n.get(t);return a||(a=new go,n.set(t,a),r.push(t)),a}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),a=this.getCache(r,n);return a!=null&&this.updateKeyMappingFor(t),a}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id()),a=this.getCache(r,n);return a}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var a=this.getKey(t);this.setCache(a,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);return a&&this.invalidateKey(r),a||this.getNumberOfIdsForKey(r)===0}}]),e}(),m4=25,wp=50,xp=-4,cy=3,yle=7.99,vle=8,ble=1024,wle=1024,xle=1024,kle=.2,Cle=.8,Ele=10,Sle=.15,_le=.1,Ble=.9,Tle=.9,Ole=100,Nle=1,il={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},$le=gn({getKey:null,doesEleInvalidateKey:Pf,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:s5,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),su=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=$le(t);He(n,r),n.lookup=new gle(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},rn=su.prototype;rn.reasons=il,rn.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},rn.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},rn.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new jc(function(n,r){return r.reqs-n.reqs});return t},rn.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},rn.getElement=function(e,t,n,r,a){var i=this,s=this.renderer,l=s.cy.zoom(),u=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(B0(l*n))),r<xp)r=xp;else if(l>=yle||r>cy)return null;var c=Math.pow(2,r),d=t.h*c,f=t.w*c,h=s.eleTextBiggerThanMin(e,c);if(!this.isVisible(e,h))return null;var m=u.get(e,r);if(m&&m.invalidated&&(m.invalidated=!1,m.texture.invalidatedWidth-=m.width),m)return m;var p;if(d<=m4?p=m4:d<=wp?p=wp:p=Math.ceil(d/wp)*wp,d>xle||f>wle)return null;var g=i.getTextureQueue(p),v=g[g.length-2],y=function(){return i.recycleTexture(p,f)||i.addTexture(p,f)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidth<f&&(v=y());for(var b=function(D){return D&&D.scaledLabelShown===h},x=a&&a===il.dequeue,w=a&&a===il.highQuality,C=a&&a===il.downscale,k,E=r+1;E<=cy;E++){var S=u.get(e,E);if(S){k=S;break}}var _=k&&k.level===r+1?k:null,N=function(){v.context.drawImage(_.texture.canvas,_.x,0,_.width,_.height,v.usedWidth,0,f,d)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,f,p),b(_))N();else if(b(k))if(w){for(var T=k.level;T>r;T--)_=i.getElement(e,t,n,T,il.downscale);N()}else return i.queueElement(e,k.level-1),k;else{var O;if(!x&&!w&&!C)for(var P=r-1;P>=xp;P--){var F=u.get(e,P);if(F){O=F;break}}if(b(O))return i.queueElement(e,r),O;v.context.translate(v.usedWidth,0),v.context.scale(c,c),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/c,1/c),v.context.translate(-v.usedWidth,0)}return m={x:v.usedWidth,texture:v,level:r,scale:c,width:f,height:d,scaledLabelShown:h},v.usedWidth+=Math.ceil(f+vle),v.eleCaches.push(m),u.set(e,r,m),i.checkTextureFullness(v),m},rn.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},rn.invalidateElement=function(e){var t=this,n=t.lookup,r=[],a=n.isInvalid(e);if(a){for(var i=xp;i<=cy;i++){var s=n.getForCachedKey(e,i);s&&r.push(s)}var l=n.invalidate(e);if(l)for(var u=0;u<r.length;u++){var c=r[u],d=c.texture;d.invalidatedWidth+=c.width,c.invalidated=!0,t.checkTextureUtility(d)}t.removeFromQueue(e)}},rn.checkTextureUtility=function(e){e.invalidatedWidth>=kle*e.width&&this.retireTexture(e)},rn.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>Cle&&e.fullnessChecks>=Ele?$a(n,e):e.fullnessChecks++},rn.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;$a(r,e),e.retired=!0;for(var i=e.eleCaches,s=0;s<i.length;s++){var l=i[s];a.deleteCache(l.key,l.level)}S0(i);var u=t.getRetiredTextureQueue(n);u.push(e)},rn.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),a={};return r.push(a),a.eleCaches=[],a.height=e,a.width=Math.max(ble,t),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=n.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a},rn.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),a=n.getRetiredTextureQueue(e),i=0;i<a.length;i++){var s=a[i];if(s.width>=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,S0(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),$a(a,s),r.push(s),s}},rn.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),i=this.getKey(e),s=a[i];if(s)s.level=Math.max(s.level,t),s.eles.merge(e),s.reqs++,r.updateItem(s);else{var l={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(l),a[i]=l}},rn.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,s=0;s<Nle&&n.size()>0;s++){var l=n.pop(),u=l.key,c=l.eles[0],d=i.hasCache(c,l.level);if(r[u]=null,!d){a.push(l);var f=t.getBoundingBox(c);t.getElement(c,f,e,l.level,il.dequeue)}}return a},rn.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),i=r[a];i!=null&&(i.eles.length===1?(i.reqs=C0,n.updateItem(i),n.pop(),r[a]=null):i.eles.unmerge(e))},rn.onDequeue=function(e){this.onDequeues.push(e)},rn.offDequeue=function(e){$a(this.onDequeues,e)},rn.setupDequeueing=h4.setupDequeueing({deqRedrawThreshold:Ole,deqCost:Sle,deqAvgCost:_le,deqNoDrawCost:Ble,deqFastCost:Tle,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var a=0;a<t.length;a++)for(var i=t[a].eles,s=0;s<i.length;s++){var l=i[s].boundingBox();if(T0(l,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Fle=1,lu=-4,kp=2,Ple=3.99,Ale=50,Ile=50,Dle=.15,Lle=.1,Rle=.9,Mle=.9,Vle=1,g4=250,zle=4e3*4e3,jle=!0,y4=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Wo()-2*g4,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Nf(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Ile),n.beforeRender(function(i,s){s-t.lastInvalidationTime<=g4?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var a=function(i,s){return s.reqs-i.reqs};t.layersQueue=new jc(a),t.setupDequeueing()},wn=y4.prototype,v4=0,Hle=Math.pow(2,53)-1;wn.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),s={id:v4=++v4%Hle,bb:e,level:t,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},l=s.context,u=-s.bb.x1,c=-s.bb.y1;return l.scale(n,n),l.translate(u,c),s},wn.getLayers=function(e,t,n){var r=this,a=r.renderer,i=a.cy,s=i.zoom(),l=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(B0(s*t)),n<lu)n=lu;else if(s>=Ple||n>kp)return null}r.validateLayersElesOrdering(n,e);var u=r.layersByLevel,c=Math.pow(2,n),d=u[n]=u[n]||[],f,h=r.levelIsComplete(n,e),m,p=function(){var _=function(P){if(r.validateLayersElesOrdering(P,e),r.levelIsComplete(P,e))return m=u[P],!0},N=function(P){if(!m)for(var F=n+P;lu<=F&&F<=kp&&!_(F);F+=P);};N(1),N(-1);for(var T=d.length-1;T>=0;T--){var O=d[T];O.invalid&&$a(d,O)}};if(!h)p();else return d;var g=function(){if(!f){f=er();for(var _=0;_<e.length;_++)m5(f,e[_].boundingBox())}return f},v=function(_){_=_||{};var N=_.after;g();var T=f.w*c*(f.h*c);if(T>zle)return null;var O=r.makeLayer(f,n);if(N!=null){var P=d.indexOf(N)+1;d.splice(P,0,O)}else(_.insert===void 0||_.insert)&&d.unshift(O);return O};if(r.skipping&&!l)return null;for(var y=null,b=e.length/Fle,x=!l,w=0;w<e.length;w++){var C=e[w],k=C._private.rscratch,E=k.imgLayerCaches=k.imgLayerCaches||{},S=E[n];if(S){y=S;continue}if((!y||y.eles.length>=b||!y5(y.bb,C.boundingBox()))&&(y=v({insert:!0,after:y}),!y))return null;m||x?r.queueLayer(y,C):r.drawEleInLayer(y,C,n,t),y.eles.push(C),E[n]=y}return m||(x?null:d)},wn.getEleLevelForLayerLevel=function(e,t){return e},wn.drawEleInLayer=function(e,t,n,r){var a=this,i=this.renderer,s=e.context,l=t.boundingBox();l.w===0||l.h===0||!t.visible()||(n=a.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(s,!1),i.drawCachedElement(s,t,null,null,n,jle),i.setImgSmoothing(s,!0))},wn.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var a=0,i=0;i<r.length;i++){var s=r[i];if(s.reqs>0||s.invalid)return!1;a+=s.eles.length}return a===t.length},wn.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,s=0;s<t.length;s++)if(a.eles[0]===t[s]){i=s;break}if(i<0){this.invalidateLayer(a);continue}for(var l=i,s=0;s<a.eles.length;s++)if(a.eles[s]!==t[l+s]){this.invalidateLayer(a);break}}},wn.updateElementsInLayers=function(e,t){for(var n=this,r=Pc(e[0]),a=0;a<e.length;a++)for(var i=r?null:e[a],s=r?e[a]:e[a].ele,l=s._private.rscratch,u=l.imgLayerCaches=l.imgLayerCaches||{},c=lu;c<=kp;c++){var d=u[c];d&&(i&&n.getEleLevelForLayerLevel(d.level)!==i.level||t(d,s,i))}},wn.haveLayers=function(){for(var e=this,t=!1,n=lu;n<=kp;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},wn.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Wo(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))},wn.invalidateLayer=function(e){if(this.lastInvalidationTime=Wo(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];$a(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},wn.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(n,r,a){var i=n.replacement;if(i||(i=n.replacement=t.makeLayer(n.bb,n.level),i.replaces=n,i.eles=n.eles),!i.reqs)for(var s=0;s<i.eles.length;s++)t.queueLayer(i,i.eles[s])})},wn.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},wn.queueLayer=function(e,t){var n=this,r=n.layersQueue,a=e.elesQueue,i=a.hasId=a.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;a.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},wn.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<Vle&&n.size()!==0;){var i=n.peek();if(i.replacement){n.pop();continue}if(i.replaces&&i!==i.replaces.replacement){n.pop();continue}if(i.invalid){n.pop();continue}var s=i.elesQueue.shift();s&&(t.drawEleInLayer(i,s,i.level,e),a++),r.length===0&&r.push(!0),i.elesQueue.length===0&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}return r},wn.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=e;for(var i=0;i<e.eles.length;i++){var s=e.eles[i]._private,l=s.imgLayerCaches=s.imgLayerCaches||{};l&&(l[e.level]=e)}t.requestRedraw()}},wn.requestRedraw=Nf(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),wn.setupDequeueing=h4.setupDequeueing({deqRedrawThreshold:Ale,deqCost:Dle,deqAvgCost:Lle,deqNoDrawCost:Rle,deqFastCost:Mle,deq:function(e,t){return e.dequeue(t)},onDeqd:E0,shouldRedraw:s5,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var b4={},w4;function Ule(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function qle(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];a===0&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function x4(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var s=n,l=n[0];e.moveTo(l.x,l.y);for(var a=1;a<s.length;a++){var i=s[a];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function Kle(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,Math.PI*2,!1);var i=t,s=i[0];e.moveTo(s.x,s.y);for(var l=0;l<i.length;l++){var u=i[l];e.lineTo(u.x,u.y)}e.closePath&&e.closePath()}function Wle(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}b4.arrowShapeImpl=function(e){return(w4||(w4={polygon:Ule,"triangle-backcurve":qle,"triangle-tee":x4,"circle-triangle":Kle,"triangle-cross":x4,circle:Wle}))[e]};var xo={};xo.drawElement=function(e,t,n,r,a,i){var s=this;t.isNode()?s.drawNode(e,t,n,r,a,i):s.drawEdge(e,t,n,r,a,i)},xo.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},xo.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},xo.drawCachedElementPortion=function(e,t,n,r,a,i,s,l){var u=this,c=n.getBoundingBox(t);if(!(c.w===0||c.h===0)){var d=n.getElement(t,c,r,a,i);if(d!=null){var f=l(u,t);if(f===0)return;var h=s(u,t),m=c.x1,p=c.y1,g=c.w,v=c.h,y,b,x,w,C;if(h!==0){var k=n.getRotationPoint(t);x=k.x,w=k.y,e.translate(x,w),e.rotate(h),C=u.getImgSmoothing(e),C||u.setImgSmoothing(e,!0);var E=n.getRotationOffset(t);y=E.x,b=E.y}else y=m,b=p;var S;f!==1&&(S=e.globalAlpha,e.globalAlpha=S*f),e.drawImage(d.texture.canvas,d.x,0,d.width,d.height,y,b,g,v),f!==1&&(e.globalAlpha=S),h!==0&&(e.rotate(-h),e.translate(-x,-w),C||u.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var Gle=function(){return 0},Xle=function(e,t){return e.getTextAngle(t,null)},Yle=function(e,t){return e.getTextAngle(t,"source")},Zle=function(e,t){return e.getTextAngle(t,"target")},Jle=function(e,t){return t.effectiveOpacity()},uy=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};xo.drawCachedElement=function(e,t,n,r,a,i){var s=this,l=s.data,u=l.eleTxrCache,c=l.lblTxrCache,d=l.slbTxrCache,f=l.tlbTxrCache,h=t.boundingBox(),m=i===!0?u.reasons.highQuality:null;if(!(h.w===0||h.h===0||!t.visible())&&(!r||T0(h,r))){var p=t.isEdge(),g=t.element()._private.rscratch.badLine;s.drawElementUnderlay(e,t),s.drawCachedElementPortion(e,t,u,n,a,m,Gle,Jle),(!p||!g)&&s.drawCachedElementPortion(e,t,c,n,a,m,Xle,uy),p&&!g&&(s.drawCachedElementPortion(e,t,d,n,a,m,Yle,uy),s.drawCachedElementPortion(e,t,f,n,a,m,Zle,uy)),s.drawElementOverlay(e,t)}},xo.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var a=t[r];n.drawElement(e,a)}},xo.drawCachedElements=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var s=t[i];a.drawCachedElement(e,s,n,r)}},xo.drawCachedNodes=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var s=t[i];s.isNode()&&a.drawCachedElement(e,s,n,r)}},xo.drawLayeredElements=function(e,t,n,r){var a=this,i=a.data.lyrTxrCache.getLayers(t,n);if(i)for(var s=0;s<i.length;s++){var l=i[s],u=l.bb;u.w===0||u.h===0||e.drawImage(l.canvas,u.x1,u.y1,u.w,u.h)}else a.drawCachedElements(e,t,n,r)};var Jo={};Jo.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l=t._private.rscratch;if(!(i&&!t.visible())&&!(l.badLine||l.allpts==null||isNaN(l.allpts[0]))){var u;n&&(u=n,e.translate(-u.x1,-u.y1));var c=i?t.pstyle("opacity").value:1,d=i?t.pstyle("line-opacity").value:1,f=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,m=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=c*d,b=c*d,x=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;f==="straight-triangle"?(s.eleStrokeStyle(e,t,F),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=m,e.lineCap=p,s.eleStrokeStyle(e,t,F),s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")},w=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(e.lineWidth=m+g,e.lineCap=p,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],F);else{e.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")},C=function(){a&&s.drawEdgeOverlay(e,t)},k=function(){a&&s.drawEdgeUnderlay(e,t)},E=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(e,t,F)},S=function(){s.drawElementText(e,t,null,r)};e.lineJoin="round";var _=t.pstyle("ghost").value==="yes";if(_){var N=t.pstyle("ghost-offset-x").pfValue,T=t.pstyle("ghost-offset-y").pfValue,O=t.pstyle("ghost-opacity").value,P=y*O;e.translate(N,T),x(P),E(P),e.translate(-N,-T)}else w();k(),x(),E(),C(),S(),n&&e.translate(u.x1,u.y1)}};var k4=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(r!==0){var a=this,i=a.usePaths(),s=n._private.rscratch,l=n.pstyle("".concat(e,"-padding")).pfValue,u=2*l,c=n.pstyle("".concat(e,"-color")).value;t.lineWidth=u,s.edgeType==="self"&&!i?t.lineCap="butt":t.lineCap="round",a.colorStrokeStyle(t,c[0],c[1],c[2],r),a.drawEdgePath(n,t,s.allpts,"solid")}}}};Jo.drawEdgeOverlay=k4("overlay"),Jo.drawEdgeUnderlay=k4("underlay"),Jo.drawEdgePath=function(e,t,n,r){var a=e._private.rscratch,i=t,s,l=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var f=n.join("$"),h=a.pathCacheKey&&a.pathCacheKey===f;h?(s=t=a.pathCache,l=!0):(s=t=new Path2D,a.pathCacheKey=f,a.pathCache=s)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(c),i.lineDashOffset=d;break;case"solid":i.setLineDash([]);break}if(!l&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var m=2;m+3<n.length;m+=4)t.quadraticCurveTo(n[m],n[m+1],n[m+2],n[m+3]);break;case"straight":case"haystack":for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1]);break;case"segments":if(a.isRound){var g=zS(a.roundCorners),v;try{for(g.s();!(v=g.n()).done;){var y=v.value;r4(t,y)}}catch(x){g.e(x)}finally{g.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var b=2;b+1<n.length;b+=2)t.lineTo(n[b],n[b+1]);break}t=i,u?t.stroke(s):t.stroke(),t.setLineDash&&t.setLineDash([])},Jo.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),l=[i[1]/s,-i[0]/s],u=[l[0]*r/2,l[1]*r/2];t.beginPath(),t.moveTo(n[a]-u[0],n[a+1]-u[1]),t.lineTo(n[a]+u[0],n[a+1]+u[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}},Jo.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},Jo.drawArrowhead=function(e,t,n,r,a,i,s){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)){var l=this,u=t.pstyle(n+"-arrow-shape").value;if(u!=="none"){var c=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",d=t.pstyle(n+"-arrow-fill").value,f=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),m=h.value==="match-line"?f:h.pfValue;h.units==="%"&&(m*=f);var p=t.pstyle("opacity").value;s===void 0&&(s=p);var g=e.globalCompositeOperation;(s!==1||d==="hollow")&&(e.globalCompositeOperation="destination-out",l.colorFillStyle(e,255,255,255,1),l.colorStrokeStyle(e,255,255,255,1),l.drawArrowShape(t,e,c,f,u,m,r,a,i),e.globalCompositeOperation=g);var v=t.pstyle(n+"-arrow-color").value;l.colorFillStyle(e,v[0],v[1],v[2],s),l.colorStrokeStyle(e,v[0],v[1],v[2],s),l.drawArrowShape(t,e,d,f,u,m,r,a,i)}}},Jo.drawArrowShape=function(e,t,n,r,a,i,s,l,u){var c=this,d=this.usePaths()&&a!=="triangle-cross",f=!1,h,m=t,p={x:s,y:l},g=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,g),y=c.arrowShapes[a];if(d){var b=c.arrowPathCache=c.arrowPathCache||[],x=_i(a),w=b[x];w!=null?(h=t=w,f=!0):(h=t=new Path2D,b[x]=h)}f||(t.beginPath&&t.beginPath(),d?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,v,u,p,r),t.closePath&&t.closePath()),t=m,d&&(t.translate(s,l),t.rotate(u),t.scale(v,v)),(n==="filled"||n==="both")&&(d?t.fill(h):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=i/(d?v:1),t.lineJoin="miter",d?t.stroke(h):t.stroke()),d&&(t.scale(1/v,1/v),t.rotate(-u),t.translate(-s,-l))};var dy={};dy.safeDrawImage=function(e,t,n,r,a,i,s,l,u,c){if(!(a<=0||i<=0||u<=0||c<=0))try{e.drawImage(t,n,r,a,i,s,l,u,c)}catch(d){ut(d)}},dy.drawInscribedImage=function(e,t,n,r,a){var i=this,s=n.position(),l=s.x,u=s.y,c=n.cy().style(),d=c.getIndexedStyle.bind(c),f=d(n,"background-fit","value",r),h=d(n,"background-repeat","value",r),m=n.width(),p=n.height(),g=n.padding()*2,v=m+(d(n,"background-width-relative-to","value",r)==="inner"?0:g),y=p+(d(n,"background-height-relative-to","value",r)==="inner"?0:g),b=n._private.rscratch,x=d(n,"background-clip","value",r),w=x==="node",C=d(n,"background-image-opacity","value",r)*a,k=d(n,"background-image-smoothing","value",r),E=n.pstyle("corner-radius").value;E!=="auto"&&(E=n.pstyle("corner-radius").pfValue);var S=t.width||t.cachedW,_=t.height||t.cachedH;(S==null||_==null)&&(document.body.appendChild(t),S=t.cachedW=t.width||t.offsetWidth,_=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var N=S,T=_;if(d(n,"background-width","value",r)!=="auto"&&(d(n,"background-width","units",r)==="%"?N=d(n,"background-width","pfValue",r)*v:N=d(n,"background-width","pfValue",r)),d(n,"background-height","value",r)!=="auto"&&(d(n,"background-height","units",r)==="%"?T=d(n,"background-height","pfValue",r)*y:T=d(n,"background-height","pfValue",r)),!(N===0||T===0)){if(f==="contain"){var O=Math.min(v/N,y/T);N*=O,T*=O}else if(f==="cover"){var O=Math.max(v/N,y/T);N*=O,T*=O}var P=l-v/2,F=d(n,"background-position-x","units",r),D=d(n,"background-position-x","pfValue",r);F==="%"?P+=(v-N)*D:P+=D;var $=d(n,"background-offset-x","units",r),L=d(n,"background-offset-x","pfValue",r);$==="%"?P+=(v-N)*L:P+=L;var I=u-y/2,z=d(n,"background-position-y","units",r),G=d(n,"background-position-y","pfValue",r);z==="%"?I+=(y-T)*G:I+=G;var q=d(n,"background-offset-y","units",r),X=d(n,"background-offset-y","pfValue",r);q==="%"?I+=(y-T)*X:I+=X,b.pathCache&&(P-=l,I-=u,l=0,u=0);var te=e.globalAlpha;e.globalAlpha=C;var le=i.getImgSmoothing(e),ue=!1;if(k==="no"&&le?(i.setImgSmoothing(e,!1),ue=!0):k==="yes"&&!le&&(i.setImgSmoothing(e,!0),ue=!0),h==="no-repeat")w&&(e.save(),b.pathCache?e.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,l,u,v,y,E,b),e.clip())),i.safeDrawImage(e,t,0,0,S,_,P,I,N,T),w&&e.restore();else{var ne=e.createPattern(t,h);e.fillStyle=ne,i.nodeShapes[i.getNodeShape(n)].draw(e,l,u,v,y,E,b),e.translate(P,I),e.fill(),e.translate(-P,-I)}e.globalAlpha=te,ue&&i.setImgSmoothing(e,le)}};var Ri={};Ri.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(B0(n*r));t=Math.pow(2,a)}var i=e.pstyle("font-size").pfValue*t,s=e.pstyle("min-zoomed-font-size").pfValue;return!(i<s)},Ri.drawElementText=function(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(r==null){if(i&&!s.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var l=t.pstyle("label");if(!l||!l.value)return;var u=s.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var c=t.element()._private.rscratch.badLine,d=t.pstyle("label"),f=t.pstyle("source-label"),h=t.pstyle("target-label");if(c||(!d||!d.value)&&(!f||!f.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var m=!n,p;n&&(p=n,e.translate(-p.x1,-p.y1)),a==null?(s.drawText(e,t,null,m,i),t.isEdge()&&(s.drawText(e,t,"source",m,i),s.drawText(e,t,"target",m,i))):s.drawText(e,t,a,m,i),n&&e.translate(p.x1,p.y1)},Ri.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},Ri.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,l=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*l,c=t.pstyle("color").value,d=t.pstyle("text-outline-color").value;e.font=r+" "+s+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],l),this.colorStrokeStyle(e,d[0],d[1],d[2],u)};function fy(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+r-i,n),e.quadraticCurveTo(t+r,n,t+r,n+i),e.lineTo(t+r,n+a-i),e.quadraticCurveTo(t+r,n+a,t+r-i,n+a),e.lineTo(t+i,n+a),e.quadraticCurveTo(t,n+a,t,n+a-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath(),s?e.stroke():e.fill()}Ri.getTextAngle=function(e,t){var n,r=e._private,a=r.rscratch,i=t?t+"-":"",s=e.pstyle(i+"text-rotation"),l=Zr(a,"labelAngle",t);return s.strValue==="autorotate"?n=e.isEdge()?l:0:s.strValue==="none"?n=0:n=s.pfValue,n},Ri.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=t._private,s=i.rscratch,l=a?t.effectiveOpacity():1;if(!(a&&(l===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var u=Zr(s,"labelX",n),c=Zr(s,"labelY",n),d,f,h=this.getLabelText(t,n);if(h!=null&&h!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var m=n?n+"-":"",p=Zr(s,"labelWidth",n),g=Zr(s,"labelHeight",n),v=t.pstyle(m+"text-margin-x").pfValue,y=t.pstyle(m+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;b&&(x="center",w="center"),u+=v,c+=y;var C;switch(r?C=this.getTextAngle(t,n):C=0,C!==0&&(d=u,f=c,e.translate(d,f),e.rotate(C),u=0,c=0),w){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g;break}var k=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,S=t.pstyle("text-border-width").pfValue,_=t.pstyle("text-background-padding").pfValue,N=t.pstyle("text-background-shape").strValue,T=N.indexOf("round")===0,O=2;if(k>0||S>0&&E>0){var P=u-_;switch(x){case"left":P-=p;break;case"center":P-=p/2;break}var F=c-g-_,D=p+2*_,$=g+2*_;if(k>0){var L=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+k*l+")",T?fy(e,P,F,D,$,O):e.fillRect(P,F,D,$),e.fillStyle=L}if(S>0&&E>0){var z=e.strokeStyle,G=e.lineWidth,q=t.pstyle("text-border-color").value,X=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+q[0]+","+q[1]+","+q[2]+","+E*l+")",e.lineWidth=S,e.setLineDash)switch(X){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=S/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(T?fy(e,P,F,D,$,O,"stroke"):e.strokeRect(P,F,D,$),X==="double"){var te=S/2;T?fy(e,P+te,F+te,D-te*2,$-te*2,O,"stroke"):e.strokeRect(P+te,F+te,D-te*2,$-te*2)}e.setLineDash&&e.setLineDash([]),e.lineWidth=G,e.strokeStyle=z}}var le=2*t.pstyle("text-outline-width").pfValue;if(le>0&&(e.lineWidth=le),t.pstyle("text-wrap").value==="wrap"){var ue=Zr(s,"labelWrapCachedLines",n),ne=Zr(s,"labelLineHeight",n),oe=p/2,U=this.getLabelJustification(t);switch(U==="auto"||(x==="left"?U==="left"?u+=-p:U==="center"&&(u+=-oe):x==="center"?U==="left"?u+=-oe:U==="right"&&(u+=oe):x==="right"&&(U==="center"?u+=oe:U==="right"&&(u+=p))),w){case"top":c-=(ue.length-1)*ne;break;case"center":case"bottom":c-=(ue.length-1)*ne;break}for(var K=0;K<ue.length;K++)le>0&&e.strokeText(ue[K],u,c),e.fillText(ue[K],u,c),c+=ne}else le>0&&e.strokeText(h,u,c),e.fillText(h,u,c);C!==0&&(e.rotate(-C),e.translate(-d,-f))}}};var sl={};sl.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l,u,c=t._private,d=c.rscratch,f=t.position();if(!(!Ee(f.x)||!Ee(f.y))&&!(i&&!t.visible())){var h=i?t.effectiveOpacity():1,m=s.usePaths(),p,g=!1,v=t.padding();l=t.width()+2*v,u=t.height()+2*v;var y;n&&(y=n,e.translate(-y.x1,-y.y1));for(var b=t.pstyle("background-image"),x=b.value,w=new Array(x.length),C=new Array(x.length),k=0,E=0;E<x.length;E++){var S=x[E],_=w[E]=S!=null&&S!=="none";if(_){var N=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",E);k++,C[E]=s.getCachedImage(S,N,function(){c.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var T=t.pstyle("background-blacken").value,O=t.pstyle("border-width").pfValue,P=t.pstyle("background-opacity").value*h,F=t.pstyle("border-color").value,D=t.pstyle("border-style").value,$=t.pstyle("border-join").value,L=t.pstyle("border-cap").value,I=t.pstyle("border-position").value,z=t.pstyle("border-dash-pattern").pfValue,G=t.pstyle("border-dash-offset").pfValue,q=t.pstyle("border-opacity").value*h,X=t.pstyle("outline-width").pfValue,te=t.pstyle("outline-color").value,le=t.pstyle("outline-style").value,ue=t.pstyle("outline-opacity").value*h,ne=t.pstyle("outline-offset").value,oe=t.pstyle("corner-radius").value;oe!=="auto"&&(oe=t.pstyle("corner-radius").pfValue);var U=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P;s.eleFillStyle(e,t,he)},K=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;s.colorStrokeStyle(e,F[0],F[1],F[2],he)},Z=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ue;s.colorStrokeStyle(e,te[0],te[1],te[2],he)},de=function(he,ae,ye,Pe){var Ie=s.nodePathCache=s.nodePathCache||[],W=a5(ye==="polygon"?ye+","+Pe.join(","):ye,""+ae,""+he,""+oe),fe=Ie[W],ie,we=!1;return fe!=null?(ie=fe,we=!0,d.pathCache=ie):(ie=new Path2D,Ie[W]=d.pathCache=ie),{path:ie,cacheHit:we}},be=t.pstyle("shape").strValue,Be=t.pstyle("shape-polygon-points").pfValue;if(m){e.translate(f.x,f.y);var pe=de(l,u,be,Be);p=pe.path,g=pe.cacheHit}var xe=function(){if(!g){var he=f;m&&(he={x:0,y:0}),s.nodeShapes[s.getNodeShape(t)].draw(p||e,he.x,he.y,l,u,oe,d)}m?e.fill(p):e.fill()},ge=function(){for(var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ye=c.backgrounding,Pe=0,Ie=0;Ie<C.length;Ie++){var W=t.cy().style().getIndexedStyle(t,"background-image-containment","value",Ie);if(ae&&W==="over"||!ae&&W==="inside"){Pe++;continue}w[Ie]&&C[Ie].complete&&!C[Ie].error&&(Pe++,s.drawInscribedImage(e,C[Ie],t,Ie,he))}c.backgrounding=Pe!==k,ye!==c.backgrounding&&t.updateStyle(!1)},Ce=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;s.hasPie(t)&&(s.drawPie(e,t,ae),he&&(m||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,l,u,oe,d)))},Oe=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ae=(T>0?T:-T)*he,ye=T>0?0:255;T!==0&&(s.colorFillStyle(e,ye,ye,ye,ae),m?e.fill(p):e.fill())},Ae=function(){if(O>0){if(e.lineWidth=O,e.lineCap=L,e.lineJoin=$,e.setLineDash)switch(D){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(z),e.lineDashOffset=G;break;case"solid":case"double":e.setLineDash([]);break}if(I!=="center"){if(e.save(),e.lineWidth*=2,I==="inside")m?e.clip(p):e.clip();else{var he=new Path2D;he.rect(-l/2-O,-u/2-O,l+2*O,u+2*O),he.addPath(p),e.clip(he,"evenodd")}m?e.stroke(p):e.stroke(),e.restore()}else m?e.stroke(p):e.stroke();if(D==="double"){e.lineWidth=O/3;var ae=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",m?e.stroke(p):e.stroke(),e.globalCompositeOperation=ae}e.setLineDash&&e.setLineDash([])}},Se=function(){if(X>0){if(e.lineWidth=X,e.lineCap="butt",e.setLineDash)switch(le){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var he=f;m&&(he={x:0,y:0});var ae=s.getNodeShape(t),ye=O;I==="inside"&&(ye=0),I==="outside"&&(ye*=2);var Pe=(l+ye+(X+ne))/l,Ie=(u+ye+(X+ne))/u,W=l*Pe,fe=u*Ie,ie=s.nodeShapes[ae].points,we;if(m){var nt=de(W,fe,ae,ie);we=nt.path}if(ae==="ellipse")s.drawEllipsePath(we||e,he.x,he.y,W,fe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ae)){var Qe=0,lt=0,ft=0;ae==="round-diamond"?Qe=(ye+ne+X)*1.4:ae==="round-heptagon"?(Qe=(ye+ne+X)*1.075,ft=-(ye/2+ne+X)/35):ae==="round-hexagon"?Qe=(ye+ne+X)*1.12:ae==="round-pentagon"?(Qe=(ye+ne+X)*1.13,ft=-(ye/2+ne+X)/15):ae==="round-tag"?(Qe=(ye+ne+X)*1.12,lt=(ye/2+X+ne)*.07):ae==="round-triangle"&&(Qe=(ye+ne+X)*(Math.PI/2),ft=-(ye+ne/2+X)/Math.PI),Qe!==0&&(Pe=(l+Qe)/l,W=l*Pe,["round-hexagon","round-tag"].includes(ae)||(Ie=(u+Qe)/u,fe=u*Ie)),oe=oe==="auto"?w5(W,fe):oe;for(var gt=W/2,qt=fe/2,Tt=oe+(ye+X+ne)/2,Ot=new Array(ie.length/2),Kt=new Array(ie.length/2),Wt=0;Wt<ie.length/2;Wt++)Ot[Wt]={x:he.x+lt+gt*ie[Wt*2],y:he.y+ft+qt*ie[Wt*2+1]};var Rt,$n,xn,kn,yt=Ot.length;for($n=Ot[yt-1],Rt=0;Rt<yt;Rt++)xn=Ot[Rt%yt],kn=Ot[(Rt+1)%yt],Kt[Rt]=iy($n,xn,kn,Tt),$n=xn,xn=kn;s.drawRoundPolygonPath(we||e,he.x+lt,he.y+ft,l*Pe,u*Ie,ie,Kt)}else if(["roundrectangle","round-rectangle"].includes(ae))oe=oe==="auto"?Ni(W,fe):oe,s.drawRoundRectanglePath(we||e,he.x,he.y,W,fe,oe+(ye+X+ne)/2);else if(["cutrectangle","cut-rectangle"].includes(ae))oe=oe==="auto"?$0():oe,s.drawCutRectanglePath(we||e,he.x,he.y,W,fe,null,oe+(ye+X+ne)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ae))oe=oe==="auto"?Ni(W,fe):oe,s.drawBottomRoundRectanglePath(we||e,he.x,he.y,W,fe,oe+(ye+X+ne)/2);else if(ae==="barrel")s.drawBarrelPath(we||e,he.x,he.y,W,fe);else if(ae.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ae)){var Nt=(ye+X+ne)/l;ie=Mf(Vf(ie,Nt)),s.drawPolygonPath(we||e,he.x,he.y,l,u,ie)}else{var Lt=(ye+X+ne)/l;ie=Mf(Vf(ie,-Lt)),s.drawPolygonPath(we||e,he.x,he.y,l,u,ie)}if(m?e.stroke(we):e.stroke(),le==="double"){e.lineWidth=ye/3;var Fn=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",m?e.stroke(we):e.stroke(),e.globalCompositeOperation=Fn}e.setLineDash&&e.setLineDash([])}},Le=function(){a&&s.drawNodeOverlay(e,t,f,l,u)},De=function(){a&&s.drawNodeUnderlay(e,t,f,l,u)},ze=function(){s.drawElementText(e,t,null,r)},B=t.pstyle("ghost").value==="yes";if(B){var M=t.pstyle("ghost-offset-x").pfValue,Y=t.pstyle("ghost-offset-y").pfValue,Q=t.pstyle("ghost-opacity").value,ee=Q*h;e.translate(M,Y),Z(),Se(),U(Q*P),xe(),ge(ee,!0),K(Q*q),Ae(),Ce(T!==0||O!==0),ge(ee,!1),Oe(ee),e.translate(-M,-Y)}m&&e.translate(-f.x,-f.y),De(),m&&e.translate(f.x,f.y),Z(),Se(),U(),xe(),ge(h,!0),K(),Ae(),Ce(T!==0||O!==0),ge(h,!1),Oe(),m&&e.translate(-f.x,-f.y),ze(),Le(),n&&e.translate(y.x1,y.y1)}};var C4=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,a,i){var s=this;if(n.visible()){var l=n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-opacity")).value,c=n.pstyle("".concat(e,"-color")).value,d=n.pstyle("".concat(e,"-shape")).value,f=n.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(r=r||n.position(),a==null||i==null){var h=n.padding();a=n.width()+2*h,i=n.height()+2*h}s.colorFillStyle(t,c[0],c[1],c[2],u),s.nodeShapes[d].draw(t,r.x,r.y,a+l*2,i+l*2,f),t.fill()}}}};sl.drawNodeOverlay=C4("overlay"),sl.drawNodeUnderlay=C4("underlay"),sl.hasPie=function(e){return e=e[0],e._private.hasPie},sl.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),s=r.x,l=r.y,u=t.width(),c=t.height(),d=Math.min(u,c)/2,f=0,h=this.usePaths();h&&(s=0,l=0),i.units==="%"?d=d*i.pfValue:i.pfValue!==void 0&&(d=i.pfValue/2);for(var m=1;m<=a.pieBackgroundN;m++){var p=t.pstyle("pie-"+m+"-background-size").value,g=t.pstyle("pie-"+m+"-background-color").value,v=t.pstyle("pie-"+m+"-background-opacity").value*n,y=p/100;y+f>1&&(y=1-f);var b=1.5*Math.PI+2*Math.PI*f,x=2*Math.PI*y,w=b+x;p===0||f>=1||f+y>1||(e.beginPath(),e.moveTo(s,l),e.arc(s,l,d,b,w),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],v),e.fill(),f+=y)}};var dr={},Qle=100;dr.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},dr.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;a<t.length;a++)if(r=t[a],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},dr.createGradientStyleFor=function(e,t,n,r,a){var i,s=this.usePaths(),l=n.pstyle(t+"-gradient-stop-colors").value,u=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var c=n.sourceEndpoint(),d=n.targetEndpoint(),f=n.midpoint(),h=Bi(c,f),m=Bi(d,f);i=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(h,m))}else{var p=s?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();i=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(g,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),b=n.targetEndpoint();i=e.createLinearGradient(y.x,y.y,b.x,b.y)}else{var x=s?{x:0,y:0}:n.position(),w=n.paddedWidth(),C=n.paddedHeight(),k=w/2,E=C/2,S=n.pstyle("background-gradient-direction").value;switch(S){case"to-bottom":i=e.createLinearGradient(x.x,x.y-E,x.x,x.y+E);break;case"to-top":i=e.createLinearGradient(x.x,x.y+E,x.x,x.y-E);break;case"to-left":i=e.createLinearGradient(x.x+k,x.y,x.x-k,x.y);break;case"to-right":i=e.createLinearGradient(x.x-k,x.y,x.x+k,x.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(x.x-k,x.y-E,x.x+k,x.y+E);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(x.x-k,x.y+E,x.x+k,x.y-E);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(x.x+k,x.y-E,x.x-k,x.y+E);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(x.x+k,x.y+E,x.x-k,x.y-E);break}}if(!i)return null;for(var _=u.length===l.length,N=l.length,T=0;T<N;T++)i.addColorStop(_?u[T]:T/(N-1),"rgba("+l[T][0]+","+l[T][1]+","+l[T][2]+","+a+")");return i},dr.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a},dr.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"},dr.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}},dr.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a},dr.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"},dr.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}},dr.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],s=t.getPixelRatio(),l=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(s=l);var u=a*s,c=i*s,d;if(!(u===t.canvasWidth&&c===t.canvasHeight)){t.fontCaches=null;var f=n.canvasContainer;f.style.width=a+"px",f.style.height=i+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)d=n.canvases[h],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<t.BUFFER_COUNT;h++)d=n.bufferCanvases[h],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";t.textureMult=1,s<=1&&(d=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,d.width=u*t.textureMult,d.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},dr.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},dr.render=function(e){e=e||d5();var t=e.forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,a=e.forcedZoom,i=e.forcedPan,s=this,l=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,u=s.cy,c=s.data,d=c.canvasNeedsRedraw,f=s.textureOnViewport&&!t&&(s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming),h=e.motionBlur!==void 0?e.motionBlur:s.motionBlur,m=s.motionBlurPxRatio,p=u.hasCompoundNodes(),g=s.hoverData.draggingEles,v=!!(s.hoverData.selecting||s.touchData.selecting);h=h&&!t&&s.motionBlurEnabled&&!v;var y=h;t||(s.prevPxRatio!==l&&(s.invalidateContainerClientCoordsCache(),s.matchCanvasSize(s.container),s.redrawHint("eles",!0),s.redrawHint("drag",!0)),s.prevPxRatio=l),!t&&s.motionBlurTimeout&&clearTimeout(s.motionBlurTimeout),h&&(s.mbFrames==null&&(s.mbFrames=0),s.mbFrames++,s.mbFrames<3&&(y=!1),s.mbFrames>s.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!f&&(d[s.NODE]=!0,d[s.SELECT_BOX]=!0);var b=u.style(),x=u.zoom(),w=a!==void 0?a:x,C=u.pan(),k={x:C.x,y:C.y},E={zoom:x,pan:{x:C.x,y:C.y}},S=s.prevViewport,_=S===void 0||E.zoom!==S.zoom||E.pan.x!==S.pan.x||E.pan.y!==S.pan.y;!_&&!(g&&!p)&&(s.motionBlurPxRatio=1),i&&(k=i),w*=l,k.x*=l,k.y*=l;var N=s.getCachedZSortedEles();function T(pe,xe,ge,Ce,Oe){var Ae=pe.globalCompositeOperation;pe.globalCompositeOperation="destination-out",s.colorFillStyle(pe,255,255,255,s.motionBlurTransparency),pe.fillRect(xe,ge,Ce,Oe),pe.globalCompositeOperation=Ae}function O(pe,xe){var ge,Ce,Oe,Ae;!s.clearingMotionBlur&&(pe===c.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||pe===c.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(ge={x:C.x*m,y:C.y*m},Ce=x*m,Oe=s.canvasWidth*m,Ae=s.canvasHeight*m):(ge=k,Ce=w,Oe=s.canvasWidth,Ae=s.canvasHeight),pe.setTransform(1,0,0,1,0,0),xe==="motionBlur"?T(pe,0,0,Oe,Ae):!t&&(xe===void 0||xe)&&pe.clearRect(0,0,Oe,Ae),n||(pe.translate(ge.x,ge.y),pe.scale(Ce,Ce)),i&&pe.translate(i.x,i.y),a&&pe.scale(a,a)}if(f||(s.textureDrawLastFrame=!1),f){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=u.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var P=s.data.bufferContexts[s.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:l*s.textureMult});var E=s.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:s.canvasWidth,height:s.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}d[s.DRAG]=!1,d[s.NODE]=!1;var F=c.contexts[s.NODE],D=s.textureCache.texture,E=s.textureCache.viewport;F.setTransform(1,0,0,1,0,0),h?T(F,0,0,E.width,E.height):F.clearRect(0,0,E.width,E.height);var $=b.core("outside-texture-bg-color").value,L=b.core("outside-texture-bg-opacity").value;s.colorFillStyle(F,$[0],$[1],$[2],L),F.fillRect(0,0,E.width,E.height);var x=u.zoom();O(F,!1),F.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l),F.drawImage(D,E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l)}else s.textureOnViewport&&!t&&(s.textureCache=null);var I=u.extent(),z=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),G=s.hideEdgesOnViewport&&z,q=[];if(q[s.NODE]=!d[s.NODE]&&h&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,q[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),q[s.DRAG]=!d[s.DRAG]&&h&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,q[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),d[s.NODE]||n||r||q[s.NODE]){var X=h&&!q[s.NODE]&&m!==1,F=t||(X?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:c.contexts[s.NODE]),te=h&&!X?"motionBlur":void 0;O(F,te),G?s.drawCachedNodes(F,N.nondrag,l,I):s.drawLayeredElements(F,N.nondrag,l,I),s.debug&&s.drawDebugPoints(F,N.nondrag),!n&&!h&&(d[s.NODE]=!1)}if(!r&&(d[s.DRAG]||n||q[s.DRAG])){var X=h&&!q[s.DRAG]&&m!==1,F=t||(X?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:c.contexts[s.DRAG]);O(F,h&&!X?"motionBlur":void 0),G?s.drawCachedNodes(F,N.drag,l,I):s.drawCachedElements(F,N.drag,l,I),s.debug&&s.drawDebugPoints(F,N.drag),!n&&!h&&(d[s.DRAG]=!1)}if(s.showFps||!r&&d[s.SELECT_BOX]&&!n){var F=t||c.contexts[s.SELECT_BOX];if(O(F),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var x=s.cy.zoom(),le=b.core("selection-box-border-width").value/x;F.lineWidth=le,F.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",F.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),le>0&&(F.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",F.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(c.bgActivePosistion&&!s.hoverData.selecting){var x=s.cy.zoom(),ue=c.bgActivePosistion;F.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",F.beginPath(),F.arc(ue.x,ue.y,b.core("active-bg-size").pfValue/x,0,2*Math.PI),F.fill()}var ne=s.lastRedrawTime;if(s.showFps&&ne){ne=Math.round(ne);var oe=Math.round(1e3/ne);F.setTransform(1,0,0,1,0,0),F.fillStyle="rgba(255, 0, 0, 0.75)",F.strokeStyle="rgba(255, 0, 0, 0.75)",F.lineWidth=1,F.fillText("1 frame = "+ne+" ms = "+oe+" fps",0,20);var U=60;F.strokeRect(0,30,250,20),F.fillRect(0,30,250*Math.min(oe/U,1),20)}n||(d[s.SELECT_BOX]=!1)}if(h&&m!==1){var K=c.contexts[s.NODE],Z=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],de=c.contexts[s.DRAG],be=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],Be=function(pe,xe,ge){pe.setTransform(1,0,0,1,0,0),ge||!y?pe.clearRect(0,0,s.canvasWidth,s.canvasHeight):T(pe,0,0,s.canvasWidth,s.canvasHeight);var Ce=m;pe.drawImage(xe,0,0,s.canvasWidth*Ce,s.canvasHeight*Ce,0,0,s.canvasWidth,s.canvasHeight)};(d[s.NODE]||q[s.NODE])&&(Be(K,Z,q[s.NODE]),d[s.NODE]=!1),(d[s.DRAG]||q[s.DRAG])&&(Be(de,be,q[s.DRAG]),d[s.DRAG]=!1)}s.prevViewport=E,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),h&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!f,s.mbFrames=0,d[s.NODE]=!0,d[s.DRAG]=!0,s.redraw()},Qle)),t||u.emit("render")};var za={};za.drawPolygonPath=function(e,t,n,r,a,i){var s=r/2,l=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*i[0],n+l*i[1]);for(var u=1;u<i.length/2;u++)e.lineTo(t+s*i[u*2],n+l*i[u*2+1]);e.closePath()},za.drawRoundPolygonPath=function(e,t,n,r,a,i,s){s.forEach(function(l){return r4(e,l)}),e.closePath()},za.drawRoundRectanglePath=function(e,t,n,r,a,i){var s=r/2,l=a/2,u=i==="auto"?Ni(r,a):Math.min(i,l,s);e.beginPath&&e.beginPath(),e.moveTo(t,n-l),e.arcTo(t+s,n-l,t+s,n,u),e.arcTo(t+s,n+l,t,n+l,u),e.arcTo(t-s,n+l,t-s,n,u),e.arcTo(t-s,n-l,t,n-l,u),e.lineTo(t,n-l),e.closePath()},za.drawBottomRoundRectanglePath=function(e,t,n,r,a,i){var s=r/2,l=a/2,u=i==="auto"?Ni(r,a):i;e.beginPath&&e.beginPath(),e.moveTo(t,n-l),e.lineTo(t+s,n-l),e.lineTo(t+s,n),e.arcTo(t+s,n+l,t,n+l,u),e.arcTo(t-s,n+l,t-s,n,u),e.lineTo(t-s,n-l),e.lineTo(t,n-l),e.closePath()},za.drawCutRectanglePath=function(e,t,n,r,a,i,s){var l=r/2,u=a/2,c=s==="auto"?$0():s;e.beginPath&&e.beginPath(),e.moveTo(t-l+c,n-u),e.lineTo(t+l-c,n-u),e.lineTo(t+l,n-u+c),e.lineTo(t+l,n+u-c),e.lineTo(t+l-c,n+u),e.lineTo(t-l+c,n+u),e.lineTo(t-l,n+u-c),e.lineTo(t-l,n-u+c),e.closePath()},za.drawBarrelPath=function(e,t,n,r,a){var i=r/2,s=a/2,l=t-i,u=t+i,c=n-s,d=n+s,f=F0(r,a),h=f.widthOffset,m=f.heightOffset,p=f.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(l,c+m),e.lineTo(l,d-m),e.quadraticCurveTo(l+p,d,l+h,d),e.lineTo(u-h,d),e.quadraticCurveTo(u-p,d,u,d-m),e.lineTo(u,c+m),e.quadraticCurveTo(u-p,c,u-h,c),e.lineTo(l+h,c),e.quadraticCurveTo(l+p,c,l,c+m),e.closePath()};for(var E4=Math.sin(0),S4=Math.cos(0),py={},hy={},_4=Math.PI/40,ll=0*Math.PI;ll<2*Math.PI;ll+=_4)py[ll]=Math.sin(ll),hy[ll]=Math.cos(ll);za.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,s,l=r/2,u=a/2,c=0*Math.PI;c<2*Math.PI;c+=_4)i=t-l*py[c]*E4+l*hy[c]*S4,s=n+u*hy[c]*E4+u*py[c]*S4,c===0?e.moveTo(i,s):e.lineTo(i,s);e.closePath()};var cu={};cu.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},cu.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),a=this.findContainerClientCoords(),i=e.full?Math.ceil(r.w):a[2],s=e.full?Math.ceil(r.h):a[3],l=Ee(e.maxWidth)||Ee(e.maxHeight),u=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,s*=e.scale,c=e.scale;else if(l){var d=1/0,f=1/0;Ee(e.maxWidth)&&(d=c*e.maxWidth/i),Ee(e.maxHeight)&&(f=c*e.maxHeight/s),c=Math.min(d,f),i*=c,s*=c}l||(i*=u,s*=u,c*=u);var h=document.createElement("canvas");h.width=i,h.height=s,h.style.width=i+"px",h.style.height=s+"px";var m=h.getContext("2d");if(i>0&&s>0){m.clearRect(0,0,i,s),m.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)m.translate(-r.x1*c,-r.y1*c),m.scale(c,c),this.drawElements(m,p),m.scale(1/c,1/c),m.translate(r.x1*c,r.y1*c);else{var g=t.pan(),v={x:g.x*c,y:g.y*c};c*=t.zoom(),m.translate(v.x,v.y),m.scale(c,c),this.drawElements(m,p),m.scale(1/c,1/c),m.translate(-v.x,-v.y)}e.bg&&(m.globalCompositeOperation="destination-over",m.fillStyle=e.bg,m.rect(0,0,i,s),m.fill())}return h};function ece(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function B4(e){var t=e.indexOf(",");return e.substr(t+1)}function T4(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new qs(function(a,i){try{t.toBlob(function(s){s!=null?a(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(s){i(s)}});case"blob":return ece(B4(r()),n);case"base64":return B4(r());case"base64uri":default:return r()}}cu.png=function(e){return T4(e,this.bufferCanvasImage(e),"image/png")},cu.jpg=function(e){return T4(e,this.bufferCanvasImage(e),"image/jpeg")};var O4={};O4.nodeShapeImpl=function(e,t,n,r,a,i,s,l){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,s);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,s,l);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,l);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,s,l);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,l);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}};var tce=N4,st=N4.prototype;st.CANVAS_LAYERS=3,st.SELECT_BOX=0,st.DRAG=1,st.NODE=2,st.BUFFER_COUNT=3,st.TEXTURE_BUFFER=0,st.MOTIONBLUR_BUFFER_NODE=1,st.MOTIONBLUR_BUFFER_DRAG=2;function N4(e){var t=this,n=t.cy.window(),r=n.document;t.data={canvases:new Array(st.CANVAS_LAYERS),contexts:new Array(st.CANVAS_LAYERS),canvasNeedsRedraw:new Array(st.CANVAS_LAYERS),bufferCanvases:new Array(st.BUFFER_COUNT),bufferContexts:new Array(st.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var s=t.data.canvasContainer.style;t.data.canvasContainer.style[a]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var l=e.cy.container();l.appendChild(t.data.canvasContainer),l.style[a]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};jte()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var c=0;c<st.CANVAS_LAYERS;c++){var d=t.data.canvases[c]=r.createElement("canvas");t.data.contexts[c]=d.getContext("2d"),Object.keys(u).forEach(function(U){d.style[U]=u[U]}),d.style.position="absolute",d.setAttribute("data-id","layer"+c),d.style.zIndex=String(st.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(d),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[st.NODE].setAttribute("data-id","layer"+st.NODE+"-node"),t.data.canvases[st.SELECT_BOX].setAttribute("data-id","layer"+st.SELECT_BOX+"-selectbox"),t.data.canvases[st.DRAG].setAttribute("data-id","layer"+st.DRAG+"-drag");for(var c=0;c<st.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=r.createElement("canvas"),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext("2d"),t.data.bufferCanvases[c].style.position="absolute",t.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility="hidden";t.pathsEnabled=!0;var f=er(),h=function(U){return{x:(U.x1+U.x2)/2,y:(U.y1+U.y2)/2}},m=function(U){return{x:-U.w/2,y:-U.h/2}},p=function(U){var K=U[0]._private,Z=K.oldBackgroundTimestamp===K.backgroundTimestamp;return!Z},g=function(U){return U[0]._private.nodeKey},v=function(U){return U[0]._private.labelStyleKey},y=function(U){return U[0]._private.sourceLabelStyleKey},b=function(U){return U[0]._private.targetLabelStyleKey},x=function(U,K,Z,de,be){return t.drawElement(U,K,Z,!1,!1,be)},w=function(U,K,Z,de,be){return t.drawElementText(U,K,Z,de,"main",be)},C=function(U,K,Z,de,be){return t.drawElementText(U,K,Z,de,"source",be)},k=function(U,K,Z,de,be){return t.drawElementText(U,K,Z,de,"target",be)},E=function(U){return U.boundingBox(),U[0]._private.bodyBounds},S=function(U){return U.boundingBox(),U[0]._private.labelBounds.main||f},_=function(U){return U.boundingBox(),U[0]._private.labelBounds.source||f},N=function(U){return U.boundingBox(),U[0]._private.labelBounds.target||f},T=function(U,K){return K},O=function(U){return h(E(U))},P=function(U,K,Z){var de=U?U+"-":"";return{x:K.x+Z.pstyle(de+"text-margin-x").pfValue,y:K.y+Z.pstyle(de+"text-margin-y").pfValue}},F=function(U,K,Z){var de=U[0]._private.rscratch;return{x:de[K],y:de[Z]}},D=function(U){return P("",F(U,"labelX","labelY"),U)},$=function(U){return P("source",F(U,"sourceLabelX","sourceLabelY"),U)},L=function(U){return P("target",F(U,"targetLabelX","targetLabelY"),U)},I=function(U){return m(E(U))},z=function(U){return m(_(U))},G=function(U){return m(N(U))},q=function(U){var K=S(U),Z=m(S(U));if(U.isNode()){switch(U.pstyle("text-halign").value){case"left":Z.x=-K.w;break;case"right":Z.x=0;break}switch(U.pstyle("text-valign").value){case"top":Z.y=-K.h;break;case"bottom":Z.y=0;break}}return Z},X=t.data.eleTxrCache=new su(t,{getKey:g,doesEleInvalidateKey:p,drawElement:x,getBoundingBox:E,getRotationPoint:O,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),te=t.data.lblTxrCache=new su(t,{getKey:v,drawElement:w,getBoundingBox:S,getRotationPoint:D,getRotationOffset:q,isVisible:T}),le=t.data.slbTxrCache=new su(t,{getKey:y,drawElement:C,getBoundingBox:_,getRotationPoint:$,getRotationOffset:z,isVisible:T}),ue=t.data.tlbTxrCache=new su(t,{getKey:b,drawElement:k,getBoundingBox:N,getRotationPoint:L,getRotationOffset:G,isVisible:T}),ne=t.data.lyrTxrCache=new y4(t);t.onUpdateEleCalcs(function(U,K){X.invalidateElements(K),te.invalidateElements(K),le.invalidateElements(K),ue.invalidateElements(K),ne.invalidateElements(K);for(var Z=0;Z<K.length;Z++){var de=K[Z]._private;de.oldBackgroundTimestamp=de.backgroundTimestamp}});var oe=function(U){for(var K=0;K<U.length;K++)ne.enqueueElementRefinement(U[K].ele)};X.onDequeue(oe),te.onDequeue(oe),le.onDequeue(oe),ue.onDequeue(oe)}st.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[st.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[st.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[st.SELECT_BOX]=t;break}};var nce=typeof Path2D<"u";st.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},st.usePaths=function(){return nce&&this.pathsEnabled},st.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},st.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},st.makeOffscreenCanvas=function(e,t){var n;if((typeof OffscreenCanvas>"u"?"undefined":en(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=e,n.height=t}return n},[b4,xo,Jo,dy,Ri,sl,dr,za,cu,O4].forEach(function(e){He(st,e)});var rce=[{name:"null",impl:G3},{name:"base",impl:p4},{name:"canvas",impl:tce}],oce=[{type:"layout",extensions:ule},{type:"renderer",extensions:rce}],$4={},F4={};function P4(e,t,n){var r=n,a=function(E){ut("Can not register `"+t+"` for `"+e+"` since `"+E+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(ou.prototype[t])return a(t);ou.prototype[t]=n}else if(e==="collection"){if(vn.prototype[t])return a(t);vn.prototype[t]=n}else if(e==="layout"){for(var i=function(E){this.options=E,n.call(this,E),ot(this._private)||(this._private={}),this._private.cy=E.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(n.prototype),l=[],u=0;u<l.length;u++){var c=l[u];s[c]=s[c]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var d=n.prototype.stop;s.stop=function(){var E=this.options;if(E&&E.animate){var S=this.animations;if(S)for(var _=0;_<S.length;_++)S[_].stop()}return d?d.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var f=function(E){return E._private.cy},h={addEventFields:function(E,S){S.layout=E,S.cy=f(E),S.target=E},bubble:function(){return!0},parent:function(E){return f(E)}};He(s,{createEmitter:function(){return this._private.emitter=new ep(h,this),this},emitter:function(){return this._private.emitter},on:function(E,S){return this.emitter().on(E,S),this},one:function(E,S){return this.emitter().one(E,S),this},once:function(E,S){return this.emitter().one(E,S),this},removeListener:function(E,S){return this.emitter().removeListener(E,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(E,S){return this.emitter().emit(E,S),this}}),dt.eventAliasesOn(s),r=i}else if(e==="renderer"&&t!=="null"&&t!=="base"){var m=A4("renderer","base"),p=m.prototype,g=n,v=n.prototype,y=function(){m.apply(this,arguments),g.apply(this,arguments)},b=y.prototype;for(var x in p){var w=p[x],C=v[x]!=null;if(C)return a(x);b[x]=w}for(var k in v)b[k]=v[k];p.clientFunctions.forEach(function(E){b[E]=b[E]||function(){It("Renderer does not implement `renderer."+E+"()` on its prototype")}}),r=y}else if(e==="__proto__"||e==="constructor"||e==="prototype")return It(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return XS({map:$4,keys:[e,t],value:r})}function A4(e,t){return YS({map:$4,keys:[e,t]})}function ace(e,t,n,r,a){return XS({map:F4,keys:[e,t,n,r],value:a})}function ice(e,t,n,r){return YS({map:F4,keys:[e,t,n,r]})}var my=function(){if(arguments.length===2)return A4.apply(null,arguments);if(arguments.length===3)return P4.apply(null,arguments);if(arguments.length===4)return ice.apply(null,arguments);if(arguments.length===5)return ace.apply(null,arguments);It("Invalid extension access syntax")};ou.prototype.extension=my,oce.forEach(function(e){e.extensions.forEach(function(t){P4(e.type,t.name,t.impl)})});var I4=function e(){if(!(this instanceof e))return new e;this.length=0},Mi=I4.prototype;Mi.instanceString=function(){return"stylesheet"},Mi.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},Mi.css=function(e,t){var n=this.length-1;if(Ve(e))this[n].properties.push({name:e,value:t});else if(ot(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var s=a[i],l=r[s];if(l!=null){var u=Tn.properties[s]||Tn.properties[Tf(s)];if(u!=null){var c=u.name,d=l;this[n].properties.push({name:c,value:d})}}}return this},Mi.style=Mi.css,Mi.generateStyle=function(e){var t=new Tn(e);return this.appendToStyle(t)},Mi.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var s=a[i];e.css(s.name,s.value)}}return e};var sce="3.30.2",Vi=function(e){if(e===void 0&&(e={}),ot(e))return new ou(e);if(Ve(e))return my.apply(my,arguments)};Vi.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(Vi),e.apply(null,t),this},Vi.warnings=function(e){return c5(e)},Vi.version=sce,Vi.stylesheet=Vi.Stylesheet=I4;let lce=class{constructor(e,t){Do(this,"cyg",null),Do(this,"nodes",[]),Do(this,"edges",[]),Do(this,"axons",[]),Do(this,"dendrites",[]),Do(this,"labelCache",new Map),Do(this,"graphCanvas",null),this.labelCache=e,this.graphCanvas=t}async addConnectivity(e){if(this.axons=e.axons.map(t=>JSON.stringify(t)),this.dendrites=e.dendrites.map(t=>JSON.stringify(t)),e.connectivity.length)for(const t of e.connectivity){const n=await this.graphNode(t[0]),r=await this.graphNode(t[1]);this.nodes.push(n),this.nodes.push(r),this.edges.push({id:`${n.id}_${r.id}`,source:n.id,target:r.id})}else this.nodes.push({id:"MISSING",label:"NO PATHS"})}showConnectivity(e){this.cyg=new uce(this,e)}clearConnectivity(){var e;(e=this.cyg)!=null&&e.cy&&(this.cyg.cy.remove(),this.cyg.cy=null)}reset(){var e;(e=this.cyg)!=null&&e.cy&&this.cyg.cy.reset()}enableZoom(e){var t;(t=this.cyg)!=null&&t.cy&&this.cyg.cy.userZoomingEnabled(e)}get elements(){return[...this.nodes.map(e=>({data:e})),...this.edges.map(e=>({data:e}))]}get roots(){return this.dendrites}async graphNode(e){const t=JSON.stringify(e),n=[e[0],...e[1]],r=[];for(const i of n){const s=this.labelCache.has(i)?this.labelCache.get(i):"";r.push(s)}n.push(...r);const a={id:t,label:n.join(`
494
- `)};return this.axons.includes(t)?this.dendrites.includes(t)?a["both-a-d"]=!0:a.axon=!0:this.dendrites.includes(t)&&(a.dendrite=!0),a}};const cce=[{selector:"node",style:{label:"data(label)","background-color":"#80F0F0","text-valign":"center","text-wrap":"wrap","text-max-width":"80px","font-size":"6px"}},{selector:"node[axon]",style:{"background-color":"green"}},{selector:"node[dendrite]",style:{"background-color":"red"}},{selector:"node[both-a-d]",style:{"background-color":"gray"}},{selector:"edge",style:{width:2,"line-color":"#9dbaea","target-arrow-color":"#9dbaea","target-arrow-shape":"triangle","curve-style":"bezier"}}];class uce{constructor(t,n){Do(this,"cy"),Do(this,"tooltip");var r;this.cy=Vi({container:n,elements:t.elements,layout:{name:"breadthfirst",circle:!1,roots:t.roots},directed:!0,style:cce,minZoom:.5,maxZoom:10,wheelSensitivity:.4}).on("mouseover","node",this.overNode.bind(this)).on("mouseout","node",this.exitNode.bind(this)).on("position","node",this.moveNode.bind(this)),this.tooltip=document.createElement("div"),this.tooltip.className="cy-graph-tooltip",this.tooltip.hidden=!0,(r=n==null?void 0:n.lastChild)==null||r.appendChild(this.tooltip)}remove(){this.cy&&this.cy.destroy()}checkRightBoundary(t){var n;t+this.tooltip.offsetWidth>=((n=this.tooltip.parentElement)==null?void 0:n.offsetWidth)&&(this.tooltip.style.left=`${t-this.tooltip.offsetWidth}px`)}overNode(t){const n=t.target;this.tooltip.innerText=n.data().label,this.tooltip.style.left=`${t.renderedPosition.x}px`,this.tooltip.style.top=`${t.renderedPosition.y}px`,this.tooltip.hidden=!1,this.checkRightBoundary(t.renderedPosition.x)}moveNode(t){const n=t.target;this.tooltip.style.left=`${n.renderedPosition().x}px`,this.tooltip.style.top=`${n.renderedPosition().y}px`,this.checkRightBoundary(n.renderedPosition().x)}exitNode(t){this.tooltip.hidden=!0}}const dce=1.3,fce=24*60*60*1e3,pce="Reset position",D4="Lock zoom (to scroll)",hce="Unlock zoom",mce="#8300bf",gce={name:"ConnectivityGraph",props:{entry:{type:String,default:""},mapServer:{type:String,default:""}},data:function(){return{loading:!0,connectivityGraph:null,selectedSource:"",pathList:[],schemaVersion:"",knowledgeByPath:new Map,labelledTerms:new Set,labelCache:new Map,resetLabel:pce,zoomLockLabel:D4,iconColor:mce,zoomEnabled:!1}},mounted(){this.refreshCache(),this.loadCacheData(),this.run().then(e=>{this.showGraph(this.entry)})},methods:{loadCacheData:function(){const e=sessionStorage.getItem("connectivity-graph-source"),t=sessionStorage.getItem("connectivity-graph-labels"),n=sessionStorage.getItem("connectivity-graph-pathlist"),r=sessionStorage.getItem("connectivity-graph-schema-version");if(e&&(this.selectedSource=e),n&&(this.pathList=JSON.parse(n)),t){const a=JSON.parse(t);this.labelCache=new Map(Object.entries(a))}r&&(this.schemaVersion=r)},removeAllCacheData:function(){["connectivity-graph-expiry","connectivity-graph-source","connectivity-graph-labels","connectivity-graph-pathlist","connectivity-graph-schema-version"].forEach(e=>{sessionStorage.removeItem(e)})},refreshCache:function(){const e=sessionStorage.getItem("connectivity-graph-expiry");new Date().getTime()>e&&this.removeAllCacheData()},updateCacheExpiry:function(){const e=new Date().getTime()+fce;sessionStorage.setItem("connectivity-graph-expiry",e)},run:async function(){if(this.schemaVersion||(this.schemaVersion=await this.getSchemaVersion(),sessionStorage.setItem("connectivity-graph-schema-version",this.schemaVersion),this.updateCacheExpiry()),this.schemaVersion<dce){console.warn("No Server!");return}this.showSpinner(),this.selectedSource||(this.selectedSource=await this.setSourceList(),sessionStorage.setItem("connectivity-graph-source",this.selectedSource),this.updateCacheExpiry()),await this.setPathList(this.selectedSource),this.hideSpinner()},showGraph:async function(e){const t=this.$refs.graphCanvas;this.showSpinner(),this.connectivityGraph=new lce(this.labelCache,t),await this.connectivityGraph.addConnectivity(this.knowledgeByPath.get(e)),this.hideSpinner(),this.connectivityGraph.showConnectivity(t)},query:async function(e,t){const n=`${this.mapServer}knowledge/query/`,r={sql:e,params:t};try{const a=await fetch(n,{method:"POST",headers:{Accept:"application/json; charset=utf-8","Cache-Control":"no-store","Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw new Error(`Cannot access ${n}`);return await a.json()}catch{return{values:[]}}},setSourceList:async function(){const e=await this.getJsonData(`${this.mapServer}knowledge/sources`),t=e?e.sources||[]:[];let n="";for(const r of t)r&&n===""&&(n=r);return n},loadPathData:async function(e){const t=await this.query(`select entity, knowledge from knowledge
493
+ `),x=0;x<b.length;x++){var w=b[x],C=p.measureText(w),k=Math.ceil(C.width),E=d;v=Math.max(k,v),y+=E}return v+=u,y+=u,s[i]={width:v,height:y}},wo.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,a=e.isEdge(),i=t?t+"-":"",s=e.pstyle(i+"text-rotation"),l=s.strValue;return l==="none"?0:a&&l==="autorotate"?r.labelAutoAngle:l==="autorotate"?0:s.pfValue},wo.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,a=r.rscratch;a.labelAngle=t.calculateLabelAngle(e),n&&(a.sourceLabelAngle=t.calculateLabelAngle(e,"source"),a.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var s4={},l4=28,c4=!1;s4.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<l4||e.height()<l4))return c4||(ut("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),c4=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var vp={};vp.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(i),s)for(var l=0;l<i.length;l++){var u=i[l],c=u._private,d=c.rstyle;d.clean=!1,d.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(i){var s=i.target;r(s)}).on("style.* background.*",function(i){var s=i.target;r(s,!1)});var a=function(i){if(i){var s=n.onUpdateEleCalcsFns;t.cleanStyle();for(var l=0;l<t.length;l++){var u=t[l],c=u._private.rstyle;u.isNode()&&!c.cleanConnected&&(r(u.connectedEdges()),c.cleanConnected=!0)}if(s)for(var d=0;d<s.length;d++){var f=s[d];f(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)},vp.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)},vp.recalculateRenderedStyle=function(e,t){var n=function(x){return x._private.rstyle.cleanConnected},r=[],a=[];if(!this.destroyed){t===void 0&&(t=!0);for(var i=0;i<e.length;i++){var s=e[i],l=s._private,u=l.rstyle;s.isEdge()&&(!n(s.source())||!n(s.target()))&&(u.clean=!1),!(t&&u.clean||s.removed())&&s.pstyle("display").value!=="none"&&(l.group==="nodes"?a.push(s):r.push(s),u.clean=!0)}for(var c=0;c<a.length;c++){var d=a[c],f=d._private,h=f.rstyle,m=d.position();this.recalculateNodeLabelProjection(d),h.nodeX=m.x,h.nodeY=m.y,h.nodeW=d.pstyle("width").pfValue,h.nodeH=d.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var g=r[p],v=g._private,y=v.rstyle,b=v.rscratch;y.srcX=b.arrowStartX,y.srcY=b.arrowStartY,y.tgtX=b.arrowEndX,y.tgtY=b.arrowEndY,y.midX=b.midX,y.midY=b.midY,y.labelAngle=b.labelAngle,y.sourceLabelAngle=b.sourceLabelAngle,y.targetLabelAngle=b.targetLabelAngle}}};var bp={};bp.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],a=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):a.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},bp.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},bp.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(S3),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var u4={};[Ai,mp,Nn,au,sy,wo,s4,vp,bp].forEach(function(e){He(u4,e)});var d4={};d4.getCachedImage=function(e,t,n){var r=this,a=r.imageCache=r.imageCache||{},i=a[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;i=a[e]=a[e]||{};var s=i.image=new Image;s.addEventListener("load",n),s.addEventListener("error",function(){s.error=!0});var l="data:",u=e.substring(0,l.length).toLowerCase()===l;return u||(t=t==="null"?null:t,s.crossOrigin=t),s.src=e,s};var ol={};ol.registerBinding=function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]),i=this.binder(e);return i.on.apply(i,a)},ol.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||Mte(e);if(t.supportsPassiveEvents==null){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch{}t.supportsPassiveEvents=a}var s=function(l,u,c){var d=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(d[2]={capture:c??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:d}),(e.addEventListener||e.on).apply(e,d),this};return{on:s,addEventListener:s,addListener:s,bind:s}},ol.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},ol.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},ol.load=function(){var e=this,t=e.cy.window(),n=function(B){return B.selected()},r=function(B,M,Y,Q){B==null&&(B=e.cy);for(var ee=0;ee<M.length;ee++){var he=M[ee];B.emit({originalEvent:Y,type:he,position:Q})}},a=function(B){return B.shiftKey||B.metaKey||B.ctrlKey},i=function(B,M){var Y=!0;if(e.cy.hasCompoundNodes()&&B&&B.pannable())for(var Q=0;M&&Q<M.length;Q++){var B=M[Q];if(B.isNode()&&B.isParent()&&!B.pannable()){Y=!1;break}}else Y=!0;return Y},s=function(B){B[0]._private.grabbed=!0},l=function(B){B[0]._private.grabbed=!1},u=function(B){B[0]._private.rscratch.inDragLayer=!0},c=function(B){B[0]._private.rscratch.inDragLayer=!1},d=function(B){B[0]._private.rscratch.isGrabTarget=!0},f=function(B){B[0]._private.rscratch.isGrabTarget=!1},h=function(B,M){var Y=M.addToList,Q=Y.has(B);!Q&&B.grabbable()&&!B.locked()&&(Y.merge(B),s(B))},m=function(B,M){if(B.cy().hasCompoundNodes()&&!(M.inDragLayer==null&&M.addToList==null)){var Y=B.descendants();M.inDragLayer&&(Y.forEach(u),Y.connectedEdges().forEach(u)),M.addToList&&h(Y,M)}},p=function(B,M){M=M||{};var Y=B.cy().hasCompoundNodes();M.inDragLayer&&(B.forEach(u),B.neighborhood().stdFilter(function(Q){return!Y||Q.isEdge()}).forEach(u)),M.addToList&&B.forEach(function(Q){h(Q,M)}),m(B,M),y(B,{inDragLayer:M.inDragLayer}),e.updateCachedGrabbedEles()},g=p,v=function(B){B&&(e.getCachedZSortedEles().forEach(function(M){l(M),c(M),f(M)}),e.updateCachedGrabbedEles())},y=function(B,M){if(!(M.inDragLayer==null&&M.addToList==null)&&B.cy().hasCompoundNodes()){var Y=B.ancestors().orphans();if(!Y.same(B)){var Q=Y.descendants().spawnSelf().merge(Y).unmerge(B).unmerge(B.descendants()),ee=Q.connectedEdges();M.inDragLayer&&(ee.forEach(u),Q.forEach(u)),M.addToList&&Q.forEach(function(he){h(he,M)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},x=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";x?(e.removeObserver=new MutationObserver(function(B){for(var M=0;M<B.length;M++){var Y=B[M],Q=Y.removedNodes;if(Q)for(var ee=0;ee<Q.length;ee++){var he=Q[ee];if(he===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(B){e.destroy()});var C=Nf(function(){e.cy.resize()},100);x&&(e.styleObserver=new MutationObserver(C),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",C),w&&(e.resizeObserver=new ResizeObserver(C),e.resizeObserver.observe(e.container));var k=function(B,M){for(;B!=null;)M(B),B=B.parentNode},E=function(){e.invalidateContainerClientCoordsCache()};k(e.container,function(B){e.registerBinding(B,"transitionend",E),e.registerBinding(B,"animationend",E),e.registerBinding(B,"scroll",E)}),e.registerBinding(e.container,"contextmenu",function(B){B.preventDefault()});var S=function(){return e.selection[4]!==0},_=function(B){for(var M=e.findContainerClientCoords(),Y=M[0],Q=M[1],ee=M[2],he=M[3],ae=B.touches?B.touches:[B],ye=!1,Pe=0;Pe<ae.length;Pe++){var Ie=ae[Pe];if(Y<=Ie.clientX&&Ie.clientX<=Y+ee&&Q<=Ie.clientY&&Ie.clientY<=Q+he){ye=!0;break}}if(!ye)return!1;for(var W=e.container,fe=B.target,ie=fe.parentNode,we=!1;ie;){if(ie===W){we=!0;break}ie=ie.parentNode}return!!we};e.registerBinding(e.container,"mousedown",function(B){if(_(B)&&!(e.hoverData.which===1&&B.which!==1)){B.preventDefault(),b(),e.hoverData.capture=!0,e.hoverData.which=B.which;var M=e.cy,Y=[B.clientX,B.clientY],Q=e.projectIntoViewport(Y[0],Y[1]),ee=e.selection,he=e.findNearestElements(Q[0],Q[1],!0,!1),ae=he[0],ye=e.dragData.possibleDragElements;e.hoverData.mdownPos=Q,e.hoverData.mdownGPos=Y;var Pe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var we=e.hoverData.down;we?we.emit({originalEvent:B,type:"taphold",position:{x:Q[0],y:Q[1]}}):M.emit({originalEvent:B,type:"taphold",position:{x:Q[0],y:Q[1]}})}},e.tapholdDuration)};if(B.which==3){e.hoverData.cxtStarted=!0;var Ie={originalEvent:B,type:"cxttapstart",position:{x:Q[0],y:Q[1]}};ae?(ae.activate(),ae.emit(Ie),e.hoverData.down=ae):M.emit(Ie),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(B.which==1){ae&&ae.activate();{if(ae!=null&&e.nodeIsGrabbable(ae)){var W=function(we){return{originalEvent:B,type:we,position:{x:Q[0],y:Q[1]}}},fe=function(we){we.emit(W("grab"))};if(d(ae),!ae.selected())ye=e.dragData.possibleDragElements=M.collection(),g(ae,{addToList:ye}),ae.emit(W("grabon")).emit(W("grab"));else{ye=e.dragData.possibleDragElements=M.collection();var ie=M.$(function(we){return we.isNode()&&we.selected()&&e.nodeIsGrabbable(we)});p(ie,{addToList:ye}),ae.emit(W("grabon")),ie.forEach(fe)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=ae,e.hoverData.downs=he,e.hoverData.downTime=new Date().getTime()}r(ae,["mousedown","tapstart","vmousedown"],B,{x:Q[0],y:Q[1]}),ae==null?(ee[4]=1,e.data.bgActivePosistion={x:Q[0],y:Q[1]},e.redrawHint("select",!0),e.redraw()):ae.pannable()&&(ee[4]=1),Pe()}ee[0]=ee[2]=Q[0],ee[1]=ee[3]=Q[1]}},!1),e.registerBinding(t,"mousemove",function(B){var M=e.hoverData.capture;if(!(!M&&!_(B))){var Y=!1,Q=e.cy,ee=Q.zoom(),he=[B.clientX,B.clientY],ae=e.projectIntoViewport(he[0],he[1]),ye=e.hoverData.mdownPos,Pe=e.hoverData.mdownGPos,Ie=e.selection,W=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(W=e.findNearestElement(ae[0],ae[1],!0,!1));var fe=e.hoverData.last,ie=e.hoverData.down,we=[ae[0]-Ie[2],ae[1]-Ie[3]],nt=e.dragData.possibleDragElements,Qe;if(Pe){var lt=he[0]-Pe[0],ft=lt*lt,gt=he[1]-Pe[1],qt=gt*gt,Tt=ft+qt;e.hoverData.isOverThresholdDrag=Qe=Tt>=e.desktopTapThreshold2}var Ot=a(B);Qe&&(e.hoverData.tapholdCancelled=!0);var Kt=function(){var Fn=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Fn.length===0?(Fn.push(we[0]),Fn.push(we[1])):(Fn[0]+=we[0],Fn[1]+=we[1])};Y=!0,r(W,["mousemove","vmousemove","tapdrag"],B,{x:ae[0],y:ae[1]});var Wt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||Q.emit({originalEvent:B,type:"boxstart",position:{x:ae[0],y:ae[1]}}),Ie[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Qe){var Rt={originalEvent:B,type:"cxtdrag",position:{x:ae[0],y:ae[1]}};ie?ie.emit(Rt):Q.emit(Rt),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||W!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:B,type:"cxtdragout",position:{x:ae[0],y:ae[1]}}),e.hoverData.cxtOver=W,W&&W.emit({originalEvent:B,type:"cxtdragover",position:{x:ae[0],y:ae[1]}}))}}else if(e.hoverData.dragging){if(Y=!0,Q.panningEnabled()&&Q.userPanningEnabled()){var $n;if(e.hoverData.justStartedPan){var xn=e.hoverData.mdownPos;$n={x:(ae[0]-xn[0])*ee,y:(ae[1]-xn[1])*ee},e.hoverData.justStartedPan=!1}else $n={x:we[0]*ee,y:we[1]*ee};Q.panBy($n),Q.emit("dragpan"),e.hoverData.dragged=!0}ae=e.projectIntoViewport(B.clientX,B.clientY)}else if(Ie[4]==1&&(ie==null||ie.pannable())){if(Qe){if(!e.hoverData.dragging&&Q.boxSelectionEnabled()&&(Ot||!Q.panningEnabled()||!Q.userPanningEnabled()))Wt();else if(!e.hoverData.selecting&&Q.panningEnabled()&&Q.userPanningEnabled()){var kn=i(ie,e.hoverData.downs);kn&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ie[4]=0,e.data.bgActivePosistion=Ms(ye),e.redrawHint("select",!0),e.redraw())}ie&&ie.pannable()&&ie.active()&&ie.unactivate()}}else{if(ie&&ie.pannable()&&ie.active()&&ie.unactivate(),(!ie||!ie.grabbed())&&W!=fe&&(fe&&r(fe,["mouseout","tapdragout"],B,{x:ae[0],y:ae[1]}),W&&r(W,["mouseover","tapdragover"],B,{x:ae[0],y:ae[1]}),e.hoverData.last=W),ie)if(Qe){if(Q.boxSelectionEnabled()&&Ot)ie&&ie.grabbed()&&(v(nt),ie.emit("freeon"),nt.emit("free"),e.dragData.didDrag&&(ie.emit("dragfreeon"),nt.emit("dragfree"))),Wt();else if(ie&&ie.grabbed()&&e.nodeIsDraggable(ie)){var yt=!e.dragData.didDrag;yt&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(nt,{inDragLayer:!0});var Nt={x:0,y:0};if(Ee(we[0])&&Ee(we[1])&&(Nt.x+=we[0],Nt.y+=we[1],yt)){var Lt=e.hoverData.dragDelta;Lt&&Ee(Lt[0])&&Ee(Lt[1])&&(Nt.x+=Lt[0],Nt.y+=Lt[1])}e.hoverData.draggingEles=!0,nt.silentShift(Nt).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else Kt();Y=!0}if(Ie[2]=ae[0],Ie[3]=ae[1],Y)return B.stopPropagation&&B.stopPropagation(),B.preventDefault&&B.preventDefault(),!1}},!1);var N,T,O;e.registerBinding(t,"mouseup",function(B){if(!(e.hoverData.which===1&&B.which!==1&&e.hoverData.capture)){var M=e.hoverData.capture;if(M){e.hoverData.capture=!1;var Y=e.cy,Q=e.projectIntoViewport(B.clientX,B.clientY),ee=e.selection,he=e.findNearestElement(Q[0],Q[1],!0,!1),ae=e.dragData.possibleDragElements,ye=e.hoverData.down,Pe=a(B);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,ye&&ye.unactivate(),e.hoverData.which===3){var Ie={originalEvent:B,type:"cxttapend",position:{x:Q[0],y:Q[1]}};if(ye?ye.emit(Ie):Y.emit(Ie),!e.hoverData.cxtDragged){var W={originalEvent:B,type:"cxttap",position:{x:Q[0],y:Q[1]}};ye?ye.emit(W):Y.emit(W)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(he,["mouseup","tapend","vmouseup"],B,{x:Q[0],y:Q[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(r(ye,["click","tap","vclick"],B,{x:Q[0],y:Q[1]}),T=!1,B.timeStamp-O<=Y.multiClickDebounceTime()?(N&&clearTimeout(N),T=!0,O=null,r(ye,["dblclick","dbltap","vdblclick"],B,{x:Q[0],y:Q[1]})):(N=setTimeout(function(){T||r(ye,["oneclick","onetap","voneclick"],B,{x:Q[0],y:Q[1]})},Y.multiClickDebounceTime()),O=B.timeStamp)),ye==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(B)&&(Y.$(n).unselect(["tapunselect"]),ae.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=ae=Y.collection()),he==ye&&!e.dragData.didDrag&&!e.hoverData.selecting&&he!=null&&he._private.selectable&&(e.hoverData.dragging||(Y.selectionType()==="additive"||Pe?he.selected()?he.unselect(["tapunselect"]):he.select(["tapselect"]):Pe||(Y.$(n).unmerge(he).unselect(["tapunselect"]),he.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var fe=Y.collection(e.getAllInBox(ee[0],ee[1],ee[2],ee[3]));e.redrawHint("select",!0),fe.length>0&&e.redrawHint("eles",!0),Y.emit({type:"boxend",originalEvent:B,position:{x:Q[0],y:Q[1]}});var ie=function(nt){return nt.selectable()&&!nt.selected()};Y.selectionType()==="additive"||Pe||Y.$(n).unmerge(fe).unselect(),fe.emit("box").stdFilter(ie).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!ee[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var we=ye&&ye.grabbed();v(ae),we&&(ye.emit("freeon"),ae.emit("free"),e.dragData.didDrag&&(ye.emit("dragfreeon"),ae.emit("dragfree")))}}ee[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,e.hoverData.which=null}}},!1);var P=function(B){if(!e.scrollingPage){var M=e.cy,Y=M.zoom(),Q=M.pan(),ee=e.projectIntoViewport(B.clientX,B.clientY),he=[ee[0]*Y+Q.x,ee[1]*Y+Q.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||S()){B.preventDefault();return}if(M.panningEnabled()&&M.userPanningEnabled()&&M.zoomingEnabled()&&M.userZoomingEnabled()){B.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);var ae;B.deltaY!=null?ae=B.deltaY/-250:B.wheelDeltaY!=null?ae=B.wheelDeltaY/1e3:ae=B.wheelDelta/1e3,ae=ae*e.wheelSensitivity;var ye=B.deltaMode===1;ye&&(ae*=33);var Pe=M.zoom()*Math.pow(10,ae);B.type==="gesturechange"&&(Pe=e.gestureStartZoom*B.scale),M.zoom({level:Pe,renderedPosition:{x:he[0],y:he[1]}}),M.emit(B.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",P,!0),e.registerBinding(t,"scroll",function(B){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(B){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||B.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(B){e.hasTouchStarted||P(B)},!0),e.registerBinding(e.container,"mouseout",function(B){var M=e.projectIntoViewport(B.clientX,B.clientY);e.cy.emit({originalEvent:B,type:"mouseout",position:{x:M[0],y:M[1]}})},!1),e.registerBinding(e.container,"mouseover",function(B){var M=e.projectIntoViewport(B.clientX,B.clientY);e.cy.emit({originalEvent:B,type:"mouseover",position:{x:M[0],y:M[1]}})},!1);var F,D,$,L,I,z,G,q,X,te,le,ue,ne,oe=function(B,M,Y,Q){return Math.sqrt((Y-B)*(Y-B)+(Q-M)*(Q-M))},U=function(B,M,Y,Q){return(Y-B)*(Y-B)+(Q-M)*(Q-M)},K;e.registerBinding(e.container,"touchstart",K=function(B){if(e.hasTouchStarted=!0,!!_(B)){b(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var M=e.cy,Y=e.touchData.now,Q=e.touchData.earlier;if(B.touches[0]){var ee=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);Y[0]=ee[0],Y[1]=ee[1]}if(B.touches[1]){var ee=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);Y[2]=ee[0],Y[3]=ee[1]}if(B.touches[2]){var ee=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);Y[4]=ee[0],Y[5]=ee[1]}if(B.touches[1]){e.touchData.singleTouchMoved=!0,v(e.dragData.touchDragEles);var he=e.findContainerClientCoords();X=he[0],te=he[1],le=he[2],ue=he[3],F=B.touches[0].clientX-X,D=B.touches[0].clientY-te,$=B.touches[1].clientX-X,L=B.touches[1].clientY-te,ne=0<=F&&F<=le&&0<=$&&$<=le&&0<=D&&D<=ue&&0<=L&&L<=ue;var ae=M.pan(),ye=M.zoom();I=oe(F,D,$,L),z=U(F,D,$,L),G=[(F+$)/2,(D+L)/2],q=[(G[0]-ae.x)/ye,(G[1]-ae.y)/ye];var Pe=200,Ie=Pe*Pe;if(z<Ie&&!B.touches[2]){var W=e.findNearestElement(Y[0],Y[1],!0,!0),fe=e.findNearestElement(Y[2],Y[3],!0,!0);W&&W.isNode()?(W.activate().emit({originalEvent:B,type:"cxttapstart",position:{x:Y[0],y:Y[1]}}),e.touchData.start=W):fe&&fe.isNode()?(fe.activate().emit({originalEvent:B,type:"cxttapstart",position:{x:Y[0],y:Y[1]}}),e.touchData.start=fe):M.emit({originalEvent:B,type:"cxttapstart",position:{x:Y[0],y:Y[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(B.touches[2])M.boxSelectionEnabled()&&B.preventDefault();else if(!B.touches[1]&&B.touches[0]){var ie=e.findNearestElements(Y[0],Y[1],!0,!0),we=ie[0];if(we!=null&&(we.activate(),e.touchData.start=we,e.touchData.starts=ie,e.nodeIsGrabbable(we))){var nt=e.dragData.touchDragEles=M.collection(),Qe=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),we.selected()?(Qe=M.$(function(Tt){return Tt.selected()&&e.nodeIsGrabbable(Tt)}),p(Qe,{addToList:nt})):g(we,{addToList:nt}),d(we);var lt=function(Tt){return{originalEvent:B,type:Tt,position:{x:Y[0],y:Y[1]}}};we.emit(lt("grabon")),Qe?Qe.forEach(function(Tt){Tt.emit(lt("grab"))}):we.emit(lt("grab"))}r(we,["touchstart","tapstart","vmousedown"],B,{x:Y[0],y:Y[1]}),we==null&&(e.data.bgActivePosistion={x:ee[0],y:ee[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(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&r(e.touchData.start,["taphold"],B,{x:Y[0],y:Y[1]})},e.tapholdDuration)}if(B.touches.length>=1){for(var ft=e.touchData.startPosition=[null,null,null,null,null,null],gt=0;gt<Y.length;gt++)ft[gt]=Q[gt]=Y[gt];var qt=B.touches[0];e.touchData.startGPosition=[qt.clientX,qt.clientY]}}},!1);var Z;e.registerBinding(t,"touchmove",Z=function(B){var M=e.touchData.capture;if(!(!M&&!_(B))){var Y=e.selection,Q=e.cy,ee=e.touchData.now,he=e.touchData.earlier,ae=Q.zoom();if(B.touches[0]){var ye=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ee[0]=ye[0],ee[1]=ye[1]}if(B.touches[1]){var ye=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ee[2]=ye[0],ee[3]=ye[1]}if(B.touches[2]){var ye=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ee[4]=ye[0],ee[5]=ye[1]}var Pe=e.touchData.startGPosition,Ie;if(M&&B.touches[0]&&Pe){for(var W=[],fe=0;fe<ee.length;fe++)W[fe]=ee[fe]-he[fe];var ie=B.touches[0].clientX-Pe[0],we=ie*ie,nt=B.touches[0].clientY-Pe[1],Qe=nt*nt,lt=we+Qe;Ie=lt>=e.touchTapThreshold2}if(M&&e.touchData.cxt){B.preventDefault();var ft=B.touches[0].clientX-X,gt=B.touches[0].clientY-te,qt=B.touches[1].clientX-X,Tt=B.touches[1].clientY-te,Ot=U(ft,gt,qt,Tt),Kt=Ot/z,Wt=150,Rt=Wt*Wt,$n=1.5,xn=$n*$n;if(Kt>=xn||Ot>=Rt){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var kn={originalEvent:B,type:"cxttapend",position:{x:ee[0],y:ee[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(kn),e.touchData.start=null):Q.emit(kn)}}if(M&&e.touchData.cxt){var kn={originalEvent:B,type:"cxtdrag",position:{x:ee[0],y:ee[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(kn):Q.emit(kn),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var yt=e.findNearestElement(ee[0],ee[1],!0,!0);(!e.touchData.cxtOver||yt!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:B,type:"cxtdragout",position:{x:ee[0],y:ee[1]}}),e.touchData.cxtOver=yt,yt&&yt.emit({originalEvent:B,type:"cxtdragover",position:{x:ee[0],y:ee[1]}}))}else if(M&&B.touches[2]&&Q.boxSelectionEnabled())B.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||Q.emit({originalEvent:B,type:"boxstart",position:{x:ee[0],y:ee[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,Y[4]=1,!Y||Y.length===0||Y[0]===void 0?(Y[0]=(ee[0]+ee[2]+ee[4])/3,Y[1]=(ee[1]+ee[3]+ee[5])/3,Y[2]=(ee[0]+ee[2]+ee[4])/3+1,Y[3]=(ee[1]+ee[3]+ee[5])/3+1):(Y[2]=(ee[0]+ee[2]+ee[4])/3,Y[3]=(ee[1]+ee[3]+ee[5])/3),e.redrawHint("select",!0),e.redraw();else if(M&&B.touches[1]&&!e.touchData.didSelect&&Q.zoomingEnabled()&&Q.panningEnabled()&&Q.userZoomingEnabled()&&Q.userPanningEnabled()){B.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Nt=e.dragData.touchDragEles;if(Nt){e.redrawHint("drag",!0);for(var Lt=0;Lt<Nt.length;Lt++){var Fn=Nt[Lt]._private;Fn.grabbed=!1,Fn.rscratch.inDragLayer=!1}}var ko=e.touchData.start,ft=B.touches[0].clientX-X,gt=B.touches[0].clientY-te,qt=B.touches[1].clientX-X,Tt=B.touches[1].clientY-te,j=oe(ft,gt,qt,Tt),re=j/I;if(ne){var _e=ft-F,Me=gt-D,Mt=qt-$,Cn=Tt-L,Pn=(_e+Mt)/2,Gt=(Me+Cn)/2,$t=Q.zoom(),Co=$t*re,ji=Q.pan(),Sp=q[0]*$t+ji.x,_p=q[1]*$t+ji.y,Bp={x:-Co/$t*(Sp-ji.x-Pn)+Sp,y:-Co/$t*(_p-ji.y-Gt)+_p};if(ko&&ko.active()){var Nt=e.dragData.touchDragEles;v(Nt),e.redrawHint("drag",!0),e.redrawHint("eles",!0),ko.unactivate().emit("freeon"),Nt.emit("free"),e.dragData.didDrag&&(ko.emit("dragfreeon"),Nt.emit("dragfree"))}Q.viewport({zoom:Co,pan:Bp,cancelOnFailedZoom:!0}),Q.emit("pinchzoom"),I=j,F=ft,D=gt,$=qt,L=Tt,e.pinching=!0}if(B.touches[0]){var ye=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ee[0]=ye[0],ee[1]=ye[1]}if(B.touches[1]){var ye=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ee[2]=ye[0],ee[3]=ye[1]}if(B.touches[2]){var ye=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ee[4]=ye[0],ee[5]=ye[1]}}else if(B.touches[0]&&!e.touchData.didSelect){var fr=e.touchData.start,uu=e.touchData.last,yt;if(!e.hoverData.draggingEles&&!e.swipePanning&&(yt=e.findNearestElement(ee[0],ee[1],!0,!0)),M&&fr!=null&&B.preventDefault(),M&&fr!=null&&e.nodeIsDraggable(fr))if(Ie){var Nt=e.dragData.touchDragEles,Tp=!e.dragData.didDrag;Tp&&p(Nt,{inDragLayer:!0}),e.dragData.didDrag=!0;var Hi={x:0,y:0};if(Ee(W[0])&&Ee(W[1])&&(Hi.x+=W[0],Hi.y+=W[1],Tp)){e.redrawHint("eles",!0);var Vn=e.touchData.dragDelta;Vn&&Ee(Vn[0])&&Ee(Vn[1])&&(Hi.x+=Vn[0],Hi.y+=Vn[1])}e.hoverData.draggingEles=!0,Nt.silentShift(Hi).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==he[0]&&e.touchData.startPosition[1]==he[1]&&e.redrawHint("eles",!0),e.redraw()}else{var Vn=e.touchData.dragDelta=e.touchData.dragDelta||[];Vn.length===0?(Vn.push(W[0]),Vn.push(W[1])):(Vn[0]+=W[0],Vn[1]+=W[1])}if(r(fr||yt,["touchmove","tapdrag","vmousemove"],B,{x:ee[0],y:ee[1]}),(!fr||!fr.grabbed())&&yt!=uu&&(uu&&uu.emit({originalEvent:B,type:"tapdragout",position:{x:ee[0],y:ee[1]}}),yt&&yt.emit({originalEvent:B,type:"tapdragover",position:{x:ee[0],y:ee[1]}})),e.touchData.last=yt,M)for(var Lt=0;Lt<ee.length;Lt++)ee[Lt]&&e.touchData.startPosition[Lt]&&Ie&&(e.touchData.singleTouchMoved=!0);if(M&&(fr==null||fr.pannable())&&Q.panningEnabled()&&Q.userPanningEnabled()){var wy=i(fr,e.touchData.starts);wy&&(B.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Ms(e.touchData.startPosition)),e.swipePanning?(Q.panBy({x:W[0]*ae,y:W[1]*ae}),Q.emit("dragpan")):Ie&&(e.swipePanning=!0,Q.panBy({x:ie*ae,y:nt*ae}),Q.emit("dragpan"),fr&&(fr.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var ye=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ee[0]=ye[0],ee[1]=ye[1]}}for(var fe=0;fe<ee.length;fe++)he[fe]=ee[fe];M&&B.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var de;e.registerBinding(t,"touchcancel",de=function(B){var M=e.touchData.start;e.touchData.capture=!1,M&&M.unactivate()});var be,Be,pe,xe;if(e.registerBinding(t,"touchend",be=function(B){var M=e.touchData.start,Y=e.touchData.capture;if(Y)B.touches.length===0&&(e.touchData.capture=!1),B.preventDefault();else return;var Q=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var ee=e.cy,he=ee.zoom(),ae=e.touchData.now,ye=e.touchData.earlier;if(B.touches[0]){var Pe=e.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);ae[0]=Pe[0],ae[1]=Pe[1]}if(B.touches[1]){var Pe=e.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);ae[2]=Pe[0],ae[3]=Pe[1]}if(B.touches[2]){var Pe=e.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);ae[4]=Pe[0],ae[5]=Pe[1]}M&&M.unactivate();var Ie;if(e.touchData.cxt){if(Ie={originalEvent:B,type:"cxttapend",position:{x:ae[0],y:ae[1]}},M?M.emit(Ie):ee.emit(Ie),!e.touchData.cxtDragged){var W={originalEvent:B,type:"cxttap",position:{x:ae[0],y:ae[1]}};M?M.emit(W):ee.emit(W)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!B.touches[2]&&ee.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var fe=ee.collection(e.getAllInBox(Q[0],Q[1],Q[2],Q[3]));Q[0]=void 0,Q[1]=void 0,Q[2]=void 0,Q[3]=void 0,Q[4]=0,e.redrawHint("select",!0),ee.emit({type:"boxend",originalEvent:B,position:{x:ae[0],y:ae[1]}});var ie=function(Wt){return Wt.selectable()&&!Wt.selected()};fe.emit("box").stdFilter(ie).select().emit("boxselect"),fe.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(M!=null&&M.unactivate(),B.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!B.touches[1]&&!B.touches[0]&&!B.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var we=e.dragData.touchDragEles;if(M!=null){var nt=M._private.grabbed;v(we),e.redrawHint("drag",!0),e.redrawHint("eles",!0),nt&&(M.emit("freeon"),we.emit("free"),e.dragData.didDrag&&(M.emit("dragfreeon"),we.emit("dragfree"))),r(M,["touchend","tapend","vmouseup","tapdragout"],B,{x:ae[0],y:ae[1]}),M.unactivate(),e.touchData.start=null}else{var Qe=e.findNearestElement(ae[0],ae[1],!0,!0);r(Qe,["touchend","tapend","vmouseup","tapdragout"],B,{x:ae[0],y:ae[1]})}var lt=e.touchData.startPosition[0]-ae[0],ft=lt*lt,gt=e.touchData.startPosition[1]-ae[1],qt=gt*gt,Tt=ft+qt,Ot=Tt*he*he;e.touchData.singleTouchMoved||(M||ee.$(":selected").unselect(["tapunselect"]),r(M,["tap","vclick"],B,{x:ae[0],y:ae[1]}),Be=!1,B.timeStamp-xe<=ee.multiClickDebounceTime()?(pe&&clearTimeout(pe),Be=!0,xe=null,r(M,["dbltap","vdblclick"],B,{x:ae[0],y:ae[1]})):(pe=setTimeout(function(){Be||r(M,["onetap","voneclick"],B,{x:ae[0],y:ae[1]})},ee.multiClickDebounceTime()),xe=B.timeStamp)),M!=null&&!e.dragData.didDrag&&M._private.selectable&&Ot<e.touchTapThreshold2&&!e.pinching&&(ee.selectionType()==="single"?(ee.$(n).unmerge(M).unselect(["tapunselect"]),M.select(["tapselect"])):M.selected()?M.unselect(["tapunselect"]):M.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var Kt=0;Kt<ae.length;Kt++)ye[Kt]=ae[Kt];e.dragData.didDrag=!1,B.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),B.touches.length<2&&(B.touches.length===1&&(e.touchData.startGPosition=[B.touches[0].clientX,B.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var ge=[],Ce=function(B){return{clientX:B.clientX,clientY:B.clientY,force:1,identifier:B.pointerId,pageX:B.pageX,pageY:B.pageY,radiusX:B.width/2,radiusY:B.height/2,screenX:B.screenX,screenY:B.screenY,target:B.target}},Oe=function(B){return{event:B,touch:Ce(B)}},Ae=function(B){ge.push(Oe(B))},Se=function(B){for(var M=0;M<ge.length;M++){var Y=ge[M];if(Y.event.pointerId===B.pointerId){ge.splice(M,1);return}}},Le=function(B){var M=ge.filter(function(Y){return Y.event.pointerId===B.pointerId})[0];M.event=B,M.touch=Ce(B)},De=function(B){B.touches=ge.map(function(M){return M.touch})},ze=function(B){return B.pointerType==="mouse"||B.pointerType===4};e.registerBinding(e.container,"pointerdown",function(B){ze(B)||(B.preventDefault(),Ae(B),De(B),K(B))}),e.registerBinding(e.container,"pointerup",function(B){ze(B)||(Se(B),De(B),be(B))}),e.registerBinding(e.container,"pointercancel",function(B){ze(B)||(Se(B),De(B),de(B))}),e.registerBinding(e.container,"pointermove",function(B){ze(B)||(B.preventDefault(),Le(B),De(B),Z(B))})}};var Zo={};Zo.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(n,r,a,i,s,l){this.renderer.nodeShapeImpl("polygon",n,r,a,i,s,this.points)},intersectLine:function(n,r,a,i,s,l,u,c){return qc(s,l,this.points,n,r,a/2,i/2,u)},checkPoint:function(n,r,a,i,s,l,u,c){return Go(n,r,this.points,l,u,i,s,[0,-1],a)}}},Zo.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,s,l){return Fre(a,i,e,t,n/2+s,r/2+s)},checkPoint:function(e,t,n,r,a,i,s,l){return Oi(e,t,r,a,i,s,n)}}},Zo.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(n,r,a,i,s,l,u){if(l[u]!==void 0&&l[u+"-cx"]===n&&l[u+"-cy"]===r)return l[u];l[u]=new Array(t.length/2),l[u+"-cx"]=n,l[u+"-cy"]=r;var c=a/2,d=i/2;s=s==="auto"?w5(a,i):s;for(var f=new Array(t.length/2),h=0;h<t.length/2;h++)f[h]={x:n+c*t[h*2],y:r+d*t[h*2+1]};var m,p,g,v,y=f.length;for(p=f[y-1],m=0;m<y;m++)g=f[m%y],v=f[(m+1)%y],l[u][m]=iy(p,g,v,s),p=g,g=v;return l[u]},draw:function(n,r,a,i,s,l,u){this.renderer.nodeShapeImpl("round-polygon",n,r,a,i,s,this.points,this.getOrCreateCorners(r,a,i,s,l,u,"drawCorners"))},intersectLine:function(n,r,a,i,s,l,u,c,d){return Pre(s,l,this.points,n,r,a,i,u,this.getOrCreateCorners(n,r,a,i,c,d,"corners"))},checkPoint:function(n,r,a,i,s,l,u,c,d){return $re(n,r,this.points,l,u,i,s,this.getOrCreateCorners(l,u,i,s,c,d,"corners"))}}},Zo.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,s,l){return v5(a,i,e,t,n,r,s,l)},checkPoint:function(e,t,n,r,a,i,s,l){var u=r/2,c=a/2;l=l==="auto"?Ni(r,a):l,l=Math.min(u,c,l);var d=l*2;return!!(Go(e,t,this.points,i,s,r,a-d,[0,-1],n)||Go(e,t,this.points,i,s,r-d,a,[0,-1],n)||Oi(e,t,d,d,i-u+l,s-c+l,n)||Oi(e,t,d,d,i+u-l,s-c+l,n)||Oi(e,t,d,d,i+u-l,s+c-l,n)||Oi(e,t,d,d,i-u+l,s+c-l,n))}}},Zo.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:$0(),points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,null,i)},generateCutTrianglePts:function(e,t,n,r,a){var i=a==="auto"?this.cornerLength:a,s=t/2,l=e/2,u=n-l,c=n+l,d=r-s,f=r+s;return{topLeft:[u,d+i,u+i,d,u+i,d+i],topRight:[c-i,d,c,d+i,c-i,d+i],bottomRight:[c,f-i,c-i,f,c-i,f-i],bottomLeft:[u+i,f,u,f-i,u+i,f-i]}},intersectLine:function(e,t,n,r,a,i,s,l){var u=this.generateCutTrianglePts(n+2*s,r+2*s,e,t,l),c=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return qc(a,i,c,e,t)},checkPoint:function(e,t,n,r,a,i,s,l){var u=l==="auto"?this.cornerLength:l;if(Go(e,t,this.points,i,s,r,a-2*u,[0,-1],n)||Go(e,t,this.points,i,s,r-2*u,a,[0,-1],n))return!0;var c=this.generateCutTrianglePts(r,a,i,s);return tr(e,t,c.topLeft)||tr(e,t,c.topRight)||tr(e,t,c.bottomRight)||tr(e,t,c.bottomLeft)}}},Zo.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,s,l){var u=.15,c=.5,d=.85,f=this.generateBarrelBezierPts(n+2*s,r+2*s,e,t),h=function(p){var g=Vs({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},u),v=Vs({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},c),y=Vs({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},d);return[p[0],p[1],g.x,g.y,v.x,v.y,y.x,y.y,p[4],p[5]]},m=[].concat(h(f.topLeft),h(f.topRight),h(f.bottomRight),h(f.bottomLeft));return qc(a,i,m,e,t)},generateBarrelBezierPts:function(e,t,n,r){var a=t/2,i=e/2,s=n-i,l=n+i,u=r-a,c=r+a,d=F0(e,t),f=d.heightOffset,h=d.widthOffset,m=d.ctrlPtOffsetPct*e,p={topLeft:[s,u+f,s+m,u,s+h,u],topRight:[l-h,u,l-m,u,l,u+f],bottomRight:[l,c-f,l-m,c,l-h,c],bottomLeft:[s+h,c,s+m,c,s,c-f]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,a,i,s,l){var u=F0(r,a),c=u.heightOffset,d=u.widthOffset;if(Go(e,t,this.points,i,s,r,a-2*c,[0,-1],n)||Go(e,t,this.points,i,s,r-2*d,a,[0,-1],n))return!0;for(var f=this.generateBarrelBezierPts(r,a,i,s),h=function(k,E,S){var _=S[4],N=S[2],T=S[0],O=S[5],P=S[1],F=Math.min(_,T),D=Math.max(_,T),$=Math.min(O,P),L=Math.max(O,P);if(F<=k&&k<=D&&$<=E&&E<=L){var I=Are(_,N,T),z=Bre(I[0],I[1],I[2],k),G=z.filter(function(q){return 0<=q&&q<=1});if(G.length>0)return G[0]}return null},m=Object.keys(f),p=0;p<m.length;p++){var g=m[p],v=f[g],y=h(e,t,v);if(y!=null){var b=v[5],x=v[3],w=v[1],C=ln(b,x,w,y);if(v.isTop&&C<=t||v.isBottom&&t<=C)return!0}}return!1}}},Zo.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Mn(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,s,l){var u=e-(n/2+s),c=t-(r/2+s),d=c,f=e+(n/2+s),h=Pa(a,i,e,t,u,c,f,d,!1);return h.length>0?h:v5(a,i,e,t,n,r,s,l)},checkPoint:function(e,t,n,r,a,i,s,l){l=l==="auto"?Ni(r,a):l;var u=2*l;if(Go(e,t,this.points,i,s,r,a-u,[0,-1],n)||Go(e,t,this.points,i,s,r-u,a,[0,-1],n))return!0;var c=r/2+2*n,d=a/2+2*n,f=[i-c,s-d,i-c,s,i+c,s,i+c,s-d];return!!(tr(e,t,f)||Oi(e,t,u,u,i+r/2-l,s+a/2-l,n)||Oi(e,t,u,u,i-r/2+l,s+a/2-l,n))}}},Zo.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Mn(3,0)),this.generateRoundPolygon("round-triangle",Mn(3,0)),this.generatePolygon("rectangle",Mn(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",Mn(5,0)),this.generateRoundPolygon("round-pentagon",Mn(5,0)),this.generatePolygon("hexagon",Mn(6,0)),this.generateRoundPolygon("round-hexagon",Mn(6,0)),this.generatePolygon("heptagon",Mn(7,0)),this.generateRoundPolygon("round-heptagon",Mn(7,0)),this.generatePolygon("octagon",Mn(8,0)),this.generateRoundPolygon("round-octagon",Mn(8,0));var r=new Array(20);{var a=N0(5,0),i=N0(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var l=0;l<i.length/2;l++)i[l*2]*=s,i[l*2+1]*=s;for(var l=0;l<20/4;l++)r[l*4]=a[l*2],r[l*4+1]=a[l*2+1],r[l*4+2]=i[l*2],r[l*4+3]=i[l*2+1]}r=b5(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}e.makePolygon=function(c){var d=c.join("$"),f="polygon-"+d,h;return(h=this[f])?h:t.generatePolygon(f,c)}};var iu={};iu.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},iu.redraw=function(e){e=e||d5();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},iu.beforeRender=function(e,t){if(!this.destroyed){t==null&&It("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,a){return a.priority-r.priority})}};var f4=function(e,t,n){for(var r=e.beforeRenderCallbacks,a=0;a<r.length;a++)r[a].fn(t,n)};iu.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function r(a){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){f4(e,!0,a);var i=Wo();e.render(e.renderOptions);var s=e.lastDrawTime=Wo();e.averageRedrawTime===void 0&&(e.averageRedrawTime=s-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var l=s-i;e.redrawTotalTime+=l,e.lastRedrawTime=l,e.averageRedrawTime=e.averageRedrawTime/2+l/2,e.requestedFrame=!1}else f4(e,!1,a);e.skipFrame=!1,$f(r)}};$f(n)}};var mle=function(e){this.init(e)},p4=mle,al=p4.prototype;al.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],al.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,s="__________cytoscape_stylesheet",l="__________cytoscape_container",u=a.getElementById(s)!=null;if(n.className.indexOf(l)<0&&(n.className=(n.className||"")+" "+l),!u){var c=a.createElement("style");c.id=s,c.textContent="."+l+" { position: relative; }",i.insertBefore(c,i.children[0])}var d=r.getComputedStyle(n),f=d.getPropertyValue("position");f==="static"&&ut("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=Ee(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},al.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},al.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,a=r.target;(a.off||a.removeEventListener).apply(a,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},al.isHeadless=function(){return!1},[ty,u4,d4,ol,Zo,iu].forEach(function(e){He(al,e)});var ly=1e3/60,h4={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Nf(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),a=function(s,l){var u=Wo(),c=n.averageRedrawTime,d=n.lastRedrawTime,f=[],h=n.cy.extent(),m=n.getPixelRatio();for(s||n.flushRenderedStyleQueue();;){var p=Wo(),g=p-u,v=p-l;if(d<ly){var y=ly-(s?c:0);if(v>=e.deqFastCost*y)break}else if(s){if(g>=e.deqCost*d||g>=e.deqAvgCost*c)break}else if(v>=e.deqNoDrawCost*ly)break;var b=e.deq(t,m,h);if(b.length>0)for(var x=0;x<b.length;x++)f.push(b[x]);else break}f.length>0&&(e.onDeqd(t,f),!s&&e.shouldRedraw(t,f,m,h)&&r())},i=e.priority||E0;n.beforeRender(a,i(t))}}}},gle=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pf;y0(this,e),this.idsByKey=new go,this.keyForId=new go,this.cachesByLvl=new go,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return v0(e,[{key:"getIdsFor",value:function(t){t==null&&It("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new Rs,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);return r!==a}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,a=n.get(t);return a||(a=new go,n.set(t,a),r.push(t)),a}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),a=this.getCache(r,n);return a!=null&&this.updateKeyMappingFor(t),a}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id()),a=this.getCache(r,n);return a}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var a=this.getKey(t);this.setCache(a,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);return a&&this.invalidateKey(r),a||this.getNumberOfIdsForKey(r)===0}}]),e}(),m4=25,wp=50,xp=-4,cy=3,yle=7.99,vle=8,ble=1024,wle=1024,xle=1024,kle=.2,Cle=.8,Ele=10,Sle=.15,_le=.1,Ble=.9,Tle=.9,Ole=100,Nle=1,il={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},$le=gn({getKey:null,doesEleInvalidateKey:Pf,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:s5,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),su=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=$le(t);He(n,r),n.lookup=new gle(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},rn=su.prototype;rn.reasons=il,rn.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},rn.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},rn.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new jc(function(n,r){return r.reqs-n.reqs});return t},rn.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},rn.getElement=function(e,t,n,r,a){var i=this,s=this.renderer,l=s.cy.zoom(),u=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(B0(l*n))),r<xp)r=xp;else if(l>=yle||r>cy)return null;var c=Math.pow(2,r),d=t.h*c,f=t.w*c,h=s.eleTextBiggerThanMin(e,c);if(!this.isVisible(e,h))return null;var m=u.get(e,r);if(m&&m.invalidated&&(m.invalidated=!1,m.texture.invalidatedWidth-=m.width),m)return m;var p;if(d<=m4?p=m4:d<=wp?p=wp:p=Math.ceil(d/wp)*wp,d>xle||f>wle)return null;var g=i.getTextureQueue(p),v=g[g.length-2],y=function(){return i.recycleTexture(p,f)||i.addTexture(p,f)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidth<f&&(v=y());for(var b=function(D){return D&&D.scaledLabelShown===h},x=a&&a===il.dequeue,w=a&&a===il.highQuality,C=a&&a===il.downscale,k,E=r+1;E<=cy;E++){var S=u.get(e,E);if(S){k=S;break}}var _=k&&k.level===r+1?k:null,N=function(){v.context.drawImage(_.texture.canvas,_.x,0,_.width,_.height,v.usedWidth,0,f,d)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,f,p),b(_))N();else if(b(k))if(w){for(var T=k.level;T>r;T--)_=i.getElement(e,t,n,T,il.downscale);N()}else return i.queueElement(e,k.level-1),k;else{var O;if(!x&&!w&&!C)for(var P=r-1;P>=xp;P--){var F=u.get(e,P);if(F){O=F;break}}if(b(O))return i.queueElement(e,r),O;v.context.translate(v.usedWidth,0),v.context.scale(c,c),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/c,1/c),v.context.translate(-v.usedWidth,0)}return m={x:v.usedWidth,texture:v,level:r,scale:c,width:f,height:d,scaledLabelShown:h},v.usedWidth+=Math.ceil(f+vle),v.eleCaches.push(m),u.set(e,r,m),i.checkTextureFullness(v),m},rn.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},rn.invalidateElement=function(e){var t=this,n=t.lookup,r=[],a=n.isInvalid(e);if(a){for(var i=xp;i<=cy;i++){var s=n.getForCachedKey(e,i);s&&r.push(s)}var l=n.invalidate(e);if(l)for(var u=0;u<r.length;u++){var c=r[u],d=c.texture;d.invalidatedWidth+=c.width,c.invalidated=!0,t.checkTextureUtility(d)}t.removeFromQueue(e)}},rn.checkTextureUtility=function(e){e.invalidatedWidth>=kle*e.width&&this.retireTexture(e)},rn.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>Cle&&e.fullnessChecks>=Ele?$a(n,e):e.fullnessChecks++},rn.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;$a(r,e),e.retired=!0;for(var i=e.eleCaches,s=0;s<i.length;s++){var l=i[s];a.deleteCache(l.key,l.level)}S0(i);var u=t.getRetiredTextureQueue(n);u.push(e)},rn.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),a={};return r.push(a),a.eleCaches=[],a.height=e,a.width=Math.max(ble,t),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=n.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a},rn.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),a=n.getRetiredTextureQueue(e),i=0;i<a.length;i++){var s=a[i];if(s.width>=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,S0(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),$a(a,s),r.push(s),s}},rn.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),i=this.getKey(e),s=a[i];if(s)s.level=Math.max(s.level,t),s.eles.merge(e),s.reqs++,r.updateItem(s);else{var l={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(l),a[i]=l}},rn.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,s=0;s<Nle&&n.size()>0;s++){var l=n.pop(),u=l.key,c=l.eles[0],d=i.hasCache(c,l.level);if(r[u]=null,!d){a.push(l);var f=t.getBoundingBox(c);t.getElement(c,f,e,l.level,il.dequeue)}}return a},rn.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),i=r[a];i!=null&&(i.eles.length===1?(i.reqs=C0,n.updateItem(i),n.pop(),r[a]=null):i.eles.unmerge(e))},rn.onDequeue=function(e){this.onDequeues.push(e)},rn.offDequeue=function(e){$a(this.onDequeues,e)},rn.setupDequeueing=h4.setupDequeueing({deqRedrawThreshold:Ole,deqCost:Sle,deqAvgCost:_le,deqNoDrawCost:Ble,deqFastCost:Tle,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var a=0;a<t.length;a++)for(var i=t[a].eles,s=0;s<i.length;s++){var l=i[s].boundingBox();if(T0(l,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Fle=1,lu=-4,kp=2,Ple=3.99,Ale=50,Ile=50,Dle=.15,Lle=.1,Rle=.9,Mle=.9,Vle=1,g4=250,zle=4e3*4e3,jle=!0,y4=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Wo()-2*g4,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Nf(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Ile),n.beforeRender(function(i,s){s-t.lastInvalidationTime<=g4?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var a=function(i,s){return s.reqs-i.reqs};t.layersQueue=new jc(a),t.setupDequeueing()},wn=y4.prototype,v4=0,Hle=Math.pow(2,53)-1;wn.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),s={id:v4=++v4%Hle,bb:e,level:t,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},l=s.context,u=-s.bb.x1,c=-s.bb.y1;return l.scale(n,n),l.translate(u,c),s},wn.getLayers=function(e,t,n){var r=this,a=r.renderer,i=a.cy,s=i.zoom(),l=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(B0(s*t)),n<lu)n=lu;else if(s>=Ple||n>kp)return null}r.validateLayersElesOrdering(n,e);var u=r.layersByLevel,c=Math.pow(2,n),d=u[n]=u[n]||[],f,h=r.levelIsComplete(n,e),m,p=function(){var _=function(P){if(r.validateLayersElesOrdering(P,e),r.levelIsComplete(P,e))return m=u[P],!0},N=function(P){if(!m)for(var F=n+P;lu<=F&&F<=kp&&!_(F);F+=P);};N(1),N(-1);for(var T=d.length-1;T>=0;T--){var O=d[T];O.invalid&&$a(d,O)}};if(!h)p();else return d;var g=function(){if(!f){f=er();for(var _=0;_<e.length;_++)m5(f,e[_].boundingBox())}return f},v=function(_){_=_||{};var N=_.after;g();var T=f.w*c*(f.h*c);if(T>zle)return null;var O=r.makeLayer(f,n);if(N!=null){var P=d.indexOf(N)+1;d.splice(P,0,O)}else(_.insert===void 0||_.insert)&&d.unshift(O);return O};if(r.skipping&&!l)return null;for(var y=null,b=e.length/Fle,x=!l,w=0;w<e.length;w++){var C=e[w],k=C._private.rscratch,E=k.imgLayerCaches=k.imgLayerCaches||{},S=E[n];if(S){y=S;continue}if((!y||y.eles.length>=b||!y5(y.bb,C.boundingBox()))&&(y=v({insert:!0,after:y}),!y))return null;m||x?r.queueLayer(y,C):r.drawEleInLayer(y,C,n,t),y.eles.push(C),E[n]=y}return m||(x?null:d)},wn.getEleLevelForLayerLevel=function(e,t){return e},wn.drawEleInLayer=function(e,t,n,r){var a=this,i=this.renderer,s=e.context,l=t.boundingBox();l.w===0||l.h===0||!t.visible()||(n=a.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(s,!1),i.drawCachedElement(s,t,null,null,n,jle),i.setImgSmoothing(s,!0))},wn.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var a=0,i=0;i<r.length;i++){var s=r[i];if(s.reqs>0||s.invalid)return!1;a+=s.eles.length}return a===t.length},wn.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,s=0;s<t.length;s++)if(a.eles[0]===t[s]){i=s;break}if(i<0){this.invalidateLayer(a);continue}for(var l=i,s=0;s<a.eles.length;s++)if(a.eles[s]!==t[l+s]){this.invalidateLayer(a);break}}},wn.updateElementsInLayers=function(e,t){for(var n=this,r=Pc(e[0]),a=0;a<e.length;a++)for(var i=r?null:e[a],s=r?e[a]:e[a].ele,l=s._private.rscratch,u=l.imgLayerCaches=l.imgLayerCaches||{},c=lu;c<=kp;c++){var d=u[c];d&&(i&&n.getEleLevelForLayerLevel(d.level)!==i.level||t(d,s,i))}},wn.haveLayers=function(){for(var e=this,t=!1,n=lu;n<=kp;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},wn.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Wo(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))},wn.invalidateLayer=function(e){if(this.lastInvalidationTime=Wo(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];$a(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},wn.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(n,r,a){var i=n.replacement;if(i||(i=n.replacement=t.makeLayer(n.bb,n.level),i.replaces=n,i.eles=n.eles),!i.reqs)for(var s=0;s<i.eles.length;s++)t.queueLayer(i,i.eles[s])})},wn.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},wn.queueLayer=function(e,t){var n=this,r=n.layersQueue,a=e.elesQueue,i=a.hasId=a.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;a.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},wn.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<Vle&&n.size()!==0;){var i=n.peek();if(i.replacement){n.pop();continue}if(i.replaces&&i!==i.replaces.replacement){n.pop();continue}if(i.invalid){n.pop();continue}var s=i.elesQueue.shift();s&&(t.drawEleInLayer(i,s,i.level,e),a++),r.length===0&&r.push(!0),i.elesQueue.length===0&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}return r},wn.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=e;for(var i=0;i<e.eles.length;i++){var s=e.eles[i]._private,l=s.imgLayerCaches=s.imgLayerCaches||{};l&&(l[e.level]=e)}t.requestRedraw()}},wn.requestRedraw=Nf(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),wn.setupDequeueing=h4.setupDequeueing({deqRedrawThreshold:Ale,deqCost:Dle,deqAvgCost:Lle,deqNoDrawCost:Rle,deqFastCost:Mle,deq:function(e,t){return e.dequeue(t)},onDeqd:E0,shouldRedraw:s5,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var b4={},w4;function Ule(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function qle(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];a===0&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function x4(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var s=n,l=n[0];e.moveTo(l.x,l.y);for(var a=1;a<s.length;a++){var i=s[a];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function Kle(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,Math.PI*2,!1);var i=t,s=i[0];e.moveTo(s.x,s.y);for(var l=0;l<i.length;l++){var u=i[l];e.lineTo(u.x,u.y)}e.closePath&&e.closePath()}function Wle(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}b4.arrowShapeImpl=function(e){return(w4||(w4={polygon:Ule,"triangle-backcurve":qle,"triangle-tee":x4,"circle-triangle":Kle,"triangle-cross":x4,circle:Wle}))[e]};var xo={};xo.drawElement=function(e,t,n,r,a,i){var s=this;t.isNode()?s.drawNode(e,t,n,r,a,i):s.drawEdge(e,t,n,r,a,i)},xo.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},xo.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},xo.drawCachedElementPortion=function(e,t,n,r,a,i,s,l){var u=this,c=n.getBoundingBox(t);if(!(c.w===0||c.h===0)){var d=n.getElement(t,c,r,a,i);if(d!=null){var f=l(u,t);if(f===0)return;var h=s(u,t),m=c.x1,p=c.y1,g=c.w,v=c.h,y,b,x,w,C;if(h!==0){var k=n.getRotationPoint(t);x=k.x,w=k.y,e.translate(x,w),e.rotate(h),C=u.getImgSmoothing(e),C||u.setImgSmoothing(e,!0);var E=n.getRotationOffset(t);y=E.x,b=E.y}else y=m,b=p;var S;f!==1&&(S=e.globalAlpha,e.globalAlpha=S*f),e.drawImage(d.texture.canvas,d.x,0,d.width,d.height,y,b,g,v),f!==1&&(e.globalAlpha=S),h!==0&&(e.rotate(-h),e.translate(-x,-w),C||u.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var Gle=function(){return 0},Xle=function(e,t){return e.getTextAngle(t,null)},Yle=function(e,t){return e.getTextAngle(t,"source")},Zle=function(e,t){return e.getTextAngle(t,"target")},Jle=function(e,t){return t.effectiveOpacity()},uy=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};xo.drawCachedElement=function(e,t,n,r,a,i){var s=this,l=s.data,u=l.eleTxrCache,c=l.lblTxrCache,d=l.slbTxrCache,f=l.tlbTxrCache,h=t.boundingBox(),m=i===!0?u.reasons.highQuality:null;if(!(h.w===0||h.h===0||!t.visible())&&(!r||T0(h,r))){var p=t.isEdge(),g=t.element()._private.rscratch.badLine;s.drawElementUnderlay(e,t),s.drawCachedElementPortion(e,t,u,n,a,m,Gle,Jle),(!p||!g)&&s.drawCachedElementPortion(e,t,c,n,a,m,Xle,uy),p&&!g&&(s.drawCachedElementPortion(e,t,d,n,a,m,Yle,uy),s.drawCachedElementPortion(e,t,f,n,a,m,Zle,uy)),s.drawElementOverlay(e,t)}},xo.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var a=t[r];n.drawElement(e,a)}},xo.drawCachedElements=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var s=t[i];a.drawCachedElement(e,s,n,r)}},xo.drawCachedNodes=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var s=t[i];s.isNode()&&a.drawCachedElement(e,s,n,r)}},xo.drawLayeredElements=function(e,t,n,r){var a=this,i=a.data.lyrTxrCache.getLayers(t,n);if(i)for(var s=0;s<i.length;s++){var l=i[s],u=l.bb;u.w===0||u.h===0||e.drawImage(l.canvas,u.x1,u.y1,u.w,u.h)}else a.drawCachedElements(e,t,n,r)};var Jo={};Jo.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l=t._private.rscratch;if(!(i&&!t.visible())&&!(l.badLine||l.allpts==null||isNaN(l.allpts[0]))){var u;n&&(u=n,e.translate(-u.x1,-u.y1));var c=i?t.pstyle("opacity").value:1,d=i?t.pstyle("line-opacity").value:1,f=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,m=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=c*d,b=c*d,x=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;f==="straight-triangle"?(s.eleStrokeStyle(e,t,F),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=m,e.lineCap=p,s.eleStrokeStyle(e,t,F),s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")},w=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(e.lineWidth=m+g,e.lineCap=p,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],F);else{e.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")},C=function(){a&&s.drawEdgeOverlay(e,t)},k=function(){a&&s.drawEdgeUnderlay(e,t)},E=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(e,t,F)},S=function(){s.drawElementText(e,t,null,r)};e.lineJoin="round";var _=t.pstyle("ghost").value==="yes";if(_){var N=t.pstyle("ghost-offset-x").pfValue,T=t.pstyle("ghost-offset-y").pfValue,O=t.pstyle("ghost-opacity").value,P=y*O;e.translate(N,T),x(P),E(P),e.translate(-N,-T)}else w();k(),x(),E(),C(),S(),n&&e.translate(u.x1,u.y1)}};var k4=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(r!==0){var a=this,i=a.usePaths(),s=n._private.rscratch,l=n.pstyle("".concat(e,"-padding")).pfValue,u=2*l,c=n.pstyle("".concat(e,"-color")).value;t.lineWidth=u,s.edgeType==="self"&&!i?t.lineCap="butt":t.lineCap="round",a.colorStrokeStyle(t,c[0],c[1],c[2],r),a.drawEdgePath(n,t,s.allpts,"solid")}}}};Jo.drawEdgeOverlay=k4("overlay"),Jo.drawEdgeUnderlay=k4("underlay"),Jo.drawEdgePath=function(e,t,n,r){var a=e._private.rscratch,i=t,s,l=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var f=n.join("$"),h=a.pathCacheKey&&a.pathCacheKey===f;h?(s=t=a.pathCache,l=!0):(s=t=new Path2D,a.pathCacheKey=f,a.pathCache=s)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(c),i.lineDashOffset=d;break;case"solid":i.setLineDash([]);break}if(!l&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var m=2;m+3<n.length;m+=4)t.quadraticCurveTo(n[m],n[m+1],n[m+2],n[m+3]);break;case"straight":case"haystack":for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1]);break;case"segments":if(a.isRound){var g=zS(a.roundCorners),v;try{for(g.s();!(v=g.n()).done;){var y=v.value;r4(t,y)}}catch(x){g.e(x)}finally{g.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var b=2;b+1<n.length;b+=2)t.lineTo(n[b],n[b+1]);break}t=i,u?t.stroke(s):t.stroke(),t.setLineDash&&t.setLineDash([])},Jo.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),l=[i[1]/s,-i[0]/s],u=[l[0]*r/2,l[1]*r/2];t.beginPath(),t.moveTo(n[a]-u[0],n[a+1]-u[1]),t.lineTo(n[a]+u[0],n[a+1]+u[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}},Jo.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},Jo.drawArrowhead=function(e,t,n,r,a,i,s){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)){var l=this,u=t.pstyle(n+"-arrow-shape").value;if(u!=="none"){var c=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",d=t.pstyle(n+"-arrow-fill").value,f=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),m=h.value==="match-line"?f:h.pfValue;h.units==="%"&&(m*=f);var p=t.pstyle("opacity").value;s===void 0&&(s=p);var g=e.globalCompositeOperation;(s!==1||d==="hollow")&&(e.globalCompositeOperation="destination-out",l.colorFillStyle(e,255,255,255,1),l.colorStrokeStyle(e,255,255,255,1),l.drawArrowShape(t,e,c,f,u,m,r,a,i),e.globalCompositeOperation=g);var v=t.pstyle(n+"-arrow-color").value;l.colorFillStyle(e,v[0],v[1],v[2],s),l.colorStrokeStyle(e,v[0],v[1],v[2],s),l.drawArrowShape(t,e,d,f,u,m,r,a,i)}}},Jo.drawArrowShape=function(e,t,n,r,a,i,s,l,u){var c=this,d=this.usePaths()&&a!=="triangle-cross",f=!1,h,m=t,p={x:s,y:l},g=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,g),y=c.arrowShapes[a];if(d){var b=c.arrowPathCache=c.arrowPathCache||[],x=_i(a),w=b[x];w!=null?(h=t=w,f=!0):(h=t=new Path2D,b[x]=h)}f||(t.beginPath&&t.beginPath(),d?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,v,u,p,r),t.closePath&&t.closePath()),t=m,d&&(t.translate(s,l),t.rotate(u),t.scale(v,v)),(n==="filled"||n==="both")&&(d?t.fill(h):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=i/(d?v:1),t.lineJoin="miter",d?t.stroke(h):t.stroke()),d&&(t.scale(1/v,1/v),t.rotate(-u),t.translate(-s,-l))};var dy={};dy.safeDrawImage=function(e,t,n,r,a,i,s,l,u,c){if(!(a<=0||i<=0||u<=0||c<=0))try{e.drawImage(t,n,r,a,i,s,l,u,c)}catch(d){ut(d)}},dy.drawInscribedImage=function(e,t,n,r,a){var i=this,s=n.position(),l=s.x,u=s.y,c=n.cy().style(),d=c.getIndexedStyle.bind(c),f=d(n,"background-fit","value",r),h=d(n,"background-repeat","value",r),m=n.width(),p=n.height(),g=n.padding()*2,v=m+(d(n,"background-width-relative-to","value",r)==="inner"?0:g),y=p+(d(n,"background-height-relative-to","value",r)==="inner"?0:g),b=n._private.rscratch,x=d(n,"background-clip","value",r),w=x==="node",C=d(n,"background-image-opacity","value",r)*a,k=d(n,"background-image-smoothing","value",r),E=n.pstyle("corner-radius").value;E!=="auto"&&(E=n.pstyle("corner-radius").pfValue);var S=t.width||t.cachedW,_=t.height||t.cachedH;(S==null||_==null)&&(document.body.appendChild(t),S=t.cachedW=t.width||t.offsetWidth,_=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var N=S,T=_;if(d(n,"background-width","value",r)!=="auto"&&(d(n,"background-width","units",r)==="%"?N=d(n,"background-width","pfValue",r)*v:N=d(n,"background-width","pfValue",r)),d(n,"background-height","value",r)!=="auto"&&(d(n,"background-height","units",r)==="%"?T=d(n,"background-height","pfValue",r)*y:T=d(n,"background-height","pfValue",r)),!(N===0||T===0)){if(f==="contain"){var O=Math.min(v/N,y/T);N*=O,T*=O}else if(f==="cover"){var O=Math.max(v/N,y/T);N*=O,T*=O}var P=l-v/2,F=d(n,"background-position-x","units",r),D=d(n,"background-position-x","pfValue",r);F==="%"?P+=(v-N)*D:P+=D;var $=d(n,"background-offset-x","units",r),L=d(n,"background-offset-x","pfValue",r);$==="%"?P+=(v-N)*L:P+=L;var I=u-y/2,z=d(n,"background-position-y","units",r),G=d(n,"background-position-y","pfValue",r);z==="%"?I+=(y-T)*G:I+=G;var q=d(n,"background-offset-y","units",r),X=d(n,"background-offset-y","pfValue",r);q==="%"?I+=(y-T)*X:I+=X,b.pathCache&&(P-=l,I-=u,l=0,u=0);var te=e.globalAlpha;e.globalAlpha=C;var le=i.getImgSmoothing(e),ue=!1;if(k==="no"&&le?(i.setImgSmoothing(e,!1),ue=!0):k==="yes"&&!le&&(i.setImgSmoothing(e,!0),ue=!0),h==="no-repeat")w&&(e.save(),b.pathCache?e.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,l,u,v,y,E,b),e.clip())),i.safeDrawImage(e,t,0,0,S,_,P,I,N,T),w&&e.restore();else{var ne=e.createPattern(t,h);e.fillStyle=ne,i.nodeShapes[i.getNodeShape(n)].draw(e,l,u,v,y,E,b),e.translate(P,I),e.fill(),e.translate(-P,-I)}e.globalAlpha=te,ue&&i.setImgSmoothing(e,le)}};var Ri={};Ri.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(B0(n*r));t=Math.pow(2,a)}var i=e.pstyle("font-size").pfValue*t,s=e.pstyle("min-zoomed-font-size").pfValue;return!(i<s)},Ri.drawElementText=function(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(r==null){if(i&&!s.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var l=t.pstyle("label");if(!l||!l.value)return;var u=s.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var c=t.element()._private.rscratch.badLine,d=t.pstyle("label"),f=t.pstyle("source-label"),h=t.pstyle("target-label");if(c||(!d||!d.value)&&(!f||!f.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var m=!n,p;n&&(p=n,e.translate(-p.x1,-p.y1)),a==null?(s.drawText(e,t,null,m,i),t.isEdge()&&(s.drawText(e,t,"source",m,i),s.drawText(e,t,"target",m,i))):s.drawText(e,t,a,m,i),n&&e.translate(p.x1,p.y1)},Ri.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},Ri.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,l=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*l,c=t.pstyle("color").value,d=t.pstyle("text-outline-color").value;e.font=r+" "+s+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],l),this.colorStrokeStyle(e,d[0],d[1],d[2],u)};function fy(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+r-i,n),e.quadraticCurveTo(t+r,n,t+r,n+i),e.lineTo(t+r,n+a-i),e.quadraticCurveTo(t+r,n+a,t+r-i,n+a),e.lineTo(t+i,n+a),e.quadraticCurveTo(t,n+a,t,n+a-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath(),s?e.stroke():e.fill()}Ri.getTextAngle=function(e,t){var n,r=e._private,a=r.rscratch,i=t?t+"-":"",s=e.pstyle(i+"text-rotation"),l=Zr(a,"labelAngle",t);return s.strValue==="autorotate"?n=e.isEdge()?l:0:s.strValue==="none"?n=0:n=s.pfValue,n},Ri.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=t._private,s=i.rscratch,l=a?t.effectiveOpacity():1;if(!(a&&(l===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var u=Zr(s,"labelX",n),c=Zr(s,"labelY",n),d,f,h=this.getLabelText(t,n);if(h!=null&&h!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var m=n?n+"-":"",p=Zr(s,"labelWidth",n),g=Zr(s,"labelHeight",n),v=t.pstyle(m+"text-margin-x").pfValue,y=t.pstyle(m+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;b&&(x="center",w="center"),u+=v,c+=y;var C;switch(r?C=this.getTextAngle(t,n):C=0,C!==0&&(d=u,f=c,e.translate(d,f),e.rotate(C),u=0,c=0),w){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g;break}var k=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,S=t.pstyle("text-border-width").pfValue,_=t.pstyle("text-background-padding").pfValue,N=t.pstyle("text-background-shape").strValue,T=N.indexOf("round")===0,O=2;if(k>0||S>0&&E>0){var P=u-_;switch(x){case"left":P-=p;break;case"center":P-=p/2;break}var F=c-g-_,D=p+2*_,$=g+2*_;if(k>0){var L=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+k*l+")",T?fy(e,P,F,D,$,O):e.fillRect(P,F,D,$),e.fillStyle=L}if(S>0&&E>0){var z=e.strokeStyle,G=e.lineWidth,q=t.pstyle("text-border-color").value,X=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+q[0]+","+q[1]+","+q[2]+","+E*l+")",e.lineWidth=S,e.setLineDash)switch(X){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=S/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(T?fy(e,P,F,D,$,O,"stroke"):e.strokeRect(P,F,D,$),X==="double"){var te=S/2;T?fy(e,P+te,F+te,D-te*2,$-te*2,O,"stroke"):e.strokeRect(P+te,F+te,D-te*2,$-te*2)}e.setLineDash&&e.setLineDash([]),e.lineWidth=G,e.strokeStyle=z}}var le=2*t.pstyle("text-outline-width").pfValue;if(le>0&&(e.lineWidth=le),t.pstyle("text-wrap").value==="wrap"){var ue=Zr(s,"labelWrapCachedLines",n),ne=Zr(s,"labelLineHeight",n),oe=p/2,U=this.getLabelJustification(t);switch(U==="auto"||(x==="left"?U==="left"?u+=-p:U==="center"&&(u+=-oe):x==="center"?U==="left"?u+=-oe:U==="right"&&(u+=oe):x==="right"&&(U==="center"?u+=oe:U==="right"&&(u+=p))),w){case"top":c-=(ue.length-1)*ne;break;case"center":case"bottom":c-=(ue.length-1)*ne;break}for(var K=0;K<ue.length;K++)le>0&&e.strokeText(ue[K],u,c),e.fillText(ue[K],u,c),c+=ne}else le>0&&e.strokeText(h,u,c),e.fillText(h,u,c);C!==0&&(e.rotate(-C),e.translate(-d,-f))}}};var sl={};sl.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l,u,c=t._private,d=c.rscratch,f=t.position();if(!(!Ee(f.x)||!Ee(f.y))&&!(i&&!t.visible())){var h=i?t.effectiveOpacity():1,m=s.usePaths(),p,g=!1,v=t.padding();l=t.width()+2*v,u=t.height()+2*v;var y;n&&(y=n,e.translate(-y.x1,-y.y1));for(var b=t.pstyle("background-image"),x=b.value,w=new Array(x.length),C=new Array(x.length),k=0,E=0;E<x.length;E++){var S=x[E],_=w[E]=S!=null&&S!=="none";if(_){var N=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",E);k++,C[E]=s.getCachedImage(S,N,function(){c.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var T=t.pstyle("background-blacken").value,O=t.pstyle("border-width").pfValue,P=t.pstyle("background-opacity").value*h,F=t.pstyle("border-color").value,D=t.pstyle("border-style").value,$=t.pstyle("border-join").value,L=t.pstyle("border-cap").value,I=t.pstyle("border-position").value,z=t.pstyle("border-dash-pattern").pfValue,G=t.pstyle("border-dash-offset").pfValue,q=t.pstyle("border-opacity").value*h,X=t.pstyle("outline-width").pfValue,te=t.pstyle("outline-color").value,le=t.pstyle("outline-style").value,ue=t.pstyle("outline-opacity").value*h,ne=t.pstyle("outline-offset").value,oe=t.pstyle("corner-radius").value;oe!=="auto"&&(oe=t.pstyle("corner-radius").pfValue);var U=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P;s.eleFillStyle(e,t,he)},K=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:q;s.colorStrokeStyle(e,F[0],F[1],F[2],he)},Z=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ue;s.colorStrokeStyle(e,te[0],te[1],te[2],he)},de=function(he,ae,ye,Pe){var Ie=s.nodePathCache=s.nodePathCache||[],W=a5(ye==="polygon"?ye+","+Pe.join(","):ye,""+ae,""+he,""+oe),fe=Ie[W],ie,we=!1;return fe!=null?(ie=fe,we=!0,d.pathCache=ie):(ie=new Path2D,Ie[W]=d.pathCache=ie),{path:ie,cacheHit:we}},be=t.pstyle("shape").strValue,Be=t.pstyle("shape-polygon-points").pfValue;if(m){e.translate(f.x,f.y);var pe=de(l,u,be,Be);p=pe.path,g=pe.cacheHit}var xe=function(){if(!g){var he=f;m&&(he={x:0,y:0}),s.nodeShapes[s.getNodeShape(t)].draw(p||e,he.x,he.y,l,u,oe,d)}m?e.fill(p):e.fill()},ge=function(){for(var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ye=c.backgrounding,Pe=0,Ie=0;Ie<C.length;Ie++){var W=t.cy().style().getIndexedStyle(t,"background-image-containment","value",Ie);if(ae&&W==="over"||!ae&&W==="inside"){Pe++;continue}w[Ie]&&C[Ie].complete&&!C[Ie].error&&(Pe++,s.drawInscribedImage(e,C[Ie],t,Ie,he))}c.backgrounding=Pe!==k,ye!==c.backgrounding&&t.updateStyle(!1)},Ce=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;s.hasPie(t)&&(s.drawPie(e,t,ae),he&&(m||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,l,u,oe,d)))},Oe=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,ae=(T>0?T:-T)*he,ye=T>0?0:255;T!==0&&(s.colorFillStyle(e,ye,ye,ye,ae),m?e.fill(p):e.fill())},Ae=function(){if(O>0){if(e.lineWidth=O,e.lineCap=L,e.lineJoin=$,e.setLineDash)switch(D){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(z),e.lineDashOffset=G;break;case"solid":case"double":e.setLineDash([]);break}if(I!=="center"){if(e.save(),e.lineWidth*=2,I==="inside")m?e.clip(p):e.clip();else{var he=new Path2D;he.rect(-l/2-O,-u/2-O,l+2*O,u+2*O),he.addPath(p),e.clip(he,"evenodd")}m?e.stroke(p):e.stroke(),e.restore()}else m?e.stroke(p):e.stroke();if(D==="double"){e.lineWidth=O/3;var ae=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",m?e.stroke(p):e.stroke(),e.globalCompositeOperation=ae}e.setLineDash&&e.setLineDash([])}},Se=function(){if(X>0){if(e.lineWidth=X,e.lineCap="butt",e.setLineDash)switch(le){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var he=f;m&&(he={x:0,y:0});var ae=s.getNodeShape(t),ye=O;I==="inside"&&(ye=0),I==="outside"&&(ye*=2);var Pe=(l+ye+(X+ne))/l,Ie=(u+ye+(X+ne))/u,W=l*Pe,fe=u*Ie,ie=s.nodeShapes[ae].points,we;if(m){var nt=de(W,fe,ae,ie);we=nt.path}if(ae==="ellipse")s.drawEllipsePath(we||e,he.x,he.y,W,fe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ae)){var Qe=0,lt=0,ft=0;ae==="round-diamond"?Qe=(ye+ne+X)*1.4:ae==="round-heptagon"?(Qe=(ye+ne+X)*1.075,ft=-(ye/2+ne+X)/35):ae==="round-hexagon"?Qe=(ye+ne+X)*1.12:ae==="round-pentagon"?(Qe=(ye+ne+X)*1.13,ft=-(ye/2+ne+X)/15):ae==="round-tag"?(Qe=(ye+ne+X)*1.12,lt=(ye/2+X+ne)*.07):ae==="round-triangle"&&(Qe=(ye+ne+X)*(Math.PI/2),ft=-(ye+ne/2+X)/Math.PI),Qe!==0&&(Pe=(l+Qe)/l,W=l*Pe,["round-hexagon","round-tag"].includes(ae)||(Ie=(u+Qe)/u,fe=u*Ie)),oe=oe==="auto"?w5(W,fe):oe;for(var gt=W/2,qt=fe/2,Tt=oe+(ye+X+ne)/2,Ot=new Array(ie.length/2),Kt=new Array(ie.length/2),Wt=0;Wt<ie.length/2;Wt++)Ot[Wt]={x:he.x+lt+gt*ie[Wt*2],y:he.y+ft+qt*ie[Wt*2+1]};var Rt,$n,xn,kn,yt=Ot.length;for($n=Ot[yt-1],Rt=0;Rt<yt;Rt++)xn=Ot[Rt%yt],kn=Ot[(Rt+1)%yt],Kt[Rt]=iy($n,xn,kn,Tt),$n=xn,xn=kn;s.drawRoundPolygonPath(we||e,he.x+lt,he.y+ft,l*Pe,u*Ie,ie,Kt)}else if(["roundrectangle","round-rectangle"].includes(ae))oe=oe==="auto"?Ni(W,fe):oe,s.drawRoundRectanglePath(we||e,he.x,he.y,W,fe,oe+(ye+X+ne)/2);else if(["cutrectangle","cut-rectangle"].includes(ae))oe=oe==="auto"?$0():oe,s.drawCutRectanglePath(we||e,he.x,he.y,W,fe,null,oe+(ye+X+ne)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ae))oe=oe==="auto"?Ni(W,fe):oe,s.drawBottomRoundRectanglePath(we||e,he.x,he.y,W,fe,oe+(ye+X+ne)/2);else if(ae==="barrel")s.drawBarrelPath(we||e,he.x,he.y,W,fe);else if(ae.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ae)){var Nt=(ye+X+ne)/l;ie=Mf(Vf(ie,Nt)),s.drawPolygonPath(we||e,he.x,he.y,l,u,ie)}else{var Lt=(ye+X+ne)/l;ie=Mf(Vf(ie,-Lt)),s.drawPolygonPath(we||e,he.x,he.y,l,u,ie)}if(m?e.stroke(we):e.stroke(),le==="double"){e.lineWidth=ye/3;var Fn=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",m?e.stroke(we):e.stroke(),e.globalCompositeOperation=Fn}e.setLineDash&&e.setLineDash([])}},Le=function(){a&&s.drawNodeOverlay(e,t,f,l,u)},De=function(){a&&s.drawNodeUnderlay(e,t,f,l,u)},ze=function(){s.drawElementText(e,t,null,r)},B=t.pstyle("ghost").value==="yes";if(B){var M=t.pstyle("ghost-offset-x").pfValue,Y=t.pstyle("ghost-offset-y").pfValue,Q=t.pstyle("ghost-opacity").value,ee=Q*h;e.translate(M,Y),Z(),Se(),U(Q*P),xe(),ge(ee,!0),K(Q*q),Ae(),Ce(T!==0||O!==0),ge(ee,!1),Oe(ee),e.translate(-M,-Y)}m&&e.translate(-f.x,-f.y),De(),m&&e.translate(f.x,f.y),Z(),Se(),U(),xe(),ge(h,!0),K(),Ae(),Ce(T!==0||O!==0),ge(h,!1),Oe(),m&&e.translate(-f.x,-f.y),ze(),Le(),n&&e.translate(y.x1,y.y1)}};var C4=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,a,i){var s=this;if(n.visible()){var l=n.pstyle("".concat(e,"-padding")).pfValue,u=n.pstyle("".concat(e,"-opacity")).value,c=n.pstyle("".concat(e,"-color")).value,d=n.pstyle("".concat(e,"-shape")).value,f=n.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(r=r||n.position(),a==null||i==null){var h=n.padding();a=n.width()+2*h,i=n.height()+2*h}s.colorFillStyle(t,c[0],c[1],c[2],u),s.nodeShapes[d].draw(t,r.x,r.y,a+l*2,i+l*2,f),t.fill()}}}};sl.drawNodeOverlay=C4("overlay"),sl.drawNodeUnderlay=C4("underlay"),sl.hasPie=function(e){return e=e[0],e._private.hasPie},sl.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),s=r.x,l=r.y,u=t.width(),c=t.height(),d=Math.min(u,c)/2,f=0,h=this.usePaths();h&&(s=0,l=0),i.units==="%"?d=d*i.pfValue:i.pfValue!==void 0&&(d=i.pfValue/2);for(var m=1;m<=a.pieBackgroundN;m++){var p=t.pstyle("pie-"+m+"-background-size").value,g=t.pstyle("pie-"+m+"-background-color").value,v=t.pstyle("pie-"+m+"-background-opacity").value*n,y=p/100;y+f>1&&(y=1-f);var b=1.5*Math.PI+2*Math.PI*f,x=2*Math.PI*y,w=b+x;p===0||f>=1||f+y>1||(e.beginPath(),e.moveTo(s,l),e.arc(s,l,d,b,w),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],v),e.fill(),f+=y)}};var dr={},Qle=100;dr.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},dr.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;a<t.length;a++)if(r=t[a],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},dr.createGradientStyleFor=function(e,t,n,r,a){var i,s=this.usePaths(),l=n.pstyle(t+"-gradient-stop-colors").value,u=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var c=n.sourceEndpoint(),d=n.targetEndpoint(),f=n.midpoint(),h=Bi(c,f),m=Bi(d,f);i=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(h,m))}else{var p=s?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();i=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(g,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),b=n.targetEndpoint();i=e.createLinearGradient(y.x,y.y,b.x,b.y)}else{var x=s?{x:0,y:0}:n.position(),w=n.paddedWidth(),C=n.paddedHeight(),k=w/2,E=C/2,S=n.pstyle("background-gradient-direction").value;switch(S){case"to-bottom":i=e.createLinearGradient(x.x,x.y-E,x.x,x.y+E);break;case"to-top":i=e.createLinearGradient(x.x,x.y+E,x.x,x.y-E);break;case"to-left":i=e.createLinearGradient(x.x+k,x.y,x.x-k,x.y);break;case"to-right":i=e.createLinearGradient(x.x-k,x.y,x.x+k,x.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(x.x-k,x.y-E,x.x+k,x.y+E);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(x.x-k,x.y+E,x.x+k,x.y-E);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(x.x+k,x.y-E,x.x-k,x.y+E);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(x.x+k,x.y+E,x.x-k,x.y-E);break}}if(!i)return null;for(var _=u.length===l.length,N=l.length,T=0;T<N;T++)i.addColorStop(_?u[T]:T/(N-1),"rgba("+l[T][0]+","+l[T][1]+","+l[T][2]+","+a+")");return i},dr.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a},dr.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"},dr.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}},dr.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a},dr.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"},dr.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}},dr.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],s=t.getPixelRatio(),l=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(s=l);var u=a*s,c=i*s,d;if(!(u===t.canvasWidth&&c===t.canvasHeight)){t.fontCaches=null;var f=n.canvasContainer;f.style.width=a+"px",f.style.height=i+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)d=n.canvases[h],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<t.BUFFER_COUNT;h++)d=n.bufferCanvases[h],d.width=u,d.height=c,d.style.width=a+"px",d.style.height=i+"px";t.textureMult=1,s<=1&&(d=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,d.width=u*t.textureMult,d.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},dr.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},dr.render=function(e){e=e||d5();var t=e.forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,a=e.forcedZoom,i=e.forcedPan,s=this,l=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,u=s.cy,c=s.data,d=c.canvasNeedsRedraw,f=s.textureOnViewport&&!t&&(s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming),h=e.motionBlur!==void 0?e.motionBlur:s.motionBlur,m=s.motionBlurPxRatio,p=u.hasCompoundNodes(),g=s.hoverData.draggingEles,v=!!(s.hoverData.selecting||s.touchData.selecting);h=h&&!t&&s.motionBlurEnabled&&!v;var y=h;t||(s.prevPxRatio!==l&&(s.invalidateContainerClientCoordsCache(),s.matchCanvasSize(s.container),s.redrawHint("eles",!0),s.redrawHint("drag",!0)),s.prevPxRatio=l),!t&&s.motionBlurTimeout&&clearTimeout(s.motionBlurTimeout),h&&(s.mbFrames==null&&(s.mbFrames=0),s.mbFrames++,s.mbFrames<3&&(y=!1),s.mbFrames>s.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!f&&(d[s.NODE]=!0,d[s.SELECT_BOX]=!0);var b=u.style(),x=u.zoom(),w=a!==void 0?a:x,C=u.pan(),k={x:C.x,y:C.y},E={zoom:x,pan:{x:C.x,y:C.y}},S=s.prevViewport,_=S===void 0||E.zoom!==S.zoom||E.pan.x!==S.pan.x||E.pan.y!==S.pan.y;!_&&!(g&&!p)&&(s.motionBlurPxRatio=1),i&&(k=i),w*=l,k.x*=l,k.y*=l;var N=s.getCachedZSortedEles();function T(pe,xe,ge,Ce,Oe){var Ae=pe.globalCompositeOperation;pe.globalCompositeOperation="destination-out",s.colorFillStyle(pe,255,255,255,s.motionBlurTransparency),pe.fillRect(xe,ge,Ce,Oe),pe.globalCompositeOperation=Ae}function O(pe,xe){var ge,Ce,Oe,Ae;!s.clearingMotionBlur&&(pe===c.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||pe===c.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(ge={x:C.x*m,y:C.y*m},Ce=x*m,Oe=s.canvasWidth*m,Ae=s.canvasHeight*m):(ge=k,Ce=w,Oe=s.canvasWidth,Ae=s.canvasHeight),pe.setTransform(1,0,0,1,0,0),xe==="motionBlur"?T(pe,0,0,Oe,Ae):!t&&(xe===void 0||xe)&&pe.clearRect(0,0,Oe,Ae),n||(pe.translate(ge.x,ge.y),pe.scale(Ce,Ce)),i&&pe.translate(i.x,i.y),a&&pe.scale(a,a)}if(f||(s.textureDrawLastFrame=!1),f){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=u.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var P=s.data.bufferContexts[s.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:l*s.textureMult});var E=s.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:s.canvasWidth,height:s.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}d[s.DRAG]=!1,d[s.NODE]=!1;var F=c.contexts[s.NODE],D=s.textureCache.texture,E=s.textureCache.viewport;F.setTransform(1,0,0,1,0,0),h?T(F,0,0,E.width,E.height):F.clearRect(0,0,E.width,E.height);var $=b.core("outside-texture-bg-color").value,L=b.core("outside-texture-bg-opacity").value;s.colorFillStyle(F,$[0],$[1],$[2],L),F.fillRect(0,0,E.width,E.height);var x=u.zoom();O(F,!1),F.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l),F.drawImage(D,E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l)}else s.textureOnViewport&&!t&&(s.textureCache=null);var I=u.extent(),z=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),G=s.hideEdgesOnViewport&&z,q=[];if(q[s.NODE]=!d[s.NODE]&&h&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,q[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),q[s.DRAG]=!d[s.DRAG]&&h&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,q[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),d[s.NODE]||n||r||q[s.NODE]){var X=h&&!q[s.NODE]&&m!==1,F=t||(X?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:c.contexts[s.NODE]),te=h&&!X?"motionBlur":void 0;O(F,te),G?s.drawCachedNodes(F,N.nondrag,l,I):s.drawLayeredElements(F,N.nondrag,l,I),s.debug&&s.drawDebugPoints(F,N.nondrag),!n&&!h&&(d[s.NODE]=!1)}if(!r&&(d[s.DRAG]||n||q[s.DRAG])){var X=h&&!q[s.DRAG]&&m!==1,F=t||(X?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:c.contexts[s.DRAG]);O(F,h&&!X?"motionBlur":void 0),G?s.drawCachedNodes(F,N.drag,l,I):s.drawCachedElements(F,N.drag,l,I),s.debug&&s.drawDebugPoints(F,N.drag),!n&&!h&&(d[s.DRAG]=!1)}if(s.showFps||!r&&d[s.SELECT_BOX]&&!n){var F=t||c.contexts[s.SELECT_BOX];if(O(F),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var x=s.cy.zoom(),le=b.core("selection-box-border-width").value/x;F.lineWidth=le,F.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",F.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),le>0&&(F.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",F.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(c.bgActivePosistion&&!s.hoverData.selecting){var x=s.cy.zoom(),ue=c.bgActivePosistion;F.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",F.beginPath(),F.arc(ue.x,ue.y,b.core("active-bg-size").pfValue/x,0,2*Math.PI),F.fill()}var ne=s.lastRedrawTime;if(s.showFps&&ne){ne=Math.round(ne);var oe=Math.round(1e3/ne);F.setTransform(1,0,0,1,0,0),F.fillStyle="rgba(255, 0, 0, 0.75)",F.strokeStyle="rgba(255, 0, 0, 0.75)",F.lineWidth=1,F.fillText("1 frame = "+ne+" ms = "+oe+" fps",0,20);var U=60;F.strokeRect(0,30,250,20),F.fillRect(0,30,250*Math.min(oe/U,1),20)}n||(d[s.SELECT_BOX]=!1)}if(h&&m!==1){var K=c.contexts[s.NODE],Z=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],de=c.contexts[s.DRAG],be=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],Be=function(pe,xe,ge){pe.setTransform(1,0,0,1,0,0),ge||!y?pe.clearRect(0,0,s.canvasWidth,s.canvasHeight):T(pe,0,0,s.canvasWidth,s.canvasHeight);var Ce=m;pe.drawImage(xe,0,0,s.canvasWidth*Ce,s.canvasHeight*Ce,0,0,s.canvasWidth,s.canvasHeight)};(d[s.NODE]||q[s.NODE])&&(Be(K,Z,q[s.NODE]),d[s.NODE]=!1),(d[s.DRAG]||q[s.DRAG])&&(Be(de,be,q[s.DRAG]),d[s.DRAG]=!1)}s.prevViewport=E,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),h&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!f,s.mbFrames=0,d[s.NODE]=!0,d[s.DRAG]=!0,s.redraw()},Qle)),t||u.emit("render")};var za={};za.drawPolygonPath=function(e,t,n,r,a,i){var s=r/2,l=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*i[0],n+l*i[1]);for(var u=1;u<i.length/2;u++)e.lineTo(t+s*i[u*2],n+l*i[u*2+1]);e.closePath()},za.drawRoundPolygonPath=function(e,t,n,r,a,i,s){s.forEach(function(l){return r4(e,l)}),e.closePath()},za.drawRoundRectanglePath=function(e,t,n,r,a,i){var s=r/2,l=a/2,u=i==="auto"?Ni(r,a):Math.min(i,l,s);e.beginPath&&e.beginPath(),e.moveTo(t,n-l),e.arcTo(t+s,n-l,t+s,n,u),e.arcTo(t+s,n+l,t,n+l,u),e.arcTo(t-s,n+l,t-s,n,u),e.arcTo(t-s,n-l,t,n-l,u),e.lineTo(t,n-l),e.closePath()},za.drawBottomRoundRectanglePath=function(e,t,n,r,a,i){var s=r/2,l=a/2,u=i==="auto"?Ni(r,a):i;e.beginPath&&e.beginPath(),e.moveTo(t,n-l),e.lineTo(t+s,n-l),e.lineTo(t+s,n),e.arcTo(t+s,n+l,t,n+l,u),e.arcTo(t-s,n+l,t-s,n,u),e.lineTo(t-s,n-l),e.lineTo(t,n-l),e.closePath()},za.drawCutRectanglePath=function(e,t,n,r,a,i,s){var l=r/2,u=a/2,c=s==="auto"?$0():s;e.beginPath&&e.beginPath(),e.moveTo(t-l+c,n-u),e.lineTo(t+l-c,n-u),e.lineTo(t+l,n-u+c),e.lineTo(t+l,n+u-c),e.lineTo(t+l-c,n+u),e.lineTo(t-l+c,n+u),e.lineTo(t-l,n+u-c),e.lineTo(t-l,n-u+c),e.closePath()},za.drawBarrelPath=function(e,t,n,r,a){var i=r/2,s=a/2,l=t-i,u=t+i,c=n-s,d=n+s,f=F0(r,a),h=f.widthOffset,m=f.heightOffset,p=f.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(l,c+m),e.lineTo(l,d-m),e.quadraticCurveTo(l+p,d,l+h,d),e.lineTo(u-h,d),e.quadraticCurveTo(u-p,d,u,d-m),e.lineTo(u,c+m),e.quadraticCurveTo(u-p,c,u-h,c),e.lineTo(l+h,c),e.quadraticCurveTo(l+p,c,l,c+m),e.closePath()};for(var E4=Math.sin(0),S4=Math.cos(0),py={},hy={},_4=Math.PI/40,ll=0*Math.PI;ll<2*Math.PI;ll+=_4)py[ll]=Math.sin(ll),hy[ll]=Math.cos(ll);za.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,s,l=r/2,u=a/2,c=0*Math.PI;c<2*Math.PI;c+=_4)i=t-l*py[c]*E4+l*hy[c]*S4,s=n+u*hy[c]*E4+u*py[c]*S4,c===0?e.moveTo(i,s):e.lineTo(i,s);e.closePath()};var cu={};cu.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},cu.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),a=this.findContainerClientCoords(),i=e.full?Math.ceil(r.w):a[2],s=e.full?Math.ceil(r.h):a[3],l=Ee(e.maxWidth)||Ee(e.maxHeight),u=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,s*=e.scale,c=e.scale;else if(l){var d=1/0,f=1/0;Ee(e.maxWidth)&&(d=c*e.maxWidth/i),Ee(e.maxHeight)&&(f=c*e.maxHeight/s),c=Math.min(d,f),i*=c,s*=c}l||(i*=u,s*=u,c*=u);var h=document.createElement("canvas");h.width=i,h.height=s,h.style.width=i+"px",h.style.height=s+"px";var m=h.getContext("2d");if(i>0&&s>0){m.clearRect(0,0,i,s),m.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)m.translate(-r.x1*c,-r.y1*c),m.scale(c,c),this.drawElements(m,p),m.scale(1/c,1/c),m.translate(r.x1*c,r.y1*c);else{var g=t.pan(),v={x:g.x*c,y:g.y*c};c*=t.zoom(),m.translate(v.x,v.y),m.scale(c,c),this.drawElements(m,p),m.scale(1/c,1/c),m.translate(-v.x,-v.y)}e.bg&&(m.globalCompositeOperation="destination-over",m.fillStyle=e.bg,m.rect(0,0,i,s),m.fill())}return h};function ece(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function B4(e){var t=e.indexOf(",");return e.substr(t+1)}function T4(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new qs(function(a,i){try{t.toBlob(function(s){s!=null?a(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(s){i(s)}});case"blob":return ece(B4(r()),n);case"base64":return B4(r());case"base64uri":default:return r()}}cu.png=function(e){return T4(e,this.bufferCanvasImage(e),"image/png")},cu.jpg=function(e){return T4(e,this.bufferCanvasImage(e),"image/jpeg")};var O4={};O4.nodeShapeImpl=function(e,t,n,r,a,i,s,l){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,s);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,s,l);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,l);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,s,l);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,l);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}};var tce=N4,st=N4.prototype;st.CANVAS_LAYERS=3,st.SELECT_BOX=0,st.DRAG=1,st.NODE=2,st.BUFFER_COUNT=3,st.TEXTURE_BUFFER=0,st.MOTIONBLUR_BUFFER_NODE=1,st.MOTIONBLUR_BUFFER_DRAG=2;function N4(e){var t=this,n=t.cy.window(),r=n.document;t.data={canvases:new Array(st.CANVAS_LAYERS),contexts:new Array(st.CANVAS_LAYERS),canvasNeedsRedraw:new Array(st.CANVAS_LAYERS),bufferCanvases:new Array(st.BUFFER_COUNT),bufferContexts:new Array(st.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var s=t.data.canvasContainer.style;t.data.canvasContainer.style[a]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var l=e.cy.container();l.appendChild(t.data.canvasContainer),l.style[a]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};jte()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var c=0;c<st.CANVAS_LAYERS;c++){var d=t.data.canvases[c]=r.createElement("canvas");t.data.contexts[c]=d.getContext("2d"),Object.keys(u).forEach(function(U){d.style[U]=u[U]}),d.style.position="absolute",d.setAttribute("data-id","layer"+c),d.style.zIndex=String(st.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(d),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[st.NODE].setAttribute("data-id","layer"+st.NODE+"-node"),t.data.canvases[st.SELECT_BOX].setAttribute("data-id","layer"+st.SELECT_BOX+"-selectbox"),t.data.canvases[st.DRAG].setAttribute("data-id","layer"+st.DRAG+"-drag");for(var c=0;c<st.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=r.createElement("canvas"),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext("2d"),t.data.bufferCanvases[c].style.position="absolute",t.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility="hidden";t.pathsEnabled=!0;var f=er(),h=function(U){return{x:(U.x1+U.x2)/2,y:(U.y1+U.y2)/2}},m=function(U){return{x:-U.w/2,y:-U.h/2}},p=function(U){var K=U[0]._private,Z=K.oldBackgroundTimestamp===K.backgroundTimestamp;return!Z},g=function(U){return U[0]._private.nodeKey},v=function(U){return U[0]._private.labelStyleKey},y=function(U){return U[0]._private.sourceLabelStyleKey},b=function(U){return U[0]._private.targetLabelStyleKey},x=function(U,K,Z,de,be){return t.drawElement(U,K,Z,!1,!1,be)},w=function(U,K,Z,de,be){return t.drawElementText(U,K,Z,de,"main",be)},C=function(U,K,Z,de,be){return t.drawElementText(U,K,Z,de,"source",be)},k=function(U,K,Z,de,be){return t.drawElementText(U,K,Z,de,"target",be)},E=function(U){return U.boundingBox(),U[0]._private.bodyBounds},S=function(U){return U.boundingBox(),U[0]._private.labelBounds.main||f},_=function(U){return U.boundingBox(),U[0]._private.labelBounds.source||f},N=function(U){return U.boundingBox(),U[0]._private.labelBounds.target||f},T=function(U,K){return K},O=function(U){return h(E(U))},P=function(U,K,Z){var de=U?U+"-":"";return{x:K.x+Z.pstyle(de+"text-margin-x").pfValue,y:K.y+Z.pstyle(de+"text-margin-y").pfValue}},F=function(U,K,Z){var de=U[0]._private.rscratch;return{x:de[K],y:de[Z]}},D=function(U){return P("",F(U,"labelX","labelY"),U)},$=function(U){return P("source",F(U,"sourceLabelX","sourceLabelY"),U)},L=function(U){return P("target",F(U,"targetLabelX","targetLabelY"),U)},I=function(U){return m(E(U))},z=function(U){return m(_(U))},G=function(U){return m(N(U))},q=function(U){var K=S(U),Z=m(S(U));if(U.isNode()){switch(U.pstyle("text-halign").value){case"left":Z.x=-K.w;break;case"right":Z.x=0;break}switch(U.pstyle("text-valign").value){case"top":Z.y=-K.h;break;case"bottom":Z.y=0;break}}return Z},X=t.data.eleTxrCache=new su(t,{getKey:g,doesEleInvalidateKey:p,drawElement:x,getBoundingBox:E,getRotationPoint:O,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),te=t.data.lblTxrCache=new su(t,{getKey:v,drawElement:w,getBoundingBox:S,getRotationPoint:D,getRotationOffset:q,isVisible:T}),le=t.data.slbTxrCache=new su(t,{getKey:y,drawElement:C,getBoundingBox:_,getRotationPoint:$,getRotationOffset:z,isVisible:T}),ue=t.data.tlbTxrCache=new su(t,{getKey:b,drawElement:k,getBoundingBox:N,getRotationPoint:L,getRotationOffset:G,isVisible:T}),ne=t.data.lyrTxrCache=new y4(t);t.onUpdateEleCalcs(function(U,K){X.invalidateElements(K),te.invalidateElements(K),le.invalidateElements(K),ue.invalidateElements(K),ne.invalidateElements(K);for(var Z=0;Z<K.length;Z++){var de=K[Z]._private;de.oldBackgroundTimestamp=de.backgroundTimestamp}});var oe=function(U){for(var K=0;K<U.length;K++)ne.enqueueElementRefinement(U[K].ele)};X.onDequeue(oe),te.onDequeue(oe),le.onDequeue(oe),ue.onDequeue(oe)}st.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[st.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[st.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[st.SELECT_BOX]=t;break}};var nce=typeof Path2D<"u";st.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},st.usePaths=function(){return nce&&this.pathsEnabled},st.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},st.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},st.makeOffscreenCanvas=function(e,t){var n;if((typeof OffscreenCanvas>"u"?"undefined":en(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=e,n.height=t}return n},[b4,xo,Jo,dy,Ri,sl,dr,za,cu,O4].forEach(function(e){He(st,e)});var rce=[{name:"null",impl:G3},{name:"base",impl:p4},{name:"canvas",impl:tce}],oce=[{type:"layout",extensions:ule},{type:"renderer",extensions:rce}],$4={},F4={};function P4(e,t,n){var r=n,a=function(E){ut("Can not register `"+t+"` for `"+e+"` since `"+E+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(ou.prototype[t])return a(t);ou.prototype[t]=n}else if(e==="collection"){if(vn.prototype[t])return a(t);vn.prototype[t]=n}else if(e==="layout"){for(var i=function(E){this.options=E,n.call(this,E),ot(this._private)||(this._private={}),this._private.cy=E.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(n.prototype),l=[],u=0;u<l.length;u++){var c=l[u];s[c]=s[c]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var d=n.prototype.stop;s.stop=function(){var E=this.options;if(E&&E.animate){var S=this.animations;if(S)for(var _=0;_<S.length;_++)S[_].stop()}return d?d.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var f=function(E){return E._private.cy},h={addEventFields:function(E,S){S.layout=E,S.cy=f(E),S.target=E},bubble:function(){return!0},parent:function(E){return f(E)}};He(s,{createEmitter:function(){return this._private.emitter=new ep(h,this),this},emitter:function(){return this._private.emitter},on:function(E,S){return this.emitter().on(E,S),this},one:function(E,S){return this.emitter().one(E,S),this},once:function(E,S){return this.emitter().one(E,S),this},removeListener:function(E,S){return this.emitter().removeListener(E,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(E,S){return this.emitter().emit(E,S),this}}),dt.eventAliasesOn(s),r=i}else if(e==="renderer"&&t!=="null"&&t!=="base"){var m=A4("renderer","base"),p=m.prototype,g=n,v=n.prototype,y=function(){m.apply(this,arguments),g.apply(this,arguments)},b=y.prototype;for(var x in p){var w=p[x],C=v[x]!=null;if(C)return a(x);b[x]=w}for(var k in v)b[k]=v[k];p.clientFunctions.forEach(function(E){b[E]=b[E]||function(){It("Renderer does not implement `renderer."+E+"()` on its prototype")}}),r=y}else if(e==="__proto__"||e==="constructor"||e==="prototype")return It(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return XS({map:$4,keys:[e,t],value:r})}function A4(e,t){return YS({map:$4,keys:[e,t]})}function ace(e,t,n,r,a){return XS({map:F4,keys:[e,t,n,r],value:a})}function ice(e,t,n,r){return YS({map:F4,keys:[e,t,n,r]})}var my=function(){if(arguments.length===2)return A4.apply(null,arguments);if(arguments.length===3)return P4.apply(null,arguments);if(arguments.length===4)return ice.apply(null,arguments);if(arguments.length===5)return ace.apply(null,arguments);It("Invalid extension access syntax")};ou.prototype.extension=my,oce.forEach(function(e){e.extensions.forEach(function(t){P4(e.type,t.name,t.impl)})});var I4=function e(){if(!(this instanceof e))return new e;this.length=0},Mi=I4.prototype;Mi.instanceString=function(){return"stylesheet"},Mi.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},Mi.css=function(e,t){var n=this.length-1;if(Ve(e))this[n].properties.push({name:e,value:t});else if(ot(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var s=a[i],l=r[s];if(l!=null){var u=Tn.properties[s]||Tn.properties[Tf(s)];if(u!=null){var c=u.name,d=l;this[n].properties.push({name:c,value:d})}}}return this},Mi.style=Mi.css,Mi.generateStyle=function(e){var t=new Tn(e);return this.appendToStyle(t)},Mi.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var s=a[i];e.css(s.name,s.value)}}return e};var sce="3.30.2",Vi=function(e){if(e===void 0&&(e={}),ot(e))return new ou(e);if(Ve(e))return my.apply(my,arguments)};Vi.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(Vi),e.apply(null,t),this},Vi.warnings=function(e){return c5(e)},Vi.version=sce,Vi.stylesheet=Vi.Stylesheet=I4;let lce=class extends EventTarget{constructor(e,t){super(),Do(this,"cyg",null),Do(this,"nodes",[]),Do(this,"edges",[]),Do(this,"axons",[]),Do(this,"dendrites",[]),Do(this,"labelCache",new Map),Do(this,"graphCanvas",null),this.labelCache=e,this.graphCanvas=t}async addConnectivity(e){if(this.axons=e.axons.map(t=>JSON.stringify(t)),this.dendrites=e.dendrites.map(t=>JSON.stringify(t)),e.connectivity.length)for(const t of e.connectivity){const n=await this.graphNode(t[0]),r=await this.graphNode(t[1]);this.nodes.push(n),this.nodes.push(r),this.edges.push({id:`${n.id}_${r.id}`,source:n.id,target:r.id})}else this.nodes.push({id:"MISSING",label:"NO PATHS"})}showConnectivity(e){this.cyg=new uce(this,e),this.cyg.on("tap-node",t=>{const n=new CustomEvent("tap-node",{detail:t.detail});this.dispatchEvent(n)})}clearConnectivity(){var e;(e=this.cyg)!=null&&e.cy&&(this.cyg.cy.remove(),this.cyg.cy=null)}reset(){var e;(e=this.cyg)!=null&&e.cy&&this.cyg.cy.reset()}enableZoom(e){var t;(t=this.cyg)!=null&&t.cy&&this.cyg.cy.userZoomingEnabled(e)}get elements(){return[...this.nodes.map(e=>({data:e})),...this.edges.map(e=>({data:e}))]}get roots(){return this.dendrites}async graphNode(e){const t=JSON.stringify(e),n=[e[0],...e[1]],r=[];for(const i of n){const s=this.labelCache.has(i)?this.labelCache.get(i):"";r.push(s)}n.push(...r);const a={id:t,label:n.join(`
494
+ `)};return this.axons.includes(t)?this.dendrites.includes(t)?a["both-a-d"]=!0:a.axon=!0:this.dendrites.includes(t)&&(a.dendrite=!0),a}on(e,t){this.addEventListener(e,t)}};const cce=[{selector:"node",style:{label:"data(label)","background-color":"#80F0F0","text-valign":"center","text-wrap":"wrap","text-max-width":"80px","font-size":"6px"}},{selector:"node[axon]",style:{"background-color":"green"}},{selector:"node[dendrite]",style:{"background-color":"red"}},{selector:"node[both-a-d]",style:{"background-color":"gray"}},{selector:"edge",style:{width:2,"line-color":"#9dbaea","target-arrow-color":"#9dbaea","target-arrow-shape":"triangle","curve-style":"bezier"}}];class uce extends EventTarget{constructor(t,n){var r;super(),Do(this,"cy"),Do(this,"tooltip"),this.cy=Vi({container:n,elements:t.elements,layout:{name:"breadthfirst",circle:!1,roots:t.roots},directed:!0,style:cce,minZoom:.5,maxZoom:10,wheelSensitivity:.4}).on("mouseover","node",this.overNode.bind(this)).on("mouseout","node",this.exitNode.bind(this)).on("position","node",this.moveNode.bind(this)).on("tap","node",this.tapNode.bind(this)),this.tooltip=document.createElement("div"),this.tooltip.className="cy-graph-tooltip",this.tooltip.hidden=!0,(r=n==null?void 0:n.lastChild)==null||r.appendChild(this.tooltip)}remove(){this.cy&&this.cy.destroy()}checkRightBoundary(t){var n;t+this.tooltip.offsetWidth>=((n=this.tooltip.parentElement)==null?void 0:n.offsetWidth)&&(this.tooltip.style.left=`${t-this.tooltip.offsetWidth}px`)}overNode(t){const n=t.target;this.tooltip.innerText=n.data().label,this.tooltip.style.left=`${t.renderedPosition.x}px`,this.tooltip.style.top=`${t.renderedPosition.y}px`,this.tooltip.hidden=!1,this.checkRightBoundary(t.renderedPosition.x)}moveNode(t){const n=t.target;this.tooltip.style.left=`${n.renderedPosition().x}px`,this.tooltip.style.top=`${n.renderedPosition().y}px`,this.checkRightBoundary(n.renderedPosition().x)}exitNode(t){this.tooltip.hidden=!0}tapNode(t){const n=t.target.data(),r=new CustomEvent("tap-node",{detail:n});this.dispatchEvent(r)}on(t,n){this.addEventListener(t,n)}}const dce=1.3,fce=24*60*60*1e3,pce="Reset position",D4="Lock zoom (to scroll)",hce="Unlock zoom",mce="#8300bf",gce={name:"ConnectivityGraph",props:{entry:{type:String,default:""},mapServer:{type:String,default:""}},data:function(){return{loading:!0,connectivityGraph:null,selectedSource:"",pathList:[],schemaVersion:"",knowledgeByPath:new Map,labelledTerms:new Set,labelCache:new Map,resetLabel:pce,zoomLockLabel:D4,iconColor:mce,zoomEnabled:!1}},mounted(){this.refreshCache(),this.loadCacheData(),this.run().then(e=>{this.showGraph(this.entry)})},methods:{loadCacheData:function(){const e=sessionStorage.getItem("connectivity-graph-source"),t=sessionStorage.getItem("connectivity-graph-labels"),n=sessionStorage.getItem("connectivity-graph-pathlist"),r=sessionStorage.getItem("connectivity-graph-schema-version");if(e&&(this.selectedSource=e),n&&(this.pathList=JSON.parse(n)),t){const a=JSON.parse(t);this.labelCache=new Map(Object.entries(a))}r&&(this.schemaVersion=r)},removeAllCacheData:function(){["connectivity-graph-expiry","connectivity-graph-source","connectivity-graph-labels","connectivity-graph-pathlist","connectivity-graph-schema-version"].forEach(e=>{sessionStorage.removeItem(e)})},refreshCache:function(){const e=sessionStorage.getItem("connectivity-graph-expiry");new Date().getTime()>e&&this.removeAllCacheData()},updateCacheExpiry:function(){const e=new Date().getTime()+fce;sessionStorage.setItem("connectivity-graph-expiry",e)},run:async function(){if(this.schemaVersion||(this.schemaVersion=await this.getSchemaVersion(),sessionStorage.setItem("connectivity-graph-schema-version",this.schemaVersion),this.updateCacheExpiry()),this.schemaVersion<dce){console.warn("No Server!");return}this.showSpinner(),this.selectedSource||(this.selectedSource=await this.setSourceList(),sessionStorage.setItem("connectivity-graph-source",this.selectedSource),this.updateCacheExpiry()),await this.setPathList(this.selectedSource),this.hideSpinner()},showGraph:async function(e){const t=this.$refs.graphCanvas;this.showSpinner(),this.connectivityGraph=new lce(this.labelCache,t),await this.connectivityGraph.addConnectivity(this.knowledgeByPath.get(e)),this.hideSpinner(),this.connectivityGraph.showConnectivity(t),this.connectivityGraph.on("tap-node",n=>{const{label:r}=n.detail,a=r.split(`
495
+ `);this.$emit("tap-node",a)})},query:async function(e,t){const n=`${this.mapServer}knowledge/query/`,r={sql:e,params:t};try{const a=await fetch(n,{method:"POST",headers:{Accept:"application/json; charset=utf-8","Cache-Control":"no-store","Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw new Error(`Cannot access ${n}`);return await a.json()}catch{return{values:[]}}},setSourceList:async function(){const e=await this.getJsonData(`${this.mapServer}knowledge/sources`),t=e?e.sources||[]:[];let n="";for(const r of t)r&&n===""&&(n=r);return n},loadPathData:async function(e){const t=await this.query(`select entity, knowledge from knowledge
495
496
  where entity like 'ilxtr:%' and source=?
496
497
  order by entity`,[e]);return t?t.values:[]},setPathList:async function(e){this.pathList.length||(this.pathList=await this.loadPathData(e),sessionStorage.setItem("connectivity-graph-pathlist",JSON.stringify(this.pathList)),this.updateCacheExpiry()),this.knowledgeByPath.clear(),this.labelledTerms=new Set;for(const[t,n]of this.pathList){const r=JSON.parse(n);"connectivity"in r&&(this.knowledgeByPath.set(t,r),this.cacheLabels(r))}return this.labelCache.size||await this.getCachedTermLabels(),""},getSchemaVersion:async function(){const e=await this.getJsonData(`${this.mapServer}knowledge/schema-version`);return e&&+e.version||0},getJsonData:async function(e){try{const t=await fetch(e,{method:"GET",headers:{Accept:"application/json; charset=utf-8","Cache-Control":"no-store","Content-Type":"application/json"}});return t.ok||console.error(`Cannot access ${e}`),await t.json()}catch{return null}},getCachedTermLabels:async function(){if(this.labelledTerms.size){const e=await this.query(`
497
498
  select entity, label from labels
498
- where entity in (?${", ?".repeat(this.labelledTerms.size-1)})`,[...this.labelledTerms.values()]);for(const n of e.values)this.labelCache.set(n[0],n[1]);const t=Object.fromEntries(this.labelCache);sessionStorage.setItem("connectivity-graph-labels",JSON.stringify(t)),this.updateCacheExpiry()}},cacheNodeLabels:function(e){for(const t of[e[0],...e[1]])this.labelledTerms.add(t)},cacheLabels:async function(e){for(const t of e.connectivity)this.cacheNodeLabels(t[0]),this.cacheNodeLabels(t[1])},showSpinner:function(){this.loading=!0},hideSpinner:function(){this.loading=!1},reset:function(){this.connectivityGraph.reset()},toggleZoom:function(){this.zoomEnabled=!this.zoomEnabled,this.zoomLockLabel=this.zoomEnabled?hce:D4,this.connectivityGraph.enableZoom(!this.zoomEnabled)}}},yce={class:"connectivity-graph"},vce={ref:"graphCanvas",class:"graph-canvas"},bce={class:"control-panel"},wce=o.createStaticVNode('<div class="node-key" data-v-ec98b14b><div class="key-head" data-v-ec98b14b>Node type:</div><div data-v-ec98b14b><div data-v-ec98b14b><span data-v-ec98b14b>Node:</span><span class="key-box" style="background:#80F0F0;" data-v-ec98b14b></span></div><div data-v-ec98b14b><span data-v-ec98b14b>Axon:</span><span class="key-box" style="background:green;" data-v-ec98b14b></span></div><div data-v-ec98b14b><span data-v-ec98b14b>Dendrite:</span><span class="key-box" style="background:red;" data-v-ec98b14b></span></div><div data-v-ec98b14b><span data-v-ec98b14b>Both:</span><span class="key-box" style="background:gray;" data-v-ec98b14b></span></div></div></div>',1),xce={class:"tools"},kce={class:"visually-hidden"},Cce={class:"visually-hidden"};function Ece(e,t,n,r,a,i){const s=sX,l=Rn,u=kf,c=_c,d=xX,f=CX,h=wte;return o.withDirectives((o.openBlock(),o.createElementBlock("div",yce,[o.createElementVNode("div",vce,null,512),o.createElementVNode("div",bce,[wce,o.createElementVNode("div",xce,[o.createVNode(c,{content:e.resetLabel,placement:"bottom",effect:"control-tooltip"},{default:o.withCtx(()=>[o.createVNode(u,{class:o.normalizeClass(["control-button",e.theme]),size:"small",onClick:i.reset},{default:o.withCtx(()=>[o.createVNode(l,{color:"white"},{default:o.withCtx(()=>[o.createVNode(s)]),_:1}),o.createElementVNode("span",kce,o.toDisplayString(e.resetLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"]),o.createVNode(c,{content:e.zoomLockLabel,placement:"bottom",effect:"control-tooltip"},{default:o.withCtx(()=>[o.createVNode(u,{class:o.normalizeClass(["control-button",e.theme]),size:"small",onClick:i.toggleZoom},{default:o.withCtx(()=>[o.createVNode(l,{color:"white"},{default:o.withCtx(()=>[e.zoomEnabled?(o.openBlock(),o.createBlock(d,{key:0})):(o.openBlock(),o.createBlock(f,{key:1}))]),_:1}),o.createElementVNode("span",Cce,o.toDisplayString(e.zoomLockLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"])])])])),[[h,e.loading]])}const Sce=QE(gce,[["render",Ece],["__scopeId","data-v-ec98b14b"]]),_ce={data(){return{ElIconView:ev}},name:"DatasetCard",components:{BadgesGroup:Yb,ImageGallery:lk,Button:Vr,Icon:Bt,CopyToClipboard:LS},props:{entry:{type:Object,default:()=>{}},envVars:{type:Object,default:()=>{}}},data:function(){return{thumbnail:ck,dataLocation:this.entry.doi,discoverId:void 0,loading:!0,version:1,lastDoi:void 0,biolucidaData:void 0,currentCategory:"All",copyContent:""}},computed:{contributors:function(){let e="";return this.entry.contributors&&(this.entry.contributors.length===1?e=this.lastName(this.entry.contributors[0].name):this.entry.contributors.length===2?e=this.lastName(this.entry.contributors[0].name)+" & "+this.lastName(this.entry.contributors[1].name):this.entry.contributors.length>2&&(e=this.lastName(this.entry.contributors[0].name)+" et al.")),e},samples:function(){let e="";return this.entry.species&&(qd[this.entry.species[0].toLowerCase()]?e=`${qd[this.entry.species[0].toLowerCase()]}`:e=`${this.entry.species}`),this.entry.numberSamples>0&&(e+=" (",this.entry.numberSamples===1?e+=`${this.entry.numberSamples} sample`:this.entry.numberSamples>1&&(e+=`${this.entry.numberSamples} samples`),this.entry.numberSubjects===1?e+=` from ${this.entry.numberSubjects} subject`:this.entry.numberSamples>1&&(e+=` from ${this.entry.numberSubjects} subjects`),e+=")"),e},label:function(){return this.entry.organs?this.entry.organs[0]:this.entry.name},publishYear:function(){return this.entry.publishDate.split("-")[0]}},mounted:function(){this.updateCopyContent()},methods:{cardClicked:function(){this.openDataset()},categoryChanged:function(e){this.currentCategory=e},galleryClicked:function(e){this.propogateCardAction(e)},galleryDatalinkClicked:function(e){an.emit("datalink-clicked",e)},openDataset:function(){window.open(this.dataLocation,"_blank")},openRepository:function(){let e=this.envVars.API_LOCATION;this.entry.additionalLinks.forEach(function(t){if(t.description=="Repository"){let n=new XMLHttpRequest;n.open("POST",e+"/pmr_latest_exposure",!0),n.setRequestHeader("Content-type","application/json"),n.onreadystatechange=()=>{if(n.readyState===4){let r="";n.status===200&&(r=JSON.parse(n.responseText).url),r===""&&(r=t.uri),window.open(r,"_blank")}},n.send(JSON.stringify({workspace_url:t.uri}))}})},propogateCardAction:function(e){an.emit("PopoverActionClick",e),an.emit("contextUpdate",e)},splitDOI:function(e){return[e.split("/")[e.split("/").length-2],e.split("/")[e.split("/").length-1]]},getBanner:function(){if(this.lastDoi!==this.entry.doi){this.lastDoi=this.entry.doi,this.loading=!0;let e=this.splitDOI(this.entry.doi);fetch(`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${e[0]}/${e[1]}`).then(t=>{if(t.ok)return t.json();throw Error(t.statusText)}).then(t=>{this.thumbnail=t.banner,this.discoverId=t.id,this.version=t.version,this.dataLocation=`https://sparc.science/datasets/${t.id}?type=dataset`,this.getBiolucidaInfo(this.discoverId),this.loading=!1,this.updateCopyContent()}).catch(()=>{this.thumbnail=ck,this.discoverId=Number(this.entry.datasetId),this.loading=!1})}},lastName:function(e){return e.split(",")[0]},getBiolucidaInfo:function(e){let n=this.envVars.API_LOCATION+"image_search/"+e;fetch(n).then(r=>r.json()).then(r=>{r.status=="success"&&(this.biolucidaData=r)})},updateCopyContent:function(){const e=[];if(this.entry.name&&e.push(`<div><strong>${this.entry.name}</strong></div>`),this.contributors){let t=this.contributors;this.entry.publishDate&&(t+=` (${this.publishYear})`),e.push(`<div>${t}</div>`)}if(this.samples&&e.push(`<div>${this.samples}</div>`),this.entry.doi){let t="<div><strong>DOI:</strong></div>";t+=`
499
+ where entity in (?${", ?".repeat(this.labelledTerms.size-1)})`,[...this.labelledTerms.values()]);for(const n of e.values)this.labelCache.set(n[0],n[1]);const t=Object.fromEntries(this.labelCache);sessionStorage.setItem("connectivity-graph-labels",JSON.stringify(t)),this.updateCacheExpiry()}},cacheNodeLabels:function(e){for(const t of[e[0],...e[1]])this.labelledTerms.add(t)},cacheLabels:async function(e){for(const t of e.connectivity)this.cacheNodeLabels(t[0]),this.cacheNodeLabels(t[1])},showSpinner:function(){this.loading=!0},hideSpinner:function(){this.loading=!1},reset:function(){this.connectivityGraph.reset()},toggleZoom:function(){this.zoomEnabled=!this.zoomEnabled,this.zoomLockLabel=this.zoomEnabled?hce:D4,this.connectivityGraph.enableZoom(!this.zoomEnabled)}}},yce={class:"connectivity-graph"},vce={ref:"graphCanvas",class:"graph-canvas"},bce={class:"control-panel"},wce=o.createStaticVNode('<div class="node-key" data-v-d620c023><div class="key-head" data-v-d620c023>Node type:</div><div data-v-d620c023><div data-v-d620c023><span data-v-d620c023>Node:</span><span class="key-box" style="background:#80F0F0;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Axon:</span><span class="key-box" style="background:green;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Dendrite:</span><span class="key-box" style="background:red;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Both:</span><span class="key-box" style="background:gray;" data-v-d620c023></span></div></div></div>',1),xce={class:"tools"},kce={class:"visually-hidden"},Cce={class:"visually-hidden"};function Ece(e,t,n,r,a,i){const s=sX,l=Rn,u=kf,c=_c,d=xX,f=CX,h=wte;return o.withDirectives((o.openBlock(),o.createElementBlock("div",yce,[o.createElementVNode("div",vce,null,512),o.createElementVNode("div",bce,[wce,o.createElementVNode("div",xce,[o.createVNode(c,{content:e.resetLabel,placement:"bottom",effect:"control-tooltip"},{default:o.withCtx(()=>[o.createVNode(u,{class:o.normalizeClass(["control-button",e.theme]),size:"small",onClick:i.reset},{default:o.withCtx(()=>[o.createVNode(l,{color:"white"},{default:o.withCtx(()=>[o.createVNode(s)]),_:1}),o.createElementVNode("span",kce,o.toDisplayString(e.resetLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"]),o.createVNode(c,{content:e.zoomLockLabel,placement:"bottom",effect:"control-tooltip"},{default:o.withCtx(()=>[o.createVNode(u,{class:o.normalizeClass(["control-button",e.theme]),size:"small",onClick:i.toggleZoom},{default:o.withCtx(()=>[o.createVNode(l,{color:"white"},{default:o.withCtx(()=>[e.zoomEnabled?(o.openBlock(),o.createBlock(d,{key:0})):(o.openBlock(),o.createBlock(f,{key:1}))]),_:1}),o.createElementVNode("span",Cce,o.toDisplayString(e.zoomLockLabel),1)]),_:1},8,["class","onClick"])]),_:1},8,["content"])])])])),[[h,e.loading]])}const Sce=QE(gce,[["render",Ece],["__scopeId","data-v-d620c023"]]),_ce={data(){return{ElIconView:ev}},name:"DatasetCard",components:{BadgesGroup:Yb,ImageGallery:lk,Button:Vr,Icon:Bt,CopyToClipboard:LS},props:{entry:{type:Object,default:()=>{}},envVars:{type:Object,default:()=>{}}},data:function(){return{thumbnail:ck,dataLocation:this.entry.doi,discoverId:void 0,loading:!0,version:1,lastDoi:void 0,biolucidaData:void 0,currentCategory:"All",copyContent:""}},computed:{contributors:function(){let e="";return this.entry.contributors&&(this.entry.contributors.length===1?e=this.lastName(this.entry.contributors[0].name):this.entry.contributors.length===2?e=this.lastName(this.entry.contributors[0].name)+" & "+this.lastName(this.entry.contributors[1].name):this.entry.contributors.length>2&&(e=this.lastName(this.entry.contributors[0].name)+" et al.")),e},samples:function(){let e="";return this.entry.species&&(qd[this.entry.species[0].toLowerCase()]?e=`${qd[this.entry.species[0].toLowerCase()]}`:e=`${this.entry.species}`),this.entry.numberSamples>0&&(e+=" (",this.entry.numberSamples===1?e+=`${this.entry.numberSamples} sample`:this.entry.numberSamples>1&&(e+=`${this.entry.numberSamples} samples`),this.entry.numberSubjects===1?e+=` from ${this.entry.numberSubjects} subject`:this.entry.numberSamples>1&&(e+=` from ${this.entry.numberSubjects} subjects`),e+=")"),e},label:function(){return this.entry.organs?this.entry.organs[0]:this.entry.name},publishYear:function(){return this.entry.publishDate.split("-")[0]}},mounted:function(){this.updateCopyContent()},methods:{cardClicked:function(){this.openDataset()},categoryChanged:function(e){this.currentCategory=e},galleryClicked:function(e){this.propogateCardAction(e)},galleryDatalinkClicked:function(e){an.emit("datalink-clicked",e)},openDataset:function(){window.open(this.dataLocation,"_blank")},openRepository:function(){let e=this.envVars.API_LOCATION;this.entry.additionalLinks.forEach(function(t){if(t.description=="Repository"){let n=new XMLHttpRequest;n.open("POST",e+"/pmr_latest_exposure",!0),n.setRequestHeader("Content-type","application/json"),n.onreadystatechange=()=>{if(n.readyState===4){let r="";n.status===200&&(r=JSON.parse(n.responseText).url),r===""&&(r=t.uri),window.open(r,"_blank")}},n.send(JSON.stringify({workspace_url:t.uri}))}})},propogateCardAction:function(e){an.emit("PopoverActionClick",e),an.emit("contextUpdate",e)},splitDOI:function(e){return[e.split("/")[e.split("/").length-2],e.split("/")[e.split("/").length-1]]},getBanner:function(){if(this.lastDoi!==this.entry.doi){this.lastDoi=this.entry.doi,this.loading=!0;let e=this.splitDOI(this.entry.doi);fetch(`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${e[0]}/${e[1]}`).then(t=>{if(t.ok)return t.json();throw Error(t.statusText)}).then(t=>{this.thumbnail=t.banner,this.discoverId=t.id,this.version=t.version,this.dataLocation=`https://sparc.science/datasets/${t.id}?type=dataset`,this.getBiolucidaInfo(this.discoverId),this.loading=!1,this.updateCopyContent()}).catch(()=>{this.thumbnail=ck,this.discoverId=Number(this.entry.datasetId),this.loading=!1})}},lastName:function(e){return e.split(",")[0]},getBiolucidaInfo:function(e){let n=this.envVars.API_LOCATION+"image_search/"+e;fetch(n).then(r=>r.json()).then(r=>{r.status=="success"&&(this.biolucidaData=r)})},updateCopyContent:function(){const e=[];if(this.entry.name&&e.push(`<div><strong>${this.entry.name}</strong></div>`),this.contributors){let t=this.contributors;this.entry.publishDate&&(t+=` (${this.publishYear})`),e.push(`<div>${t}</div>`)}if(this.samples&&e.push(`<div>${this.samples}</div>`),this.entry.doi){let t="<div><strong>DOI:</strong></div>";t+=`
499
500
  `,t+=`<a href="${this.entry.doi}">${this.entry.doi}</a>`,e.push(`<div>${t}</div>`)}if(this.entry.datasetId){let t="<div><strong>Dataset ID:</strong></div>";t+=`
500
501
  `,t+=`${this.entry.datasetId}`,e.push(`<div>${t}</div>`)}if(this.dataLocation){let t="<div><strong>Dataset URL:</strong></div>";t+=`
501
502
  `,t+=`<a href="${this.dataLocation}">${this.dataLocation}</a>`,e.push(`<div>${t}</div>`)}if(this.version){let t="<div><strong>Dataset version:</strong></div>";t+=`