@qaecy/cue-ui 0.0.59 → 0.0.61
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.
- package/1359.js +1 -1
- package/1520.js +1 -1
- package/1837.js +1 -1
- package/1842.js +1 -0
- package/2317.js +1 -1
- package/2538.js +1 -0
- package/2713.js +7 -0
- package/2775.js +1 -1
- package/2839.js +1 -1
- package/3036.js +1 -1
- package/3202.js +1 -1
- package/3418.js +1 -1
- package/3523.js +1 -1
- package/3577.js +1 -1
- package/3614.js +1 -1
- package/3654.js +1 -0
- package/3656.js +1 -0
- package/366.js +1 -0
- package/4098.js +1 -1
- package/426.js +1 -0
- package/468.js +1 -0
- package/4791.js +1 -1
- package/5649.js +1 -1
- package/5872.js +1 -1
- package/6233.js +1 -1
- package/6419.js +1 -1
- package/6947.js +1 -1
- package/7019.js +1 -0
- package/7193.js +1 -0
- package/7719.js +1 -1
- package/7727.js +1 -1
- package/8725.js +1 -0
- package/9396.js +1 -1
- package/992.js +1 -1
- package/index.js +1 -1
- package/main.js +1 -1
- package/package.json +1 -1
- package/1701.js +0 -1
- package/2283.js +0 -1
- package/2530.js +0 -1
- package/329.js +0 -1
- package/3842.js +0 -1
- package/3869.js +0 -1
- package/4311.js +0 -1
- package/7154.js +0 -1
- package/7284.js +0 -1
- package/7313.js +0 -1
- package/928.js +0 -1
package/7019.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[7019],{6034(Qe,Me,Y){"use strict";Y.d(Me,{y:()=>q});var Z=Y(7705),M=Y(7598),w=Y(9769),T=Y(5187),N=Y(2271),y=Y(5547);const E=["*"];let m=(()=>{class k{style=(0,Z.hFB)("");gap=(0,Z.hFB)("m");columns=(0,Z.hFB)(1);getStyles=(0,N.EW)(()=>`\n grid-template-columns: repeat(${this.columns()}, minmax(0, 1fr));\n gap: var(--cue-grid-gap-${this.gap()});\n ${this.style()}\n `);static \u0275fac=function(Ee){return new(Ee||k)};static \u0275cmp=y.VBU({type:k,selectors:[["cue-grid"]],hostVars:2,hostBindings:function(Ee,ae){2&Ee&&y.Aen(ae.getStyles())},inputs:{style:[1,"style"],gap:[1,"gap"],columns:[1,"columns"]},ngContentSelectors:E,decls:1,vars:0,template:function(Ee,ae){1&Ee&&(y.NAR(),y.SdG(0))},styles:["[_nghost-%COMP%]{display:grid}"]})}return k})();var L=Y(2245),D=Y(5381),P=Y(29);const G=["*"];function _(k,ne){if(1&k&&(y.j41(0,"cue-typography",2),y.EFF(1),y.k0s()),2&k){const W=y.XpG();y.R7$(),y.SpI(" ",W.label()," ")}}let q=(()=>{class k{label=(0,Z.hFB)("");variant=(0,Z.hFB)("default");shadow=(0,Z.hFB)(!1);padded=(0,Z.hFB)(!0);showCloseBtn=(0,Z.hFB)(!0);position=(0,Z.hFB)("top-left");clickedClose=(0,Z.CGW)();margin=(0,Z.hFB)("0.5rem");close(W){W.stopPropagation(),W.stopImmediatePropagation(),this.clickedClose.emit()}static \u0275fac=function(Ee){return new(Ee||k)};static \u0275cmp=y.VBU({type:k,selectors:[["cue-draggable-card"]],inputs:{label:[1,"label"],variant:[1,"variant"],shadow:[1,"shadow"],padded:[1,"padded"],showCloseBtn:[1,"showCloseBtn"],position:[1,"position"],margin:[1,"margin"]},outputs:{clickedClose:"clickedClose"},ngContentSelectors:G,decls:8,vars:14,consts:[["cdkDrag","",1,"panel",3,"variant","shadow","padded"],["justify","end"],["size","l"],[2,"width","100%"],["name","close",2,"cursor","pointer",3,"click"]],template:function(Ee,ae){1&Ee&&(y.NAR(),y.j41(0,"cue-card",0)(1,"cue-typography")(2,"cue-grid")(3,"cue-flexcontainer",1),y.nVh(4,_,2,1,"cue-typography",2),y.nrm(5,"span",3),y.j41(6,"cue-svg-icon",4),y.bIt("click",function(S){return ae.close(S)}),y.k0s()(),y.SdG(7),y.k0s()()()),2&Ee&&(y.xc7("top","top-left"===ae.position()||"top-right"===ae.position()?ae.margin():"null")("bottom","bottom-left"===ae.position()||"bottom-right"===ae.position()?ae.margin():"null")("left","top-left"===ae.position()||"bottom-left"===ae.position()?ae.margin():"null")("right","top-right"===ae.position()||"bottom-right"===ae.position()?ae.margin():"null"),y.Y8G("variant",ae.variant())("shadow",ae.shadow())("padded",ae.padded()),y.R7$(3),y.xc7("padding",ae.padded()?"0":"10px"),y.R7$(),y.vxM(ae.label()&&"undefined"!==ae.label()?4:-1))},dependencies:[w.MD,T.Card,m,L.Typography,D.FlexContainer,P.A,M.T1],styles:[".panel[_ngcontent-%COMP%]{position:absolute;width:fit-content;z-index:100}"]})}return k})()},9134(Qe,Me,Y){"use strict";Y.d(Me,{v:()=>N});var Z=Y(7705),M=Y(6034),w=Y(7517),T=Y(5547);let N=(()=>{class y{title=(0,Z.hFB)("Legend");layers=(0,Z.hFB)([]);position=(0,Z.hFB)("top-left");close=(0,Z.CGW)();visibilityChange=(0,Z.CGW)();layerChange=(0,Z.CGW)();visibilityAll=(0,Z.CGW)();static \u0275fac=function(L){return new(L||y)};static \u0275cmp=T.VBU({type:y,selectors:[["cue-color-legend-panel"]],inputs:{title:[1,"title"],layers:[1,"layers"],position:[1,"position"]},outputs:{close:"close",visibilityChange:"visibilityChange",layerChange:"layerChange",visibilityAll:"visibilityAll"},decls:3,vars:4,consts:[[3,"clickedClose","label","padded","position"],[1,"content"],[3,"visibilityAll","layerChange","visibilityChange","layers"]],template:function(L,D){1&L&&(T.j41(0,"cue-draggable-card",0),T.bIt("clickedClose",function(){return D.close.emit()}),T.j41(1,"div",1)(2,"cue-layer-legend",2),T.bIt("visibilityAll",function(G){return D.visibilityAll.emit(G)})("layerChange",function(G){return D.layerChange.emit(G)})("visibilityChange",function(G){return D.visibilityChange.emit(G)}),T.k0s()()()),2&L&&(T.Y8G("label",D.title())("padded",!1)("position",D.position()),T.R7$(2),T.Y8G("layers",D.layers()))},dependencies:[M.y,w.P],styles:[".content[_ngcontent-%COMP%]{padding-left:10px;padding-right:10px;margin-bottom:30px;font-size:.8em;max-height:200px;max-width:180px;overflow:auto}"]})}return y})()},4523(Qe,Me,Y){"use strict";Y.d(Me,{t:()=>rb});var Z=Y(467),M=Y(7705),w=Y(5802),T=Y(2271);class N{hideClassAssignmentTriples=!0;hideDatatypePropertyTriples=!0;collapseIntoClassificationLabels=[];preferredLabelLanguage="en";showClassLabelOnInstance=!0;edgeWidths={};nodeSizes={}}var E=Y(2130),m=Y(8402);class L{_doc;_omitClassAssignments;_omitDatatypeProperties;_preferredLabelLanguage;_collapseIntoClassificationLabels;_edgeWidths;_nodeSizes;_context;_nodes=[];_edges=[];_seenNodes=[];_resourceLabels={};_resourceAltLabels={};_resolvedCollapsePredicates=new Set;_knownPrefixes={schema:"http://schema.org/"};constructor(e,t=!0,n=!0,a="en",i=[],s={},o={}){this._doc=e,this._omitClassAssignments=t,this._omitDatatypeProperties=n,this._preferredLabelLanguage=a,this._collapseIntoClassificationLabels=i,this._edgeWidths=s,this._nodeSizes=o}get elementData(){return{nodes:this._nodes,edges:this._edges}}init(){var e=this;return(0,Z.A)(function*(){return"http://schema.org/"==e._doc["@context"]&&(e._doc["@context"]="https://schema.org/"),e._context={...e._doc["@context"],...e._knownPrefixes},e._nodes=[],e._edges=[],e._seenNodes=[],e._resourceLabels={},e._resourceAltLabels={},e._resolvedCollapsePredicates=new Set(e._collapseIntoClassificationLabels.map(n=>e._expandIRI(n))),(yield(0,E.toRDF)(e._doc)).forEach(n=>e._processQuad(n)),e._nodes=e._appendNames(e._nodes),e._edges=e._appendNames(e._edges),{nodes:e._nodes,edges:e._edges}})()}append(e){var t=this;return(0,Z.A)(function*(){return(yield(0,E.toRDF)(e)).forEach(a=>t._processQuad(a)),t._nodes=t._appendNames(t._nodes),t._edges=t._appendNames(t._edges),{nodes:t._nodes,edges:t._edges}})()}_processQuad(e){const t=e.subject.value;let n=e.predicate.value,a=e.object.value;if("http://www.w3.org/2004/02/skos/core#prefLabel"===n||"http://www.w3.org/2000/01/rdf-schema#label"===n||"http://schema.org/name"===n)return void(Object.keys(this._resourceLabels).includes(t)?this._resourceLabels[t].push(e.object):this._resourceLabels[t]=[e.object]);if("http://www.w3.org/2004/02/skos/core#altLabel"===n)return void(Object.keys(this._resourceAltLabels).includes(t)?this._resourceAltLabels[t].push(e.object):this._resourceAltLabels[t]=[e.object]);if(this._appendNamedNode(t),this._resolvedCollapsePredicates.has(n)){const s=this._nodes.find(o=>o.data.id===t);return void(void 0!==s&&(void 0===s.data.boxLabels&&(s.data.boxLabels=[]),s.data.boxLabels.push(this._appendPrefix(a))))}if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===n&&(n="a",this._seenNodes.includes(t))){const s=this._nodes.find(o=>o.data.id===t);void 0!==s&&(void 0===s.data.boxLabels&&(s.data.boxLabels=[]),s.data.boxLabels.push(this._appendPrefix(a)))}const i=e.object.termType;if("Literal"===i){if(a=this._appendLiteralNode(a),this._seenNodes.includes(t)){const s=this._nodes.find(o=>o.data.id===t);if(void 0!==s){void 0===s.data.properties&&(s.data.properties={});const o=this._getIdFromIRI(n);s.data.properties[o]=e.object.value}}}else"BlankNode"===i?this._appendNamedNode(a,"individual"):"NamedNode"===i?this._appendNamedNode(a,"a"===n?"class":"individual"):console.warn("Unknown term type "+i);this._appendEdge(t,n,a,"Literal"===i)}_appendNames(e){return e.map(t=>{const n=t.data.iri,a=(void 0!==t.data.id?this._resourceLabels[t.data.id]:void 0)??(void 0!==n?this._resourceLabels[n]:void 0)??(void 0!==t.data.id?this._resourceAltLabels[t.data.id]:void 0)??(void 0!==n?this._resourceAltLabels[n]:void 0);if(Array.isArray(a))1===a.length?t.data.label=a[0].value:console.log("MORE THAN ONE LABEL NOT YET SUPPORTED");else{if("class"===t.classes){if(null==t.data.iri)return t;t.data.label=this._getIdFromIRI(t.data.iri)}if("edge"===t.classes){if(null==t.data.iri)return t;t.data.label=this._getIdFromIRI(t.data.iri)}}const i=t.data;if(void 0!==i.size){const s=void 0!==i.iri?this._nodeSizes[i.iri]:void 0;void 0!==s?i.size=s:""!=t.data.label&&(i.size=44),Array.isArray(i.boxLabels)&&(i.boxLabels=i.boxLabels.map(o=>{const l=this._expandIRI(o),u=this._resourceLabels[l]??this._resourceAltLabels[l];return Array.isArray(u)&&u.length>0?u[0].value:o}))}return t})}_appendNamedNode(e,t="individual"){if(!this._omitClassAssignments||"class"!==t)if(this._seenNodes.includes(e)){if("class"===t){const n=this._nodes.find(a=>a.data.id===e);null!=n&&(n.classes=t)}}else this._nodes.push({data:{id:e,iri:e,label:"",size:24},classes:t}),this._seenNodes.push(e)}_appendLiteralNode(e){if(this._omitDatatypeProperties)return"";""===e&&(e="-");const t=this._camelize(e);return this._seenNodes.includes(t)||(this._nodes.push({data:{id:t,label:e,size:2*e.length},classes:"literal"}),this._seenNodes.push(t)),t}_appendEdge(e,t,n,a=!1){if(this._omitClassAssignments&&"a"===t||this._omitDatatypeProperties&&a)return;const i=this._edgeWidths[t];this._edges.push({data:{id:(0,m.A)(),source:e,target:n,label:this._appendPrefix(t),iri:t,...void 0!==i?{width:i}:{}},classes:"edge"})}_expandIRI(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;const t=e.indexOf(":");if(t>0){const n=e.substring(0,t),a=e.substring(t+1),i=this._context?.[n];if(i)return i+a}return e}_appendPrefix(e){const t=Object.keys(this._context),n=Object.values(this._context);for(const a in n){const i=n[a];if(e.startsWith(i)){e=e.replace(i,`${t[a]}:`);break}}return e}_camelize(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,function(t,n){return 0===n?t.toLowerCase():t.toUpperCase()}).replace(/\s+/g,"")}_getIdFromIRI(e){return e.includes("#")?e.split("#")[1]:e.split("/").pop()??e}}class D{_doc;_settings;_elementDataHandler;_elementData;constructor(e,t=new N){this._doc=e,this._settings=t,this._elementDataHandler=new L(this._doc,this._settings.hideClassAssignmentTriples,this._settings.hideDatatypePropertyTriples,this._settings.preferredLabelLanguage,this._settings.collapseIntoClassificationLabels,this._settings.edgeWidths,this._settings.nodeSizes)}set settings(e){this._settings=e,this._elementDataHandler=new L(this._doc,this._settings.hideClassAssignmentTriples,this._settings.hideDatatypePropertyTriples,this._settings.preferredLabelLanguage,this._settings.collapseIntoClassificationLabels,this._settings.edgeWidths,this._settings.nodeSizes)}init(){var e=this;return(0,Z.A)(function*(){return e._elementData=yield e._elementDataHandler.init(),e._elementData})()}appendElementData(e){var t=this;return(0,Z.A)(function*(){return t._elementData=yield t._elementDataHandler.append(e),t._elementData})()}compact(){console.log("COMPACT")}expand(){console.log("EXPAND")}}class G{props={display:!0,displayOnlyOnHover:!0};boxLabels={display:!0,displayOnlyOnHover:!1}}function _(r,e,t=new G){function n(){r.nodes().forEach(s=>{const o=s.renderedHeight(),l=document.getElementById(`box-${s.id()}`);if(l){if(t.boxLabels.display){const u=s.data().boxLabels;if(void 0!==u){let c=document.getElementById(`labels-box-${s.id()}`);c?c.style.bottom=o/2-10+"px":(c=document.createElement("div"),c.id=`labels-box-${s.id()}`,c.className="box-label",c.style.bottom=o/2-10+"px",t.boxLabels.displayOnlyOnHover&&(c.style.display="none"),l.appendChild(c),u.forEach((d,f)=>{if(!c)return;const h=document.createElement("div");h.id=`labels-box-${s.id()}-${f}`,h.className="entry",h.innerHTML=d,c.appendChild(h)}))}}if(t.props.display){const u=s.data().properties;if(void 0!==u){let c=document.getElementById(`props-box-${s.id()}`);c?c.style.top=o/2-10+"px":(c=document.createElement("div"),c.id=`props-box-${s.id()}`,c.style.right="0px",c.className="property",c.style.top=o/2-10+"px",t.props.displayOnlyOnHover&&(c.style.display="none"),l.appendChild(c),Object.keys(u).forEach((d,f)=>{if(!c)return;const h=document.createElement("div");h.id=`props-box-${s.id()}-${f}`,h.className="entry",h.innerHTML=`<span class="key">${d}</span><span class="value">${u[d]}</span>`,c.appendChild(h)}))}}}})}!function P(r,e){function t(){r.nodes().forEach(a=>{const i=a.renderedPosition();let s=document.getElementById(`box-${a.id()}`);s||(s=document.createElement("div"),s.id=`box-${a.id()}`,s.style.position="absolute",e.appendChild(s)),s.style.left=`${i.x}px`,s.style.top=`${i.y}px`})}t(),r.on("position","node",t),r.on("pan zoom",t),r.on("remove","node",function n(a){const i=a.target.id(),s=document.getElementById(`box-${i}`);s&&s.remove()}),window.addEventListener("resize",t)}(r,e),n(),r.on("zoom",()=>{n(),function i(){if(!t.boxLabels.display)return;const o=r.zoom()>=.6;r.nodes().forEach(l=>{const u=document.getElementById(`labels-box-${l.id()}`);u&&(t.boxLabels.displayOnlyOnHover||(u.style.display=o?"flex":"none"))})}()}),r.on("mouseover","node",s=>{const o=s.target;if(t.props.displayOnlyOnHover){const l=document.getElementById(`props-box-${o.id()}`);l&&(l.style.display="flex")}if(t.boxLabels.displayOnlyOnHover){const l=document.getElementById(`labels-box-${o.id()}`);l&&(l.style.display="flex")}}),r.on("mouseout","node",s=>{const o=s.target;if(t.props.displayOnlyOnHover){const l=document.getElementById(`props-box-${o.id()}`);l&&(l.style.display="none")}if(t.boxLabels.displayOnlyOnHover){const l=document.getElementById(`labels-box-${o.id()}`);l&&(l.style.display="none")}})}function O(r){return getComputedStyle(document.documentElement).getPropertyValue(r).trim()}const q={get backgroundColor(){return O("--cue-main-background")||"#f5f6f9"},get edgeColor(){return O("--cue-primary")||"#2859e1"},edgeFontSize:"5rem",edgeWidth:"1.5rem",get nodeColor(){return O("--cue-primary")||"#2859e1"},nodeOpacity:"0.9",font:"Poppins",directed:!0,labelSelector:"label",showNodeLabels:!0,showEdgeLabels:!0,get hoverBorderColor(){return O("--cue-primary")||"#2859e1"},get textColor(){return O("--cue-primaryContrast")||"#ffffff"}},k=(r=q)=>{const e=O("--cue-primary")||"#2859e1",t=O("--cue-primaryContrast")||"#ffffff",n=O("--cue-accent")||"#e2f552",a=O("--cue-accentContrast")||"#121c2b",i=O("--cue-neutral")||"#8394b0",s=O("--cue-main-foreground")||"#121c2b",o=r.backgroundColor;return[{selector:"node",style:{label:l=>l.data(r.labelSelector)&&r.showNodeLabels?l.data(r.labelSelector):"",shape:"round-rectangle","text-valign":"bottom","text-margin-y":10,"font-family":r.font,"font-size":"6rem",opacity:r.nodeOpacity,color:s,"text-outline-width":0,"text-outline-color":l=>l.data("color")?l.data("color"):e,"background-color":l=>l.data("color")?l.data("color"):e,width:l=>l.data("size")?l.data("size"):"24",height:l=>l.data("size")?l.data("size"):"24","background-image":l=>l.data("imgPath")?l.data("imgPath"):"none","background-fit":"cover","background-width":"100%","background-height":"100%","background-image-opacity":.2}},{selector:"edge",style:{label:"","font-family":r.font,"font-size":r.edgeFontSize,color:e,"target-arrow-color":e,"curve-style":"bezier","target-arrow-shape":r.directed?"triangle":"none","arrow-scale":.8,"line-color":e,"line-opacity":.5,width:l=>l.data("width")?l.data("width"):r.edgeWidth}},{selector:"edge.edge-hover, edge.neighbor-hover",style:{label:l=>l.data(r.labelSelector)&&r.showEdgeLabels?l.data(r.labelSelector):"","line-opacity":1,width:l=>l.data("width")?l.data("width"):r.edgeWidth,"text-valign":"center","text-rotation":"autorotate","text-background-opacity":1,"text-background-color":o,"text-background-padding":4,"font-size":r.edgeFontSize,"font-weight":"600"}},{selector:".triple",style:{"background-color":o,"border-color":l=>l.data("color")?l.data("color"):e}},{selector:".literal",style:{label:l=>l.data(r.labelSelector)?l.data(r.labelSelector):"","text-valign":"center","font-size":"6rem","border-color":s,"background-color":o,"text-outline-width":0,"border-width":0,"background-opacity":0,color:s}},{selector:".loading",style:{shape:"ellipse","pie-size":"100%","pie-1-background-color":e,"pie-1-background-size":l=>`${l.data("pct")}%`,"pie-2-background-color":n,"pie-2-background-size":l=>100-parseInt(l.data("pct"))+"%",label:l=>void 0!==l.data("pct")&&100!==l.data("pct")?`${parseInt(l.data("pct"))}%`:"","font-size":"5rem","border-width":1,"border-opacity":1,"border-color":t}},{selector:".dropzone",style:{"border-color":e,"border-width":6,"border-opacity":1}},{selector:".collapser",style:{"background-color":i,"text-outline-color":i,"text-outline-width":0,"text-valign":"center",color:t,"border-width":0,"border-opacity":0,opacity:1}},{selector:".collapser-expanded",style:{opacity:.65}},{selector:".class",style:{"background-color":n,"text-outline-color":n,color:a}},{selector:".faded",style:{opacity:.12}},{selector:"node.focused",style:{"outline-color":l=>l.data("color")||e,"outline-width":"2px","outline-offset":"3px","outline-opacity":.5,"outline-style":"solid"}}]};class W{_requestId;_animationRunning=!1;constructor(e,t=!0,n=1e-4,a=.02){this._build(e,t,n,a)}stop(){void 0!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=void 0,this._animationRunning=!1)}_build(e,t=!0,n=1e-4,a=.02){const i=()=>{this._animationRunning&&(e.nodes().forEach((s,o)=>{const l=s.position(),u=Math.sin(performance.now()*n+o)*a,c=Math.cos(performance.now()*n+o)*a;s.position({x:l.x+u,y:l.y+c})}),this._requestId=requestAnimationFrame(i))};this._animationRunning=!0,this._requestId=requestAnimationFrame(i),t&&e.on("mouseover","node",()=>{this.stop()})}}var Ee=Y(6894),ae=Y.n(Ee);function R(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function B(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function se(r,e,t){return e&&function te(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,Re(n.key),n)}}(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function U(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=oe(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(l){throw l},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,o=!1;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return s=l.done,l},e:function(l){o=!0,i=l},f:function(){try{s||null==t.return||t.return()}finally{if(o)throw i}}}}function ie(r,e,t){return(e=Re(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function he(r,e){return function S(r){if(Array.isArray(r))return r}(r)||function ge(r,e){var t=null==r?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,a,i,s,o=[],l=!0,u=!1;try{if(i=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=i.call(t)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw a}}return o}}(r,e)||oe(r,e)||function Te(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function re(r){return function I(r){if(Array.isArray(r))return R(r)}(r)||function be(r){if(typeof Symbol<"u"&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||oe(r)||function Ge(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Re(r){var e=function de(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}(r,"string");return"symbol"==typeof e?e:e+""}function ye(r){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function oe(r,e){if(r){if("string"==typeof r)return R(r,e);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?R(r,e):void 0}}var qi,Tl,Ki,Cl,Zi,Dl,Ji,Sl,Qi,Il,es,Ll,ts,Al,ns,Nl,as,Rl,is,Ml,ss,_l,os,Pl,ls,kl,us,Bl,Ne=typeof window>"u"?null:window,Ze=Ne?Ne.navigator:null,$e=ye(""),et=ye({}),Pe=ye(function(){}),Ye=typeof HTMLElement>"u"?"undefined":ye(HTMLElement),we=function(e){return e&&e.instanceString&&ke(e.instanceString)?e.instanceString():null},le=function(e){return null!=e&&ye(e)==$e},ke=function(e){return null!=e&&ye(e)===Pe},We=function(e){return!vt(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},Oe=function(e){return null!=e&&ye(e)===et&&!We(e)&&e.constructor===Object},Be=function(e){return null!=e&&ye(e)===ye(1)&&!isNaN(e)},nt=function(e){if("undefined"!==Ye)return null!=e&&e instanceof HTMLElement},vt=function(e){return At(e)||qt(e)},At=function(e){return"collection"===we(e)&&e._private.single},qt=function(e){return"collection"===we(e)&&!e._private.single},wr=function(e){return"core"===we(e)},pn=function(e){return"stylesheet"===we(e)},Sr=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},Yf=function(e){return function(e){return null!=e&&ye(e)===et}(e)&&ke(e.then)},Mn=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var n=function(){var o,s=arguments,l=t.apply(this,s),u=n.cache;return(o=u[l])||(o=u[l]=e.apply(this,s)),o};return n.cache={},n},$i=Mn(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Ua=Mn(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),yl=Mn(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),ml=function(e){return Sr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Kr=function(e,t){return e.slice(-1*t.length)===t},Jt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",qf="rgb[a]?\\(("+Jt+"[%]?)\\s*,\\s*("+Jt+"[%]?)\\s*,\\s*("+Jt+"[%]?)(?:\\s*,\\s*("+Jt+"))?\\)",Kf="rgb[a]?\\((?:"+Jt+"[%]?)\\s*,\\s*(?:"+Jt+"[%]?)\\s*,\\s*(?:"+Jt+"[%]?)(?:\\s*,\\s*(?:"+Jt+"))?\\)",Zf="hsl[a]?\\(("+Jt+")\\s*,\\s*("+Jt+"[%])\\s*,\\s*("+Jt+"[%])(?:\\s*,\\s*("+Jt+"))?\\)",Jf="hsl[a]?\\((?:"+Jt+")\\s*,\\s*(?:"+Jt+"[%])\\s*,\\s*(?:"+Jt+"[%])(?:\\s*,\\s*(?:"+Jt+"))?\\)",bl=function(e,t){return e<t?-1:e>t?1:0},mt=null!=Object.assign?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var n=e[t];if(null!=n)for(var a=Object.keys(n),i=0;i<a.length;i++){var s=a[i];r[s]=n[s]}}return r},xl=function(e){return(We(e)?e:null)||function(e){return sh[e.toLowerCase()]}(e)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var n,a,i,s=16;return 4===e.length?(n=parseInt(e[1]+e[1],s),a=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(n=parseInt(e[1]+e[2],s),a=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[n,a,i]}}(e)||function(e){var t,n=new RegExp("^"+qf+"$").exec(e);if(n){t=[];for(var a=[],i=1;i<=3;i++){var s=n[i];if("%"===s[s.length-1]&&(a[i]=!0),s=parseFloat(s),a[i]&&(s=s/100*255),s<0||s>255)return;t.push(Math.floor(s))}if((a[1]||a[2]||a[3])&&!(a[1]&&a[2]&&a[3]))return;var u=n[4];if(void 0!==u){if((u=parseFloat(u))<0||u>1)return;t.push(u)}}return t}(e)||function(e){var t,n,a,i,s,o,l,u;function c(v,b,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?v+6*(b-v)*p:p<.5?b:p<2/3?v+(b-v)*(2/3-p)*6:v}var d=new RegExp("^"+Zf+"$").exec(e);if(d){if((n=parseInt(d[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(a=parseFloat(d[2]))<0||a>100||(a/=100,(i=parseFloat(d[3]))<0||i>100)||(i/=100,void 0!==(s=d[4])&&((s=parseFloat(s))<0||s>1)))return;if(0===a)o=l=u=Math.round(255*i);else{var f=i<.5?i*(1+a):i+a-i*a,h=2*i-f;o=Math.round(255*c(h,f,n+1/3)),l=Math.round(255*c(h,f,n)),u=Math.round(255*c(h,f,n-1/3))}t=[o,l,u,s]}return t}(e)},sh={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},wl=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var s=n[i];if(Oe(s))throw Error("Tried to set map with object key");i<n.length-1?(null==t[s]&&(t[s]={}),t=t[s]):t[s]=e.value}},El=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var s=n[i];if(Oe(s))throw Error("Tried to get map with object key");if(null==(t=t[s]))return t}return t},ja=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function la(){return Tl?qi:(Tl=1,qi=function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)})}function Xa(){if(Dl)return Zi;Dl=1;var r=function oh(){return Cl?Ki:(Cl=1,Ki="object"==typeof ja&&ja&&ja.Object===Object&&ja)}(),e="object"==typeof self&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Zi=t}function rs(){if(Al)return ts;Al=1;var r=Xa();return ts=r.Symbol}function Ol(){if(Ml)return is;Ml=1;var r=rs(),e=function dh(){if(Nl)return ns;Nl=1;var r=rs(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,a=r?r.toStringTag:void 0;return ns=function i(s){var o=t.call(s,a),l=s[a];try{s[a]=void 0;var u=!0}catch{}var c=n.call(s);return u&&(o?s[a]=l:delete s[a]),c}}(),t=function fh(){if(Rl)return as;Rl=1;var e=Object.prototype.toString;return as=function t(n){return e.call(n)}}(),i=r?r.toStringTag:void 0;return is=function s(o){return null==o?void 0===o?"[object Undefined]":"[object Null]":i&&i in Object(o)?e(o):t(o)}}function ua(){if(Pl)return os;Pl=1;var r=Ol(),e=function hh(){return _l?ss:(_l=1,ss=function r(e){return null!=e&&"object"==typeof e})}();return os=function n(a){return"symbol"==typeof a||e(a)&&"[object Symbol]"==r(a)}}var ph=function gh(){if(Bl)return us;Bl=1;var r=la(),e=function lh(){if(Sl)return Ji;Sl=1;var r=Xa();return Ji=function(){return r.Date.now()}}(),t=function vh(){if(kl)return ls;kl=1;var r=function ch(){if(Ll)return es;Ll=1;var r=function uh(){if(Il)return Qi;Il=1;var r=/\s/;return Qi=function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}}(),e=/^\s+/;return es=function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}}(),e=la(),t=ua(),a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;return ls=function l(u){if("number"==typeof u)return u;if(t(u))return NaN;if(e(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=e(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=r(u);var d=i.test(u);return d||s.test(u)?o(u.slice(2),d?2:8):a.test(u)?NaN:+u}}(),a=Math.max,i=Math.min;return us=function s(o,l,u){var c,d,f,h,v,b,p=0,g=!1,x=!1,C=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function A(ee){var ue=c,fe=d;return c=d=void 0,p=ee,h=o.apply(fe,ue)}function F(ee){var ue=ee-b;return void 0===b||ue>=l||ue<0||x&&ee-p>=f}function j(){var ee=e();if(F(ee))return $(ee);v=setTimeout(j,function H(ee){var ve=l-(ee-b);return x?i(ve,f-(ee-p)):ve}(ee))}function $(ee){return v=void 0,C&&c?A(ee):(c=d=void 0,h)}function Q(){var ee=e(),ue=F(ee);if(c=arguments,d=this,b=ee,ue){if(void 0===v)return function z(ee){return p=ee,v=setTimeout(j,l),g?A(ee):h}(b);if(x)return clearTimeout(v),v=setTimeout(j,l),A(b)}return void 0===v&&(v=setTimeout(j,l)),h}return l=t(l)||0,r(u)&&(g=!!u.leading,f=(x="maxWait"in u)?a(t(u.maxWait)||0,l):f,C="trailing"in u?!!u.trailing:C),Q.cancel=function J(){void 0!==v&&clearTimeout(v),p=0,c=b=d=v=void 0},Q.flush=function K(){return void 0===v?h:$(e())},Q},us}(),ca=oa(ph),cs=Ne?Ne.performance:null,Fl=cs&&cs.now?function(){return cs.now()}:function(){return Date.now()},yh=function(){if(Ne){if(Ne.requestAnimationFrame)return function(r){Ne.requestAnimationFrame(r)};if(Ne.mozRequestAnimationFrame)return function(r){Ne.mozRequestAnimationFrame(r)};if(Ne.webkitRequestAnimationFrame)return function(r){Ne.webkitRequestAnimationFrame(r)};if(Ne.msRequestAnimationFrame)return function(r){Ne.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(Fl())},1e3/60)}}(),Wa=function(e){return yh(e)},Ur=Fl,yn=9261,On=5381,zl=function(e){for(var a,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yn;!(a=e.next()).done;)n=65599*n+a.value|0;return n},da=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:yn)+e|0},fa=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:On;return(t<<5)+t+e|0},Zr=function(e){return 2097152*e[0]+e[1]},Ya=function(e,t){return[da(e[0],t[0]),fa(e[1],t[1])]},Vl=function(e,t){var n={value:0,done:!1},a=0,i=e.length;return zl({next:function(){return a<i?n.value=e[a++]:n.done=!0,n}},t)},mn=function(e,t){var n={value:0,done:!1},a=0,i=e.length;return zl({next:function(){return a<i?n.value=e.charCodeAt(a++):n.done=!0,n}},t)},Hl=function(){return bh(arguments)},bh=function(e){for(var t,n=0;n<e.length;n++){var a=e[n];t=0===n?mn(a):mn(a,t)}return t};var Ul=!0,Th=null!=console.warn,Ch=null!=console.trace,ds=Number.MAX_SAFE_INTEGER||9007199254740991,jl=function(){return!0},$a=function(){return!1},Xl=function(){return 0},fs=function(){},jt=function(e){throw new Error(e)},Wl=function(e){if(void 0===e)return Ul;Ul=!!e},Bt=function(e){Wl()&&(Th?console.warn(e):(console.log(e),Ch&&console.trace()))},_r=function(e){return null==e?e:We(e)?e.slice():Oe(e)?function(e){return mt({},e)}(e):e},Yl=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},Ih={},$l=function(){return Ih},ir=function(e){var t=Object.keys(e);return function(n){for(var a={},i=0;i<t.length;i++){var s=t[i],o=n?.[s];a[s]=void 0===o?e[s]:o}return a}},Jr=function(e,t,n){for(var a=e.length-1;a>=0;a--)e[a]===t&&e.splice(a,1)},hs=function(e){e.splice(0,e.length)},vr=function(e,t,n){return n&&(t=yl(n,t)),e[t]},Pr=function(e,t,n,a){n&&(t=yl(n,t)),e[t]=a},jr=typeof Map<"u"?Map:function(){return se(function r(){B(this,r),this._obj={}},[{key:"set",value:function(t,n){return this._obj[t]=n,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return void 0!==this._obj[t]}},{key:"get",value:function(t){return this._obj[t]}}])}(),Rh=function(){return se(function r(e){if(B(this,r),this._obj=Object.create(null),this.size=0,null!=e){var t;t=null!=e.instanceString&&e.instanceString()===this.instanceString()?e.toArray():e;for(var n=0;n<t.length;n++)this.add(t[n])}},[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var n=this._obj;1!==n[t]&&(n[t]=1,this.size++)}},{key:"delete",value:function(t){var n=this._obj;1===n[t]&&(n[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return 1===this._obj[t]}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(n){return t.has(n)})}},{key:"forEach",value:function(t,n){return this.toArray().forEach(t,n)}}])}(),_n="undefined"!==(typeof Set>"u"?"undefined":ye(Set))?Set:Rh,qa=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&wr(e)){var a=t.group;if(null==a&&(a=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===a||"edges"===a){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:a,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===a:!!t.pannable,active:!1,classes:new _n,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var s=t.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];We(t.classes)?u=t.classes:le(t.classes)&&(u=t.classes.split(/\s+/));for(var c=0,d=u.length;c<d;c++){var f=u[c];!f||""===f||i.classes.add(f)}this.createEmitter(),(void 0===n||n)&&this.restore();var h=t.style||t.css;h&&(Bt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))}else jt("An element must be of type `nodes` or `edges`; you specified `"+a+"`")}else jt("An element must have a core reference and parameters set")},ql=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,a,i){var s;Oe(n)&&!vt(n)&&(n=(s=n).roots||s.root,a=s.visit,i=s.directed),i=2!==arguments.length||ke(a)?i:a,a=ke(a)?a:function(){};for(var b,o=this._private.cy,l=n=le(n)?this.filter(n):n,u=[],c=[],d={},f={},h={},v=0,p=this.byGroup(),g=p.nodes,x=p.edges,C=0;C<l.length;C++){var A=l[C],z=A.id();A.isNode()&&(u.unshift(A),e.bfs&&(h[z]=!0,c.push(A)),f[z]=0)}for(var F,H=function(){var ee=e.bfs?u.shift():u.pop(),ue=ee.id();if(e.dfs){if(h[ue])return 0;h[ue]=!0,c.push(ee)}var Ie,fe=f[ue],ve=d[ue],ce=null!=ve?ve.source():null,pe=null!=ve?ve.target():null,Se=null==ve?void 0:ee.same(ce)?pe[0]:ce[0];if(!0===(Ie=a(ee,ve,Se,v++,fe)))return b=ee,1;if(!1===Ie)return 1;for(var me=ee.connectedEdges().filter(function(Je){return(!i||Je.source().same(ee))&&x.has(Je)}),De=0;De<me.length;De++){var Ue=me[De],qe=Ue.connectedNodes().filter(function(Je){return!Je.same(ee)&&g.has(Je)}),je=qe.id();0!==qe.length&&!h[je]&&(u.push(qe=qe[0]),e.bfs&&(h[je]=!0,c.push(qe)),d[je]=Ue,f[je]=f[ue]+1)}};0!==u.length&&(0===(F=H())||1!==F););for(var j=o.collection(),$=0;$<c.length;$++){var J=c[$],K=d[J.id()];null!=K&&j.push(K),j.push(J)}return{path:o.collection(j),found:o.collection(b)}}},ha={breadthFirstSearch:ql({bfs:!0}),depthFirstSearch:ql({dfs:!0})};ha.bfs=ha.breadthFirstSearch,ha.dfs=ha.depthFirstSearch;var Kl,vs,Zl,Ka={exports:{}},Mh=Ka.exports;var ps,va=oa(function _h(){return Zl||(Zl=1,vs=function Oh(){return Kl||(Kl=1,r=Ka,function(){var t,n,a,i,s,o,l,u,c,d,f,h,v,b,p;a=Math.floor,d=Math.min,n=function(g,x){return g<x?-1:g>x?1:0},c=function(g,x,C,A,z){var H;if(null==C&&(C=0),null==z&&(z=n),C<0)throw new Error("lo must be non-negative");for(null==A&&(A=g.length);C<A;)z(x,g[H=a((C+A)/2)])<0?A=H:C=H+1;return[].splice.apply(g,[C,C-C].concat(x)),x},o=function(g,x,C){return null==C&&(C=n),g.push(x),b(g,0,g.length-1,C)},s=function(g,x){var C,A;return null==x&&(x=n),C=g.pop(),g.length?(A=g[0],g[0]=C,p(g,0,x)):A=C,A},u=function(g,x,C){var A;return null==C&&(C=n),A=g[0],g[0]=x,p(g,0,C),A},l=function(g,x,C){var A;return null==C&&(C=n),g.length&&C(g[0],x)<0&&(x=(A=[g[0],x])[0],g[0]=A[1],p(g,0,C)),x},i=function(g,x){var A,z,H,F,j;for(null==x&&(x=n),F=[],A=0,z=(H=function(){j=[];for(var $=0,J=a(g.length/2);0<=J?$<J:$>J;0<=J?$++:$--)j.push($);return j}.apply(this).reverse()).length;A<z;A++)F.push(p(g,H[A],x));return F},v=function(g,x,C){var A;if(null==C&&(C=n),-1!==(A=g.indexOf(x)))return b(g,0,A,C),p(g,A,C)},f=function(g,x,C){var z,H,F,j;if(null==C&&(C=n),!(z=g.slice(0,x)).length)return z;for(i(z,C),H=0,F=(j=g.slice(x)).length;H<F;H++)l(z,j[H],C);return z.sort(C).reverse()},h=function(g,x,C){var A,z,H,F,j,$,J,K,Q;if(null==C&&(C=n),10*x<=g.length){if(!(H=g.slice(0,x).sort(C)).length)return H;for(z=H[H.length-1],F=0,$=(J=g.slice(x)).length;F<$;F++)C(A=J[F],z)<0&&(c(H,A,0,null,C),H.pop(),z=H[H.length-1]);return H}for(i(g,C),Q=[],j=0,K=d(x,g.length);0<=K?j<K:j>K;0<=K?++j:--j)Q.push(s(g,C));return Q},b=function(g,x,C,A){var z,H,F;for(null==A&&(A=n),z=g[C];C>x&&A(z,H=g[F=C-1>>1])<0;)g[C]=H,C=F;return g[C]=z},p=function(g,x,C){var A,z,H,F,j;for(null==C&&(C=n),z=g.length,j=x,H=g[x],A=2*x+1;A<z;)(F=A+1)<z&&!(C(g[A],g[F])<0)&&(A=F),g[x]=g[A],A=2*(x=A)+1;return g[x]=H,b(g,j,x,C)},t=function(){function g(x){this.cmp=x??n,this.nodes=[]}return g.push=o,g.pop=s,g.replace=u,g.pushpop=l,g.heapify=i,g.updateItem=v,g.nlargest=f,g.nsmallest=h,g.prototype.push=function(x){return o(this.nodes,x,this.cmp)},g.prototype.pop=function(){return s(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(x){return-1!==this.nodes.indexOf(x)},g.prototype.replace=function(x){return u(this.nodes,x,this.cmp)},g.prototype.pushpop=function(x){return l(this.nodes,x,this.cmp)},g.prototype.heapify=function(){return i(this.nodes,this.cmp)},g.prototype.updateItem=function(x){return v(this.nodes,x,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return 0===this.nodes.length},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var x;return(x=new g).nodes=this.nodes.slice(0),x},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g}(),r.exports=t}.call(Mh)),Ka.exports;var r}()),vs}()),kh=ir({root:null,weight:function(e){return 1},directed:!1}),Bh={dijkstra:function(e){if(!Oe(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=kh(e),a=n.root,s=n.directed,o=this,l=n.weight,u=le(a)?this.filter(a)[0]:a[0],c={},d={},f={},h=this.byGroup(),v=h.nodes,b=h.edges;b.unmergeBy(function(fe){return fe.isLoop()});for(var p=function(ve){return c[ve.id()]},g=function(ve,ce){c[ve.id()]=ce,x.updateItem(ve)},x=new va(function(fe,ve){return p(fe)-p(ve)}),C=0;C<v.length;C++){var A=v[C];c[A.id()]=A.same(u)?0:1/0,x.push(A)}for(var z=function(ve,ce){for(var Ie,pe=(s?ve.edgesTo(ce):ve.edgesWith(ce)).intersect(b),Se=1/0,me=0;me<pe.length;me++){var De=pe[me],Ue=l(De);(Ue<Se||!Ie)&&(Se=Ue,Ie=De)}return{edge:Ie,dist:Se}};x.size()>0;){var H=x.pop(),F=p(H),j=H.id();if(f[j]=F,F!==1/0)for(var $=H.neighborhood().intersect(v),J=0;J<$.length;J++){var K=$[J],Q=K.id(),ee=z(H,K),ue=F+ee.dist;ue<p(K)&&(g(K,ue),d[Q]={node:H,edge:ee.edge})}}return{distanceTo:function(ve){var ce=le(ve)?v.filter(ve)[0]:ve[0];return f[ce.id()]},pathTo:function(ve){var ce=le(ve)?v.filter(ve)[0]:ve[0],pe=[],Se=ce,Ie=Se.id();if(ce.length>0)for(pe.unshift(ce);d[Ie];){var me=d[Ie];pe.unshift(me.edge),pe.unshift(me.node),Ie=(Se=me.node).id()}return o.spawn(pe)}}}},Fh={kruskal:function(e){e=e||function(C){return 1};for(var t=this.byGroup(),n=t.nodes,a=t.edges,i=n.length,s=new Array(i),o=n,l=function(A){for(var z=0;z<s.length;z++)if(s[z].has(A))return z},u=0;u<i;u++)s[u]=this.spawn(n[u]);for(var c=a.sort(function(C,A){return e(C)-e(A)}),d=0;d<c.length;d++){var f=c[d],h=f.source()[0],v=f.target()[0],b=l(h),p=l(v),g=s[b],x=s[p];b!==p&&(o.merge(f),g.merge(x),s.splice(p,1))}return o}},Gh=ir({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),zh={aStar:function(e){var t=this.cy(),n=Gh(e),a=n.root,i=n.goal,s=n.heuristic,o=n.directed,l=n.weight;a=t.collection(a)[0],i=t.collection(i)[0];var C,A,u=a.id(),c=i.id(),d={},f={},h={},v=new va(function(Ie,me){return f[Ie.id()]-f[me.id()]}),b=new _n,p={},g={},x=function(me,De){v.push(me),b.add(De)},z=function(){C=v.pop(),A=C.id(),b.delete(A)},H=function(me){return b.has(me)};x(a,u),d[u]=0,f[u]=s(a);for(var F=0;v.size()>0;){if(z(),F++,A===c){for(var j=[],$=i,J=c,K=g[J];j.unshift($),null!=K&&j.unshift(K),null!=($=p[J]);)K=g[J=$.id()];return{found:!0,distance:d[A],path:this.spawn(j),steps:F}}h[A]=!0;for(var Q=C._private.edges,ee=0;ee<Q.length;ee++){var ue=Q[ee];if(this.hasElementWithId(ue.id())&&(!o||ue.data("source")===A)){var fe=ue.source(),ve=ue.target(),ce=fe.id()!==A?fe:ve,pe=ce.id();if(this.hasElementWithId(pe)&&!h[pe]){var Se=d[A]+l(ue);if(!H(pe)){d[pe]=Se,f[pe]=Se+s(ce),x(ce,pe),p[pe]=C,g[pe]=ue;continue}Se<d[pe]&&(d[pe]=Se,f[pe]=Se+s(ce),p[pe]=C,g[pe]=ue)}}}}return{found:!1,distance:void 0,path:void 0,steps:F}}},Vh=ir({weight:function(e){return 1},directed:!1}),Hh={floydWarshall:function(e){for(var t=this.cy(),n=Vh(e),i=n.directed,s=n.weight,o=this.byGroup(),l=o.nodes,u=o.edges,c=l.length,d=c*c,f=function(Ue){return l.indexOf(Ue)},h=function(Ue){return l[Ue]},v=new Array(d),b=0;b<d;b++){var p=b%c;v[b]=(b-p)/c===p?0:1/0}for(var x=new Array(d),C=new Array(d),A=0;A<u.length;A++){var z=u[A],H=z.source()[0],F=z.target()[0];if(H!==F){var j=f(H),$=f(F),J=j*c+$,K=s(z);if(v[J]>K&&(v[J]=K,x[J]=$,C[J]=z),!i){var Q=$*c+j;!i&&v[Q]>K&&(v[Q]=K,x[Q]=j,C[Q]=z)}}}for(var ee=0;ee<c;ee++)for(var ue=0;ue<c;ue++)for(var fe=ue*c+ee,ve=0;ve<c;ve++){var ce=ue*c+ve,pe=ee*c+ve;v[fe]+v[pe]<v[ce]&&(v[ce]=v[fe]+v[pe],x[ce]=x[fe])}var Ie=function(Ue){return f(function(Ue){return(le(Ue)?t.filter(Ue):Ue)[0]}(Ue))};return{distance:function(Ue,qe){var je=Ie(Ue),Je=Ie(qe);return v[je*c+Je]},path:function(Ue,qe){var je=Ie(Ue),Je=Ie(qe),tt=h(je);if(je===Je)return tt.collection();if(null==x[je*c+Je])return t.collection();var at=t.collection();for(at.merge(tt);je!==Je;)at.merge(C[je*c+(je=x[je*c+Je])]),at.merge(h(je));return at}}}},Uh=ir({weight:function(e){return 1},directed:!1,root:null}),jh={bellmanFord:function(e){var t=this,n=Uh(e),i=n.directed,s=n.root,o=n.weight,l=this,u=this.cy(),c=this.byGroup(),d=c.edges,f=c.nodes,h=f.length,v=new jr,b=!1,p=[];s=u.collection(s)[0],d.unmergeBy(function(Et){return Et.isLoop()});for(var g=d.length,x=function(bt){var pt=v.get(bt.id());return pt||(pt={},v.set(bt.id(),pt)),pt},C=function(bt){return(le(bt)?u.$(bt):bt)[0]},H=0;H<h;H++){var F=f[H],j=x(F);j.dist=F.same(s)?0:1/0,j.pred=null,j.edge=null}for(var $=!1,J=function(bt,pt,ot,gt,ht,Tt){var xt=gt.dist+Tt;xt<ht.dist&&!ot.same(gt.edge)&&(ht.dist=xt,ht.pred=bt,ht.edge=ot,$=!0)},K=1;K<h;K++){$=!1;for(var Q=0;Q<g;Q++){var ee=d[Q],ue=ee.source(),fe=ee.target(),ve=o(ee),ce=x(ue),pe=x(fe);J(ue,0,ee,ce,pe,ve),i||J(fe,0,ee,pe,ce,ve)}if(!$)break}if($)for(var Se=[],Ie=0;Ie<g;Ie++){var me=d[Ie],De=me.source(),Ue=me.target(),qe=o(me),je=x(De).dist,Je=x(Ue).dist;if(je+qe<Je||!i&&Je+qe<je){if(b||(Bt("Graph contains a negative weight cycle for Bellman-Ford"),b=!0),!1===e.findNegativeWeightCycles)break;var tt=[];je+qe<Je&&tt.push(De),!i&&Je+qe<je&&tt.push(Ue);for(var at=tt.length,He=0;He<at;He++){var Ce=tt[He],Ae=[Ce];Ae.push(x(Ce).edge);for(var _e=x(Ce).pred;-1===Ae.indexOf(_e);)Ae.push(_e),Ae.push(x(_e).edge),_e=x(_e).pred;for(var ze=(Ae=Ae.slice(Ae.indexOf(_e)))[0].id(),rt=0,ct=2;ct<Ae.length;ct+=2)Ae[ct].id()<ze&&(ze=Ae[ct].id(),rt=ct);(Ae=Ae.slice(rt).concat(Ae.slice(0,rt))).push(Ae[0]);var Nt=Ae.map(function(Et){return Et.id()}).join(",");-1===Se.indexOf(Nt)&&(p.push(l.spawn(Ae)),Se.push(Nt))}}}return{distanceTo:function(bt){return x(C(bt)).dist},pathTo:function(bt){for(var pt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,gt=[],ht=C(bt);;){if(null==ht)return t.spawn();var Tt=x(ht),xt=Tt.edge,It=Tt.pred;if(gt.unshift(ht[0]),ht.same(pt)&>.length>0)break;null!=xt&>.unshift(xt),ht=It}return l.spawn(gt)},hasNegativeWeightCycle:b,negativeWeightCycles:p}}},Xh=Math.sqrt(2),Wh=function(e,t,n){0===n.length&&jt("Karger-Stein must be run on a connected (sub)graph");for(var a=n[e],o=t[a[1]],l=t[a[2]],u=n,c=u.length-1;c>=0;c--){var d=u[c],f=d[1],h=d[2];(t[f]===o&&t[h]===l||t[f]===l&&t[h]===o)&&u.splice(c,1)}for(var v=0;v<u.length;v++){var b=u[v];b[1]===l?(u[v]=b.slice(),u[v][1]=o):b[2]===l&&(u[v]=b.slice(),u[v][2]=o)}for(var p=0;p<t.length;p++)t[p]===l&&(t[p]=o);return u},gs=function(e,t,n,a){for(;n>a;){var i=Math.floor(Math.random()*t.length);t=Wh(i,e,t),n--}return t},Yh={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,a=t.edges;a.unmergeBy(function(pe){return pe.isLoop()});var i=n.length,s=a.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Xh);if(!(i<2)){for(var u=[],c=0;c<s;c++){var d=a[c];u.push([c,n.indexOf(d.source()),n.indexOf(d.target())])}for(var f=1/0,h=[],v=new Array(i),b=new Array(i),p=new Array(i),g=function(Se,Ie){for(var me=0;me<i;me++)Ie[me]=Se[me]},x=0;x<=o;x++){for(var C=0;C<i;C++)b[C]=C;var A=gs(b,u.slice(),i,l),z=A.slice();g(b,p);var H=gs(b,A,l,2),F=gs(p,z,l,2);H.length<=F.length&&H.length<f?(f=H.length,h=H,g(b,v)):F.length<=H.length&&F.length<f&&(f=F.length,h=F,g(p,v))}for(var j=this.spawn(h.map(function(pe){return a[pe[0]]})),$=this.spawn(),J=this.spawn(),K=v[0],Q=0;Q<v.length;Q++){var ue=n[Q];v[Q]===K?$.merge(ue):J.merge(ue)}var fe=function(Se){var Ie=e.spawn();return Se.forEach(function(me){Ie.merge(me),me.connectedEdges().forEach(function(De){e.contains(De)&&!j.contains(De)&&Ie.merge(De)})}),Ie},ve=[fe($),fe(J)];return{cut:j,components:ve,partition1:$,partition2:J}}jt("At least 2 nodes are required for Karger-Stein algorithm")}},Za=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Jl=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Pn=function(e){return{x:e[0],y:e[1]}},Ja=function(e,t){return Math.atan2(t,e)-Math.PI/2},ys=Math.log2||function(r){return Math.log(r)/Math.log(2)},ms=function(e){return e>0?1:e<0?-1:0},bn=function(e,t){return Math.sqrt(xn(e,t))},xn=function(e,t){var n=t.x-e.x,a=t.y-e.y;return n*n+a*a},ev=function(e){for(var t=e.length,n=0,a=0;a<t;a++)n+=e[a];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},tr=function(e,t,n,a){return(1-a)*(1-a)*e+2*(1-a)*a*t+a*a*n},kn=function(e,t,n,a){return{x:tr(e.x,t.x,n.x,a),y:tr(e.y,t.y,n.y,a)}},ga=function(e,t,n){return Math.max(e,Math.min(n,t))},gr=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},av=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Ql=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Qa=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ei=function(e){var n,a,i,s,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===t.length)n=a=i=s=t[0];else if(2===t.length)n=i=t[0],s=a=t[1];else if(4===t.length){var o=he(t,4);n=o[0],a=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=a,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},eu=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},bs=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},Qr=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},tu=function(e,t){return Qr(e,t.x,t.y)},ru=function(e,t){return Qr(e,t.x1,t.y1)&&Qr(e,t.x2,t.y2)},iv=null!==(ps=Math.hypot)&&void 0!==ps?ps:function(r,e){return Math.sqrt(r*r+e*e)};var nu=function(e,t,n,a,i,s,o){var v,fe,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",u="auto"===l?tn(i,s):l,c=i/2,d=s/2,f=(u=Math.min(u,c,d))!==c,h=u!==d;if(f){var p=a-d-o;if((v=en(e,t,n,a,n-c+u-o,p,n+c-u+o,p,!1)).length>0)return v}if(h){var C=n+c+o;if((v=en(e,t,n,a,C,a-d+u-o,C,a+d-u+o,!1)).length>0)return v}if(f){var j=a+d+o;if((v=en(e,t,n,a,n-c+u-o,j,n+c-u+o,j,!1)).length>0)return v}if(h){var K=n-c-o;if((v=en(e,t,n,a,K,a-d+u-o,K,a+d-u+o,!1)).length>0)return v}var ve=n-c+u,ce=a-d+u;if((fe=pa(e,t,n,a,ve,ce,u+o)).length>0&&fe[0]<=ve&&fe[1]<=ce)return[fe[0],fe[1]];var pe=n+c-u,Se=a-d+u;if((fe=pa(e,t,n,a,pe,Se,u+o)).length>0&&fe[0]>=pe&&fe[1]<=Se)return[fe[0],fe[1]];var Ie=n+c-u,me=a+d-u;if((fe=pa(e,t,n,a,Ie,me,u+o)).length>0&&fe[0]>=Ie&&fe[1]>=me)return[fe[0],fe[1]];var De=n-c+u,Ue=a+d-u;return(fe=pa(e,t,n,a,De,Ue,u+o)).length>0&&fe[0]<=De&&fe[1]>=Ue?[fe[0],fe[1]]:[]},lv=function(e,t,n,a,i,s,o){var l=o,u=Math.min(n,i),c=Math.max(n,i),d=Math.min(a,s),f=Math.max(a,s);return u-l<=e&&e<=c+l&&d-l<=t&&t<=f+l},uv=function(e,t,n,a,i,s,o,l,u){var c_x1=Math.min(n,o,i)-u,c_x2=Math.max(n,o,i)+u,c_y1=Math.min(a,l,s)-u,c_y2=Math.max(a,l,s)+u;return!(e<c_x1||e>c_x2||t<c_y1||t>c_y2)},fv=function(e,t,n,a,i,s,o,l){var h=[];!function(e,t,n,a,i){var o,l,u,c,d,f,h,v;0===e&&(e=1e-5),u=-27*(a/=e)+(t/=e)*(9*(n/=e)-t*t*2),o=(l=(3*n-t*t)/9)*l*l+(u/=54)*u,i[1]=0,h=t/3,o>0?(d=(d=u+Math.sqrt(o))<0?-Math.pow(-d,1/3):Math.pow(d,1/3),f=(f=u-Math.sqrt(o))<0?-Math.pow(-f,1/3):Math.pow(f,1/3),i[0]=-h+d+f,i[4]=i[2]=-(h+=(d+f)/2),h=Math.sqrt(3)*(-f+d)/2,i[3]=h,i[5]=-h):(i[5]=i[3]=0,0===o?(v=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=2*v-h,i[4]=i[2]=-(v+h)):(c=(l=-l)*l*l,c=Math.acos(u/Math.sqrt(c)),v=2*Math.sqrt(l),i[0]=-h+v*Math.cos(c/3),i[2]=-h+v*Math.cos((c+2*Math.PI)/3),i[4]=-h+v*Math.cos((c+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+a*a-4*a*s+2*a*l+4*s*s-4*s*l+l*l,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*a*s-3*a*a-3*a*l-6*s*s+3*s*l,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*a*a-6*a*s+a*l-a*t+2*s*s+2*s*t-l*t,1*n*i-n*n+n*e-i*e+a*s-a*a+a*t-s*t,h);for(var b=[],p=0;p<6;p+=2)Math.abs(h[p+1])<1e-7&&h[p]>=0&&h[p]<=1&&b.push(h[p]);b.push(1),b.push(0);for(var x,C,A,g=-1,z=0;z<b.length;z++)x=Math.pow(1-b[z],2)*n+2*(1-b[z])*b[z]*i+b[z]*b[z]*o,C=Math.pow(1-b[z],2)*a+2*(1-b[z])*b[z]*s+b[z]*b[z]*l,A=Math.pow(x-e,2)+Math.pow(C-t,2),g>=0?A<g&&(g=A):g=A;return g},hv=function(e,t,n,a,i,s){var o=[e-n,t-a],l=[i-n,s-a],u=l[0]*l[0]+l[1]*l[1],c=o[0]*o[0]+o[1]*o[1],d=o[0]*l[0]+o[1]*l[1],f=d*d/u;return d<0?c:f>u?(e-i)*(e-i)+(t-s)*(t-s):c-f},mr=function(e,t,n){for(var a,i,s,o,u=0,c=0;c<n.length/2;c++)if(i=n[2*c+1],c+1<n.length/2?(s=n[2*(c+1)],o=n[2*(c+1)+1]):(s=n[2*(c+1-n.length/2)],o=n[2*(c+1-n.length/2)+1]),(a=n[2*c])!=e||s!=e){if(!(a>=e&&e>=s||a<=e&&e<=s))continue;(e-a)/(s-a)*(o-i)+i>t&&u++}return u%2!=0},Xr=function(e,t,n,a,i,s,o,l,u){var d,b,c=new Array(n.length);null!=l[0]?(d=Math.atan(l[1]/l[0]),l[0]<0?d+=Math.PI/2:d=-d-Math.PI/2):d=l;for(var f=Math.cos(-d),h=Math.sin(-d),v=0;v<c.length/2;v++)c[2*v]=s/2*(n[2*v]*f-n[2*v+1]*h),c[2*v+1]=o/2*(n[2*v+1]*f+n[2*v]*h),c[2*v]+=a,c[2*v+1]+=i;if(u>0){var p=ri(c,-u);b=ti(p)}else b=c;return mr(e,t,b)},ti=function(e){for(var o,l,u,c,t=new Array(e.length/2),d=0;d<e.length/4;d++){d<e.length/4-1?(o=e[4*(d+1)],l=e[4*(d+1)+1],u=e[4*(d+1)+2],c=e[4*(d+1)+3]):(o=e[0],l=e[1],u=e[2],c=e[3]);var f=en(e[4*d],e[4*d+1],e[4*d+2],e[4*d+3],o,l,u,c,!0);t[2*d]=f[0],t[2*d+1]=f[1]}return t},ri=function(e,t){for(var a,i,s,o,n=new Array(2*e.length),l=0;l<e.length/2;l++){l<e.length/2-1?(s=e[2*(l+1)],o=e[2*(l+1)+1]):(s=e[0],o=e[1]);var u=o-(i=e[2*l+1]),c=-(s-(a=e[2*l])),d=Math.sqrt(u*u+c*c),f=u/d,h=c/d;n[4*l]=a+f*t,n[4*l+1]=i+h*t,n[4*l+2]=s+f*t,n[4*l+3]=o+h*t}return n},wn=function(e,t,n,a,i,s,o){return e-=i,t-=s,(e/=n/2+o)*e+(t/=a/2+o)*t<=1},pa=function(e,t,n,a,i,s,o){var l=[n-e,a-t],u=[e-i,t-s],c=l[0]*l[0]+l[1]*l[1],d=2*(u[0]*l[0]+u[1]*l[1]),h=d*d-4*c*(u[0]*u[0]+u[1]*u[1]-o*o);if(h<0)return[];var v=(-d+Math.sqrt(h))/(2*c),b=(-d-Math.sqrt(h))/(2*c),p=Math.min(v,b),g=Math.max(v,b),x=[];if(p>=0&&p<=1&&x.push(p),g>=0&&g<=1&&x.push(g),0===x.length)return[];var C=x[0]*l[0]+e,A=x[0]*l[1]+t;return x.length>1?x[0]==x[1]?[C,A]:[C,A,x[1]*l[0]+e,x[1]*l[1]+t]:[C,A]},xs=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},en=function(e,t,n,a,i,s,o,l,u){var c=e-i,d=n-e,f=o-i,h=t-s,v=a-t,b=l-s,p=f*h-b*c,g=d*h-v*c,x=b*d-f*v;if(0!==x){var C=p/x,A=g/x,H=-.001;return H<=C&&C<=1.001&&H<=A&&A<=1.001||u?[e+C*d,t+C*v]:[]}return 0===p||0===g?xs(e,n,o)===o?[o,l]:xs(e,n,i)===i?[i,s]:xs(i,o,n)===n?[n,a]:[]:[]},pv=function(e,t,n,a,i){var s=[],o=a/2,l=i/2,u=t,c=n;s.push({x:u+o*e[0],y:c+l*e[1]});for(var d=1;d<e.length/2;d++)s.push({x:u+o*e[2*d],y:c+l*e[2*d+1]});return s},ya=function(e,t,n,a,i,s,o,l){var c,h,u=[],d=new Array(n.length),f=!0;if(null==s&&(f=!1),f){for(var v=0;v<d.length/2;v++)d[2*v]=n[2*v]*s+a,d[2*v+1]=n[2*v+1]*o+i;if(l>0){var b=ri(d,-l);h=ti(b)}else h=d}else h=n;for(var x,C,A=0;A<h.length/2;A++)A<h.length/2-1?(x=h[2*(A+1)],C=h[2*(A+1)+1]):(x=h[0],C=h[1]),0!==(c=en(e,t,a,i,h[2*A],h[2*A+1],x,C)).length&&u.push(c[0],c[1]);return u},ni=function(e,t,n){var a=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=(i-n)/i;return s<0&&(s=1e-5),[t[0]+s*a[0],t[1]+s*a[1]]},pr=function(e,t){var n=ws(e,t);return au(n)},au=function(e){for(var t,n,a=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<a;u++)t=e[2*u],n=e[2*u+1],i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,n),l=Math.max(l,n);for(var c=2/(o-i),d=2/(l-s),f=0;f<a;f++)t=e[2*f]=e[2*f]*c,n=e[2*f+1]=e[2*f+1]*d,i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,n),l=Math.max(l,n);if(s<-1)for(var h=0;h<a;h++)n=e[2*h+1]=e[2*h+1]+(-1-s);return e},ws=function(e,t){var n=1/e*2*Math.PI,a=e%2==0?Math.PI/2+n/2:Math.PI/2;a+=t;for(var s,i=new Array(2*e),o=0;o<e;o++)s=o*n+a,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},tn=function(e,t){return Math.min(e/4,t/4,8)},iu=function(e,t){return Math.min(e/10,t/10,8)},Ts=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Cs(r,e){function t(d){for(var f=[],h=0;h<d.length;h++){var v=d[h],b=d[(h+1)%d.length],p={x:b.x-v.x,y:b.y-v.y},g={x:-p.y,y:p.x},x=Math.sqrt(g.x*g.x+g.y*g.y);f.push({x:g.x/x,y:g.y/x})}return f}function n(d,f){var p,h=1/0,v=-1/0,b=U(d);try{for(b.s();!(p=b.n()).done;){var g=p.value,x=g.x*f.x+g.y*f.y;h=Math.min(h,x),v=Math.max(v,x)}}catch(C){b.e(C)}finally{b.f()}return{min:h,max:v}}function a(d,f){return!(d.max<f.min||f.max<d.min)}var o,s=U([].concat(re(t(r)),re(t(e))));try{for(s.s();!(o=s.n()).done;){var l=o.value;if(!a(n(r,l),n(e,l)))return!1}}catch(d){s.e(d)}finally{s.f()}return!0}var bv=ir({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),xv={pageRank:function(e){for(var t=bv(e),n=t.dampingFactor,a=t.precision,i=t.iterations,s=t.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,d=u.length,h=c.length,v=new Array(d*d),b=new Array(d),p=(1-n)/d,g=0;g<d;g++){for(var x=0;x<d;x++)v[g*d+x]=0;b[g]=0}for(var A=0;A<h;A++){var z=c[A],H=z.data("source"),F=z.data("target");if(H!==F){var j=u.indexOfId(H),$=u.indexOfId(F),J=s(z);v[$*d+j]+=J,b[j]+=J}}for(var Q=1/d+p,ee=0;ee<d;ee++)if(0===b[ee])for(var ue=0;ue<d;ue++)v[ue*d+ee]=Q;else for(var ve=0;ve<d;ve++){var ce=ve*d+ee;v[ce]=v[ce]/b[ee]+p}for(var Ie,pe=new Array(d),Se=new Array(d),me=0;me<d;me++)pe[me]=1;for(var De=0;De<i;De++){for(var Ue=0;Ue<d;Ue++)Se[Ue]=0;for(var qe=0;qe<d;qe++)for(var je=0;je<d;je++)Se[qe]+=v[qe*d+je]*pe[je];ev(Se),Ie=pe,pe=Se,Se=Ie;for(var tt=0,at=0;at<d;at++){var He=Ie[at]-pe[at];tt+=He*He}if(tt<a)break}return{rank:function(_e){return _e=o.collection(_e)[0],pe[u.indexOf(_e)]}}}},su=ir({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Bn={degreeCentralityNormalized:function(e){e=su(e);var t=this.cy(),n=this.nodes(),a=n.length;if(e.directed){for(var c={},d={},f=0,h=0,v=0;v<a;v++){var b=n[v],p=b.id();e.root=b;var g=this.degreeCentrality(e);f<g.indegree&&(f=g.indegree),h<g.outdegree&&(h=g.outdegree),c[p]=g.indegree,d[p]=g.outdegree}return{indegree:function(C){return 0==f?0:(le(C)&&(C=t.filter(C)),c[C.id()]/f)},outdegree:function(C){return 0===h?0:(le(C)&&(C=t.filter(C)),d[C.id()]/h)}}}for(var i={},s=0,o=0;o<a;o++){var l=n[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(C){return 0===s?0:(le(C)&&(C=t.filter(C)),i[C.id()]/s)}}},degreeCentrality:function(e){e=su(e);var t=this.cy(),n=this,i=e.root,s=e.weight,o=e.directed,l=e.alpha;if(i=t.collection(i)[0],o){for(var h=i.connectedEdges(),v=h.filter(function(H){return H.target().same(i)&&n.has(H)}),b=h.filter(function(H){return H.source().same(i)&&n.has(H)}),p=v.length,g=b.length,x=0,C=0,A=0;A<v.length;A++)x+=s(v[A]);for(var z=0;z<b.length;z++)C+=s(b[z]);return{indegree:Math.pow(p,1-l)*Math.pow(x,l),outdegree:Math.pow(g,1-l)*Math.pow(C,l)}}for(var u=i.connectedEdges().intersection(n),c=u.length,d=0,f=0;f<u.length;f++)d+=s(u[f]);return{degree:Math.pow(c,1-l)*Math.pow(d,l)}}};Bn.dc=Bn.degreeCentrality,Bn.dcn=Bn.degreeCentralityNormalised=Bn.degreeCentralityNormalized;var ou=ir({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Fn={closenessCentralityNormalized:function(e){for(var t=ou(e),n=t.harmonic,a=t.weight,i=t.directed,s=this.cy(),o={},l=0,u=this.nodes(),c=this.floydWarshall({weight:a,directed:i}),d=0;d<u.length;d++){for(var f=0,h=u[d],v=0;v<u.length;v++)if(d!==v){var b=c.distance(h,u[v]);f+=n?1/b:b}n||(f=1/f),l<f&&(l=f),o[h.id()]=f}return{closeness:function(g){return 0==l?0:(g=le(g)?s.filter(g)[0].id():g.id(),o[g]/l)}}},closenessCentrality:function(e){var t=ou(e),n=t.root,a=t.weight,i=t.directed,s=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:a,directed:i}),l=0,u=this.nodes(),c=0;c<u.length;c++){var d=u[c];if(!d.same(n)){var f=o.distanceTo(d);l+=s?1/f:f}}return s?l:1/l}};Fn.cc=Fn.closenessCentrality,Fn.ccn=Fn.closenessCentralityNormalised=Fn.closenessCentralityNormalized;var wv=ir({weight:null,directed:!1}),Ds={betweennessCentrality:function(e){for(var t=wv(e),n=t.directed,a=t.weight,i=null!=a,s=this.cy(),o=this.nodes(),l={},u={},c=0,d={set:function(C,A){u[C]=A,A>c&&(c=A)},get:function(C){return u[C]}},f=0;f<o.length;f++){var h=o[f],v=h.id();l[v]=n?h.outgoers().nodes():h.openNeighborhood().nodes(),d.set(v,0)}for(var b=function(){for(var C=o[p].id(),A=[],z={},H={},F={},j=new va(function(qe,je){return F[qe]-F[je]}),$=0;$<o.length;$++){var J=o[$].id();z[J]=[],H[J]=0,F[J]=1/0}for(H[C]=1,F[C]=0,j.push(C);!j.empty();){var K=j.pop();if(A.push(K),i)for(var Q=0;Q<l[K].length;Q++){var fe,ee=l[K][Q],ue=s.getElementById(K);fe=ue.edgesTo(ee).length>0?ue.edgesTo(ee)[0]:ee.edgesTo(ue)[0];var ve=a(fe);ee=ee.id(),F[ee]>F[K]+ve&&(F[ee]=F[K]+ve,j.nodes.indexOf(ee)<0?j.push(ee):j.updateItem(ee),H[ee]=0,z[ee]=[]),F[ee]==F[K]+ve&&(H[ee]=H[ee]+H[K],z[ee].push(K))}else for(var ce=0;ce<l[K].length;ce++){var pe=l[K][ce].id();F[pe]==1/0&&(j.push(pe),F[pe]=F[K]+1),F[pe]==F[K]+1&&(H[pe]=H[pe]+H[K],z[pe].push(K))}}for(var Se={},Ie=0;Ie<o.length;Ie++)Se[o[Ie].id()]=0;for(;A.length>0;){for(var me=A.pop(),De=0;De<z[me].length;De++){var Ue=z[me][De];Se[Ue]=Se[Ue]+H[Ue]/H[me]*(1+Se[me])}me!=o[p].id()&&d.set(me,d.get(me)+Se[me])}},p=0;p<o.length;p++)b();var g={betweenness:function(C){var A=s.collection(C).id();return d.get(A)},betweennessNormalized:function(C){if(0==c)return 0;var A=s.collection(C).id();return d.get(A)/c}};return g.betweennessNormalised=g.betweennessNormalized,g}};Ds.bc=Ds.betweennessCentrality;var Ev=ir({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),Cv=function(e,t){for(var n=0,a=0;a<t.length;a++)n+=t[a](e);return n},lu=function(e,t){for(var n,a=0;a<t;a++){n=0;for(var i=0;i<t;i++)n+=e[i*t+a];for(var s=0;s<t;s++)e[s*t+a]=e[s*t+a]/n}},Sv=function(e,t,n){for(var a=new Array(n*n),i=0;i<n;i++){for(var s=0;s<n;s++)a[i*n+s]=0;for(var o=0;o<n;o++)for(var l=0;l<n;l++)a[i*n+l]+=e[i*n+o]*t[o*n+l]}return a},Iv=function(e,t,n){for(var a=e.slice(0),i=1;i<n;i++)e=Sv(e,a,t);return e},Lv=function(e,t,n){for(var a=new Array(t*t),i=0;i<t*t;i++)a[i]=Math.pow(e[i],n);return lu(a,t),a},Av=function(e,t,n,a){for(var i=0;i<n;i++)if(Math.round(e[i]*Math.pow(10,a))/Math.pow(10,a)!==Math.round(t[i]*Math.pow(10,a))/Math.pow(10,a))return!1;return!0},Rv=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},uu=function(e){for(var t=this.nodes(),n=this.edges(),a=this.cy(),i=function(e){return Ev(e)}(e),s={},o=0;o<t.length;o++)s[t[o].id()]=o;for(var d,l=t.length,u=l*l,c=new Array(u),f=0;f<u;f++)c[f]=0;for(var h=0;h<n.length;h++){var v=n[h],b=s[v.source().id()],p=s[v.target().id()],g=Cv(v,i.attributes);c[b*l+p]+=g,c[p*l+b]+=g}(function(e,t,n){for(var a=0;a<t;a++)e[a*t+a]=n})(c,l,i.multFactor),lu(c,l);for(var x=!0,C=0;x&&C<i.maxIterations;)x=!1,d=Iv(c,l,i.expandFactor),c=Lv(d,l,i.inflateFactor),Av(c,d,u,4)||(x=!0),C++;var A=function(e,t,n,a){for(var i=[],s=0;s<t;s++){for(var o=[],l=0;l<t;l++)Math.round(1e3*e[s*t+l])/1e3>0&&o.push(n[l]);0!==o.length&&i.push(a.collection(o))}return i}(c,l,t,a);return A=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Rv(e[t],e[n])&&e.splice(n,1);return e}(A),A},Ov={markovClustering:uu,mcl:uu},_v=function(e){return e},cu=function(e,t){return Math.abs(t-e)},du=function(e,t,n){return e+cu(t,n)},fu=function(e,t,n){return e+Math.pow(n-t,2)},Pv=function(e){return Math.sqrt(e)},kv=function(e,t,n){return Math.max(e,cu(t,n))},ma=function(e,t,n,a,i){for(var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:_v,o=a,c=0;c<e;c++)o=i(o,t(c),n(c));return s(o)},Gn={euclidean:function(e,t,n){return e>=2?ma(e,t,n,0,fu,Pv):ma(e,t,n,0,du)},squaredEuclidean:function(e,t,n){return ma(e,t,n,0,fu)},manhattan:function(e,t,n){return ma(e,t,n,0,du)},max:function(e,t,n){return ma(e,t,n,-1/0,kv)}};function ai(r,e,t,n,a,i){var s;return s=ke(r)?r:Gn[r]||Gn.euclidean,0===e&&ke(r)?s(a,i):s(e,t,n,a,i)}Gn["squared-euclidean"]=Gn.squaredEuclidean,Gn.squaredeuclidean=Gn.squaredEuclidean;var Bv=ir({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Ss=function(e){return Bv(e)},ii=function(e,t,n,a,i){var o="kMedoids"!==i?function(d){return n[d]}:function(d){return a[d](n)};return ai(e,a.length,o,function(f){return a[f](t)},n,t)},Is=function(e,t,n){for(var a=n.length,i=new Array(a),s=new Array(a),o=new Array(t),l=null,u=0;u<a;u++)i[u]=e.min(n[u]).value,s[u]=e.max(n[u]).value;for(var c=0;c<t;c++){l=[];for(var d=0;d<a;d++)l[d]=Math.random()*(s[d]-i[d])+i[d];o[c]=l}return o},hu=function(e,t,n,a,i){for(var s=1/0,o=0,l=0;l<t.length;l++){var u=ii(n,e,t[l],a,i);u<s&&(s=u,o=l)}return o},vu=function(e,t,n){for(var a=[],i=null,s=0;s<t.length;s++)n[(i=t[s]).id()]===e&&a.push(i);return a},Fv=function(e,t,n){return Math.abs(t-e)<=n},Gv=function(e,t,n){for(var a=0;a<e.length;a++)for(var i=0;i<e[a].length;i++)if(Math.abs(e[a][i]-t[a][i])>n)return!1;return!0},zv=function(e,t,n){for(var a=0;a<n;a++)if(e===t[a])return!0;return!1},gu=function(e,t){var n=new Array(t);if(e.length<50)for(var a=0;a<t;a++){for(var i=e[Math.floor(Math.random()*e.length)];zv(i,n,a);)i=e[Math.floor(Math.random()*e.length)];n[a]=i}else for(var s=0;s<t;s++)n[s]=e[Math.floor(Math.random()*e.length)];return n},pu=function(e,t,n){for(var a=0,i=0;i<t.length;i++)a+=ii("manhattan",t[i],e,n,"kMedoids");return a},Uv=function(e,t,n,a,i){for(var s,o,l=0;l<t.length;l++)for(var u=0;u<e.length;u++)a[l][u]=Math.pow(n[l][u],i.m);for(var c=0;c<e.length;c++)for(var d=0;d<i.attributes.length;d++){s=0,o=0;for(var f=0;f<t.length;f++)s+=a[f][c]*i.attributes[d](t[f]),o+=a[f][c];e[c][d]=s/o}},jv=function(e,t,n,a,i){for(var s=0;s<e.length;s++)t[s]=e[s].slice();for(var o,l,u,c=2/(i.m-1),d=0;d<n.length;d++)for(var f=0;f<a.length;f++){o=0;for(var h=0;h<n.length;h++)l=ii(i.distance,a[f],n[d],i.attributes,"cmeans"),u=ii(i.distance,a[f],n[h],i.attributes,"cmeans"),o+=Math.pow(l/u,c);e[f][d]=1/o}},yu=function(e){var i,s,o,l,u,t=this.cy(),n=this.nodes(),a=Ss(e);l=new Array(n.length);for(var c=0;c<n.length;c++)l[c]=new Array(a.k);o=new Array(n.length);for(var d=0;d<n.length;d++)o[d]=new Array(a.k);for(var f=0;f<n.length;f++){for(var h=0,v=0;v<a.k;v++)o[f][v]=Math.random(),h+=o[f][v];for(var b=0;b<a.k;b++)o[f][b]=o[f][b]/h}s=new Array(a.k);for(var p=0;p<a.k;p++)s[p]=new Array(a.attributes.length);u=new Array(n.length);for(var g=0;g<n.length;g++)u[g]=new Array(a.k);for(var x=!0,C=0;x&&C<a.maxIterations;)x=!1,Uv(s,n,o,u,a),jv(o,l,s,n,a),Gv(o,l,a.sensitivityThreshold)||(x=!0),C++;return i=function(e,t,n,a){for(var i=new Array(n.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<t.length;u++){o=-1/0,l=-1;for(var c=0;c<t[0].length;c++)t[u][c]>o&&(o=t[u][c],l=c);i[l].push(e[u])}for(var d=0;d<i.length;d++)i[d]=a.collection(i[d]);return i}(n,o,a,t),{clusters:i,degreeOfMembership:o}},Wv={kMeans:function(e){var l,t=this.cy(),n=this.nodes(),a=null,i=Ss(e),s=new Array(i.k),o={};l=i.testMode?"number"==typeof i.testCentroids?Is(n,i.k,i.attributes):"object"===ye(i.testCentroids)?i.testCentroids:Is(n,i.k,i.attributes):Is(n,i.k,i.attributes);for(var u=!0,c=0;u&&c<i.maxIterations;){for(var d=0;d<n.length;d++)o[(a=n[d]).id()]=hu(a,l,i.distance,i.attributes,"kMeans");u=!1;for(var f=0;f<i.k;f++){var h=vu(f,n,o);if(0!==h.length){for(var v=i.attributes.length,b=l[f],p=new Array(v),g=new Array(v),x=0;x<v;x++){g[x]=0;for(var C=0;C<h.length;C++)g[x]+=i.attributes[x](a=h[C]);p[x]=g[x]/h.length,Fv(p[x],b[x],i.sensitivityThreshold)||(u=!0)}l[f]=p,s[f]=t.collection(h)}}c++}return s},kMedoids:function(e){var o,u,t=this.cy(),n=this.nodes(),a=null,i=Ss(e),s=new Array(i.k),l={},c=new Array(i.k);i.testMode?"number"==typeof i.testCentroids||(o="object"===ye(i.testCentroids)?i.testCentroids:gu(n,i.k)):o=gu(n,i.k);for(var d=!0,f=0;d&&f<i.maxIterations;){for(var h=0;h<n.length;h++)l[(a=n[h]).id()]=hu(a,o,i.distance,i.attributes,"kMedoids");d=!1;for(var v=0;v<o.length;v++){var b=vu(v,n,l);if(0!==b.length){c[v]=pu(o[v],b,i.attributes);for(var p=0;p<b.length;p++)(u=pu(b[p],b,i.attributes))<c[v]&&(c[v]=u,o[v]=b[p],d=!0);s[v]=t.collection(b)}}f++}return s},fuzzyCMeans:yu,fcm:yu},Yv=ir({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),$v={single:"min",complete:"max"},mu=function(e,t,n,a,i){for(var l,s=0,o=1/0,u=i.attributes,c=function($,J){return ai(i.distance,u.length,function(K){return u[K]($)},function(K){return u[K](J)},$,J)},d=0;d<e.length;d++){var f=e[d].key,h=n[f][a[f]];h<o&&(s=f,o=h)}if("threshold"===i.mode&&o>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,v=t[s],b=t[a[s]];p="dendrogram"===i.mode?{left:v,right:b,key:v.key}:{value:v.value.concat(b.value),key:v.key},e[v.index]=p,e.splice(b.index,1),t[v.key]=p;for(var g=0;g<e.length;g++){var x=e[g];v.key===x.key?l=1/0:"min"===i.linkage?(l=n[v.key][x.key],n[v.key][x.key]>n[b.key][x.key]&&(l=n[b.key][x.key])):"max"===i.linkage?(l=n[v.key][x.key],n[v.key][x.key]<n[b.key][x.key]&&(l=n[b.key][x.key])):l="mean"===i.linkage?(n[v.key][x.key]*v.size+n[b.key][x.key]*b.size)/(v.size+b.size):"dendrogram"===i.mode?c(x.value,v.value):c(x.value[0],v.value[0]),n[v.key][x.key]=n[x.key][v.key]=l}for(var C=0;C<e.length;C++){var A=e[C].key;if(a[A]===v.key||a[A]===b.key){for(var z=A,H=0;H<e.length;H++){var F=e[H].key;n[A][F]<n[A][z]&&(z=F)}a[A]=z}e[C].index=C}return v.key=b.key=v.index=b.index=null,!0},zn=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&zn(e.left,t),e.right&&zn(e.right,t)))},Ls=function(e,t){if(!e)return"";if(e.left&&e.right){var n=Ls(e.left,t),a=Ls(e.right,t),i=t.add({group:"nodes",data:{id:n+","+a}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}return e.value?e.value.id():void 0},As=function(e,t,n){if(!e)return[];var a=[],i=[],s=[];return 0===t?(e.left&&zn(e.left,a),e.right&&zn(e.right,i),s=a.concat(i),[n.collection(s)]):1===t?e.value?[n.collection(e.value)]:(e.left&&zn(e.left,a),e.right&&zn(e.right,i),[n.collection(a),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(a=As(e.left,t-1,n)),e.right&&(i=As(e.right,t-1,n)),a.concat(i))},bu=function(e){for(var t=this.cy(),n=this.nodes(),a=function(e){var t=Yv(e),n=$v[t.linkage];return null!=n&&(t.linkage=n),t}(e),i=a.attributes,s=function(C,A){return ai(a.distance,i.length,function(z){return i[z](C)},function(z){return i[z](A)},C,A)},o=[],l=[],u=[],c=[],d=0;d<n.length;d++){var f={value:"dendrogram"===a.mode?n[d]:[n[d]],key:d,index:d};o[d]=f,c[d]=f,l[d]=[],u[d]=0}for(var h=0;h<o.length;h++)for(var v=0;v<=h;v++){var b;b="dendrogram"===a.mode?h===v?1/0:s(o[h].value,o[v].value):h===v?1/0:s(o[h].value[0],o[v].value[0]),l[h][v]=b,l[v][h]=b,b<l[h][u[h]]&&(u[h]=v)}for(var p=mu(o,c,l,u,a);p;)p=mu(o,c,l,u,a);var g;return"dendrogram"===a.mode?(g=As(o[0],a.dendrogramDepth,t),a.addDendrogram&&Ls(o[0],t)):(g=new Array(o.length),o.forEach(function(x,C){x.key=x.index=null,g[C]=t.collection(x.value)})),g},Kv={hierarchicalClustering:bu,hca:bu},Zv=ir({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Qv=function(e,t,n,a){var i=function(o,l){return a[l](o)};return-ai(e,a.length,function(s){return i(t,s)},function(s){return i(n,s)},t,n)},xu=function(e,t,n){for(var a=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<n.length;l++){var u=n[l];t[i*e+u]>o&&(s=u,o=t[i*e+u])}s>0&&a.push(s)}for(var c=0;c<n.length;c++)a[n[c]]=n[c];return a},wu=function(e){for(var t=this.cy(),n=this.nodes(),a=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||jt("Damping must range on [0.5, 1). Got: ".concat(t));var a=["median","mean","min","max"];return a.some(function(i){return i===n})||Be(n)||jt("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(n)),Zv(e)}(e),i={},s=0;s<n.length;s++)i[n[s].id()]=s;var o,l,u,c,d,f,$;l=(o=n.length)*o,u=new Array(l);for(var h=0;h<l;h++)u[h]=-1/0;for(var v=0;v<o;v++)for(var b=0;b<o;b++)v!==b&&(u[v*o+b]=Qv(a.distance,n[v],n[b],a.attributes));c=function(e,t){var n;return n="median"===t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t)):e=e.slice(t,n);for(var o=0,l=e.length-1;l>=0;l--)s?isFinite(e[l])||(e[l]=-1/0,o++):e.splice(l,1);i&&e.sort(function(f,h){return f-h});var c=e.length,d=Math.floor(c/2);return c%2!=0?e[d+1+o]:(e[d-1+o]+e[d+o])/2}(e):"mean"===t?function(e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,a=0,i=0,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s<n;s++){var o=e[s];isFinite(o)&&(a+=o,i++)}return a/i}(e):"min"===t?function(e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,a=1/0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i<n;i++){var s=e[i];isFinite(s)&&(a=Math.min(s,a))}return a}(e):"max"===t?function(e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,a=-1/0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;i<n;i++){var s=e[i];isFinite(s)&&(a=Math.max(s,a))}return a}(e):t,n}(u,a.preference);for(var p=0;p<o;p++)u[p*o+p]=c;d=new Array(l);for(var g=0;g<l;g++)d[g]=0;f=new Array(l);for(var x=0;x<l;x++)f[x]=0;for(var C=new Array(o),A=new Array(o),z=new Array(o),H=0;H<o;H++)C[H]=0,A[H]=0,z[H]=0;for(var F=new Array(o*a.minIterations),j=0;j<F.length;j++)F[j]=0;for($=0;$<a.maxIterations;$++){for(var J=0;J<o;J++){for(var K=-1/0,Q=-1/0,ee=-1,ue=0,fe=0;fe<o;fe++)C[fe]=d[J*o+fe],(ue=f[J*o+fe]+u[J*o+fe])>=K?(Q=K,K=ue,ee=fe):ue>Q&&(Q=ue);for(var ve=0;ve<o;ve++)d[J*o+ve]=(1-a.damping)*(u[J*o+ve]-K)+a.damping*C[ve];d[J*o+ee]=(1-a.damping)*(u[J*o+ee]-Q)+a.damping*C[ee]}for(var ce=0;ce<o;ce++){for(var pe=0,Se=0;Se<o;Se++)C[Se]=f[Se*o+ce],A[Se]=Math.max(0,d[Se*o+ce]),pe+=A[Se];pe-=A[ce],A[ce]=d[ce*o+ce],pe+=A[ce];for(var Ie=0;Ie<o;Ie++)f[Ie*o+ce]=(1-a.damping)*Math.min(0,pe-A[Ie])+a.damping*C[Ie];f[ce*o+ce]=(1-a.damping)*(pe-A[ce])+a.damping*C[ce]}for(var me=0,De=0;De<o;De++){var Ue=f[De*o+De]+d[De*o+De]>0?1:0;F[$%a.minIterations*o+De]=Ue,me+=Ue}if(me>0&&($>=a.minIterations-1||$==a.maxIterations-1)){for(var qe=0,je=0;je<o;je++){z[je]=0;for(var Je=0;Je<a.minIterations;Je++)z[je]+=F[Je*o+je];(0===z[je]||z[je]===a.minIterations)&&qe++}if(qe===o)break}}for(var tt=function(e,t,n){for(var a=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&a.push(i);return a}(o,d,f),at=function(e,t,n){for(var a=xu(e,t,n),i=0;i<n.length;i++){for(var s=[],o=0;o<a.length;o++)a[o]===n[i]&&s.push(o);for(var l=-1,u=-1/0,c=0;c<s.length;c++){for(var d=0,f=0;f<s.length;f++)d+=t[s[f]*e+s[c]];d>u&&(l=c,u=d)}n[i]=s[l]}return xu(e,t,n)}(o,u,tt),He={},Ce=0;Ce<tt.length;Ce++)He[tt[Ce]]=[];for(var Ae=0;Ae<n.length;Ae++){var ze=at[i[n[Ae].id()]];null!=ze&&He[ze].push(n[Ae])}for(var rt=new Array(tt.length),ct=0;ct<tt.length;ct++)rt[ct]=t.collection(He[tt[ct]]);return rt},ng={affinityPropagation:wu,ap:wu},ag=ir({root:void 0,directed:!1}),ig={hierholzer:function(e){if(!Oe(e)){var t=arguments;e={root:t[0],directed:t[1]}}var l,u,c,n=ag(e),a=n.root,i=n.directed,s=this,o=!1;a&&(c=le(a)?this.filter(a)[0].id():a[0].id());var d={},f={};s.forEach(i?function(x){var C=x.id();if(x.isNode()){var A=x.indegree(!0),z=x.outdegree(!0),H=A-z,F=z-A;1==H?l?o=!0:l=C:1==F?u?o=!0:u=C:(F>1||H>1)&&(o=!0),d[C]=[],x.outgoers().forEach(function(j){j.isEdge()&&d[C].push(j.id())})}else f[C]=[void 0,x.target().id()]}:function(x){var C=x.id();x.isNode()?(x.degree(!0)%2&&(l?u?o=!0:u=C:l=C),d[C]=[],x.connectedEdges().forEach(function(z){return d[C].push(z.id())})):f[C]=[x.source().id(),x.target().id()]});var h={found:!1,trail:void 0};if(o)return h;if(u&&l)if(i){if(c&&u!=c)return h;c=u}else{if(c&&u!=c&&l!=c)return h;c||(c=u)}else c||(c=s[0].id());var v=function(C){for(var H,F,j,A=C,z=[C];d[A].length;)H=d[A].shift(),F=f[H][0],A!=(j=f[H][1])?(d[j]=d[j].filter(function($){return $!=H}),A=j):!i&&A!=F&&(d[F]=d[F].filter(function($){return $!=H}),A=F),z.unshift(H),z.unshift(A);return z},b=[],p=[];for(p=v(c);1!=p.length;)0==d[p[0]].length?(b.unshift(s.getElementById(p.shift())),b.unshift(s.getElementById(p.shift()))):p=v(p.shift()).concat(p);for(var g in b.unshift(s.getElementById(p.shift())),d)if(d[g].length)return h;return h.found=!0,h.trail=this.spawn(b,!0),h}},si=function(){var e=this,t={},n=0,a=0,i=[],s=[],o={},u=function(f,h,v){f===v&&(a+=1),t[h]={id:n,low:n++,cutVertex:!1};var p,g,x,C,b=e.getElementById(h).connectedEdges().intersection(e);0===b.size()?i.push(e.spawn(e.getElementById(h))):b.forEach(function(A){p=A.source().id(),g=A.target().id(),(x=p===h?g:p)!==v&&(C=A.id(),o[C]||(o[C]=!0,s.push({x:h,y:x,edge:A})),x in t?t[h].low=Math.min(t[h].low,t[x].id):(u(f,x,h),t[h].low=Math.min(t[h].low,t[x].low),t[h].id<=t[x].low&&(t[h].cutVertex=!0,function(f,h){for(var v=s.length-1,b=[],p=e.spawn();s[v].x!=f||s[v].y!=h;)b.push(s.pop().edge),v--;b.push(s.pop().edge),b.forEach(function(g){var x=g.connectedNodes().intersection(e);p.merge(g),x.forEach(function(C){var A=C.id(),z=C.connectedEdges().intersection(e);p.merge(C),p.merge(t[A].cutVertex?z.filter(function(H){return H.isLoop()}):z)})}),i.push(p)}(h,x))))})};e.forEach(function(d){if(d.isNode()){var f=d.id();f in t||(a=0,u(f,f),t[f].cutVertex=a>1)}});var c=Object.keys(t).filter(function(d){return t[d].cutVertex}).map(function(d){return e.getElementById(d)});return{cut:e.spawn(c),components:i}},oi=function(){var e=this,t={},n=0,a=[],i=[],s=e.spawn(e),o=function(u){if(i.push(u),t[u]={index:n,low:n++,explored:!1},e.getElementById(u).connectedEdges().intersection(e).forEach(function(b){var p=b.target().id();p!==u&&(p in t||o(p),t[p].explored||(t[u].low=Math.min(t[u].low,t[p].low)))}),t[u].index===t[u].low){for(var d=e.spawn();;){var f=i.pop();if(d.merge(e.getElementById(f)),t[f].low=t[u].index,t[f].explored=!0,f===u)break}var h=d.edgesWith(d),v=d.merge(h);a.push(v),s=s.difference(v)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||o(u)}}),{cut:s,components:a}},Eu={};[ha,Bh,Fh,zh,Hh,jh,Yh,xv,Bn,Fn,Ds,Ov,Wv,Kv,ng,ig,{hopcroftTarjanBiconnected:si,htbc:si,htb:si,hopcroftTarjanBiconnectedComponents:si},{tarjanStronglyConnected:oi,tsc:oi,tscc:oi,tarjanStronglyConnectedComponents:oi}].forEach(function(r){mt(Eu,r)});var Ir=function(e){if(!(this instanceof Ir))return new Ir(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Ir.prototype={fulfill:function(e){return Su(this,1,"fulfillValue",e)},reject:function(e){return Su(this,2,"rejectReason",e)},then:function(e,t){var n=this,a=new Ir;return n.onFulfilled.push(Au(e,a,"fulfill")),n.onRejected.push(Au(t,a,"reject")),Iu(n),a.proxy}};var Su=function(e,t,n,a){return 0===e.state&&(e.state=t,e[n]=a,Iu(e)),e},Iu=function(e){1===e.state?Lu(e,"onFulfilled",e.fulfillValue):2===e.state&&Lu(e,"onRejected",e.rejectReason)},Lu=function(e,t,n){if(0!==e[t].length){var a=e[t];e[t]=[];var i=function(){for(var o=0;o<a.length;o++)a[o](n)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},Au=function(e,t,n){return function(a){if("function"!=typeof e)t[n].call(t,a);else{var i;try{i=e(a)}catch(s){return void t.reject(s)}Nu(t,i)}}},Nu=function(e,t){if(e!==t&&e.proxy!==t){var n;if("object"===ye(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(i){return void e.reject(i)}if("function"!=typeof n)e.fulfill(t);else{var a=!1;try{n.call(t,function(i){a||(a=!0,i===t?e.reject(new TypeError("circular thenable chain")):Nu(e,i))},function(i){a||(a=!0,e.reject(i))})}catch(i){a||e.reject(i)}}}else e.reject(new TypeError("cannot resolve promise with itself"))};Ir.all=function(r){return new Ir(function(e,t){for(var n=new Array(r.length),a=0,i=function(l,u){n[l]=u,++a===r.length&&e(n)},s=0;s<r.length;s++)(function(o){var l=r[o];null!=l&&null!=l.then?l.then(function(d){i(o,d)},function(d){t(d)}):i(o,l)})(s)})},Ir.resolve=function(r){return new Ir(function(e,t){e(r)})},Ir.reject=function(r){return new Ir(function(e,t){t(r)})};var Vn=typeof Promise<"u"?Promise:Ir,Ns=function(e,t,n){var a=wr(e),i=!a,s=this._private=mt({duration:1e3},t,n);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&ke(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(a){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},En=Ns.prototype;mt(En,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var n=e.target._private.animation;(e.queue?n.queue:n.current).push(this),vt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(u,c){var d=e[u];null!=d&&(e[u]=e[c],e[c]=d)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var a=0;a<e.style.length;a++){var i=e.style[a],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[a]=o}return t&&this.play(),this},promise:function(e){var n,t=this._private;return n="frame"===e?t.frames:t.completes,new Vn(function(a,i){n.push(function(){a()})})}}),En.complete=En.completed,En.run=En.play,En.running=En.playing;var Rs,Ru,Ms,Mu,Os,Ou,_s,_u,Ps,Pu,ks,ku,Bs,Bu,Fs,Fu,Gs,Gu,Vs,zu,Hs,Vu,Us,Hu,js,Uu,Xs,ju,Ws,Xu,Ys,Wu,$s,Yu,qs,$u,Ks,Ku,Zs,Zu,Js,Ju,Qs,Qu,eo,ec,to,tc,ro,rc,no,nc,ao,ac,io,ic,so,sc,oo,oc,lo,lc,uo,uc,co,cc,fo,dc,ho,fc,vo,hc,go,gc,po,yc,yo,mc,mo,xc,bo,Ec,wo,Tc,Eo,Cc,lg={animated:function(){return function(){var t=this,a=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return!1;var s=a[0];return s?s._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var t=this,a=void 0!==t.length?t:[t];if(!(this._private.cy||this).styleEnabled())return this;for(var s=0;s<a.length;s++)a[s]._private.animation.queue=[];return this}},delay:function(){return function(t,n){return(this._private.cy||this).styleEnabled()?this.animate({delay:t,duration:t,complete:n}):this}},delayAnimation:function(){return function(t,n){return(this._private.cy||this).styleEnabled()?this.animation({delay:t,duration:t,complete:n}):this}},animation:function(){return function(t,n){var a=this,i=void 0!==a.length,s=i?a:[a],o=this._private.cy||this,l=!i,u=!l;if(!o.styleEnabled())return this;var c=o.style();if(t=mt({},t,n),0===Object.keys(t).length)return new Ns(s[0],t);switch(void 0===t.duration&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200}if(u&&(t.style=c.getPropsList(t.style||t.css),t.css=void 0),u&&null!=t.renderedPosition){var f=t.renderedPosition,h=o.pan(),v=o.zoom();t.position=Jl(f,v,h)}if(l&&null!=t.panBy){var b=t.panBy,p=o.pan();t.pan={x:p.x+b.x,y:p.y+b.y}}var g=t.center||t.centre;if(l&&null!=g){var x=o.getCenterPan(g.eles,t.zoom);null!=x&&(t.pan=x)}if(l&&null!=t.fit){var C=t.fit,A=o.getFitViewport(C.eles||C.boundingBox,C.padding);null!=A&&(t.pan=A.pan,t.zoom=A.zoom)}if(l&&Oe(t.zoom)){var z=o.getZoomedViewport(t.zoom);null!=z?(z.zoomed&&(t.zoom=z.zoom),z.panned&&(t.pan=z.pan)):t.zoom=null}return new Ns(s[0],t)}},animate:function(){return function(t,n){var a=this,s=void 0!==a.length?a:[a];if(!(this._private.cy||this).styleEnabled())return this;n&&(t=mt({},t,n));for(var l=0;l<s.length;l++){var u=s[l],c=u.animated()&&(void 0===t.queue||t.queue);u.animation(t,c?{queue:!0}:void 0).play()}return this}},stop:function(){return function(t,n){var a=this,s=void 0!==a.length?a:[a],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var c=s[l]._private,d=c.animation.current,f=0;f<d.length;f++)n&&(d[f]._private.duration=0);t&&(c.animation.queue=[]),n||(c.animation.current=[])}return o.notify("draw"),this}}};function li(){return Ru?Rs:(Ru=1,Rs=Array.isArray)}function vg(){if(Bu)return Bs;Bu=1;var r=function cg(){if(Ou)return Os;Ou=1;var r=Ol(),e=la();return Os=function s(o){if(!e(o))return!1;var l=r(o);return"[object Function]"==l||"[object GeneratorFunction]"==l||"[object AsyncFunction]"==l||"[object Proxy]"==l}}(),e=function fg(){if(Pu)return Ps;Pu=1;var n,r=function dg(){if(_u)return _s;_u=1;var r=Xa();return _s=r["__core-js_shared__"]}(),e=(n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";return Ps=function t(n){return!!e&&e in n},Ps}(),t=la(),n=function hg(){if(ku)return ks;ku=1;var e=Function.prototype.toString;return ks=function t(n){if(null!=n){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}}(),i=/^\[object .+?Constructor\]$/,c=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Bs=function d(f){return!(!t(f)||e(f))&&(r(f)?c:i).test(n(f))}}function zs(){if(Gu)return Gs;Gu=1;var r=vg(),e=function gg(){return Fu?Fs:(Fu=1,Fs=function r(e,t){return e?.[t]})}();return Gs=function t(n,a){var i=e(n,a);return r(i)?i:void 0}}function ui(){if(zu)return Vs;zu=1;var e=zs()(Object,"create");return Vs=e}function qu(){return $u?qs:($u=1,qs=function r(e,t){return e===t||e!=e&&t!=t})}function ci(){if(Ku)return Ks;Ku=1;var r=qu();return Ks=function e(t,n){for(var a=t.length;a--;)if(r(t[a][0],n))return a;return-1}}function Ag(){if(nc)return no;nc=1;var r=function wg(){if(Wu)return Ys;Wu=1;var r=function pg(){if(Vu)return Hs;Vu=1;var r=ui();return Hs=function e(){this.__data__=r?r(null):{},this.size=0}}(),e=function yg(){return Hu?Us:(Hu=1,Us=function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t})}(),t=function mg(){if(Uu)return js;Uu=1;var r=ui(),n=Object.prototype.hasOwnProperty;return js=function a(i){var s=this.__data__;if(r){var o=s[i];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(s,i)?s[i]:void 0}}(),n=function bg(){if(ju)return Xs;ju=1;var r=ui(),t=Object.prototype.hasOwnProperty;return Xs=function n(a){var i=this.__data__;return r?void 0!==i[a]:t.call(i,a)}}(),a=function xg(){if(Xu)return Ws;Xu=1;var r=ui();return Ws=function t(n,a){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=r&&void 0===a?"__lodash_hash_undefined__":a,this}}();function i(s){var o=-1,l=null==s?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,Ys=i}(),e=function Ig(){if(tc)return to;tc=1;var r=function Eg(){return Yu?$s:(Yu=1,$s=function r(){this.__data__=[],this.size=0})}(),e=function Tg(){if(Zu)return Zs;Zu=1;var r=ci(),t=Array.prototype.splice;return Zs=function n(a){var i=this.__data__,s=r(i,a);return!(s<0||(s==i.length-1?i.pop():t.call(i,s,1),--this.size,0))}}(),t=function Cg(){if(Ju)return Js;Ju=1;var r=ci();return Js=function e(t){var n=this.__data__,a=r(n,t);return a<0?void 0:n[a][1]}}(),n=function Dg(){if(Qu)return Qs;Qu=1;var r=ci();return Qs=function e(t){return r(this.__data__,t)>-1}}(),a=function Sg(){if(ec)return eo;ec=1;var r=ci();return eo=function e(t,n){var a=this.__data__,i=r(a,t);return i<0?(++this.size,a.push([t,n])):a[i][1]=n,this}}();function i(s){var o=-1,l=null==s?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,to=i}(),t=function Lg(){if(rc)return ro;rc=1;var t=zs()(Xa(),"Map");return ro=t}();return no=function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}}function di(){if(ic)return io;ic=1;var r=function Ng(){return ac?ao:(ac=1,ao=function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e})}();return io=function e(t,n){var a=t.__data__;return r(n)?a["string"==typeof n?"string":"hash"]:a.map}}function Bg(){if(fc)return ho;fc=1;var r=function kg(){if(dc)return fo;dc=1;var r=function Pg(){if(cc)return co;cc=1;var r=Ag(),e=function Rg(){if(sc)return so;sc=1;var r=di();return so=function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}}(),t=function Mg(){if(oc)return oo;oc=1;var r=di();return oo=function e(t){return r(this,t).get(t)}}(),n=function Og(){if(lc)return lo;lc=1;var r=di();return lo=function e(t){return r(this,t).has(t)}}(),a=function _g(){if(uc)return uo;uc=1;var r=di();return uo=function e(t,n){var a=r(this,t),i=a.size;return a.set(t,n),this.size+=a.size==i?0:1,this}}();function i(s){var o=-1,l=null==s?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=n,i.prototype.set=a,co=i}();function t(n,a){if("function"!=typeof n||null!=a&&"function"!=typeof a)throw new TypeError("Expected a function");var i=function(){var s=arguments,o=a?a.apply(this,s):s[0],l=i.cache;if(l.has(o))return l.get(o);var u=n.apply(this,s);return i.cache=l.set(o,u)||l,u};return i.cache=new(t.Cache||r),i}return t.Cache=r,fo=t}();return ho=function t(n){var a=r(n,function(s){return 500===i.size&&i.clear(),s}),i=a.cache;return a}}function vc(){if(hc)return vo;hc=1;var r=Bg(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=r(function(a){var i=[];return 46===a.charCodeAt(0)&&i.push(""),a.replace(e,function(s,o,l,u){i.push(l?u.replace(t,"$1"):o||s)}),i});return vo=n}function pc(){return gc?go:(gc=1,go=function r(e,t){for(var n=-1,a=null==e?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i})}function bc(){if(mc)return yo;mc=1;var r=function Fg(){if(yc)return po;yc=1;var r=rs(),e=pc(),t=li(),n=ua(),a=r?r.prototype:void 0,i=a?a.toString:void 0;return po=function s(o){if("string"==typeof o)return o;if(t(o))return e(o,s)+"";if(n(o))return i?i.call(o):"";var l=o+"";return"0"==l&&1/o==-1/0?"-0":l}}();return yo=function e(t){return null==t?"":r(t)}}function wc(){if(xc)return mo;xc=1;var r=li(),e=function ug(){if(Mu)return Ms;Mu=1;var r=li(),e=ua(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Ms=function a(i,s){if(r(i))return!1;var o=typeof i;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=i&&!e(i))||n.test(i)||!t.test(i)||null!=s&&i in Object(s)}}(),t=vc(),n=bc();return mo=function a(i,s){return r(i)?i:e(i,s)?[i]:t(n(i))}}function xo(){if(Ec)return bo;Ec=1;var r=ua();return bo=function e(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}var To,Dc,Co,Sc,Do,Ic,So,Lc,Io,Ac,Lo,Nc,Vg=function zg(){if(Cc)return Eo;Cc=1;var r=function Gg(){if(Tc)return wo;Tc=1;var r=wc(),e=xo();return wo=function t(n,a){for(var i=0,s=(a=r(a,n)).length;null!=n&&i<s;)n=n[e(a[i++])];return i&&i==s?n:void 0}}();return Eo=function e(t,n,a){var i=null==t?void 0:r(t,n);return void 0===i?a:i}}(),Hg=oa(Vg);function Yg(){if(Ac)return Io;Ac=1;var r=function Xg(){if(Ic)return Do;Ic=1;var r=function jg(){if(Sc)return Co;Sc=1;var r=function Ug(){if(Dc)return To;Dc=1;var r=zs(),e=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}}();return To=e}();return Co=function e(t,n,a){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):t[n]=a}}(),e=qu(),n=Object.prototype.hasOwnProperty;return Do=function a(i,s,o){var l=i[s];(!n.call(i,s)||!e(l,o)||void 0===o&&!(s in i))&&r(i,s,o)}}(),e=wc(),t=function Wg(){if(Lc)return So;Lc=1;var e=/^(?:0|[1-9]\d*)$/;return So=function t(n,a){var i=typeof n;return!!(a=a??9007199254740991)&&("number"==i||"symbol"!=i&&e.test(n))&&n>-1&&n%1==0&&n<a}}(),n=la(),a=xo();return Io=function i(s,o,l,u){if(!n(s))return s;for(var c=-1,d=(o=e(o,s)).length,f=d-1,h=s;null!=h&&++c<d;){var v=a(o[c]),b=l;if("__proto__"===v||"constructor"===v||"prototype"===v)return s;if(c!=f){var p=h[v];void 0===(b=u?u(p,v,h):void 0)&&(b=n(p)?p:t(o[c+1])?[]:{})}r(h,v,b),h=h[v]}return s}}var Ao,Rc,No,Mc,Kg=oa(function $g(){if(Nc)return Lo;Nc=1;var r=Yg();return Lo=function e(t,n,a){return null==t?t:r(t,n,a)}}()),Qg=function Jg(){if(Mc)return No;Mc=1;var r=pc(),e=function Zg(){return Rc?Ao:(Rc=1,Ao=function r(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t})}(),t=li(),n=ua(),a=vc(),i=xo(),s=bc();return No=function o(l){return t(l)?r(l,i):n(l)?[l]:e(a(s(l)))}}(),ep=oa(Qg),tp={data:function(e){return e=mt({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,i){},onSet:function(a){},canSet:function(a){return!0}},e),function(a,i){var s=e,o=this,l=void 0!==o.length,u=l?o:[o],c=l?o[0]:o;if(le(a)){var h,f=-1!==a.indexOf(".")&&ep(a);if(s.allowGetting&&void 0===i)return c&&(s.beforeGet(c),h=f&&void 0===c._private[s.field][a]?Hg(c._private[s.field],f):c._private[s.field][a]),h;if(s.allowSetting&&void 0!==i&&!s.immutableKeys[a]){var b=ie({},a,i);s.beforeSet(o,b);for(var p=0,g=u.length;p<g;p++){var x=u[p];s.canSet(x)&&(f&&void 0===c._private[s.field][a]?Kg(x._private[s.field],f,i):x._private[s.field][a]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}else if(s.allowSetting&&Oe(a)){var A,z,C=a,H=Object.keys(C);s.beforeSet(o,C);for(var F=0;F<H.length;F++)if(z=C[A=H[F]],!s.immutableKeys[A])for(var $=0;$<u.length;$++){var J=u[$];s.canSet(J)&&(J._private[s.field][A]=z)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&ke(a))o.on(s.bindingEvent,a);else if(s.allowGetting&&void 0===a){var Q;return c&&(s.beforeGet(c),Q=c._private[s.field]),Q}return o}},removeData:function(e){return e=mt({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(a){var i=e,s=this,l=void 0!==s.length?s:[s];if(le(a)){for(var u=a.split(/\s+/),c=u.length,d=0;d<c;d++){var f=u[d];if(!Sr(f)&&!i.immutableKeys[f])for(var v=0,b=l.length;v<b;v++)l[v]._private[i.field][f]=void 0}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(void 0===a){for(var p=0,g=l.length;p<g;p++)for(var x=l[p]._private[i.field],C=Object.keys(x),A=0;A<C.length;A++){var z=C[A];!i.immutableKeys[z]&&(x[z]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},rp={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(n,a){var i=this,s=Array.prototype.slice.call(arguments,0);return new Vn(function(o,l){var c=s.concat([function(h){i.off.apply(i,d),o(h)}]),d=c.concat([]);i.on.apply(i,c)})}}},Ft={};[lg,tp,rp].forEach(function(r){mt(Ft,r)});var np={animate:Ft.animate(),animation:Ft.animation(),animated:Ft.animated(),clearQueue:Ft.clearQueue(),delay:Ft.delay(),delayAnimation:Ft.delayAnimation(),stop:Ft.stop()},fi={classes:function(e){var t=this;if(void 0===e){var n=[];return t[0]._private.classes.forEach(function(v){return n.push(v)}),n}We(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new _n(e),s=0;s<t.length;s++){for(var o=t[s],l=o._private,u=l.classes,c=!1,d=0;d<e.length;d++)if(!u.has(e[d])){c=!0;break}c||(c=u.size!==e.length),c&&(l.classes=i,a.push(o))}return a.length>0&&this.spawn(a).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){We(e)||(e=e.match(/\S+/g)||[]);for(var n=this,a=void 0===t,i=[],s=0,o=n.length;s<o;s++)for(var l=n[s],u=l._private.classes,c=!1,d=0;d<e.length;d++){var f=e[d],h=u.has(f),v=!1;t||a&&!h?(u.add(f),v=!0):(!t||a&&h)&&(u.delete(f),v=!0),!c&&v&&(i.push(l),c=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};fi.className=fi.classNames=fi.classes;var Ot={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:Jt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ot.variable="(?:[\\w-.]|(?:\\\\"+Ot.metaChar+"))+",Ot.className="(?:[\\w-]|(?:\\\\"+Ot.metaChar+"))+",Ot.value=Ot.string+"|"+Ot.number,Ot.id=Ot.variable,function(){var r,e,t;for(r=Ot.comparatorOp.split("|"),t=0;t<r.length;t++)Ot.comparatorOp+="|@"+(e=r[t]);for(r=Ot.comparatorOp.split("|"),t=0;t<r.length;t++)!((e=r[t]).indexOf("!")>=0)&&"="!==e&&(Ot.comparatorOp+="|\\!"+e)}();var Ro=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return function(e,t){return-1*bl(e,t)}(r.selector,e.selector)}),ap=function(){for(var e,r={},t=0;t<Ro.length;t++)r[(e=Ro[t]).selector]=e.matches;return r}(),sp="("+Ro.map(function(r){return r.selector}).join("|")+")",Hn=function(e){return e.replace(new RegExp("\\\\("+Ot.metaChar+")","g"),function(t,n){return n})},rn=function(e,t,n){e[e.length-1]=n},Mo=[{name:"group",query:!0,regex:"("+Ot.group+")",populate:function(e,t,n){var i=he(n,1)[0];t.checks.push({type:0,value:"*"===i?i:i+"s"})}},{name:"state",query:!0,regex:sp,populate:function(e,t,n){var a=he(n,1);t.checks.push({type:7,value:a[0]})}},{name:"id",query:!0,regex:"\\#("+Ot.id+")",populate:function(e,t,n){var a=he(n,1);t.checks.push({type:8,value:Hn(a[0])})}},{name:"className",query:!0,regex:"\\.("+Ot.className+")",populate:function(e,t,n){var a=he(n,1);t.checks.push({type:9,value:Hn(a[0])})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Ot.variable+")\\s*\\]",populate:function(e,t,n){var a=he(n,1);t.checks.push({type:4,field:Hn(a[0])})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Ot.variable+")\\s*("+Ot.comparatorOp+")\\s*("+Ot.value+")\\s*\\]",populate:function(e,t,n){var a=he(n,3),i=a[0],s=a[1],o=a[2];o=null!=new RegExp("^"+Ot.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:3,field:Hn(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Ot.boolOp+")\\s*("+Ot.variable+")\\s*\\]",populate:function(e,t,n){var a=he(n,2),i=a[0];t.checks.push({type:5,field:Hn(a[1]),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Ot.meta+")\\s*("+Ot.comparatorOp+")\\s*("+Ot.number+")\\s*\\]\\]",populate:function(e,t,n){var a=he(n,3),s=a[1],o=a[2];t.checks.push({type:6,field:Hn(a[0]),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Ot.separator,populate:function(e,t){var n=e.currentSubject,a=e.edgeCount,i=e.compoundCount,s=e[e.length-1];return null!=n&&(s.subject=n,e.currentSubject=null),s.edgeCount=a,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:Ot.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},i={checks:[]};return n.checks.push({type:11,source:t,target:i}),rn(e,0,n),e.edgeCount++,i}var s={checks:[]},l={checks:[]};return s.checks.push({type:12,source:t,target:l}),rn(e,0,s),e.edgeCount++,l}},{name:"undirectedEdge",separator:!0,regex:Ot.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},i={checks:[]};return n.checks.push({type:10,nodes:[t,i]}),rn(e,0,n),e.edgeCount++,i}var s={checks:[]},l={checks:[]};return s.checks.push({type:14,node:t,neighbor:l}),rn(e,0,s),l}},{name:"child",separator:!0,regex:Ot.child,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},a={checks:[]};return n.checks.push({type:15,parent:e[e.length-1],child:a}),rn(e,0,n),e.compoundCount++,a}if(e.currentSubject===t){var s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]},d={checks:[]};return s.checks.push({type:19,left:e[e.length-1],right:l,subject:u}),u.checks=t.checks,t.checks=[{type:20}],d.checks.push({type:20}),l.checks.push({type:17,parent:d,child:c}),rn(e,0,s),e.currentSubject=u,e.compoundCount++,c}var f={checks:[]},h={checks:[]},v=[{type:17,parent:f,child:h}];return f.checks=t.checks,t.checks=v,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:Ot.descendant,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},a={checks:[]};return n.checks.push({type:16,ancestor:e[e.length-1],descendant:a}),rn(e,0,n),e.compoundCount++,a}if(e.currentSubject===t){var s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]},d={checks:[]};return s.checks.push({type:19,left:e[e.length-1],right:l,subject:u}),u.checks=t.checks,t.checks=[{type:20}],d.checks.push({type:20}),l.checks.push({type:18,ancestor:d,descendant:c}),rn(e,0,s),e.currentSubject=u,e.compoundCount++,c}var f={checks:[]},h={checks:[]},v=[{type:18,ancestor:f,descendant:h}];return f.checks=t.checks,t.checks=v,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:Ot.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Bt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var a=e[e.length-1].checks[0],i=null==a?null:a.type;11===i?a.type=13:10===i&&(a.type=14,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];Mo.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var op=function(e){for(var t,n,a,i=0;i<Mo.length;i++){var s=Mo[i],o=s.name,l=e.match(s.regexObj);if(null!=l){n=l,t=s,a=o,e=e.substring(l[0].length);break}}return{expr:t,match:n,name:a,remaining:e}},dp={parse:function(e){var t=this,n=t.inputText=e,a=t[0]={checks:[]};for(t.length=1,n=function(e){var t=e.match(/^\s+/);return t&&(e=e.substring(t[0].length)),e}(n);;){var i=op(n);if(null==i.expr)return Bt("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(t,a,s);if(!1===o)return!1;if(null!=o&&(a=o),(n=i.remaining).match(/^\s*$/))break}var l=t[t.length-1];null!=t.currentSubject&&(l.subject=t.currentSubject),l.edgeCount=t.edgeCount,l.compoundCount=t.compoundCount;for(var u=0;u<t.length;u++){var c=t[u];if(c.compoundCount>0&&c.edgeCount>0)return Bt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return Bt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===c.edgeCount&&Bt("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(c){return c??""},t=function(c){return le(c)?'"'+c+'"':e(c)},n=function(c){return" "+c+" "},i=function(c,d){return c.checks.reduce(function(f,h,v){return f+(d===c&&0===v?"$":"")+function(c,d){var h=c.value;switch(c.type){case 0:var v=e(h);return v.substring(0,v.length-1);case 3:return"["+c.field+n(e(c.operator))+t(h)+"]";case 5:var x=c.field;return"["+e(c.operator)+x+"]";case 4:return"["+c.field+"]";case 6:return"[["+c.field+n(e(c.operator))+t(h)+"]]";case 7:return h;case 8:return"#"+h;case 9:return"."+h;case 17:case 15:return i(c.parent,d)+n(">")+i(c.child,d);case 18:case 16:return i(c.ancestor,d)+" "+i(c.descendant,d);case 19:var H=i(c.left,d),F=i(c.subject,d),j=i(c.right,d);return H+(H.length>0?" ":"")+F+j;case 20:return""}}(h,d)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=i(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s}},Oc=function(e,t,n){var a,l,u,i=le(e),s=Be(e),o=le(n),c=!1,d=!1,f=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),d=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(i||o||c)&&(l=i||s?""+e:"",u=""+n),c&&(e=l=l.toLowerCase(),n=u=u.toLowerCase()),t){case"*=":a=l.indexOf(u)>=0;break;case"$=":a=l.indexOf(u,l.length-u.length)>=0;break;case"^=":a=0===l.indexOf(u);break;case"=":a=e===n;break;case">":f=!0,a=e>n;break;case">=":f=!0,a=e>=n;break;case"<":f=!0,a=e<n;break;case"<=":f=!0,a=e<=n;break;default:a=!1}return d&&(null!=e||!f)&&(a=!a),a},Oo=function(e,t){return e.data(t)},Wt=[],Ut=function(e,t){return e.checks.every(function(n){return Wt[n.type](n,t)})};Wt[0]=function(r,e){var t=r.value;return"*"===t||t===e.group()},Wt[7]=function(r,e){return function(e,t){return ap[e](t)}(r.value,e)},Wt[8]=function(r,e){var t=r.value;return e.id()===t},Wt[9]=function(r,e){return e.hasClass(r.value)},Wt[6]=function(r,e){var n=r.operator,a=r.value;return Oc(function(e,t){return e[t]()}(e,r.field),n,a)},Wt[3]=function(r,e){var n=r.operator,a=r.value;return Oc(Oo(e,r.field),n,a)},Wt[5]=function(r,e){var n=r.operator;return function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}}(Oo(e,r.field),n)},Wt[4]=function(r,e){return function(e){return void 0!==e}(Oo(e,r.field))},Wt[10]=function(r,e){var t=r.nodes[0],n=r.nodes[1],a=e.source(),i=e.target();return Ut(t,a)&&Ut(n,i)||Ut(n,a)&&Ut(t,i)},Wt[14]=function(r,e){return Ut(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&Ut(r.neighbor,t)})},Wt[11]=function(r,e){return Ut(r.source,e.source())&&Ut(r.target,e.target())},Wt[12]=function(r,e){return Ut(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&Ut(r.target,t)})},Wt[13]=function(r,e){return Ut(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&Ut(r.source,t)})},Wt[15]=function(r,e){return Ut(r.child,e)&&Ut(r.parent,e.parent())},Wt[17]=function(r,e){return Ut(r.parent,e)&&e.children().some(function(t){return Ut(r.child,t)})},Wt[16]=function(r,e){return Ut(r.descendant,e)&&e.ancestors().some(function(t){return Ut(r.ancestor,t)})},Wt[18]=function(r,e){return Ut(r.ancestor,e)&&e.descendants().some(function(t){return Ut(r.descendant,t)})},Wt[19]=function(r,e){return Ut(r.subject,e)&&Ut(r.left,e)&&Ut(r.right,e)},Wt[20]=function(){return!0},Wt[1]=function(r,e){return r.value.has(e)},Wt[2]=function(r,e){return(0,r.value)(e)};var yp={matches:function(e){for(var n=0;n<this.length;n++)if(Ut(this[n],e))return!0;return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&8===t[0].checks[0].type)return e.getElementById(t[0].checks[0].value).collection();var n=function(i){for(var s=0;s<t.length;s++)if(Ut(t[s],i))return!0;return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}},nn=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||le(e)&&e.match(/^\s*$/)||(vt(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):ke(e)?this.addQuery({checks:[{type:2,value:e}]}):le(e)?this.parse(e)||(this.invalid=!0):jt("A selector must be created from a string; found "))},an=nn.prototype;[dp,yp].forEach(function(r){return mt(an,r)}),an.text=function(){return this.inputText},an.size=function(){return this.length},an.eq=function(r){return this[r]},an.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()},an.addQuery=function(r){this[this.length++]=r},an.selector=an.toString;var sn={allAre:function(e){var t=new nn(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new nn(e);return this.some(function(n){return t.matches(n)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};sn.allAreNeighbours=sn.allAreNeighbors,sn.has=sn.contains,sn.equal=sn.equals=sn.same;var ba,kc,Er=function(e,t){return function(a,i,s,o){var c,l=a,u=this;if(null==l?c="":vt(l)&&1===l.length&&(c=l.id()),1===u.length&&c){var d=u[0]._private,f=d.traversalCache=d.traversalCache||{},h=f[t]=f[t]||[],v=mn(c);return h[v]||(h[v]=e.call(u,a,i,s,o))}return e.call(u,a,i,s,o)}},Un={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var a=0;a<this.length;a++){var s=this[a]._private.parent;s&&t.push(s)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var a=0;a<n.length;a++)t.push(n[a]);n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var i=this[n].parents();t=(t=t||i).intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:Er(function(r){for(var e=[],t=0;t<this.length;t++)for(var a=this[t]._private.children,i=0;i<a.length;i++)e.push(a[i]);return this.spawn(e,!0).filter(r)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return function n(a){for(var i=0;i<a.length;i++){var s=a[i];t.push(s),s.children().nonempty()&&n(s.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function _o(r,e,t,n){for(var a=[],i=new _n,o=r.cy().hasCompoundNodes(),l=0;l<r.length;l++){var u=r[l];t?a.push(u):o&&n(a,i,u)}for(;a.length>0;){var c=a.shift();e(c),i.add(c.id()),o&&n(a,i,c)}return r}function _c(r,e,t){if(t.isParent())for(var n=t._private.children,a=0;a<n.length;a++){var i=n[a];e.has(i.id())||r.push(i)}}function Pc(r,e,t){if(t.isChild()){var n=t._private.parent;e.has(n.id())||r.push(n)}}function mp(r,e,t){Pc(r,e,t),_c(r,e,t)}Un.forEachDown=function(r){return _o(this,r,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],_c)},Un.forEachUp=function(r){return _o(this,r,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Pc)},Un.forEachUpAndDown=function(r){return _o(this,r,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],mp)},Un.ancestors=Un.parents,ba=kc={data:Ft.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ft.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ft.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},ba.attr=ba.data,ba.removeAttr=ba.removeData;var bp=kc,hi={};function Po(r){return function(e){var t=this;if(void 0===e&&(e=!0),0===t.length);else if(t.isNode()&&!t.removed()){for(var n=0,a=t[0],i=a._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(n+=r(a,o))}return n}}}function jn(r,e){return function(t){for(var n,a=this.nodes(),i=0;i<a.length;i++){var o=a[i][r](t);void 0!==o&&(void 0===n||e(o,n))&&(n=o)}return n}}mt(hi,{degree:Po(function(r,e){return e.source().same(e.target())?2:1}),indegree:Po(function(r,e){return e.target().same(r)?1:0}),outdegree:Po(function(r,e){return e.source().same(r)?1:0})}),mt(hi,{minDegree:jn("degree",function(r,e){return r<e}),maxDegree:jn("degree",function(r,e){return r>e}),minIndegree:jn("indegree",function(r,e){return r<e}),maxIndegree:jn("indegree",function(r,e){return r>e}),minOutdegree:jn("outdegree",function(r,e){return r<e}),maxOutdegree:jn("outdegree",function(r,e){return r>e})}),mt(hi,{totalDegree:function(e){for(var t=0,n=this.nodes(),a=0;a<n.length;a++)t+=n[a].degree(e);return t}});var Lr,Bc,Fc=function(e,t,n){for(var a=0;a<e.length;a++){var i=e[a];if(!i.locked()){var s=i._private.position,o={x:null!=t.x?t.x-s.x:0,y:null!=t.y?t.y-s.y:0};i.isParent()&&!(0===o.x&&0===o.y)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},Gc={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){Fc(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Lr=Bc={position:Ft.data(Gc),silentPosition:Ft.data(mt({},Gc,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Fc(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(Oe(e))t?this.silentPosition(e):this.position(e);else if(ke(e)){var n=e,a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o,s=this[i];(o=n(s,i))&&(t?s.silentPosition(o):s.position(o))}a.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var a;if(Oe(e)?(a={x:Be(e.x)?e.x:0,y:Be(e.y)?e.y:0},n=t):le(e)&&Be(t)&&((a={x:0,y:0})[e]=t),null!=a){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+a.x,y:l.y+a.y};n?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,t){return Oe(e)?this.shift(e,!0):le(e)&&Be(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],a=this.cy(),i=a.zoom(),s=a.pan(),o=Oe(e)?e:void 0,l=void 0!==o||void 0!==t&&le(e);if(n&&n.isNode()){if(!l){var d=n.position();return o=Za(d,i,s),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-s[e])/i):void 0!==o&&c.position(Jl(o,i,s))}}else if(!l)return;return this},relativePosition:function(e,t){var n=this[0],a=this.cy(),i=Oe(e)?e:void 0,s=void 0!==i||void 0!==t&&le(e),o=a.hasCompoundNodes();if(n&&n.isNode()){if(!s){var v=n.position(),b=o?n.parent():null,p=b&&b.length>0;p&&(b=b[0]);var x=p?b.position():{x:0,y:0};return i={x:v.x-x.x,y:v.y-x.y},void 0===e?i:i[e]}for(var l=0;l<this.length;l++){var u=this[l],c=o?u.parent():null,d=c&&c.length>0;d&&(c=c[0]);var h=d?c.position():{x:0,y:0};void 0!==t?u.position(e,t+h[e]):void 0!==i&&u.position({x:i.x+h.x,y:i.y+h.y})}}else if(!s)return;return this}},Lr.modelPosition=Lr.point=Lr.position,Lr.modelPositions=Lr.points=Lr.positions,Lr.renderedPoint=Lr.renderedPosition,Lr.relativePoint=Lr.relativePosition;var Yn,on,xp=Bc,Xn=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},Wn=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}};Yn=on={},on.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),n=t.zoom(),a=t.pan(),i=e.x1*n+a.x,s=e.x2*n+a.x,o=e.y1*n+a.y,l=e.y2*n+a.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}},on.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.cy();return e.styleEnabled()&&e.hasCompoundNodes()?(this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,r||t.emitAndNotify("bounds")}}),this):this},on.updateCompoundBounds=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(s){if(s.isParent()){var o=s._private,l=s.children(),u="include"===s.pstyle("compound-sizing-wrt-labels").value,c={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},d=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),f=o.position;(0===d.w||0===d.h)&&((d={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue}).x1=f.x-d.w/2,d.x2=f.x+d.w/2,d.y1=f.y-d.h/2,d.y2=f.y+d.h/2);var b=c.width.left.value;"px"===c.width.left.units&&c.width.val>0&&(b=100*b/c.width.val);var p=c.width.right.value;"px"===c.width.right.units&&c.width.val>0&&(p=100*p/c.width.val);var g=c.height.top.value;"px"===c.height.top.units&&c.height.val>0&&(g=100*g/c.height.val);var x=c.height.bottom.value;"px"===c.height.bottom.units&&c.height.val>0&&(x=100*x/c.height.val);var C=h(c.width.val-d.w,b,p),A=C.biasDiff,z=C.biasComplementDiff,H=h(c.height.val-d.h,g,x),F=H.biasDiff,j=H.biasComplementDiff;o.autoPadding=function v($,J,K,Q){if("%"!==K.units)return"px"===K.units?K.pfValue:0;switch(Q){case"width":return $>0?K.pfValue*$:0;case"height":return J>0?K.pfValue*J:0;case"average":return $>0&&J>0?K.pfValue*($+J)/2:0;case"min":return $>0&&J>0?$>J?K.pfValue*J:K.pfValue*$:0;case"max":return $>0&&J>0?$>J?K.pfValue*$:K.pfValue*J:0;default:return 0}}(d.w,d.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(d.w,c.width.val),f.x=(-A+d.x1+d.x2+z)/2,o.autoHeight=Math.max(d.h,c.height.val),f.y=(-F+d.y1+d.y2+j)/2}function h($,J,K){var Q=0,ee=0,ue=J+K;return $>0&&ue>0&&(Q=J/ue*$,ee=K/ue*$),{biasDiff:Q,biasComplementDiff:ee}}}for(var n=0;n<this.length;n++){var a=this[n],i=a._private;(!i.compoundBoundsClean||r)&&(t(a),e.batching()||(i.compoundBoundsClean=!0))}return this};var Tr=function(e){return e===1/0||e===-1/0?0:e},Ar=function(e,t,n,a,i){a-t===0||i-n===0||null==t||null==n||null==a||null==i||(e.x1=t<e.x1?t:e.x1,e.x2=a>e.x2?a:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ln=function(e,t){return null==t?e:Ar(e,t.x1,t.y1,t.x2,t.y2)},xa=function(e,t,n){return vr(e,t,n)},vi=function(e,t,n){if(!t.cy().headless()){var l,u,a=t._private,i=a.rstyle,s=i.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(l=i.srcX,u=i.srcY):"target"===n?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var c=a.arrowBounds=a.arrowBounds||{},d=c[n]=c[n]||{};d.x1=l-s,d.y1=u-s,d.x2=l+s,d.y2=u+s,d.w=d.x2-d.x1,d.h=d.y2-d.y1,Qa(d,1),Ar(e,d.x1,d.y1,d.x2,d.y2)}}},ko=function(e,t,n){if(!t.cy().headless()){var a,i=t._private,s=i.rstyle;if(t.pstyle((a=n?n+"-":"")+"label").strValue){var K,Q,ee,ue,l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),c=xa(s,"labelWidth",n),d=xa(s,"labelHeight",n),f=xa(s,"labelX",n),h=xa(s,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,b=t.pstyle(a+"text-margin-y").pfValue,p=t.isEdge(),g=t.pstyle(a+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,A=t.pstyle("text-border-width").pfValue/2,z=t.pstyle("text-background-padding").pfValue,F=d,j=c,$=j/2,J=F/2;if(p)K=f-$,Q=f+$,ee=h-J,ue=h+J;else{switch(Xn(l.value)){case"left":K=f-j,Q=f;break;case"center":K=f-$,Q=f+$;break;case"right":K=f,Q=f+j}switch(Wn(u.value)){case"top":ee=h-F,ue=h;break;case"center":ee=h-J,ue=h+J;break;case"bottom":ee=h,ue=h+F}}var fe=v-Math.max(x,A)-z-2,ve=v+Math.max(x,A)+z+2,ce=b-Math.max(x,A)-z-2,pe=b+Math.max(x,A)+z+2;K+=fe,Q+=ve,ee+=ce,ue+=pe;var Se=n||"main",Ie=i.labelBounds,me=Ie[Se]=Ie[Se]||{};me.x1=K,me.y1=ee,me.x2=Q,me.y2=ue,me.w=Q-K,me.h=ue-ee,me.leftPad=fe,me.rightPad=ve,me.topPad=ce,me.botPad=pe;var De=p&&"autorotate"===g.strValue;if(De||null!=g.pfValue&&0!==g.pfValue){var qe=De?xa(i.rstyle,"labelAngle",n):g.pfValue,je=Math.cos(qe),Je=Math.sin(qe),tt=(K+Q)/2,at=(ee+ue)/2;if(!p){switch(Xn(l.value)){case"left":tt=Q;break;case"right":tt=K}switch(Wn(u.value)){case"top":at=ue;break;case"bottom":at=ee}}var He=function(Et,bt){return{x:(Et-=tt)*je-(bt-=at)*Je+tt,y:Et*Je+bt*je+at}},Ce=He(K,ee),Ae=He(K,ue),_e=He(Q,ee),ze=He(Q,ue);K=Math.min(Ce.x,Ae.x,_e.x,ze.x),Q=Math.max(Ce.x,Ae.x,_e.x,ze.x),ee=Math.min(Ce.y,Ae.y,_e.y,ze.y),ue=Math.max(Ce.y,Ae.y,_e.y,ze.y)}var rt=Se+"Rot",ct=Ie[rt]=Ie[rt]||{};ct.x1=K,ct.y1=ee,ct.x2=Q,ct.y2=ue,ct.w=Q-K,ct.h=ue-ee,Ar(e,K,ee,Q,ue),Ar(i.labelBounds.all,K,ee,Q,ue)}return e}},zc=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,s=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;Vc(e,t,n,s,"outside",s/2)}},Vc=function(e,t,n,a,i,s){if(!(0===n||a<=0||"inside"===i)){var l=t.cy().renderer(),u=l.nodeShapes[l.getNodeShape(t)];if(u){var c=t.position(),d=c.x,f=c.y,h=t.width(),v=t.height();if(u.hasMiterBounds){"center"===i&&(a/=2);var b=u.miterBounds(d,f,h,v,a);ln(e,b)}else null!=s&&s>0&&ei(e,[s,s,s,s])}}},Hc=function(e){var t=0,n=function(s){return(s?1:0)<<t++},a=0;return a+=n(e.incudeNodes),a+=n(e.includeEdges),a+=n(e.includeLabels),a+=n(e.includeMainLabels),a+=n(e.includeSourceLabels),a+=n(e.includeTargetLabels),(a+=n(e.includeOverlays))+n(e.includeOutlines)},Uc=function(e){var t=function(o){return Math.round(o)};if(e.isEdge()){var n=e.source().position(),a=e.target().position();return Vl([t(n.x),t(n.y),t(a.x),t(a.y)])}var i=e.position();return Vl([t(i.x),t(i.y)])},jc=function(e,t){var a,n=e._private,i=e.isEdge(),o=(null==t?Xc:Hc(t))===Xc;if(null==n.bbCache?(a=function(e,t){var c,d,f,h,v,b,n=e._private.cy,a=n.styleEnabled(),i=n.headless(),s=gr(),o=e._private,l=e.isNode(),u=e.isEdge(),p=o.rstyle,g=l&&a?e.pstyle("bounds-expansion").pfValue:[0],x=function(Nt){return"none"!==Nt.pstyle("display").value},C=!a||x(e)&&(!u||x(e.source())&&x(e.target()));if(C){var z=0;a&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(z=e.pstyle("overlay-padding").value);var F=0;a&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(F=e.pstyle("underlay-padding").value);var j=Math.max(z,F),J=0;if(a&&(J=e.pstyle("width").pfValue/2),l&&t.includeNodes){var K=e.position();v=K.x,b=K.y;var ee=e.outerWidth()/2,fe=e.outerHeight()/2;Ar(s,c=v-ee,f=b-fe,d=v+ee,h=b+fe),a&&zc(s,e),a&&t.includeOutlines&&!i&&zc(s,e),a&&function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,a=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;Vc(e,t,n,a,i)}}(s,e)}else if(u&&t.includeEdges)if(a&&!i){var ve=e.pstyle("curve-style").strValue;if(c=Math.min(p.srcX,p.midX,p.tgtX),d=Math.max(p.srcX,p.midX,p.tgtX),f=Math.min(p.srcY,p.midY,p.tgtY),h=Math.max(p.srcY,p.midY,p.tgtY),Ar(s,c-=J,f-=J,d+=J,h+=J),"haystack"===ve){var ce=p.haystackPts;if(ce&&2===ce.length){if((c=ce[0].x)>(d=ce[1].x)){var pe=c;c=d,d=pe}if((f=ce[0].y)>(h=ce[1].y)){var Se=f;f=h,h=Se}Ar(s,c-J,f-J,d+J,h+J)}}else if("bezier"===ve||"unbundled-bezier"===ve||Kr(ve,"segments")||Kr(ve,"taxi")){var Ie;switch(ve){case"bezier":case"unbundled-bezier":Ie=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":Ie=p.linePts}if(null!=Ie)for(var me=0;me<Ie.length;me++){var De=Ie[me];Ar(s,c=De.x-J,f=De.y-J,d=De.x+J,h=De.y+J)}}}else{var qe=e.source().position(),Je=e.target().position();if((c=qe.x)>(d=Je.x)){var tt=c;c=d,d=tt}if((f=qe.y)>(h=Je.y)){var at=f;f=h,h=at}Ar(s,c-=J,f-=J,d+=J,h+=J)}if(a&&t.includeEdges&&u&&(vi(s,e,"mid-source"),vi(s,e,"mid-target"),vi(s,e,"source"),vi(s,e,"target")),a&&"yes"===e.pstyle("ghost").value){var Ce=e.pstyle("ghost-offset-x").pfValue,Ae=e.pstyle("ghost-offset-y").pfValue;Ar(s,s.x1+Ce,s.y1+Ae,s.x2+Ce,s.y2+Ae)}var _e=o.bodyBounds=o.bodyBounds||{};eu(_e,s),ei(_e,g),Qa(_e,1),a&&Ar(s,(c=s.x1)-j,(f=s.y1)-j,(d=s.x2)+j,(h=s.y2)+j);var ze=o.overlayBounds=o.overlayBounds||{};eu(ze,s),ei(ze,g),Qa(ze,1);var rt=o.labelBounds=o.labelBounds||{};null!=rt.all?function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0}(rt.all):rt.all=gr(),a&&t.includeLabels&&(t.includeMainLabels&&ko(s,e,null),u&&(t.includeSourceLabels&&ko(s,e,"source"),t.includeTargetLabels&&ko(s,e,"target")))}return s.x1=Tr(s.x1),s.y1=Tr(s.y1),s.x2=Tr(s.x2),s.y2=Tr(s.y2),s.w=Tr(s.x2-s.x1),s.h=Tr(s.y2-s.y1),s.w>0&&s.h>0&&C&&(ei(s,g),Qa(s,1)),s}(e,wa),n.bbCache=a,n.bbCachePosKey=Uc(e)):a=n.bbCache,!o){var l=e.isNode();a=gr(),(t.includeNodes&&l||t.includeEdges&&!l)&&ln(a,t.includeOverlays?n.overlayBounds:n.bodyBounds),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?ln(a,n.labelBounds.all):(t.includeMainLabels&&ln(a,n.labelBounds.mainRot),t.includeSourceLabels&&ln(a,n.labelBounds.sourceRot),t.includeTargetLabels&&ln(a,n.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},wa={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Xc=Hc(wa),Wc=ir(wa);on.boundingBox=function(r){var e,t=void 0===r||void 0===r.useCache||!0===r.useCache,n=Mn(function(c){var d=c._private;return null==d.bbCache||d.styleDirty||d.bbCachePosKey!==Uc(c)},function(c){return c.id()});if(t&&1===this.length&&!n(this[0]))r=void 0===r?wa:Wc(r),e=jc(this[0],r);else{e=gr();var a=Wc(r=r||wa),i=this,o=i.cy().styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),o&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var l=0;l<i.length;l++){var u=i[l];n(u)&&u.dirtyBoundingBoxCache(),ln(e,jc(u,a))}}return e.x1=Tr(e.x1),e.y1=Tr(e.y1),e.x2=Tr(e.x2),e.y2=Tr(e.y2),e.w=Tr(e.x2-e.x1),e.h=Tr(e.y2-e.y1),e},on.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},on.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),n=t.hasCompoundNodes(),a=t.collection();if(n&&(a=e.filter(function(u){return u.isParent()}),e=e.not(a)),Oe(r)){var i=r;r=function(){return i}}t.startBatch(),e.forEach(function(c,d){return c._private.bbAtOldPos=r(c,d)}).silentPositions(r),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var l=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}}(this.boundingBox({useCache:!1}));return e.silentPositions(function(c){return c._private.bbAtOldPos}),n&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),t.endBatch(),l},Yn.boundingbox=Yn.bb=Yn.boundingBox,Yn.renderedBoundingbox=Yn.renderedBoundingBox;var Ea,Ta,Cp=on;Ea=Ta={};var Yc=function(e){e.uppercaseName=ml(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=ml(e.outerName),Ea[e.name]=function(){var n=this[0],a=n._private;if(n){if(a.cy._private.styleEnabled){if(n.isParent())return n.updateCompoundBounds(),a[e.autoName]||0;var o=n.pstyle(e.name);return"label"===o.strValue?(n.recalculateRenderedStyle(),a.rstyle[e.labelName]||0):o.pfValue}return 1}},Ea["outer"+e.uppercaseName]=function(){var n=this[0];if(n){if(n._private.cy._private.styleEnabled){var o=n[e.name](),l=n.pstyle("border-position").value;return o+("center"===l?n.pstyle("border-width").pfValue:"outside"===l?2*n.pstyle("border-width").pfValue:0)+2*n.padding()}return 1}},Ea["rendered"+e.uppercaseName]=function(){var n=this[0];if(n)return n[e.name]()*this.cy().zoom()},Ea["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n)return n[e.outerName]()*this.cy().zoom()}};Yc({name:"width"}),Yc({name:"height"}),Ta.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),void 0!==e.autoPadding?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue},Ta.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()},Ta.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var Dp=Ta,$c={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},Pp=Object.keys($c).reduce(function(r,e){var t=$c[e],n=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(e);return r[e]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)}(this,t.get)},r[n]=t.mult?function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),a=n.pan(),i=n.zoom();return t(e).map(function(s){return Za(s,i,a)})}}(this,t.get)}:function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Za(t(e),n.zoom(),n.pan())}}(this,t.get)},r},{}),kp=mt({},xp,Cp,Dp,Pp),qc=function(e,t){this.recycle(e,t)};function Ca(){return!1}function gi(){return!0}qc.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Ca,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?gi:Ca):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?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),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,a=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*a+i.x,y:n.y*a+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=gi;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=gi;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=gi,this.stopPropagation()},isDefaultPrevented:Ca,isPropagationStopped:Ca,isImmediatePropagationStopped:Ca};var Kc=/^([^.]+)(\.(?:[^.]+))?$/,Zc={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},Jc=Object.keys(Zc),Fp={};function pi(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fp,e=arguments.length>1?arguments[1]:void 0,t=0;t<Jc.length;t++){var n=Jc[t];this[n]=r[n]||Zc[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var un=pi.prototype,Qc=function(e,t,n,a,i,s,o){ke(a)&&(i=a,a=null),o&&(s=null==s?o:mt({},s,o));for(var l=We(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!Sr(c)){var d=c.match(Kc);if(d&&!1===t(e,c,d[1],d[2]?d[2]:null,a,i,s))break}}},ed=function(e,t){return e.addEventFields(e.context,t),new qc(t.type,t)};un.on=un.addListener=function(r,e,t,n,a){return Qc(this,function(i,s,o,l,u,c,d){ke(c)&&i.listeners.push({event:s,callback:c,type:o,namespace:l,qualifier:u,conf:d})},r,e,t,n,a),this},un.one=function(r,e,t,n){return this.on(r,e,t,n,{one:!0})},un.removeListener=un.off=function(r,e,t,n){var a=this;0!==this.emitting&&(this.listeners=function(e){return e.slice()}(this.listeners));for(var i=this.listeners,s=function(u){var c=i[u];Qc(a,function(d,f,h,v,b,p){if((c.type===h||"*"===r)&&(!v&&".*"!==c.namespace||c.namespace===v)&&(!b||d.qualifierCompare(c.qualifier,b))&&(!p||c.callback===p))return i.splice(u,1),!1},r,e,t,n)},o=i.length-1;o>=0;o--)s(o);return this},un.removeAllListeners=function(){return this.removeListener("*")},un.emit=un.trigger=function(r,e,t){var n=this.listeners,a=n.length;return this.emitting++,We(e)||(e=[e]),function(e,t,n){if(function(e){return"event"===we(e)}(n))t(e,n);else if(Oe(n))t(e,ed(e,n));else for(var a=We(n)?n:n.split(/\s+/),i=0;i<a.length;i++){var s=a[i];if(!Sr(s)){var o=s.match(Kc);o&&t(e,ed(e,{type:o[1],namespace:o[2]?o[2]:null,target:e.context}))}}}(this,function(i,s){null!=t&&(a=(n=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}]).length);for(var o=function(){var c=n[l];if(c.type===s.type&&(!c.namespace||c.namespace===s.namespace||".*"===c.namespace)&&i.eventMatches(i.context,c,s)){var d=[s];null!=e&&function(e,t){for(var n=0;n<t.length;n++)e.push(t[n])}(d,e),i.beforeEmit(i.context,c,s),c.conf&&c.conf.one&&(i.listeners=i.listeners.filter(function(v){return v!==c}));var f=i.callbackContext(i.context,c,s),h=c.callback.apply(f,d);i.afterEmit(i.context,c,s),!1===h&&(s.stopPropagation(),s.preventDefault())}},l=0;l<a;l++)o();i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},r),this.emitting--,this};var zp={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return null==a||e!==n.target&&At(n.target)&&a.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?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()}},yi=function(e){return le(e)?new nn(e):e},td={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new pi(zp,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var a=yi(t),i=0;i<this.length;i++)this[i].emitter().on(e,a,n);return this},removeListener:function(e,t,n){for(var a=yi(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,a,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var a=yi(t),i=0;i<this.length;i++)this[i].emitter().one(e,a,n);return this},once:function(e,t,n){for(var a=yi(t),i=0;i<this.length;i++)this[i].emitter().on(e,a,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};Ft.eventAliasesOn(td);var rd={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 a=this[n];a.isNode()?e.push(a):t.push(a)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(le(e)||vt(e))return new nn(e).filter(this);if(ke(e)){for(var n=this.spawn(),a=this,i=0;i<a.length;i++){var s=a[i];(t?e.apply(t,[s,i,a]):e(s,i,a))&&n.push(s)}return n}return this.spawn()},not:function(e){if(e){le(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var a=this[n];e.has(a)||t.push(a)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(le(e))return this.filter(e);for(var n=this.spawn(),s=this.length<e.length,o=s?this:e,l=s?e:this,u=0;u<o.length;u++){var c=o[u];l.has(c)&&n.push(c)}return n},xor:function(e){var t=this._private.cy;le(e)&&(e=t.$(e));var n=this.spawn(),i=e,s=function(l,u){for(var c=0;c<l.length;c++){var d=l[c];u.hasElementWithId(d._private.data.id)||n.push(d)}};return s(this,i),s(i,this),n},diff:function(e){var t=this._private.cy;le(e)&&(e=t.$(e));var n=this.spawn(),a=this.spawn(),i=this.spawn(),o=e,l=function(c,d,f){for(var h=0;h<c.length;h++){var v=c[h];d.hasElementWithId(v._private.data.id)?i.merge(v):f.push(v)}};return l(this,o,n),l(o,this,a),{left:n,right:a,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(le(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i];!this.has(s)&&a.push(s)}return a},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&le(e)){var a=e;e=n.mutableElements().filter(a)}for(var i=t.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id;if(!i.has(l)){var c=this.length++;this[c]=o,i.set(l,{ele:o,index:c})}}return this},unmergeAt:function(e){var n=this[e].id(),i=this._private.map;if(this[e]=void 0,i.delete(n),this.length>1&&e!==this.length-1){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){var i=this._private.map.get((e=e[0])._private.data.id);return i?(this.unmergeAt(i.index),this):this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&le(e)){var n=e;e=t.mutableElements().filter(n)}for(var a=0;a<e.length;a++)this.unmergeOne(e[a]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],a=this,i=0;i<a.length;i++){var s=a[i],o=t?e.apply(t,[s,i,a]):e(s,i,a);n.push(o)}return n},reduce:function(e,t){for(var n=t,a=this,i=0;i<a.length;i++)n=e(n,a[i],i,a);return n},max:function(e,t){for(var a,n=-1/0,i=this,s=0;s<i.length;s++){var o=i[s],l=t?e.apply(t,[o,s,i]):e(o,s,i);l>n&&(n=l,a=o)}return{value:n,ele:a}},min:function(e,t){for(var a,n=1/0,i=this,s=0;s<i.length;s++){var o=i[s],l=t?e.apply(t,[o,s,i]):e(o,s,i);l<n&&(n=l,a=o)}return{value:n,ele:a}}},Pt=rd;Pt.u=Pt["|"]=Pt["+"]=Pt.union=Pt.or=Pt.add,Pt["\\"]=Pt["!"]=Pt["-"]=Pt.difference=Pt.relativeComplement=Pt.subtract=Pt.not,Pt.n=Pt["&"]=Pt["."]=Pt.and=Pt.intersection=Pt.intersect,Pt["^"]=Pt["(+)"]=Pt["(-)"]=Pt.symmetricDifference=Pt.symdiff=Pt.xor,Pt.fnFilter=Pt.filterFn=Pt.stdFilter=Pt.filter,Pt.complement=Pt.abscomp=Pt.absoluteComplement;var e,nd=function(e,t){var a=e.cy().hasCompoundNodes();function i(c){var d=c.pstyle("z-compound-depth");return"auto"===d.value?a?c.zDepth():0:"bottom"===d.value?-1:"top"===d.value?ds:0}var s=i(e)-i(t);if(0!==s)return s;function o(c){return"auto"===c.pstyle("z-index-compare").value&&c.isNode()?1:0}var l=o(e)-o(t);if(0!==l)return l;var u=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==u?u:e.poolIndex()-t.poolIndex()},mi={forEach:function(e,t){if(ke(e))for(var n=this.length,a=0;a<n;a++){var i=this[a];if(!1===(t?e.apply(t,[i,a,this]):e(i,a,this)))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=[],a=this.length;null==t&&(t=a),null==e&&(e=0),e<0&&(e=a+e),t<0&&(t=a+t);for(var i=e;i>=0&&i<t&&i<a;i++)n.push(this[i]);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 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!ke(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(nd)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var a=t.data.parent?e.parents().size():0;return e.isParent()?a:ds-1}var s=t.target,o=t.source.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}};mi.each=mi.forEach,e="undefined",(typeof Symbol>"u"?"undefined":ye(Symbol))!=e&&ye(Symbol.iterator)!=e&&(mi[Symbol.iterator]=function(){var n=this,a={value:void 0,done:!1},i=0,s=this.length;return ie({next:function(){return i<s?a.value=n[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})});var Up=ir({nodeDimensionsIncludeLabels:!1}),bi={layoutDimensions:function(e){var t;if(e=Up(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var a=this.nodes().filter(function(z){return!z.isParent()}),i=this.cy(),s=t.eles,o=function(H){return H.id()},l=Mn(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var c=t.spacingFactor&&1!==t.spacingFactor,f=function(){if(!c)return null;for(var H=gr(),F=0;F<a.length;F++){var $=l(a[F],F);Ql(H,$.x,$.y)}return H}(),h=Mn(function(z,H){var F=l(z,H);return c&&(F=function(H,F,j){var $_x=F.x1+F.w/2,$_y=F.y1+F.h/2;return{x:$_x+(j.x-$_x)*H,y:$_y+(j.y-$_y)*H}}(Math.abs(t.spacingFactor),f,F)),null!=t.transform&&(F=t.transform(z,F)),F},o);if(t.animate){for(var v=0;v<a.length;v++){var b=a[v],p=h(b,v);if(null==t.animateFilter||t.animateFilter(b,v)){var x=b.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}else b.position(p)}if(t.fit){var C=i.animation({fit:{boundingBox:s.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(C)}else if(void 0!==t.zoom&&void 0!==t.pan){var A=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(A)}e.animations.forEach(function(z){return z.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Vn.all(e.animations.map(function(z){return z.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else a.positions(h),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.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){return this.cy().makeLayout(mt({},e,{eles:this}))}};function ad(r,e,t){var i,n=t._private,a=n.styleCache=n.styleCache||[];return null!=(i=a[r])||(i=a[r]=e(t)),i}function xi(r,e){return r=mn(r),function(n){return ad(r,e,n)}}function wi(r,e){r=mn(r);var t=function(a){return e.call(a)};return function(){var a=this[0];if(a)return ad(r,t,a)}}bi.createLayout=bi.makeLayout=bi.layout;var sr={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),a=t.styleEnabled();return n&&a&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var n,e=this.cy(),t=function(i){return i._private.styleCache=null};return e.hasCompoundNodes()?((n=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(n.connectedEdges()),n.forEach(t)):this.forEach(function(a){t(a),a.connectedEdges().forEach(t)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var i=this;e=!(!e&&void 0!==e),t.hasCompoundNodes()&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._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&&void 0!==arguments[1])||arguments[1],n=this[0],a=n.cy();if(a.styleEnabled()&&n)return n._private.styleDirty&&(n._private.styleDirty=!1,a.style().apply(n)),n._private.style[e]??(t?a.style().getDefaultProperty(e):null)},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var a=!1,i=n.style();if(Oe(e))i.applyBypass(this,e,a),this.emitAndNotify("style");else if(le(e)){if(void 0===t){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,a),this.emitAndNotify("style")}else if(void 0===e){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,a=t.style(),i=this;if(void 0===e)for(var s=0;s<i.length;s++)a.removeAllBypasses(i[s],n);else{e=e.split(/\s+/);for(var l=0;l<i.length;l++)a.removeBypasses(i[l],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 a=n._private,i=n.pstyle("opacity").value;if(!t)return i;var s=a.data.parent?n.parents():null;if(s)for(var o=0;o<s.length;o++)i*=s[o].pstyle("opacity").value;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();return t?n?0===t.effectiveOpacity():0===t.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function Bo(r,e){var n=r._private.data.parent?r.parents():null;if(n)for(var a=0;a<n.length;a++)if(!e(n[a]))return!1;return!0}function Fo(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,n=r.parentOk||r.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],s=a.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||Bo(i,n);var l=o.source,u=o.target;return t(l)&&(!s||Bo(l,t))&&(l===u||t(u)&&(!s||Bo(u,t)))}}}var $n=xi("eleTakesUpSpace",function(r){return"element"===r.pstyle("display").value&&0!==r.width()&&(!r.isNode()||0!==r.height())});sr.takesUpSpace=wi("takesUpSpace",Fo({ok:$n}));var jp=xi("eleInteractive",function(r){return"yes"===r.pstyle("events").value&&"visible"===r.pstyle("visibility").value&&$n(r)}),Xp=xi("parentInteractive",function(r){return"visible"===r.pstyle("visibility").value&&$n(r)});sr.interactive=wi("interactive",Fo({ok:jp,parentOk:Xp,edgeOkViaNode:$n})),sr.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var Wp=xi("eleVisible",function(r){return"visible"===r.pstyle("visibility").value&&0!==r.pstyle("opacity").pfValue&&$n(r)});sr.visible=wi("visible",Fo({ok:Wp,edgeOkViaNode:$n})),sr.hidden=function(){var r=this[0];if(r)return!r.visible()},sr.isBundledBezier=wi("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),sr.bypass=sr.css=sr.style,sr.renderedCss=sr.renderedStyle,sr.removeBypass=sr.removeCss=sr.removeStyle,sr.pstyle=sr.parsedStyle;var cn={};function id(r){return function(){var e=arguments,t=[];if(2===e.length)this.on(r.event,e[0],e[1]);else if(1===e.length&&ke(e[0]))this.on(r.event,e[0]);else if(0===e.length||1===e.length&&We(e[0])){for(var s=1===e.length?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!r.ableField||l._private[r.ableField],c=l._private[r.field]!=r.value;if(r.overrideAble){var d=r.overrideAble(l);if(void 0!==d&&(u=d,!d))return this}u&&(l._private[r.field]=r.value,c&&t.push(l))}var f=this.spawn(t);f.updateStyle(),f.emit(r.event),s&&f.emit(s)}return this}}function qn(r){cn[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(void 0!==t)return t}return e._private[r.field]}},cn[r.on]=id({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),cn[r.off]=id({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}qn({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),qn({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),qn({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),qn({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),cn.deselect=cn.unselect,cn.grabbed=function(){var r=this[0];if(r)return r._private.grabbed},qn({field:"active",on:"activate",off:"unactivate"}),qn({field:"pannable",on:"panify",off:"unpanify"}),cn.inactive=function(){var r=this[0];if(r)return!r._private.active};var cr={},sd=function(e){return function(n){for(var i=[],s=0;s<this.length;s++){var o=this[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),c=0;c<u.length;c++){var d=u[c],f=d.source(),h=d.target();if(e.noIncomingEdges&&h===o&&f!==o||e.noOutgoingEdges&&f===o&&h!==o){l=!0;break}}l||i.push(o)}}return this.spawn(i,!0).filter(n)}},od=function(e){return function(t){for(var a=[],i=0;i<this.length;i++){var s=this[i];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],c=u.source(),d=u.target();e.outgoing&&c===s?(a.push(u),a.push(d)):e.incoming&&d===s&&(a.push(u),a.push(c))}}return this.spawn(a,!0).filter(t)}},ld=function(e){return function(t){for(var n=this,a=[],i={};;){var s=e.outgoing?n.outgoers():n.incomers();if(0===s.length)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],c=u.id();i[c]||(i[c]=!0,a.push(u),o=!0)}if(!o)break;n=s}return this.spawn(a,!0).filter(t)}};function ud(r){return function(t){for(var n=[],a=0;a<this.length;a++){var s=this[a]._private[r.attr];s&&n.push(s)}return this.spawn(n,!0).filter(t)}}function cd(r){return function(t){var n=[],a=this._private.cy,i=r||{};le(t)&&(t=a.$(t));for(var s=0;s<t.length;s++)for(var o=t[s]._private.edges,l=0;l<o.length;l++){var u=o[l],c=u._private.data,d=this.hasElementWithId(c.source)&&t.hasElementWithId(c.target),f=t.hasElementWithId(c.source)&&this.hasElementWithId(c.target);(d||f)&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!d||i.thisIsTgt&&!f)||n.push(u))}return this.spawn(n,!0)}}function dd(r){return r=mt({},{codirected:!1},r),function(n){for(var a=[],i=this.edges(),s=r,o=0;o<i.length;o++)for(var u=i[o]._private,c=u.source,d=c._private.data.id,f=u.data.target,h=c._private.edges,v=0;v<h.length;v++){var b=h[v],p=b._private.data,g=p.target,x=p.source,C=g===f&&x===d;(s.codirected&&C||!s.codirected&&(C||d===g&&f===x))&&a.push(b)}return this.spawn(a,!0).filter(n)}}cr.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null},mt(cr,{roots:sd({noIncomingEdges:!0}),leaves:sd({noOutgoingEdges:!0}),outgoers:Er(od({outgoing:!0}),"outgoers"),successors:ld({outgoing:!0}),incomers:Er(od({incoming:!0}),"incomers"),predecessors:ld({})}),mt(cr,{neighborhood:Er(function(r){for(var e=[],t=this.nodes(),n=0;n<t.length;n++)for(var a=t[n],i=a.connectedEdges(),s=0;s<i.length;s++){var o=i[s],l=o.source(),u=o.target(),c=a===l?u:l;c.length>0&&e.push(c[0]),e.push(o[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),cr.neighbourhood=cr.neighborhood,cr.closedNeighbourhood=cr.closedNeighborhood,cr.openNeighbourhood=cr.openNeighborhood,mt(cr,{source:Er(function(e){var n,t=this[0];return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:Er(function(e){var n,t=this[0];return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:ud({attr:"source"}),targets:ud({attr:"target"})}),mt(cr,{edgesWith:Er(cd(),"edgesWith"),edgesTo:Er(cd({thisIsSrc:!0}),"edgesTo")}),mt(cr,{connectedEdges:Er(function(r){for(var e=[],n=0;n<this.length;n++){var a=this[n];if(a.isNode())for(var i=a._private.edges,s=0;s<i.length;s++)e.push(i[s])}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:Er(function(r){for(var e=[],n=0;n<this.length;n++){var a=this[n];a.isEdge()&&(e.push(a.source()[0]),e.push(a.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:Er(dd(),"parallelEdges"),codirectedEdges:Er(dd({codirected:!0}),"codirectedEdges")}),mt(cr,{components:function(e){var t=this,n=t.cy(),a=n.collection(),i=null==e?t.nodes():e.nodes(),s=[];null!=e&&i.empty()&&(i=e.sources());var o=function(c,d){a.merge(c),i.unmerge(c),d.merge(c)};if(i.empty())return t.spawn();var l=function(){var c=n.collection();s.push(c);var d=i[0];o(d,c),t.bfs({directed:!1,roots:d,visit:function(h){return o(h,c)}}),c.forEach(function(f){f.connectedEdges().forEach(function(h){t.has(h)&&c.has(h.source())&&c.has(h.target())&&c.merge(h)})})};do{l()}while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),cr.componentsOf=cr.components;var or=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new jr,s=!1;if(t){if(t.length>0&&Oe(t[0])&&!At(t[0])){s=!0;for(var o=[],l=new _n,u=0,c=t.length;u<c;u++){var d=t[u];null==d.data&&(d.data={});var f=d.data;if(null==f.id)f.id=Yl();else if(e.hasElementWithId(f.id)||l.has(f.id))continue;var h=new qa(e,d,!1);o.push(h),l.add(f.id)}t=o}}else t=[];this.length=0;for(var v=0,b=t.length;v<b;v++){var p=t[v][0];if(null!=p){var g=p._private.data.id;(!n||!i.has(g))&&(n&&i.set(g,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(x){this.lazyMap=x},rebuildMap:function(){for(var C=this.lazyMap=new jr,A=this.eles,z=0;z<A.length;z++){var H=A[z];C.set(H.id(),{index:z,ele:H})}}},n&&(this._private.map=i),s&&!a&&this.restore()}else jt("A collection must have a reference to the core")},Vt=qa.prototype=or.prototype=Object.create(Array.prototype);Vt.instanceString=function(){return"collection"},Vt.spawn=function(r,e){return new or(this.cy(),r,e)},Vt.spawnSelf=function(){return this.spawn(this)},Vt.cy=function(){return this._private.cy},Vt.renderer=function(){return this._private.cy.renderer()},Vt.element=function(){return this[0]},Vt.collection=function(){return qt(this)?this:new or(this._private.cy,[this])},Vt.unique=function(){return new or(this._private.cy,this,!0)},Vt.hasElementWithId=function(r){return this._private.map.has(r=""+r)},Vt.getElementById=function(r){var e=this._private.cy,t=this._private.map.get(r=""+r);return t?t.ele:new or(e)},Vt.$id=Vt.getElementById,Vt.poolIndex=function(){return this._private.cy._private.elements._private.map.get(this[0]._private.data.id).index},Vt.indexOf=function(r){return this._private.map.get(r[0]._private.data.id).index},Vt.indexOfId=function(r){return this._private.map.get(r=""+r).index},Vt.json=function(r){var e=this.element(),t=this.cy();if(null==e&&r)return this;if(null!=e){var n=e._private;if(Oe(r)){if(t.startBatch(),r.data){e.data(r.data);var a=n.data;if(e.isEdge()){var i=!1,s={},o=r.data.source,l=r.data.target;null!=o&&o!=a.source&&(s.source=""+o,i=!0),null!=l&&l!=a.target&&(s.target=""+l,i=!0),i&&(e=e.move(s))}else{var c=r.data.parent;"parent"in r.data&&(null!=c||null!=a.parent)&&c!=a.parent&&(void 0===c&&(c=null),null!=c&&(c=""+c),e=e.move({parent:c}))}}r.position&&e.position(r.position);var d=function(b,p,g){var x=r[b];null!=x&&x!==n[b]&&(x?e[p]():e[g]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),null!=r.classes&&e.classes(r.classes),t.endBatch(),this}if(void 0===r){var f={data:_r(n.data),position:_r(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:""},h=0;return n.classes.forEach(function(v){return f.classes+=0===h++?v:" "+v}),f}}},Vt.jsons=function(){for(var r=[],e=0;e<this.length;e++){var n=this[e].json();r.push(n)}return r},Vt.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var a=this[t].json(),i=new qa(r,a,!1);e.push(i)}return new or(r,e)},Vt.copy=Vt.clone,Vt.restore=function(){for(var o,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this,n=t.cy(),a=n._private,i=[],s=[],l=0,u=t.length;l<u;l++){var c=t[l];e&&!c.removed()||(c.isNode()?i.push(c):s.push(c))}o=i.concat(s);var d,f=function(){o.splice(d,1),d--};for(d=0;d<o.length;d++){var h=o[d],v=h._private,b=v.data;if(h.clearTraversalCache(),e||v.removed)if(void 0===b.id)b.id=Yl();else if(Be(b.id))b.id=""+b.id;else{if(Sr(b.id)||!le(b.id)){jt("Can not create element with invalid string ID `"+b.id+"`"),f();continue}if(n.hasElementWithId(b.id)){jt("Can not create second element with ID `"+b.id+"`"),f();continue}}var p=b.id;if(h.isNode()){var g=v.position;null==g.x&&(g.x=0),null==g.y&&(g.y=0)}if(h.isEdge()){for(var x=h,C=["source","target"],A=C.length,z=!1,H=0;H<A;H++){var F=C[H],j=b[F];Be(j)&&(j=b[F]=""+b[F]),null==j||""===j?(jt("Can not create edge `"+p+"` with unspecified "+F),z=!0):n.hasElementWithId(j)||(jt("Can not create edge `"+p+"` with nonexistent "+F+" `"+j+"`"),z=!0)}if(z){f();continue}var $=n.getElementById(b.source),J=n.getElementById(b.target);$.same(J)?$._private.edges.push(x):($._private.edges.push(x),J._private.edges.push(x)),x._private.source=$,x._private.target=J}v.map=new jr,v.map.set(p,{ele:h,index:0}),v.removed=!1,e&&n.addToPool(h)}for(var K=0;K<i.length;K++){var Q=i[K],ee=Q._private.data;Be(ee.parent)&&(ee.parent=""+ee.parent);var ue=ee.parent;if(null!=ue||Q._private.parent){var ve=Q._private.parent?n.collection().merge(Q._private.parent):n.getElementById(ue);if(ve.empty())ee.parent=void 0;else if(ve[0].removed())Bt("Node added with missing parent, reference to parent removed"),ee.parent=void 0,Q._private.parent=null;else{for(var ce=!1,pe=ve;!pe.empty();){if(Q.same(pe)){ce=!0,ee.parent=void 0;break}pe=pe.parent()}ce||(ve[0]._private.children.push(Q),Q._private.parent=ve[0],a.hasCompoundNodes=!0)}}}if(o.length>0){for(var Se=o.length===t.length?t:new or(n,o),Ie=0;Ie<Se.length;Ie++){var me=Se[Ie];me.isNode()||(me.parallelEdges().clearTraversalCache(),me.source().clearTraversalCache(),me.target().clearTraversalCache())}(a.hasCompoundNodes?n.collection().merge(Se).merge(Se.connectedNodes()).merge(Se.parent()):Se).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?Se.emitAndNotify("add"):e&&Se.emit("add")}return t},Vt.removed=function(){var r=this[0];return r&&r._private.removed},Vt.inside=function(){var r=this[0];return r&&!r._private.removed},Vt.remove=function(){var r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=this,n=[],a={},i=t._private.cy;function l(ue){var fe=a[ue.id()];e&&ue.removed()||fe||(a[ue.id()]=!0,ue.isNode()?(n.push(ue),function s(ue){for(var fe=ue._private.edges,ve=0;ve<fe.length;ve++)l(fe[ve])}(ue),function o(ue){for(var fe=ue._private.children,ve=0;ve<fe.length;ve++)l(fe[ve])}(ue)):n.unshift(ue))}for(var u=0,c=t.length;u<c;u++)l(t[u]);function f(ue,fe){Jr(ue._private.edges,fe),ue.clearTraversalCache()}function h(ue){ue.clearTraversalCache()}var v=[];function b(ue,fe){fe=fe[0];var ve=(ue=ue[0])._private.children,ce=ue.id();Jr(ve,fe),fe._private.parent=null,v.ids[ce]||(v.ids[ce]=!0,v.push(ue))}v.ids={},t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(n);for(var p=0;p<n.length;p++){var g=n[p];if(g.isEdge()){var x=g.source()[0],C=g.target()[0];f(x,g),f(C,g);for(var A=g.parallelEdges(),z=0;z<A.length;z++){var H=A[z];h(H),H.isBundledBezier()&&H.dirtyBoundingBoxCache()}}else{var F=g.parent();0!==F.length&&b(F,g)}e&&(g._private.removed=!0)}var j=i._private.elements;i._private.hasCompoundNodes=!1;for(var $=0;$<j.length;$++)if(j[$].isParent()){i._private.hasCompoundNodes=!0;break}var K=new or(this.cy(),n);K.size()>0&&(r?K.emitAndNotify("remove"):e&&K.emit("remove"));for(var Q=0;Q<v.length;Q++){var ee=v[Q];(!e||!ee.removed())&&ee.updateStyle()}return K},Vt.move=function(r){var e=this._private.cy,t=this,n=!1,a=!1,i=function(v){return null==v?v:""+v};if(void 0!==r.source||void 0!==r.target){var s=i(r.source),o=i(r.target),l=null!=s&&e.hasElementWithId(s),u=null!=o&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){t.remove(n,a),t.emitAndNotify("moveout");for(var h=0;h<t.length;h++){var v=t[h],b=v._private.data;v.isEdge()&&(l&&(b.source=s),u&&(b.target=o))}t.restore(n,a)}),t.emitAndNotify("move"))}else if(void 0!==r.parent){var c=i(r.parent);if(null===c||e.hasElementWithId(c)){var f=null===c?void 0:c;e.batch(function(){var h=t.remove(n,a);h.emitAndNotify("moveout");for(var v=0;v<t.length;v++){var b=t[v],p=b._private.data;b.isNode()&&(p.parent=f)}h.restore(n,a)}),t.emitAndNotify("move")}}return this},[Eu,np,fi,sn,Un,bp,hi,kp,td,rd,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},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}},mi,bi,sr,cn,cr].forEach(function(r){mt(Vt,r)});var $p={add:function(e){var t,n=this;if(vt(e)){var a=e;if(a._private.cy===n)t=a.restore();else{for(var i=[],s=0;s<a.length;s++)i.push(a[s].json());t=new or(n,i)}}else if(We(e))t=new or(n,e);else if(Oe(e)&&(We(e.nodes)||We(e.edges))){for(var u=e,c=[],d=["nodes","edges"],f=0,h=d.length;f<h;f++){var v=d[f],b=u[v];if(We(b))for(var p=0,g=b.length;p<g;p++){var x=mt({group:v},b[p]);c.push(x)}}t=new or(n,c)}else t=new qa(n,e).collection();return t},remove:function(e){return vt(e)||le(e)&&(e=this.$(e)),e.remove()}};function qp(r,e,t,n){var u=.1,c=typeof Float32Array<"u";if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var f=c?new Float32Array(11):new Array(11);function h(J,K){return 1-3*K+3*J}function v(J,K){return 3*K-6*J}function b(J){return 3*J}function p(J,K,Q){return((h(K,Q)*J+v(K,Q))*J+b(K))*J}function g(J,K,Q){return 3*h(K,Q)*J*J+2*v(K,Q)*J+b(K)}var H=!1;var j=function(K){return H||function F(){H=!0,(r!==e||t!==n)&&function C(){for(var J=0;J<11;++J)f[J]=p(J*u,r,t)}()}(),r===e&&t===n?K:0===K?0:1===K?1:p(function z(J){for(var K=0,Q=1;10!==Q&&f[Q]<=J;++Q)K+=u;--Q;var fe=K+(J-f[Q])/(f[Q+1]-f[Q])*u,ve=g(fe,r,t);return ve>=.001?function x(J,K){for(var Q=0;Q<4;++Q){var ee=g(K,r,t);if(0===ee)return K;K-=(p(K,r,t)-J)/ee}return K}(J,fe):0===ve?fe:function A(J,K,Q){var ee,ue,fe=0;do{(ee=p(ue=K+(Q-K)/2,r,t)-J)>0?Q=ue:K=ue}while(Math.abs(ee)>1e-7&&++fe<10);return ue}(J,K,K+u)}(K),e,n)};j.getControlPoints=function(){return[{x:r,y:e},{x:t,y:n}]};var $="generateBezier("+[r,e,t,n]+")";return j.toString=function(){return $},j}var Kp=function(){function r(n){return-n.tension*n.x-n.friction*n.v}function e(n,a,i){var s={x:n.x+i.dx*a,v:n.v+i.dv*a,tension:n.tension,friction:n.friction};return{dx:s.v,dv:r(s)}}function t(n,a){var i={dx:n.v,dv:r(n)},s=e(n,.5*a,i),o=e(n,.5*a,s),l=e(n,a,o),c=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return n.x=n.x+1/6*(i.dx+2*(s.dx+o.dx)+l.dx)*a,n.v=n.v+c*a,n}return function n(a,i,s){var f,h,v,o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1e-4;for(a=parseFloat(a)||500,i=parseFloat(i)||20,s=s||null,o.tension=a,o.friction=i,h=(f=null!==s)?(u=n(a,i))/s*.016:.016;v=t(v||o,h),l.push(1+v.x),u+=16,Math.abs(v.x)>c&&Math.abs(v.v)>c;);return f?function(b){return l[b*(l.length-1)|0]}:u}}(),Ht=function(e,t,n,a){var i=qp(e,t,n,a);return function(s,o,l){return s+(o-s)*i(l)}},Ei={linear:function(e,t,n){return e+(t-e)*n},ease:Ht(.25,.1,.25,1),"ease-in":Ht(.42,0,1,1),"ease-out":Ht(0,0,.58,1),"ease-in-out":Ht(.42,0,.58,1),"ease-in-sine":Ht(.47,0,.745,.715),"ease-out-sine":Ht(.39,.575,.565,1),"ease-in-out-sine":Ht(.445,.05,.55,.95),"ease-in-quad":Ht(.55,.085,.68,.53),"ease-out-quad":Ht(.25,.46,.45,.94),"ease-in-out-quad":Ht(.455,.03,.515,.955),"ease-in-cubic":Ht(.55,.055,.675,.19),"ease-out-cubic":Ht(.215,.61,.355,1),"ease-in-out-cubic":Ht(.645,.045,.355,1),"ease-in-quart":Ht(.895,.03,.685,.22),"ease-out-quart":Ht(.165,.84,.44,1),"ease-in-out-quart":Ht(.77,0,.175,1),"ease-in-quint":Ht(.755,.05,.855,.06),"ease-out-quint":Ht(.23,1,.32,1),"ease-in-out-quint":Ht(.86,0,.07,1),"ease-in-expo":Ht(.95,.05,.795,.035),"ease-out-expo":Ht(.19,1,.22,1),"ease-in-out-expo":Ht(1,0,0,1),"ease-in-circ":Ht(.6,.04,.98,.335),"ease-out-circ":Ht(.075,.82,.165,1),"ease-in-out-circ":Ht(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Ei.linear;var a=Kp(e,t,n);return function(i,s,o){return i+(s-i)*a(o)}},"cubic-bezier":Ht};function fd(r,e,t,n,a){if(1===n||e===t)return t;var i=a(e,t,n);return null==r||((r.roundValue||r.color)&&(i=Math.round(i)),void 0!==r.min&&(i=Math.max(i,r.min)),void 0!==r.max&&(i=Math.min(i,r.max))),i}function hd(r,e){return null!=r.pfValue||null!=r.value?null==r.pfValue||null!=e&&"%"===e.type.units?r.value:r.pfValue:r}function Kn(r,e,t,n,a){var i=null!=a?a.type:null;t<0?t=0:t>1&&(t=1);var s=hd(r,a),o=hd(e,a);if(Be(s)&&Be(o))return fd(i,s,o,t,n);if(We(s)&&We(o)){for(var l=[],u=0;u<o.length;u++){var c=s[u],d=o[u];if(null!=c&&null!=d){var f=fd(i,c,d,t,n);l.push(f)}else l.push(d)}return l}}function Zp(r,e,t,n){var a=!n,i=r._private,s=e._private,o=s.easing,l=s.startTime,c=(n?r:r.cy()).style();if(!s.easingImpl)if(null==o)s.easingImpl=Ei.linear;else{var d,h,v;d=le(o)?c.parse("transition-timing-function",o).value:o,le(d)?(h=d,v=[]):(h=d[1],v=d.slice(2).map(function(Se){return+Se})),v.length>0?("spring"===h&&v.push(s.duration),s.easingImpl=Ei[h].apply(null,v)):s.easingImpl=Ei[h]}var p,b=s.easingImpl;if(p=0===s.duration?1:(t-l)/s.duration,s.applying&&(p=s.progress),p<0?p=0:p>1&&(p=1),null==s.delay){var g=s.startPosition,x=s.position;if(x&&a&&!r.locked()){var C={};Da(g.x,x.x)&&(C.x=Kn(g.x,x.x,p,b)),Da(g.y,x.y)&&(C.y=Kn(g.y,x.y,p,b)),r.position(C)}var A=s.startPan,z=s.pan,H=i.pan,F=null!=z&&n;F&&(Da(A.x,z.x)&&(H.x=Kn(A.x,z.x,p,b)),Da(A.y,z.y)&&(H.y=Kn(A.y,z.y,p,b)),r.emit("pan"));var j=s.startZoom,$=s.zoom,J=null!=$&&n;J&&(Da(j,$)&&(i.zoom=ga(i.minZoom,Kn(j,$,p,b),i.maxZoom)),r.emit("zoom")),(F||J)&&r.emit("viewport");var K=s.style;if(K&&K.length>0&&a){for(var Q=0;Q<K.length;Q++){var ee=K[Q],ue=ee.name,ve=s.startStyle[ue],pe=Kn(ve,ee,p,b,c.properties[ve.name]);c.overrideBypass(r,ue,pe)}r.emit("style")}}return s.progress=p,p}function Da(r,e){return!!(null!=r&&null!=e&&(Be(r)&&Be(e)||r&&e))}function Jp(r,e,t,n){var a=e._private;a.started=!0,a.startTime=t-a.progress*a.duration}function vd(r,e){var t=e._private.aniEles,n=[];function a(c,d){var f=c._private,h=f.animation.current,v=f.animation.queue,b=!1;if(0===h.length){var p=v.shift();p&&h.push(p)}for(var g=function(H){for(var F=H.length-1;F>=0;F--)(0,H[F])();H.splice(0,H.length)},x=h.length-1;x>=0;x--){var C=h[x],A=C._private;A.stopped?(h.splice(x,1),A.hooked=!1,A.playing=!1,A.started=!1,g(A.frames)):!A.playing&&!A.applying||(A.playing&&A.applying&&(A.applying=!1),A.started||Jp(0,C,r),Zp(c,C,r,d),A.applying&&(A.applying=!1),g(A.frames),null!=A.step&&A.step(r),C.completed()&&(h.splice(x,1),A.hooked=!1,A.playing=!1,A.started=!1,g(A.completes)),b=!0)}return!d&&0===h.length&&0===v.length&&n.push(c),b}for(var i=!1,s=0;s<t.length;s++){var l=a(t[s]);i=i||l}var u=a(e,!0);(i||u)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(n),e.emit("step")}var Qp={animate:Ft.animate(),animation:Ft.animation(),animated:Ft.animated(),clearQueue:Ft.clearQueue(),delay:Ft.delay(),delayAnimation:Ft.delayAnimation(),stop:Ft.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(i,s){vd(s,e)},n.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&Wa(function(i){vd(i,e),t()})}()}}},ey={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var a=t.qualifier;return null==a||e!==n.target&&At(n.target)&&a.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Ti=function(e){return le(e)?new nn(e):e},gd={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new pi(ey,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Ti(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Ti(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Ti(t),n),this},once:function(e,t,n){return this.emitter().one(e,Ti(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}};Ft.eventAliasesOn(gd);var Go={png:function(e){return this._private.renderer.png(e=e||{})},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Go.jpeg=Go.jpg;var Ci={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var i,n=e.name,a=t.extension("layout",n);if(null!=a)return i=le(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new a(mt({},e,{cy:t,eles:i}));jt("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else jt("A `name` must be specified to make a layout");else jt("Layout options must be specified to make a layout")}};Ci.createLayout=Ci.makeLayout=Ci.layout;var ty={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var a=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&a.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var a=e.batchNotifications[n];a.empty()?t.notify(n):t.notify(n,a)})}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),a=0;a<n.length;a++){var i=n[a],s=e[i];t.getElementById(i).data(s)}})}},ry=ir({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),zo={renderTo:function(e,t,n,a){return this._private.renderer.renderTo(e,t,n,a),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(null!=n){void 0!==e.wheelSensitivity&&Bt("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 a=ry(e);a.cy=t,t._private.renderer=new n(a),this.notify("init")}else jt("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},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 a=n._private;a.rscratch={},a.rstyle={},a.animation.current=[],a.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};zo.invalidateDimensions=zo.resize;var Di={collection:function(e,t){return le(e)?this.$(e):vt(e)?e.collection():We(e)?(t||(t={}),new or(this,e,t.unique,t.removed)):new or(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}};Di.elements=Di.filter=Di.$;var rr={apply:function(r){for(var e=this,a=e._private.cy.collection(),i=0;i<r.length;i++){var s=r[i],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0,e.updateStyleHints(s)&&a.push(s)}}return a},getPropertiesDiff:function(r,e){var t=this,n=t._private.propDiffs=t._private.propDiffs||{},a=r+"-"+e,i=n[a];if(i)return i;for(var s=[],o={},l=0;l<t.length;l++){var u=t[l],d="t"===e[l],f="t"===r[l]!==d,h=u.mappedProperties.length>0;if(f||d&&h){var v=void 0;f&&h||f?v=u.properties:h&&(v=u.mappedProperties);for(var b=0;b<v.length;b++){for(var p=v[b],g=p.name,x=!1,C=l+1;C<t.length&&("t"!==e[C]||!(x=null!=t[C].properties[p.name]));C++);!o[g]&&!x&&(o[g]=!0,s.push(g))}}}return n[a]=s,s},getContextMeta:function(r){for(var n,e=this,t="",a=r._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i];t+=s.selector&&s.selector.matches(r)?"t":"f"}return n=e.getPropertiesDiff(a,t),r._private.styleCxtKey=t,{key:t,diffPropNames:n,empty:0===n.length}},getContextStyle:function(r){var e=r.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[e])return n[e];for(var a={_private:{key:e}},i=0;i<this.length;i++){var s=this[i];if("t"===e[i])for(var l=0;l<s.properties.length;l++){var u=s.properties[l];a[u.name]=u}}return n[e]=a,a},applyContextStyle:function(r,e,t){for(var a=r.diffPropNames,i={},s=this.types,o=0;o<a.length;o++){var l=a[o],u=e[l],c=t.pstyle(l);if(!u){if(!c)continue;u=c.bypass?{name:l,deleteBypassed:!0}:{name:l,delete:!0}}if(c!==u){if(u.mapped===s.fn&&null!=c&&null!=c.mapping&&c.mapping.value===u.value){var d=c.mapping;if((d.fnValue=u.value(t))===d.prevFnValue)continue}var h=i[l]={prev:c};this.applyParsedProperty(t,u),h.next=t.pstyle(l),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},updateStyleHints:function(r){var n,e=r._private,t=this,a=t.propertyGroupKeys,i=function(_e,ze,rt){return t.getPropertiesHash(_e,ze,rt)},s=e.styleKey;if(r.removed())return!1;var o="nodes"===e.group,l=r._private.style;n=Object.keys(l);for(var u=0;u<a.length;u++)e.styleKeys[a[u]]=[yn,On];for(var d=function(_e,ze){return e.styleKeys[ze][0]=da(_e,e.styleKeys[ze][0])},f=function(_e,ze){return e.styleKeys[ze][1]=fa(_e,e.styleKeys[ze][1])},h=function(_e,ze){d(_e,ze),f(_e,ze)},v=function(_e,ze){for(var rt=0;rt<_e.length;rt++){var ct=_e.charCodeAt(rt);d(ct,ze),f(ct,ze)}},p=function(_e){return-128<_e&&_e<128&&Math.floor(_e)!==_e?2e9-(1024*_e|0):_e},g=0;g<n.length;g++){var x=n[g],C=l[x];if(null!=C){var A=this.properties[x],z=A.type,H=A.groupKey,F=void 0;null!=A.hashOverride?F=A.hashOverride(r,C):null!=C.pfValue&&(F=C.pfValue);var j=null==A.enums?C.value:null,$=null!=F,Q=C.units;!z.number||!$&&null==j||z.multiple?v(C.strValue,H):(h(p($?F:j),H),!$&&null!=Q&&v(Q,H))}}for(var ue=[yn,On],fe=0;fe<a.length;fe++){var ce=e.styleKeys[a[fe]];ue[0]=da(ce[0],ue[0]),ue[1]=fa(ce[1],ue[1])}e.styleKey=function(e,t){return 2097152*e+t}(ue[0],ue[1]);var pe=e.styleKeys;e.labelDimsKey=Zr(pe.labelDimensions);var Se=i(r,["label"],pe.labelDimensions);if(e.labelKey=Zr(Se),e.labelStyleKey=Zr(Ya(pe.commonLabel,Se)),!o){var Ie=i(r,["source-label"],pe.labelDimensions);e.sourceLabelKey=Zr(Ie),e.sourceLabelStyleKey=Zr(Ya(pe.commonLabel,Ie));var me=i(r,["target-label"],pe.labelDimensions);e.targetLabelKey=Zr(me),e.targetLabelStyleKey=Zr(Ya(pe.commonLabel,me))}if(o){var De=e.styleKeys,at=De.pie,He=De.stripe,Ce=[De.nodeBody,De.nodeBorder,De.nodeOutline,De.backgroundImage,De.compound,at,He].filter(function(Ae){return null!=Ae}).reduce(Ya,[yn,On]);e.nodeKey=Zr(Ce),e.hasPie=null!=at&&at[0]!==yn&&at[1]!==On,e.hasStripe=null!=He&&He[0]!==yn&&He[1]!==On}return s!==e.styleKey},clearStyleHints:function(r){var e=r._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null},applyParsedProperty:function(r,e){var i,t=this,n=e,a=r._private.style,s=t.types,o=t.properties[n.name].type,l=n.bypass,u=a[n.name],c=u&&u.bypass,d=r._private,f="mapping",h=function(Ue){return null==Ue?null:null!=Ue.pfValue?Ue.pfValue:Ue.value},v=function(){var Ue=h(u),qe=h(n);t.checkTriggers(r,n.name,Ue,qe)};if("curve-style"===e.name&&r.isEdge()&&("bezier"!==e.value&&r.isLoop()||"haystack"===e.value&&(r.source().isParent()||r.target().isParent()))&&(n=e=this.parse(e.name,"bezier",l)),n.delete)return a[n.name]=void 0,v(),!0;if(n.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,v(),!0):(v(),!0);if(n.deleteBypass)return u?!!u.bypass&&(a[n.name]=u.bypassed,v(),!0):(v(),!0);var b=function(){Bt("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case s.mapData:for(var p=n.field.split("."),g=d.data,x=0;x<p.length&&g;x++)g=g[p[x]];if(null==g)return b(),!1;var A;if(!Be(g))return Bt("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+g+"` for `"+r.id()+"` is non-numeric)"),!1;var z=n.fieldMax-n.fieldMin;if((A=0===z?0:(g-n.fieldMin)/z)<0?A=0:A>1&&(A=1),o.color){var H=n.valueMin[0],j=n.valueMin[1],$=n.valueMax[1],J=n.valueMin[2],K=n.valueMax[2],Q=null==n.valueMin[3]?1:n.valueMin[3],ee=null==n.valueMax[3]?1:n.valueMax[3],ue=[Math.round(H+(n.valueMax[0]-H)*A),Math.round(j+($-j)*A),Math.round(J+(K-J)*A),Math.round(Q+(ee-Q)*A)];i={bypass:n.bypass,name:n.name,value:ue,strValue:"rgb("+ue[0]+", "+ue[1]+", "+ue[2]+")"}}else{if(!o.number)return!1;i=this.parse(n.name,n.valueMin+(n.valueMax-n.valueMin)*A,n.bypass,f)}if(!i)return b(),!1;i.mapping=n,n=i;break;case s.data:for(var ve=n.field.split("."),ce=d.data,pe=0;pe<ve.length&&ce;pe++)ce=ce[ve[pe]];if(null!=ce&&(i=this.parse(n.name,ce,n.bypass,f)),!i)return b(),!1;i.mapping=n,n=i;break;case s.fn:var me=null!=n.fnValue?n.fnValue:(0,n.value)(r);if(n.prevFnValue=me,null==me)return Bt("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+r.id()+"` is null)"),!1;if(!(i=this.parse(n.name,me,n.bypass,f)))return Bt("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=_r(n),n=i;break;case void 0:break;default:return!1}return l?(n.bypassed=c?u.bypassed:u,a[n.name]=n):c?u.bypassed=n:a[n.name]=n,v(),!0},cleanElements:function(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),e)for(var a=n._private.style,i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],l=a[o];null!=l&&(l.bypass?l.bypassed=null:a[o]=null)}else n._private.style={}}},update:function(){this._private.cy.mutableElements().updateStyle()},updateTransitions:function(r,e){var t=this,n=r._private,a=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,s=r.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var o={},l=!1,u=0;u<a.length;u++){var c=a[u],d=r.pstyle(c),f=e[c];if(f){var v=f.prev,b=null!=f.next?f.next:d,p=!1,g=void 0,x=1e-6;v&&(Be(v.pfValue)&&Be(b.pfValue)?g=v.pfValue+x*(p=b.pfValue-v.pfValue):Be(v.value)&&Be(b.value)?g=v.value+x*(p=b.value-v.value):We(v.value)&&We(b.value)&&(p=v.value[0]!==b.value[0]||v.value[1]!==b.value[1]||v.value[2]!==b.value[2],g=v.strValue),p&&(o[c]=b.strValue,this.applyBypass(r,c,g),l=!0))}}if(!l)return;n.transitioning=!0,new Vn(function(C){s>0?r.delayAnimation(s).play().promise().then(C):C()}).then(function(){return r.animation({style:o,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,a),r.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(r,a),r.emitAndNotify("style"),n.transitioning=!1)},checkTrigger:function(r,e,t,n,a,i){var s=this.properties[e],o=a(s);r.removed()||null!=o&&o(t,n,r)&&i(s)},checkZOrderTrigger:function(r,e,t,n){var a=this;this.checkTrigger(r,e,t,n,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",r)})},checkBoundsTrigger:function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBounds},function(a){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})},checkConnectedEdgesBoundsTrigger:function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfConnectedEdges},function(a){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},checkParallelEdgesBoundsTrigger:function(r,e,t,n){this.checkTrigger(r,e,t,n,function(a){return a.triggersBoundsOfParallelEdges},function(a){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},checkTriggers:function(r,e,t,n){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,n),this.checkBoundsTrigger(r,e,t,n),this.checkConnectedEdgesBoundsTrigger(r,e,t,n),this.checkParallelEdgesBoundsTrigger(r,e,t,n)}},Ia={applyBypass:function(r,e,t,n){var i=[];if("*"===e||"**"===e){if(void 0!==t)for(var o=0;o<this.properties.length;o++){var c=this.parse(this.properties[o].name,t,!0);c&&i.push(c)}}else if(le(e)){var d=this.parse(e,t,!0);d&&i.push(d)}else{if(!Oe(e))return!1;var f=e;n=t;for(var h=Object.keys(f),v=0;v<h.length;v++){var b=h[v],p=f[b];if(void 0===p&&(p=f[Ua(b)]),void 0!==p){var g=this.parse(b,p,!0);g&&i.push(g)}}}if(0===i.length)return!1;for(var x=!1,C=0;C<r.length;C++){for(var A=r[C],z={},H=void 0,F=0;F<i.length;F++){var j=i[F];if(n){var $=A.pstyle(j.name);H=z[j.name]={prev:$}}x=this.applyParsedProperty(A,_r(j))||x,n&&(H.next=A.pstyle(j.name))}x&&this.updateStyleHints(A),n&&this.updateTransitions(A,z,!0)}return x},overrideBypass:function(r,e,t){e=$i(e);for(var n=0;n<r.length;n++){var a=r[n],i=a._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=i?null!=i.pfValue?i.pfValue:i.value:null;i&&i.bypass?(i.value=t,null!=i.pfValue&&(i.pfValue=t),i.strValue=o?"rgb("+t.join(",")+")":l?t.join(" "):""+t,this.updateStyleHints(a)):this.applyBypass(a,e,t),this.checkTriggers(a,e,u,t)}},removeAllBypasses:function(r,e){return this.removeBypasses(r,this.propertyNames,e)},removeBypasses:function(r,e,t){for(var a=0;a<r.length;a++){for(var i=r[a],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],c=i.pstyle(u.name);if(c&&c.bypass){var f=this.parse(l,"",!0),h=s[u.name]={prev:c};this.applyParsedProperty(i,f),h.next=i.pstyle(u.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,s,!0)}}},Vo={getEmSizeInPixels:function(){var r=this.containerCss("font-size");return null!=r?parseFloat(r):1},containerCss:function(r){var e=this._private.cy,t=e.container(),n=e.window();if(n&&t&&n.getComputedStyle)return n.getComputedStyle(t).getPropertyValue(r)}},kr={getRenderedStyle:function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)},getRawStyle:function(r,e){var t=this;if(r=r[0]){for(var n={},a=0;a<t.properties.length;a++){var i=t.properties[a],s=t.getStylePropertyValue(r,i.name,e);null!=s&&(n[i.name]=s,n[Ua(i.name)]=s)}return n}},getIndexedStyle:function(r,e,t,n){return r.pstyle(e)[t][n]??r.cy().style().getDefaultProperty(e)[t][0]},getStylePropertyValue:function(r,e,t){if(r=r[0]){var a=this.properties[e];a.alias&&(a=a.pointsTo);var i=a.type,s=r.pstyle(a.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(t&&i.number&&null!=o&&Be(o)){var c=r.cy().zoom(),d=function(p){return p*c},f=function(p,g){return d(p)+g},h=We(o);return(h?l.every(function(b){return null!=b}):null!=l)?h?o.map(function(b,p){return f(b,l[p])}).join(" "):f(o,l):h?o.map(function(b){return le(b)?b:""+d(b)}).join(" "):""+d(o)}if(null!=u)return u}return null}},getAnimationStartStyle:function(r,e){for(var t={},n=0;n<e.length;n++){var i=e[n].name,s=r.pstyle(i);void 0!==s&&(s=Oe(s)?this.parse(i,s.strValue):this.parse(i,s)),s&&(t[i]=s)}return t},getPropsList:function(r){var t=[],n=r,a=this.properties;if(n)for(var i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],l=n[o],u=a[o]||a[$i(o)],c=this.parse(u.name,l);c&&t.push(c)}return t},getNonDefaultPropertiesHash:function(r,e,t){var i,s,o,l,u,n=t.slice();for(l=0;l<e.length;l++)if(null!=(i=r.pstyle(e[l],!1)))if(null!=i.pfValue)n[0]=da(o,n[0]),n[1]=fa(o,n[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),n[0]=da(o,n[0]),n[1]=fa(o,n[1]);return n}};kr.getPropertiesHash=kr.getNonDefaultPropertiesHash;var Si={appendFromJson:function(r){for(var e=this,t=0;t<r.length;t++){var n=r[t],a=n.selector,i=n.style||n.css,s=Object.keys(i);e.selector(a);for(var o=0;o<s.length;o++){var l=s[o];e.css(l,i[l])}}return e},fromJson:function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e},json:function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],n=t.selector,a=t.properties,i={},s=0;s<a.length;s++){var o=a[s];i[o.name]=o.strValue}r.push({selector:n?n.toString():"core",style:i})}return r}},Ho={appendFromString:function(r){var a,i,s,t=this,n=""+r;function o(){n=n.length>a.length?n.substr(a.length):""}function l(){i=i.length>s.length?i.substr(s.length):""}for(n=n.replace(/[/][*](\s|.)+?[*][/]/g,"");!n.match(/^\s*$/);){var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Bt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}a=c[0];var d=c[1];if("core"!==d&&new nn(d).invalid)Bt("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),o();else{var h=c[2],v=!1;i=h;for(var b=[];!i.match(/^\s*$/);){var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Bt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),v=!0;break}s=g[0];var x=g[1],C=g[2];this.properties[x]?t.parse(x,C)?(b.push({name:x,val:C}),l()):(Bt("Skipping property: Invalid property definition in: "+s),l()):(Bt("Skipping property: Invalid property name in: "+s),l())}if(v){o();break}t.selector(d);for(var H=0;H<b.length;H++){var F=b[H];t.css(F.name,F.val)}o()}}return t},fromString:function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e}},Kt={};(function(){var r=Jt,e=Kf,t=Jf,i=function(Ae){return"^"+Ae+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(Ae){var _e=r+"|\\w+|"+e+"|"+t+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+Ae+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+_e+")\\s*\\,\\s*("+_e+")\\)$"},o=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Kt.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"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},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},boxSelection:{enums:["contain","overlap","none"]},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","circle"]},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","top-inside","center","bottom","bottom-inside"]},halign:{enums:["left","left-inside","center","right","right-inside"]},justification:{enums:["left","center","right","auto"]},textMetrics:{enums:["font","glyph"]},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:o,singleRegexMatchValue:!0},urls:{regexes:o,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(Ae,_e){switch(Ae.length){case 2:return"deg"!==_e[0]&&"rad"!==_e[0]&&"deg"!==_e[1]&&"rad"!==_e[1];case 1:return le(Ae[0])||"deg"===_e[0]||"rad"===_e[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\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(Ae){var _e=Ae.length;return 1===_e||2===_e||4===_e}}};var l={zeroNonZero:function(Ae,_e){return(null==Ae||null==_e)&&Ae!==_e||0==Ae&&0!=_e||0!=Ae&&0==_e},any:function(Ae,_e){return Ae!=_e},emptyNonEmpty:function(Ae,_e){var ze=Sr(Ae),rt=Sr(_e);return ze&&!rt||!ze&&rt}},u=Kt.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],d=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],f=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],h=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],v=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification},{name:"text-metrics",type:u.textMetrics},{name:"box-select-labels",type:u.bool,triggersBounds:l.any}],b=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any},{name:"box-selection",type:u.boxSelection,triggersZOrder:l.any}],p=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(Ae,_e,ze){return Ae!==_e&&"bezier"===ze.pstyle("curve-style").value}},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],g=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],x=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],C=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],A=function(Ae,_e){return"label"===_e.value?-Ae.poolIndex():_e.pfValue},z=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:A},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:A},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],H=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],F=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],j=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],$=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],J=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(Ae,_e){return Ae!==_e&&("bezier"===Ae||"bezier"===_e)}},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],K=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],Q=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],ee=[];Kt.pieBackgroundN=16,ee.push({name:"pie-size",type:u.sizeMaybePercent}),ee.push({name:"pie-hole",type:u.sizeMaybePercent}),ee.push({name:"pie-start-angle",type:u.angle});for(var ue=1;ue<=Kt.pieBackgroundN;ue++)ee.push({name:"pie-"+ue+"-background-color",type:u.color}),ee.push({name:"pie-"+ue+"-background-size",type:u.percent}),ee.push({name:"pie-"+ue+"-background-opacity",type:u.zeroOneNumber});var fe=[];Kt.stripeBackgroundN=16,fe.push({name:"stripe-size",type:u.sizeMaybePercent}),fe.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var ve=1;ve<=Kt.stripeBackgroundN;ve++)fe.push({name:"stripe-"+ve+"-background-color",type:u.color}),fe.push({name:"stripe-"+ve+"-background-size",type:u.percent}),fe.push({name:"stripe-"+ve+"-background-opacity",type:u.zeroOneNumber});var ce=[],pe=Kt.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(Ce){pe.forEach(function(Ae){ce.push({name:Ae+"-"+Ce.name,type:Ce.type,triggersBounds:Ce.triggersBounds})})},{});var Se=Kt.properties=[].concat(b,C,p,g,x,K,v,h,c,d,f,z,H,F,j,ee,fe,$,J,ce,Q),Ie=Kt.propertyGroups={behavior:b,transition:C,visibility:p,overlay:g,underlay:x,ghost:K,commonLabel:v,labelDimensions:h,mainLabel:c,sourceLabel:d,targetLabel:f,nodeBody:z,nodeBorder:H,nodeOutline:F,backgroundImage:j,pie:ee,stripe:fe,compound:$,edgeLine:J,edgeArrow:ce,core:Q},me=Kt.propertyGroupNames={};(Kt.propertyGroupKeys=Object.keys(Ie)).forEach(function(Ce){me[Ce]=Ie[Ce].map(function(Ae){return Ae.name}),Ie[Ce].forEach(function(Ae){return Ae.groupKey=Ce})});var Ue=Kt.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"}];Kt.propertyNames=Se.map(function(Ce){return Ce.name});for(var qe=0;qe<Se.length;qe++){var je=Se[qe];Se[je.name]=je}for(var Je=0;Je<Ue.length;Je++){var tt=Ue[Je],He={name:tt.name,alias:!0,pointsTo:Se[tt.pointsTo]};Se.push(He),Se[tt.name]=He}})(),Kt.getDefaultProperty=function(r){return this.getDefaultProperties()[r]},Kt.getDefaultProperties=function(){var r=this._private;if(null!=r.defaultProperties)return r.defaultProperties;for(var e=mt({"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","box-selection":"contain","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","text-metrics":"font","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","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%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var c=1;c<=Kt.pieBackgroundN;c++)l[u.name.replace("{{i}}",c)]=u.value;return l},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var c=1;c<=Kt.stripeBackgroundN;c++)l[u.name.replace("{{i}}",c)]=u.value;return l},{}),{"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(l,u){return Kt.arrowPrefixes.forEach(function(c){l[c+"-"+u.name]=u.value}),l},{})),t={},n=0;n<this.properties.length;n++){var a=this.properties[n];if(!a.pointsTo){var i=a.name,o=this.parse(i,e[i]);t[i]=o}}return r.defaultProperties=t,r.defaultProperties},Kt.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 Ii={parse:function(r,e,t,n){var a=this;if(ke(e))return a.parseImplWarn(r,e,t,n);var c,l=Hl(r,""+e,t?"t":"f","mapping"===n||!0===n||!1===n||null==n?"dontcare":n),u=a.propCache=a.propCache||[];return(c=u[l])||(c=u[l]=a.parseImplWarn(r,e,t,n)),(t||"mapping"===n)&&(c=_r(c))&&(c.value=_r(c.value)),c},parseImplWarn:function(r,e,t,n){var a=this.parseImpl(r,e,t,n);return!a&&null!=e&&Bt("The style property `".concat(r,": ").concat(e,"` is invalid")),a&&("width"===a.name||"height"===a.name)&&"label"===e&&Bt("The style value of `label` is deprecated for `"+a.name+"`"),a},parseImpl:function(r,e,t,n){var a=this;r=$i(r);var i=a.properties[r],s=e,o=a.types;if(!i||void 0===e)return null;i.alias&&(r=(i=i.pointsTo).name);var l=le(e);l&&(e=e.trim());var c,d,u=i.type;if(!u)return null;if(t&&(""===e||null===e))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(ke(e))return{name:r,value:e,strValue:"fn",mapped:o.fn,bypass:t};if(!(!l||n||e.length<7||"a"!==e[1])){if(e.length>=7&&"d"===e[0]&&(c=new RegExp(o.data.regex).exec(e)))return!t&&{name:r,value:c,strValue:""+e,mapped:o.data,field:c[1],bypass:t};if(e.length>=10&&"m"===e[0]&&(d=new RegExp(o.mapData.regex).exec(e))){if(t||u.multiple)return!1;var h=o.mapData;if(!u.color&&!u.number)return!1;var v=this.parse(r,d[4]);if(!v||v.mapped)return!1;var b=this.parse(r,d[5]);if(!b||b.mapped)return!1;if(v.pfValue===b.pfValue||v.strValue===b.strValue)return Bt("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+v.strValue+"`"),this.parse(r,v.strValue);if(u.color){var p=v.value,g=b.value;if(!(p[0]!==g[0]||p[1]!==g[1]||p[2]!==g[2]||p[3]!==g[3]&&(null!=p[3]&&1!==p[3]||null!=g[3]&&1!==g[3])))return!1}return{name:r,value:d,strValue:""+e,mapped:h,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:v.value,valueMax:b.value,bypass:t}}}if(u.multiple&&"multiple"!==n){var C;if(C=l?e.split(/\s+/):We(e)?e:[e],u.evenMultiple&&C.length%2!=0)return null;for(var A=[],z=[],H=[],F="",j=!1,$=0;$<C.length;$++){var J=a.parse(r,C[$],t,"multiple");j=j||le(J.value),A.push(J.value),H.push(null!=J.pfValue?J.pfValue:J.value),z.push(J.units),F+=($>0?" ":"")+J.strValue}return u.validate&&!u.validate(A,z)?null:u.singleEnum&&j?1===A.length&&le(A[0])?{name:r,value:A[0],strValue:A[0],bypass:t}:null:{name:r,value:A,pfValue:H,strValue:F,bypass:t,units:z}}var K=function(){for(var He=0;He<u.enums.length;He++)if(u.enums[He]===e)return{name:r,value:e,strValue:""+e,bypass:t};return null};if(u.number){var Q,ee="px";if(u.units&&(Q=u.units),u.implicitUnits&&(ee=u.implicitUnits),!u.unitless)if(l){var ue="px|em"+(u.allowPercent?"|\\%":"");Q&&(ue=Q);var fe=e.match("^("+Jt+")("+ue+")?$");fe&&(e=fe[1],Q=fe[2]||ee)}else(!Q||u.implicitUnits)&&(Q=ee);if(e=parseFloat(e),isNaN(e)&&void 0===u.enums)return null;if(isNaN(e)&&void 0!==u.enums)return e=s,K();if(u.integer&&!function(e){return Be(e)&&Math.floor(e)===e}(e)||void 0!==u.min&&(e<u.min||u.strictMin&&e===u.min)||void 0!==u.max&&(e>u.max||u.strictMax&&e===u.max))return null;var ve={name:r,value:e,strValue:""+e+(Q||""),units:Q,bypass:t};return ve.pfValue=u.unitless||"px"!==Q&&"em"!==Q?e:"px"!==Q&&Q?this.getEmSizeInPixels()*e:e,("ms"===Q||"s"===Q)&&(ve.pfValue="ms"===Q?e:1e3*e),("deg"===Q||"rad"===Q)&&(ve.pfValue="rad"===Q?e:function(e){return Math.PI*e/180}(e)),"%"===Q&&(ve.pfValue=e/100),ve}if(u.propList){var ce=[],pe=""+e;if("none"!==pe){for(var Se=pe.split(/\s*,\s*|\s+/),Ie=0;Ie<Se.length;Ie++){var me=Se[Ie].trim();a.properties[me]?ce.push(me):Bt("`"+me+"` is not a valid property name")}if(0===ce.length)return null}return{name:r,value:ce,strValue:0===ce.length?"none":ce.join(" "),bypass:t}}if(u.color){var De=xl(e);return De?{name:r,value:De,pfValue:De,strValue:"rgb("+De[0]+","+De[1]+","+De[2]+")",bypass:t}:null}if(u.regex||u.regexes){if(u.enums){var Ue=K();if(Ue)return Ue}for(var qe=u.regexes?u.regexes:[u.regex],je=0;je<qe.length;je++){var tt=new RegExp(qe[je]).exec(e);if(tt)return{name:r,value:u.singleRegexMatchValue?tt[1]:tt,strValue:""+e,bypass:t}}return null}return u.string?{name:r,value:""+e,strValue:""+e,bypass:t}:u.enums?K():null}},nr=function(e){if(!(this instanceof nr))return new nr(e);wr(e)?(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):jt("A style must have a core reference")},dr=nr.prototype;dr.instanceString=function(){return"style"},dr.clear=function(){for(var r=this._private,t=r.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(a){var i=a[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this},dr.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},dr.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)},dr.selector=function(r){var e="core"===r?null:new nn(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this},dr.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var a=this.properties[n],i=t[a.name];void 0===i&&(i=t[Ua(a.name)]),void 0!==i&&this.cssRule(a.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},dr.style=dr.css,dr.cssRule=function(r,e){var t=this.parse(r,e);if(t){var n=this.length-1;this[n].properties.push(t),this[n].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.name.match(/stripe-(\d+)-background-size/)&&t.value&&(this._private.hasStripe=!0),t.mapped&&this[n].mappedProperties.push(t),!this[n].selector&&(this._private.coreStyle[t.name]=t)}return this},dr.append=function(r){return pn(r)?r.appendToStyle(this):We(r)?this.appendFromJson(r):le(r)&&this.appendFromString(r),this},nr.fromJson=function(r,e){var t=new nr(r);return t.fromJson(e),t},nr.fromString=function(r,e){return new nr(r).fromString(e)},[rr,Ia,Vo,kr,Si,Ho,Kt,Ii].forEach(function(r){mt(dr,r)}),nr.types=dr.types,nr.properties=dr.properties,nr.propertyGroups=dr.propertyGroups,nr.propertyGroupNames=dr.propertyGroupNames,nr.propertyGroupKeys=dr.propertyGroupKeys;var ay={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return t.style=pn(e)?e.generateStyle(this):We(e)?nr.fromJson(this,e):le(e)?nr.fromString(this,e):nr(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Tn={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType="single"),void 0===e?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var n,a,i,s,o,e=arguments,t=this._private.pan;switch(e.length){case 0:return t;case 1:if(le(e[0]))return t[n=e[0]];if(Oe(e[0])){if(!this._private.panningEnabled)return this;o=(i=e[0]).y,Be(s=i.x)&&(t.x=s),Be(o)&&(t.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[1],("x"===(n=e[0])||"y"===n)&&Be(a)&&(t[n]=a),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var i,s,o,l,u,n=arguments,a=this._private.pan;if(!this._private.panningEnabled)return this;switch(n.length){case 1:Oe(e)&&(u=(o=n[0]).y,Be(l=o.x)&&(a.x+=l),Be(u)&&(a.y+=u),this.emit("pan viewport"));break;case 2:s=t,("x"===(i=e)||"y"===i)&&Be(s)&&(a[i]+=s),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var a=this._private;a.zoom=n.zoom,a.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){var n;if((Be(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled)&&(le(e)?e=this.$(e):!function(e){return Oe(e)&&Be(e.x1)&&Be(e.x2)&&Be(e.y1)&&Be(e.y2)}(e)?vt(e)||(e=this.mutableElements()):((n={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1),!vt(e)||!e.empty())){n=n||e.boundingBox();var l,s=this.width(),o=this.height();if(t=Be(t)?t:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:l=(l=(l=Math.min((s-2*t)/n.w,(o-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:l)<this._private.minZoom?this._private.minZoom:l,pan:{x:(s-l*(n.x1+n.x2))/2,y:(o-l*(n.y1+n.y2))/2}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var a=e;e=a.min,t=a.max}return Be(e)&&Be(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):Be(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:Be(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var i,s,t=this._private,n=t.pan,a=t.zoom,o=!1;return t.zoomingEnabled||(o=!0),Be(e)?s=e:Oe(e)&&(s=e.level,null!=e.position?i=Za(e.position,a,n):null!=e.renderedPosition&&(i=e.renderedPosition),null!=i&&!t.panningEnabled&&(o=!0)),s=(s=s>t.maxZoom?t.maxZoom:s)<t.minZoom?t.minZoom:s,!o&&Be(s)&&s!==a&&(null==i||Be(i.x)&&Be(i.y))?null!=i?{zoomed:!0,panned:!0,zoom:s,pan:{x:-s/a*(i.x-n.x)+i.x,y:-s/a*(i.y-n.y)+i.y}}:{zoomed:!0,panned:!1,zoom:s,pan:n}:null},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(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):this},viewport:function(e){var t=this._private,n=!0,a=!0,i=[],s=!1,o=!1;if(!e)return this;if(Be(e.zoom)||(n=!1),Oe(e.pan)||(a=!1),!n&&!a)return this;if(n){var l=e.zoom;l<t.minZoom||l>t.maxZoom||!t.zoomingEnabled?s=!0:(t.zoom=l,i.push("zoom"))}if(a&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;Be(u.x)&&(t.pan.x=u.x,o=!1),Be(u.y)&&(t.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(le(e)){var n=e;e=this.mutableElements().filter(n)}else vt(e)||(e=this.mutableElements());if(0!==e.length){var a=e.boundingBox(),i=this.width(),s=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(a.x1+a.x2))/2,y:(s-t*(a.y1+a.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var a,i,e=this._private,t=e.container;return e.sizeCache=e.sizeCache||(t?(a=this.window().getComputedStyle(t),{width:t.clientWidth-(i=function(o){return parseFloat(a.getPropertyValue(o))})("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("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(),a={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 a.w=a.x2-a.x1,a.h=a.y2-a.y1,a},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Tn.centre=Tn.center,Tn.autolockNodes=Tn.autolock,Tn.autoungrabifyNodes=Tn.autoungrabify;var La={data:Ft.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};La.attr=La.data,La.removeAttr=La.removeData;var Aa=function(e){var t=this,n=(e=mt({},e)).container;n&&!nt(n)&&nt(n[0])&&(n=n[0]);var a=n?n._cyreg:null;(a=a||{})&&a.cy&&(a.cy.destroy(),a={});var i=a.readies=a.readies||[];n&&(n._cyreg=a),a.cy=t;var s=void 0!==Ne&&void 0!==n&&!e.headless,o=e;o.layout=mt({name:s?"grid":"null"},o.layout),o.renderer=mt({name:s?"canvas":"null"},o.renderer);var l=function(v,b,p){return void 0!==b?b:void 0!==p?p:v},u=this._private={container:n,ready:!1,options:o,elements:new or(this),listeners:[],aniEles:new or(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?s:o.styleEnabled,zoom:Be(o.zoom)?o.zoom:1,pan:{x:Oe(o.pan)&&Be(o.pan.x)?o.pan.x:0,y:Oe(o.pan)&&Be(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),u.styleEnabled&&t.setStyle([]);var d=mt({},o,o.renderer);t.initRenderer(d),function(v,b){if(v.some(Yf))return Vn.all(v).then(b);b(v)}([o.style,o.elements],function(h){var v=h[0],b=h[1];u.styleEnabled&&t.style().append(v),function(v,b,p){t.notifications(!1);var g=t.mutableElements();g.length>0&&g.remove(),null!=v&&(Oe(v)||We(v))&&t.add(v),t.one("layoutready",function(C){t.notifications(!0),t.emit(C),t.one("load",b),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var x=mt({},t._private.options.layout);x.eles=t.elements(),t.layout(x).run()}(b,function(){t.startAnimationLoop(),u.ready=!0,ke(o.ready)&&t.on("ready",o.ready);for(var p=0;p<i.length;p++)t.on("ready",i[p]);a&&(a.readies=[]),t.emit("ready")},o.done)})},Li=Aa.prototype;mt(Li,{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(){if(null==this._private.container)return Ne;var t=this._private.container.ownerDocument;return void 0===t||null==t?Ne:t.defaultView||Ne},mount:function(e){if(null!=e){var t=this,n=t._private,a=n.options;return!nt(e)&&nt(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(mt({},a,a.renderer,{name:"null"===a.renderer.name?"canvas":a.renderer.name})),t.startAnimationLoop(),t.style(a.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 _r(this._private.options)},json:function(e){var t=this,n=t._private,a=t.mutableElements();if(Oe(e)){if(t.startBatch(),e.elements){var s={},o=function(A,z){for(var H=[],F=[],j=0;j<A.length;j++){var $=A[j];if($.data.id){var J=""+$.data.id,K=t.getElementById(J);s[J]=!0,0!==K.length?F.push({ele:K,json:$}):(z&&($.group=z),H.push($))}else Bt("cy.json() cannot handle elements without an ID attribute")}t.add(H);for(var Q=0;Q<F.length;Q++){var ee=F[Q];ee.ele.json(ee.json)}};if(We(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var c=l[u],d=e.elements[c];We(d)&&o(d,c)}var f=t.collection();a.filter(function(C){return!s[C.id()]}).forEach(function(C){C.isParent()?f.merge(C):C.remove()}),f.forEach(function(C){return C.children().move({parent:null})}),f.forEach(function(C){return(A=C,t.getElementById(A.id())).remove();var A})}e.style&&t.style(e.style),null!=e.zoom&&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"],v=0;v<h.length;v++){var b=h[v];null!=e[b]&&t[b](e[b])}return t.endBatch(),this}var g={};e?g.elements=this.elements().map(function(C){return C.json()}):(g.elements={},a.forEach(function(C){var A=C.group();g.elements[A]||(g.elements[A]=[]),g.elements[A].push(C.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=_r(t.data());var x=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=_r(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=_r(x.renderer),g.hideEdgesOnViewport=x.hideEdgesOnViewport,g.textureOnViewport=x.textureOnViewport,g.wheelSensitivity=x.wheelSensitivity,g.motionBlur=x.motionBlur,g.multiClickDebounceTime=x.multiClickDebounceTime,g}}),Li.$id=Li.getElementById,[$p,Qp,gd,Go,Ci,ty,zo,Di,ay,Tn,La].forEach(function(r){mt(Li,r)});var sy={fit:!0,directed:!1,direction:"downward",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}},oy={maximal:!1,acyclic:!1},Zn=function(e){return e.scratch("breadthfirst")},pd=function(e,t){return e.scratch("breadthfirst",t)};function yd(r){this.options=mt({},sy,oy,r)}yd.prototype.run=function(){var u,r=this.options,e=r.cy,t=r.eles,n=t.nodes().filter(function(pt){return pt.isChildless()}),a=t,i=r.directed,s=r.acyclic||r.maximal||r.maximalAdjustments>0,o=!!r.boundingBox,l=gr(o?r.boundingBox:structuredClone(e.extent()));if(vt(r.roots))u=r.roots;else if(We(r.roots)){for(var c=[],d=0;d<r.roots.length;d++){var h=e.getElementById(r.roots[d]);c.push(h)}u=e.collection(c)}else if(le(r.roots))u=e.$(r.roots);else if(i)u=n.roots();else{var v=t.components();u=e.collection();for(var b=function(){var ot=v[p],gt=ot.maxDegree(!1),ht=ot.filter(function(Tt){return Tt.degree(!1)===gt});u=u.add(ht)},p=0;p<v.length;p++)b()}var g=[],x={},C=function(ot,gt){null==g[gt]&&(g[gt]=[]);var ht=g[gt].length;g[gt].push(ot),pd(ot,{index:ht,depth:gt})};a.bfs({roots:u,directed:r.directed,visit:function(ot,gt,ht,Tt,xt){var It=ot[0],Rt=It.id();It.isChildless()&&C(It,xt),x[Rt]=!0}});for(var z=[],H=0;H<n.length;H++){var F=n[H];x[F.id()]||z.push(F)}var j=function(ot){for(var gt=g[ot],ht=0;ht<gt.length;ht++){var Tt=gt[ht];null!=Tt?pd(Tt,{depth:ot,index:ht}):(gt.splice(ht,1),ht--)}},$=function(ot,gt){for(var ht=Zn(ot),Tt=ot.incomers().filter(function(Xe){return Xe.isNode()&&t.has(Xe)}),xt=-1,It=ot.id(),Rt=0;Rt<Tt.length;Rt++){var kt=Zn(Tt[Rt]);xt=Math.max(xt,kt.depth)}if(ht.depth<=xt){if(!r.acyclic&>[It])return null;var _t=xt+1;return function(ot,gt){var ht=Zn(ot);g[ht.depth][ht.index]=null,ot.isChildless()&&C(ot,gt)}(ot,_t),gt[It]=_t,!0}return!1};if(i&&s){var J=[],K={},Q=function(ot){return J.push(ot)},ee=function(){return J.shift()};for(n.forEach(function(pt){return J.push(pt)});J.length>0;){var ue=ee(),fe=$(ue,K);if(fe)ue.outgoers().filter(function(pt){return pt.isNode()&&t.has(pt)}).forEach(Q);else if(null===fe){Bt("Detected double maximal shift for node `"+ue.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var ve=0;if(r.avoidOverlap)for(var ce=0;ce<n.length;ce++){var Se=n[ce].layoutDimensions(r);ve=Math.max(ve,Se.w,Se.h)}var De={},Ue=function(ot){if(De[ot.id()])return De[ot.id()];for(var gt=Zn(ot).depth,ht=ot.neighborhood(),Tt=0,xt=0,It=0;It<ht.length;It++){var Rt=ht[It];if(!Rt.isEdge()&&!Rt.isParent()&&n.has(Rt)){var Gt=Zn(Rt);if(null!=Gt){var kt=Gt.index,_t=Gt.depth;null!=kt&&null!=_t&&_t<gt&&(Tt+=kt/g[_t].length,xt++)}}}return Tt/=xt=Math.max(1,xt),0===xt&&(Tt=0),De[ot.id()]=Tt,Tt},qe=function(ot,gt){var xt=Ue(ot)-Ue(gt);return 0===xt?bl(ot.id(),gt.id()):xt};void 0!==r.depthSort&&(qe=r.depthSort);for(var je=g.length,Je=0;Je<je;Je++)g[Je].sort(qe),j(Je);for(var tt=[],at=0;at<z.length;at++)tt.push(z[at]);tt.length&&(g.unshift(tt),je=g.length,function(){for(var ot=0;ot<je;ot++)j(ot)}());for(var Ce=0,Ae=0;Ae<je;Ae++)Ce=Math.max(g[Ae].length,Ce);var _e_x=l.x1+l.w/2,_e_y=l.y1+l.h/2,ze=n.reduce(function(pt,ot){return gt=ot.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}),{w:-1===pt.w?gt.w:(pt.w+gt.w)/2,h:-1===pt.h?gt.h:(pt.h+gt.h)/2};var gt},{w:-1,h:-1}),rt=Math.max(1===je?0:o?(l.h-2*r.padding-ze.h)/(je-1):(l.h-2*r.padding-ze.h)/(je+1),ve),ct=g.reduce(function(pt,ot){return Math.max(pt,ot.length)},0),Et={downward:0,leftward:90,upward:180,rightward:-90};return-1===Object.keys(Et).indexOf(r.direction)&&jt("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Et).join(", "))),t.nodes().layoutPositions(this,r,function(ot){return function Eh(r,e,t){if(0===t)return r;var n=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2,i=e.w/e.h,s=1/i,o=function xh(r,e,t,n,a){var i=a*Math.PI/180;return{x:Math.cos(i)*(r-t)-Math.sin(i)*(e-n)+t,y:Math.sin(i)*(r-t)+Math.cos(i)*(e-n)+n}}(r.x,r.y,n,a,t),l=function(e,t,n,a,i,s){return{x:(e-n)*i+n,y:(t-a)*s+a}}(o.x,o.y,n,a,i,s);return{x:l.x,y:l.y}}(function(ot){var gt=Zn(ot),ht=gt.depth,Tt=gt.index;if(r.circle){var xt=Math.min(l.w/2/je,l.h/2/je),It=(xt=Math.max(xt,ve))*ht+xt-(je>0&&g[0].length<=3?xt/2:0),Rt=2*Math.PI/g[ht].length*Tt;return 0===ht&&1===g[0].length&&(It=1),{x:_e_x+It*Math.cos(Rt),y:_e_y+It*Math.sin(Rt)}}var Gt=g[ht].length,kt=Math.max(1===Gt?0:o?(l.w-2*r.padding-ze.w)/((r.grid?ct:Gt)-1):(l.w-2*r.padding-ze.w)/((r.grid?ct:Gt)+1),ve);return{x:_e_x+(Tt+1-(Gt+1)/2)*kt,y:_e_y+(ht+1-(je+1)/2)*rt}}(ot),l,Et[r.direction])}),this};var ly={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function md(r){this.options=mt({},ly,r)}md.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var c,s=gr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=(void 0===e.sweep?2*Math.PI-2*Math.PI/i.length:e.sweep)/Math.max(1,i.length-1),d=0,f=0;f<i.length;f++){var v=i[f].layoutDimensions(e);d=Math.max(d,v.w,v.h)}if(c=Be(e.radius)?e.radius:i.length<=1?0:Math.min(s.h,s.w)/2-d,i.length>1&&e.avoidOverlap){d*=1.75;var g=Math.cos(u)-Math.cos(0),x=Math.sin(u)-Math.sin(0),C=Math.sqrt(d*d/(g*g+x*x));c=Math.max(C,c)}return n.nodes().layoutPositions(this,e,function(H,F){var j=e.startAngle+F*u*(a?1:-1),$=c*Math.cos(j),J=c*Math.sin(j);return{x:o.x+$,y:o.y+J}}),this};var uy={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function bd(r){this.options=mt({},uy,r)}bd.prototype.run=function(){for(var r=this.options,e=r,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=r.cy,a=e.eles,i=a.nodes().not(":parent"),s=gr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,c=0;c<i.length;c++){var f,d=i[c];f=e.concentric(d),l.push({value:f,node:d}),d._private.scratch.concentric=f}i.updateStyle();for(var h=0;h<i.length;h++){var b=i[h].layoutDimensions(e);u=Math.max(u,b.w,b.h)}l.sort(function(rt,ct){return ct.value-rt.value});for(var p=e.levelWidth(i),g=[[]],x=g[0],C=0;C<l.length;C++){var A=l[C];x.length>0&&Math.abs(x[0].value-A.value)>=p&&g.push(x=[]),x.push(A)}var H=u+e.minNodeSpacing;if(!e.avoidOverlap){var F=g.length>0&&g[0].length>1,j=Math.min(s.w,s.h)/2-H;H=Math.min(H,j/(g.length+F?1:0))}for(var J=0,K=0;K<g.length;K++){var Q=g[K],ee=void 0===e.sweep?2*Math.PI-2*Math.PI/Q.length:e.sweep,ue=Q.dTheta=ee/Math.max(1,Q.length-1);if(Q.length>1&&e.avoidOverlap){var fe=Math.cos(ue)-Math.cos(0),ve=Math.sin(ue)-Math.sin(0),ce=Math.sqrt(H*H/(fe*fe+ve*ve));J=Math.max(ce,J)}Q.r=J,J+=H}if(e.equidistant){for(var pe=0,Se=0,Ie=0;Ie<g.length;Ie++)pe=Math.max(pe,g[Ie].r-Se);Se=0;for(var Ue=0;Ue<g.length;Ue++){var qe=g[Ue];0===Ue&&(Se=qe.r),qe.r=Se,Se+=pe}}for(var je={},Je=0;Je<g.length;Je++)for(var tt=g[Je],at=tt.dTheta,He=tt.r,Ce=0;Ce<tt.length;Ce++){var Ae=tt[Ce],_e=e.startAngle+(t?1:-1)*at*Ce,ze={x:o.x+He*Math.cos(_e),y:o.y+He*Math.sin(_e)};je[Ae.node.id()]=ze}return a.nodes().layoutPositions(this,e,function(rt){var ct=rt.id();return je[ct]}),this};var Uo,cy={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 Ai(r){this.options=mt({},cy,r),this.options.layout=this;var e=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(a){var i=a.source().data("id"),s=a.target().data("id"),o=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(n)}Ai.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(!0===r.animate||!1===r.animate)&&t.emit({type:"layoutstart",layout:t}),Uo=!0===r.debug;var n=dy(e,t,r);Uo&&(void 0)(n),r.randomize&&vy(n);var a=Ur(),i=function(){gy(n,e,r),!0===r.fit&&e.fit(r.padding)},s=function(f){return!(t.stopped||f>=r.numIter||(py(n,r),n.temperature=n.temperature*r.coolingFactor,n.temperature<r.minTemp))},o=function(){if(!0===r.animate||!1===r.animate)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var f=r.eles.nodes(),h=wd(n,r,f);f.layoutPositions(t,r,h)}},l=0,u=!0;if(!0===r.animate){var c=function(){for(var f=0;u&&f<r.refresh;)u=s(l),l++,f++;u?(Ur()-a>=r.animationThreshold&&i(),Wa(c)):(Cd(n,r),o())};c()}else{for(;u;)u=s(l),l++;Cd(n,r),o()}return this},Ai.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Ai.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var dy=function(e,t,n){for(var a=n.eles.edges(),i=n.eles.nodes(),s=gr(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:n.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=n.eles.components(),u={},c=0;c<l.length;c++)for(var d=l[c],f=0;f<d.length;f++)u[d[f].id()]=c;for(c=0;c<o.nodeSize;c++){var b=(v=i[c]).layoutDimensions(n);(p={}).isLocked=v.locked(),p.id=v.data("id"),p.parentId=v.data("parent"),p.cmptId=u[v.id()],p.children=[],p.positionX=v.position("x"),p.positionY=v.position("y"),p.offsetX=0,p.offsetY=0,p.height=b.w,p.width=b.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(v.style("padding")),p.padRight=parseFloat(v.style("padding")),p.padTop=parseFloat(v.style("padding")),p.padBottom=parseFloat(v.style("padding")),p.nodeRepulsion=ke(n.nodeRepulsion)?n.nodeRepulsion(v):n.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=c}var g=[],x=0,C=-1,A=[];for(c=0;c<o.nodeSize;c++){var v,z=(v=o.layoutNodes[c]).parentId;null!=z?o.layoutNodes[o.idToIndex[z]].children.push(v.id):(g[++C]=v.id,A.push(v.id))}for(o.graphSet.push(A);x<=C;){var H=g[x++],j=o.layoutNodes[o.idToIndex[H]].children;if(j.length>0)for(o.graphSet.push(j),c=0;c<j.length;c++)g[++C]=j[c]}for(c=0;c<o.graphSet.length;c++){var $=o.graphSet[c];for(f=0;f<$.length;f++)o.indexToGraph[o.idToIndex[$[f]]]=c}for(c=0;c<o.edgeSize;c++){var K=a[c],Q={};Q.id=K.data("id"),Q.sourceId=K.data("source"),Q.targetId=K.data("target");var ee=ke(n.idealEdgeLength)?n.idealEdgeLength(K):n.idealEdgeLength,ue=ke(n.edgeElasticity)?n.edgeElasticity(K):n.edgeElasticity,fe=o.idToIndex[Q.sourceId],ve=o.idToIndex[Q.targetId];if(o.indexToGraph[fe]!=o.indexToGraph[ve]){for(var Se=fy(Q.sourceId,Q.targetId,o),Ie=o.graphSet[Se],me=0,p=o.layoutNodes[fe];-1===Ie.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],me++;for(p=o.layoutNodes[ve];-1===Ie.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],me++;ee*=me*n.nestingFactor}Q.idealLength=ee,Q.elasticity=ue,o.layoutEdges.push(Q)}return o},fy=function(e,t,n){var a=xd(e,t,0,n);return 2>a.count?0:a.graph},xd=function(e,t,n,a){var i=a.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var s=0,o=0;o<i.length;o++){var c=a.layoutNodes[a.idToIndex[i[o]]].children;if(0!==c.length){var f=xd(e,t,a.indexToGraph[a.idToIndex[c[0]]],a);if(0!==f.count){if(1!==f.count)return f;if(2===++s)break}}}return{count:s,graph:n}},vy=function(e,t){for(var n=e.clientWidth,a=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];0===s.children.length&&!s.isLocked&&(s.positionX=Math.random()*n,s.positionY=Math.random()*a)}},wd=function(e,t,n){var a=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];return t.boundingBox?{x:a.x1+(0===i.w?.5:(l.positionX-i.x1)/i.w)*a.w,y:a.y1+(0===i.h?.5:(l.positionY-i.y1)/i.h)*a.h}:{x:l.positionX,y:l.positionY}}},gy=function(e,t,n){var a=n.layout,i=n.eles.nodes(),s=wd(e,n,i);i.positions(s),!0!==e.ready&&(e.ready=!0,a.one("layoutready",n.ready),a.emit({type:"layoutready",layout:this}))},py=function(e,t,n){yy(e,t),xy(e),wy(e,t),Ey(e),Ty(e)},yy=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var a=e.graphSet[n],i=a.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[a[s]]],l=s+1;l<i;l++)my(o,e.layoutNodes[e.idToIndex[a[l]]],e,t)},Ed=function(e){return-e+2*e*Math.random()},my=function(e,t,n,a){if(e.cmptId===t.cmptId||n.isCompound){var o=t.positionX-e.positionX,l=t.positionY-e.positionY;0===o&&0===l&&(o=Ed(1),l=Ed(1));var c=by(e,t,o,l);if(c>0)var h=(d=a.nodeOverlap*c)*o/(f=Math.sqrt(o*o+l*l)),v=d*l/f;else{var d,b=Ni(e,o,l),p=Ni(t,-1*o,-1*l),g=p.x-b.x,x=p.y-b.y,C=g*g+x*x,f=Math.sqrt(C);h=(d=(e.nodeRepulsion+t.nodeRepulsion)/C)*g/f,v=d*x/f}e.isLocked||(e.offsetX-=h,e.offsetY-=v),t.isLocked||(t.offsetX+=h,t.offsetY+=v)}},by=function(e,t,n,a){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(a>0)var s=e.maxY-t.minY;else s=t.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Ni=function(e,t,n){var a=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=n/t,u=s/o,c={};return 0===t&&0<n||0===t&&0>n?(c.x=a,c.y=i+s/2,c):0<t&&-1*u<=l&&l<=u?(c.x=a+o/2,c.y=i+o*n/2/t,c):0>t&&-1*u<=l&&l<=u?(c.x=a-o/2,c.y=i-o*n/2/t,c):0<n&&(l<=-1*u||l>=u)?(c.x=a+s*t/2/n,c.y=i+s/2,c):(0>n&&(l<=-1*u||l>=u)&&(c.x=a-s*t/2/n,c.y=i-s/2),c)},xy=function(e,t){for(var n=0;n<e.edgeSize;n++){var a=e.layoutEdges[n],s=e.layoutNodes[e.idToIndex[a.sourceId]],l=e.layoutNodes[e.idToIndex[a.targetId]],u=l.positionX-s.positionX,c=l.positionY-s.positionY;if(0!==u||0!==c){var d=Ni(s,u,c),f=Ni(l,-1*u,-1*c),h=f.x-d.x,v=f.y-d.y,b=Math.sqrt(h*h+v*v),p=Math.pow(a.idealLength-b,2)/a.elasticity;if(0!==b)var g=p*h/b,x=p*v/b;else g=0,x=0;s.isLocked||(s.offsetX+=g,s.offsetY+=x),l.isLocked||(l.offsetX-=g,l.offsetY-=x)}}},wy=function(e,t){if(0!==t.gravity)for(var a=0;a<e.graphSet.length;a++){var i=e.graphSet[a],s=i.length;if(0===a)var o=e.clientHeight/2,l=e.clientWidth/2;else{var c=e.layoutNodes[e.idToIndex[e.layoutNodes[e.idToIndex[i[0]]].parentId]];o=c.positionX,l=c.positionY}for(var d=0;d<s;d++){var f=e.layoutNodes[e.idToIndex[i[d]]];if(!f.isLocked){var h=o-f.positionX,v=l-f.positionY,b=Math.sqrt(h*h+v*v);if(b>1){var g=t.gravity*v/b;f.offsetX+=t.gravity*h/b,f.offsetY+=g}}}}},Ey=function(e,t){var n=[],a=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;a<=i;){var s=n[a++],l=e.layoutNodes[e.idToIndex[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[++i]=u[f]}l.offsetX=0,l.offsetY=0}}},Ty=function(e,t){for(var n=0;n<e.nodeSize;n++)0<(a=e.layoutNodes[n]).children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0);for(n=0;n<e.nodeSize;n++)if(!(0<(a=e.layoutNodes[n]).children.length||a.isLocked)){var i=Cy(a.offsetX,a.offsetY,e.temperature);a.positionX+=i.x,a.positionY+=i.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,Td(a,e)}for(n=0;n<e.nodeSize;n++){var a;0<(a=e.layoutNodes[n]).children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},Cy=function(e,t,n){var a=Math.sqrt(e*e+t*t);if(a>n)var i={x:n*e/a,y:n*t/a};else i={x:e,y:t};return i},Td=function(e,t){var n=e.parentId;if(null!=n){var a=t.layoutNodes[t.idToIndex[n]],i=!1;if((null==a.maxX||e.maxX+a.padRight>a.maxX)&&(a.maxX=e.maxX+a.padRight,i=!0),(null==a.minX||e.minX-a.padLeft<a.minX)&&(a.minX=e.minX-a.padLeft,i=!0),(null==a.maxY||e.maxY+a.padBottom>a.maxY)&&(a.maxY=e.maxY+a.padBottom,i=!0),(null==a.minY||e.minY-a.padTop<a.minY)&&(a.minY=e.minY-a.padTop,i=!0),i)return Td(a,t)}},Cd=function(e,t){for(var n=e.layoutNodes,a=[],i=0;i<n.length;i++){var s=n[i],o=s.cmptId;(a[o]=a[o]||[]).push(s)}var u=0;for(i=0;i<a.length;i++)if(c=a[i]){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}a.sort(function(x,C){return C.w*C.h-x.w*x.h});var h=0,v=0,b=0,p=0,g=Math.sqrt(u)*e.clientWidth/e.clientHeight;for(i=0;i<a.length;i++){var c;if(c=a[i]){for(d=0;d<c.length;d++)(f=c[d]).isLocked||(f.positionX+=h-c.x1,f.positionY+=v-c.y1);h+=c.w+t.componentSpacing,b+=c.w+t.componentSpacing,p=Math.max(p,c.h),b>g&&(v+=p+t.componentSpacing,h=0,b=0,p=0)}}},Dy={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 Dd(r){this.options=mt({},Dy,r)}Dd.prototype.run=function(){var r=this.options,e=r,t=r.cy,n=e.eles,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));var i=gr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)n.nodes().layoutPositions(this,e,function(Ue){return{x:i.x1,y:i.y1}});else{var s=a.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),c=function(qe){if(null==qe)return Math.min(l,u);Math.min(l,u)==l?l=qe:u=qe},d=function(qe){if(null==qe)return Math.max(l,u);Math.max(l,u)==l?l=qe:u=qe},f=e.rows,h=null!=e.cols?e.cols:e.columns;if(null!=f&&null!=h)l=f,u=h;else if(null!=f&&null==h)l=f,u=Math.ceil(s/l);else if(null==f&&null!=h)u=h,l=Math.ceil(s/u);else if(u*l>s){var v=c(),b=d();(v-1)*b>=s?c(v-1):(b-1)*v>=s&&d(b-1)}else for(;u*l<s;){var p=c(),g=d();(g+1)*p>=s?d(g+1):c(p+1)}var x=i.w/u,C=i.h/l;if(e.condense&&(x=0,C=0),e.avoidOverlap)for(var A=0;A<a.length;A++){var z=a[A],H=z._private.position;(null==H.x||null==H.y)&&(H.x=0,H.y=0);var F=z.layoutDimensions(e),j=e.avoidOverlapPadding,J=F.h+j;x=Math.max(x,F.w+j),C=Math.max(C,J)}for(var K={},Q=function(qe,je){return!!K["c-"+qe+"-"+je]},ee=function(qe,je){K["c-"+qe+"-"+je]=!0},ue=0,fe=0,ve=function(){++fe>=u&&(fe=0,ue++)},ce={},pe=0;pe<a.length;pe++){var Se=a[pe],Ie=e.position(Se);if(Ie&&(void 0!==Ie.row||void 0!==Ie.col)){var me={row:Ie.row,col:Ie.col};if(void 0===me.col)for(me.col=0;Q(me.row,me.col);)me.col++;else if(void 0===me.row)for(me.row=0;Q(me.row,me.col);)me.row++;ce[Se.id()]=me,ee(me.row,me.col)}}a.layoutPositions(this,e,function(qe,je){var Je,tt;if(qe.locked()||qe.isParent())return!1;var at=ce[qe.id()];if(at)Je=at.col*x+x/2+i.x1,tt=at.row*C+C/2+i.y1;else{for(;Q(ue,fe);)ve();Je=fe*x+x/2+i.x1,tt=ue*C+C/2+i.y1,ee(ue,fe),ve()}return{x:Je,y:tt}})}return this};var Sy={ready:function(){},stop:function(){}};function jo(r){this.options=mt({},Sy,r)}jo.prototype.run=function(){var r=this.options,e=r.eles,t=this;return t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this},jo.prototype.stop=function(){return this};var Iy={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 Sd(r){this.options=mt({},Iy,r)}Sd.prototype.run=function(){var r=this.options,t=r.eles.nodes(),n=ke(r.positions);return t.layoutPositions(this,r,function(i,s){var o=function a(i){return null==r.positions?function(e){return{x:e.x,y:e.y}}(i.position()):n?r.positions(i):r.positions[i._private.data.id]??null}(i);return!i.locked()&&null!=o&&o}),this};var Ly={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 Id(r){this.options=mt({},Ly,r)}Id.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=gr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()});return t.nodes().layoutPositions(this,r,function(s,o){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}}),this};var Ay=[{name:"breadthfirst",impl:yd},{name:"circle",impl:md},{name:"concentric",impl:bd},{name:"cose",impl:Ai},{name:"grid",impl:Dd},{name:"null",impl:jo},{name:"preset",impl:Sd},{name:"random",impl:Id}];function Ld(r){this.options=r,this.notifications=0}var Ad=function(){},Nd=function(){throw new Error("A headless instance can not render images")};Ld.prototype={recalculateRenderedStyle:Ad,notify:function(){this.notifications++},init:Ad,isHeadless:function(){return!0},png:Nd,jpg:Nd};var Xo={arrowShapeWidth:.3,registerArrowShapes:function(){var r=this.arrowShapes={},e=this,t=function(u,c,d,f,h,v,b){return h.x-d/2-b<=u&&u<=h.x+d/2+b&&h.y-d/2-b<=c&&c<=h.y+d/2+b},n=function(u,c,d,f,h){var v=u*Math.cos(f)-c*Math.sin(f),b=u*Math.sin(f)+c*Math.cos(f);return{x:v*d+h.x,y:b*d+h.y}},a=function(u,c,d,f){for(var h=[],v=0;v<u.length;v+=2)h.push(n(u[v],u[v+1],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},o=function(u,c){le(c)&&(c=r[c]),r[u]=mt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(f,h,v,b,p,g){var x=i(a(this.points,v+2*g,b,p));return mr(f,h,x)},roughCollide:t,draw:function(f,h,v,b){var p=a(this.points,h,v,b);e.arrowShapeImpl("polygon")(f,p)},spacing:function(f){return 0},gap:s},c)};o("none",{collide:$a,roughCollide:$a,draw:fs,spacing:Xl,gap:Xl}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:function(u,c,d,f,h){var v=a(this.points,c,d,f),b=this.controlPoint,p=n(b[0],b[1],c,d,f);e.arrowShapeImpl(this.name)(u,v,p)},gap:function(u){return.8*s(u)}}),o("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,v,b){var p=i(a(this.points,d+2*b,f,h)),g=i(a(this.pointsTee,d+2*b,f,h));return mr(u,c,p)||mr(u,c,g)},draw:function(u,c,d,f,h){var v=a(this.points,c,d,f),b=a(this.pointsTee,c,d,f);e.arrowShapeImpl(this.name)(u,v,b)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,c,d,f,h,v,b){var p=h,g=Math.pow(p.x-u,2)+Math.pow(p.y-c,2)<=Math.pow((d+2*b)*this.radius,2),x=i(a(this.points,d+2*b,f,h));return mr(u,c,x)||g},draw:function(u,c,d,f,h){var v=a(this.pointsTr,c,d,f);e.arrowShapeImpl(this.name)(u,v,f.x,f.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("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;return d[3]=d[3]-f,d[5]=d[5]-f,d},collide:function(u,c,d,f,h,v,b){var p=i(a(this.points,d+2*b,f,h)),g=i(a(this.crossLinePts(d,v),d+2*b,f,h));return mr(u,c,p)||mr(u,c,g)},draw:function(u,c,d,f,h){var v=a(this.points,c,d,f),b=a(this.crossLinePts(c,h),c,d,f);e.arrowShapeImpl(this.name)(u,v,b)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return.525*s(u)}}),o("circle",{radius:.15,collide:function(u,c,d,f,h,v,b){var p=h;return Math.pow(p.x-u,2)+Math.pow(p.y-c,2)<=Math.pow((d+2*b)*this.radius,2)},draw:function(u,c,d,f,h){e.arrowShapeImpl(this.name)(u,f.x,f.y,this.radius*c)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("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}})}},Cn={projectIntoViewport:function(r,e){var t=this.cy,n=this.findContainerClientCoords(),a=n[0],i=n[1],s=n[4],o=t.pan(),l=t.zoom();return[((r-a)/s-o.x)/l,((e-i)/s-o.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),n=function(g){return parseFloat(t.getPropertyValue(g))},a_left=n("padding-left"),a_right=n("padding-right"),a_top=n("padding-top"),a_bottom=n("padding-bottom"),i_left=n("border-left-width"),i_right=n("border-right-width"),i_top=n("border-top-width"),s=(n("border-bottom-width"),r.clientWidth);return this.containerBB=[e.left+a_left+i_left,e.top+a_top+i_top,s-(a_left+a_right),r.clientHeight-(a_top+a_bottom),e.width/(s+(i_left+i_right))]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(r,e,t,n){return this.findNearestElements(r,e,t,n)[0]},findNearestElements:function(r,e,t,n){var v,b,a=this,i=this,s=i.getCachedZSortedEles(),o=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),c=(n?24:8)/l,d=(n?8:2)/l,f=(n?8:2)/l,h=1/0;function p(F,j){if(F.isNode()){if(b)return;b=F,o.push(F)}if(F.isEdge()&&(null==j||j<h))if(v){if(v.pstyle("z-compound-depth").value===F.pstyle("z-compound-depth").value&&v.pstyle("z-compound-depth").value===F.pstyle("z-compound-depth").value)for(var $=0;$<o.length;$++)if(o[$].isEdge()){o[$]=F,v=F,h=j??h;break}}else o.push(F),v=F,h=j??h}function g(F){var j=F.outerWidth()+2*d,$=F.outerHeight()+2*d,J=j/2,K=$/2,Q=F.position(),ee="auto"===F.pstyle("corner-radius").value?"auto":F.pstyle("corner-radius").pfValue,ue=F._private.rscratch;if(Q.x-J<=r&&r<=Q.x+J&&Q.y-K<=e&&e<=Q.y+K&&i.nodeShapes[a.getNodeShape(F)].checkPoint(r,e,0,j,$,Q.x,Q.y,ee,ue))return p(F,0),!0}function x(F){var fe,j=F._private,$=j.rscratch,J=F.pstyle("width").pfValue,K=F.pstyle("arrow-scale").value,Q=J/2+c,ee=Q*Q,ue=2*Q,pe=j.source,Se=j.target;if("segments"===$.edgeType||"straight"===$.edgeType||"haystack"===$.edgeType){for(var ve=$.allpts,ce=0;ce+3<ve.length;ce+=2)if(lv(r,e,ve[ce],ve[ce+1],ve[ce+2],ve[ce+3],ue)&&ee>(fe=hv(r,e,ve[ce],ve[ce+1],ve[ce+2],ve[ce+3])))return p(F,fe),!0}else if("bezier"===$.edgeType||"multibezier"===$.edgeType||"self"===$.edgeType||"compound"===$.edgeType)for(ve=$.allpts,ce=0;ce+5<$.allpts.length;ce+=4)if(uv(r,e,ve[ce],ve[ce+1],ve[ce+2],ve[ce+3],ve[ce+4],ve[ce+5],ue)&&ee>(fe=fv(r,e,ve[ce],ve[ce+1],ve[ce+2],ve[ce+3],ve[ce+4],ve[ce+5])))return p(F,fe),!0;pe=pe||j.source,Se=Se||j.target;var Ie=a.getArrowWidth(J,K),me=[{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}];for(ce=0;ce<me.length;ce++){var De=me[ce],Ue=i.arrowShapes[F.pstyle(De.name+"-arrow-shape").value],qe=F.pstyle("width").pfValue;if(Ue.roughCollide(r,e,Ie,De.angle,{x:De.x,y:De.y},qe,c)&&Ue.collide(r,e,Ie,De.angle,{x:De.x,y:De.y},qe,c))return p(F),!0}u&&o.length>0&&(g(pe),g(Se))}function C(F,j,$){return vr(F,j,$)}function A(F,j){var K,$=F._private,J=f;K=j?j+"-":"",F.boundingBox();var Q=$.labelBounds[j||"main"],ee=F.pstyle(K+"label").value;if("yes"===F.pstyle("text-events").strValue&&ee){var fe=C($.rscratch,"labelX",j),ve=C($.rscratch,"labelY",j),ce=C($.rscratch,"labelAngle",j),pe=F.pstyle(K+"text-margin-x").pfValue,Se=F.pstyle(K+"text-margin-y").pfValue,Ie=Q.x1-J-pe,me=Q.x2+J-pe,De=Q.y1-J-Se,Ue=Q.y2+J-Se;if(ce){var qe=Math.cos(ce),je=Math.sin(ce),Je=function(ze,rt){return{x:(ze-=fe)*qe-(rt-=ve)*je+fe,y:ze*je+rt*qe+ve}},tt=Je(Ie,De),at=Je(Ie,Ue),He=Je(me,De),Ce=Je(me,Ue);if(mr(r,e,[tt.x+pe,tt.y+Se,He.x+pe,He.y+Se,Ce.x+pe,Ce.y+Se,at.x+pe,at.y+Se]))return p(F),!0}else if(Qr(Q,r,e))return p(F),!0}}t&&(s=s.interactive);for(var z=s.length-1;z>=0;z--){var H=s[z];H.isNode()?g(H)||A(H):x(H)||A(H)||A(H,"source")||A(H,"target")}return o},getAllInBox:function(r,e,t,n){var a=this.getCachedZSortedEles().interactive,s=2/this.cy.zoom(),o=[],l=Math.min(r,t),u=Math.max(r,t),c=Math.min(e,n),d=Math.max(e,n),f=gr({x1:r=l,y1:e=c,x2:t=u,y2:n=d}),h=[{x:f.x1,y:f.y1},{x:f.x2,y:f.y1},{x:f.x2,y:f.y2},{x:f.x1,y:f.y2}],v=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function b(ze,rt,ct){return vr(ze,rt,ct)}function p(ze,rt){var ct=ze._private,Nt=s;ze.boundingBox();var bt=ct.labelBounds.main;if(!bt)return null;var pt=b(ct.rscratch,"labelX",rt),ot=b(ct.rscratch,"labelY",rt),gt=b(ct.rscratch,"labelAngle",rt),ht=ze.pstyle("text-margin-x").pfValue,Tt=ze.pstyle("text-margin-y").pfValue,xt=bt.x1-Nt-ht,It=bt.x2+Nt-ht,Rt=bt.y1-Nt-Tt,Gt=bt.y2+Nt-Tt;if(gt){var kt=Math.cos(gt),_t=Math.sin(gt),Xe=function(xe,Le){return{x:(xe-=pt)*kt-(Le-=ot)*_t+pt,y:xe*_t+Le*kt+ot}};return[Xe(xt,Rt),Xe(It,Rt),Xe(It,Gt),Xe(xt,Gt)]}return[{x:xt,y:Rt},{x:It,y:Rt},{x:It,y:Gt},{x:xt,y:Gt}]}function g(ze,rt,ct,Nt){function Et(bt,pt,ot){return(ot.y-bt.y)*(pt.x-bt.x)>(pt.y-bt.y)*(ot.x-bt.x)}return Et(ze,ct,Nt)!==Et(rt,ct,Nt)&&Et(ze,rt,ct)!==Et(ze,rt,Nt)}for(var x=0;x<a.length;x++){var C=a[x];if(C.isNode()){var A=C,z="yes"===A.pstyle("text-events").strValue,H=A.pstyle("box-selection").strValue,F="yes"===A.pstyle("box-select-labels").strValue;if("none"===H)continue;var $=A.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:("overlap"===H||F)&&z});if("contain"===H){var J=!1;if(F&&z){var K=p(A);K&&Cs(K,h)&&(o.push(A),J=!0)}!J&&ru(f,$)&&o.push(A)}else if("overlap"===H&&bs(f,$)){var Q=A.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(Cs([{x:Q.x1,y:Q.y1},{x:Q.x2,y:Q.y1},{x:Q.x2,y:Q.y2},{x:Q.x1,y:Q.y2}],h))o.push(A);else{var ue=p(A);ue&&Cs(ue,h)&&o.push(A)}}}else{var fe=C,ve=fe._private,ce=ve.rscratch,pe=fe.pstyle("box-selection").strValue;if("none"===pe)continue;if("contain"===pe){if(null!=ce.startX&&null!=ce.startY&&!Qr(f,ce.startX,ce.startY)||null!=ce.endX&&null!=ce.endY&&!Qr(f,ce.endX,ce.endY))continue;if("bezier"===ce.edgeType||"multibezier"===ce.edgeType||"self"===ce.edgeType||"compound"===ce.edgeType||"segments"===ce.edgeType||"haystack"===ce.edgeType){for(var Se=ve.rstyle.bezierPts||ve.rstyle.linePts||ve.rstyle.haystackPts,Ie=!0,me=0;me<Se.length;me++)if(!tu(f,Se[me])){Ie=!1;break}Ie&&o.push(fe)}else"straight"===ce.edgeType&&o.push(fe)}else if("overlap"===pe){var De=!1;if(null!=ce.startX&&null!=ce.startY&&null!=ce.endX&&null!=ce.endY&&(Qr(f,ce.startX,ce.startY)||Qr(f,ce.endX,ce.endY)))o.push(fe),De=!0;else if(!De&&"haystack"===ce.edgeType)for(var Ue=ve.rstyle.haystackPts,qe=0;qe<Ue.length;qe++)if(tu(f,Ue[qe])){o.push(fe),De=!0;break}if(!De){var je=ve.rstyle.bezierPts||ve.rstyle.linePts||ve.rstyle.haystackPts;if((!je||je.length<2)&&"straight"===ce.edgeType&&null!=ce.startX&&null!=ce.startY&&null!=ce.endX&&null!=ce.endY&&(je=[{x:ce.startX,y:ce.startY},{x:ce.endX,y:ce.endY}]),!je||je.length<2)continue;for(var Je=0;Je<je.length-1;Je++){for(var tt=je[Je],at=je[Je+1],He=0;He<v.length;He++){var Ce=he(v[He],2);if(g(tt,at,Ce[0],Ce[1])){o.push(fe),De=!0;break}}if(De)break}}}}}return o}},Ri={calculateArrowAngles:function(r){var l,u,c,d,f,h,e=r._private.rscratch,t="haystack"===e.edgeType,n="bezier"===e.edgeType,a="multibezier"===e.edgeType,i="segments"===e.edgeType,s="compound"===e.edgeType,o="self"===e.edgeType;t?(c=e.haystackPts[0],d=e.haystackPts[1],f=e.haystackPts[2],h=e.haystackPts[3]):(c=e.arrowStartX,d=e.arrowStartY,f=e.arrowEndX,h=e.arrowEndY),g=e.midX,x=e.midY,i?(l=c-e.segpts[0],u=d-e.segpts[1]):a||s||o||n?(l=c-tr((v=e.allpts)[0],v[2],v[4],.1),u=d-tr(v[1],v[3],v[5],.1)):(l=c-g,u=d-x),e.srcArrowAngle=Ja(l,u);var g=e.midX,x=e.midY;if(t&&(g=(c+f)/2,x=(d+h)/2),l=f-c,u=h-d,i)if((v=e.allpts).length/2%2==0)l=v[C=v.length/2]-v[A=C-2],u=v[C+1]-v[A+1];else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var A;l=v[C=v.length/2-1]-v[A=C-2],u=v[C+1]-v[A+1]}else if(a||s||o){var H,F,j,$,K,J,Q,v=e.allpts;e.ctrlpts.length/2%2==0?(H=tr(v[J=v.length/2-1],v[K=J+2],v[Q=K+2],0),F=tr(v[J+1],v[K+1],v[Q+1],0),j=tr(v[J],v[K],v[Q],1e-4),$=tr(v[J+1],v[K+1],v[Q+1],1e-4)):(H=tr(v[J=(K=v.length/2-1)-2],v[K],v[Q=K+2],.4999),F=tr(v[J+1],v[K+1],v[Q+1],.4999),j=tr(v[J],v[K],v[Q],.5),$=tr(v[J+1],v[K+1],v[Q+1],.5)),l=j-H,u=$-F}if(e.midtgtArrowAngle=Ja(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i&&(v=e.allpts).length/2%2!=0&&!e.isRound){var C,ee=2+(C=v.length/2-1);l=-(v[ee]-v[C]),u=-(v[ee+1]-v[C+1])}if(e.midsrcArrowAngle=Ja(l,u),i)l=f-e.segpts[e.segpts.length-2],u=h-e.segpts[e.segpts.length-1];else if(a||s||o||n){var ue=(v=e.allpts).length;l=f-tr(v[ue-6],v[ue-4],v[ue-2],.9),u=h-tr(v[ue-5],v[ue-3],v[ue-1],.9)}else l=f-g,u=h-x;e.tgtArrowAngle=Ja(l,u)}};Ri.getArrowWidth=Ri.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},n=t[r+", "+e];return n||(n=Math.max(Math.pow(13.37*r,.9),29)*e,t[r+", "+e]=n,n)};var Wo,Yo,Md,Dn,Mi,Wr,Sn,In,Fr,Jn,Oi,Od,_d,$o,qo,Pd,Br={},Cr={},kd=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)};function Bd(r,e){0===e.radius?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Ko(r,e,t,n){return 0===n||0===e.radius?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(function(e,t,n,a,i){if(e!==Pd?kd(t,e,Br):function(e,t){t.x=-1*e.x,t.y=-1*e.y,t.nx=-1*e.nx,t.ny=-1*e.ny,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang}(Cr,Br),kd(t,n,Cr),Md=Br.nx*Cr.nx-Br.ny*-Cr.ny,Wr=Math.asin(Math.max(-1,Math.min(1,Br.nx*Cr.ny-Br.ny*Cr.nx))),Math.abs(Wr)<1e-6)return Wo=t.x,Yo=t.y,void(In=Jn=0);Dn=1,Mi=!1,Md<0?Wr<0?Wr=Math.PI+Wr:(Wr=Math.PI-Wr,Dn=-1,Mi=!0):Wr>0&&(Dn=-1,Mi=!0),Jn=void 0!==t.radius?t.radius:a,Sn=Wr/2,Oi=Math.min(Br.len/2,Cr.len/2),i?(Fr=Math.abs(Math.cos(Sn)*Jn/Math.sin(Sn)))>Oi?(Fr=Oi,In=Math.abs(Fr*Math.sin(Sn)/Math.cos(Sn))):In=Jn:(Fr=Math.min(Oi,Jn),In=Math.abs(Fr*Math.sin(Sn)/Math.cos(Sn))),Wo=($o=t.x+Cr.nx*Fr)-Cr.ny*In*Dn,Yo=(qo=t.y+Cr.ny*Fr)+Cr.nx*In*Dn,Od=t.x+Br.nx*Fr,_d=t.y+Br.ny*Fr,Pd=t}(r,e,t,n,!(arguments.length>4&&void 0!==arguments[4])||arguments[4]),{cx:Wo,cy:Yo,radius:In,startX:Od,startY:_d,stopX:$o,stopY:qo,startAngle:Br.ang+Math.PI/2*Dn,endAngle:Cr.ang-Math.PI/2*Dn,counterClockwise:Mi})}var My=Math.sqrt(.02),fr={};function Fd(r){var e=[];if(null!=r){for(var t=0;t<r.length;t+=2)e.push({x:r[t],y:r[t+1]});return e}}fr.findMidptPtsEtc=function(r,e){var i,$,J,K,t=e.posPts,n=e.intersectionPts,a=e.vectorNormInverse,s=r.pstyle("source-endpoint"),o=r.pstyle("target-endpoint"),l=null!=s.units&&null!=o.units;switch(r.pstyle("edge-distances").value){case"node-position":i=t;break;case"intersection":i=n;break;case"endpoints":if(l){var f=he(this.manualEndptToPx(r.source()[0],s),2),h=f[0],v=f[1],p=he(this.manualEndptToPx(r.target()[0],o),2),g=p[0],x=p[1],C={x1:h,y1:v,x2:g,y2:x};J=g-h,a={x:-($=x-v)/(K=Math.sqrt(J*J+$*$)),y:J/K},i=C}else Bt("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=n}return{midptPts:i,vectorNormInverse:a}},fr.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],n=t._private,a=n.rscratch;if(!a.haystack){var i=2*Math.random()*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=2*Math.random()*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var s=n.source,o=n.target,l=s.position(),u=o.position(),c=s.width(),d=o.width(),f=s.height(),h=o.height(),b=t.pstyle("haystack-radius").value/2;a.haystackPts=a.allpts=[a.source.x*c*b+l.x,a.source.y*f*b+l.y,a.target.x*d*b+u.x,a.target.y*h*b+u.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(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}},fr.findSegmentsPoints=function(r,e){var t=r._private.rscratch,n=r.pstyle("segment-weights"),a=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),s=r.pstyle("radius-type"),o=Math.min(n.pfValue.length,a.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=s.pfValue[s.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var c=0;c<o;c++){var d=n.pfValue[c],f=a.pfValue[c],h=1-d,v=d,b=this.findMidptPtsEtc(r,e),p=b.midptPts,g=b.vectorNormInverse,x={x:p.x1*h+p.x2*v,y:p.y1*h+p.y2*v};t.segpts.push(x.x+g.x*f,x.y+g.y*f),t.radii.push(void 0!==i.pfValue[c]?i.pfValue[c]:l),t.isArcRadius.push("arc-radius"===(void 0!==s.pfValue[c]?s.pfValue[c]:u))}},fr.findLoopPoints=function(r,e,t,n){var a=r._private.rscratch,i=e.dirCounts,s=e.srcPos,o=r.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=r.pstyle("loop-direction").pfValue,c=r.pstyle("loop-sweep").pfValue,d=r.pstyle("control-point-step-size").pfValue;a.edgeType="self";var f=t,h=d;n&&(f=0,h=l);var v=u-Math.PI/2,b=v-c/2,p=v+c/2,g=u+"_"+c;f=void 0===i[g]?i[g]=0:++i[g],a.ctrlpts=[s.x+1.4*Math.cos(b)*h*(f/3+1),s.y+1.4*Math.sin(b)*h*(f/3+1),s.x+1.4*Math.cos(p)*h*(f/3+1),s.y+1.4*Math.sin(p)*h*(f/3+1)]},fr.findCompoundLoopPoints=function(r,e,t,n){var a=r._private.rscratch;a.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,c=e.tgtH,d=r.pstyle("control-point-step-size").pfValue,f=r.pstyle("control-point-distances"),v=t,b=d;n&&(v=0,b=f?f.pfValue[0]:void 0);var g={x:i.x-o/2,y:i.y-l/2},x={x:s.x-u/2,y:s.y-c/2},C={x:Math.min(g.x,x.x),y:Math.min(g.y,x.y)},z=Math.max(.5,Math.log(.01*o)),H=Math.max(.5,Math.log(.01*u));a.ctrlpts=[C.x,C.y-(1+Math.pow(50,1.12)/100)*b*(v/3+1)*z,C.x-(1+Math.pow(50,1.12)/100)*b*(v/3+1)*H,C.y]},fr.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"},fr.findBezierPoints=function(r,e,t,n,a){var i=r._private.rscratch,s=r.pstyle("control-point-step-size").pfValue,o=r.pstyle("control-point-distances"),l=r.pstyle("control-point-weights"),u=o&&l?Math.min(o.value.length,l.value.length):1,c=o?o.pfValue[0]:void 0,d=l.value[0],f=n;i.edgeType=f?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<u;h++){var b,v=(.5-e.eles.length/2+t)*s*(a?-1:1),p=ms(v);f&&(c=o?o.pfValue[h]:s,d=l.value[h]);var g=void 0!==(b=n?c:void 0!==c?p*c:void 0)?b:v,x=1-d,C=d,A=this.findMidptPtsEtc(r,e),z=A.midptPts,H=A.vectorNormInverse,F={x:z.x1*x+z.x2*C,y:z.y1*x+z.y2*C};i.ctrlpts.push(F.x+H.x*g,F.y+H.y*g)}},fr.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var n="vertical",a="horizontal",i="leftward",s="rightward",o="downward",l="upward",c=e.posPts,d=e.srcW,f=e.srcH,h=e.tgtW,v=e.tgtH,p="node-position"!==r.pstyle("edge-distances").value,g=r.pstyle("taxi-direction").value,x=g,C=r.pstyle("taxi-turn"),A="%"===C.units,z=C.pfValue,H=z<0,F=r.pstyle("taxi-turn-min-distance").pfValue,$=p?(f+v)/2:0,J=c.x2-c.x1,K=c.y2-c.y1,Q=function(Le,Fe){return Le>0?Math.max(Le-Fe,0):Math.min(Le+Fe,0)},ee=Q(J,p?(d+h)/2:0),ue=Q(K,$),fe=!1;"auto"===x?g=Math.abs(ee)>Math.abs(ue)?a:n:x===l||x===o?(g=n,fe=!0):(x===i||x===s)&&(g=a,fe=!0);var me,ve=g===n,ce=ve?ue:ee,pe=ve?K:J,Se=ms(pe),Ie=!1;(!fe||!A&&!H)&&(x===o&&pe<0||x===l&&pe>0||x===i&&pe>0||x===s&&pe<0)&&(ce=(Se*=-1)*Math.abs(ce),Ie=!0);var qe=function(Le){return Math.abs(Le)<F||Math.abs(Le)>=Math.abs(ce)},je=qe(me=A?(z<0?1+z:z)*ce:(z<0?ce:0)+z*Se),Je=qe(Math.abs(ce)-Math.abs(me));if(!je&&!Je||Ie)if(ve){var xt=c.y1+me+(p?f/2*Se:0);t.segpts=[c.x1,xt,c.x2,xt]}else{var Gt=c.x1+me+(p?d/2*Se:0);t.segpts=[Gt,c.y1,Gt,c.y2]}else if(ve){var at=Math.abs(pe)<=f/2,He=Math.abs(J)<=h/2;if(at){var Ce=(c.x1+c.x2)/2;t.segpts=[Ce,c.y1,Ce,c.y2]}else if(He){var ze=(c.y1+c.y2)/2;t.segpts=[c.x1,ze,c.x2,ze]}else t.segpts=[c.x1,c.y2]}else{var Nt=Math.abs(pe)<=d/2,Et=Math.abs(K)<=v/2;if(Nt){var bt=(c.y1+c.y2)/2;t.segpts=[c.x1,bt,c.x2,bt]}else if(Et){var gt=(c.x1+c.x2)/2;t.segpts=[gt,c.y1,gt,c.y2]}else t.segpts=[c.x2,c.y1]}if(t.isRound){var Xe=r.pstyle("taxi-radius").value,X="arc-radius"===r.pstyle("radius-type").value[0];t.radii=new Array(t.segpts.length/2).fill(Xe),t.isArcRadius=new Array(t.segpts.length/2).fill(X)}},fr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if("bezier"===t.edgeType){var n=e.srcPos,a=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,c=e.tgtShape,d=e.srcCornerRadius,f=e.tgtCornerRadius,h=e.srcRs,v=e.tgtRs,b=!Be(t.startX)||!Be(t.startY),p=!Be(t.arrowStartX)||!Be(t.arrowStartY),g=!Be(t.endX)||!Be(t.endY),x=!Be(t.arrowEndX)||!Be(t.arrowEndY),z=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,H=bn({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),F=H<z,j=bn({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),$=j<z,J=!1;if(b||p||F){J=!0;var K={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},Q=Math.sqrt(K.x*K.x+K.y*K.y),ee={x:K.x/Q,y:K.y/Q},ue=Math.max(i,s),fe={x:t.ctrlpts[0]+2*ee.x*ue,y:t.ctrlpts[1]+2*ee.y*ue},ve=u.intersectLine(n.x,n.y,i,s,fe.x,fe.y,0,d,h);F?(t.ctrlpts[0]=t.ctrlpts[0]+ee.x*(z-H),t.ctrlpts[1]=t.ctrlpts[1]+ee.y*(z-H)):(t.ctrlpts[0]=ve[0]+ee.x*z,t.ctrlpts[1]=ve[1]+ee.y*z)}if(g||x||$){J=!0;var ce={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},pe=Math.sqrt(ce.x*ce.x+ce.y*ce.y),Se={x:ce.x/pe,y:ce.y/pe},Ie=Math.max(i,s),me={x:t.ctrlpts[0]+2*Se.x*Ie,y:t.ctrlpts[1]+2*Se.y*Ie},De=c.intersectLine(a.x,a.y,o,l,me.x,me.y,0,f,v);$?(t.ctrlpts[0]=t.ctrlpts[0]+Se.x*(z-j),t.ctrlpts[1]=t.ctrlpts[1]+Se.y*(z-j)):(t.ctrlpts[0]=De[0]+Se.x*z,t.ctrlpts[1]=De[1]+Se.y*z)}J&&this.findEndpoints(r)}},fr.storeAllpts=function(r){var e=r._private.rscratch;if("multibezier"===e.edgeType||"bezier"===e.edgeType||"self"===e.edgeType||"compound"===e.edgeType){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);var n;e.allpts.push(e.endX,e.endY),e.ctrlpts.length/2%2==0?(e.midX=e.allpts[n=e.allpts.length/2-1],e.midY=e.allpts[n+1]):(e.midX=tr(e.allpts[n=e.allpts.length/2-3],e.allpts[n+2],e.allpts[n+4],.5),e.midY=tr(e.allpts[n+1],e.allpts[n+3],e.allpts[n+5],.5))}else if("straight"===e.edgeType)e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if("segments"===e.edgeType){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var s=e.radii[i/2-1];e.roundCorners.push(Ko({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:s},{x:e.allpts[i+2],y:e.allpts[i+3]},s,e.isArcRadius[i/2-1]))}}if(e.segpts.length%4==0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var c=e.segpts.length/2-1;if(e.isRound){var d={x:e.segpts[c],y:e.segpts[c+1]},f=e.roundCorners[c/2];if(0===f.radius){var h={x:e.segpts[c+2],y:e.segpts[c+3]};e.midX=d.x,e.midY=d.y,e.midVector=[d.y-h.y,h.x-d.x]}else{var v=[d.x-f.cx,d.y-f.cy],b=f.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(p){return p*b}),e.midX=f.cx+v[0],e.midY=f.cy+v[1],e.midVector=v}}else e.midX=e.segpts[c],e.midY=e.segpts[c+1]}}},fr.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||Be(e.startX)&&Be(e.startY)&&Be(e.endX)&&Be(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Bt("Edge `"+r.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."))},fr.findEdgeControlPoints=function(r){var e=this;if(r&&0!==r.length){for(var t=this,a=t.cy.hasCompoundNodes(),i=new jr,s=function($,J){return[].concat(re($),[J?1:0]).join("-")},o=[],l=[],u=0;u<r.length;u++){var c=r[u],d=c._private,f=c.pstyle("curve-style").value;if(!c.removed()&&c.takesUpSpace()){if("haystack"===f){l.push(c);continue}var h="unbundled-bezier"===f||Kr(f,"segments")||"straight"===f||"straight-triangle"===f||Kr(f,"taxi"),v="unbundled-bezier"===f||"bezier"===f,p=d.target,C=[d.source.poolIndex(),p.poolIndex()].sort(),A=s(C,h),z=i.get(A);null==z&&(z={eles:[]},o.push({pairId:C,edgeIsUnbundled:h}),i.set(A,z)),z.eles.push(c),h&&(z.hasUnbundled=!0),v&&(z.hasBezier=!0)}}for(var H=function(){var ue,$=o[F],Q=s($.pairId,$.edgeIsUnbundled),ee=i.get(Q);if(!ee.hasUnbundled){var fe=ee.eles[0].parallelEdges().filter(function(X){return X.isBundledBezier()});hs(ee.eles),fe.forEach(function(X){return ee.eles.push(X)}),ee.eles.sort(function(X,xe){return X.poolIndex()-xe.poolIndex()})}var ve=ee.eles[0],ce=ve.source(),pe=ve.target();if(ce.poolIndex()>pe.poolIndex()){var Se=ce;ce=pe,pe=Se}var Ie=ee.srcPos=ce.position(),me=ee.tgtPos=pe.position(),De=ee.srcW=ce.outerWidth(),Ue=ee.srcH=ce.outerHeight(),qe=ee.tgtW=pe.outerWidth(),je=ee.tgtH=pe.outerHeight(),Je=ee.srcShape=t.nodeShapes[e.getNodeShape(ce)],tt=ee.tgtShape=t.nodeShapes[e.getNodeShape(pe)],at=ee.srcCornerRadius="auto"===ce.pstyle("corner-radius").value?"auto":ce.pstyle("corner-radius").pfValue,He=ee.tgtCornerRadius="auto"===pe.pstyle("corner-radius").value?"auto":pe.pstyle("corner-radius").pfValue,Ce=ee.tgtRs=pe._private.rscratch,Ae=ee.srcRs=ce._private.rscratch;ee.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var _e=0;_e<ee.eles.length;_e++){var ze=ee.eles[_e],rt=ze[0]._private.rscratch,ct=ze.pstyle("curve-style").value,Nt="unbundled-bezier"===ct||Kr(ct,"segments")||Kr(ct,"taxi"),Et=!ce.same(ze.source());if(!ee.calculatedIntersection&&ce!==pe&&(ee.hasBezier||ee.hasUnbundled)){ee.calculatedIntersection=!0;var bt=Je.intersectLine(Ie.x,Ie.y,De,Ue,me.x,me.y,0,at,Ae),pt=ee.srcIntn=bt,ot=tt.intersectLine(me.x,me.y,qe,je,Ie.x,Ie.y,0,He,Ce),gt=ee.tgtIntn=ot,ht=ee.intersectionPts={x1:bt[0],x2:ot[0],y1:bt[1],y2:ot[1]},Tt=ee.posPts={x1:Ie.x,x2:me.x,y1:Ie.y,y2:me.y},xt=ot[1]-bt[1],It=ot[0]-bt[0],Rt=Math.sqrt(It*It+xt*xt);Be(Rt)&&Rt>=My||(Rt=Math.sqrt(Math.max(It*It,.01)+Math.max(xt*xt,.01)));var Gt=ee.vector={x:It,y:xt},kt=ee.vectorNorm={x:Gt.x/Rt,y:Gt.y/Rt},_t={x:-kt.y,y:kt.x};ee.nodesOverlap=!Be(Rt)||tt.checkPoint(bt[0],bt[1],0,qe,je,me.x,me.y,He,Ce)||Je.checkPoint(ot[0],ot[1],0,De,Ue,Ie.x,Ie.y,at,Ae),ee.vectorNormInverse=_t,ue={nodesOverlap:ee.nodesOverlap,dirCounts:ee.dirCounts,calculatedIntersection:!0,hasBezier:ee.hasBezier,hasUnbundled:ee.hasUnbundled,eles:ee.eles,srcPos:me,srcRs:Ce,tgtPos:Ie,tgtRs:Ae,srcW:qe,srcH:je,tgtW:De,tgtH:Ue,srcIntn:gt,tgtIntn:pt,srcShape:tt,tgtShape:Je,posPts:{x1:Tt.x2,y1:Tt.y2,x2:Tt.x1,y2:Tt.y1},intersectionPts:{x1:ht.x2,y1:ht.y2,x2:ht.x1,y2:ht.y1},vector:{x:-Gt.x,y:-Gt.y},vectorNorm:{x:-kt.x,y:-kt.y},vectorNormInverse:{x:-_t.x,y:-_t.y}}}var Xe=Et?ue:ee;rt.nodesOverlap=Xe.nodesOverlap,rt.srcIntn=Xe.srcIntn,rt.tgtIntn=Xe.tgtIntn,rt.isRound=ct.startsWith("round"),a&&(ce.isParent()||ce.isChild()||pe.isParent()||pe.isChild())&&(ce.parents().anySame(pe)||pe.parents().anySame(ce)||ce.same(pe)&&ce.isParent())?e.findCompoundLoopPoints(ze,Xe,_e,Nt):ce===pe?e.findLoopPoints(ze,Xe,_e,Nt):ct.endsWith("segments")?e.findSegmentsPoints(ze,Xe):ct.endsWith("taxi")?e.findTaxiPoints(ze,Xe):"straight"===ct||!Nt&&ee.eles.length%2==1&&_e===Math.floor(ee.eles.length/2)?e.findStraightEdgePoints(ze):e.findBezierPoints(ze,Xe,_e,Nt,Et),e.findEndpoints(ze),e.tryToCorrectInvalidPoints(ze,Xe),e.checkForInvalidEdgeWarning(ze),e.storeAllpts(ze),e.storeEdgeProjections(ze),e.calculateArrowAngles(ze),e.recalculateEdgeLabelProjections(ze),e.calculateLabelAngles(ze)}},F=0;F<o.length;F++)H();this.findHaystackPoints(l)}},fr.getSegmentPoints=function(r){var e=r[0]._private.rscratch;if(this.recalculateRenderedStyle(r),"segments"===e.edgeType)return Fd(e.segpts)},fr.getControlPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if("bezier"===t||"multibezier"===t||"self"===t||"compound"===t)return Fd(e.ctrlpts)},fr.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Ra={manualEndptToPx:function(r,e){var n=r.position(),a=r.outerWidth(),i=r.outerHeight(),s=r._private.rscratch;if(2===e.value.length){var o=[e.pfValue[0],e.pfValue[1]];return"%"===e.units[0]&&(o[0]=o[0]*a),"%"===e.units[1]&&(o[1]=o[1]*i),o[0]+=n.x,o[1]+=n.y,o}var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(a,i),c=[n.x+Math.cos(l)*u,n.y+Math.sin(l)*u];return this.nodeShapes[this.getNodeShape(r)].intersectLine(n.x,n.y,a,i,c[0],c[1],0,"auto"===r.pstyle("corner-radius").value?"auto":r.pstyle("corner-radius").pfValue,s)},findEndpoints:function(r){var e,t,n,a,s,i=this,o=r.source()[0],l=r.target()[0],u=o.position(),c=l.position(),d=r.pstyle("target-arrow-shape").value,f=r.pstyle("source-arrow-shape").value,h=r.pstyle("target-distance-from-node").pfValue,v=r.pstyle("source-distance-from-node").pfValue,b=o._private.rscratch,p=l._private.rscratch,g=r.pstyle("curve-style").value,x=r._private.rscratch,C=x.edgeType,A=Kr(g,"taxi"),z="self"===C||"compound"===C,H="bezier"===C||"multibezier"===C||z,F="bezier"!==C,j="straight"===C||"segments"===C,$="segments"===C,J=H||F||j,K=z||A,Q=r.pstyle("source-endpoint"),ee=K?"outside-to-node":Q.value,ue="auto"===o.pstyle("corner-radius").value?"auto":o.pstyle("corner-radius").pfValue,fe=r.pstyle("target-endpoint"),ve=K?"outside-to-node":fe.value,ce="auto"===l.pstyle("corner-radius").value?"auto":l.pstyle("corner-radius").pfValue;x.srcManEndpt=Q,x.tgtManEndpt=fe;var pe,Se,Ie,me,De=null!==(e=2===(null==fe||null===(t=fe.pfValue)||void 0===t?void 0:t.length)?fe.pfValue:null)&&void 0!==e?e:[0,0],Ue=null!==(n=2===(null==Q||null===(a=Q.pfValue)||void 0===a?void 0:a.length)?Q.pfValue:null)&&void 0!==n?n:[0,0];if(H){var qe=[x.ctrlpts[0],x.ctrlpts[1]];pe=F?[x.ctrlpts[x.ctrlpts.length-2],x.ctrlpts[x.ctrlpts.length-1]]:qe,Se=qe}else if(j){var Je=$?x.segpts.slice(0,2):[c.x+De[0],c.y+De[1]];pe=$?x.segpts.slice(x.segpts.length-2):[u.x+Ue[0],u.y+Ue[1]],Se=Je}if("inside-to-node"===ve)s=[c.x,c.y];else if(fe.units)s=this.manualEndptToPx(l,fe);else if("outside-to-line"===ve)s=x.tgtIntn;else if("outside-to-node"===ve||"outside-to-node-or-label"===ve?Ie=pe:("outside-to-line"===ve||"outside-to-line-or-label"===ve)&&(Ie=[u.x,u.y]),s=i.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),Ie[0],Ie[1],0,ce,p),"outside-to-node-or-label"===ve||"outside-to-line-or-label"===ve){var at=l._private.rscratch,Ae=at.labelX,_e=at.labelY,ze=at.labelWidth/2,rt=at.labelHeight/2,ct=l.pstyle("text-valign").value;"top"===(ct=Wn(ct))?_e-=rt:"bottom"===ct&&(_e+=rt);var Nt=l.pstyle("text-halign").value;"left"===(Nt=Xn(Nt))?Ae-=ze:"right"===Nt&&(Ae+=ze);var Et=ya(Ie[0],Ie[1],[Ae-ze,_e-rt,Ae+ze,_e-rt,Ae+ze,_e+rt,Ae-ze,_e+rt],c.x,c.y);if(Et.length>0){var bt=u,pt=xn(bt,Pn(s)),ot=xn(bt,Pn(Et)),gt=pt;ot<pt&&(s=Et,gt=ot),Et.length>2&&xn(bt,{x:Et[2],y:Et[3]})<gt&&(s=[Et[2],Et[3]])}}var Tt=ni(s,pe,i.arrowShapes[d].spacing(r)+h),xt=ni(s,pe,i.arrowShapes[d].gap(r)+h);if(x.endX=xt[0],x.endY=xt[1],x.arrowEndX=Tt[0],x.arrowEndY=Tt[1],"inside-to-node"===ee)s=[u.x,u.y];else if(Q.units)s=this.manualEndptToPx(o,Q);else if("outside-to-line"===ee)s=x.srcIntn;else if("outside-to-node"===ee||"outside-to-node-or-label"===ee?me=Se:("outside-to-line"===ee||"outside-to-line-or-label"===ee)&&(me=[c.x,c.y]),s=i.nodeShapes[this.getNodeShape(o)].intersectLine(u.x,u.y,o.outerWidth(),o.outerHeight(),me[0],me[1],0,ue,b),"outside-to-node-or-label"===ee||"outside-to-line-or-label"===ee){var It=o._private.rscratch,kt=It.labelX,_t=It.labelY,Xe=It.labelWidth/2,X=It.labelHeight/2,xe=o.pstyle("text-valign").value;"top"===(xe=Wn(xe))?_t-=X:"bottom"===xe&&(_t+=X);var Le=o.pstyle("text-halign").value;"left"===(Le=Xn(Le))?kt-=Xe:"right"===Le&&(kt+=Xe);var Fe=ya(me[0],me[1],[kt-Xe,_t-X,kt+Xe,_t-X,kt+Xe,_t+X,kt-Xe,_t+X],u.x,u.y);if(Fe.length>0){var Ve=c,dt=xn(Ve,Pn(s)),Ke=xn(Ve,Pn(Fe)),st=dt;Ke<dt&&(s=[Fe[0],Fe[1]],st=Ke),Fe.length>2&&xn(Ve,{x:Fe[2],y:Fe[3]})<st&&(s=[Fe[2],Fe[3]])}}var yt=ni(s,Se,i.arrowShapes[f].spacing(r)+v),Ct=ni(s,Se,i.arrowShapes[f].gap(r)+v);x.startX=Ct[0],x.startY=Ct[1],x.arrowStartX=yt[0],x.arrowStartY=yt[1],J&&(x.badLine=!(Be(x.startX)&&Be(x.startY)&&Be(x.endX)&&Be(x.endY)))},getSourceEndpoint:function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),"haystack"===e.edgeType?{x:e.haystackPts[0],y:e.haystackPts[1]}:{x:e.arrowStartX,y:e.arrowStartY}},getTargetEndpoint:function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),"haystack"===e.edgeType?{x:e.haystackPts[2],y:e.haystackPts[3]}:{x:e.arrowEndX,y:e.arrowEndY}}},Zo={};function Oy(r,e,t){for(var n=function(u,c,d,f){return tr(u,c,d,f)},i=e._private.rstyle.bezierPts,s=0;s<r.bezierProjPcts.length;s++){var o=r.bezierProjPcts[s];i.push({x:n(t[0],t[2],t[4],o),y:n(t[1],t[3],t[5],o)})}}Zo.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,n=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,"multibezier"===n||"bezier"===n||"self"===n||"compound"===n){e.rstyle.bezierPts=[];for(var a=0;a+5<t.allpts.length;a+=4)Oy(this,r,t.allpts.slice(a,a+6))}else if("segments"===n){var i=e.rstyle.linePts=[];for(a=0;a+1<t.allpts.length;a+=2)i.push({x:t.allpts[a],y:t.allpts[a+1]})}else if("haystack"===n){var s=t.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth},Zo.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var Gr={recalculateNodeLabelProjection:function(r){var e=r.pstyle("label").strValue;if(!Sr(e)){var t,n,a=r._private,i=r.width(),s=r.height(),o=r.padding(),l=r.position(),u=r.pstyle("text-halign").strValue,c=r.pstyle("text-valign").strValue,d=a.rscratch,f=a.rstyle;switch(u){case"left":t=l.x-i/2-o;break;case"left-inside":t=l.x-i/2+o;break;case"right":t=l.x+i/2+o;break;case"right-inside":t=l.x+i/2-o;break;default:t=l.x}switch(c){case"top":n=l.y-s/2-o;break;case"top-inside":n=l.y-s/2+o;break;case"bottom":n=l.y+s/2+o;break;case"bottom-inside":n=l.y+s/2-o;break;default:n=l.y}d.labelX=t,d.labelY=n,f.labelX=t,f.labelY=n,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}}},Gd=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},zd=function(e,t){return Gd(t.x-e.x,t.y-e.y)};Gr.recalculateEdgeLabelProjections=function(r){var e,t=r._private,n=t.rscratch,a=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){var s=function(d,f,h){Pr(t.rscratch,d,f,h),Pr(t.rstyle,d,f,h)};s("labelX",null,(e={x:n.midX,y:n.midY}).x),s("labelY",null,e.y);var o=Gd(n.midDispX,n.midDispY);s("labelAutoAngle",null,o);var l=function(){if(l.cache)return l.cache;for(var d=[],f=0;f+5<n.allpts.length;f+=4)d.push({p0:{x:n.allpts[f],y:n.allpts[f+1]},p1:{x:n.allpts[f+2],y:n.allpts[f+3]},p2:{x:n.allpts[f+4],y:n.allpts[f+5]},startDist:0,length:0,segments:[]});var p=t.rstyle.bezierPts,g=a.bezierProjPcts.length;function x(F,j,$,J,K){var Q=bn(j,$),ee=F.segments[F.segments.length-1];F.segments.push({p0:j,p1:$,t0:J,t1:K,startDist:ee?ee.startDist+ee.length:0,length:Q}),F.length+=Q}for(var C=0;C<d.length;C++){var A=d[C],z=d[C-1];z&&(A.startDist=z.startDist+z.length),x(A,A.p0,p[C*g],0,a.bezierProjPcts[0]);for(var H=0;H<g-1;H++)x(A,p[C*g+H],p[C*g+H+1],a.bezierProjPcts[H],a.bezierProjPcts[H+1]);x(A,p[C*g+g-1],A.p2,a.bezierProjPcts[g-1],1)}return l.cache=d},u=function(d){var f,h="source"===d;if(i[d]){var v=r.pstyle(d+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var p,b=l(),g=0,x=0,C=0;C<b.length;C++){for(var A=b[h?C:b.length-1-C],z=0;z<A.segments.length;z++){var H=A.segments[h?z:A.segments.length-1-z];if(g=x,(x+=H.length)>=v||C===b.length-1&&z===A.segments.length-1){p={cp:A,segment:H};break}}if(p)break}var j=p.cp,$=p.segment,J=(v-g)/$.length,K=$.t1-$.t0,Q=h?$.t0+K*J:$.t1-K*J;Q=ga(0,Q,1),e=kn(j.p0,j.p1,j.p2,Q),f=function(e,t,n,a){var i=ga(0,a-.001,1),s=ga(0,a+.001,1),o=kn(e,t,n,i),l=kn(e,t,n,s);return zd(o,l)}(j.p0,j.p1,j.p2,Q);break;case"straight":case"segments":case"haystack":for(var ue,fe,ve,ce,ee=0,pe=n.allpts.length,Se=0;Se+3<pe&&(h?(ve={x:n.allpts[Se],y:n.allpts[Se+1]},ce={x:n.allpts[Se+2],y:n.allpts[Se+3]}):(ve={x:n.allpts[pe-2-Se],y:n.allpts[pe-1-Se]},ce={x:n.allpts[pe-4-Se],y:n.allpts[pe-3-Se]}),fe=ee,!((ee+=ue=bn(ve,ce))>=v));Se+=2);var me=(v-fe)/ue;me=ga(0,me,1),e=function(e,t,n,a){var i_x=t.x-e.x,i_y=t.y-e.y,s=bn(e,t);return n=n??0,{x:e.x+i_x/s*(a=a??n*s),y:e.y+i_y/s*a}}(ve,ce,me),f=zd(ve,ce)}s("labelX",d,e.x),s("labelY",d,e.y),s("labelAutoAngle",d,f)}};u("source"),u("target"),this.applyLabelDimensions(r)}},Gr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))},Gr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,n=this.getLabelText(r,e),a=mn(n,r._private.labelDimsKey);if(vr(t.rscratch,"prefixedLabelDimsKey",e)!==a){Pr(t.rscratch,"prefixedLabelDimsKey",e,a);var i=this.calculateLabelDimensions(r,n),s=r.pstyle("line-height").pfValue,o=r.pstyle("font-size").pfValue,l=r.pstyle("text-wrap").strValue,u=vr(t.rscratch,"labelWrapCachedLines",e)||[],c="wrap"!==l?1:Math.max(u.length,1),d=o*s,f=i.width,h=i.height+(c-1)*(s-1)*o;Pr(t.rstyle,"labelWidth",e,f),Pr(t.rscratch,"labelWidth",e,f),Pr(t.rstyle,"labelHeight",e,h),Pr(t.rscratch,"labelHeight",e,h),Pr(t.rscratch,"labelLineHeight",e,d),Pr(t.rscratch,"labelActualDescent",e,i.labelActualDescent)}},Gr.getLabelText=function(r,e){var t=r._private,a=r.pstyle((e?e+"-":"")+"label").strValue,i=r.pstyle("text-transform").value,s=function(Ue,qe){return qe?(Pr(t.rscratch,Ue,e,qe),qe):vr(t.rscratch,Ue,e)};if(!a)return"";"none"==i||("uppercase"==i?a=a.toUpperCase():"lowercase"==i&&(a=a.toLowerCase()));var o=r.pstyle("text-wrap").value;if("wrap"===o){var l=s("labelKey");if(null!=l&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var c=a.split("\n"),d=r.pstyle("text-max-width").pfValue,h="anywhere"===r.pstyle("text-overflow-wrap").value,v=[],b=/[\s\u200b]+|$/g,p=0;p<c.length;p++){var g=c[p],C=this.calculateLabelDimensions(r,g).width;if(h){var A=g.split("").join("\u200b");g=A}if(C>d){var $,H="",F=0,j=U(g.matchAll(b));try{for(j.s();!($=j.n()).done;){var J=$.value,K=J[0],Q=g.substring(F,J.index);F=J.index+K.length,this.calculateLabelDimensions(r,0===H.length?Q:H+Q+K).width<=d?H+=Q+K:(H&&v.push(H),H=Q+K)}}catch(De){j.e(De)}finally{j.f()}H.match(/^[\s\u200b]+$/)||v.push(H)}else v.push(g)}s("labelWrapCachedLines",v),a=s("labelWrapCachedText",v.join("\n")),s("labelWrapKey",l)}else if("ellipsis"===o){var ve=r.pstyle("text-max-width").pfValue,ce="",Se=!1;if(this.calculateLabelDimensions(r,a).width<ve)return a;for(var Ie=0;Ie<a.length&&!(this.calculateLabelDimensions(r,ce+a[Ie]+"\u2026").width>ve);Ie++)ce+=a[Ie],Ie===a.length-1&&(Se=!0);return Se||(ce+="\u2026"),ce}return a},Gr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;return"auto"===e?r.isNode()?function(e){switch(e){case"left":case"right-inside":return"right";case"right":case"left-inside":return"left";default:return"center"}}(t):"center":e},Gr.calculateLabelDimensions=function(r,e){var a=this.cy.window().document,s=r.pstyle("font-style").strValue,o=r.pstyle("font-size").pfValue,l=r.pstyle("font-family").strValue,u=r.pstyle("font-weight").strValue,c=r.pstyle("text-metrics").strValue||"font",d=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=a.createElement("canvas"),f=this.labelCalcCanvasContext=d.getContext("2d");var h=d.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}f.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var v=0,b=0,p=e.split("\n"),g=p.length,x=0,C=0,A=0;A<g;A++){var H=f.measureText(p[A]),F=Math.ceil(H.width),j=o;"glyph"===c&&(0===A&&(C=H.actualBoundingBoxAscent),A===g-1&&(x=H.actualBoundingBoxDescent)),v=Math.max(F,v),b+=j}return"glyph"===c&&(b-=o-C-x),{width:v+=0,height:b+=0,labelActualAscent:C,labelActualDescent:x}},Gr.calculateLabelAngle=function(r,e){var n=r._private.rscratch,a=r.isEdge(),s=r.pstyle((e?e+"-":"")+"text-rotation"),o=s.strValue;return"none"===o?0:a&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:s.pfValue},Gr.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),a=r._private.rscratch;a.labelAngle=e.calculateLabelAngle(r),t&&(a.sourceLabelAngle=e.calculateLabelAngle(r,"source"),a.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var Vd={},Ud=!1;Vd.getNodeShape=function(r){var t=r.pstyle("shape").value;if("cutrectangle"===t&&(r.width()<28||r.height()<28))return Ud||(Bt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Ud=!0),"rectangle";if(r.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=r.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var Pi={updateCachedGrabbedEles:function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var a=(n=r[t])._private.rscratch;n.grabbed()&&!n.isParent()?e.push(n):a.inDragLayer?r.drag.push(n):r.nondrag.push(n)}for(t=0;t<e.length;t++){var n;r.drag.push(n=e[t])}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(nd),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e}},jd={};[Cn,Ri,fr,Ra,Zo,Gr,Vd,{registerCalculationListeners:function(){var r=this.cy,e=r.collection(),t=this,n=function(s){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.merge(s),o)for(var l=0;l<s.length;l++){var d=s[l]._private.rstyle;d.clean=!1,d.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(s){n(s.target)}).on("style.* background.*",function(s){n(s.target,!1)});var a=function(s){if(s){var o=t.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],c=u._private.rstyle;u.isNode()&&!c.cleanConnected&&(n(u.connectedEdges()),c.cleanConnected=!0)}if(o)for(var d=0;d<o.length;d++)(0,o[d])(s,e);t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){a(!0)},t.beforeRender(a,t.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(r){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(r)},recalculateRenderedStyle:function(r,e){var t=function(A){return A._private.rstyle.cleanConnected};if(0!==r.length){var n=[],a=[];if(!this.destroyed){void 0===e&&(e=!0);for(var i=0;i<r.length;i++){var s=r[i],o=s._private,l=o.rstyle;s.isEdge()&&(!t(s.source())||!t(s.target()))&&(l.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(C){return!C._private.rstyle.clean&&C.isBundledBezier()})&&(l.clean=!1),!(e&&l.clean||s.removed())&&"none"!==s.pstyle("display").value&&("nodes"===o.group?a.push(s):n.push(s),l.clean=!0)}for(var u=0;u<a.length;u++){var c=a[u],f=c._private.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),f.nodeX=h.x,f.nodeY=h.y,f.nodeW=c.pstyle("width").pfValue,f.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var v=0;v<n.length;v++){var p=n[v]._private,g=p.rstyle,x=p.rscratch;g.srcX=x.arrowStartX,g.srcY=x.arrowStartY,g.tgtX=x.arrowEndX,g.tgtY=x.arrowEndY,g.midX=x.midX,g.midY=x.midY,g.labelAngle=x.labelAngle,g.sourceLabelAngle=x.sourceLabelAngle,g.targetLabelAngle=x.targetLabelAngle}}}}},Pi].forEach(function(r){mt(jd,r)});var Xd={getCachedImage:function(r,e,t){var a=this.imageCache=this.imageCache||{},i=a[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;var s=(i=a[r]=a[r]||{}).image=new Image;s.addEventListener("load",t),s.addEventListener("error",function(){s.error=!0});return"data:"===r.substring(0,5).toLowerCase()||(s.crossOrigin=e="null"===e?null:e),s.src=r,s}},Wd=function(e,t){var n=e[0];!n||n._private.grabbed===t||(n._private.grabbed=t,e.updateStyle(!1))},Qn={registerBinding:function(r,e,t,n){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(r)){for(var i=[],s=0;s<r.length;s++){var o=r[s];if(void 0!==o){var l=this.binder(o);i.push(l.on.apply(l,a))}}return i}return(l=this.binder(r)).on.apply(l,a)},binder:function(r){var e=this,t=e.cy.window(),n=r===t||r===t.document||r===t.document.body||function(e){return!(typeof HTMLElement>"u")&&e instanceof HTMLElement}(r);if(null==e.supportsPassiveEvents){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=a}var s=function(l,u,c){var d=Array.prototype.slice.call(arguments);return n&&e.supportsPassiveEvents&&(d[2]={capture:c??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:d}),(r.addEventListener||r.on).apply(r,d),this};return{on:s,addEventListener:s,addListener:s,bind:s}},nodeIsDraggable:function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()},nodeIsGrabbable:function(r){return this.nodeIsDraggable(r)&&r.interactive()}};Qn.load=function(){var r=this,e=r.cy.window(),t=function(X){return X.selected()},a=function(X,xe,Le,Fe){null==X&&(X=r.cy);for(var Ve=0;Ve<xe.length;Ve++)X.emit({originalEvent:Le,type:xe[Ve],position:Fe})},i=function(X){return X.shiftKey||X.metaKey||X.ctrlKey},s=function(X,xe){var Le=!0;if(r.cy.hasCompoundNodes()&&X&&X.pannable()){for(var Fe=0;xe&&Fe<xe.length;Fe++)if((X=xe[Fe]).isNode()&&X.isParent()&&!X.pannable()){Le=!1;break}}else Le=!0;return Le},o=function(X){X[0]._private.rscratch.inDragLayer=!0},u=function(X){X[0]._private.rscratch.isGrabTarget=!0},d=function(X,xe){var Le=xe.addToList;!Le.has(X)&&X.grabbable()&&!X.locked()&&(Le.merge(X),function(e){Wd(e,!0)}(X))},h=function(X,xe){xe=xe||{};var Le=X.cy().hasCompoundNodes();xe.inDragLayer&&(X.forEach(o),X.neighborhood().stdFilter(function(Fe){return!Le||Fe.isEdge()}).forEach(o)),xe.addToList&&X.forEach(function(Fe){d(Fe,xe)}),function(X,xe){if(X.cy().hasCompoundNodes()&&(null!=xe.inDragLayer||null!=xe.addToList)){var Le=X.descendants();xe.inDragLayer&&(Le.forEach(o),Le.connectedEdges().forEach(o)),xe.addToList&&d(Le,xe)}}(X,xe),p(X,{inDragLayer:xe.inDragLayer}),r.updateCachedGrabbedEles()},v=h,b=function(X){X&&(r.getCachedZSortedEles().forEach(function(xe){(function(e){Wd(e,!1)})(xe),function(X){X[0]._private.rscratch.inDragLayer=!1}(xe),function(X){X[0]._private.rscratch.isGrabTarget=!1}(xe)}),r.updateCachedGrabbedEles())},p=function(X,xe){if((null!=xe.inDragLayer||null!=xe.addToList)&&X.cy().hasCompoundNodes()){var Le=X.ancestors().orphans();if(!Le.same(X)){var Fe=Le.descendants().spawnSelf().merge(Le).unmerge(X).unmerge(X.descendants()),Ve=Fe.connectedEdges();xe.inDragLayer&&(Ve.forEach(o),Fe.forEach(o)),xe.addToList&&Fe.forEach(function(dt){d(dt,xe)})}}},g=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},x=typeof MutationObserver<"u",C=typeof ResizeObserver<"u";x?(r.removeObserver=new MutationObserver(function(Xe){for(var X=0;X<Xe.length;X++){var Le=Xe[X].removedNodes;if(Le)for(var Fe=0;Fe<Le.length;Fe++)if(Le[Fe]===r.container){r.destroy();break}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(Xe){r.destroy()});var A=ca(function(){r.cy.resize()},100);x&&(r.styleObserver=new MutationObserver(A),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",A),C&&(r.resizeObserver=new ResizeObserver(A),r.resizeObserver.observe(r.container));var H=function(){r.invalidateContainerClientCoordsCache()};(function(X,xe){for(;null!=X;)xe(X),X=X.parentNode})(r.container,function(Xe){r.registerBinding(Xe,"transitionend",H),r.registerBinding(Xe,"animationend",H),r.registerBinding(Xe,"scroll",H)}),r.registerBinding(r.container,"contextmenu",function(Xe){Xe.preventDefault()});var j=function(X){for(var xe=r.findContainerClientCoords(),Le=xe[0],Fe=xe[1],Ve=xe[2],dt=xe[3],Ke=X.touches?X.touches:[X],st=!1,lt=0;lt<Ke.length;lt++){var yt=Ke[lt];if(Le<=yt.clientX&&yt.clientX<=Le+Ve&&Fe<=yt.clientY&&yt.clientY<=Fe+dt){st=!0;break}}if(!st)return!1;for(var Ct=r.container,ft=X.target.parentNode,Lt=!1;ft;){if(ft===Ct){Lt=!0;break}ft=ft.parentNode}return!!Lt};r.registerBinding(r.container,"mousedown",function(X){if(j(X)&&(1!==r.hoverData.which||1===X.which)){X.preventDefault(),g(),r.hoverData.capture=!0,r.hoverData.which=X.which;var xe=r.cy,Le=[X.clientX,X.clientY],Fe=r.projectIntoViewport(Le[0],Le[1]),Ve=r.selection,dt=r.findNearestElements(Fe[0],Fe[1],!0,!1),Ke=dt[0],st=r.dragData.possibleDragElements;r.hoverData.mdownPos=Fe,r.hoverData.mdownGPos=Le;var lt=function(Mt){return{originalEvent:X,type:Mt,position:{x:Fe[0],y:Fe[1]}}};if(3==X.which){r.hoverData.cxtStarted=!0;var Ct={originalEvent:X,type:"cxttapstart",position:{x:Fe[0],y:Fe[1]}};Ke?(Ke.activate(),Ke.emit(Ct),r.hoverData.down=Ke):xe.emit(Ct),r.hoverData.downTime=(new Date).getTime(),r.hoverData.cxtDragged=!1}else if(1==X.which){if(Ke&&Ke.activate(),null!=Ke&&r.nodeIsGrabbable(Ke)){if(u(Ke),Ke.selected()){st=r.dragData.possibleDragElements=xe.collection();var ft=xe.$(function(Lt){return Lt.isNode()&&Lt.selected()&&r.nodeIsGrabbable(Lt)});h(ft,{addToList:st}),Ke.emit(lt("grabon")),ft.forEach(function(Mt){Mt.emit(lt("grab"))})}else st=r.dragData.possibleDragElements=xe.collection(),v(Ke,{addToList:st}),Ke.emit(lt("grabon")).emit(lt("grab"));r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=Ke,r.hoverData.downs=dt,r.hoverData.downTime=(new Date).getTime(),a(Ke,["mousedown","tapstart","vmousedown"],X,{x:Fe[0],y:Fe[1]}),null==Ke?(Ve[4]=1,r.data.bgActivePosistion={x:Fe[0],y:Fe[1]},r.redrawHint("select",!0),r.redraw()):Ke.pannable()&&(Ve[4]=1),r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var Mt=r.hoverData.down;Mt?Mt.emit(lt("taphold")):xe.emit(lt("taphold"))}},r.tapholdDuration)}Ve[0]=Ve[2]=Fe[0],Ve[1]=Ve[3]=Fe[1]}},!1);var J,K,Q,$=function(X){var xe=X.getRootNode();if(xe&&11===xe.nodeType&&void 0!==xe.host)return xe}(r.container);r.registerBinding([e,$],"mousemove",function(X){var Dr;if(r.hoverData.capture||j(X)){var Le=!1,Fe=r.cy,Ve=Fe.zoom(),dt=[X.clientX,X.clientY],Ke=r.projectIntoViewport(dt[0],dt[1]),st=r.hoverData.mdownPos,lt=r.hoverData.mdownGPos,yt=r.selection,Ct=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(Ct=r.findNearestElement(Ke[0],Ke[1],!0,!1));var ar,Dt=r.hoverData.last,ft=r.hoverData.down,Lt=[Ke[0]-yt[2],Ke[1]-yt[3]],Mt=r.dragData.possibleDragElements;if(lt){var Yt=dt[0]-lt[0],$t=dt[1]-lt[1];r.hoverData.isOverThresholdDrag=ar=Yt*Yt+$t*$t>=r.desktopTapThreshold2}var ur=i(X);ar&&(r.hoverData.tapholdCancelled=!0),Le=!0,a(Ct,["mousemove","vmousemove","tapdrag"],X,{x:Ke[0],y:Ke[1]});var Xt=function(Dr){return{originalEvent:X,type:Dr,position:{x:Ke[0],y:Ke[1]}}},qr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||Fe.emit(Xt("boxstart")),yt[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(3===r.hoverData.which){if(ar){var Rr=Xt("cxtdrag");ft?ft.emit(Rr):Fe.emit(Rr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||Ct!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(Xt("cxtdragout")),r.hoverData.cxtOver=Ct,Ct&&Ct.emit(Xt("cxtdragover")))}}else if(r.hoverData.dragging){if(Le=!0,Fe.panningEnabled()&&Fe.userPanningEnabled()){var gn;if(r.hoverData.justStartedPan){var Xi=r.hoverData.mdownPos;gn={x:(Ke[0]-Xi[0])*Ve,y:(Ke[1]-Xi[1])*Ve},r.hoverData.justStartedPan=!1}else gn={x:Lt[0]*Ve,y:Lt[1]*Ve};Fe.panBy(gn),Fe.emit(Xt("dragpan")),r.hoverData.dragged=!0}Ke=r.projectIntoViewport(X.clientX,X.clientY)}else if(1!=yt[4]||null!=ft&&!ft.pannable()){if(ft&&ft.pannable()&&ft.active()&&ft.unactivate(),(!ft||!ft.grabbed())&&Ct!=Dt&&(Dt&&a(Dt,["mouseout","tapdragout"],X,{x:Ke[0],y:Ke[1]}),Ct&&a(Ct,["mouseover","tapdragover"],X,{x:Ke[0],y:Ke[1]}),r.hoverData.last=Ct),ft)if(ar){if(Fe.boxSelectionEnabled()&&ur)ft&&ft.grabbed()&&(b(Mt),ft.emit(Xt("freeon")),Mt.emit(Xt("free")),r.dragData.didDrag&&(ft.emit(Xt("dragfreeon")),Mt.emit(Xt("dragfree")))),qr();else if(ft&&ft.grabbed()&&r.nodeIsDraggable(ft)){var br=!r.dragData.didDrag;br&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||h(Mt,{inDragLayer:!0});var hr={x:0,y:0};if(Be(Lt[0])&&Be(Lt[1])&&(hr.x+=Lt[0],hr.y+=Lt[1],br)){var xr=r.hoverData.dragDelta;xr&&Be(xr[0])&&Be(xr[1])&&(hr.x+=xr[0],hr.y+=xr[1])}r.hoverData.draggingEles=!0,Mt.silentShift(hr).emit(Xt("position")).emit(Xt("drag")),r.redrawHint("drag",!0),r.redraw()}}else 0===(Dr=r.hoverData.dragDelta=r.hoverData.dragDelta||[]).length?(Dr.push(Lt[0]),Dr.push(Lt[1])):(Dr[0]+=Lt[0],Dr[1]+=Lt[1]);Le=!0}else ar&&(r.hoverData.dragging||!Fe.boxSelectionEnabled()||!ur&&Fe.panningEnabled()&&Fe.userPanningEnabled()?!r.hoverData.selecting&&Fe.panningEnabled()&&Fe.userPanningEnabled()&&s(ft,r.hoverData.downs)&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,yt[4]=0,r.data.bgActivePosistion=Pn(st),r.redrawHint("select",!0),r.redraw()):qr(),ft&&ft.pannable()&&ft.active()&&ft.unactivate());if(yt[2]=Ke[0],yt[3]=Ke[1],Le)return X.stopPropagation&&X.stopPropagation(),X.preventDefault&&X.preventDefault(),!1}},!1),r.registerBinding(e,"mouseup",function(X){if((1!==r.hoverData.which||1===X.which||!r.hoverData.capture)&&r.hoverData.capture){r.hoverData.capture=!1;var Le=r.cy,Fe=r.projectIntoViewport(X.clientX,X.clientY),Ve=r.selection,dt=r.findNearestElement(Fe[0],Fe[1],!0,!1),Ke=r.dragData.possibleDragElements,st=r.hoverData.down,lt=i(X);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,st&&st.unactivate();var yt=function(Yt){return{originalEvent:X,type:Yt,position:{x:Fe[0],y:Fe[1]}}};if(3===r.hoverData.which){var Ct=yt("cxttapend");if(st?st.emit(Ct):Le.emit(Ct),!r.hoverData.cxtDragged){var Dt=yt("cxttap");st?st.emit(Dt):Le.emit(Dt)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(1===r.hoverData.which){if(a(dt,["mouseup","tapend","vmouseup"],X,{x:Fe[0],y:Fe[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(st,["click","tap","vclick"],X,{x:Fe[0],y:Fe[1]}),K=!1,X.timeStamp-Q<=Le.multiClickDebounceTime()?(J&&clearTimeout(J),K=!0,Q=null,a(st,["dblclick","dbltap","vdblclick"],X,{x:Fe[0],y:Fe[1]})):(J=setTimeout(function(){K||a(st,["oneclick","onetap","voneclick"],X,{x:Fe[0],y:Fe[1]})},Le.multiClickDebounceTime()),Q=X.timeStamp)),null==st&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(X)&&(Le.$(t).unselect(["tapunselect"]),Ke.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=Ke=Le.collection()),dt==st&&!r.dragData.didDrag&&!r.hoverData.selecting&&null!=dt&&dt._private.selectable&&(r.hoverData.dragging||("additive"===Le.selectionType()||lt?dt.selected()?dt.unselect(["tapunselect"]):dt.select(["tapselect"]):lt||(Le.$(t).unmerge(dt).unselect(["tapunselect"]),dt.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var ft=Le.collection(r.getAllInBox(Ve[0],Ve[1],Ve[2],Ve[3]));r.redrawHint("select",!0),ft.length>0&&r.redrawHint("eles",!0),Le.emit(yt("boxend")),"additive"===Le.selectionType()||lt||Le.$(t).unmerge(ft).unselect(),ft.emit(yt("box")).stdFilter(function(Yt){return Yt.selectable()&&!Yt.selected()}).select().emit(yt("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!Ve[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var Mt=st&&st.grabbed();b(Ke),Mt&&(st.emit(yt("freeon")),Ke.emit(yt("free")),r.dragData.didDrag&&(st.emit(yt("dragfreeon")),Ke.emit(yt("dragfree"))))}}Ve[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}},!1);var fe,ee=[],ve=1e5,Se=function(X){var xe=!1,Le=X.deltaY;if(null==Le&&(null!=X.wheelDeltaY?Le=X.wheelDeltaY/4:null!=X.wheelDelta&&(Le=X.wheelDelta/4)),0!==Le){if(null==fe)if(ee.length>=4){var Fe=ee;if(fe=function(X){for(var Le=0;Le<X.length;Le++)if(X[Le]%5!=0)return!1;return!0}(Fe),!fe){var Ve=Math.abs(Fe[0]);fe=function(X){for(var xe=Math.abs(X[0]),Le=1;Le<X.length;Le++)if(Math.abs(X[Le])!==xe)return!1;return!0}(Fe)&&Ve>5}if(fe)for(var dt=0;dt<Fe.length;dt++)ve=Math.min(Math.abs(Fe[dt]),ve)}else ee.push(Le),xe=!0;else fe&&(ve=Math.min(Math.abs(Le),ve));if(!r.scrollingPage){var Ke=r.cy,st=Ke.zoom(),lt=Ke.pan(),yt=r.projectIntoViewport(X.clientX,X.clientY),Ct=[yt[0]*st+lt.x,yt[1]*st+lt.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||0!==r.selection[4])return void X.preventDefault();if(Ke.panningEnabled()&&Ke.userPanningEnabled()&&Ke.zoomingEnabled()&&Ke.userZoomingEnabled()){var Dt;X.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150),xe&&Math.abs(Le)>5&&(Le=5*ms(Le)),Dt=Le/-250,fe&&(Dt/=ve,Dt*=3),Dt*=r.wheelSensitivity,1===X.deltaMode&&(Dt*=33);var Lt=Ke.zoom()*Math.pow(10,Dt);"gesturechange"===X.type&&(Lt=r.gestureStartZoom*X.scale),Ke.zoom({level:Lt,renderedPosition:{x:Ct[0],y:Ct[1]}}),Ke.emit({type:"gesturechange"===X.type?"pinchzoom":"scrollzoom",originalEvent:X,position:{x:yt[0],y:yt[1]}})}}}};r.registerBinding(r.container,"wheel",Se,!0),r.registerBinding(e,"scroll",function(X){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(X){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||X.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(Xe){r.hasTouchStarted||Se(Xe)},!0),r.registerBinding(r.container,"mouseout",function(X){var xe=r.projectIntoViewport(X.clientX,X.clientY);r.cy.emit({originalEvent:X,type:"mouseout",position:{x:xe[0],y:xe[1]}})},!1),r.registerBinding(r.container,"mouseover",function(X){var xe=r.projectIntoViewport(X.clientX,X.clientY);r.cy.emit({originalEvent:X,type:"mouseover",position:{x:xe[0],y:xe[1]}})},!1);var Ie,me,De,Ue,qe,je,Je,tt,at,He,Ce,Ae,_e,ct,Nt,Et,bt,pt,ot,gt,ze=function(X,xe,Le,Fe){return Math.sqrt((Le-X)*(Le-X)+(Fe-xe)*(Fe-xe))},rt=function(X,xe,Le,Fe){return(Le-X)*(Le-X)+(Fe-xe)*(Fe-xe)};if(r.registerBinding(r.container,"touchstart",ct=function(X){if(r.hasTouchStarted=!0,j(X)){g(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var xe=r.cy,Le=r.touchData.now,Fe=r.touchData.earlier;if(X.touches[0]){var Ve=r.projectIntoViewport(X.touches[0].clientX,X.touches[0].clientY);Le[0]=Ve[0],Le[1]=Ve[1]}X.touches[1]&&(Ve=r.projectIntoViewport(X.touches[1].clientX,X.touches[1].clientY),Le[2]=Ve[0],Le[3]=Ve[1]),X.touches[2]&&(Ve=r.projectIntoViewport(X.touches[2].clientX,X.touches[2].clientY),Le[4]=Ve[0],Le[5]=Ve[1]);var dt=function(ur){return{originalEvent:X,type:ur,position:{x:Le[0],y:Le[1]}}};if(X.touches[1]){r.touchData.singleTouchMoved=!0,b(r.dragData.touchDragEles);var Ke=r.findContainerClientCoords();Ce=Ke[2],Ae=Ke[3],me=X.touches[0].clientY-(He=Ke[1]),De=X.touches[1].clientX-(at=Ke[0]),Ue=X.touches[1].clientY-He,_e=0<=(Ie=X.touches[0].clientX-at)&&Ie<=Ce&&0<=De&&De<=Ce&&0<=me&&me<=Ae&&0<=Ue&&Ue<=Ae;var st=xe.pan(),lt=xe.zoom();if(qe=ze(Ie,me,De,Ue),je=rt(Ie,me,De,Ue),tt=[((Je=[(Ie+De)/2,(me+Ue)/2])[0]-st.x)/lt,(Je[1]-st.y)/lt],je<4e4&&!X.touches[2]){var Dt=r.findNearestElement(Le[0],Le[1],!0,!0),ft=r.findNearestElement(Le[2],Le[3],!0,!0);return Dt&&Dt.isNode()?(Dt.activate().emit(dt("cxttapstart")),r.touchData.start=Dt):ft&&ft.isNode()?(ft.activate().emit(dt("cxttapstart")),r.touchData.start=ft):xe.emit(dt("cxttapstart")),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,void r.redraw()}}if(X.touches[2])xe.boxSelectionEnabled()&&X.preventDefault();else if(!X.touches[1]&&X.touches[0]){var Lt=r.findNearestElements(Le[0],Le[1],!0,!0),Mt=Lt[0];if(null!=Mt&&(Mt.activate(),r.touchData.start=Mt,r.touchData.starts=Lt,r.nodeIsGrabbable(Mt))){var ar=r.dragData.touchDragEles=xe.collection(),Yt=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),Mt.selected()?(Yt=xe.$(function(er){return er.selected()&&r.nodeIsGrabbable(er)}),h(Yt,{addToList:ar})):v(Mt,{addToList:ar}),u(Mt),Mt.emit(dt("grabon")),Yt?Yt.forEach(function(er){er.emit(dt("grab"))}):Mt.emit(dt("grab"))}a(Mt,["touchstart","tapstart","vmousedown"],X,{x:Le[0],y:Le[1]}),null==Mt&&(r.data.bgActivePosistion={x:Ve[0],y:Ve[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){!1===r.touchData.singleTouchMoved&&!r.pinching&&!r.touchData.selecting&&a(r.touchData.start,["taphold"],X,{x:Le[0],y:Le[1]})},r.tapholdDuration)}if(X.touches.length>=1){for(var Nr=r.touchData.startPosition=[null,null,null,null,null,null],$t=0;$t<Le.length;$t++)Nr[$t]=Fe[$t]=Le[$t];var Zt=X.touches[0];r.touchData.startGPosition=[Zt.clientX,Zt.clientY]}}},!1),r.registerBinding(e,"touchmove",Nt=function(X){var xe=r.touchData.capture;if(xe||j(X)){var Le=r.selection,Fe=r.cy,Ve=r.touchData.now,dt=r.touchData.earlier,Ke=Fe.zoom();if(X.touches[0]){var st=r.projectIntoViewport(X.touches[0].clientX,X.touches[0].clientY);Ve[0]=st[0],Ve[1]=st[1]}X.touches[1]&&(st=r.projectIntoViewport(X.touches[1].clientX,X.touches[1].clientY),Ve[2]=st[0],Ve[3]=st[1]),X.touches[2]&&(st=r.projectIntoViewport(X.touches[2].clientX,X.touches[2].clientY),Ve[4]=st[0],Ve[5]=st[1]);var Ct,lt=function(fb){return{originalEvent:X,type:fb,position:{x:Ve[0],y:Ve[1]}}},yt=r.touchData.startGPosition;if(xe&&X.touches[0]&&yt){for(var Dt=[],ft=0;ft<Ve.length;ft++)Dt[ft]=Ve[ft]-dt[ft];var Lt=X.touches[0].clientX-yt[0],ar=X.touches[0].clientY-yt[1];Ct=Lt*Lt+ar*ar>=r.touchTapThreshold2}if(xe&&r.touchData.cxt){X.preventDefault();var Hr=rt($t=X.touches[0].clientX-at,Zt=X.touches[0].clientY-He,er=X.touches[1].clientX-at,ur=X.touches[1].clientY-He);if(Hr/je>=2.25||Hr>=22500){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Rn=lt("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(Rn),r.touchData.start=null):Fe.emit(Rn)}}if(xe&&r.touchData.cxt){Rn=lt("cxtdrag"),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Rn):Fe.emit(Rn),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var br=r.findNearestElement(Ve[0],Ve[1],!0,!0);(!r.touchData.cxtOver||br!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(lt("cxtdragout")),r.touchData.cxtOver=br,br&&br.emit(lt("cxtdragover")))}else if(xe&&X.touches[2]&&Fe.boxSelectionEnabled())X.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||Fe.emit(lt("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,Le[4]=1,Le&&0!==Le.length&&void 0!==Le[0]?(Le[2]=(Ve[0]+Ve[2]+Ve[4])/3,Le[3]=(Ve[1]+Ve[3]+Ve[5])/3):(Le[0]=(Ve[0]+Ve[2]+Ve[4])/3,Le[1]=(Ve[1]+Ve[3]+Ve[5])/3,Le[2]=(Ve[0]+Ve[2]+Ve[4])/3+1,Le[3]=(Ve[1]+Ve[3]+Ve[5])/3+1),r.redrawHint("select",!0),r.redraw();else if(xe&&X.touches[1]&&!r.touchData.didSelect&&Fe.zoomingEnabled()&&Fe.panningEnabled()&&Fe.userZoomingEnabled()&&Fe.userPanningEnabled()){if(X.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),hr=r.dragData.touchDragEles){r.redrawHint("drag",!0);for(var xr=0;xr<hr.length;xr++){var za=hr[xr]._private;za.grabbed=!1,za.rscratch.inDragLayer=!1}}var $t,Zt,er,ur,Dr=r.touchData.start,Vf=ze($t=X.touches[0].clientX-at,Zt=X.touches[0].clientY-He,er=X.touches[1].clientX-at,ur=X.touches[1].clientY-He),nb=Vf/qe;if(_e){var lb=($t-Ie+(er-De))/2,ub=(Zt-me+(ur-Ue))/2,Va=Fe.zoom(),gl=Va*nb,Wi=Fe.pan(),Hf=tt[0]*Va+Wi.x,Uf=tt[1]*Va+Wi.y,cb={x:-gl/Va*(Hf-Wi.x-lb)+Hf,y:-gl/Va*(Uf-Wi.y-ub)+Uf};Dr&&Dr.active()&&(b(hr=r.dragData.touchDragEles),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Dr.unactivate().emit(lt("freeon")),hr.emit(lt("free")),r.dragData.didDrag&&(Dr.emit(lt("dragfreeon")),hr.emit(lt("dragfree")))),Fe.viewport({zoom:gl,pan:cb,cancelOnFailedZoom:!0}),Fe.emit(lt("pinchzoom")),qe=Vf,Ie=$t,me=Zt,De=er,Ue=ur,r.pinching=!0}X.touches[0]&&(st=r.projectIntoViewport(X.touches[0].clientX,X.touches[0].clientY),Ve[0]=st[0],Ve[1]=st[1]),X.touches[1]&&(st=r.projectIntoViewport(X.touches[1].clientX,X.touches[1].clientY),Ve[2]=st[0],Ve[3]=st[1]),X.touches[2]&&(st=r.projectIntoViewport(X.touches[2].clientX,X.touches[2].clientY),Ve[4]=st[0],Ve[5]=st[1])}else if(X.touches[0]&&!r.touchData.didSelect){var Mr=r.touchData.start,pl=r.touchData.last;if(!r.hoverData.draggingEles&&!r.swipePanning&&(br=r.findNearestElement(Ve[0],Ve[1],!0,!0)),xe&&null!=Mr&&X.preventDefault(),xe&&null!=Mr&&r.nodeIsDraggable(Mr))if(Ct){var hr=r.dragData.touchDragEles,jf=!r.dragData.didDrag;jf&&h(hr,{inDragLayer:!0}),r.dragData.didDrag=!0;var Ha={x:0,y:0};Be(Dt[0])&&Be(Dt[1])&&(Ha.x+=Dt[0],Ha.y+=Dt[1],jf)&&(r.redrawHint("eles",!0),(Or=r.touchData.dragDelta)&&Be(Or[0])&&Be(Or[1])&&(Ha.x+=Or[0],Ha.y+=Or[1])),r.hoverData.draggingEles=!0,hr.silentShift(Ha).emit(lt("position")).emit(lt("drag")),r.redrawHint("drag",!0),r.touchData.startPosition[0]==dt[0]&&r.touchData.startPosition[1]==dt[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Or;0===(Or=r.touchData.dragDelta=r.touchData.dragDelta||[]).length?(Or.push(Dt[0]),Or.push(Dt[1])):(Or[0]+=Dt[0],Or[1]+=Dt[1])}if(a(Mr||br,["touchmove","tapdrag","vmousemove"],X,{x:Ve[0],y:Ve[1]}),(!Mr||!Mr.grabbed())&&br!=pl&&(pl&&pl.emit(lt("tapdragout")),br&&br.emit(lt("tapdragover"))),r.touchData.last=br,xe)for(xr=0;xr<Ve.length;xr++)Ve[xr]&&r.touchData.startPosition[xr]&&Ct&&(r.touchData.singleTouchMoved=!0);xe&&(null==Mr||Mr.pannable())&&Fe.panningEnabled()&&Fe.userPanningEnabled()&&(s(Mr,r.touchData.starts)&&(X.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Pn(r.touchData.startPosition)),r.swipePanning?(Fe.panBy({x:Dt[0]*Ke,y:Dt[1]*Ke}),Fe.emit(lt("dragpan"))):Ct&&(r.swipePanning=!0,Fe.panBy({x:Lt*Ke,y:ar*Ke}),Fe.emit(lt("dragpan")),Mr&&(Mr.unactivate(),r.redrawHint("select",!0),r.touchData.start=null))),st=r.projectIntoViewport(X.touches[0].clientX,X.touches[0].clientY),Ve[0]=st[0],Ve[1]=st[1])}for(ft=0;ft<Ve.length;ft++)dt[ft]=Ve[ft];xe&&X.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&null!=r.data.bgActivePosistion&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1),r.registerBinding(e,"touchcancel",Et=function(X){var xe=r.touchData.start;r.touchData.capture=!1,xe&&xe.unactivate()}),r.registerBinding(e,"touchend",bt=function(X){var xe=r.touchData.start;if(r.touchData.capture){0===X.touches.length&&(r.touchData.capture=!1),X.preventDefault();var Fe=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var Ve=r.cy,dt=Ve.zoom(),Ke=r.touchData.now,st=r.touchData.earlier;if(X.touches[0]){var lt=r.projectIntoViewport(X.touches[0].clientX,X.touches[0].clientY);Ke[0]=lt[0],Ke[1]=lt[1]}X.touches[1]&&(lt=r.projectIntoViewport(X.touches[1].clientX,X.touches[1].clientY),Ke[2]=lt[0],Ke[3]=lt[1]),X.touches[2]&&(lt=r.projectIntoViewport(X.touches[2].clientX,X.touches[2].clientY),Ke[4]=lt[0],Ke[5]=lt[1]);var Ct,yt=function(Rr){return{originalEvent:X,type:Rr,position:{x:Ke[0],y:Ke[1]}}};if(xe&&xe.unactivate(),r.touchData.cxt){if(Ct=yt("cxttapend"),xe?xe.emit(Ct):Ve.emit(Ct),!r.touchData.cxtDragged){var Dt=yt("cxttap");xe?xe.emit(Dt):Ve.emit(Dt)}return r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,void r.redraw()}if(!X.touches[2]&&Ve.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var ft=Ve.collection(r.getAllInBox(Fe[0],Fe[1],Fe[2],Fe[3]));Fe[0]=void 0,Fe[1]=void 0,Fe[2]=void 0,Fe[3]=void 0,Fe[4]=0,r.redrawHint("select",!0),Ve.emit(yt("boxend")),ft.emit(yt("box")).stdFilter(function(Rr){return Rr.selectable()&&!Rr.selected()}).select().emit(yt("boxselect")),ft.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(xe?.unactivate(),X.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!X.touches[1]&&!X.touches[0]&&!X.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Mt=r.dragData.touchDragEles;if(null!=xe){var ar=xe._private.grabbed;b(Mt),r.redrawHint("drag",!0),r.redrawHint("eles",!0),ar&&(xe.emit(yt("freeon")),Mt.emit(yt("free")),r.dragData.didDrag&&(xe.emit(yt("dragfreeon")),Mt.emit(yt("dragfree")))),a(xe,["touchend","tapend","vmouseup","tapdragout"],X,{x:Ke[0],y:Ke[1]}),xe.unactivate(),r.touchData.start=null}else{var Yt=r.findNearestElement(Ke[0],Ke[1],!0,!0);a(Yt,["touchend","tapend","vmouseup","tapdragout"],X,{x:Ke[0],y:Ke[1]})}var Nr=r.touchData.startPosition[0]-Ke[0],Zt=r.touchData.startPosition[1]-Ke[1],Hr=(Nr*Nr+Zt*Zt)*dt*dt;r.touchData.singleTouchMoved||(xe||Ve.$(":selected").unselect(["tapunselect"]),a(xe,["tap","vclick"],X,{x:Ke[0],y:Ke[1]}),pt=!1,X.timeStamp-gt<=Ve.multiClickDebounceTime()?(ot&&clearTimeout(ot),pt=!0,gt=null,a(xe,["dbltap","vdblclick"],X,{x:Ke[0],y:Ke[1]})):(ot=setTimeout(function(){pt||a(xe,["onetap","voneclick"],X,{x:Ke[0],y:Ke[1]})},Ve.multiClickDebounceTime()),gt=X.timeStamp)),null!=xe&&!r.dragData.didDrag&&xe._private.selectable&&Hr<r.touchTapThreshold2&&!r.pinching&&("single"===Ve.selectionType()?(Ve.$(t).unmerge(xe).unselect(["tapunselect"]),xe.select(["tapselect"])):xe.selected()?xe.unselect(["tapunselect"]):xe.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}for(var Xt=0;Xt<Ke.length;Xt++)st[Xt]=Ke[Xt];r.dragData.didDrag=!1,0===X.touches.length&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),X.touches.length<2&&(1===X.touches.length&&(r.touchData.startGPosition=[X.touches[0].clientX,X.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())}},!1),typeof TouchEvent>"u"){var ht=[],Tt=function(X){return{clientX:X.clientX,clientY:X.clientY,force:1,identifier:X.pointerId,pageX:X.pageX,pageY:X.pageY,radiusX:X.width/2,radiusY:X.height/2,screenX:X.screenX,screenY:X.screenY,target:X.target}},Rt=function(X){for(var xe=0;xe<ht.length;xe++)if(ht[xe].event.pointerId===X.pointerId)return void ht.splice(xe,1)},kt=function(X){X.touches=ht.map(function(xe){return xe.touch})},_t=function(X){return"mouse"===X.pointerType||4===X.pointerType};r.registerBinding(r.container,"pointerdown",function(Xe){_t(Xe)||(Xe.preventDefault(),ht.push(function(X){return{event:X,touch:Tt(X)}}(Xe)),kt(Xe),ct(Xe))}),r.registerBinding(r.container,"pointerup",function(Xe){_t(Xe)||(Rt(Xe),kt(Xe),bt(Xe))}),r.registerBinding(r.container,"pointercancel",function(Xe){_t(Xe)||(Rt(Xe),kt(Xe),Et())}),r.registerBinding(r.container,"pointermove",function(Xe){var X,xe;_t(Xe)||(Xe.preventDefault(),X=Xe,(xe=ht.filter(function(Le){return Le.event.pointerId===X.pointerId})[0]).event=X,xe.touch=Tt(X),kt(Xe),Nt(Xe))})}};var Yr={generatePolygon:function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(n,a,i,s,o,l){this.renderer.nodeShapeImpl("polygon",n,a,i,s,o,this.points)},intersectLine:function(n,a,i,s,o,l,u,c){return ya(o,l,this.points,n,a,i/2,s/2,u)},checkPoint:function(n,a,i,s,o,l,u,c){return Xr(n,a,this.points,l,u,s,o,[0,-1],i)},hasMiterBounds:"rectangle"!==r,miterBounds:function(n,a,i,s,o,l){return function ov(r,e,t,n,a,i){var o=function sv(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=function(j,$){return{x:j.x+$.x,y:j.y+$.y}},n=function(j,$){return{x:j.x-$.x,y:j.y-$.y}},a=function(j,$){return{x:j.x*$,y:j.y*$}},i=function(j,$){return j.x*$.y-j.y*$.x},s=function(j){var $=iv(j.x,j.y);return 0===$?{x:0,y:0}:{x:j.x/$,y:j.y/$}},l=function(j,$,J,K){var Q=n($,j),ee=n(K,J),ue=i(Q,ee);if(Math.abs(ue)<1e-9)return t(j,a(Q,.5));var fe=i(n(J,j),ee)/ue;return t(j,a(Q,fe))},u=r.map(function(F){return{x:F.x,y:F.y}});(function(j){for(var $=0,J=0;J<j.length;J++){var K=j[J],Q=j[(J+1)%j.length];$+=K.x*Q.y-Q.x*K.y}return $/2})(u)<0&&u.reverse();for(var c=u.length,d=[],f=0;f<c;f++){var b=n(u[(f+1)%c],u[f]),p=s({x:b.y,y:-b.x});d.push(p)}for(var g=d.map(function(F,j){return{p1:t(u[j],a(F,e)),p2:t(u[(j+1)%c],a(F,e))}}),x=[],C=0;C<c;C++){var A=g[(C-1+c)%c],z=g[C],H=l(A.p1,A.p2,z.p1,z.p2);x.push(H)}return x}(pv(r,e,t,n,a),i),l=gr();return o.forEach(function(u){return Ql(l,u.x,u.y)}),l}(this.points,n,a,i,s,o)}}},generateEllipse:function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,a,i,s){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,s,o,l){return function(e,t,n,a,i,s){var o=n-e,l=a-t;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),c=u-1;if(c<0)return[];var d=c/u;return[(n-e)*d+e,(a-t)*d+t]}(i,s,e,t,n/2+o,a/2+o)},checkPoint:function(e,t,n,a,i,s,o,l){return wn(e,t,a,i,s,o,n)}}},generateRoundPolygon:function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(n,a,i,s,o,l,u){if(void 0!==l[u]&&l[u+"-cx"]===n&&l[u+"-cy"]===a)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=n,l[u+"-cy"]=a;var c=i/2,d=s/2;o="auto"===o?iu(i,s):o;for(var f=new Array(e.length/2),h=0;h<e.length/2;h++)f[h]={x:n+c*e[2*h],y:a+d*e[2*h+1]};var v,b,p,g,x=f.length;for(b=f[x-1],v=0;v<x;v++)l[u][v]=Ko(b,p=f[v%x],g=f[(v+1)%x],o),b=p,p=g;return l[u]},draw:function(n,a,i,s,o,l,u){this.renderer.nodeShapeImpl("round-polygon",n,a,i,s,o,this.points,this.getOrCreateCorners(a,i,s,o,l,u,"drawCorners"))},intersectLine:function(n,a,i,s,o,l,u,c,d){return function(e,t,n,a,i,s,o,l,u){var d,c=[],f=new Array(2*n.length);u.forEach(function(x,C){0===C?(f[f.length-2]=x.startX,f[f.length-1]=x.startY):(f[4*C-2]=x.startX,f[4*C-1]=x.startY),f[4*C]=x.stopX,f[4*C+1]=x.stopY,0!==(d=pa(e,t,a,i,x.cx,x.cy,x.radius)).length&&c.push(d[0],d[1])});for(var h=0;h<f.length/4;h++)0!==(d=en(e,t,a,i,f[4*h],f[4*h+1],f[4*h+2],f[4*h+3],!1)).length&&c.push(d[0],d[1]);if(c.length>2){for(var v=[c[0],c[1]],b=Math.pow(v[0]-e,2)+Math.pow(v[1]-t,2),p=1;p<c.length/2;p++){var g=Math.pow(c[2*p]-e,2)+Math.pow(c[2*p+1]-t,2);g<=b&&(v[0]=c[2*p],v[1]=c[2*p+1],b=g)}return v}return c}(o,l,this.points,n,a,0,0,0,this.getOrCreateCorners(n,a,i,s,c,d,"corners"))},checkPoint:function(n,a,i,s,o,l,u,c,d){return function(e,t,n,a,i,s,o,l){for(var u=new Array(2*n.length),c=0;c<l.length;c++){var d=l[c];if(u[4*c+0]=d.startX,u[4*c+1]=d.startY,u[4*c+2]=d.stopX,u[4*c+3]=d.stopY,Math.pow(d.cx-e,2)+Math.pow(d.cy-t,2)<=Math.pow(d.radius,2))return!0}return mr(e,t,u)}(n,a,this.points,0,0,0,0,this.getOrCreateCorners(l,u,s,o,c,d,"corners"))}}},generateRoundRectangle:function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:pr(4,0),draw:function(e,t,n,a,i,s){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,s)},intersectLine:function(e,t,n,a,i,s,o,l){return nu(i,s,e,t,n,a,o,l)},checkPoint:function(e,t,n,a,i,s,o,l){var u=a/2,c=i/2;l="auto"===l?tn(a,i):l;var d=2*(l=Math.min(u,c,l));return!!(Xr(e,t,this.points,s,o,a,i-d,[0,-1],n)||Xr(e,t,this.points,s,o,a-d,i,[0,-1],n)||wn(e,t,d,d,s-u+l,o-c+l,n)||wn(e,t,d,d,s+u-l,o-c+l,n)||wn(e,t,d,d,s+u-l,o+c-l,n)||wn(e,t,d,d,s-u+l,o+c-l,n))}}},generateCutRectangle:function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:pr(4,0),draw:function(e,t,n,a,i,s){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,null,s)},generateCutTrianglePts:function(e,t,n,a,i){var s="auto"===i?this.cornerLength:i,o=t/2,l=e/2,u=n-l,c=n+l,d=a-o,f=a+o;return{topLeft:[u,d+s,u+s,d,u+s,d+s],topRight:[c-s,d,c,d+s,c-s,d+s],bottomRight:[c,f-s,c-s,f,c-s,f-s],bottomLeft:[u+s,f,u,f-s,u+s,f-s]}},intersectLine:function(e,t,n,a,i,s,o,l){var u=this.generateCutTrianglePts(n+2*o,a+2*o,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 ya(i,s,c,e,t)},checkPoint:function(e,t,n,a,i,s,o,l){var u="auto"===l?this.cornerLength:l;if(Xr(e,t,this.points,s,o,a,i-2*u,[0,-1],n)||Xr(e,t,this.points,s,o,a-2*u,i,[0,-1],n))return!0;var c=this.generateCutTrianglePts(a,i,s,o);return mr(e,t,c.topLeft)||mr(e,t,c.topRight)||mr(e,t,c.bottomRight)||mr(e,t,c.bottomLeft)}}},generateBarrel:function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:pr(4,0),draw:function(e,t,n,a,i,s){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i)},intersectLine:function(e,t,n,a,i,s,o,l){var f=this.generateBarrelBezierPts(n+2*o,a+2*o,e,t),h=function(p){var g=kn({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},.15),x=kn({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},.5),C=kn({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},.85);return[p[0],p[1],g.x,g.y,x.x,x.y,C.x,C.y,p[4],p[5]]},v=[].concat(h(f.topLeft),h(f.topRight),h(f.bottomRight),h(f.bottomLeft));return ya(i,s,v,e,t)},generateBarrelBezierPts:function(e,t,n,a){var i=t/2,s=e/2,o=n-s,l=n+s,u=a-i,c=a+i,d=Ts(e,t),f=d.heightOffset,h=d.widthOffset,v=d.ctrlPtOffsetPct*e,b={topLeft:[o,u+f,o+v,u,o+h,u],topRight:[l-h,u,l-v,u,l,u+f],bottomRight:[l,c-f,l-v,c,l-h,c],bottomLeft:[o+h,c,o+v,c,o,c-f]};return b.topLeft.isTop=!0,b.topRight.isTop=!0,b.bottomLeft.isBottom=!0,b.bottomRight.isBottom=!0,b},checkPoint:function(e,t,n,a,i,s,o,l){var u=Ts(a,i),d=u.widthOffset;if(Xr(e,t,this.points,s,o,a,i-2*u.heightOffset,[0,-1],n)||Xr(e,t,this.points,s,o,a-2*d,i,[0,-1],n))return!0;for(var f=this.generateBarrelBezierPts(a,i,s,o),h=function(j,$,J){var K=J[4],Q=J[2],ee=J[0],ue=J[5],fe=J[1],ve=Math.min(K,ee),ce=Math.max(K,ee),pe=Math.min(ue,fe),Se=Math.max(ue,fe);if(ve<=j&&j<=ce&&pe<=$&&$<=Se){var Ie=function(e,t,n){return[e-2*t+n,2*(t-e),e]}(K,Q,ee),me=function(e,t,n,a){var i=t*t-4*e*(n-=a);if(i<0)return[];var s=Math.sqrt(i),o=2*e;return[(-t+s)/o,(-t-s)/o]}(Ie[0],Ie[1],Ie[2],j),De=me.filter(function(Ue){return 0<=Ue&&Ue<=1});if(De.length>0)return De[0]}return null},v=Object.keys(f),b=0;b<v.length;b++){var g=f[v[b]],x=h(e,t,g);if(null!=x){var H=tr(g[5],g[3],g[1],x);if(g.isTop&&H<=t||g.isBottom&&t<=H)return!0}}return!1}}},generateBottomRoundrectangle:function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:pr(4,0),draw:function(e,t,n,a,i,s){this.renderer.nodeShapeImpl(this.name,e,t,n,a,i,this.points,s)},intersectLine:function(e,t,n,a,i,s,o,l){var c=t-(a/2+o),h=en(i,s,e,t,e-(n/2+o),c,e+(n/2+o),c,!1);return h.length>0?h:nu(i,s,e,t,n,a,o,l)},checkPoint:function(e,t,n,a,i,s,o,l){var u=2*(l="auto"===l?tn(a,i):l);if(Xr(e,t,this.points,s,o,a,i-u,[0,-1],n)||Xr(e,t,this.points,s,o,a-u,i,[0,-1],n))return!0;var c=a/2+2*n,d=i/2+2*n;return!!(mr(e,t,[s-c,o-d,s-c,o,s+c,o,s+c,o-d])||wn(e,t,u,u,s+a/2-l,o+i/2-l,n)||wn(e,t,u,u,s-a/2+l,o+i/2-l,n))}}},registerNodeShapes:function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",pr(3,0)),this.generateRoundPolygon("round-triangle",pr(3,0)),this.generatePolygon("rectangle",pr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t),this.generatePolygon("pentagon",pr(5,0)),this.generateRoundPolygon("round-pentagon",pr(5,0)),this.generatePolygon("hexagon",pr(6,0)),this.generateRoundPolygon("round-hexagon",pr(6,0)),this.generatePolygon("heptagon",pr(7,0)),this.generateRoundPolygon("round-heptagon",pr(7,0)),this.generatePolygon("octagon",pr(8,0)),this.generateRoundPolygon("round-octagon",pr(8,0));var n=new Array(20),a=ws(5,0),i=ws(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[2*o]*=s,i[2*o+1]*=s;for(o=0;o<5;o++)n[4*o]=a[2*o],n[4*o+1]=a[2*o+1],n[4*o+2]=i[2*o],n[4*o+3]=i[2*o+1];n=au(n),this.generatePolygon("star",n),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 l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),r.makePolygon=function(u){var f,d="polygon-"+u.join("$");return(f=this[d])?f:e.generatePolygon(d,u)}}},Ma={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(r){r=r||$l();var e=this;void 0===e.averageRedrawTime&&(e.averageRedrawTime=0),void 0===e.lastRedrawTime&&(e.lastRedrawTime=0),void 0===e.lastDrawTime&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r},beforeRender:function(r,e){if(!this.destroyed){null==e&&jt("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(n,a){return a.priority-n.priority})}}},Yd=function(e,t,n){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(t,n)};Ma.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function(a){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){Yd(r,!0,a);var i=Ur();r.render(r.renderOptions);var s=r.lastDrawTime=Ur();void 0===r.averageRedrawTime&&(r.averageRedrawTime=s-i),void 0===r.redrawCount&&(r.redrawCount=0),r.redrawCount++,void 0===r.redrawTotalTime&&(r.redrawTotalTime=0);var o=s-i;r.redrawTotalTime+=o,r.lastRedrawTime=o,r.averageRedrawTime=r.averageRedrawTime/2+o/2,r.requestedFrame=!1}else Yd(r,!1,a);r.skipFrame=!1,Wa(t)}};Wa(t)}};var $d=function(e){this.init(e)},ea=$d.prototype;ea.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],ea.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),n=e.cy.window();if(n){var a=n.document,i=a.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",l=null!=a.getElementById(s);if(t.className.indexOf(o)<0&&(t.className=(t.className||"")+" "+o),!l){var u=a.createElement("style");u.id=s,u.textContent="."+o+" { position: relative; }",i.insertBefore(u,i.children[0])}"static"===n.getComputedStyle(t).getPropertyValue("position")&&Bt("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.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]},e.redraws=0,e.showFps=r.showFps,e.debug=r.debug,e.webgl=r.webgl,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=Be(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()},ea.notify=function(r,e){var t=this,n=t.cy;if(!this.destroyed){if("init"===r)return void t.load();if("destroy"===r)return void t.destroy();("add"===r||"remove"===r||"move"===r&&n.hasCompoundNodes()||"load"===r||"zorder"===r||"mount"===r)&&t.invalidateCachedZSortedEles(),"viewport"===r&&t.redrawHint("select",!0),"gc"===r&&t.redrawHint("gc",!0),("load"===r||"resize"===r||"mount"===r)&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},ea.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var t=r.bindings[e],a=t.target;(a.off||a.removeEventListener).apply(a,t.args)}if(r.bindings=[],r.beforeRenderCallbacks=[],r.onUpdateEleCalcsFns=[],r.removeObserver&&r.removeObserver.disconnect(),r.styleObserver&&r.styleObserver.disconnect(),r.resizeObserver&&r.resizeObserver.disconnect(),r.labelCalcDiv)try{document.body.removeChild(r.labelCalcDiv)}catch{}},ea.isHeadless=function(){return!1},[Xo,jd,Xd,Qn,Yr,Ma].forEach(function(r){mt(ea,r)});var Jo=1e3/60,qd_setupDequeueing=function(e){return function(){var n=this,a=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var i=ca(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold);a.beforeRender(function(u,c){var d=Ur(),f=a.averageRedrawTime,h=a.lastRedrawTime,v=[],b=a.cy.extent(),p=a.getPixelRatio();for(u||a.flushRenderedStyleQueue();;){var g=Ur(),x=g-d,C=g-c;if(h<Jo){if(C>=e.deqFastCost*(Jo-(u?f:0)))break}else if(u){if(x>=e.deqCost*h||x>=e.deqAvgCost*f)break}else if(C>=e.deqNoDrawCost*Jo)break;var z=e.deq(n,p,b);if(!(z.length>0))break;for(var H=0;H<z.length;H++)v.push(z[H])}v.length>0&&(e.onDeqd(n,v),!u&&e.shouldRedraw(n,v,p,b)&&i())},(e.priority||fs)(n))}}},Fy=function(){return se(function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$a;B(this,r),this.idsByKey=new jr,this.keyForId=new jr,this.cachesByLvl=new jr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t},[{key:"getIdsFor",value:function(t){null==t&&jt("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(t);return a||(a=new _n,n.set(t,a)),a}},{key:"addIdForKey",value:function(t,n){null!=t&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){null!=t&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return null==t?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n),i=this.getKey(t);this.deleteIdForKey(a,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteIdForKey(a,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id();return this.keyForId.get(n)!==this.getKey(t)}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,a=this.lvls,i=n.get(t);return i||(i=new jr,n.set(t,i),a.push(t)),i}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var a=this.getKey(t),i=this.getCache(a,n);return null!=i&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,n){var a=this.keyForId.get(t.id());return this.getCache(a,n)}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var a=this.getKey(t);return this.hasCache(a,n)}},{key:"setCache",value:function(t,n,a){a.key=t,this.getCachesAt(n).set(t,a)}},{key:"set",value:function(t,n,a){var i=this.getKey(t);this.setCache(i,n,a),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var a=this.getKey(t);this.deleteCache(a,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(a){return n.deleteCache(t,a)})}},{key:"invalidate",value:function(t){var n=t.id(),a=this.keyForId.get(n);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(a),i||0===this.getNumberOfIdsForKey(a)}}])}(),ta={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Jy=ir({getKey:null,doesEleInvalidateKey:$a,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:jl,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Oa=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var a=Jy(t);mt(n,a),n.lookup=new Fy(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},Qt=Oa.prototype;Qt.reasons=ta,Qt.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]},Qt.getRetiredTextureQueue=function(r){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[r]=t[r]||[]},Qt.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new va(function(t,n){return n.reqs-t.reqs})},Qt.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Qt.getElement=function(r,e,t,n,a){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||0===e.w||0===e.h||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(null==n&&(n=Math.ceil(ys(o*t))),n<-4)n=-4;else if(o>=7.99||n>3)return null;var u=Math.pow(2,n),c=e.h*u,d=e.w*u,f=s.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,f))return null;var v,h=l.get(r,n);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;if(v=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var b=i.getTextureQueue(v),p=b[b.length-2],g=function(){return i.recycleTexture(v,d)||i.addTexture(v,d)};p||(p=b[b.length-1]),p||(p=g()),p.width-p.usedWidth<d&&(p=g());for(var H,x=function(ve){return ve&&ve.scaledLabelShown===f},C=a&&a===ta.dequeue,A=a&&a===ta.highQuality,z=a&&a===ta.downscale,F=n+1;F<=3;F++){var j=l.get(r,F);if(j){H=j;break}}var $=H&&H.level===n+1?H:null,J=function(){p.context.drawImage($.texture.canvas,$.x,0,$.width,$.height,p.usedWidth,0,d,c)};if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,d,v),x($))J();else if(x(H)){if(!A)return i.queueElement(r,H.level-1),H;for(var K=H.level;K>n;K--)$=i.getElement(r,e,t,K,ta.downscale);J()}else{var Q;if(!C&&!A&&!z)for(var ee=n-1;ee>=-4;ee--){var ue=l.get(r,ee);if(ue){Q=ue;break}}if(x(Q))return i.queueElement(r,n),Q;p.context.translate(p.usedWidth,0),p.context.scale(u,u),this.drawElement(p.context,r,e,f,!1),p.context.scale(1/u,1/u),p.context.translate(-p.usedWidth,0)}return h={x:p.usedWidth,texture:p,level:n,scale:u,width:d,height:c,scaledLabelShown:f},p.usedWidth+=Math.ceil(d+8),p.eleCaches.push(h),l.set(r,n,h),i.checkTextureFullness(p),h},Qt.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])},Qt.invalidateElement=function(r){var e=this,t=e.lookup,n=[];if(t.isInvalid(r)){for(var i=-4;i<=3;i++){var s=t.getForCachedKey(r,i);s&&n.push(s)}if(t.invalidate(r))for(var l=0;l<n.length;l++){var u=n[l],c=u.texture;c.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(c)}e.removeFromQueue(r)}},Qt.checkTextureUtility=function(r){r.invalidatedWidth>=.2*r.width&&this.retireTexture(r)},Qt.checkTextureFullness=function(r){var t=this.getTextureQueue(r.height);r.usedWidth/r.width>.8&&r.fullnessChecks>=10?Jr(t,r):r.fullnessChecks++},Qt.retireTexture=function(r){var t=r.height,n=this.getTextureQueue(t),a=this.lookup;Jr(n,r),r.retired=!0;for(var i=r.eleCaches,s=0;s<i.length;s++){var o=i[s];a.deleteCache(o.key,o.level)}hs(i),this.getRetiredTextureQueue(t).push(r)},Qt.addTexture=function(r,e){var a={};return this.getTextureQueue(r).push(a),a.eleCaches=[],a.height=r,a.width=Math.max(1024,e),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=this.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a},Qt.recycleTexture=function(r,e){for(var n=this.getTextureQueue(r),a=this.getRetiredTextureQueue(r),i=0;i<a.length;i++){var s=a[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,hs(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),Jr(a,s),n.push(s),s}},Qt.queueElement=function(r,e){var n=this.getElementQueue(),a=this.getElementKeyToQueue(),i=this.getKey(r),s=a[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(r),s.reqs++,n.updateItem(s);else{var o={eles:r.spawn().merge(r),level:e,reqs:1,key:i};n.push(o),a[i]=o}},Qt.dequeue=function(r){for(var e=this,t=e.getElementQueue(),n=e.getElementKeyToQueue(),a=[],i=e.lookup,s=0;s<1&&t.size()>0;s++){var o=t.pop(),l=o.key,u=o.eles[0],c=i.hasCache(u,o.level);if(n[l]=null,!c){a.push(o);var d=e.getBoundingBox(u);e.getElement(u,d,r,o.level,ta.dequeue)}}return a},Qt.removeFromQueue=function(r){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),a=this.getKey(r),i=n[a];null!=i&&(1===i.eles.length?(i.reqs=ds,t.updateItem(i),t.pop(),n[a]=null):i.eles.unmerge(r))},Qt.onDequeue=function(r){this.onDequeues.push(r)},Qt.offDequeue=function(r){Jr(this.onDequeues,r)},Qt.setupDequeueing=qd_setupDequeueing({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,a){for(var i=0;i<t.length;i++)for(var s=t[i].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(bs(l,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var ef=function(e){var t=this,n=t.renderer=e,a=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Ur()-500,t.skipping=!1,t.eleTxrDeqs=a.collection(),t.scheduleElementRefinement=ca(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),n.beforeRender(function(s,o){t.skipping=o-t.lastInvalidationTime<=250},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new va(function(o,l){return l.reqs-o.reqs}),t.setupDequeueing()},lr=ef.prototype,tf=0,cm=Math.pow(2,53)-1;lr.makeLayer=function(r,e){var t=Math.pow(2,e),n=Math.ceil(r.w*t),a=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(n,a),s={id:tf=++tf%cm,bb:r,level:e,width:n,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(t,t),o.translate(l,u),s},lr.getLayers=function(r,e,t){var n=this,s=n.renderer.cy.zoom(),o=n.firstGet;if(n.firstGet=!1,null==t)if((t=Math.ceil(ys(s*e)))<-4)t=-4;else if(s>=3.99||t>2)return null;n.validateLayersElesOrdering(t,r);var d,h,l=n.layersByLevel,u=Math.pow(2,t),c=l[t]=l[t]||[];if(n.levelIsComplete(t,r))return c;!function(){var J=function(fe){if(n.validateLayersElesOrdering(fe,r),n.levelIsComplete(fe,r))return h=l[fe],!0},K=function(fe){if(!h)for(var ve=t+fe;-4<=ve&&ve<=2&&!J(ve);ve+=fe);};K(1),K(-1);for(var Q=c.length-1;Q>=0;Q--){var ee=c[Q];ee.invalid&&Jr(c,ee)}}();var p=function(J){var K=(J=J||{}).after;!function(){if(!d){d=gr();for(var J=0;J<r.length;J++)av(d,r[J].boundingBox())}}();var Q=Math.ceil(d.w*u),ee=Math.ceil(d.h*u);if(Q>32767||ee>32767)return null;if(Q*ee>16e6)return null;var fe=n.makeLayer(d,t);if(null!=K){var ve=c.indexOf(K)+1;c.splice(ve,0,fe)}else(void 0===J.insert||J.insert)&&c.unshift(fe);return fe};if(n.skipping&&!o)return null;for(var g=null,x=r.length/1,C=!o,A=0;A<r.length;A++){var z=r[A],H=z._private.rscratch,F=H.imgLayerCaches=H.imgLayerCaches||{},j=F[t];if(j)g=j;else{if((!g||g.eles.length>=x||!ru(g.bb,z.boundingBox()))&&!(g=p({insert:!0,after:g})))return null;h||C?n.queueLayer(g,z):n.drawEleInLayer(g,z,t,e),g.eles.push(z),F[t]=g}}return h||(C?null:c)},lr.getEleLevelForLayerLevel=function(r,e){return r},lr.drawEleInLayer=function(r,e,t,n){var i=this.renderer,s=r.context,o=e.boundingBox();0===o.w||0===o.h||!e.visible()||(t=this.getEleLevelForLayerLevel(t,n),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,t,!0),i.setImgSmoothing(s,!0))},lr.levelIsComplete=function(r,e){var n=this.layersByLevel[r];if(!n||0===n.length)return!1;for(var a=0,i=0;i<n.length;i++){var s=n[i];if(s.reqs>0||s.invalid)return!1;a+=s.eles.length}return a===e.length},lr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var n=0;n<t.length;n++){for(var a=t[n],i=-1,s=0;s<e.length;s++)if(a.eles[0]===e[s]){i=s;break}if(i<0)this.invalidateLayer(a);else{var o=i;for(s=0;s<a.eles.length;s++)if(a.eles[s]!==e[o+s]){this.invalidateLayer(a);break}}}},lr.updateElementsInLayers=function(r,e){for(var n=At(r[0]),a=0;a<r.length;a++)for(var i=n?null:r[a],s=n?r[a]:r[a].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=-4;u<=2;u++){var c=l[u];c&&(i&&this.getEleLevelForLayerLevel(c.level)!==i.level||e(c,s,i))}},lr.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},lr.invalidateElements=function(r){var e=this;0!==r.length&&(e.lastInvalidationTime=Ur(),0!==r.length&&e.haveLayers()&&e.updateElementsInLayers(r,function(n,a,i){e.invalidateLayer(n)}))},lr.invalidateLayer=function(r){if(this.lastInvalidationTime=Ur(),!r.invalid){var e=r.level,t=r.eles;Jr(this.layersByLevel[e],r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var a=0;a<t.length;a++){var i=t[a]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}},lr.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(n,a,i){var s=n.replacement;if(s||((s=n.replacement=e.makeLayer(n.bb,n.level)).replaces=n,s.eles=n.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})},lr.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()},lr.queueLayer=function(r,e){var n=this.layersQueue,a=r.elesQueue,i=a.hasId=a.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;a.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,n.updateItem(r)):(r.reqs=1,n.push(r))}},lr.dequeue=function(r){for(var e=this,t=e.layersQueue,n=[],a=0;a<1&&0!==t.size();){var i=t.peek();if(i.replacement)t.pop();else if(i.replaces&&i!==i.replaces.replacement)t.pop();else if(i.invalid)t.pop();else{var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,r),a++),0===n.length&&n.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}}return n},lr.applyLayerReplacement=function(r){var t=this.layersByLevel[r.level],n=r.replaces,a=t.indexOf(n);if(!(a<0||n.invalid)){t[a]=r;for(var i=0;i<r.eles.length;i++){var s=r.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[r.level]=r)}this.requestRedraw()}},lr.requestRedraw=ca(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100),lr.setupDequeueing=qd_setupDequeueing({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:fs,shouldRedraw:jl,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var nf,rf={};function dm(r,e){for(var t=0;t<e.length;t++){var n=e[t];r.lineTo(n.x,n.y)}}function fm(r,e,t){for(var n,a=0;a<e.length;a++){var i=e[a];0===a&&(n=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,n.x,n.y)}function af(r,e,t){r.beginPath&&r.beginPath();for(var n=e,a=0;a<n.length;a++)r.lineTo((i=n[a]).x,i.y);var s=t,o=t[0];for(r.moveTo(o.x,o.y),a=1;a<s.length;a++){var i;r.lineTo((i=s[a]).x,i.y)}r.closePath&&r.closePath()}function hm(r,e,t,n,a){r.beginPath&&r.beginPath(),r.arc(t,n,a,0,2*Math.PI,!1);var i=e,s=i[0];r.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var l=i[o];r.lineTo(l.x,l.y)}r.closePath&&r.closePath()}function vm(r,e,t,n){r.arc(e,t,n,0,2*Math.PI,!1)}rf.arrowShapeImpl=function(r){return(nf||(nf={polygon:dm,"triangle-backcurve":fm,"triangle-tee":af,"circle-triangle":hm,"triangle-cross":af,circle:vm}))[r]};var zr={drawElement:function(r,e,t,n,a,i){e.isNode()?this.drawNode(r,e,t,n,a,i):this.drawEdge(r,e,t,n,a,i)},drawElementOverlay:function(r,e){e.isNode()?this.drawNodeOverlay(r,e):this.drawEdgeOverlay(r,e)},drawElementUnderlay:function(r,e){e.isNode()?this.drawNodeUnderlay(r,e):this.drawEdgeUnderlay(r,e)},drawCachedElementPortion:function(r,e,t,n,a,i,s,o){var l=this,u=t.getBoundingBox(e);if(0!==u.w&&0!==u.h){var c=t.getElement(e,u,n,a,i);if(null!=c){var d=o(l,e);if(0===d)return;var g,x,C,A,z,j,f=s(l,e),h=u.x1,v=u.y1,b=u.w,p=u.h;if(0!==f){var H=t.getRotationPoint(e);r.translate(C=H.x,A=H.y),r.rotate(f),(z=l.getImgSmoothing(r))||l.setImgSmoothing(r,!0);var F=t.getRotationOffset(e);g=F.x,x=F.y}else g=h,x=v;1!==d&&(r.globalAlpha=(j=r.globalAlpha)*d),r.drawImage(c.texture.canvas,c.x,0,c.width,c.height,g,x,b,p),1!==d&&(r.globalAlpha=j),0!==f&&(r.rotate(-f),r.translate(-C,-A),z||l.setImgSmoothing(r,!1))}else t.drawElement(r,e)}}},gm=function(){return 0},pm=function(e,t){return e.getTextAngle(t,null)},ym=function(e,t){return e.getTextAngle(t,"source")},mm=function(e,t){return e.getTextAngle(t,"target")},bm=function(e,t){return t.effectiveOpacity()},el=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};zr.drawCachedElement=function(r,e,t,n,a,i){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,c=o.slbTxrCache,d=o.tlbTxrCache,f=e.boundingBox(),h=!0===i?l.reasons.highQuality:null;if(0!==f.w&&0!==f.h&&e.visible()&&(!n||bs(f,n))){var v=e.isEdge(),b=e.element()._private.rscratch.badLine;s.drawElementUnderlay(r,e),s.drawCachedElementPortion(r,e,l,t,a,h,gm,bm),(!v||!b)&&s.drawCachedElementPortion(r,e,u,t,a,h,pm,el),v&&!b&&(s.drawCachedElementPortion(r,e,c,t,a,h,ym,el),s.drawCachedElementPortion(r,e,d,t,a,h,mm,el)),s.drawElementOverlay(r,e)}},zr.drawElements=function(r,e){for(var n=0;n<e.length;n++)this.drawElement(r,e[n])},zr.drawCachedElements=function(r,e,t,n){for(var i=0;i<e.length;i++)this.drawCachedElement(r,e[i],t,n)},zr.drawCachedNodes=function(r,e,t,n){for(var i=0;i<e.length;i++){var s=e[i];s.isNode()&&this.drawCachedElement(r,s,t,n)}},zr.drawLayeredElements=function(r,e,t,n){var i=this.data.lyrTxrCache.getLayers(e,t);if(i)for(var s=0;s<i.length;s++){var o=i[s],l=o.bb;0===l.w||0===l.h||r.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else this.drawCachedElements(r,e,t,n)};var $r={drawEdge:function(r,e,t){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=this,o=e._private.rscratch;if((!i||e.visible())&&!o.badLine&&null!=o.allpts&&!isNaN(o.allpts[0])){var l;t&&r.translate(-(l=t).x1,-l.y1);var u=i?e.pstyle("opacity").value:1,c=i?e.pstyle("line-opacity").value:1,d=e.pstyle("curve-style").value,f=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,v=e.pstyle("line-cap").value,b=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,g=u*c,x=u*c,C=function(){var fe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;"straight-triangle"===d?(s.eleStrokeStyle(r,e,fe),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=h,r.lineCap=v,s.eleStrokeStyle(r,e,fe),s.drawEdgePath(e,r,o.allpts,f),r.lineCap="butt")},F=function(){s.drawArrowheads(r,e,arguments.length>0&&void 0!==arguments[0]?arguments[0]:x)};if(r.lineJoin="round","yes"===e.pstyle("ghost").value){var J=e.pstyle("ghost-offset-x").pfValue,K=e.pstyle("ghost-offset-y").pfValue,Q=e.pstyle("ghost-opacity").value,ee=g*Q;r.translate(J,K),C(ee),F(ee),r.translate(-J,-K)}else!function(){var fe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;r.lineWidth=h+b,r.lineCap=v,b>0?(s.colorStrokeStyle(r,p[0],p[1],p[2],fe),"straight-triangle"===d?s.drawEdgeTrianglePath(e,r,o.allpts):(s.drawEdgePath(e,r,o.allpts,f),r.lineCap="butt")):r.lineCap="butt"}();a&&s.drawEdgeUnderlay(r,e),C(),F(),a&&s.drawEdgeOverlay(r,e),s.drawElementText(r,e,null,n),t&&r.translate(l.x1,l.y1)}}},sf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var a=n.pstyle("".concat(e,"-opacity")).value;if(0!==a){var i=this,s=i.usePaths(),o=n._private.rscratch,u=2*n.pstyle("".concat(e,"-padding")).pfValue,c=n.pstyle("".concat(e,"-color")).value;t.lineWidth=u,t.lineCap="self"!==o.edgeType||s?"round":"butt",i.colorStrokeStyle(t,c[0],c[1],c[2],a),i.drawEdgePath(n,t,o.allpts,"solid")}}}};$r.drawEdgeOverlay=sf("overlay"),$r.drawEdgeUnderlay=sf("underlay"),$r.drawEdgePath=function(r,e,t,n){var s,a=r._private.rscratch,i=e,o=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,c=r.pstyle("line-dash-offset").pfValue;if(l){var d=t.join("$");a.pathCacheKey&&a.pathCacheKey===d?(s=e=a.pathCache,o=!0):(s=e=new Path2D,a.pathCacheKey=d,a.pathCache=s)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=c;break;case"solid":i.setLineDash([])}if(!o&&!a.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<t.length;h+=4)e.quadraticCurveTo(t[h],t[h+1],t[h+2],t[h+3]);break;case"straight":case"haystack":for(var v=2;v+1<t.length;v+=2)e.lineTo(t[v],t[v+1]);break;case"segments":if(a.isRound){var p,b=U(a.roundCorners);try{for(b.s();!(p=b.n()).done;)Bd(e,p.value)}catch(C){b.e(C)}finally{b.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var x=2;x+1<t.length;x+=2)e.lineTo(t[x],t[x+1])}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])},$r.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var n=r.pstyle("width").pfValue,a=0;a+1<t.length;a+=2){var i=[t[a+2]-t[a],t[a+3]-t[a+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],l=[o[0]*n/2,o[1]*n/2];e.beginPath(),e.moveTo(t[a]-l[0],t[a+1]-l[1]),e.lineTo(t[a]+l[0],t[a+1]+l[1]),e.lineTo(t[a+2],t[a+3]),e.closePath(),e.fill()}},$r.drawArrowheads=function(r,e,t){var n=e._private.rscratch,a="haystack"===n.edgeType;a||this.drawArrowhead(r,e,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,t),a||this.drawArrowhead(r,e,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,t)},$r.drawArrowhead=function(r,e,t,n,a,i,s){if(!(isNaN(n)||null==n||isNaN(a)||null==a||isNaN(i)||null==i)){var o=this,l=e.pstyle(t+"-arrow-shape").value;if("none"!==l){var u="hollow"===e.pstyle(t+"-arrow-fill").value?"both":"filled",c=e.pstyle(t+"-arrow-fill").value,d=e.pstyle("width").pfValue,f=e.pstyle(t+"-arrow-width"),h="match-line"===f.value?d:f.pfValue;"%"===f.units&&(h*=d);var v=e.pstyle("opacity").value;void 0===s&&(s=v);var b=r.globalCompositeOperation;(1!==s||"hollow"===c)&&(r.globalCompositeOperation="destination-out",o.colorFillStyle(r,255,255,255,1),o.colorStrokeStyle(r,255,255,255,1),o.drawArrowShape(e,r,u,d,l,h,n,a,i),r.globalCompositeOperation=b);var p=e.pstyle(t+"-arrow-color").value;o.colorFillStyle(r,p[0],p[1],p[2],s),o.colorStrokeStyle(r,p[0],p[1],p[2],s),o.drawArrowShape(e,r,c,d,l,h,n,a,i)}}},$r.drawArrowShape=function(r,e,t,n,a,i,s,o,l){var f,u=this,c=this.usePaths()&&"triangle-cross"!==a,d=!1,h=e,v={x:s,y:o},b=r.pstyle("arrow-scale").value,p=this.getArrowWidth(n,b),g=u.arrowShapes[a];if(c){var x=u.arrowPathCache=u.arrowPathCache||[],C=mn(a),A=x[C];null!=A?(f=e=A,d=!0):(f=e=new Path2D,x[C]=f)}d||(e.beginPath&&e.beginPath(),c?g.draw(e,1,0,{x:0,y:0},1):g.draw(e,p,l,v,n),e.closePath&&e.closePath()),e=h,c&&(e.translate(s,o),e.rotate(l),e.scale(p,p)),("filled"===t||"both"===t)&&(c?e.fill(f):e.fill()),("hollow"===t||"both"===t)&&(e.lineWidth=i/(c?p:1),e.lineJoin="miter",c?e.stroke(f):e.stroke()),c&&(e.scale(1/p,1/p),e.rotate(-l),e.translate(-s,-o))};var tl={safeDrawImage:function(r,e,t,n,a,i,s,o,l,u){if(!(a<=0||i<=0||l<=0||u<=0))try{r.drawImage(e,t,n,a,i,s,o,l,u)}catch(c){Bt(c)}},drawInscribedImage:function(r,e,t,n,a){var i=this,s=t.position(),o=s.x,l=s.y,u=t.cy().style(),c=u.getIndexedStyle.bind(u),d=c(t,"background-fit","value",n),f=c(t,"background-repeat","value",n),h=t.width(),v=t.height(),b=2*t.padding(),p=h+("inner"===c(t,"background-width-relative-to","value",n)?0:b),g=v+("inner"===c(t,"background-height-relative-to","value",n)?0:b),x=t._private.rscratch,A="node"===c(t,"background-clip","value",n),z=c(t,"background-image-opacity","value",n)*a,H=c(t,"background-image-smoothing","value",n),F=t.pstyle("corner-radius").value;"auto"!==F&&(F=t.pstyle("corner-radius").pfValue);var j=e.width||e.cachedW,$=e.height||e.cachedH;(null==j||null==$)&&(document.body.appendChild(e),j=e.cachedW=e.width||e.offsetWidth,$=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var J=j,K=$;if("auto"!==c(t,"background-width","value",n)&&(J="%"===c(t,"background-width","units",n)?c(t,"background-width","pfValue",n)*p:c(t,"background-width","pfValue",n)),"auto"!==c(t,"background-height","value",n)&&(K="%"===c(t,"background-height","units",n)?c(t,"background-height","pfValue",n)*g:c(t,"background-height","pfValue",n)),0!==J&&0!==K){if("contain"===d)J*=Q=Math.min(p/J,g/K),K*=Q;else if("cover"===d){var Q;J*=Q=Math.max(p/J,g/K),K*=Q}var ee=o-p/2,ue=c(t,"background-position-x","units",n),fe=c(t,"background-position-x","pfValue",n);ee+="%"===ue?(p-J)*fe:fe;var ve=c(t,"background-offset-x","units",n),ce=c(t,"background-offset-x","pfValue",n);ee+="%"===ve?(p-J)*ce:ce;var pe=l-g/2,Se=c(t,"background-position-y","units",n),Ie=c(t,"background-position-y","pfValue",n);pe+="%"===Se?(g-K)*Ie:Ie;var me=c(t,"background-offset-y","units",n),De=c(t,"background-offset-y","pfValue",n);pe+="%"===me?(g-K)*De:De,x.pathCache&&(ee-=o,pe-=l,o=0,l=0);var Ue=r.globalAlpha;r.globalAlpha=z;var qe=i.getImgSmoothing(r),je=!1;if("no"===H&&qe?(i.setImgSmoothing(r,!1),je=!0):"yes"===H&&!qe&&(i.setImgSmoothing(r,!0),je=!0),"no-repeat"===f)A&&(r.save(),x.pathCache?r.clip(x.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,o,l,p,g,F,x),r.clip())),i.safeDrawImage(r,e,0,0,j,$,ee,pe,J,K),A&&r.restore();else{var Je=r.createPattern(e,f);r.fillStyle=Je,i.nodeShapes[i.getNodeShape(t)].draw(r,o,l,p,g,F,x),r.translate(ee,pe),r.fill(),r.translate(-ee,-pe)}r.globalAlpha=Ue,je&&i.setImgSmoothing(r,qe)}}},Ln={};function of(r,e,t,n,a){var s=Math.min(arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,n/2,a/2);r.beginPath(),r.moveTo(e+s,t),r.lineTo(e+n-s,t),r.quadraticCurveTo(e+n,t,e+n,t+s),r.lineTo(e+n,t+a-s),r.quadraticCurveTo(e+n,t+a,e+n-s,t+a),r.lineTo(e+s,t+a),r.quadraticCurveTo(e,t+a,e,t+a-s),r.lineTo(e,t+s),r.quadraticCurveTo(e,t,e+s,t),r.closePath()}Ln.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),n=this.getPixelRatio(),a=Math.ceil(ys(t*n));e=Math.pow(2,a)}return!(r.pstyle("font-size").pfValue*e<r.pstyle("min-zoomed-font-size").pfValue)},Ln.drawElementText=function(r,e,t,n,a){var i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=this;if(null==n){if(i&&!s.eleTextBiggerThanMin(e))return}else if(!1===n)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e),u="glyph"===e.pstyle("text-metrics").strValue;r.textAlign=l,r.textBaseline=u?"alphabetic":"bottom"}else{var c=e.element()._private.rscratch.badLine,d=e.pstyle("label"),f=e.pstyle("source-label"),h=e.pstyle("target-label");if(c||(!d||!d.value)&&(!f||!f.value)&&(!h||!h.value))return;r.textAlign="center",r.textBaseline="bottom"}var b,v=!t;t&&r.translate(-(b=t).x1,-b.y1),null==a?(s.drawText(r,e,null,v,i),e.isEdge()&&(s.drawText(r,e,"source",v,i),s.drawText(r,e,"target",v,i))):s.drawText(r,e,a,v,i),t&&r.translate(b.x1,b.y1)},Ln.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if((e=this.fontCaches[t]).context===r)return e;return this.fontCaches.push(e={context:r}),e},Ln.setupTextStyle=function(r,e){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,c=e.pstyle("text-outline-color").value;r.font=n+" "+s+" "+a+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],o),this.colorStrokeStyle(r,c[0],c[1],c[2],l)},Ln.getTextAngle=function(r,e){var t,a=r._private.rscratch,s=r.pstyle((e?e+"-":"")+"text-rotation");if("autorotate"===s.strValue){var o=vr(a,"labelAngle",e);t=r.isEdge()?o:0}else t="none"===s.strValue?0:s.pfValue;return t},Ln.drawText=function(r,e,t){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=e._private.rscratch,o=a?e.effectiveOpacity():1;if(!a||0!==o&&0!==e.pstyle("text-opacity").value){"main"===t&&(t=null);var c,d,l=vr(s,"labelX",t),u=vr(s,"labelY",t),f=this.getLabelText(e,t);if(null!=f&&""!==f&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,a);var H,h=t?t+"-":"",v=vr(s,"labelWidth",t),b=vr(s,"labelHeight",t),p=vr(s,"labelActualDescent",t),g=e.pstyle(h+"text-margin-x").pfValue,x=e.pstyle(h+"text-margin-y").pfValue,C=e.isEdge(),A=e.pstyle("text-halign").value,z=e.pstyle("text-valign").value;C&&(A="center",z="center"),l+=g,u+=x,0!==(H=n?this.getTextAngle(e,t):0)&&(r.translate(c=l,d=u),r.rotate(H),l=0,u=0);var F=Xn(A),j=Wn(z);switch(j){case"top":break;case"center":u+=b/2;break;case"bottom":u+=b}var $=e.pstyle("text-background-opacity").value,J=e.pstyle("text-border-opacity").value,K=e.pstyle("text-border-width").pfValue,Q=e.pstyle("text-background-padding").pfValue,ee=e.pstyle("text-background-shape").strValue,ue="round-rectangle"===ee||"roundrectangle"===ee,fe="circle"===ee;if($>0||K>0&&J>0){var ce=r.fillStyle,pe=r.strokeStyle,Se=r.lineWidth,Ie=e.pstyle("text-background-color").value,me=e.pstyle("text-border-color").value,De=e.pstyle("text-border-style").value,Ue=$>0,qe=K>0&&J>0,je=l-Q;switch(F){case"left":je-=v;break;case"center":je-=v/2}var Je=u-b-Q,tt=v+2*Q,at=b+2*Q;if(Ue&&(r.fillStyle="rgba(".concat(Ie[0],",").concat(Ie[1],",").concat(Ie[2],",").concat($*o,")")),qe&&(r.strokeStyle="rgba(".concat(me[0],",").concat(me[1],",").concat(me[2],",").concat(J*o,")"),r.lineWidth=K,r.setLineDash))switch(De){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=K/4,r.setLineDash([]);break;default:r.setLineDash([])}if(ue?(r.beginPath(),of(r,je,Je,tt,at,2)):fe?(r.beginPath(),function xm(r,e,t,n,a){var s=Math.min(n,a)/2,o=e+n/2,l=t+a/2;r.beginPath(),r.arc(o,l,s,0,2*Math.PI),r.closePath()}(r,je,Je,tt,at)):(r.beginPath(),r.rect(je,Je,tt,at)),Ue&&r.fill(),qe&&r.stroke(),qe&&"double"===De){var He=K/2;r.beginPath(),ue?of(r,je+He,Je+He,tt-2*He,at-2*He,2):r.rect(je+He,Je+He,tt-2*He,at-2*He),r.stroke()}r.fillStyle=ce,r.strokeStyle=pe,r.lineWidth=Se,r.setLineDash&&r.setLineDash([])}var Ce=2*e.pstyle("text-outline-width").pfValue;if(Ce>0&&(r.lineWidth=Ce),u-=p,"wrap"===e.pstyle("text-wrap").value){var Ae=vr(s,"labelWrapCachedLines",t),_e=vr(s,"labelLineHeight",t),ze=v/2,rt=this.getLabelJustification(e);switch("auto"===rt||("left"===F?"left"===rt?l+=-v:"center"===rt&&(l+=-ze):"center"===F?"left"===rt?l+=-ze:"right"===rt&&(l+=ze):"right"===F&&("center"===rt?l+=ze:"right"===rt&&(l+=v))),j){case"top":case"center":case"bottom":u-=(Ae.length-1)*_e}for(var ct=0;ct<Ae.length;ct++)Ce>0&&r.strokeText(Ae[ct],l,u),r.fillText(Ae[ct],l,u),u+=_e}else Ce>0&&r.strokeText(f,l,u),r.fillText(f,l,u);0!==H&&(r.rotate(-H),r.translate(-c,-d))}}};var dn={drawNode:function(r,e,t){var o,l,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],s=this,u=e._private,c=u.rscratch,d=e.position();if(Be(d.x)&&Be(d.y)&&(!i||e.visible())){var v,g,f=i?e.effectiveOpacity():1,h=s.usePaths(),b=!1,p=e.padding();o=e.width()+2*p,l=e.height()+2*p,t&&r.translate(-(g=t).x1,-g.y1);for(var C=e.pstyle("background-image").value,A=new Array(C.length),z=new Array(C.length),H=0,F=0;F<C.length;F++){var j=C[F];if(A[F]=null!=j&&"none"!==j){var J=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",F);H++,z[F]=s.getCachedImage(j,J,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var K=e.pstyle("background-blacken").value,Q=e.pstyle("border-width").pfValue,ee=e.pstyle("background-opacity").value*f,ue=e.pstyle("border-color").value,fe=e.pstyle("border-style").value,ve=e.pstyle("border-join").value,ce=e.pstyle("border-cap").value,pe=e.pstyle("border-position").value,Se=e.pstyle("border-dash-pattern").pfValue,Ie=e.pstyle("border-dash-offset").pfValue,me=e.pstyle("border-opacity").value*f,De=e.pstyle("outline-width").pfValue,Ue=e.pstyle("outline-color").value,qe=e.pstyle("outline-style").value,je=e.pstyle("outline-opacity").value*f,Je=e.pstyle("outline-offset").value,tt=e.pstyle("corner-radius").value;"auto"!==tt&&(tt=e.pstyle("corner-radius").pfValue);var at=function(){s.eleFillStyle(r,e,arguments.length>0&&void 0!==arguments[0]?arguments[0]:ee)},He=function(){s.colorStrokeStyle(r,ue[0],ue[1],ue[2],arguments.length>0&&void 0!==arguments[0]?arguments[0]:me)},Ce=function(){s.colorStrokeStyle(r,Ue[0],Ue[1],Ue[2],arguments.length>0&&void 0!==arguments[0]?arguments[0]:je)},Ae=function(X,xe,Le,Fe){var st,Ve=s.nodePathCache=s.nodePathCache||[],dt=Hl("polygon"===Le?Le+","+Fe.join(","):Le,""+xe,""+X,""+tt),Ke=Ve[dt],lt=!1;return null!=Ke?(lt=!0,c.pathCache=st=Ke):(st=new Path2D,Ve[dt]=c.pathCache=st),{path:st,cacheHit:lt}},_e=e.pstyle("shape").strValue,ze=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(d.x,d.y);var rt=Ae(o,l,_e,ze);v=rt.path,b=rt.cacheHit}var ct=function(){if(!b){var X=d;h&&(X={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(v||r,X.x,X.y,o,l,tt,c)}h?r.fill(v):r.fill()},Nt=function(){for(var X=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,xe=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Le=u.backgrounding,Fe=0,Ve=0;Ve<z.length;Ve++){var dt=e.cy().style().getIndexedStyle(e,"background-image-containment","value",Ve);xe&&"over"===dt||!xe&&"inside"===dt?Fe++:A[Ve]&&z[Ve].complete&&!z[Ve].error&&(Fe++,s.drawInscribedImage(r,z[Ve],e,Ve,X))}u.backgrounding=Fe!==H,Le!==u.backgrounding&&e.updateStyle(!1)},Et=function(){var X=arguments.length>0&&void 0!==arguments[0]&&arguments[0],xe=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;s.hasPie(e)&&(s.drawPie(r,e,xe),X&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,d.x,d.y,o,l,tt,c)))},bt=function(){var X=arguments.length>0&&void 0!==arguments[0]&&arguments[0],xe=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;s.hasStripe(e)&&(r.save(),h?r.clip(c.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(r,d.x,d.y,o,l,tt,c),r.clip()),s.drawStripe(r,e,xe),r.restore(),X&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,d.x,d.y,o,l,tt,c)))},pt=function(){var Le=K>0?0:255;0!==K&&(s.colorFillStyle(r,Le,Le,Le,(K>0?K:-K)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:f)),h?r.fill(v):r.fill())},ot=function(){if(Q>0){if(r.lineWidth=Q,r.lineCap=ce,r.lineJoin=ve,r.setLineDash)switch(fe){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(Se),r.lineDashOffset=Ie;break;case"solid":case"double":r.setLineDash([])}if("center"!==pe){if(r.save(),r.lineWidth*=2,"inside"===pe)h?r.clip(v):r.clip();else{var X=new Path2D;X.rect(-o/2-Q,-l/2-Q,o+2*Q,l+2*Q),X.addPath(v),r.clip(X,"evenodd")}h?r.stroke(v):r.stroke(),r.restore()}else h?r.stroke(v):r.stroke();if("double"===fe){r.lineWidth=Q/3;var xe=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(v):r.stroke(),r.globalCompositeOperation=xe}r.setLineDash&&r.setLineDash([])}},gt=function(){if(De>0){if(r.lineWidth=De,r.lineCap="butt",r.setLineDash)switch(qe){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([])}var X=d;h&&(X={x:0,y:0});var xe=s.getNodeShape(e),Le=Q;"inside"===pe&&(Le=0),"outside"===pe&&(Le*=2);var lt,Fe=(o+Le+(De+Je))/o,Ve=(l+Le+(De+Je))/l,dt=o*Fe,Ke=l*Ve,st=s.nodeShapes[xe].points;if(h&&(lt=Ae(dt,Ke,xe,st).path),"ellipse"===xe)s.drawEllipsePath(lt||r,X.x,X.y,dt,Ke);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(xe)){var Ct=0,Dt=0,ft=0;"round-diamond"===xe?Ct=1.4*(Le+Je+De):"round-heptagon"===xe?(Ct=1.075*(Le+Je+De),ft=-(Le/2+Je+De)/35):"round-hexagon"===xe?Ct=1.12*(Le+Je+De):"round-pentagon"===xe?(Ct=1.13*(Le+Je+De),ft=-(Le/2+Je+De)/15):"round-tag"===xe?(Ct=1.12*(Le+Je+De),Dt=.07*(Le/2+De+Je)):"round-triangle"===xe&&(Ct=(Le+Je+De)*(Math.PI/2),ft=-(Le+Je/2+De)/Math.PI),0!==Ct&&(dt=o*(Fe=(o+Ct)/o),["round-hexagon","round-tag"].includes(xe)||(Ke=l*(Ve=(l+Ct)/l)));for(var Lt=dt/2,Mt=Ke/2,ar=(tt="auto"===tt?iu(dt,Ke):tt)+(Le+De+Je)/2,Yt=new Array(st.length/2),Nr=new Array(st.length/2),$t=0;$t<st.length/2;$t++)Yt[$t]={x:X.x+Dt+Lt*st[2*$t],y:X.y+ft+Mt*st[2*$t+1]};var Zt,er,ur,Hr,Xt=Yt.length;for(er=Yt[Xt-1],Zt=0;Zt<Xt;Zt++)Nr[Zt]=Ko(er,ur=Yt[Zt%Xt],Hr=Yt[(Zt+1)%Xt],ar),er=ur,ur=Hr;s.drawRoundPolygonPath(lt||r,X.x+Dt,X.y+ft,o*Fe,l*Ve,st,Nr)}else["roundrectangle","round-rectangle"].includes(xe)?(tt="auto"===tt?tn(dt,Ke):tt,s.drawRoundRectanglePath(lt||r,X.x,X.y,dt,Ke,tt+(Le+De+Je)/2)):["cutrectangle","cut-rectangle"].includes(xe)?s.drawCutRectanglePath(lt||r,X.x,X.y,dt,Ke,null,(tt="auto"===tt?8:tt)+(Le+De+Je)/4):["bottomroundrectangle","bottom-round-rectangle"].includes(xe)?(tt="auto"===tt?tn(dt,Ke):tt,s.drawBottomRoundRectanglePath(lt||r,X.x,X.y,dt,Ke,tt+(Le+De+Je)/2)):"barrel"===xe?s.drawBarrelPath(lt||r,X.x,X.y,dt,Ke):xe.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(xe)?(st=ti(ri(st,(Le+De+Je)/o)),s.drawPolygonPath(lt||r,X.x,X.y,o,l,st)):(st=ti(ri(st,-(Le+De+Je)/o)),s.drawPolygonPath(lt||r,X.x,X.y,o,l,st));if(h?r.stroke(lt):r.stroke(),"double"===qe){r.lineWidth=Le/3;var gn=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(lt):r.stroke(),r.globalCompositeOperation=gn}r.setLineDash&&r.setLineDash([])}};if("yes"===e.pstyle("ghost").value){var Rt=e.pstyle("ghost-offset-x").pfValue,Gt=e.pstyle("ghost-offset-y").pfValue,kt=e.pstyle("ghost-opacity").value,_t=kt*f;r.translate(Rt,Gt),Ce(),gt(),at(kt*ee),ct(),Nt(_t,!0),He(kt*me),ot(),Et(0!==K||0!==Q),bt(0!==K||0!==Q),Nt(_t,!1),pt(_t),r.translate(-Rt,-Gt)}h&&r.translate(-d.x,-d.y),a&&s.drawNodeUnderlay(r,e,d,o,l),h&&r.translate(d.x,d.y),Ce(),gt(),at(),ct(),Nt(f,!0),He(),ot(),Et(0!==K||0!==Q),bt(0!==K||0!==Q),Nt(f,!1),pt(),h&&r.translate(-d.x,-d.y),s.drawElementText(r,e,null,n),a&&s.drawNodeOverlay(r,e,d,o,l),t&&r.translate(g.x1,g.y1)}}},lf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,a,i,s){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(a=a||n.position(),null==i||null==s){var h=n.padding();i=n.width()+2*h,s=n.height()+2*h}this.colorFillStyle(t,c[0],c[1],c[2],u),this.nodeShapes[d].draw(t,a.x,a.y,i+2*l,s+2*l,f),t.fill()}}}};dn.drawNodeOverlay=lf("overlay"),dn.drawNodeUnderlay=lf("underlay"),dn.hasPie=function(r){return(r=r[0])._private.hasPie},dn.hasStripe=function(r){return(r=r[0])._private.hasStripe},dn.drawPie=function(r,e,t,n){e=e[0],n=n||e.position();var h,a=e.cy().style(),i=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,l=n.x,u=n.y,c=e.width(),d=e.height(),f=Math.min(c,d)/2,v=0;if(this.usePaths()&&(l=0,u=0),"%"===i.units?f*=i.pfValue:void 0!==i.pfValue&&(f=i.pfValue/2),"%"===s.units?h=f*s.pfValue:void 0!==s.pfValue&&(h=s.pfValue/2),!(h>=f))for(var p=1;p<=a.pieBackgroundN;p++){var g=e.pstyle("pie-"+p+"-background-size").value,x=e.pstyle("pie-"+p+"-background-color").value,C=e.pstyle("pie-"+p+"-background-opacity").value*t,A=g/100;A+v>1&&(A=1-v);var z=1.5*Math.PI+2*Math.PI*v,F=(z+=o)+2*Math.PI*A;0===g||v>=1||v+A>1||(0===h?(r.beginPath(),r.moveTo(l,u),r.arc(l,u,f,z,F),r.closePath()):(r.beginPath(),r.arc(l,u,f,z,F),r.arc(l,u,h,F,z,!0),r.closePath()),this.colorFillStyle(r,x[0],x[1],x[2],C),r.fill(),v+=A)}},dn.drawStripe=function(r,e,t,n){e=e[0],n=n||e.position();var a=e.cy().style(),i=n.x,s=n.y,o=e.width(),l=e.height(),u=0,c=this.usePaths();r.save();var d=e.pstyle("stripe-direction").value,f=e.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":r.rotate(-Math.PI/2)}var h=o,v=l;"%"===f.units?(h*=f.pfValue,v*=f.pfValue):void 0!==f.pfValue&&(h=f.pfValue,v=f.pfValue),c&&(i=0,s=0),s-=h/2,i-=v/2;for(var b=1;b<=a.stripeBackgroundN;b++){var p=e.pstyle("stripe-"+b+"-background-size").value,g=e.pstyle("stripe-"+b+"-background-color").value,x=e.pstyle("stripe-"+b+"-background-opacity").value*t,C=p/100;C+u>1&&(C=1-u),!(0===p||u>=1||u+C>1)&&(r.beginPath(),r.rect(i,s+v*u,h,v*C),r.closePath(),this.colorFillStyle(r,g[0],g[1],g[2],x),r.fill(),u+=C)}r.restore()};var Pa,yr={};function uf(r,e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(n));return n}function Tm(r,e,t){void 0===t&&(t=e);var n=r.makeOffscreenCanvas(e,t),a=n.context=n.getContext("2d");return n.clear=function(){return a.clearRect(0,0,n.width,n.height)},n.clear(),n}function rl(r){var e=r.pixelRatio,t=r.cy.zoom(),n=r.cy.pan();return{zoom:t*e,pan:{x:n.x*e,y:n.y*e}}}function Sm(r,e){return!!e.picking||"solid"===r.pstyle("background-fill").value&&"none"===r.pstyle("background-image").strValue&&(0===r.pstyle("border-width").value||0===r.pstyle("border-opacity").value||"solid"===r.pstyle("border-style").value)}function Im(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function An(r,e,t){var n=r[0]/255,a=r[1]/255,i=r[2]/255,s=e,o=t||new Array(4);return o[0]=n*s,o[1]=a*s,o[2]=i*s,o[3]=s,o}function ra(r,e){var t=e||new Array(4);return t[0]=(255&r)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function Lm(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function cf(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function df(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function Nm(r,e,t,n,a,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*n,a);case r.INT:return new Int32Array(t.buffer,i*n,a)}}function Vr(r,e,t,n){var i=he(cf(r,t),3),s=i[0],o=i[1],l=i[2],u=df(r,o,e*s),c=s*l,d=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,d),r.bufferData(r.ARRAY_BUFFER,e*c,r.DYNAMIC_DRAW),r.enableVertexAttribArray(n),o===r.FLOAT?r.vertexAttribPointer(n,s,o,!1,c,0):o===r.INT&&r.vertexAttribIPointer(n,s,o,c,0),r.vertexAttribDivisor(n,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var f=new Array(e),h=0;h<e;h++)f[h]=Nm(r,o,u,c,s,h);return d.dataArray=u,d.stride=c,d.size=s,d.getView=function(v){return f[v]},d.setPoint=function(v,b,p){var g=f[v];g[0]=b,g[1]=p},d.bufferSubData=function(v){r.bindBuffer(r.ARRAY_BUFFER,d),v?r.bufferSubData(r.ARRAY_BUFFER,0,u,0,v*s):r.bufferSubData(r.ARRAY_BUFFER,0,u)},d}yr.getPixelRatio=function(){var r=this.data.contexts[0];return null!=this.forcedPixelRatio?this.forcedPixelRatio:(this.cy.window().devicePixelRatio||1)/(r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1)},yr.paintCache=function(r){for(var n,e=this.paintCaches=this.paintCaches||[],t=!0,a=0;a<e.length;a++)if((n=e[a]).context===r){t=!1;break}return t&&e.push(n={context:r}),n},yr.createGradientStyleFor=function(r,e,t,n,a){var i,s=this.usePaths(),o=t.pstyle(e+"-gradient-stop-colors").value,l=t.pstyle(e+"-gradient-stop-positions").pfValue;if("radial-gradient"===n)if(t.isEdge()){var u=t.sourceEndpoint(),c=t.targetEndpoint(),d=t.midpoint(),f=bn(u,d),h=bn(c,d);i=r.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(f,h))}else{var v=s?{x:0,y:0}:t.position(),b=t.paddedWidth(),p=t.paddedHeight();i=r.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(b,p))}else if(t.isEdge()){var g=t.sourceEndpoint(),x=t.targetEndpoint();i=r.createLinearGradient(g.x,g.y,x.x,x.y)}else{var C=s?{x:0,y:0}:t.position(),H=t.paddedWidth()/2,F=t.paddedHeight()/2;switch(t.pstyle("background-gradient-direction").value){case"to-bottom":i=r.createLinearGradient(C.x,C.y-F,C.x,C.y+F);break;case"to-top":i=r.createLinearGradient(C.x,C.y+F,C.x,C.y-F);break;case"to-left":i=r.createLinearGradient(C.x+H,C.y,C.x-H,C.y);break;case"to-right":i=r.createLinearGradient(C.x-H,C.y,C.x+H,C.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(C.x-H,C.y-F,C.x+H,C.y+F);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(C.x-H,C.y+F,C.x+H,C.y-F);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(C.x+H,C.y-F,C.x-H,C.y+F);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(C.x+H,C.y+F,C.x-H,C.y-F)}}if(!i)return null;for(var $=l.length===o.length,J=o.length,K=0;K<J;K++)i.addColorStop($?l[K]:K/(J-1),"rgba("+o[K][0]+","+o[K][1]+","+o[K][2]+","+a+")");return i},yr.gradientFillStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"background",e,t,n);if(!a)return null;r.fillStyle=a},yr.colorFillStyle=function(r,e,t,n,a){r.fillStyle="rgba("+e+","+t+","+n+","+a+")"},yr.eleFillStyle=function(r,e,t){var n=e.pstyle("background-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientFillStyle(r,e,n,t);else{var a=e.pstyle("background-color").value;this.colorFillStyle(r,a[0],a[1],a[2],t)}},yr.gradientStrokeStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"line",e,t,n);if(!a)return null;r.strokeStyle=a},yr.colorStrokeStyle=function(r,e,t,n,a){r.strokeStyle="rgba("+e+","+t+","+n+","+a+")"},yr.eleStrokeStyle=function(r,e,t){var n=e.pstyle("line-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientStrokeStyle(r,e,n,t);else{var a=e.pstyle("line-color").value;this.colorStrokeStyle(r,a[0],a[1],a[2],t)}},yr.matchCanvasSize=function(r){var e=this,t=e.data,n=e.findContainerClientCoords(),a=n[2],i=n[3],s=e.getPixelRatio();(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=e.motionBlurPxRatio);var c,l=a*s,u=i*s;if(l!==e.canvasWidth||u!==e.canvasHeight){e.fontCaches=null;var d=t.canvasContainer;d.style.width=a+"px",d.style.height=i+"px";for(var f=0;f<e.CANVAS_LAYERS;f++)(c=t.canvases[f]).width=l,c.height=u,c.style.width=a+"px",c.style.height=i+"px";for(f=0;f<e.BUFFER_COUNT;f++)(c=t.bufferCanvases[f]).width=l,c.height=u,c.style.width=a+"px",c.style.height=i+"px";e.textureMult=1,s<=1&&(c=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,c.width=l*e.textureMult,c.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=s}},yr.renderTo=function(r,e,t,n){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:n})},yr.clearCanvas=function(){var r=this,e=r.data;function t(n){n.clearRect(0,0,r.canvasWidth,r.canvasHeight)}t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])},yr.render=function(r){var e=this;r=r||$l();var t=e.cy,n=r.forcedContext,a=r.drawAllLayers,i=r.drawOnlyNodeLayer,s=r.forcedZoom,o=r.forcedPan,l=void 0===r.forcedPxRatio?this.getPixelRatio():r.forcedPxRatio,u=e.data,c=u.canvasNeedsRedraw,d=e.textureOnViewport&&!n&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),f=void 0!==r.motionBlur?r.motionBlur:e.motionBlur,h=e.motionBlurPxRatio,v=t.hasCompoundNodes(),b=e.hoverData.draggingEles,g=f=f&&!n&&e.motionBlurEnabled&&!(e.hoverData.selecting||e.touchData.selecting);n||(e.prevPxRatio!==l&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=l),!n&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),f&&(null==e.mbFrames&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(g=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!d&&(c[e.NODE]=!0,c[e.SELECT_BOX]=!0);var x=t.style(),C=t.zoom(),A=void 0!==s?s:C,z=t.pan(),H={x:z.x,y:z.y},F={zoom:C,pan:{x:z.x,y:z.y}},j=e.prevViewport;!(void 0===j||F.zoom!==j.zoom||F.pan.x!==j.pan.x||F.pan.y!==j.pan.y)&&!(b&&!v)&&(e.motionBlurPxRatio=1),o&&(H=o),A*=l,H.x*=l,H.y*=l;var J=e.getCachedZSortedEles();function K(He,Ce,Ae,_e,ze){var rt=He.globalCompositeOperation;He.globalCompositeOperation="destination-out",e.colorFillStyle(He,255,255,255,e.motionBlurTransparency),He.fillRect(Ce,Ae,_e,ze),He.globalCompositeOperation=rt}function Q(He,Ce){var Ae,_e,ze,rt;e.clearingMotionBlur||He!==u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]&&He!==u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]?(Ae=H,_e=A,ze=e.canvasWidth,rt=e.canvasHeight):(Ae={x:z.x*h,y:z.y*h},_e=C*h,ze=e.canvasWidth*h,rt=e.canvasHeight*h),He.setTransform(1,0,0,1,0,0),"motionBlur"===Ce?K(He,0,0,ze,rt):!n&&(void 0===Ce||Ce)&&He.clearRect(0,0,ze,rt),a||(He.translate(Ae.x,Ae.y),He.scale(_e,_e)),o&&He.translate(o.x,o.y),s&&He.scale(s,s)}if(d||(e.textureDrawLastFrame=!1),d){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var ee=e.data.bufferContexts[e.TEXTURE_BUFFER];ee.setTransform(1,0,0,1,0,0),ee.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:ee,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult}),(F=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight}).mpan={x:(0-F.pan.x)/F.zoom,y:(0-F.pan.y)/F.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var fe=e.textureCache.texture;F=e.textureCache.viewport,(ue=u.contexts[e.NODE]).setTransform(1,0,0,1,0,0),f?K(ue,0,0,F.width,F.height):ue.clearRect(0,0,F.width,F.height);var ve=x.core("outside-texture-bg-color").value,ce=x.core("outside-texture-bg-opacity").value;e.colorFillStyle(ue,ve[0],ve[1],ve[2],ce),ue.fillRect(0,0,F.width,F.height),C=t.zoom(),Q(ue,!1),ue.clearRect(F.mpan.x,F.mpan.y,F.width/F.zoom/l,F.height/F.zoom/l),ue.drawImage(fe,F.mpan.x,F.mpan.y,F.width/F.zoom/l,F.height/F.zoom/l)}else e.textureOnViewport&&!n&&(e.textureCache=null);var ue,pe=t.extent(),Se=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),Ie=e.hideEdgesOnViewport&&Se,me=[];if(me[e.NODE]=!c[e.NODE]&&f&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,me[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),me[e.DRAG]=!c[e.DRAG]&&f&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,me[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||a||i||me[e.NODE]){var De=f&&!me[e.NODE]&&1!==h;Q(ue=n||(De?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),f&&!De?"motionBlur":void 0),Ie?e.drawCachedNodes(ue,J.nondrag,l,pe):e.drawLayeredElements(ue,J.nondrag,l,pe),e.debug&&e.drawDebugPoints(ue,J.nondrag),!a&&!f&&(c[e.NODE]=!1)}!i&&(c[e.DRAG]||a||me[e.DRAG])&&(De=f&&!me[e.DRAG]&&1!==h,Q(ue=n||(De?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]),f&&!De?"motionBlur":void 0),Ie?e.drawCachedNodes(ue,J.drag,l,pe):e.drawCachedElements(ue,J.drag,l,pe),e.debug&&e.drawDebugPoints(ue,J.drag),!a&&!f&&(c[e.DRAG]=!1));if(this.drawSelectionRectangle(r,Q),f&&1!==h){var Je=u.contexts[e.DRAG],tt=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],at=function(Ce,Ae,_e){Ce.setTransform(1,0,0,1,0,0),_e||!g?Ce.clearRect(0,0,e.canvasWidth,e.canvasHeight):K(Ce,0,0,e.canvasWidth,e.canvasHeight),Ce.drawImage(Ae,0,0,e.canvasWidth*h,e.canvasHeight*h,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||me[e.NODE])&&(at(u.contexts[e.NODE],e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],me[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||me[e.DRAG])&&(at(Je,tt,me[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=F,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),f&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!d,e.mbFrames=0,c[e.NODE]=!0,c[e.DRAG]=!0,e.redraw()},100)),n||t.emit("render")},yr.drawSelectionRectangle=function(r,e){var t=this,a=t.data,i=t.cy.style(),o=r.drawAllLayers,l=a.canvasNeedsRedraw;if(t.showFps||!r.drawOnlyNodeLayer&&l[t.SELECT_BOX]&&!o){var c=r.forcedContext||a.contexts[t.SELECT_BOX];if(e(c),1==t.selection[4]&&(t.hoverData.selecting||t.touchData.selecting)){var d=t.cy.zoom(),f=i.core("selection-box-border-width").value/d;c.lineWidth=f,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),f>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(a.bgActivePosistion&&!t.hoverData.selecting){d=t.cy.zoom();var h=a.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(h.x,h.y,i.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var v=t.lastRedrawTime;if(t.showFps&&v){v=Math.round(v);var b=Math.round(1e3/v),p="1 frame = "+v+" ms = "+b+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Pa){var g=c.measureText(p);Pa=g.actualBoundingBoxAscent}c.fillText(p,0,Pa),c.strokeRect(0,Pa+10,250,20),c.fillRect(0,Pa+10,250*Math.min(b/60,1),20)}o||(l[t.SELECT_BOX]=!1)}};var ff=typeof Float32Array<"u"?Float32Array:Array;function nl(){var r=new ff(9);return ff!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function hf(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Gi(r,e,t){var n=e[0],a=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],d=e[8],f=t[0],h=t[1];return r[0]=n,r[1]=a,r[2]=i,r[3]=s,r[4]=o,r[5]=l,r[6]=f*n+h*s+u,r[7]=f*a+h*o+c,r[8]=f*i+h*l+d,r}function vf(r,e,t){var n=e[0],a=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],d=e[8],f=Math.sin(t),h=Math.cos(t);return r[0]=h*n+f*s,r[1]=h*a+f*o,r[2]=h*i+f*l,r[3]=h*s-f*n,r[4]=h*o-f*a,r[5]=h*l-f*i,r[6]=u,r[7]=c,r[8]=d,r}function al(r,e,t){var n=t[0],a=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=a*e[3],r[4]=a*e[4],r[5]=a*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var km=function(){return se(function r(e,t,n,a){B(this,r),this.debugID=Math.floor(1e4*Math.random()),this.r=e,this.texSize=t,this.texRows=n,this.texHeight=Math.floor(t/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(e,t,t),this.scratch=a(e,t,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var n=t.w,a=t.h,s=this.texSize,o=this.texHeight/a,l=n*o,u=a*o;return l>s&&(l=n*(o=s/n),u=a*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(t,n,a){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,l=this.texHeight,u=this.getScale(n),c=u.scale,d=u.texW,f=u.texH,h=function(C,A){if(a&&A){var z=A.context,j=C.x,$=l*C.row;z.save(),z.translate(j,$),z.scale(c,c),a(z,n),z.restore()}},v=[null,null],b=function(){h(i.freePointer,i.canvas),v[0]={x:i.freePointer.x,y:i.freePointer.row*l,w:d,h:f},v[1]={x:i.freePointer.x+d,y:i.freePointer.row*l,w:0,h:f},i.freePointer.x+=d,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+d<=s)b();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(g(),b()):this.enableWrapping?function(){var C=i.scratch,A=i.canvas;C.clear(),h({x:0,row:0},C);var z=s-i.freePointer.x,H=d-z,F=l,j=i.freePointer.x,$=i.freePointer.row*l,J=z;A.context.drawImage(C,0,0,J,F,j,$,J,F),v[0]={x:j,y:$,w:J,h:f};var Q=(i.freePointer.row+1)*l,ee=H;A&&A.context.drawImage(C,z,0,ee,F,0,Q,ee,F),v[1]={x:0,y:Q,w:ee,h:f},i.freePointer.x=H,i.freePointer.row++}():(g(),b())}return this.keyToLocation.set(t,v),this.needsBuffer=!0,v}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(t){if(this.locked)return!1;var n=this.texSize,a=this.texRows,i=this.getScale(t);return!(this.freePointer.x+i.texW>n)||this.freePointer.row<a-1}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=function Am(r){var t=r.createTexture();return t.buffer=function(n){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}(t)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),Bm=function(){return se(function r(e,t,n,a){B(this,r),this.r=e,this.texSize=t,this.texRows=n,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set},[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){return new km(this.r,this.texSize,this.texRows,this.createTextureCanvas)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,n=this.texSize,i=this.createTextureCanvas,s=Math.floor(n/this.texRows);this.scratch=i(t,n,s,"scratch")}return this.scratch}},{key:"draw",value:function(t,n,a){var i=this.styleKeyToAtlas.get(t);return i||((!(i=this.atlases[this.atlases.length-1])||!i.canFit(n))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,n,a),this.styleKeyToAtlas.set(t,i)),i}},{key:"getAtlas",value:function(t){return this.styleKeyToAtlas.get(t)}},{key:"hasAtlas",value:function(t){return this.styleKeyToAtlas.has(t)}},{key:"markKeyForGC",value:function(t){this.markedKeys.add(t)}},{key:"gc",value:function(){var t=this,n=this.markedKeys;if(0!==n.size){var l,a=[],i=new Map,s=null,o=U(this.atlases);try{var u=function(){var d=l.value,f=d.getKeys(),h=function Fm(r,e){return r.intersection?r.intersection(e):new Set(re(r).filter(function(t){return e.has(t)}))}(n,f);if(0===h.size)return a.push(d),f.forEach(function(z){return i.set(z,d)}),1;s||(s=t._createAtlas(),a.push(s));var b,v=U(f);try{for(v.s();!(b=v.n()).done;){var p=b.value;if(!h.has(p)){var x=he(d.getOffsets(p),2),C=x[0];s.canFit({w:C.w+x[1].w,h:C.h})||(s.lock(),s=t._createAtlas(),a.push(s)),d.canvas&&(t._copyTextureToNewAtlas(p,d,s),i.set(p,s))}}}catch(z){v.e(z)}finally{v.f()}d.dispose()};for(o.s();!(l=o.n()).done;)u()}catch(c){o.e(c)}finally{o.f()}this.atlases=a,this.styleKeyToAtlas=i,this.markedKeys=new Set}else console.log("nothing to garbage collect")}},{key:"_copyTextureToNewAtlas",value:function(t,n,a){var s=he(n.getOffsets(t),2),o=s[0],l=s[1];if(0===l.w)a.draw(t,o,function(f){f.drawImage(n.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(n.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),u.context.drawImage(n.canvas,l.x,l.y,l.w,l.h,o.w,0,l.w,l.h);var c=o.w+l.w,d=o.h;a.draw(t,{w:c,h:d},function(f){f.drawImage(u,0,0,c,d,0,0,c,d)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}(),Gm=function(){return se(function r(e,t){B(this,r),this.r=e,this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map},[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,n){var a=this.globalOptions,i=a.webglTexSize,o=n.texRows,l=this._cacheScratchCanvas(a.createTextureCanvas),u=new Bm(this.r,i,o,l);this.collections.set(t,u)}},{key:"addRenderType",value:function(t,n){var a=n.collection;if(!this.collections.has(a))throw new Error("invalid atlas collection name '".concat(a,"'"));var i=this.collections.get(a),s=mt({type:t,atlasCollection:i},n);this.renderTypes.set(t,s)}},{key:"getRenderTypeOpts",value:function(t){return this.renderTypes.get(t)}},{key:"getAtlasCollection",value:function(t){return this.collections.get(t)}},{key:"_cacheScratchCanvas",value:function(t){var n=-1,a=-1,i=null;return function(s,o,l,u){return u?((!i||o!=n||l!=a)&&(n=o,a=l,i=t(s,o,l)),i):t(s,o,l)}}},{key:"_key",value:function(t,n){return"".concat(t,"-").concat(n)}},{key:"invalidate",value:function(t){var v,n=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.forceRedraw,s=void 0!==i&&i,o=a.filterEle,l=void 0===o?function(){return!0}:o,u=a.filterType,c=void 0===u?function(){return!0}:u,d=!1,f=!1,h=U(t);try{for(h.s();!(v=h.n()).done;){var b=v.value;if(l(b)){var g,p=U(this.renderTypes.values());try{var x=function(){var A=g.value,z=A.type;if(c(z)){var H=n.collections.get(A.collection),F=A.getKey(b),j=Array.isArray(F)?F:[F];if(s)j.forEach(function(Q){return H.markKeyForGC(Q)}),f=!0;else{var $=A.getID?A.getID(b):b.id(),J=n._key(z,$),K=n.typeAndIdToKey.get(J);void 0!==K&&!Im(j,K)&&(d=!0,n.typeAndIdToKey.delete(J),K.forEach(function(Q){return H.markKeyForGC(Q)}))}}};for(p.s();!(g=p.n()).done;)x()}catch(C){p.e(C)}finally{p.f()}}}}catch(C){h.e(C)}finally{h.f()}return f&&(this.gc(),d=!1),d}},{key:"gc",value:function(){var n,t=U(this.collections.values());try{for(t.s();!(n=t.n()).done;)n.value.gc()}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,n,a,i){var s=this.renderTypes.get(n),o=this.collections.get(s.collection),l=!1,u=o.draw(i,a,function(f){s.drawClipped?(f.save(),f.beginPath(),f.rect(0,0,a.w,a.h),f.clip(),s.drawElement(f,t,a,!0,!0),f.restore()):s.drawElement(f,t,a,!0,!0),l=!0});if(l){var c=s.getID?s.getID(t):t.id(),d=this._key(n,c);this.typeAndIdToKey.has(d)?this.typeAndIdToKey.get(d).push(i):this.typeAndIdToKey.set(d,[i])}return u}},{key:"getAtlasInfo",value:function(t,n){var a=this,i=this.renderTypes.get(n),s=i.getKey(t);return(Array.isArray(s)?s:[s]).map(function(l){var u=i.getBoundingBox(t,l),c=a.getOrCreateAtlas(t,n,u,l),f=he(c.getOffsets(l),2),h=f[0];return{atlas:c,tex:h,tex1:h,tex2:f[1],bb:u}})}},{key:"getDebugInfo",value:function(){var a,t=[],n=U(this.collections);try{for(n.s();!(a=n.n()).done;){var i=he(a.value,2),s=i[0],l=i[1].getCounts();t.push({type:s,keyCount:l.keyCount,atlasCount:l.atlasCount})}}catch(d){n.e(d)}finally{n.f()}return t}}])}(),zm=function(){return se(function r(e){B(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]},[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,n){return n})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(t){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(t)}},{key:"getAtlasIndexForBatch",value:function(t){var n=this.batchAtlases.indexOf(t);if(n<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),n=this.batchAtlases.length-1}return n}}])}(),ka={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Xm=function(){return se(function r(e,t,n){B(this,r),this.r=e,this.gl=t,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=Tm,this.atlasManager=new Gm(e,n),this.batchManager=new zm(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(ka.SCREEN),this.pickingProgram=this._createShaderProgram(ka.PICKING),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(t,n){this.atlasManager.addAtlasCollection(t,n)}},{key:"addTextureAtlasRenderType",value:function(t,n){this.atlasManager.addRenderType(t,n)}},{key:"addSimpleShapeRenderType",value:function(t,n){this.simpleShapeOptions.set(t,n)}},{key:"invalidate",value:function(t){var a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).type,i=this.atlasManager;return a?i.invalidate(t,{filterType:function(o){return o===a},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var n=this.gl,a="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),i=this.batchManager.getIndexArray(),o=function Em(r,e,t){var n=uf(r,r.VERTEX_SHADER,e),a=uf(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,n),r.attachShader(i,a),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}(n,a,"#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join("\n\t"),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x<q.y)? 1.570796327 : 0.0;\n for( int i=0; i<5; i++ ) {\n vec2 cs = vec2(cos(w),sin(w));\n vec2 u = ab*vec2( cs.x,cs.y);\n vec2 v = ab*vec2(-cs.y,cs.x);\n w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));\n }\n \n // compute final point and distance\n float d = length(p-ab*vec2(cos(w),sin(w)));\n \n // return signed distance\n return (dot(p/ab,p/ab)>1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join("\n\telse "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(t.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));o.aPosition=n.getAttribLocation(o,"aPosition"),o.aIndex=n.getAttribLocation(o,"aIndex"),o.aVertType=n.getAttribLocation(o,"aVertType"),o.aTransform=n.getAttribLocation(o,"aTransform"),o.aAtlasId=n.getAttribLocation(o,"aAtlasId"),o.aTex=n.getAttribLocation(o,"aTex"),o.aPointAPointB=n.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=n.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=n.getAttribLocation(o,"aLineWidth"),o.aColor=n.getAttribLocation(o,"aColor"),o.aCornerRadius=n.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=n.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=n.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=n.getUniformLocation(o,"uAtlasSize"),o.uBGColor=n.getUniformLocation(o,"uBGColor"),o.uZoom=n.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var l=0;l<this.batchManager.getMaxAtlasesPerBatch();l++)o.uTextures.push(n.getUniformLocation(o,"uTexture".concat(l)));return o}},{key:"_createVAO",value:function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var n=this.maxInstances,a=this.gl,i=this.program,s=a.createVertexArray();return a.bindVertexArray(s),function Rm(r,e,t,n){var i=he(cf(r,e),2),s=i[0],o=i[1],l=df(r,o,n),u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,l,r.STATIC_DRAW),o===r.FLOAT?r.vertexAttribPointer(t,s,o,!1,0,0):o===r.INT&&r.vertexAttribIPointer(t,s,o,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null)}(a,"vec2",i.aPosition,t),this.transformBuffer=function Mm(r,e,t){for(var a=new Float32Array(9*e),i=new Array(e),s=0;s<e;s++)i[s]=new Float32Array(a.buffer,9*s*4,9);var l=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,a.byteLength,r.DYNAMIC_DRAW);for(var u=0;u<3;u++){var c=t+u;r.enableVertexAttribArray(c),r.vertexAttribPointer(c,3,r.FLOAT,!1,36,12*u),r.vertexAttribDivisor(c,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),l.getMatrixView=function(d){return i[d]},l.setData=function(d,f){i[f].set(d,0)},l.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferSubData(r.ARRAY_BUFFER,0,a)},l}(a,n,i.aTransform),this.indexBuffer=Vr(a,n,"vec4",i.aIndex),this.vertTypeBuffer=Vr(a,n,"int",i.aVertType),this.atlasIdBuffer=Vr(a,n,"int",i.aAtlasId),this.texBuffer=Vr(a,n,"vec4",i.aTex),this.pointAPointBBuffer=Vr(a,n,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Vr(a,n,"vec4",i.aPointCPointD),this.lineWidthBuffer=Vr(a,n,"vec2",i.aLineWidth),this.colorBuffer=Vr(a,n,"vec4",i.aColor),this.cornerRadiusBuffer=Vr(a,n,"vec4",i.aCornerRadius),this.borderColorBuffer=Vr(a,n,"vec4",i.aBorderColor),a.bindVertexArray(null),s}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(n){return Kr(n,"Buffer")}).map(function(n){return t[n]})),this._buffers}},{key:"startFrame",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ka.SCREEN;this.panZoomMatrix=t,this.renderTarget=n,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,n){return!!t.visible()&&(!n||!n.isVisible||n.isVisible(t))}},{key:"drawTexture",value:function(t,n,a){var i=this.atlasManager,s=this.batchManager,o=i.getRenderTypeOpts(a);if(this._isVisible(t,o)&&(!t.isEdge()||this._isValidEdge(t))){if(this.renderTarget.picking&&o.getTexPickingMode){var l=o.getTexPickingMode(t);if(1===l)return;if(2==l)return void this.drawPickingRectangle(t,n,a)}var d,c=U(i.getAtlasInfo(t,a));try{for(c.s();!(d=c.n()).done;){var f=d.value,h=f.atlas,v=f.tex1,b=f.tex2;s.canAddToCurrentBatch(h)||this.endBatch();for(var p=s.getAtlasIndexForBatch(h),g=0,x=[[v,!0],[b,!1]];g<x.length;g++){var C=he(x[g],2),A=C[0],z=C[1];if(0!=A.w){var H=this.instanceCount;this.vertTypeBuffer.getView(H)[0]=0,ra(n,this.indexBuffer.getView(H)),this.atlasIdBuffer.getView(H)[0]=p;var $=this.texBuffer.getView(H);$[0]=A.x,$[1]=A.y,$[2]=A.w,$[3]=A.h;var J=this.transformBuffer.getMatrixView(H);this.setTransformMatrix(t,J,o,f,z),this.instanceCount++,z||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(K){c.e(K)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(t,n,a,i){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=0;if(a.shapeProps&&a.shapeProps.padding&&(o=t.pstyle(a.shapeProps.padding).pfValue),i){var u=i.tex1,d=u.w/(u.w+i.tex2.w);s||(d=1-d);var f=this._getAdjustedBB(i.bb,o,s,d);this._applyTransformMatrix(n,f,a,t)}else{var h=a.getBoundingBox(t),v=this._getAdjustedBB(h,o,!0,1);this._applyTransformMatrix(n,v,a,t)}}},{key:"_applyTransformMatrix",value:function(t,n,a,i){var s,o;hf(t);var l=a.getRotation?a.getRotation(i):0;if(0!==l){var u=a.getRotationPoint(i);Gi(t,t,[u.x,u.y]),vf(t,t,l);var f=a.getRotationOffset(i);s=f.x+(n.xOffset||0),o=f.y+(n.yOffset||0)}else s=n.x1,o=n.y1;Gi(t,t,[s,o]),al(t,t,[n.w,n.h])}},{key:"_getAdjustedBB",value:function(t,n,a,i){var s=t.x1,o=t.y1,l=t.w,u=t.h;n&&(s-=n,o-=n,l+=2*n,u+=2*n);var d=0,f=l*i;return a&&i<1?l=f:!a&&i<1&&(s+=d=l-f,l=f),{x1:s,y1:o,w:l,h:u,xOffset:d,yOffset:t.yOffset}}},{key:"drawPickingRectangle",value:function(t,n,a){var i=this.atlasManager.getRenderTypeOpts(a),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=4,ra(n,this.indexBuffer.getView(s)),An([0,0,0],1,this.colorBuffer.getView(s));var u=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(t,u,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,n,a){var i=this.simpleShapeOptions.get(a);if(this._isVisible(t,i)){var s=i.shapeProps,o=this._getVertTypeForShape(t,s.shape);if(void 0===o||i.isSimple&&!i.isSimple(t,this.renderTarget))return void this.drawTexture(t,n,a);var l=this.instanceCount;if(this.vertTypeBuffer.getView(l)[0]=o,5===o||6===o){var u=i.getBoundingBox(t),c=this._getCornerRadius(t,s.radius,u),d=this.cornerRadiusBuffer.getView(l);d[0]=c,d[1]=c,d[2]=c,d[3]=c,6===o&&(d[0]=0,d[2]=0)}ra(n,this.indexBuffer.getView(l));var h=this.renderTarget.picking?1:"node-body"===a?t.effectiveOpacity():1,v=this.renderTarget.picking?1:t.pstyle(s.opacity).value*h;An(t.pstyle(s.color).value,v,this.colorBuffer.getView(l));var g=this.lineWidthBuffer.getView(l);if(g[0]=0,g[1]=0,s.border){var x=t.pstyle("border-width").value;if(x>0){An(t.pstyle("border-color").value,h*t.pstyle("border-opacity").value,this.borderColorBuffer.getView(l));var H=t.pstyle("border-position").value;if("inside"===H)g[0]=0,g[1]=-x;else if("outside"===H)g[0]=x,g[1]=0;else{var F=x/2;g[0]=F,g[1]=-F}}}var j=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(t,j,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,n){switch(t.pstyle(n).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(t,n,a){var i=a.w,s=a.h;if("auto"===t.pstyle(n).value)return tn(i,s);var o=t.pstyle(n).pfValue;return Math.min(o,s/2,i/2)}},{key:"drawEdgeArrow",value:function(t,n,a){if(t.visible()){var s,o,l,i=t._private.rscratch;if(!("source"===a?(s=i.arrowStartX,o=i.arrowStartY,l=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,l=i.tgtArrowAngle),isNaN(s)||null==s||isNaN(o)||null==o||isNaN(l)||null==l||"none"===t.pstyle(a+"-arrow-shape").value)){var c=t.pstyle(a+"-arrow-color").value,h=t.pstyle("opacity").value*t.pstyle("line-opacity").value,v=t.pstyle("width").pfValue,b=t.pstyle("arrow-scale").value,p=this.r.getArrowWidth(v,b),g=this.instanceCount,x=this.transformBuffer.getMatrixView(g);hf(x),Gi(x,x,[s,o]),al(x,x,[p,p]),vf(x,x,l),this.vertTypeBuffer.getView(g)[0]=3,ra(n,this.indexBuffer.getView(g)),An(c,h,this.colorBuffer.getView(g)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(t,n){if(t.visible()){var a=this._getEdgePoints(t);if(a){var i=t.pstyle("opacity").value,s=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,l=t.pstyle("line-color").value,u=i*s;if(a.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==a.length){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=1,ra(n,this.indexBuffer.getView(c)),An(l,u,this.colorBuffer.getView(c)),this.lineWidthBuffer.getView(c)[0]=o;var v=this.pointAPointBBuffer.getView(c);v[0]=a[0],v[1]=a[1],v[2]=a[2],v[3]=a[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var b=0;b<a.length-2;b+=2){var p=this.instanceCount;this.vertTypeBuffer.getView(p)[0]=2,ra(n,this.indexBuffer.getView(p)),An(l,u,this.colorBuffer.getView(p)),this.lineWidthBuffer.getView(p)[0]=o;var A=a[b-2],z=a[b-1],H=a[b],F=a[b+1],j=a[b+2],$=a[b+3],J=a[b+4],K=a[b+5];0==b&&(A=2*H-j+.001,z=2*F-$+.001),b==a.length-4&&(J=2*j-H+.001,K=2*$-F+.001);var Q=this.pointAPointBBuffer.getView(p);Q[0]=A,Q[1]=z,Q[2]=H,Q[3]=F;var ee=this.pointCPointDBuffer.getView(p);ee[0]=j,ee[1]=$,ee[2]=J,ee[3]=K,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(t){var n=t._private.rscratch;return!(n.badLine||null==n.allpts||isNaN(n.allpts[0]))}},{key:"_getEdgePoints",value:function(t){var n=t._private.rscratch;if(this._isValidEdge(t)){var a=n.allpts;if(4==a.length)return a;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(a,i)}}},{key:"_getNumSegments",value:function(t){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,n){if(4==t.length)return t;for(var a=Array(2*(n+1)),i=0;i<=n;i++)0==i?(a[0]=t[0],a[1]=t[1]):i==n?(a[2*i]=t[t.length-2],a[2*i+1]=t[t.length-1]):this._setCurvePoint(t,i/n,a,2*i);return a}},{key:"_setCurvePoint",value:function(t,n,a,i){if(!(t.length<=2)){for(var s=Array(t.length-2),o=0;o<s.length;o+=2){var u=(1-n)*t[o+1]+n*t[o+3];s[o]=(1-n)*t[o]+n*t[o+2],s[o+1]=u}return this._setCurvePoint(s,n,a,i)}a[i]=t[0],a[i+1]=t[1]}},{key:"endBatch",value:function(){var t=this.gl,n=this.vao,a=this.vertexCount,i=this.instanceCount;if(0!==i){var s=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(s),t.bindVertexArray(n);var l,o=U(this.buffers);try{for(o.s();!(l=o.n()).done;)l.value.bufferSubData(i)}catch(v){o.e(v)}finally{o.f()}for(var c=this.batchManager.getAtlases(),d=0;d<c.length;d++)c[d].bufferIfNeeded(t);for(var f=0;f<c.length;f++)t.activeTexture(t.TEXTURE0+f),t.bindTexture(t.TEXTURE_2D,c[f].texture),t.uniform1i(s.uTextures[f],f);t.uniform1f(s.uZoom,function Cm(r){var e=r.pixelRatio;return r.cy.zoom()*e}(this.r)),t.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var h=An(this.bgColor,1);t.uniform4fv(s.uBGColor,h),t.drawArraysInstanced(t.TRIANGLES,0,a,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),n=t.reduce(function(s,o){return s+o.atlasCount},0),a=this.batchDebugInfo,i=a.reduce(function(s,o){return s+o.count},0);return{atlasInfo:t,totalAtlases:n,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:a.length,batchInfo:a,totalInstances:i}}}])}(),yf={};function mf(r,e){return vr(r._private.rscratch,"labelWrapCachedLines",e)||[]}yf.initWebgl=function(r,e){var t=this,n=t.data.contexts[t.WEBGL];r.bgColor=function Wm(r){var e=r.cy.container();return xl(e&&e.style&&e.style.backgroundColor||"white")}(t),r.webglTexSize=Math.min(r.webglTexSize,n.getParameter(n.MAX_TEXTURE_SIZE)),r.webglTexRows=Math.min(r.webglTexRows,54),r.webglTexRowsNodes=Math.min(r.webglTexRowsNodes,54),r.webglBatchSize=Math.min(r.webglBatchSize,16384),r.webglTexPerBatch=Math.min(r.webglTexPerBatch,n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=function Om(r){var e=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,e);var t=r.createTexture();return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.bindFramebuffer(r.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(n,a){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,n,a,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}(n),t.pickingFrameBuffer.needsDraw=!0,t.drawing=new Xm(t,n,r);var a=function(d){return function(f){return t.getTextAngle(f,d)}},i=function(d){return function(f){var h=f.pstyle(d);return h&&h.value}},s=function(d){return function(f){return f.pstyle("".concat(d,"-opacity")).value>0}},o=function(d){return"yes"===d.pstyle("text-events").strValue?2:1},l=function(d){var f=d.position(),h=f.x,v=f.y,b=d.outerWidth(),p=d.outerHeight();return{w:b,h:p,x1:h-b/2,y1:v-p/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:Sm,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:ol(e.getLabelKey,null),getBoundingBox:ll(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:a(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:ol(e.getSourceLabelKey,"source"),getBoundingBox:ll(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:a("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:ol(e.getTargetLabelKey,"target"),getBoundingBox:ll(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:a("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var u=ca(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(c,d){var f=!1;d&&d.length>0&&(f|=t.drawing.invalidate(d)),f&&u()}),function Ym(r){var e=r.render;r.render=function(i){i=i||{},r.webgl&&(r.cy.zoom()>7.99?(function $m(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}(r),e.call(r,i)):(function qm(r){var e=function(n){n.save(),n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,r.canvasWidth,r.canvasHeight),n.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}(r),xf(r,i,ka.SCREEN)))};var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0},r.findNearestElements=function(i,s,o,l){return function t0(r,e,t){var i,s,l,n=function e0(r,e,t){var i,s,u=rl(r),f=function Dm(r,e,t,n,a){var s=a*t+e.y;return[n*t+e.x,s=Math.round(r.canvasHeight-s)]}(r,u.pan,u.zoom,e,t),h=he(f,2);i=h[0]-3,s=h[1]-3;var g=r.data.contexts[r.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),xf(r,null,ka.PICKING),r.pickingFrameBuffer.needsDraw=!1);var C=new Uint8Array(144);g.readPixels(i,s,6,6,g.RGBA,g.UNSIGNED_BYTE,C),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var A=new Set,z=0;z<36;z++){var F=Lm(C.slice(4*z,4*z+4))-1;F>=0&&A.add(F)}return A}(r,e,t),a=r.getCachedZSortedEles(),o=U(n);try{for(o.s();!(l=o.n()).done;){var c=a[l.value];if(!i&&c.isNode()&&(i=c),!s&&c.isEdge()&&(s=c),i&&s)break}}catch(d){o.e(d)}finally{o.f()}return[i,s].filter(Boolean)}(r,i,s)};var n=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){n.call(r),r.pickingFrameBuffer.needsDraw=!0};var a=r.notify;r.notify=function(i,s){a.call(r,i,s),"viewport"===i||"bounds"===i?r.pickingFrameBuffer.needsDraw=!0:"background"===i&&r.drawing.invalidate(s,{type:"node-body"})}}(t)};var ol=function(e,t){return function(n){var a=e(n),i=mf(n,t);return i.length>1?i.map(function(s,o){return"".concat(a,"_").concat(o)}):a}},ll=function(e,t){return function(n,a){var i=e(n);if("string"==typeof a){var s=a.indexOf("_");if(s>0){var o=Number(a.substring(s+1)),l=mf(n,t),u=i.h/l.length,c=u*o;return{x1:i.x1,w:i.w,y1:i.y1+c,h:u,yOffset:c}}}return i}};function bf(r,e){var t=r.canvasWidth,n=r.canvasHeight,a=rl(r),i=a.pan,s=a.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,n),e.translate(i.x,i.y),e.scale(s,s)}function ul(r,e,t){var n=r.drawing;e+=1,t.isNode()?(n.drawNode(t,e,"node-underlay"),n.drawNode(t,e,"node-body"),n.drawTexture(t,e,"label"),n.drawNode(t,e,"node-overlay")):(n.drawEdgeLine(t,e),n.drawEdgeArrow(t,e,"source"),n.drawEdgeArrow(t,e,"target"),n.drawTexture(t,e,"label"),n.drawTexture(t,e,"edge-source-label"),n.drawTexture(t,e,"edge-target-label"))}function xf(r,e,t){var n;r.webglDebug&&(n=performance.now());var a=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&function Zm(r,e){r.drawSelectionRectangle(e,function(t){return bf(r,t)})}(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var s=r.data.contexts[r.WEBGL];t.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=function Km(r){var e=r.canvasWidth,t=r.canvasHeight,n=rl(r),a=n.pan,i=n.zoom,s=nl();Gi(s,s,[a.x,a.y]),al(s,s,[i,i]);var o=nl();!function Pm(r,e,t){r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1}(o,e,t);var l=nl();return function _m(r,e,t){var n=e[0],a=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],d=e[8],f=t[0],h=t[1],v=t[2],b=t[3],p=t[4],g=t[5],x=t[6],C=t[7],A=t[8];r[0]=f*n+h*s+v*u,r[1]=f*a+h*o+v*c,r[2]=f*i+h*l+v*d,r[3]=b*n+p*s+g*u,r[4]=b*a+p*o+g*c,r[5]=b*i+p*l+g*d,r[6]=x*n+C*s+A*u,r[7]=x*a+C*o+A*c,r[8]=x*i+C*l+A*d}(l,o,s),l}(r),l=r.getCachedZSortedEles();if(i=l.length,a.startFrame(o,t),t.screen){for(var u=0;u<l.nondrag.length;u++)ul(r,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)ul(r,c,l.drag[c])}else if(t.picking)for(var d=0;d<l.length;d++)ul(r,d,l[d]);a.endFrame(),t.screen&&r.webglDebugShowAtlases&&(function Jm(r){var e=r.data.contexts[r.NODE];e.save(),bf(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}(r),function Qm(r){var e=function(a,i,s){for(var o=a.atlasManager.getAtlasCollection(i),l=r.data.contexts[r.NODE],u=o.atlases,c=0;c<u.length;c++){var f=u[c].canvas;if(f){var h=f.width,v=f.height,b=h*c,p=f.height*s;l.save(),l.scale(.4,.4),l.drawImage(f,b,p),l.strokeStyle="black",l.rect(b,p,h,v),l.stroke(),l.restore()}}},t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var f=performance.now(),v=Math.ceil(f-n),b=a.getDebugInfo(),p=["".concat(i," elements"),"".concat(b.totalInstances," instances"),"".concat(b.batchCount," batches"),"".concat(b.totalAtlases," atlases"),"".concat(b.wrappedCount," wrapped textures"),"".concat(b.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(t.name,") - frame time ").concat(v,"ms")),console.log("Totals:"),console.log(" ".concat(p)),console.log("Texture Atlases Used:");var C,x=U(b.atlasInfo);try{for(x.s();!(C=x.n()).done;){var A=C.value;console.log(" ".concat(A.type,": ").concat(A.keyCount," keys, ").concat(A.atlasCount," atlases"))}}catch(z){x.e(z)}finally{x.f()}console.log("")}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,a.gc())}for(var fn={drawPolygonPath:function(r,e,t,n,a,i){var s=n/2,o=a/2;r.beginPath&&r.beginPath(),r.moveTo(e+s*i[0],t+o*i[1]);for(var l=1;l<i.length/2;l++)r.lineTo(e+s*i[2*l],t+o*i[2*l+1]);r.closePath()},drawRoundPolygonPath:function(r,e,t,n,a,i,s){s.forEach(function(o){return Bd(r,o)}),r.closePath()},drawRoundRectanglePath:function(r,e,t,n,a,i){var s=n/2,o=a/2,l="auto"===i?tn(n,a):Math.min(i,o,s);r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.arcTo(e+s,t-o,e+s,t,l),r.arcTo(e+s,t+o,e,t+o,l),r.arcTo(e-s,t+o,e-s,t,l),r.arcTo(e-s,t-o,e,t-o,l),r.lineTo(e,t-o),r.closePath()},drawBottomRoundRectanglePath:function(r,e,t,n,a,i){var s=n/2,o=a/2,l="auto"===i?tn(n,a):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.lineTo(e+s,t-o),r.lineTo(e+s,t),r.arcTo(e+s,t+o,e,t+o,l),r.arcTo(e-s,t+o,e-s,t,l),r.lineTo(e-s,t-o),r.lineTo(e,t-o),r.closePath()},drawCutRectanglePath:function(r,e,t,n,a,i,s){var o=n/2,l=a/2,u="auto"===s?8:s;r.beginPath&&r.beginPath(),r.moveTo(e-o+u,t-l),r.lineTo(e+o-u,t-l),r.lineTo(e+o,t-l+u),r.lineTo(e+o,t+l-u),r.lineTo(e+o-u,t+l),r.lineTo(e-o+u,t+l),r.lineTo(e-o,t+l-u),r.lineTo(e-o,t-l+u),r.closePath()},drawBarrelPath:function(r,e,t,n,a){var i=n/2,s=a/2,o=e-i,l=e+i,u=t-s,c=t+s,d=Ts(n,a),f=d.widthOffset,h=d.heightOffset,v=d.ctrlPtOffsetPct*f;r.beginPath&&r.beginPath(),r.moveTo(o,u+h),r.lineTo(o,c-h),r.quadraticCurveTo(o+v,c,o+f,c),r.lineTo(l-f,c),r.quadraticCurveTo(l-v,c,l,c-h),r.lineTo(l,u+h),r.quadraticCurveTo(l-v,u,l-f,u),r.lineTo(o+f,u),r.quadraticCurveTo(o+v,u,o,u+h),r.closePath()}},wf=Math.sin(0),Ef=Math.cos(0),cl={},dl={},Tf=Math.PI/40,aa=0*Math.PI;aa<2*Math.PI;aa+=Tf)cl[aa]=Math.sin(aa),dl[aa]=Math.cos(aa);fn.drawEllipsePath=function(r,e,t,n,a){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,n/2,a/2,0,0,2*Math.PI);else for(var i,s,o=n/2,l=a/2,u=0*Math.PI;u<2*Math.PI;u+=Tf)i=e-o*cl[u]*wf+o*dl[u]*Ef,s=t+l*dl[u]*wf+l*cl[u]*Ef,0===u?r.moveTo(i,s):r.lineTo(i,s);r.closePath()};var Ga={};function Cf(r){var e=r.indexOf(",");return r.substr(e+1)}function Df(r,e,t){var n=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new Vn(function(a,i){try{e.toBlob(function(s){null!=s?a(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(s){i(s)}});case"blob":return function r0(r,e){for(var t=atob(r),n=new ArrayBuffer(t.length),a=new Uint8Array(n),i=0;i<t.length;i++)a[i]=t.charCodeAt(i);return new Blob([n],{type:e})}(Cf(n()),t);case"base64":return Cf(n());default:return n()}}Ga.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]},Ga.bufferCanvasImage=function(r){var e=this.cy,n=e.mutableElements().boundingBox(),a=this.findContainerClientCoords(),i=r.full?Math.ceil(n.w):a[2],s=r.full?Math.ceil(n.h):a[3],o=Be(r.maxWidth)||Be(r.maxHeight),l=this.getPixelRatio(),u=1;if(void 0!==r.scale)i*=r.scale,s*=r.scale,u=r.scale;else if(o){var c=1/0,d=1/0;Be(r.maxWidth)&&(c=u*r.maxWidth/i),Be(r.maxHeight)&&(d=u*r.maxHeight/s),i*=u=Math.min(c,d),s*=u}o||(i*=l,s*=l,u*=l);var f=document.createElement("canvas");f.width=i,f.height=s,f.style.width=i+"px",f.style.height=s+"px";var h=f.getContext("2d");if(i>0&&s>0){h.clearRect(0,0,i,s),h.globalCompositeOperation="source-over";var v=this.getCachedZSortedEles();if(r.full)h.translate(-n.x1*u,-n.y1*u),h.scale(u,u),this.drawElements(h,v),h.scale(1/u,1/u),h.translate(n.x1*u,n.y1*u);else{var b=e.pan(),p={x:b.x*u,y:b.y*u};u*=e.zoom(),h.translate(p.x,p.y),h.scale(u,u),this.drawElements(h,v),h.scale(1/u,1/u),h.translate(-p.x,-p.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,s),h.fill())}return f},Ga.png=function(r){return Df(r,this.bufferCanvasImage(r),"image/png")},Ga.jpg=function(r){return Df(r,this.bufferCanvasImage(r),"image/jpeg")};var n0=If,St=If.prototype;function If(r){var e=this,n=e.cy.window().document;r.webgl&&(St.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.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)";e.data.canvasContainer=n.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=r.cy.container();o.appendChild(e.data.canvasContainer),o.style[a]=i;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Ze&&Ze.userAgent.match(/msie|trident|edge/i)&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<St.CANVAS_LAYERS;u++){var c=e.data.canvases[u]=n.createElement("canvas"),d=St.CANVAS_TYPES[u];e.data.contexts[u]=c.getContext(d),e.data.contexts[u]||jt("Could not create canvas of type "+d),Object.keys(l).forEach(function(He){c.style[He]=l[He]}),c.style.position="absolute",c.setAttribute("data-id","layer"+u),c.style.zIndex=String(St.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[u]=!1}for(e.data.topCanvas=e.data.canvases[0],e.data.canvases[St.NODE].setAttribute("data-id","layer"+St.NODE+"-node"),e.data.canvases[St.SELECT_BOX].setAttribute("data-id","layer"+St.SELECT_BOX+"-selectbox"),e.data.canvases[St.DRAG].setAttribute("data-id","layer"+St.DRAG+"-drag"),e.data.canvases[St.WEBGL]&&e.data.canvases[St.WEBGL].setAttribute("data-id","layer"+St.WEBGL+"-webgl"),u=0;u<St.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=n.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var f=gr(),v=function(Ce){return{x:-Ce.w/2,y:-Ce.h/2}},p=function(Ce){return Ce[0]._private.nodeKey},g=function(Ce){return Ce[0]._private.labelStyleKey},x=function(Ce){return Ce[0]._private.sourceLabelStyleKey},C=function(Ce){return Ce[0]._private.targetLabelStyleKey},A=function(Ce,Ae,_e,ze,rt){return e.drawElement(Ce,Ae,_e,!1,!1,rt)},z=function(Ce,Ae,_e,ze,rt){return e.drawElementText(Ce,Ae,_e,ze,"main",rt)},H=function(Ce,Ae,_e,ze,rt){return e.drawElementText(Ce,Ae,_e,ze,"source",rt)},F=function(Ce,Ae,_e,ze,rt){return e.drawElementText(Ce,Ae,_e,ze,"target",rt)},j=function(Ce){return Ce.boundingBox(),Ce[0]._private.bodyBounds},$=function(Ce){return Ce.boundingBox(),Ce[0]._private.labelBounds.main||f},J=function(Ce){return Ce.boundingBox(),Ce[0]._private.labelBounds.source||f},K=function(Ce){return Ce.boundingBox(),Ce[0]._private.labelBounds.target||f},Q=function(Ce,Ae){return Ae},ee=function(Ce){return function(Ce){return{x:(Ce.x1+Ce.x2)/2,y:(Ce.y1+Ce.y2)/2}}(j(Ce))},ue=function(Ce,Ae,_e){var ze=Ce?Ce+"-":"";return{x:Ae.x+_e.pstyle(ze+"text-margin-x").pfValue,y:Ae.y+_e.pstyle(ze+"text-margin-y").pfValue}},fe=function(Ce,Ae,_e){var ze=Ce[0]._private.rscratch;return{x:ze[Ae],y:ze[_e]}},ve=function(Ce){return ue("",fe(Ce,"labelX","labelY"),Ce)},ce=function(Ce){return ue("source",fe(Ce,"sourceLabelX","sourceLabelY"),Ce)},pe=function(Ce){return ue("target",fe(Ce,"targetLabelX","targetLabelY"),Ce)},Se=function(Ce){return v(j(Ce))},Ie=function(Ce){return v(J(Ce))},me=function(Ce){return v(K(Ce))},De=function(Ce){var Ae=$(Ce),_e=v($(Ce));if(Ce.isNode()){switch(Xn(Ce.pstyle("text-halign").value)){case"left":_e.x=-Ae.w-(Ae.leftPad||0);break;case"right":_e.x=-(Ae.rightPad||0)}switch(Wn(Ce.pstyle("text-valign").value)){case"top":_e.y=-Ae.h-(Ae.topPad||0);break;case"bottom":_e.y=-(Ae.botPad||0)}}return _e},Ue=e.data.eleTxrCache=new Oa(e,{getKey:p,doesEleInvalidateKey:function(Ce){var Ae=Ce[0]._private;return!(Ae.oldBackgroundTimestamp===Ae.backgroundTimestamp)},drawElement:A,getBoundingBox:j,getRotationPoint:ee,getRotationOffset:Se,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),qe=e.data.lblTxrCache=new Oa(e,{getKey:g,drawElement:z,getBoundingBox:$,getRotationPoint:ve,getRotationOffset:De,isVisible:Q}),je=e.data.slbTxrCache=new Oa(e,{getKey:x,drawElement:H,getBoundingBox:J,getRotationPoint:ce,getRotationOffset:Ie,isVisible:Q}),Je=e.data.tlbTxrCache=new Oa(e,{getKey:C,drawElement:F,getBoundingBox:K,getRotationPoint:pe,getRotationOffset:me,isVisible:Q}),tt=e.data.lyrTxrCache=new ef(e);e.onUpdateEleCalcs(function(Ce,Ae){Ue.invalidateElements(Ae),qe.invalidateElements(Ae),je.invalidateElements(Ae),Je.invalidateElements(Ae),tt.invalidateElements(Ae);for(var _e=0;_e<Ae.length;_e++){var ze=Ae[_e]._private;ze.oldBackgroundTimestamp=ze.backgroundTimestamp}});var at=function(Ce){for(var Ae=0;Ae<Ce.length;Ae++)tt.enqueueElementRefinement(Ce[Ae].ele)};Ue.onDequeue(at),qe.onDequeue(at),je.onDequeue(at),Je.onDequeue(at),r.webgl&&e.initWebgl(r,{getStyleKey:p,getLabelKey:g,getSourceLabelKey:x,getTargetLabelKey:C,drawElement:A,drawLabel:z,drawSourceLabel:H,drawTargetLabel:F,getElementBox:j,getLabelBox:$,getSourceLabelBox:J,getTargetLabelBox:K,getElementRotationPoint:ee,getElementRotationOffset:Se,getLabelRotationPoint:ve,getSourceLabelRotationPoint:ce,getTargetLabelRotationPoint:pe,getLabelRotationOffset:De,getSourceLabelRotationOffset:Ie,getTargetLabelRotationOffset:me})}St.CANVAS_LAYERS=3,St.SELECT_BOX=0,St.DRAG=1,St.NODE=2,St.WEBGL=3,St.CANVAS_TYPES=["2d","2d","2d","webgl2"],St.BUFFER_COUNT=3,St.TEXTURE_BUFFER=0,St.MOTIONBLUR_BUFFER_NODE=1,St.MOTIONBLUR_BUFFER_DRAG=2,St.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[St.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[St.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[St.SELECT_BOX]=e;break;case"gc":t.data.gc=!0}};var a0=typeof Path2D<"u";St.path2dEnabled=function(r){if(void 0===r)return this.pathsEnabled;this.pathsEnabled=!!r},St.usePaths=function(){return a0&&this.pathsEnabled},St.setImgSmoothing=function(r,e){null!=r.imageSmoothingEnabled?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)},St.getImgSmoothing=function(r){return null!=r.imageSmoothingEnabled?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled},St.makeOffscreenCanvas=function(r,e){var t;return"undefined"!==(typeof OffscreenCanvas>"u"?"undefined":ye(OffscreenCanvas))?t=new OffscreenCanvas(r,e):((t=this.cy.window().document.createElement("canvas")).width=r,t.height=e),t},[rf,zr,$r,tl,Ln,dn,yr,yf,fn,Ga,{nodeShapeImpl:function(r,e,t,n,a,i,s,o){switch(r){case"ellipse":return this.drawEllipsePath(e,t,n,a,i);case"polygon":return this.drawPolygonPath(e,t,n,a,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,t,n,a,i,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,n,a,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,n,a,i,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,n,a,i,o);case"barrel":return this.drawBarrelPath(e,t,n,a,i)}}}].forEach(function(r){mt(St,r)});var s0=[{type:"layout",extensions:Ay},{type:"renderer",extensions:[{name:"null",impl:Ld},{name:"base",impl:$d},{name:"canvas",impl:n0}]}],Lf={},Af={};function Nf(r,e,t){var n=t,a=function(j){Bt("Can not register `"+e+"` for `"+r+"` since `"+j+"` already exists in the prototype and can not be overridden")};if("core"===r){if(Aa.prototype[e])return a(e);Aa.prototype[e]=t}else if("collection"===r){if(or.prototype[e])return a(e);or.prototype[e]=t}else if("layout"===r){for(var i=function(j){this.options=j,t.call(this,j),Oe(this._private)||(this._private={}),this._private.cy=j.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(t.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||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 c=t.prototype.stop;s.stop=function(){var F=this.options;if(F&&F.animate){var j=this.animations;if(j)for(var $=0;$<j.length;$++)j[$].stop()}return c?c.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var d=function(j){return j._private.cy},f={addEventFields:function(j,$){$.layout=j,$.cy=d(j),$.target=j},bubble:function(){return!0},parent:function(j){return d(j)}};mt(s,{createEmitter:function(){return this._private.emitter=new pi(f,this),this},emitter:function(){return this._private.emitter},on:function(j,$){return this.emitter().on(j,$),this},one:function(j,$){return this.emitter().one(j,$),this},once:function(j,$){return this.emitter().one(j,$),this},removeListener:function(j,$){return this.emitter().removeListener(j,$),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(j,$){return this.emitter().emit(j,$),this}}),Ft.eventAliasesOn(s),n=i}else if("renderer"===r&&"null"!==e&&"base"!==e){var h=Rf("renderer","base"),v=h.prototype,b=t,p=t.prototype,g=function(){h.apply(this,arguments),b.apply(this,arguments)},x=g.prototype;for(var C in v){var A=v[C];if(null!=p[C])return a(C);x[C]=A}for(var H in p)x[H]=p[H];v.clientFunctions.forEach(function(F){x[F]=x[F]||function(){jt("Renderer does not implement `renderer."+F+"()` on its prototype")}}),n=g}else if("__proto__"===r||"constructor"===r||"prototype"===r)return jt(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return wl({map:Lf,keys:[r,e],value:n})}function Rf(r,e){return El({map:Lf,keys:[r,e]})}function o0(r,e,t,n,a){return wl({map:Af,keys:[r,e,t,n],value:a})}function l0(r,e,t,n){return El({map:Af,keys:[r,e,t,n]})}var fl=function(){return 2===arguments.length?Rf.apply(null,arguments):3===arguments.length?Nf.apply(null,arguments):4===arguments.length?l0.apply(null,arguments):5===arguments.length?o0.apply(null,arguments):void jt("Invalid extension access syntax")};Aa.prototype.extension=fl,s0.forEach(function(r){r.extensions.forEach(function(e){Nf(r.type,e.name,e.impl)})});var Hi=function(){if(!(this instanceof Hi))return new Hi;this.length=0},Nn=Hi.prototype;Nn.instanceString=function(){return"stylesheet"},Nn.selector=function(r){return this[this.length++]={selector:r,properties:[]},this},Nn.css=function(r,e){var t=this.length-1;if(le(r))this[t].properties.push({name:r,value:e});else if(Oe(r))for(var n=r,a=Object.keys(n),i=0;i<a.length;i++){var s=a[i],o=n[s];if(null!=o){var l=nr.properties[s]||nr.properties[Ua(s)];null!=l&&this[t].properties.push({name:l.name,value:o})}}return this},Nn.style=Nn.css,Nn.generateStyle=function(r){var e=new nr(r);return this.appendToStyle(e)},Nn.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],a=t.properties;r.selector(t.selector);for(var i=0;i<a.length;i++){var s=a[i];r.css(s.name,s.value)}}return r};var hn=function(e){return void 0===e&&(e={}),Oe(e)?new Aa(e):le(e)?fl.apply(fl,arguments):void 0};hn.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(hn),r.apply(null,e),this},hn.warnings=function(r){return Wl(r)},hn.version="3.34.0",hn.stylesheet=hn.Stylesheet=Hi;var c0=Y(5970),V=Y(5547);const d0=["graphContainer"],f0=(r,e)=>e.key,Mf=(r,e)=>e.id;function h0(r,e){if(1&r&&(V.j41(0,"div",5)(1,"span",6),V.EFF(2),V.k0s(),V.j41(3,"span",7),V.EFF(4),V.k0s()()),2&r){const t=e.$implicit;V.R7$(2),V.JRh(t.key),V.R7$(2),V.JRh(t.value)}}function v0(r,e){if(1&r&&(V.j41(0,"div",4),V.Z7z(1,h0,5,2,"div",5,f0),V.k0s()),2&r){const t=e;V.xc7("left",t.x,"px")("top",t.y,"px"),V.R7$(),V.Dyx(t.entries)}}function g0(r,e){if(1&r){const t=V.RV6();V.j41(0,"button",10),V.bIt("mousedown",function(a){return a.stopPropagation()})("click",function(){const a=w.eBV(t).$implicit,i=V.XpG(2);return w.Njj(i._onContextMenuAction(a.id))}),V.EFF(1),V.k0s()}if(2&r){const t=e.$implicit;V.R7$(),V.SpI(" ",t.label," ")}}function p0(r,e){if(1&r&&(V.j41(0,"div",8),V.Z7z(1,g0,2,1,"button",9,Mf),V.k0s()),2&r){const t=V.XpG();V.xc7("left",t.contextMenuPos().x,"px")("top",t.contextMenuPos().y,"px"),V.R7$(),V.Dyx(t.contextMenuItems())}}function y0(r,e){if(1&r){const t=V.RV6();V.j41(0,"button",10),V.bIt("mousedown",function(a){return a.stopPropagation()})("click",function(){const a=w.eBV(t).$implicit,i=V.XpG(2);return w.Njj(i._onEdgeContextMenuAction(a.id))}),V.EFF(1),V.k0s()}if(2&r){const t=e.$implicit;V.R7$(),V.SpI(" ",t.label," ")}}function m0(r,e){if(1&r&&(V.j41(0,"div",8),V.Z7z(1,y0,2,1,"button",9,Mf),V.k0s()),2&r){const t=V.XpG();V.xc7("left",t.edgeContextMenuPos().x,"px")("top",t.edgeContextMenuPos().y,"px"),V.R7$(),V.Dyx(t.edgeContextMenuItems())}}try{hn.use(ae())}catch{}let hl=(()=>{class r{elements=M.hFB.required();animate=(0,M.hFB)(!1);stopAnimationAfterFirstNodeHover=(0,M.hFB)(!0);layout=(0,M.hFB)("cose-bilkent");highlightNeighborsOnHover=(0,M.hFB)(!0);userZoomingEnabled=(0,M.hFB)(!0);userPanningEnabled=(0,M.hFB)(!0);appendHTMLLabels=(0,M.hFB)(!0);directed=(0,M.hFB)(!0);labelPropsSettings=(0,M.hFB)(new G);contextMenuItems=(0,M.hFB)([]);edgeContextMenuItems=(0,M.hFB)([]);nodeHover=(0,M.CGW)();nodeClick=(0,M.CGW)();canvasClick=(0,M.CGW)();contextMenuAction=(0,M.CGW)();edgeContextMenuAction=(0,M.CGW)();_cy=(0,w.vPA)(void 0);_container=(0,w.vPA)(void 0);_animate;_positionCache=new Map;hoverNodeOverlay=(0,w.vPA)(null);contextMenuVisible=(0,w.vPA)(!1);contextMenuPos=(0,w.vPA)({x:0,y:0});_contextMenuNode=null;edgeContextMenuVisible=(0,w.vPA)(!1);edgeContextMenuPos=(0,w.vPA)({x:0,y:0});_edgeContextMenuLabel="";_edgeContextMenuEdge={source:"",target:""};graphContainer;handleElements=(0,w.QZP)(()=>{const t=this.elements();if(void 0===this._container())return;const n=this._cy();n?this._patch(n,t):this._build(),this._setupClickHoverEvents()});handleAnimate=(0,w.QZP)(()=>{const t=this._cy();void 0!==t&&(this.animate()?this._setAnimation(t):this._stopAnimation())});handleHTMLLabels=(0,w.QZP)(()=>{const t=this._cy(),n=this._container();if(void 0===t||void 0===n)return;const a=this.labelPropsSettings(),i=new G;i.boxLabels={...a.boxLabels},i.props={display:!1,displayOnlyOnHover:a.props.displayOnlyOnHover},_(t,n,i)});_bodyObserver;_resizeDebounce;_startBodyObserver(){this._bodyObserver=new MutationObserver(()=>{this._reapplyStyles()}),this._bodyObserver.observe(document.body,{attributes:!0,attributeFilter:["class"]})}_reapplyStyles(){const t=this._cy(),n=this._container();if(!t||!n)return;const a=this._resolveParentBg(n),i={...q,directed:this.directed(),backgroundColor:a};t.style(k(i)).update()}_resolveParentBg(t){let n=t.parentElement;for(;n;){const a=window.getComputedStyle(n).backgroundColor;if(a&&"rgba(0, 0, 0, 0)"!==a&&"transparent"!==a)return a;n=n.parentElement}return"#ffffff"}ngAfterViewInit(){const t=this.graphContainer.nativeElement;void 0!==t&&this._container.update(()=>t)}ngOnDestroy(){this._bodyObserver?.disconnect(),clearTimeout(this._resizeDebounce),this._cy()?.destroy()}onResize(){const t=this._cy();t&&(t.resize(),clearTimeout(this._resizeDebounce),this._resizeDebounce=setTimeout(()=>{t.resize(),this._nodesHavePosition()||t.fit(void 0,60),t.center()},250))}_setAnimation(t){this._stopAnimation(),this._animate=new W(t,this.stopAnimationAfterFirstNodeHover(),1e-4,.02)}_stopAnimation(){this._animate?.stop()}_patch(t,n){const a=new Set(n.nodes.map(g=>g.data.id)),i=new Set(n.edges.map(g=>g.data.id??""));t.nodes().filter(g=>!a.has(g.id())).forEach(g=>{this._positionCache.set(g.id(),{...g.position()})}),t.remove(t.nodes().filter(g=>!a.has(g.id()))),t.remove(t.edges().filter(g=>!i.has(g.id())));const s=new Set(t.nodes().map(g=>g.id())),o=new Set(t.edges().map(g=>g.id()));for(const g of n.nodes)if(s.has(g.data.id)){const x=t.getElementById(g.data.id);x.data(g.data),x.classes(g.classes??"")}const l=n.nodes.filter(g=>!s.has(g.data.id)),u=n.edges.filter(g=>!o.has(g.data.id??""));if(0===l.length&&0===u.length)return;t.nodes().lock();const c=new Set(l.map(g=>g.data.id)),d=t.nodes();t.add([...l.map(g=>({group:"nodes",data:g.data,classes:g.classes??""})),...u.map(g=>({group:"edges",data:g.data,classes:g.classes??""}))]);const f=new Map;for(const g of u){const x=c.has(g.data.source),C=c.has(g.data.target??"");if(x&&!C){const A=t.getElementById(g.data.target??"");A.length>0&&!f.has(g.data.source)&&f.set(g.data.source,{...A.position()})}if(C&&!x){const A=t.getElementById(g.data.source);A.length>0&&!f.has(g.data.target)&&f.set(g.data.target,{...A.position()})}}const h=[];let v=0;if(t.nodes().filter(g=>c.has(g.id())).forEach(g=>{const x=this._positionCache.get(g.id());if(x)g.position(x),g.lock(),this._positionCache.delete(g.id());else{const C=f.get(g.id());if(C){const A=v++*(2*Math.PI/Math.max(l.length,1)),z=100+60*Math.random();g.position({x:C.x+z*Math.cos(A),y:C.y+z*Math.sin(A)})}else h.push(g)}}),h.length>0&&d.length>0){const g=d.boundingBox({}),x=(g.x1+g.x2)/2,C=(g.y1+g.y2)/2,A=Math.max(g.x2-g.x1,g.y2-g.y1)/2+180,z=2*Math.PI/Math.max(h.length,1);h.forEach((H,F)=>{H.position({x:x+A*Math.cos(z*F),y:C+A*Math.sin(z*F)})})}const b=this._container();if(b&&this.appendHTMLLabels()){const g=new G,x=this.labelPropsSettings();g.boxLabels={...x.boxLabels},g.props={display:!1,displayOnlyOnHover:x.props.displayOnlyOnHover},_(t,b,g)}const p=t.layout({...this._layoutOptions(),randomize:!1,fit:!1,animate:!0});p.on("layoutstop",()=>t.nodes().unlock()),p.run()}_build(){this._bodyObserver?.disconnect(),this._bodyObserver=void 0;const t=this._container(),n=t?this._resolveParentBg(t):q.backgroundColor,a={...q,directed:this.directed(),backgroundColor:n},i=k(a),s=this._nodesHavePosition()?{name:"preset",padding:100,animate:!1}:{...this._layoutOptions(),padding:80,animate:!1},o=hn({container:this._container(),style:i,layout:s,elements:this.elements(),userZoomingEnabled:this.userZoomingEnabled(),userPanningEnabled:this.userPanningEnabled(),minZoom:.2,maxZoom:3});o.one("layoutstop",()=>{o.resize(),this._nodesHavePosition()||o.fit(void 0,60),o.center()}),this._cy.update(()=>o),this._startBodyObserver()}_setupClickHoverEvents(){const t=this._cy();if(null==t)return;let n=t.collection();t.nodes().unbind("tapstart"),t.nodes().bind("tapstart",a=>{const i=a.target.data();!i.isCollapser&&!i.isChainExpander&&this.contextMenuItems().length>0&&(a.originalEvent?.preventDefault(),a.originalEvent?.stopPropagation())}),t.nodes().unbind("click"),t.nodes().bind("click",a=>{const i=a.target,s=i.data();if(s.isCollapser||s.isChainExpander)return this.contextMenuVisible.set(!1),this.nodeClick.emit(s),void(n=n.union(i));if(this.contextMenuItems().length>0){const o=i.renderedPosition();return this._contextMenuNode=s,this.contextMenuPos.set({x:o.x,y:o.y}),void this.contextMenuVisible.set(!0)}this.nodeClick.emit(s),n=n.union(i)}),t.nodes().unbind("cxttap"),t.nodes().bind("cxttap",a=>{if(!this.contextMenuItems().length)return;const i=a.target,s=i.data(),o=i.renderedPosition();this._contextMenuNode=s,this.contextMenuPos.set({x:o.x,y:o.y}),this.contextMenuVisible.set(!0),this.edgeContextMenuVisible.set(!1),this.nodeHover.emit(s)}),t.nodes().unbind("mouseover"),t.nodes().bind("mouseover",a=>{this._dimAllButNeighbors(a.target);const i=a.target.data();this.nodeHover.emit(i);const s=i.properties;if(this.labelPropsSettings().props.display&&s){const o=Object.entries(s).map(([l,u])=>({key:l,value:String(u)}));if(o.length>0){const l=a.target.renderedBoundingBox();this.hoverNodeOverlay.set({x:(l.x1+l.x2)/2,y:l.y2,entries:o})}}}),t.nodes().unbind("mouseout"),t.nodes().bind("mouseout",()=>{this._unDimAll(),this.nodeHover.emit(void 0),this.hoverNodeOverlay.set(null)}),t.nodes().unbind("drag"),t.nodes().bind("drag",a=>{if(null===this.hoverNodeOverlay())return;const i=a.target.renderedBoundingBox(),s=this.hoverNodeOverlay();this.hoverNodeOverlay.set({...s,x:(i.x1+i.x2)/2,y:i.y2})}),t.nodes().unbind("dragfree"),t.nodes().bind("dragfree",()=>{this.hoverNodeOverlay.set(null)}),t.edges().unbind("mouseover"),t.edges().bind("mouseover",a=>{a.target.addClass("edge-hover")}),t.edges().unbind("mouseout"),t.edges().bind("mouseout",a=>{a.target.removeClass("edge-hover")}),t.edges().unbind("tap"),t.edges().bind("tap",a=>{if(!this.edgeContextMenuItems().length)return;const i=a.target,s=i.renderedMidpoint();this._edgeContextMenuLabel=i.data("label")??"",this._edgeContextMenuEdge={id:i.data("id"),iri:i.data("iri"),label:i.data("label"),source:i.data("source"),target:i.data("target"),color:i.data("color"),width:i.data("width")},this.edgeContextMenuPos.set({x:s.x,y:s.y}),this.edgeContextMenuVisible.set(!0),this.contextMenuVisible.set(!1)}),t.off("click"),t.on("click",a=>{0===Object.keys(a.target.data()).length&&(this.contextMenuVisible.set(!1),this.edgeContextMenuVisible.set(!1),this.canvasClick.emit())}),t.off("viewport"),t.on("viewport",()=>{this.contextMenuVisible.set(!1),this.edgeContextMenuVisible.set(!1)})}_onContextMenuAction(t){this.contextMenuVisible.set(!1),this._contextMenuNode&&this.contextMenuAction.emit({actionId:t,node:this._contextMenuNode})}_onEdgeContextMenuAction(t){this.edgeContextMenuVisible.set(!1),this.edgeContextMenuAction.emit({actionId:t,edgeLabel:this._edgeContextMenuLabel,edge:this._edgeContextMenuEdge})}_layoutOptions(){const t=this.layout();if("cose-bilkent"!==t)return{name:t};const n=this.elements().nodes,a=this.elements().edges,i=n.length>0?2*a.length/n.length:1,s=n.map(b=>{const x=[b.data.label||"",...b.data.boxLabels||[]].filter(Boolean);return Math.max(...x.map(C=>C.length),0)}),o=s.length>0?s.reduce((b,p)=>b+p,0)/s.length:0,l=s.length>0?Math.max(...s):0,c=1.5*o,d=.8*Math.max(0,l-20),f=7.2*i;return{name:"cose-bilkent",nodeDimensionsIncludeLabels:!0,randomize:!0,nodeRepulsion:Math.round(4500+500*i),idealEdgeLength:Math.round(48+c+d+f),edgeElasticity:.45,gravity:.25,gravityRange:3.8,numIter:2500}}_nodesHavePosition(){return void 0!==this.elements().nodes.find(n=>void 0!==n.position)}fitTo(t,n=80){const a=this._cy();if(!a||0===t.length)return;let i=a.collection();for(const s of t){const o=a.getElementById(s);o.length>0&&(i=i.union(o))}0!==i.length&&a.animate({fit:{eles:i,padding:n},duration:400,easing:"ease-in-out-cubic"})}_unDimAll(){const t=this._cy();null!=t&&(t.elements().forEach(n=>{n.removeClass("faded")}),t.edges().removeClass("neighbor-hover"))}_dimAllButNeighbors(t){const n=this._cy();if(null==n)return;const a=t.neighborhood().map(i=>i.id());n.elements().forEach(i=>{a.includes(i.id())||i.id()===t.id()?i.removeClass("faded"):i.addClass("faded")}),t.connectedEdges().addClass("neighbor-hover")}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=V.VBU({type:r,selectors:[["cue-simple-graph"]],viewQuery:function(n,a){if(1&n&&V.GBs(d0,5),2&n){let i;V.mGM(i=V.lsd())&&(a.graphContainer=i.first)}},inputs:{elements:[1,"elements"],animate:[1,"animate"],stopAnimationAfterFirstNodeHover:[1,"stopAnimationAfterFirstNodeHover"],layout:[1,"layout"],highlightNeighborsOnHover:[1,"highlightNeighborsOnHover"],userZoomingEnabled:[1,"userZoomingEnabled"],userPanningEnabled:[1,"userPanningEnabled"],appendHTMLLabels:[1,"appendHTMLLabels"],directed:[1,"directed"],labelPropsSettings:[1,"labelPropsSettings"],contextMenuItems:[1,"contextMenuItems"],edgeContextMenuItems:[1,"edgeContextMenuItems"]},outputs:{nodeHover:"nodeHover",nodeClick:"nodeClick",canvasClick:"canvasClick",contextMenuAction:"contextMenuAction",edgeContextMenuAction:"edgeContextMenuAction"},decls:5,vars:3,consts:[["graphContainer",""],["id","graph","cueResized","",3,"resized"],[1,"node-props-overlay",3,"left","top"],[1,"cy-context-menu",3,"left","top"],[1,"node-props-overlay"],[1,"prop-row"],[1,"prop-key"],[1,"prop-value"],[1,"cy-context-menu"],[1,"cy-context-item"],[1,"cy-context-item",3,"mousedown","click"]],template:function(n,a){if(1&n&&(V.j41(0,"div",1,0),V.bIt("resized",function(){return a.onResize()}),V.nVh(2,v0,3,4,"div",2),V.nVh(3,p0,3,4,"div",3),V.nVh(4,m0,3,4,"div",3),V.k0s()),2&n){let i;V.R7$(2),V.vxM((i=a.hoverNodeOverlay())?2:-1,i),V.R7$(),V.vxM(a.contextMenuVisible()&&a.contextMenuItems().length>0?3:-1),V.R7$(),V.vxM(a.edgeContextMenuVisible()&&a.edgeContextMenuItems().length>0?4:-1)}},dependencies:[c0.C],styles:["[_nghost-%COMP%]{display:contents}#graph[_ngcontent-%COMP%]{display:block!important;text-align:left!important;margin:0!important;min-height:100px;flex:1 1;width:100%;position:relative;overflow:hidden} .box-label{position:absolute;pointer-events:none;display:flex;flex-direction:column;align-items:flex-start;gap:4px}.node-props-overlay[_ngcontent-%COMP%]{position:absolute;transform:translate(-50%,8px);z-index:20;pointer-events:none;background:var(--cue-menu-background-color);color:var(--cue-menu-foreground-color);border:1px solid var(--cue-menu-border-color);border-radius:var(--cue-menu-border-radius);box-shadow:var(--cue-menu-box-shadow);padding:var(--cue-menu-padding-y) var(--cue-menu-padding-x);display:flex;flex-direction:column;gap:8px;min-width:140px;max-width:260px}.prop-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px}.prop-key[_ngcontent-%COMP%]{font-family:Poppins,sans-serif;font-size:.6rem;font-weight:600;color:var(--cue-neutral);text-transform:uppercase;letter-spacing:.05em}.prop-value[_ngcontent-%COMP%]{font-family:Poppins,sans-serif;font-size:.72rem;color:var(--cue-menu-foreground-color);overflow:hidden;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.cy-context-menu[_ngcontent-%COMP%]{position:absolute;z-index:30;background:var(--cue-menu-background-color);color:var(--cue-menu-foreground-color);border:1px solid var(--cue-menu-border-color);border-radius:var(--cue-menu-border-radius);box-shadow:var(--cue-menu-box-shadow);padding:4px 0;min-width:160px;display:flex;flex-direction:column}.cy-context-item[_ngcontent-%COMP%]{background:none;border:none;padding:8px 16px;text-align:left;font-family:Poppins,sans-serif;font-size:.8rem;color:var(--cue-menu-foreground-color);cursor:pointer}.cy-context-item[_ngcontent-%COMP%]:hover{background:var(--cue-menu-hover-color, rgba(0, 0, 0, .06))}"],changeDetection:0})}return r})();const Of=["#2859e1","#4caf50","#fc2626","#f59e0b","#8b5cf6","#06b6d4","#f97316","#14b8a6","#ec4899","#6366f1"],vl="__collapser__",ji="__chain__";var T0=Y(9134),C0=Y(6034),D0=Y(7517),S0=Y(6455),I0=Y(8334),vn=Y(9352),Bf=Y(5971),L0=Y(5448),Ff=Y(3319),A0=Y(9769),Gf=Y(2245),N0=Y(5381),R0=Y(1359);const M0=r=>({$implicit:r,depth:0}),O0=(r,e)=>({$implicit:r,depth:e}),zf=(r,e)=>e.id;function _0(r,e){if(1&r&&V.eu8(0,2),2&r){const t=e.$implicit;V.XpG();const n=V.sdS(4);V.Y8G("ngTemplateOutlet",n)("ngTemplateOutletContext",V.eq3(2,M0,t))}}function P0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-button",8),V.bIt("click",function(){w.eBV(t);const a=V.XpG().$implicit,i=V.XpG();return w.Njj(i.toggleExpand(a.id))}),V.j41(1,"span",9),V.nrm(2,"cue-button-icon",10),V.k0s()()}if(2&r){const t=V.XpG().$implicit,n=V.XpG();V.R7$(),V.AVh("rotate-180",n.isExpanded(t.id))}}function k0(r,e){1&r&&V.nrm(0,"span",5)}function B0(r,e){if(1&r&&V.eu8(0,2),2&r){const t=e.$implicit,n=V.XpG(2).depth;V.XpG();const a=V.sdS(4);V.Y8G("ngTemplateOutlet",a)("ngTemplateOutletContext",V.l_i(2,O0,t,n+1))}}function F0(r,e){if(1&r&&V.Z7z(0,B0,1,5,"ng-container",2,zf),2&r){const t=V.XpG().$implicit,n=V.XpG();V.Dyx(n._sortChildren(t.children))}}function G0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-flexcontainer",3),V.nVh(1,P0,3,2,"cue-button",4)(2,k0,1,0,"span",5),V.j41(3,"cue-checkbox",6),V.bIt("checkedChange",function(){const a=w.eBV(t).$implicit,i=V.XpG();return w.Njj(i.toggle(a))}),V.k0s(),V.j41(4,"cue-typography",7),V.bIt("click",function(){const a=w.eBV(t).$implicit,i=V.XpG();return w.Njj(i.toggle(a))}),V.EFF(5),V.k0s()(),V.nVh(6,F0,2,0)}if(2&r){const t=e.$implicit,n=e.depth,a=V.XpG();V.xc7("padding-left",16*n,"px"),V.R7$(),V.vxM(null!=t.children&&t.children.length?1:2),V.R7$(2),V.Y8G("checked",a.isChecked(t))("indeterminate",a.isIndeterminate(t))("color",t.color),V.R7$(2),V.JRh(t.label),V.R7$(),V.vxM(null!=t.children&&t.children.length&&a.isExpanded(t.id)?6:-1)}}let z0=(()=>{class r{nodes=(0,M.hFB)([]);uncheckedIds=(0,M.geq)(new Set);_expandedIds=(0,w.vPA)(new Set);_seenBranchIds=new Set;_initExpanded=(0,w.QZP)(()=>{const t=new Set,n=a=>{for(const i of a)i.children?.length&&(t.add(i.id),n(i.children))};n(this.nodes()),this._expandedIds.update(a=>{const i=new Set;return t.forEach(s=>{(a.has(s)||!this._seenBranchIds.has(s))&&i.add(s)}),i}),this._seenBranchIds=t});_sortedNodes=(0,T.EW)(()=>this._sortChildren(this.nodes()));_sortChildren(t){return t?[...t].sort((n,a)=>a.weight-n.weight):[]}isExpanded(t){return this._expandedIds().has(t)}toggleExpand(t){this._expandedIds.update(n=>{const a=new Set(n);return a.has(t)?a.delete(t):a.add(t),a})}_descendantIds(t){const n=[t.id];return t.children?.forEach(a=>n.push(...this._descendantIds(a))),n}isChecked(t){const n=this.uncheckedIds();return this._descendantIds(t).every(a=>!n.has(a))}isIndeterminate(t){if(!t.children?.length)return!1;const n=this._descendantIds(t),a=this.uncheckedIds(),i=n.filter(s=>a.has(s)).length;return i>0&&i<n.length}toggle(t){const n=this._descendantIds(t),a=this.isChecked(t);this.uncheckedIds.update(i=>{const s=new Set(i);return n.forEach(o=>a?s.add(o):s.delete(o)),s})}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=V.VBU({type:r,selectors:[["cue-tree-checklist"]],inputs:{nodes:[1,"nodes"],uncheckedIds:[1,"uncheckedIds"]},outputs:{uncheckedIds:"uncheckedIdsChange"},decls:5,vars:0,consts:[["row",""],["direction","column","gap","xs",2,"width","100%"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],["align","center","justify","start","gap","xs",2,"width","100%"],["variant","ghost","size","xs"],[1,"tc-spacer"],["size","s",3,"checkedChange","checked","indeterminate","color"],[2,"cursor","pointer",3,"click"],["variant","ghost","size","xs",3,"click"],[1,"tc-caret"],["icon","arrow-dropdown"]],template:function(n,a){1&n&&(V.j41(0,"cue-flexcontainer",1),V.Z7z(1,_0,1,4,"ng-container",2,zf),V.k0s(),V.DNE(3,G0,7,8,"ng-template",null,0,V.C5r)),2&n&&(V.R7$(),V.Dyx(a._sortedNodes()))},dependencies:[N0.FlexContainer,Gf.Typography,R0.Checkbox,Bf.Button,Ff.ButtonIcon,A0.T3],styles:["[_nghost-%COMP%]{display:block;width:100%}.tc-spacer[_ngcontent-%COMP%]{display:inline-block;width:24px;flex:0 0 auto}.tc-caret[_ngcontent-%COMP%]{display:inline-flex;transition:transform .15s ease}.tc-caret.rotate-180[_ngcontent-%COMP%]{transform:rotate(180deg)}"],changeDetection:0})}return r})();var V0=Y(5187);function H0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-simple-graph",5),V.bIt("nodeHover",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onNodeHover(a))})("nodeClick",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onNodeClick(a))})("canvasClick",function(){w.eBV(t);const a=V.XpG();return w.Njj(a._onCanvasClick())})("contextMenuAction",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onContextMenuAction(a))})("edgeContextMenuAction",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onEdgeContextMenuAction(a))}),V.k0s()}if(2&r){const t=V.XpG();V.Y8G("elements",e)("labelPropsSettings",t.labelPropsSettings())("contextMenuItems",t._nodeMenuItems())("edgeContextMenuItems",t._edgeMenuItems())}}function U0(r,e){1&r&&V.EFF(0," No elements ")}function j0(r,e){if(1&r){const t=V.RV6();V.j41(0,"button",16),V.bIt("click",function(){w.eBV(t);const a=V.XpG(2);return w.Njj(a._entitiesPanelExpanded.set(!a._entitiesPanelExpanded()))}),V.EFF(1),V.nI1(2,"transloco"),V.k0s()}if(2&r){const t=V.XpG(2);V.AVh("active",t._entitiesPanelExpanded()),V.R7$(),V.SpI(" ",V.bMT(2,3,"components.graph.rdf.legendEntities")," ")}}function X0(r,e){if(1&r){const t=V.RV6();V.j41(0,"button",16),V.bIt("click",function(){w.eBV(t);const a=V.XpG(2);return w.Njj(a._relationsPanelExpanded.set(!a._relationsPanelExpanded()))}),V.EFF(1),V.nI1(2,"transloco"),V.k0s()}if(2&r){const t=V.XpG(2);V.AVh("active",t._relationsPanelExpanded()),V.R7$(),V.SpI(" ",V.bMT(2,3,"components.graph.rdf.legendRelationships")," ")}}function W0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-card",14)(1,"div",17)(2,"cue-typography",18),V.EFF(3),V.nI1(4,"transloco"),V.k0s(),V.j41(5,"button",19),V.nI1(6,"transloco"),V.nI1(7,"transloco"),V.bIt("click",function(){w.eBV(t);const a=V.XpG(2);return w.Njj(a._invertCategorySelection())}),V.nrm(8,"cue-button-icon",20),V.k0s()(),V.j41(9,"cue-tree-checklist",21),V.bIt("uncheckedIdsChange",function(a){w.eBV(t);const i=V.XpG(2);return w.Njj(i._onCategoryTreeChange(a))}),V.k0s()()}if(2&r){const t=V.XpG(2);V.Y8G("shadow",!1),V.R7$(3),V.JRh(V.bMT(4,6,"components.graph.rdf.legendEntities")),V.R7$(2),V.BMQ("aria-label",V.bMT(6,8,"components.graph.rdf.labelInvertSelection"))("title",V.bMT(7,10,"components.graph.rdf.labelInvertSelection")),V.R7$(4),V.Y8G("nodes",t._categoryTree())("uncheckedIds",t._categoryUncheckedIds())}}function Y0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-card",14)(1,"div",17)(2,"cue-typography",18),V.EFF(3),V.nI1(4,"transloco"),V.k0s(),V.j41(5,"button",19),V.nI1(6,"transloco"),V.nI1(7,"transloco"),V.bIt("click",function(){w.eBV(t);const a=V.XpG(2);return w.Njj(a._invertPredicateSelection())}),V.nrm(8,"cue-button-icon",20),V.k0s()(),V.j41(9,"cue-tree-checklist",21),V.bIt("uncheckedIdsChange",function(a){w.eBV(t);const i=V.XpG(2);return w.Njj(i._onPredicateTreeChange(a))}),V.k0s()()}if(2&r){const t=V.XpG(2);V.Y8G("shadow",!1),V.R7$(3),V.JRh(V.bMT(4,6,"components.graph.rdf.legendRelationships")),V.R7$(2),V.BMQ("aria-label",V.bMT(6,8,"components.graph.rdf.labelInvertSelection"))("title",V.bMT(7,10,"components.graph.rdf.labelInvertSelection")),V.R7$(4),V.Y8G("nodes",t._relationshipTree())("uncheckedIds",t._predicateUncheckedIds())}}function $0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-button",22),V.bIt("click",function(){w.eBV(t);const a=V.XpG(2);return w.Njj(a._resetAllFilters())}),V.j41(1,"cue-button-label"),V.EFF(2),V.nI1(3,"transloco"),V.k0s()()}2&r&&(V.R7$(2),V.JRh(V.bMT(3,1,"components.graph.rdf.labelResetFilters")))}function q0(r,e){if(1&r){const t=V.RV6();V.j41(0,"div",2)(1,"div",6)(2,"button",7),V.nI1(3,"transloco"),V.bIt("click",function(){w.eBV(t);const a=V.XpG();return w.Njj(a._hierarchyPanelOpen.set(!a._hierarchyPanelOpen()))}),V.j41(4,"span",8),V.nrm(5,"cue-button-icon",9),V.k0s()(),V.j41(6,"div",10)(7,"div",11),V.nVh(8,j0,3,5,"button",12),V.nVh(9,X0,3,5,"button",12),V.k0s(),V.j41(10,"div",13),V.nVh(11,W0,10,12,"cue-card",14),V.nVh(12,Y0,10,12,"cue-card",14),V.k0s(),V.nVh(13,$0,4,3,"cue-button",15),V.k0s()()()}if(2&r){const t=V.XpG();V.R7$(),V.AVh("collapsed",!t._hierarchyPanelOpen()),V.R7$(),V.BMQ("aria-label",V.bMT(3,10,"components.graph.rdf.legendTitle")),V.R7$(2),V.AVh("rotate-180",t._hierarchyPanelOpen()),V.R7$(4),V.vxM(t._categoryTree().length>0?8:-1),V.R7$(),V.vxM(t._relationshipTree().length>0?9:-1),V.R7$(2),V.vxM(t._categoryTree().length>0&&t._entitiesPanelExpanded()?11:-1),V.R7$(),V.vxM(t._relationshipTree().length>0&&t._relationsPanelExpanded()?12:-1),V.R7$(),V.vxM(t._hasActiveFilters()?13:-1)}}function K0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-draggable-card",23),V.nI1(1,"transloco"),V.bIt("clickedClose",function(){w.eBV(t);const a=V.XpG();return w.Njj(a._tabbedLegendClosed.set(!0))}),V.j41(2,"cue-tabs",24)(3,"cue-tab",25),V.nI1(4,"transloco"),V.j41(5,"div",26)(6,"cue-layer-legend",27),V.bIt("visibilityAll",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onCategoryVisibilityAll(a))})("layerChange",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onCategoryLayerChange(a))}),V.k0s()()(),V.j41(7,"cue-tab",25),V.nI1(8,"transloco"),V.j41(9,"div",26)(10,"cue-layer-legend",27),V.bIt("visibilityAll",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onPredicateVisibilityAll(a))})("layerChange",function(a){w.eBV(t);const i=V.XpG();return w.Njj(i._onPredicateLayerChange(a))}),V.k0s()()()()()}if(2&r){const t=V.XpG();V.Y8G("label",V.bMT(1,7,"components.graph.rdf.legendTitle"))("padded",!1)("position",t.legendPosition()),V.R7$(3),V.Y8G("label",V.bMT(4,9,"components.graph.rdf.legendEntities")),V.R7$(3),V.Y8G("layers",t._categoryLayers()),V.R7$(),V.Y8G("label",V.bMT(8,11,"components.graph.rdf.legendRelationships")),V.R7$(3),V.Y8G("layers",t._predicateLayers())}}function Z0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-color-legend-panel",29),V.nI1(1,"transloco"),V.bIt("close",function(){w.eBV(t);const a=V.XpG(2);return w.Njj(a._legendClosed.set(!0))})("layerChange",function(a){w.eBV(t);const i=V.XpG(2);return w.Njj(i._onCategoryLayerChange(a))})("visibilityAll",function(a){w.eBV(t);const i=V.XpG(2);return w.Njj(i._onCategoryVisibilityAll(a))}),V.k0s()}if(2&r){const t=V.XpG(2);V.Y8G("title",V.bMT(1,2,"components.graph.rdf.legendCategories"))("layers",t._categoryLayers())}}function J0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-button",32),V.bIt("click",function(){w.eBV(t);const a=V.XpG(3);return w.Njj(a._unhideAllPredicates())}),V.j41(1,"cue-button-label"),V.EFF(2),V.nI1(3,"transloco"),V.k0s()()}2&r&&(V.xc7("position","absolute")("top","2.5rem")("right","0.5rem"),V.R7$(2),V.JRh(V.bMT(3,7,"components.graph.rdf.labelUnhideEdges")))}function Q0(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-color-legend-panel",30),V.nI1(1,"transloco"),V.bIt("close",function(){w.eBV(t);const a=V.XpG(2);return w.Njj(a._predicateLegendClosed.set(!0))})("layerChange",function(a){w.eBV(t);const i=V.XpG(2);return w.Njj(i._onPredicateLayerChange(a))})("visibilityAll",function(a){w.eBV(t);const i=V.XpG(2);return w.Njj(i._onPredicateVisibilityAll(a))}),V.k0s(),V.nVh(2,J0,4,9,"cue-button",31)}if(2&r){const t=V.XpG(2);V.Y8G("title",V.bMT(1,4,"components.graph.rdf.legendRelationships"))("layers",t._predicateLayers())("position",t.legendPosition()),V.R7$(2),V.vxM(t._anyPredicateHidden()?2:-1)}}function eb(r,e){if(1&r&&(V.nVh(0,Z0,2,4,"cue-color-legend-panel",28),V.nVh(1,Q0,3,6)),2&r){const t=V.XpG();V.vxM(t.colorByCategory()&&t._categoryLayers().length>0&&!t._legendClosed()?0:-1),V.R7$(),V.vxM(t.showRelationshipLegend()&&t._predicateLayers().length>0&&!t._predicateLegendClosed()?1:-1)}}function tb(r,e){if(1&r){const t=V.RV6();V.j41(0,"cue-button",33),V.bIt("click",function(){w.eBV(t);const a=V.XpG();return w.Njj(a._resetIsolation())}),V.j41(1,"cue-button-label"),V.EFF(2),V.nI1(3,"transloco"),V.k0s()()}2&r&&(V.xc7("position","absolute")("bottom","0.5rem")("right","0.5rem"),V.R7$(2),V.JRh(V.bMT(3,7,"components.graph.rdf.labelResetIsolation")))}let rb=(()=>{class r{_graph=(0,M.ebz)(hl);doc=(0,M.hFB)();collapseClasses=(0,M.hFB)(!0);collapseAttributes=(0,M.hFB)(!0);collapseRelationships=(0,M.hFB)(!0);classPredicates=(0,M.hFB)([]);focusNodes=(0,M.hFB)([]);focusNodeColor=(0,M.hFB)("red");zoomToFocusNodes=(0,M.hFB)(!1);colorByCategory=(0,M.hFB)(!1);showRelationshipLegend=(0,M.hFB)(!1);legendPosition=(0,M.hFB)("top-left");tabbedLegend=(0,M.hFB)(!1);categoryLabelsOnHover=(0,M.hFB)(!0);showFocusMenuItem=(0,M.hFB)(!0);nodeMenuItems=(0,M.hFB)(void 0);edgeMenuItems=(0,M.hFB)(void 0);edgeWidths=(0,M.hFB)({});nodeSizes=(0,M.hFB)({});categoryHierarchy=(0,M.hFB)([]);relationshipHierarchy=(0,M.hFB)([]);nodeHover=(0,M.CGW)();nodeClick=(0,M.CGW)();canvasClick=(0,M.CGW)();_fullElements=null;_collapserGroups=[];_chainGroups=[];_focusedNodeId=void 0;_hiddenNodeIds=new Set;_categoryColors=new Map;_labelFocusOnNeighbours=(0,vn.Xx)("components.graph.rdf.labelFocusOnNeighbours");_labelIsolateNode=(0,vn.Xx)("components.graph.rdf.labelIsolateNode");_labelUnhideEdges=(0,vn.Xx)("components.graph.rdf.labelUnhideEdges");_labelHideEdgeType=(0,vn.Xx)("components.graph.rdf.labelHideEdgeType");_labelCollapseRelationship=(0,vn.Xx)("components.graph.rdf.labelCollapseRelationship");_labelExpandMore=(0,vn.Xx)("components.graph.rdf.labelExpandMore");_labelCollapseExpanded=(0,vn.Xx)("components.graph.rdf.labelCollapseExpanded");_hoveredNode=(0,w.vPA)(null);_isolatedNodeId=(0,w.vPA)(void 0);_nodeMenuItems=(0,T.EW)(()=>{const t=this.nodeMenuItems();if(void 0!==t)return t;const n=this._hoveredNode()?.id,a=!!n&&this._collapserGroups.some(d=>d.allTargetNodeIds.includes(n)),i=n?this._collapserGroups.find(d=>d.id===n):void 0,s=!!i&&i.visibleCount>0,o=!!i&&i.visibleCount<i.allTargetNodeIds.length,l=n?this._chainGroups.find(d=>d.id===n):void 0,u=!!l&&l.visibleCount>0,c=!!l&&l.visibleCount<l.hiddenNodeIds.length;return[...this.showFocusMenuItem()?[{id:"focus",label:this._labelFocusOnNeighbours()}]:[],{id:"isolate",label:this._labelIsolateNode()},...this._anyPredicateHidden()?[{id:"unhide-edges",label:this._labelUnhideEdges()}]:[],...o||c?[{id:"expand-more",label:this._labelExpandMore()}]:[],...s||u?[{id:"collapse-expanded",label:this._labelCollapseExpanded()}]:[],...a?[{id:"collapse-relationship",label:this._labelCollapseRelationship()}]:[]]});_edgeMenuItems=(0,T.EW)(()=>{const t=this.edgeMenuItems();return void 0!==t?t:[{id:"hide-edge-type",label:this._labelHideEdgeType()}]});elements=(0,w.vPA)(void 0);_survivingCategoryLabels=(0,w.vPA)(new Set);_survivingPredicateLabels=(0,w.vPA)(new Set);_categoryLayers=(0,w.vPA)([]);_legendClosed=(0,w.vPA)(!1);_predicateLayers=(0,w.vPA)([]);_predicateLegendClosed=(0,w.vPA)(!1);_nodeLayers=(0,w.vPA)([]);_tabbedLegendClosed=(0,w.vPA)(!1);_entitiesPanelExpanded=(0,w.vPA)(!0);_relationsPanelExpanded=(0,w.vPA)(!0);_hierarchyPanelOpen=(0,w.vPA)(!0);_anyPredicateHidden=(0,T.EW)(()=>this._predicateLayers().some(t=>!t.visible));_hasHierarchyData=(0,T.EW)(()=>this.categoryHierarchy().length>0||this.relationshipHierarchy().length>0);_categoryLayersActive=(0,T.EW)(()=>this._categoryLayers().length>0);_effectiveCategoryLayers=(0,T.EW)(()=>this._categoryLayersActive()?this._categoryLayers():this._nodeLayers());_categoryTree=(0,T.EW)(()=>this._buildHierarchyTree(this._effectiveCategoryLayers(),this.categoryHierarchy()));_relationshipTree=(0,T.EW)(()=>this._buildHierarchyTree(this._predicateLayers(),this.relationshipHierarchy()));_categoryUncheckedIds=(0,T.EW)(()=>this._uncheckedGroupIds(this._effectiveCategoryLayers(),this._survivingCategoryLabels()));_predicateUncheckedIds=(0,T.EW)(()=>this._uncheckedGroupIds(this._predicateLayers(),this._survivingPredicateLabels()));_hasActiveFilters=(0,T.EW)(()=>void 0!==this._isolatedNodeId()||this._categoryUncheckedIds().size>0||this._predicateUncheckedIds().size>0);_layerIdentity(t){return t.iri?t.iri.replace(/~\d+$/,""):t.label}_groupLayersByIdentity(t){const n=new Map;return t.forEach(a=>{const i=this._layerIdentity(a),s=n.get(i);s?s.push(a):n.set(i,[a])}),n}_uncheckedGroupIds(t,n){const a=new Set;return this._groupLayersByIdentity(t).forEach((i,s)=>{const o=i.every(u=>!u.visible),l=!i.some(u=>n.has(u.label));(o||l)&&a.add(s)}),a}_buildHierarchyTree(t,n){if(0===n.length)return[];const a=new Map(n.map(f=>[f.matchIri??f.label,f])),i=this._groupLayersByIdentity(t),s=new Map,o=[],l=new Set,c=f=>{if(l.has(f))return;l.add(f);const h=(f=>{let h=s.get(f);if(!h){const v=a.get(f),b=i.get(f);h={id:f,label:v?.label??b?.[0]?.label??f,weight:v?.weight??0,children:[]},s.set(f,h)}return h})(f),v=a.get(f)?.parentLabel,b=v?n.find(p=>p.label===v)?.matchIri??v:void 0;if(b&&b!==f){c(b);const p=s.get(b);p.children.includes(h)||p.children.push(h)}else o.push(h)};i.forEach((f,h)=>c(h));const d=f=>{const h=(f.children??[]).reduce((v,b)=>v+d(b),0);return f.children?.length||delete f.children,f.weight+=h,f.weight};return o.forEach(d),o}_onCategoryTreeChange(t){this._categoryLayersActive()?this._categoryLayers.update(n=>n.map(a=>({...a,visible:!t.has(this._layerIdentity(a))}))):(this._nodeLayers.update(n=>n.map(a=>({...a,visible:!t.has(this._layerIdentity(a))}))),this._syncHiddenNodeIds()),this._recomputeElements()}_invertCategorySelection(){const t=this._categoryUncheckedIds();this._categoryLayersActive()?this._categoryLayers.update(n=>n.map(a=>({...a,visible:t.has(this._layerIdentity(a))}))):(this._nodeLayers.update(n=>n.map(a=>({...a,visible:t.has(this._layerIdentity(a))}))),this._syncHiddenNodeIds()),this._recomputeElements()}_invertPredicateSelection(){const t=this._predicateUncheckedIds();this._predicateLayers.update(n=>n.map(a=>({...a,visible:t.has(this._layerIdentity(a))}))),this._recomputeElements()}_onPredicateTreeChange(t){this._predicateLayers.update(n=>n.map(a=>({...a,visible:!t.has(this._layerIdentity(a))}))),this._recomputeElements()}_unhideAllPredicates(){this._predicateLayers.update(t=>t.map(n=>({...n,visible:!0}))),this._recomputeElements()}_resetIsolation(){this._isolatedNodeId.set(void 0),this._recomputeElements()}_resetAllFilters(){this._isolatedNodeId.set(void 0),this._categoryLayers.update(t=>t.map(n=>({...n,visible:!0}))),this._nodeLayers.update(t=>t.map(n=>({...n,visible:!0}))),this._predicateLayers.update(t=>t.map(n=>({...n,visible:!0}))),this._hiddenNodeIds.clear(),this._recomputeElements()}onDoc=(0,w.QZP)((()=>{var t=this;return(0,Z.A)(function*(){const n=t.doc();if(void 0===n)return;const a=new N;a.hideClassAssignmentTriples=t.collapseClasses(),a.hideDatatypePropertyTriples=t.collapseAttributes(),a.collapseIntoClassificationLabels=t.classPredicates(),a.edgeWidths=t.edgeWidths(),a.nodeSizes=t.nodeSizes();const i=new D(n,a);let s;try{s=yield i.init(),console.log("[rdf-graph onDoc] elements:",s.nodes.length,"nodes,",s.edges.length,"edges")}catch(l){return void console.error("[rdf-graph onDoc] CytoscapeJSONLD.init() threw:",l)}t._fullElements=s,t._collapserGroups=t.collapseRelationships()?function x0(r){const e=new Map,t=new Map;for(const i of r.edges)i.data.target&&e.set(i.data.target,(e.get(i.data.target)??0)+1),i.data.source&&t.set(i.data.source,(t.get(i.data.source)??0)+1);const n=new Map;for(const i of r.edges){const s=`${i.data.source}\0${i.data.label}`;n.has(s)||n.set(s,[]),n.get(s).push(i)}const a=[];for(const[i,s]of n){if(s.length<4)continue;const o=i.indexOf("\0"),l=i.slice(0,o),u=i.slice(o+1),c=s.map(d=>d.data.target).filter(d=>d&&1===(e.get(d)??0)&&0===(t.get(d)??0));c.length<4||a.push({id:`${vl}${l}\0${u}`,sourceId:l,predicateLabel:u,allTargetNodeIds:c,visibleCount:0})}return a}(s):[],t._chainGroups=function w0(r){const e=new Map,t=new Map;for(const u of r.nodes)e.set(u.data.id,[]),t.set(u.data.id,[]);for(const u of r.edges)e.get(u.data.source)?.push(u),u.data.target&&t.get(u.data.target)?.push(u);const n=new Map,a=(u,c=new Set)=>{if(n.has(u))return n.get(u);if(c.has(u))return 0;c.add(u);const h=1+(e.get(u)??[]).reduce((v,b)=>Math.max(v,b.data.target?a(b.data.target,c):0),0);return n.set(u,h),h};for(const u of r.nodes)a(u.data.id);const i=new Set,s=[...r.nodes].sort((u,c)=>(n.get(c.data.id)??0)-(n.get(u.data.id)??0));for(const u of s){if(i.size>=20)break;let c=u.data.id;for(;c&&!i.has(c)&&i.size<20;)i.add(c),c=(e.get(c)??[]).filter(f=>f.data.target&&!i.has(f.data.target)).sort((f,h)=>(n.get(h.data.target)??0)-(n.get(f.data.target)??0))[0]?.data.target}const o=new Set(r.nodes.map(u=>u.data.id).filter(u=>!i.has(u)));if(0===o.size)return[];const l=new Map;for(const u of i)for(const c of e.get(u)??[]){if(!c.data.target||!o.has(c.data.target))continue;const d=`${u}\0${c.data.label??""}`;l.has(d)||l.set(d,{id:`${ji}${u}\0${c.data.label??""}`,sourceId:u,predicateLabel:c.data.label??"",hiddenNodeIds:[],visibleCount:0});const f=l.get(d);let h=c.data.target;for(;h&&o.has(h)&&!f.hiddenNodeIds.includes(h);)f.hiddenNodeIds.push(h),o.delete(h),h=(e.get(h)??[]).filter(b=>b.data.target&&o.has(b.data.target)).sort((b,p)=>(n.get(p.data.target)??0)-(n.get(b.data.target)??0))[0]?.data.target}return o.size>0&&l.set("__orphan__",{id:`${ji}__orphan__`,sourceId:s[0]?.data.id??"",predicateLabel:"",hiddenNodeIds:[...o],visibleCount:0}),[...l.values()].filter(u=>u.hiddenNodeIds.length>0)}(s),t._categoryLayers.set(t._buildCategoryLayers(s)),t._predicateLayers.set(t._buildPredicateLayers(s)),t._nodeLayers.set(t._buildNodeLayers(s)),t._hiddenNodeIds.clear(),t._legendClosed.set(!1),t._predicateLegendClosed.set(!1),t._tabbedLegendClosed.set(!1),t._isolatedNodeId.set(void 0),t._recomputeElements();const o=t.focusNodes();o.length>0&&t.zoomToFocusNodes()&&setTimeout(()=>t._graph()?.fitTo(o),450)})})());focusEffect=(0,w.QZP)(()=>{const t=this.focusNodes();this._fullElements&&(this._recomputeElements(),t.length>0&&this.zoomToFocusNodes()&&setTimeout(()=>this._graph()?.fitTo(t),200))});triggerResize(){const t=this._graph();if(t){const n=t._cy();n.resize(),setTimeout(()=>{const a=n.container(),i=a?.offsetWidth||0,s=a?.offsetHeight||0;if(i>=100&&s>=100){n.resize();const o=n.elements();if(o.length>0){const l=o.nodes();if(!(l.length>0&&l.every(J=>{const K=J.position();return 0!==K.x||0!==K.y}))){const J=this._graph();return void(J&&J._build?.())}const c=Math.min(i,s),d=Math.min(Math.max(.15*c,40),120),f=o.boundingBox(),C=Math.min((i-2*d)/(f.w||1),(s-2*d)/(f.h||1)),A=o.nodes().length,z=o.edges().length,H=A>0?2*z/A:1;let F=2.5;H>10?F=1:H>6?F=1.5:H>3&&(F=2);const $=Math.min(Math.max(C,.2),F);n.animate($!==C?{zoom:$,center:{eles:o},duration:300}:{fit:{eles:o,padding:d},duration:300})}}else console.warn("\u{1f3af} RDFGraph: container too small or invalid dimensions, skipping fit")},150)}}colorByCategoryEffect=(0,w.QZP)(()=>{this.colorByCategory()&&this._legendClosed.set(!1),this._fullElements&&this._recomputeElements()});showRelationshipLegendEffect=(0,w.QZP)(()=>{this.showRelationshipLegend()&&this._predicateLegendClosed.set(!1)});labelPropsSettings=(0,T.EW)(()=>{const t=new G;return t.boxLabels.display=this.collapseClasses(),t.props.display=this.collapseAttributes(),t.boxLabels.displayOnlyOnHover=this.colorByCategory()||this.categoryLabelsOnHover(),t});_onNodeHover(t){t&&this._hoveredNode.set(t),this.nodeHover.emit(t)}_onNodeClick(t){const n=t;if(n.isCollapser&&n.collapserGroupId){const a=this._collapserGroups.find(i=>i.id===n.collapserGroupId);if(a){const i=Math.min(a.visibleCount+5,a.allTargetNodeIds.length);return void(i!==a.visibleCount&&(a.visibleCount=i,this._recomputeElements()))}}if(n.isChainExpander&&n.chainGroupId){const a=this._chainGroups.find(i=>i.id===n.chainGroupId);if(a){const i=Math.min(a.visibleCount+5,a.hiddenNodeIds.length);return void(i!==a.visibleCount&&(a.visibleCount=i,this._recomputeElements()))}}this.nodeClick.emit(t)}_onCanvasClick(){this.canvasClick.emit(),this._focusedNodeId&&(this._focusedNodeId=void 0,this._recomputeElements())}_onContextMenuAction(t){const n=this.nodeMenuItems();if(void 0===n){if("focus"===t.actionId){const a=t.node.id;this._focusedNodeId=this._focusedNodeId===a?void 0:a,this._recomputeElements()}else if("isolate"===t.actionId)this._isolatedNodeId.set(t.node.id),this._recomputeElements();else if("unhide-edges"===t.actionId)this._unhideAllPredicates();else if("expand-more"===t.actionId){const a=t.node.id,i=this._collapserGroups.find(o=>o.id===a);i&&(i.visibleCount=Math.min(i.visibleCount+5,i.allTargetNodeIds.length));const s=this._chainGroups.find(o=>o.id===a);s&&(s.visibleCount=Math.min(s.visibleCount+5,s.hiddenNodeIds.length)),this._recomputeElements()}else if("collapse-expanded"===t.actionId){const a=t.node.id,i=this._collapserGroups.find(o=>o.id===a);i&&(i.visibleCount=0);const s=this._chainGroups.find(o=>o.id===a);s&&(s.visibleCount=0),this._recomputeElements()}else if("collapse-relationship"===t.actionId){const a=t.node.id;for(const i of this._collapserGroups)i.allTargetNodeIds.includes(a)&&(i.visibleCount=0);this._recomputeElements()}}else n.find(a=>a.id===t.actionId)?.action(t.node)}_onEdgeContextMenuAction(t){const n=this.edgeMenuItems();void 0===n?"hide-edge-type"===t.actionId&&(this._predicateLayers.update(a=>a.map(i=>i.label===t.edgeLabel?{...i,visible:!1}:i)),this._recomputeElements()):n.find(a=>a.id===t.actionId)?.action(t.edge)}_onCategoryLayerChange(t){this._categoryLayers.update(n=>[...n]),this._recomputeElements()}_onCategoryVisibilityAll(t){this._categoryLayers.update(n=>[...n]),this._recomputeElements()}_onPredicateLayerChange(t){this._predicateLayers.update(n=>[...n]),this._recomputeElements()}_onPredicateVisibilityAll(t){this._predicateLayers.update(n=>[...n]),this._recomputeElements()}_onNodeLayerChange(t){this._syncHiddenNodeIds(),this._nodeLayers.update(n=>[...n]),this._recomputeElements()}_onNodeVisibilityAll(t){this._syncHiddenNodeIds(),this._nodeLayers.update(n=>[...n]),this._recomputeElements()}_syncHiddenNodeIds(){this._hiddenNodeIds.clear();for(const t of this._nodeLayers())t.visible||this._hiddenNodeIds.add(t.label)}static _PREDICATE_COLOR="#4a90d9";_buildPredicateLayers(t){const n=new Map,a=[];for(const i of t.edges){const s=i.data.label??"";s&&!n.has(s)&&(n.set(s,i.data.iri),a.push(s))}return a.map(i=>({label:i,color:r._PREDICATE_COLOR,visible:!0,iri:n.get(i)}))}_buildCategoryLayers(t){const n=new Set,a=[];for(const i of t.nodes){if(i.data.id.startsWith(vl)||i.data.id.startsWith(ji))continue;const s=i.data.boxLabels?.[0];s&&!n.has(s)&&(n.add(s),a.push(s))}return this._categoryColors=function b0(r){const e=new Map;return r.forEach((t,n)=>{e.set(t,Of[n%Of.length])}),e}(a),a.map(i=>({label:i,color:this._categoryColors.get(i),visible:!0}))}_buildNodeLayers(t){const n=new Set,a=[];for(const i of t.nodes){if(i.data.id.startsWith(vl)||i.data.id.startsWith(ji))continue;const s=i.data.label||i.data.id,o=i.data.boxLabels?.[0],l=o?this._categoryColors.get(o):void 0;s&&!n.has(s)&&(n.add(s),a.push({label:s,color:l,visible:!0}))}return a.sort((i,s)=>i.label.localeCompare(s.label))}_recomputeElements(){this.elements.set(this._display());const t=this._computeSurvivingLabels();this._survivingCategoryLabels.set(t.categories),this._survivingPredicateLabels.set(t.predicates)}_computeSurvivingLabels(){const t=this._fullElements;if(!t)return{categories:new Set,predicates:new Set};let n=t.nodes,a=t.edges;const i=new Set(this._predicateLayers().filter(c=>!c.visible).map(c=>c.label));if(i.size>0){a=a.filter(d=>!i.has(d.data.label??""));const c=new Set;a.forEach(d=>{c.add(d.data.source),c.add(d.data.target)}),n=n.filter(d=>c.has(d.data.id))}if(this._hiddenNodeIds.size>0){n=n.filter(d=>!this._hiddenNodeIds.has(d.data.label||d.data.id));const c=new Set(n.map(d=>d.data.id));a=a.filter(d=>c.has(d.data.source)&&c.has(d.data.target))}const s=new Set(this._categoryLayers().filter(c=>!c.visible).map(c=>c.label));if(s.size>0){n=n.filter(d=>{const f=d.data.boxLabels?.[0];return void 0===f||!s.has(f)});const c=new Set(n.map(d=>d.data.id));a=a.filter(d=>c.has(d.data.source)&&c.has(d.data.target))}const o=this._isolatedNodeId();if(o){const c=new Set([o]);a.forEach(d=>{d.data.source===o&&c.add(d.data.target??""),d.data.target===o&&c.add(d.data.source)}),n=n.filter(d=>c.has(d.data.id)),a=a.filter(d=>c.has(d.data.source)&&c.has(d.data.target??""))}const l=new Set;this._categoryLayersActive()?n.forEach(c=>{const d=c.data.boxLabels?.[0];d&&l.add(d)}):n.forEach(c=>{const d=c.data.label||c.data.id;d&&l.add(d)});const u=new Set;return a.forEach(c=>{c.data.label&&u.add(c.data.label)}),{categories:l,predicates:u}}_display(){if(!this._fullElements)return{nodes:[],edges:[]};let t=function E0(r,e,t){const n=new Set,a=new Set,i=[],s=[];for(const l of t){const u=l.hiddenNodeIds.length-l.visibleCount;if(u<2)continue;for(const f of l.hiddenNodeIds.slice(l.visibleCount))n.add(f);const c=l.visibleCount>0,d=c?l.hiddenNodeIds[l.visibleCount-1]:l.sourceId;i.push({data:{id:l.id,label:`+${u}`,size:28,isChainExpander:!0,isExpanded:c,chainGroupId:l.id},classes:c?"collapser collapser-expanded":"collapser"}),s.push({data:{id:`edge_${l.id}`,source:d,target:l.id,label:l.predicateLabel}})}for(const l of e){const u=l.allTargetNodeIds.length-l.visibleCount;if(u<2)continue;for(const f of l.allTargetNodeIds.slice(l.visibleCount))n.add(f);const c=r.edges.filter(f=>f.data.source===l.sourceId&&f.data.label===l.predicateLabel&&l.allTargetNodeIds.includes(f.data.target));for(const f of c)a.add(f.data.id??"");for(const f of c)l.allTargetNodeIds.indexOf(f.data.target)<l.visibleCount&&s.push(f);const d=l.visibleCount>0;i.push({data:{id:l.id,label:`+${u}`,size:28,isCollapser:!0,isExpanded:d,collapserGroupId:l.id},classes:d?"collapser collapser-expanded":"collapser"}),s.push({data:{id:`edge_${l.id}`,source:l.sourceId,target:l.id,label:l.predicateLabel}})}const o=new Set(i.map(l=>l.data.id));return{nodes:[...r.nodes.filter(l=>!n.has(l.data.id)),...i],edges:[...r.edges.filter(l=>!(a.has(l.data.id??"")||n.has(l.data.source)||n.has(l.data.target??"")||o.has(l.data.source)||o.has(l.data.target??""))),...s]}}(this._fullElements,this._collapserGroups,this._chainGroups);const n=new Set(this._predicateLayers().filter(l=>!l.visible).map(l=>l.label));if(n.size>0){const l=t.edges.filter(c=>!n.has(c.data.label??"")),u=new Set;for(const c of l)u.add(c.data.source),u.add(c.data.target);t={nodes:t.nodes.filter(c=>u.has(c.data.id)),edges:l}}if(this._hiddenNodeIds.size>0){const l=new Map(this._fullElements.nodes.map(d=>[d.data.id,d.data.label||d.data.id])),u=d=>this._hiddenNodeIds.has(l.get(d)??""),c=new Set(t.nodes.filter(d=>this._hiddenNodeIds.has(d.data.label||d.data.id)).map(d=>d.data.id));for(const d of this._collapserGroups)d.allTargetNodeIds.every(u)&&c.add(d.id);for(const d of this._chainGroups){const f=d.hiddenNodeIds.slice(d.visibleCount);f.length>0&&f.every(u)&&c.add(d.id)}c.size>0&&(t={nodes:t.nodes.filter(d=>!c.has(d.data.id)),edges:t.edges.filter(d=>!c.has(d.data.source)&&!c.has(d.data.target))})}const a=new Set(this._categoryLayers().filter(l=>!l.visible).map(l=>l.label));if(a.size>0){const l=new Map(this._fullElements.nodes.map(d=>[d.data.id,d.data.boxLabels?.[0]])),u=d=>{const f=l.get(d);return void 0!==f&&a.has(f)},c=new Set(t.nodes.filter(d=>{const f=d.data.boxLabels?.[0];return void 0!==f&&a.has(f)}).map(d=>d.data.id));for(const d of this._collapserGroups)d.allTargetNodeIds.every(u)&&c.add(d.id);for(const d of this._chainGroups){const f=d.hiddenNodeIds.slice(d.visibleCount);f.length>0&&f.every(u)&&c.add(d.id)}t={nodes:t.nodes.filter(d=>!c.has(d.data.id)),edges:t.edges.filter(d=>!c.has(d.data.source)&&!c.has(d.data.target))}}this.colorByCategory()&&(t={...t,nodes:t.nodes.map(l=>{const u=l.data.boxLabels?.[0],c=u?this._categoryColors.get(u):void 0;return c?{...l,data:{...l.data,color:c}}:l})});const i=this._isolatedNodeId();i&&(t=this._applyIsolation(t,i)),this._focusedNodeId&&(t=this._applyFocus(t,this._focusedNodeId));const s=new Set(this.focusNodes()),o=this.focusNodeColor();return s.size>0&&(t={...t,nodes:t.nodes.map(l=>{if(!s.has(l.data.id))return l;const u=l.classes?l.classes.trim():"";return{...l,data:{...l.data,color:o},classes:u?`${u} focused`:"focused"}})}),t}_applyIsolation(t,n){const a=new Set([n]);for(const i of t.edges)i.data.source===n&&a.add(i.data.target??""),i.data.target===n&&a.add(i.data.source);return{nodes:t.nodes.filter(i=>a.has(i.data.id)),edges:t.edges.filter(i=>a.has(i.data.source)&&a.has(i.data.target??""))}}_applyFocus(t,n){return{...t,nodes:t.nodes.map(a=>{if(a.data.id!==n)return a;const i=a.classes?a.classes.trim():"";return{...a,classes:i?`${i} focused`:"focused"}})}}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=V.VBU({type:r,selectors:[["cue-rdf-graph"]],viewQuery:function(n,a){1&n&&V.wEZ(a._graph,hl,5),2&n&&V.NyB()},inputs:{doc:[1,"doc"],collapseClasses:[1,"collapseClasses"],collapseAttributes:[1,"collapseAttributes"],collapseRelationships:[1,"collapseRelationships"],classPredicates:[1,"classPredicates"],focusNodes:[1,"focusNodes"],focusNodeColor:[1,"focusNodeColor"],zoomToFocusNodes:[1,"zoomToFocusNodes"],colorByCategory:[1,"colorByCategory"],showRelationshipLegend:[1,"showRelationshipLegend"],legendPosition:[1,"legendPosition"],tabbedLegend:[1,"tabbedLegend"],categoryLabelsOnHover:[1,"categoryLabelsOnHover"],showFocusMenuItem:[1,"showFocusMenuItem"],nodeMenuItems:[1,"nodeMenuItems"],edgeMenuItems:[1,"edgeMenuItems"],edgeWidths:[1,"edgeWidths"],nodeSizes:[1,"nodeSizes"],categoryHierarchy:[1,"categoryHierarchy"],relationshipHierarchy:[1,"relationshipHierarchy"]},outputs:{nodeHover:"nodeHover",nodeClick:"nodeClick",canvasClick:"canvasClick"},decls:7,vars:3,consts:[[2,"display","flex","flex-direction","column","position","relative","width","100%","flex","1","min-height","0"],[3,"elements","labelPropsSettings","contextMenuItems","edgeContextMenuItems"],[1,"hierarchy-panel"],[3,"label","padded","position"],["variant","ghost","size","s",1,"isolation-reset-btn",3,"position","bottom","right"],[3,"nodeHover","nodeClick","canvasClick","contextMenuAction","edgeContextMenuAction","elements","labelPropsSettings","contextMenuItems","edgeContextMenuItems"],[1,"hp-panel-row"],["type","button",1,"hp-edge-toggle",3,"click"],[1,"hp-edge-arrow"],["icon","arrow-back"],[1,"hp-panel-inner"],[1,"hp-pill-row"],["type","button",1,"hp-pill",3,"active"],[1,"hp-panel-body"],["variant","secondary",1,"hp-subcard",3,"shadow"],["variant","secondary","size","s",1,"hp-reset-btn"],["type","button",1,"hp-pill",3,"click"],[1,"hp-section-label"],["size","xs","weight","semibold"],["type","button",1,"hp-invert-btn",3,"click"],["icon","arrow-up-down"],[3,"uncheckedIdsChange","nodes","uncheckedIds"],["variant","secondary","size","s",1,"hp-reset-btn",3,"click"],[3,"clickedClose","label","padded","position"],[1,"legend-tabs"],[3,"label"],[1,"legend-content"],[3,"visibilityAll","layerChange","layers"],["position","top-right",3,"title","layers"],["position","top-right",3,"close","layerChange","visibilityAll","title","layers"],[3,"close","layerChange","visibilityAll","title","layers","position"],["variant","ghost","size","s",1,"unhide-btn",3,"position","top","right"],["variant","ghost","size","s",1,"unhide-btn",3,"click"],["variant","ghost","size","s",1,"isolation-reset-btn",3,"click"]],template:function(n,a){if(1&n&&(V.j41(0,"div",0),V.nVh(1,H0,1,4,"cue-simple-graph",1)(2,U0,1,0),V.nVh(3,q0,14,12,"div",2)(4,K0,11,13,"cue-draggable-card",3)(5,eb,2,2),V.nVh(6,tb,4,9,"cue-button",4),V.k0s()),2&n){let i,s;V.R7$(),V.vxM((i=a.elements())?1:2,i),V.R7$(2),V.vxM(a._hasHierarchyData()?3:a.tabbedLegend()&&!a._tabbedLegendClosed()?4:5),V.R7$(3),V.vxM((s=a._isolatedNodeId())?6:-1,s)}},dependencies:[hl,T0.v,C0.y,D0.P,S0.t,I0.o,Bf.Button,L0.ButtonLabel,Ff.ButtonIcon,z0,V0.Card,Gf.Typography,vn.Kj],styles:["[_nghost-%COMP%]{display:contents}.legend-tabs[_ngcontent-%COMP%]{width:180px}.legend-content[_ngcontent-%COMP%]{padding:4px 10px 24px;font-size:.8em;max-height:200px;overflow:auto}.hierarchy-panel[_ngcontent-%COMP%]{position:absolute;top:0;right:0;height:100%;width:288px;max-width:100%;z-index:40;overflow:hidden;pointer-events:none}.hp-panel-row[_ngcontent-%COMP%]{display:flex;align-items:stretch;height:100%;width:288px;transition:transform .22s cubic-bezier(.4,0,.2,1)}.hp-panel-row.collapsed[_ngcontent-%COMP%]{transform:translate(260px)}.hp-edge-toggle[_ngcontent-%COMP%]{flex:0 0 28px;width:28px;align-self:center;height:48px;border:1px solid var(--cue-card-border-color);border-right:none;border-radius:6px 0 0 6px;background:var(--cue-primary);color:var(--cue-primaryContrast);display:flex;align-items:center;justify-content:center;cursor:pointer;pointer-events:auto;box-shadow:-2px 0 8px #00000026}.hp-edge-arrow[_ngcontent-%COMP%]{display:inline-flex;transition:transform .2s ease}.hp-edge-arrow.rotate-180[_ngcontent-%COMP%]{transform:rotate(180deg)}.hp-panel-inner[_ngcontent-%COMP%]{position:relative;flex:0 0 260px;width:260px;height:100%;background:var(--cue-primary);color:var(--cue-primaryContrast);border-radius:var(--cue-card-border-radius);border-left:1px solid rgba(255,255,255,.15);display:flex;flex-direction:column;overflow:hidden;box-shadow:-6px 0 24px #00000026;pointer-events:auto}.hp-pill-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:8px;padding:16px 16px 0;flex-shrink:0}.hp-pill[_ngcontent-%COMP%]{font-family:var(--cue-font-family);font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;padding:5px 12px;border-radius:999px;background:#ffffff1f;color:#ffffffbf;border:1px solid rgba(255,255,255,.2);cursor:pointer;transition:background .15s,color .15s,border-color .15s}.hp-pill[_ngcontent-%COMP%]:hover{border-color:#fff6}.hp-pill.active[_ngcontent-%COMP%]{background:#ffffffe6;color:var(--cue-primary);border-color:#ffffffe6}.hp-panel-body[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:12px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.2) transparent}.hp-reset-btn[_ngcontent-%COMP%]{flex-shrink:0;margin:8px 12px 12px;justify-content:center;box-shadow:0 -2px 12px #0003}.hp-subcard[_ngcontent-%COMP%]{flex-shrink:0}.hp-section-label[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.hp-section-label[_ngcontent-%COMP%] cue-typography[_ngcontent-%COMP%]{opacity:.75}.hp-invert-btn[_ngcontent-%COMP%]{background:none;border:none;color:inherit;opacity:.55;cursor:pointer;padding:2px;display:flex;align-items:center;flex-shrink:0}.hp-invert-btn[_ngcontent-%COMP%]:hover{opacity:1}"],changeDetection:0})}return r})()},2065(Qe,Me,Y){"use strict";function w(y,E,m="text/plain"){return function Z(y,E="data.zip"){const m=document.createElement("a"),L=URL.createObjectURL(y);m.href=L,m.download=E,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(L)}(new Blob([y],{type:m}),E)}function T(y,E){const m=document.createElement("a");m.style.display="hidden",m.setAttribute("href",window.URL.createObjectURL(y)),m.setAttribute("download",E),document.body.appendChild(m),m.click(),m.remove()}Y.d(Me,{KE:()=>T,YN:()=>w})},7573(Qe,Me,Y){"use strict";Y.d(Me,{E:()=>Z});const Z={qcy:"https://dev.qaecy.com/ont#","qcy-e":"https://dev.qaecy.com/enum#","qcy-f":"https://dev.qaecy.com/functions#",obc:"https://w3id.org/obc#",dicc:"https://w3id.org/digitalconstruction/0.5/Contexts#",dicv:"https://w3id.org/digitalconstruction/0.5/Variables#",dice:"https://w3id.org/digitalconstruction/0.5/Entities#",dicp:"https://w3id.org/digitalconstruction/0.5/Processes#",dica:"https://w3id.org/digitalconstruction/0.5/Agents#",dici:"https://w3id.org/digitalconstruction/0.5/Information#",dicbm:"https://w3id.org/digitalconstruction/0.5/Materials#",dicob:"https://w3id.org/digitalconstruction/0.5/Occupancy#",dicl:"https://w3id.org/digitalconstruction/0.5/Lifecycle#",dices:"https://w3id.org/digitalconstruction/0.5/Energy#",dicu:"https://w3id.org/digitalconstruction/0.5/Units#",diclvl:"https://w3id.org/digitalconstruction/0.5/Levels#",dicstg:"https://w3id.org/digitalconstruction/0.5/Stages#"}},8846(Qe){"use strict";Qe.exports=function Me(Y){return null===Y||"object"!=typeof Y||null!=Y.toJSON?JSON.stringify(Y):Array.isArray(Y)?"["+Y.reduce((Z,M,w)=>Z+(0===w?"":",")+Me(void 0===M||"symbol"==typeof M?null:M),"")+"]":"{"+Object.keys(Y).sort().reduce((Z,M,w)=>void 0===Y[M]||"symbol"==typeof Y[M]?Z:Z+(0===Z.length?"":",")+Me(M)+":"+Me(Y[M]),"")+"}"}},1692(Qe,Me,Y){var Z;Qe.exports=(Z=Y(6556),function(M){var w={};function T(N){if(w[N])return w[N].exports;var y=w[N]={i:N,l:!1,exports:{}};return M[N].call(y.exports,y,y.exports,T),y.l=!0,y.exports}return T.m=M,T.c=w,T.i=function(N){return N},T.d=function(N,y,E){T.o(N,y)||Object.defineProperty(N,y,{configurable:!1,enumerable:!0,get:E})},T.n=function(N){var y=N&&N.__esModule?function(){return N.default}:function(){return N};return T.d(y,"a",y),y},T.o=function(N,y){return Object.prototype.hasOwnProperty.call(N,y)},T.p="",T(T.s=7)}([function(M,w){M.exports=Z},function(M,w,T){"use strict";var N=T(0).FDLayoutConstants;function y(){}for(var E in N)y[E]=N[E];y.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,y.DEFAULT_RADIAL_SEPARATION=N.DEFAULT_EDGE_LENGTH,y.DEFAULT_COMPONENT_SEPERATION=60,y.TILE=!0,y.TILING_PADDING_VERTICAL=10,y.TILING_PADDING_HORIZONTAL=10,y.TREE_REDUCTION_ON_INCREMENTAL=!1,M.exports=y},function(M,w,T){"use strict";var N=T(0).FDLayoutEdge;function y(m,L,D){N.call(this,m,L,D)}for(var E in y.prototype=Object.create(N.prototype),N)y[E]=N[E];M.exports=y},function(M,w,T){"use strict";var N=T(0).LGraph;function y(m,L,D){N.call(this,m,L,D)}for(var E in y.prototype=Object.create(N.prototype),N)y[E]=N[E];M.exports=y},function(M,w,T){"use strict";var N=T(0).LGraphManager;function y(m){N.call(this,m)}for(var E in y.prototype=Object.create(N.prototype),N)y[E]=N[E];M.exports=y},function(M,w,T){"use strict";var N=T(0).FDLayoutNode,y=T(0).IMath;function E(L,D,P,G){N.call(this,L,D,P,G)}for(var m in E.prototype=Object.create(N.prototype),N)E[m]=N[m];E.prototype.move=function(){var L=this.graphManager.getLayout();this.displacementX=L.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=L.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>L.coolingFactor*L.maxNodeDisplacement&&(this.displacementX=L.coolingFactor*L.maxNodeDisplacement*y.sign(this.displacementX)),Math.abs(this.displacementY)>L.coolingFactor*L.maxNodeDisplacement&&(this.displacementY=L.coolingFactor*L.maxNodeDisplacement*y.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),L.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},E.prototype.propogateDisplacementToChildren=function(L,D){for(var G,P=this.getChild().getNodes(),_=0;_<P.length;_++)null==(G=P[_]).getChild()?(G.moveBy(L,D),G.displacementX+=L,G.displacementY+=D):G.propogateDisplacementToChildren(L,D)},E.prototype.setPred1=function(L){this.pred1=L},E.prototype.getPred1=function(){return pred1},E.prototype.getPred2=function(){return pred2},E.prototype.setNext=function(L){this.next=L},E.prototype.getNext=function(){return next},E.prototype.setProcessed=function(L){this.processed=L},E.prototype.isProcessed=function(){return processed},M.exports=E},function(M,w,T){"use strict";var N=T(0).FDLayout,y=T(4),E=T(3),m=T(5),L=T(2),D=T(1),P=T(0).FDLayoutConstants,G=T(0).LayoutConstants,_=T(0).Point,O=T(0).PointD,q=T(0).Layout,k=T(0).Integer,ne=T(0).IGeometry,W=T(0).LGraph,Ee=T(0).Transform;function ae(){N.call(this),this.toBeTiled={}}for(var R in ae.prototype=Object.create(N.prototype),N)ae[R]=N[R];ae.prototype.newGraphManager=function(){var S=new y(this);return this.graphManager=S,S},ae.prototype.newGraph=function(S){return new E(null,this.graphManager,S)},ae.prototype.newNode=function(S){return new m(this.graphManager,S)},ae.prototype.newEdge=function(S){return new L(null,null,S)},ae.prototype.initParameters=function(){N.prototype.initParameters.call(this,arguments),this.isSubLayout||(this.idealEdgeLength=D.DEFAULT_EDGE_LENGTH<10?10:D.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=D.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=P.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=P.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=P.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=P.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=P.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=P.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/P.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=P.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},ae.prototype.layout=function(){return G.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},ae.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(D.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var I=new Set(this.getAllNodes()),B=this.nodesWithGravity.filter(function(U){return I.has(U)});this.graphManager.setAllNodesToApplyGravitation(B)}}else{var S=this.getFlatForest();S.length>0?this.positionNodesRadially(S):(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),I=new Set(this.getAllNodes()),B=this.nodesWithGravity.filter(function(te){return I.has(te)}),this.graphManager.setAllNodesToApplyGravitation(B),this.positionNodesRandomly())}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},ae.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%P.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var S=new Set(this.getAllNodes()),I=this.nodesWithGravity.filter(function(se){return S.has(se)});this.graphManager.setAllNodesToApplyGravitation(I),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=P.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=P.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var B=!this.isTreeGrowing&&!this.isGrowthFinished,te=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(B,te),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},ae.prototype.getPositionsData=function(){for(var S=this.graphManager.getAllNodes(),I={},B=0;B<S.length;B++){var te=S[B].rect,se=S[B].id;I[se]={id:se,x:te.getCenterX(),y:te.getCenterY(),w:te.width,h:te.height}}return I},ae.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var S=!1;if("during"===P.ANIMATE)this.emit("layoutstarted");else{for(;!S;)S=this.tick();this.graphManager.updateBounds()}},ae.prototype.calculateNodesToApplyGravitationTo=function(){var I,se,S=[],B=this.graphManager.getGraphs(),te=B.length;for(se=0;se<te;se++)(I=B[se]).updateConnected(),I.isConnected||(S=S.concat(I.getNodes()));return S},ae.prototype.createBendpoints=function(){var S=[];S=S.concat(this.graphManager.getAllEdges());var B,I=new Set;for(B=0;B<S.length;B++){var te=S[B];if(!I.has(te)){var se=te.getSource(),U=te.getTarget();if(se==U)te.getBendpoints().push(new O),te.getBendpoints().push(new O),this.createDummyNodesForBendpoints(te),I.add(te);else{var ie=[];if(ie=(ie=ie.concat(se.getEdgeListToNode(U))).concat(U.getEdgeListToNode(se)),!I.has(ie[0])){var be;if(ie.length>1)for(be=0;be<ie.length;be++){var ge=ie[be];ge.getBendpoints().push(new O),this.createDummyNodesForBendpoints(ge)}ie.forEach(function(Te){I.add(Te)})}}}if(I.size==S.length)break}},ae.prototype.positionNodesRadially=function(S){for(var I=new _(0,0),B=Math.ceil(Math.sqrt(S.length)),te=0,se=0,U=0,ie=new O(0,0),be=0;be<S.length;be++){be%B==0&&(U=0,se=te,0!=be&&(se+=D.DEFAULT_COMPONENT_SEPERATION),te=0);var ge=S[be],Te=q.findCenterOfTree(ge);I.x=U,I.y=se,(ie=ae.radialLayout(ge,Te,I)).y>te&&(te=Math.floor(ie.y)),U=Math.floor(ie.x+D.DEFAULT_COMPONENT_SEPERATION)}this.transform(new O(G.WORLD_CENTER_X-ie.x/2,G.WORLD_CENTER_Y-ie.y/2))},ae.radialLayout=function(S,I,B){var te=Math.max(this.maxDiagonalInTree(S),D.DEFAULT_RADIAL_SEPARATION);ae.branchRadialLayout(I,null,0,359,0,te);var se=W.calculateBounds(S),U=new Ee;U.setDeviceOrgX(se.getMinX()),U.setDeviceOrgY(se.getMinY()),U.setWorldOrgX(B.x),U.setWorldOrgY(B.y);for(var ie=0;ie<S.length;ie++)S[ie].transform(U);var ge=new O(se.getMaxX(),se.getMaxY());return U.inverseTransformPoint(ge)},ae.branchRadialLayout=function(S,I,B,te,se,U){var ie=(te-B+1)/2;ie<0&&(ie+=180);var ge=(ie+B)%360*ne.TWO_PI/360,Ge=(Math.cos(ge),se*Math.cos(ge)),he=se*Math.sin(ge);S.setCenter(Ge,he);var re=[],de=(re=re.concat(S.getEdges())).length;null!=I&&de--;for(var oe,Re=0,ye=re.length,Ne=S.getEdgesBetween(I);Ne.length>1;){var Ze=Ne[0];Ne.splice(0,1);var $e=re.indexOf(Ze);$e>=0&&re.splice($e,1),ye--,de--}oe=null!=I?(re.indexOf(Ne[0])+1)%ye:0;for(var et=Math.abs(te-B)/de,Pe=oe;Re!=de;Pe=++Pe%ye){var Ye=re[Pe].getOtherEnd(S);if(Ye!=I){var we=(B+Re*et)%360;ae.branchRadialLayout(Ye,S,we,(we+et)%360,se+U,U),Re++}}},ae.maxDiagonalInTree=function(S){for(var I=k.MIN_VALUE,B=0;B<S.length;B++){var se=S[B].getDiagonal();se>I&&(I=se)}return I},ae.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},ae.prototype.groupZeroDegreeMembers=function(){var S=this,I={};this.memberGroups={},this.idToDummyNode={};for(var B=[],te=this.graphManager.getAllNodes(),se=0;se<te.length;se++){var ie=(U=te[se]).getParent();0===this.getNodeDegreeWithChildren(U)&&(null==ie.id||!this.getToBeTiled(ie))&&B.push(U)}for(se=0;se<B.length;se++){var U,be=(U=B[se]).getParent().id;typeof I[be]>"u"&&(I[be]=[]),I[be]=I[be].concat(U)}Object.keys(I).forEach(function(ge){if(I[ge].length>1){var Te="DummyCompound_"+ge;S.memberGroups[Te]=I[ge];var Ge=I[ge][0].getParent(),he=new m(S.graphManager);he.id=Te,he.paddingLeft=Ge.paddingLeft||0,he.paddingRight=Ge.paddingRight||0,he.paddingBottom=Ge.paddingBottom||0,he.paddingTop=Ge.paddingTop||0,S.idToDummyNode[Te]=he;var re=S.getGraphManager().add(S.newGraph(),he),de=Ge.getChild();de.add(he);for(var Re=0;Re<I[ge].length;Re++){var ye=I[ge][Re];de.remove(ye),re.add(ye)}}})},ae.prototype.clearCompounds=function(){var S={},I={};this.performDFSOnCompounds();for(var B=0;B<this.compoundOrder.length;B++)I[this.compoundOrder[B].id]=this.compoundOrder[B],S[this.compoundOrder[B].id]=[].concat(this.compoundOrder[B].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[B].getChild()),this.compoundOrder[B].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(S,I)},ae.prototype.clearZeroDegreeMembers=function(){var S=this,I=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(B){var te=S.idToDummyNode[B];I[B]=S.tileNodes(S.memberGroups[B],te.paddingLeft+te.paddingRight),te.rect.width=I[B].width,te.rect.height=I[B].height})},ae.prototype.repopulateCompounds=function(){for(var S=this.compoundOrder.length-1;S>=0;S--){var I=this.compoundOrder[S];this.adjustLocations(this.tiledMemberPack[I.id],I.rect.x,I.rect.y,I.paddingLeft,I.paddingTop)}},ae.prototype.repopulateZeroDegreeMembers=function(){var S=this,I=this.tiledZeroDegreePack;Object.keys(I).forEach(function(B){var te=S.idToDummyNode[B];S.adjustLocations(I[B],te.rect.x,te.rect.y,te.paddingLeft,te.paddingTop)})},ae.prototype.getToBeTiled=function(S){var I=S.id;if(null!=this.toBeTiled[I])return this.toBeTiled[I];var B=S.getChild();if(null==B)return this.toBeTiled[I]=!1,!1;for(var te=B.getNodes(),se=0;se<te.length;se++){var U=te[se];if(this.getNodeDegree(U)>0)return this.toBeTiled[I]=!1,!1;if(null!=U.getChild()){if(!this.getToBeTiled(U))return this.toBeTiled[I]=!1,!1}else this.toBeTiled[U.id]=!1}return this.toBeTiled[I]=!0,!0},ae.prototype.getNodeDegree=function(S){for(var B=S.getEdges(),te=0,se=0;se<B.length;se++){var U=B[se];U.getSource().id!==U.getTarget().id&&(te+=1)}return te},ae.prototype.getNodeDegreeWithChildren=function(S){var I=this.getNodeDegree(S);if(null==S.getChild())return I;for(var B=S.getChild().getNodes(),te=0;te<B.length;te++)I+=this.getNodeDegreeWithChildren(B[te]);return I},ae.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},ae.prototype.fillCompexOrderByDFS=function(S){for(var I=0;I<S.length;I++){var B=S[I];null!=B.getChild()&&this.fillCompexOrderByDFS(B.getChild().getNodes()),this.getToBeTiled(B)&&this.compoundOrder.push(B)}},ae.prototype.adjustLocations=function(S,I,B,te,se){B+=se;for(var U=I+=te,ie=0;ie<S.rows.length;ie++){var be=S.rows[ie];I=U;for(var ge=0,Te=0;Te<be.length;Te++){var Ge=be[Te];Ge.rect.x=I,Ge.rect.y=B,I+=Ge.rect.width+S.horizontalPadding,Ge.rect.height>ge&&(ge=Ge.rect.height)}B+=ge+S.verticalPadding}},ae.prototype.tileCompoundMembers=function(S,I){var B=this;this.tiledMemberPack=[],Object.keys(S).forEach(function(te){var se=I[te];B.tiledMemberPack[te]=B.tileNodes(S[te],se.paddingLeft+se.paddingRight),se.rect.width=B.tiledMemberPack[te].width,se.rect.height=B.tiledMemberPack[te].height})},ae.prototype.tileNodes=function(S,I){var se={rows:[],rowWidth:[],rowHeight:[],width:0,height:I,verticalPadding:D.TILING_PADDING_VERTICAL,horizontalPadding:D.TILING_PADDING_HORIZONTAL};S.sort(function(be,ge){return be.rect.width*be.rect.height>ge.rect.width*ge.rect.height?-1:be.rect.width*be.rect.height<ge.rect.width*ge.rect.height?1:0});for(var U=0;U<S.length;U++){var ie=S[U];0==se.rows.length?this.insertNodeToRow(se,ie,0,I):this.canAddHorizontal(se,ie.rect.width,ie.rect.height)?this.insertNodeToRow(se,ie,this.getShortestRowIndex(se),I):this.insertNodeToRow(se,ie,se.rows.length,I),this.shiftToLastRow(se)}return se},ae.prototype.insertNodeToRow=function(S,I,B,te){var se=te;B==S.rows.length&&(S.rows.push([]),S.rowWidth.push(se),S.rowHeight.push(0));var ie=S.rowWidth[B]+I.rect.width;S.rows[B].length>0&&(ie+=S.horizontalPadding),S.rowWidth[B]=ie,S.width<ie&&(S.width=ie);var be=I.rect.height;B>0&&(be+=S.verticalPadding);var ge=0;be>S.rowHeight[B]&&(ge=S.rowHeight[B],S.rowHeight[B]=be,ge=S.rowHeight[B]-ge),S.height+=ge,S.rows[B].push(I)},ae.prototype.getShortestRowIndex=function(S){for(var I=-1,B=Number.MAX_VALUE,te=0;te<S.rows.length;te++)S.rowWidth[te]<B&&(I=te,B=S.rowWidth[te]);return I},ae.prototype.getLongestRowIndex=function(S){for(var I=-1,B=Number.MIN_VALUE,te=0;te<S.rows.length;te++)S.rowWidth[te]>B&&(I=te,B=S.rowWidth[te]);return I},ae.prototype.canAddHorizontal=function(S,I,B){var te=this.getShortestRowIndex(S);if(te<0)return!0;var se=S.rowWidth[te];if(se+S.horizontalPadding+I<=S.width)return!0;var ie,be,U=0;return S.rowHeight[te]<B&&te>0&&(U=B+S.verticalPadding-S.rowHeight[te]),ie=S.width-se>=I+S.horizontalPadding?(S.height+U)/(se+I+S.horizontalPadding):(S.height+U)/S.width,U=B+S.verticalPadding,(be=S.width<I?(S.height+U)/I:(S.height+U)/S.width)<1&&(be=1/be),ie<1&&(ie=1/ie),ie<be},ae.prototype.shiftToLastRow=function(S){var I=this.getLongestRowIndex(S),B=S.rowWidth.length-1,te=S.rows[I],se=te[te.length-1],U=se.width+S.horizontalPadding;if(S.width-S.rowWidth[B]>U&&I!=B){te.splice(-1,1),S.rows[B].push(se),S.rowWidth[I]=S.rowWidth[I]-U,S.rowWidth[B]=S.rowWidth[B]+U,S.width=S.rowWidth[instance.getLongestRowIndex(S)];for(var ie=Number.MIN_VALUE,be=0;be<te.length;be++)te[be].height>ie&&(ie=te[be].height);I>0&&(ie+=S.verticalPadding);var ge=S.rowHeight[I]+S.rowHeight[B];S.rowHeight[I]=ie,S.rowHeight[B]<se.height+S.verticalPadding&&(S.rowHeight[B]=se.height+S.verticalPadding),S.height+=S.rowHeight[I]+S.rowHeight[B]-ge,this.shiftToLastRow(S)}},ae.prototype.tilingPreLayout=function(){D.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},ae.prototype.tilingPostLayout=function(){D.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},ae.prototype.reduceTrees=function(){for(var B,S=[],I=!0;I;){var te=this.graphManager.getAllNodes(),se=[];I=!1;for(var U=0;U<te.length;U++)1==(B=te[U]).getEdges().length&&!B.getEdges()[0].isInterGraph&&null==B.getChild()&&(se.push([B,B.getEdges()[0],B.getOwner()]),I=!0);if(1==I){for(var ie=[],be=0;be<se.length;be++)1==se[be][0].getEdges().length&&(ie.push(se[be]),se[be][0].getOwner().remove(se[be][0]));S.push(ie),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=S},ae.prototype.growTree=function(S){for(var te,B=S[S.length-1],se=0;se<B.length;se++)this.findPlaceforPrunedNode(te=B[se]),te[2].add(te[0]),te[2].add(te[1],te[1].source,te[1].target);S.splice(S.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},ae.prototype.findPlaceforPrunedNode=function(S){var I,B,te=S[0],se=(B=te==S[1].source?S[1].target:S[1].source).startX,U=B.finishX,ie=B.startY,be=B.finishY,re=[0,0,0,0];if(ie>0)for(var de=se;de<=U;de++)re[0]+=this.grid[de][ie-1].length+this.grid[de][ie].length-1;if(U<this.grid.length-1)for(de=ie;de<=be;de++)re[1]+=this.grid[U+1][de].length+this.grid[U][de].length-1;if(be<this.grid[0].length-1)for(de=se;de<=U;de++)re[2]+=this.grid[de][be+1].length+this.grid[de][be].length-1;if(se>0)for(de=ie;de<=be;de++)re[3]+=this.grid[se-1][de].length+this.grid[se][de].length-1;for(var ye,oe,Re=k.MAX_VALUE,Ne=0;Ne<re.length;Ne++)re[Ne]<Re?(Re=re[Ne],ye=1,oe=Ne):re[Ne]==Re&&ye++;if(3==ye&&0==Re)0==re[0]&&0==re[1]&&0==re[2]?I=1:0==re[0]&&0==re[1]&&0==re[3]?I=0:0==re[0]&&0==re[2]&&0==re[3]?I=3:0==re[1]&&0==re[2]&&0==re[3]&&(I=2);else if(2==ye&&0==Re){var Ze=Math.floor(2*Math.random());I=0==re[0]&&0==re[1]?0==Ze?0:1:0==re[0]&&0==re[2]?0==Ze?0:2:0==re[0]&&0==re[3]?0==Ze?0:3:0==re[1]&&0==re[2]?0==Ze?1:2:0==re[1]&&0==re[3]?0==Ze?1:3:0==Ze?2:3}else I=4==ye&&0==Re?Ze=Math.floor(4*Math.random()):oe;0==I?te.setCenter(B.getCenterX(),B.getCenterY()-B.getHeight()/2-P.DEFAULT_EDGE_LENGTH-te.getHeight()/2):1==I?te.setCenter(B.getCenterX()+B.getWidth()/2+P.DEFAULT_EDGE_LENGTH+te.getWidth()/2,B.getCenterY()):2==I?te.setCenter(B.getCenterX(),B.getCenterY()+B.getHeight()/2+P.DEFAULT_EDGE_LENGTH+te.getHeight()/2):te.setCenter(B.getCenterX()-B.getWidth()/2-P.DEFAULT_EDGE_LENGTH-te.getWidth()/2,B.getCenterY())},M.exports=ae},function(M,w,T){"use strict";var N={};N.layoutBase=T(0),N.CoSEConstants=T(1),N.CoSEEdge=T(2),N.CoSEGraph=T(3),N.CoSEGraphManager=T(4),N.CoSELayout=T(6),N.CoSENode=T(5),M.exports=N}]))},6894(Qe,Me,Y){var Z;Qe.exports=(Z=Y(1692),function(M){var w={};function T(N){if(w[N])return w[N].exports;var y=w[N]={i:N,l:!1,exports:{}};return M[N].call(y.exports,y,y.exports,T),y.l=!0,y.exports}return T.m=M,T.c=w,T.i=function(N){return N},T.d=function(N,y,E){T.o(N,y)||Object.defineProperty(N,y,{configurable:!1,enumerable:!0,get:E})},T.n=function(N){var y=N&&N.__esModule?function(){return N.default}:function(){return N};return T.d(y,"a",y),y},T.o=function(N,y){return Object.prototype.hasOwnProperty.call(N,y)},T.p="",T(T.s=1)}([function(M,w){M.exports=Z},function(M,w,T){"use strict";var N=T(0).layoutBase.LayoutConstants,y=T(0).layoutBase.FDLayoutConstants,E=T(0).CoSEConstants,m=T(0).CoSELayout,L=T(0).CoSENode,D=T(0).layoutBase.PointD,P=T(0).layoutBase.DimensionD,G={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function O(ne){this.options=function _(ne,W){var Ee={};for(var ae in ne)Ee[ae]=ne[ae];for(var ae in W)Ee[ae]=W[ae];return Ee}(G,ne),q(this.options)}var q=function(W){null!=W.nodeRepulsion&&(E.DEFAULT_REPULSION_STRENGTH=y.DEFAULT_REPULSION_STRENGTH=W.nodeRepulsion),null!=W.idealEdgeLength&&(E.DEFAULT_EDGE_LENGTH=y.DEFAULT_EDGE_LENGTH=W.idealEdgeLength),null!=W.edgeElasticity&&(E.DEFAULT_SPRING_STRENGTH=y.DEFAULT_SPRING_STRENGTH=W.edgeElasticity),null!=W.nestingFactor&&(E.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=y.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=W.nestingFactor),null!=W.gravity&&(E.DEFAULT_GRAVITY_STRENGTH=y.DEFAULT_GRAVITY_STRENGTH=W.gravity),null!=W.numIter&&(E.MAX_ITERATIONS=y.MAX_ITERATIONS=W.numIter),null!=W.gravityRange&&(E.DEFAULT_GRAVITY_RANGE_FACTOR=y.DEFAULT_GRAVITY_RANGE_FACTOR=W.gravityRange),null!=W.gravityCompound&&(E.DEFAULT_COMPOUND_GRAVITY_STRENGTH=y.DEFAULT_COMPOUND_GRAVITY_STRENGTH=W.gravityCompound),null!=W.gravityRangeCompound&&(E.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=W.gravityRangeCompound),null!=W.initialEnergyOnIncremental&&(E.DEFAULT_COOLING_FACTOR_INCREMENTAL=y.DEFAULT_COOLING_FACTOR_INCREMENTAL=W.initialEnergyOnIncremental),N.QUALITY="draft"==W.quality?0:"proof"==W.quality?2:1,E.NODE_DIMENSIONS_INCLUDE_LABELS=y.NODE_DIMENSIONS_INCLUDE_LABELS=N.NODE_DIMENSIONS_INCLUDE_LABELS=W.nodeDimensionsIncludeLabels,E.DEFAULT_INCREMENTAL=y.DEFAULT_INCREMENTAL=N.DEFAULT_INCREMENTAL=!W.randomize,E.ANIMATE=y.ANIMATE=N.ANIMATE=W.animate,E.TILE=W.tile,E.TILING_PADDING_VERTICAL="function"==typeof W.tilingPaddingVertical?W.tilingPaddingVertical.call():W.tilingPaddingVertical,E.TILING_PADDING_HORIZONTAL="function"==typeof W.tilingPaddingHorizontal?W.tilingPaddingHorizontal.call():W.tilingPaddingHorizontal};O.prototype.run=function(){var ne,W,Ee=this.options,R=(this.idToLNode={},this.layout=new m),S=this;S.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var I=R.newGraphManager();this.gm=I;var B=this.options.eles.nodes(),te=this.options.eles.edges();this.root=I.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(B),R);for(var se=0;se<te.length;se++){var U=te[se],ie=this.idToLNode[U.data("source")],be=this.idToLNode[U.data("target")];ie!==be&&0==ie.getEdgesBetween(be).length&&(I.add(R.newEdge(),ie,be).id=U.id())}var Te=function(re,de){"number"==typeof re&&(re=de);var Re=re.data("id"),ye=S.idToLNode[Re];return{x:ye.getRect().getCenterX(),y:ye.getRect().getCenterY()}},Ge=function he(){for(var Re,re=function(){Ee.fit&&Ee.cy.fit(Ee.eles,Ee.padding),ne||(ne=!0,S.cy.one("layoutready",Ee.ready),S.cy.trigger({type:"layoutready",layout:S}))},de=S.options.refresh,ye=0;ye<de&&!Re;ye++)Re=S.stopped||S.layout.tick();if(Re)return R.checkLayoutSuccess()&&!R.isSubLayout&&R.doPostLayout(),R.tilingPostLayout&&R.tilingPostLayout(),R.isLayoutFinished=!0,S.options.eles.nodes().positions(Te),re(),S.cy.one("layoutstop",S.options.stop),S.cy.trigger({type:"layoutstop",layout:S}),W&&cancelAnimationFrame(W),void(ne=!1);var oe=S.layout.getPositionsData();Ee.eles.nodes().positions(function(Ne,Ze){if("number"==typeof Ne&&(Ne=Ze),!Ne.isParent()){for(var $e=Ne.id(),et=oe[$e],Pe=Ne;null==et&&(et=oe[Pe.data("parent")]||oe["DummyCompound_"+Pe.data("parent")],oe[$e]=et,null!=(Pe=Pe.parent()[0])););return null!=et?{x:et.x,y:et.y}:{x:Ne.position("x"),y:Ne.position("y")}}}),re(),W=requestAnimationFrame(he)};return R.addListener("layoutstarted",function(){"during"===S.options.animate&&(W=requestAnimationFrame(Ge))}),R.runLayout(),"during"!==this.options.animate&&(S.options.eles.nodes().not(":parent").layoutPositions(S,S.options,Te),ne=!1),this},O.prototype.getTopMostNodes=function(ne){for(var W={},Ee=0;Ee<ne.length;Ee++)W[ne[Ee].id()]=!0;return ne.filter(function(R,S){"number"==typeof R&&(R=S);for(var I=R.parent()[0];null!=I;){if(W[I.id()])return!1;I=I.parent()[0]}return!0})},O.prototype.processChildrenList=function(ne,W,Ee){for(var ae=W.length,R=0;R<ae;R++){var B,be,S=W[R],I=S.children(),te=S.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if((B=null!=S.outerWidth()&&null!=S.outerHeight()?ne.add(new L(Ee.graphManager,new D(S.position("x")-te.w/2,S.position("y")-te.h/2),new P(parseFloat(te.w),parseFloat(te.h)))):ne.add(new L(this.graphManager))).id=S.data("id"),B.paddingLeft=parseInt(S.css("padding")),B.paddingTop=parseInt(S.css("padding")),B.paddingRight=parseInt(S.css("padding")),B.paddingBottom=parseInt(S.css("padding")),this.options.nodeDimensionsIncludeLabels&&S.isParent()){var se=S.boundingBox({includeLabels:!0,includeNodes:!1}).w,U=S.boundingBox({includeLabels:!0,includeNodes:!1}).h,ie=S.css("text-halign");B.labelWidth=se,B.labelHeight=U,B.labelPos=ie}this.idToLNode[S.data("id")]=B,isNaN(B.rect.x)&&(B.rect.x=0),isNaN(B.rect.y)&&(B.rect.y=0),null!=I&&I.length>0&&(be=Ee.getGraphManager().add(Ee.newGraph(),B),this.processChildrenList(be,I,Ee))}},O.prototype.stop=function(){return this.stopped=!0,this};var k=function(W){W("layout","cose-bilkent",O)};typeof cytoscape<"u"&&k(cytoscape),M.exports=k}]))},7839(Qe,Me,Y){"use strict";var Z=Y(9293).default;const{isArray:M,isObject:w,isString:T}=Y(2831),{asArray:N}=Y(9420),{prependBase:y}=Y(2051),E=Y(7881),m=Y(6181);function D(G){throw new E("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:G})}function P({context:G,base:_}){if(!G)return;const O=G["@context"];if(T(O))G["@context"]=y(_,O);else if(M(O))for(let q=0;q<O.length;++q){const k=O[q];T(k)?O[q]=y(_,k):w(k)&&P({context:{"@context":k},base:_})}else if(w(O))for(const q in O)P({context:O[q],base:_})}Qe.exports=class{constructor({sharedCache:_}){this.perOpCache=new Map,this.sharedCache=_}resolve(_){var O=this;return Z(function*({activeCtx:q,context:k,documentLoader:ne,base:W,cycles:Ee=new Set}){k&&w(k)&&k["@context"]&&(k=k["@context"]),k=N(k);const ae=[];for(const R of k){if(T(R)){let B=O._get(R);B||(B=yield O._resolveRemoteContext({activeCtx:q,url:R,documentLoader:ne,base:W,cycles:Ee})),M(B)?ae.push(...B):ae.push(B);continue}if(null===R){ae.push(new m({document:null}));continue}w(R)||D(k);const S=JSON.stringify(R);let I=O._get(S);I||(I=new m({document:R}),O._cacheResolvedContext({key:S,resolved:I,tag:"static"})),ae.push(I)}return ae}).apply(this,arguments)}_get(_){let O=this.perOpCache.get(_);if(!O){const q=this.sharedCache.get(_);q&&(O=q.get("static"),O&&this.perOpCache.set(_,O))}return O}_cacheResolvedContext({key:_,resolved:O,tag:q}){if(this.perOpCache.set(_,O),void 0!==q){let k=this.sharedCache.get(_);k||(k=new Map,this.sharedCache.set(_,k)),k.set(q,O)}return O}_resolveRemoteContext(_){var O=this;return Z(function*({activeCtx:q,url:k,documentLoader:ne,base:W,cycles:Ee}){k=y(W,k);const{context:ae,remoteDoc:R}=yield O._fetchContext({activeCtx:q,url:k,documentLoader:ne,cycles:Ee});P({context:ae,base:W=R.documentUrl||k});const S=yield O.resolve({activeCtx:q,context:ae,documentLoader:ne,base:W,cycles:Ee});return O._cacheResolvedContext({key:k,resolved:S,tag:R.tag}),S}).apply(this,arguments)}_fetchContext(_){return Z(function*({activeCtx:O,url:q,documentLoader:k,cycles:ne}){if(ne.size>10)throw new E("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===O.processingMode?"loading remote context failed":"context overflow",max:10});if(ne.has(q))throw new E("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===O.processingMode?"recursive context inclusion":"context overflow",url:q});let W,Ee;ne.add(q);try{Ee=yield k(q),W=Ee.document||null,T(W)&&(W=JSON.parse(W))}catch(ae){throw new E(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${q}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:q,cause:ae})}if(!w(W))throw new E(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${q}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:q});return W="@context"in W?{"@context":W["@context"]}:{"@context":{}},Ee.contextUrl&&(M(W["@context"])||(W["@context"]=[W["@context"]]),W["@context"].push(Ee.contextUrl)),{context:W,remoteDoc:Ee}}).apply(this,arguments)}}},7881(Qe){"use strict";Qe.exports=class extends Error{constructor(Y="An unspecified JSON-LD error occurred.",Z="jsonld.Error",M={}){super(Y),this.name=Z,this.message=Y,this.details=M}}},1328(Qe){"use strict";Qe.exports=Me=>{class Y{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(Y,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(Y.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:Y}),Y.compact=function(Z,M){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):Me.compact(Z,M)},Y.expand=function(Z){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):Me.expand(Z)},Y.flatten=function(Z){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):Me.flatten(Z)},Y}},5426(Qe,Me,Y){"use strict";Qe.exports=Y(1224).NQuads},4808(Qe,Me,Y){"use strict";var Z=Y(9293).default;Qe.exports=class{constructor(){this._requests={}}wrapLoader(w){const T=this;return T._loader=w,function(){return T.add.apply(T,arguments)}}add(w){var T=this;return Z(function*(){let N=T._requests[w];if(N)return Promise.resolve(N);N=T._requests[w]=T._loader(w);try{return yield N}finally{delete T._requests[w]}})()}}},6181(Qe,Me,Y){"use strict";const Z=Y(3052);Qe.exports=class{constructor({document:T}){this.document=T,this.cache=new Z({max:10})}getProcessed(T){return this.cache.get(T)}setProcessed(T,N){this.cache.set(T,N)}}},3763(Qe,Me,Y){"use strict";var Z=Y(9293).default;const M=Y(7881),{isArray:w,isObject:T,isString:N,isUndefined:y}=Y(2831),{isList:E,isValue:m,isGraph:L,isSimpleGraph:D,isSubjectReference:P}=Y(4209),{expandIri:G,getContextValue:_,isKeyword:O,process:q,processingMode:k}=Y(429),{removeBase:ne,prependBase:W}=Y(2051),{REGEX_KEYWORD:Ee,addValue:ae,asArray:R,compareShortestLeast:S}=Y(9420),I={};function te(se,U,ie){if("@nest"!==G(se,U,{vocab:!0},ie))throw new M("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}Qe.exports=I,I.compact=function(){var se=Z(function*({activeCtx:U,activeProperty:ie=null,element:be,options:ge={}}){if(w(be)){let Ge=[];for(let he=0;he<be.length;++he){const re=yield I.compact({activeCtx:U,activeProperty:ie,element:be[he],options:ge});null!==re&&Ge.push(re)}return ge.compactArrays&&1===Ge.length&&0===(_(U,ie,"@container")||[]).length&&(Ge=Ge[0]),Ge}const Te=_(U,ie,"@context");if(y(Te)||(U=yield q({activeCtx:U,localCtx:Te,propagate:!0,overrideProtected:!0,options:ge})),T(be)){if(ge.link&&"@id"in be&&ge.link.hasOwnProperty(be["@id"])){const Ne=ge.link[be["@id"]];for(let Ze=0;Ze<Ne.length;++Ze)if(Ne[Ze].expanded===be)return Ne[Ze].compacted}if(m(be)||P(be)){const Ne=I.compactValue({activeCtx:U,activeProperty:ie,value:be,options:ge});return ge.link&&P(be)&&(ge.link.hasOwnProperty(be["@id"])||(ge.link[be["@id"]]=[]),ge.link[be["@id"]].push({expanded:be,compacted:Ne})),Ne}if(E(be)&&(_(U,ie,"@container")||[]).includes("@list"))return I.compact({activeCtx:U,activeProperty:ie,element:be["@list"],options:ge});const Ge="@reverse"===ie,he={},re=U;!m(be)&&!P(be)&&(U=U.revertToPreviousContext());const de=_(re,ie,"@context");y(de)||(U=yield q({activeCtx:U,localCtx:de,propagate:!0,overrideProtected:!0,options:ge})),ge.link&&"@id"in be&&(ge.link.hasOwnProperty(be["@id"])||(ge.link[be["@id"]]=[]),ge.link[be["@id"]].push({expanded:be,compacted:he}));let Re=be["@type"]||[];Re.length>1&&(Re=Array.from(Re).sort());const ye=U;for(const Ne of Re){const Ze=I.compactIri({activeCtx:ye,iri:Ne,relativeTo:{vocab:!0}}),$e=_(re,Ze,"@context");y($e)||(U=yield q({activeCtx:U,localCtx:$e,options:ge,propagate:!1}))}const oe=Object.keys(be).sort();for(const Ne of oe){const Ze=be[Ne];if("@id"===Ne){let $e=R(Ze).map(Pe=>I.compactIri({activeCtx:U,iri:Pe,relativeTo:{vocab:!1},base:ge.base}));1===$e.length&&($e=$e[0]),he[I.compactIri({activeCtx:U,iri:"@id",relativeTo:{vocab:!0}})]=$e;continue}if("@type"===Ne){let $e=R(Ze).map(le=>I.compactIri({activeCtx:re,iri:le,relativeTo:{vocab:!0}}));1===$e.length&&($e=$e[0]);const et=I.compactIri({activeCtx:U,iri:"@type",relativeTo:{vocab:!0}}),we=(_(U,et,"@container")||[]).includes("@set")&&k(U,1.1)||w($e)&&0===Ze.length;ae(he,et,$e,{propertyIsArray:we});continue}if("@reverse"===Ne){const $e=yield I.compact({activeCtx:U,activeProperty:"@reverse",element:Ze,options:ge});for(const et in $e)if(U.mappings.has(et)&&U.mappings.get(et).reverse){const Pe=$e[et],we=(_(U,et,"@container")||[]).includes("@set")||!ge.compactArrays;ae(he,et,Pe,{propertyIsArray:we}),delete $e[et]}if(Object.keys($e).length>0){const et=I.compactIri({activeCtx:U,iri:Ne,relativeTo:{vocab:!0}});ae(he,et,$e)}continue}if("@preserve"===Ne){const $e=yield I.compact({activeCtx:U,activeProperty:ie,element:Ze,options:ge});w($e)&&0===$e.length||ae(he,Ne,$e);continue}if("@index"===Ne){if((_(U,ie,"@container")||[]).includes("@index"))continue;const et=I.compactIri({activeCtx:U,iri:Ne,relativeTo:{vocab:!0}});ae(he,et,Ze);continue}if("@graph"!==Ne&&"@list"!==Ne&&"@included"!==Ne&&O(Ne)){const $e=I.compactIri({activeCtx:U,iri:Ne,relativeTo:{vocab:!0}});ae(he,$e,Ze);continue}if(!w(Ze))throw new M("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===Ze.length){const $e=I.compactIri({activeCtx:U,iri:Ne,value:Ze,relativeTo:{vocab:!0},reverse:Ge}),et=U.mappings.has($e)?U.mappings.get($e)["@nest"]:null;let Pe=he;et&&(te(U,et,ge),T(he[et])||(he[et]={}),Pe=he[et]),ae(Pe,$e,Ze,{propertyIsArray:!0})}for(const $e of Ze){const et=I.compactIri({activeCtx:U,iri:Ne,value:$e,relativeTo:{vocab:!0},reverse:Ge}),Pe=U.mappings.has(et)?U.mappings.get(et)["@nest"]:null;let Ye=he;Pe&&(te(U,Pe,ge),T(he[Pe])||(he[Pe]={}),Ye=he[Pe]);const we=_(U,et,"@container")||[],le=L($e),ke=E($e);let We;ke?We=$e["@list"]:le&&(We=$e["@graph"]);let Oe=yield I.compact({activeCtx:U,activeProperty:et,element:ke||le?We:$e,options:ge});if(ke){if(w(Oe)||(Oe=[Oe]),we.includes("@list")){ae(Ye,et,Oe,{valueIsArray:!0,allowDuplicate:!0});continue}Oe={[I.compactIri({activeCtx:U,iri:"@list",relativeTo:{vocab:!0}})]:Oe},"@index"in $e&&(Oe[I.compactIri({activeCtx:U,iri:"@index",relativeTo:{vocab:!0}})]=$e["@index"])}if(le)if(we.includes("@graph")&&(we.includes("@id")||we.includes("@index")&&D($e))){let it;Ye.hasOwnProperty(et)?it=Ye[et]:Ye[et]=it={};const Be=(we.includes("@id")?$e["@id"]:$e["@index"])||I.compactIri({activeCtx:U,iri:"@none",relativeTo:{vocab:!0}});ae(it,Be,Oe,{propertyIsArray:!ge.compactArrays||we.includes("@set")})}else we.includes("@graph")&&D($e)?(w(Oe)&&Oe.length>1&&(Oe={"@included":Oe}),ae(Ye,et,Oe,{propertyIsArray:!ge.compactArrays||we.includes("@set")})):(w(Oe)&&1===Oe.length&&ge.compactArrays&&(Oe=Oe[0]),Oe={[I.compactIri({activeCtx:U,iri:"@graph",relativeTo:{vocab:!0}})]:Oe},"@id"in $e&&(Oe[I.compactIri({activeCtx:U,iri:"@id",relativeTo:{vocab:!0}})]=$e["@id"]),"@index"in $e&&(Oe[I.compactIri({activeCtx:U,iri:"@index",relativeTo:{vocab:!0}})]=$e["@index"]),ae(Ye,et,Oe,{propertyIsArray:!ge.compactArrays||we.includes("@set")}));else if(we.includes("@language")||we.includes("@index")||we.includes("@id")||we.includes("@type")){let it,Be;if(Ye.hasOwnProperty(et)?it=Ye[et]:Ye[et]=it={},we.includes("@language"))m(Oe)&&(Oe=Oe["@value"]),Be=$e["@language"];else if(we.includes("@index")){const wt=_(U,et,"@index")||"@index",nt=I.compactIri({activeCtx:U,iri:wt,relativeTo:{vocab:!0}});if("@index"===wt)Be=$e["@index"],delete Oe[nt];else{let vt;if([Be,...vt]=R(Oe[wt]||[]),N(Be))switch(vt.length){case 0:delete Oe[wt];break;case 1:Oe[wt]=vt[0];break;default:Oe[wt]=vt}else Be=null}}else if(we.includes("@id")){const wt=I.compactIri({activeCtx:U,iri:"@id",relativeTo:{vocab:!0}});Be=Oe[wt],delete Oe[wt]}else if(we.includes("@type")){const wt=I.compactIri({activeCtx:U,iri:"@type",relativeTo:{vocab:!0}});let nt;switch([Be,...nt]=R(Oe[wt]||[]),nt.length){case 0:delete Oe[wt];break;case 1:Oe[wt]=nt[0];break;default:Oe[wt]=nt}1===Object.keys(Oe).length&&"@id"in $e&&(Oe=yield I.compact({activeCtx:U,activeProperty:et,element:{"@id":$e["@id"]},options:ge}))}Be||(Be=I.compactIri({activeCtx:U,iri:"@none",relativeTo:{vocab:!0}})),ae(it,Be,Oe,{propertyIsArray:we.includes("@set")})}else{const it=!ge.compactArrays||we.includes("@set")||we.includes("@list")||w(Oe)&&0===Oe.length||"@list"===Ne||"@graph"===Ne;ae(Ye,et,Oe,{propertyIsArray:it})}}}return he}return be});return function(U){return se.apply(this,arguments)}}(),I.compactIri=({activeCtx:se,iri:U,value:ie=null,relativeTo:be={vocab:!1},reverse:ge=!1,base:Te=null})=>{if(null===U)return U;se.isPropertyTermScoped&&se.previousContext&&(se=se.previousContext);const Ge=se.getInverse();if(O(U)&&U in Ge&&"@none"in Ge[U]&&"@type"in Ge[U]["@none"]&&"@none"in Ge[U]["@none"]["@type"])return Ge[U]["@none"]["@type"]["@none"];if(be.vocab&&U in Ge){const ye=se["@language"]||"@none",oe=[];T(ie)&&"@index"in ie&&!("@graph"in ie)&&oe.push("@index","@index@set"),T(ie)&&"@preserve"in ie&&(ie=ie["@preserve"][0]),L(ie)?("@index"in ie&&oe.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in ie&&oe.push("@graph@id","@graph@id@set"),oe.push("@graph","@graph@set","@set"),"@index"in ie||oe.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in ie||oe.push("@graph@id","@graph@id@set")):T(ie)&&!m(ie)&&oe.push("@id","@id@set","@type","@set@type");let Ne="@language",Ze="@null";if(ge)Ne="@type",Ze="@reverse",oe.push("@set");else if(E(ie)){"@index"in ie||oe.push("@list");const et=ie["@list"];if(0===et.length)Ne="@any",Ze="@none";else{let Pe=0===et.length?ye:null,Ye=null;for(let we=0;we<et.length;++we){const le=et[we];let ke="@none",We="@none";if(m(le)?"@direction"in le?ke=`${(le["@language"]||"").toLowerCase()}_${le["@direction"]}`:"@language"in le?ke=le["@language"].toLowerCase():"@type"in le?We=le["@type"]:ke="@null":We="@id",null===Pe?Pe=ke:ke!==Pe&&m(le)&&(Pe="@none"),null===Ye?Ye=We:We!==Ye&&(Ye="@none"),"@none"===Pe&&"@none"===Ye)break}Pe=Pe||"@none",Ye=Ye||"@none","@none"!==Ye?(Ne="@type",Ze=Ye):Ze=Pe}}else{if(m(ie))if("@language"in ie&&!("@index"in ie)){oe.push("@language","@language@set"),Ze=ie["@language"];const et=ie["@direction"];et&&(Ze=`${Ze}_${et}`)}else"@direction"in ie&&!("@index"in ie)?Ze=`_${ie["@direction"]}`:"@type"in ie&&(Ne="@type",Ze=ie["@type"]);else Ne="@type",Ze="@id";oe.push("@set")}oe.push("@none"),T(ie)&&!("@index"in ie)&&oe.push("@index","@index@set"),m(ie)&&1===Object.keys(ie).length&&oe.push("@language","@language@set");const $e=function B(se,U,ie,be,ge,Te){null===Te&&(Te="@null");const Ge=[];if(("@id"===Te||"@reverse"===Te)&&T(ie)&&"@id"in ie){"@reverse"===Te&&Ge.push("@reverse");const re=I.compactIri({activeCtx:se,iri:ie["@id"],relativeTo:{vocab:!0}});se.mappings.has(re)&&se.mappings.get(re)&&se.mappings.get(re)["@id"]===ie["@id"]?Ge.push.apply(Ge,["@vocab","@id"]):Ge.push.apply(Ge,["@id","@vocab"])}else{Ge.push(Te);const re=Ge.find(de=>de.includes("_"));re&&Ge.push(re.replace(/^[^_]+_/,"_"))}Ge.push("@none");const he=se.inverse[U];for(const re of be){if(!(re in he))continue;const de=he[re][ge];for(const Re of Ge)if(Re in de)return de[Re]}return null}(se,U,ie,oe,Ne,Ze);if(null!==$e)return $e}if(be.vocab&&"@vocab"in se){const ye=se["@vocab"];if(0===U.indexOf(ye)&&U!==ye){const oe=U.substr(ye.length);if(!se.mappings.has(oe))return oe}}let he=null;const re=[];let de=se.fastCurieMap;const Re=U.length-1;for(let ye=0;ye<Re&&U[ye]in de;++ye)de=de[U[ye]],""in de&&re.push(de[""][0]);for(let ye=re.length-1;ye>=0;--ye){const oe=re[ye],Ne=oe.terms;for(const Ze of Ne){const $e=Ze+":"+U.substr(oe.iri.length);se.mappings.get(Ze)._prefix&&(!se.mappings.has($e)||null===ie&&se.mappings.get($e)["@id"]===U)&&(null===he||S($e,he)<0)&&(he=$e)}}if(null!==he)return he;for(const[ye,oe]of se.mappings)if(oe&&oe._prefix&&U.startsWith(ye+":"))throw new M(`Absolute IRI "${U}" confused with prefix "${ye}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:se});if(!be.vocab){if("@base"in se){if(se["@base"]){const ye=ne(W(Te,se["@base"]),U);return Ee.test(ye)?`./${ye}`:ye}return U}return ne(Te,U)}return U},I.compactValue=({activeCtx:se,activeProperty:U,value:ie,options:be})=>{if(m(ie)){const he=_(se,U,"@type"),re=_(se,U,"@language"),de=_(se,U,"@direction"),Re=_(se,U,"@container")||[],ye="@index"in ie&&!Re.includes("@index");if(!ye&&"@none"!==he&&(ie["@type"]===he||"@language"in ie&&ie["@language"]===re&&"@direction"in ie&&ie["@direction"]===de||"@language"in ie&&ie["@language"]===re||"@direction"in ie&&ie["@direction"]===de))return ie["@value"];const oe=Object.keys(ie).length,Ne=1===oe||2===oe&&"@index"in ie&&!ye,Ze="@language"in se,$e=N(ie["@value"]),et=se.mappings.has(U)&&null===se.mappings.get(U)["@language"];if(Ne&&"@none"!==he&&(!Ze||!$e||et))return ie["@value"];const Pe={};return ye&&(Pe[I.compactIri({activeCtx:se,iri:"@index",relativeTo:{vocab:!0}})]=ie["@index"]),"@type"in ie?Pe[I.compactIri({activeCtx:se,iri:"@type",relativeTo:{vocab:!0}})]=I.compactIri({activeCtx:se,iri:ie["@type"],relativeTo:{vocab:!0}}):"@language"in ie&&(Pe[I.compactIri({activeCtx:se,iri:"@language",relativeTo:{vocab:!0}})]=ie["@language"]),"@direction"in ie&&(Pe[I.compactIri({activeCtx:se,iri:"@direction",relativeTo:{vocab:!0}})]=ie["@direction"]),Pe[I.compactIri({activeCtx:se,iri:"@value",relativeTo:{vocab:!0}})]=ie["@value"],Pe}const ge=G(se,U,{vocab:!0},be),Te=_(se,U,"@type"),Ge=I.compactIri({activeCtx:se,iri:ie["@id"],relativeTo:{vocab:"@vocab"===Te},base:be.base});return"@id"===Te||"@vocab"===Te||"@graph"===ge?Ge:{[I.compactIri({activeCtx:se,iri:"@id",relativeTo:{vocab:!0}})]:Ge}}},5315(Qe){"use strict";const Me="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Y="http://www.w3.org/2001/XMLSchema#";Qe.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:Me,RDF_LIST:Me+"List",RDF_FIRST:Me+"first",RDF_REST:Me+"rest",RDF_NIL:Me+"nil",RDF_TYPE:Me+"type",RDF_PLAIN_LITERAL:Me+"PlainLiteral",RDF_XML_LITERAL:Me+"XMLLiteral",RDF_JSON_LITERAL:Me+"JSON",RDF_OBJECT:Me+"object",RDF_LANGSTRING:Me+"langString",XSD:Y,XSD_BOOLEAN:Y+"boolean",XSD_DOUBLE:Y+"double",XSD_INTEGER:Y+"integer",XSD_STRING:Y+"string"}},429(Qe,Me,Y){"use strict";var Z=Y(9293).default;const M=Y(9420),w=Y(7881),{isArray:T,isObject:N,isString:y,isUndefined:E}=Y(2831),{isAbsolute:m,isRelative:L,prependBase:D}=Y(2051),{handleEvent:P}=Y(2585),{REGEX_BCP47:G,REGEX_KEYWORD:_,asArray:O,compareShortestLeast:q}=Y(9420),k=new Map,W={};function Ee(R,S,I,B,te,se){if(null===S||!y(S)||W.isKeyword(S))return S;if(S.match(_))return null;if(B&&B.hasOwnProperty(S)&&!0!==te.get(S)&&W.createTermDefinition({activeCtx:R,localCtx:B,term:S,defined:te,options:se}),(I=I||{}).vocab){const ie=R.mappings.get(S);if(null===ie)return null;if(N(ie)&&"@id"in ie)return ie["@id"]}const U=S.indexOf(":");if(U>0){const ie=S.substr(0,U),be=S.substr(U+1);if("_"===ie||0===be.indexOf("//"))return S;B&&B.hasOwnProperty(ie)&&W.createTermDefinition({activeCtx:R,localCtx:B,term:ie,defined:te,options:se});const ge=R.mappings.get(ie);if(ge&&ge._prefix)return ge["@id"]+be;if(m(S))return S}if(I.vocab&&"@vocab"in R)S=R["@vocab"]+S;else if(I.base){let ie,be;"@base"in R?R["@base"]?(be=D(se.base,R["@base"]),ie=D(be,S)):(be=R["@base"],ie=S):(be=se.base,ie=D(se.base,S)),S=ie}return S}function ae(R,S){if(!R||"object"!=typeof R||!S||"object"!=typeof S)return R===S;const I=Array.isArray(R);if(I!==Array.isArray(S))return!1;if(I){if(R.length!==S.length)return!1;for(let se=0;se<R.length;++se)if(!ae(R[se],S[se]))return!1;return!0}const B=Object.keys(R),te=Object.keys(S);if(B.length!==te.length)return!1;for(const se in R){let U=R[se],ie=S[se];if("@container"===se&&Array.isArray(U)&&Array.isArray(ie)&&(U=U.slice().sort(),ie=ie.slice().sort()),!ae(U,ie))return!1}return!0}Qe.exports=W,W.process=function(){var R=Z(function*({activeCtx:S,localCtx:I,options:B,propagate:te=!0,overrideProtected:se=!1,cycles:U=new Set}){if(N(I)&&"@context"in I&&T(I["@context"])&&(I=I["@context"]),0===O(I).length)return S;const be=[],ge=[({event:re,next:de})=>{be.push(re),de()}];B.eventHandler&&ge.push(B.eventHandler);const Te=B;B={...B,eventHandler:ge};const Ge=yield B.contextResolver.resolve({activeCtx:S,context:I,documentLoader:B.documentLoader,base:B.base});N(Ge[0].document)&&"boolean"==typeof Ge[0].document["@propagate"]&&(te=Ge[0].document["@propagate"]);let he=S;!te&&!he.previousContext&&(he=he.clone(),he.previousContext=S);for(const re of Ge){let{document:de}=re;if(S=he,null===de){if(!se&&0!==Object.keys(S.protected).length)throw new w("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});he=S=W.getInitialContext(B).clone();continue}const Re=re.getProcessed(S);if(Re){if(Te.eventHandler)for(const oe of Re.events)P({event:oe,options:Te});he=S=Re.context;continue}if(N(de)&&"@context"in de&&(de=de["@context"]),!N(de))throw new w("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:de});he=he.clone();const ye=new Map;if("@version"in de){if(1.1!==de["@version"])throw new w("Unsupported JSON-LD version: "+de["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:de});if(S.processingMode&&"json-ld-1.0"===S.processingMode)throw new w("@version: "+de["@version"]+" not compatible with "+S.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:de});he.processingMode="json-ld-1.1",he["@version"]=de["@version"],ye.set("@version",!0)}if(he.processingMode=he.processingMode||S.processingMode,"@base"in de){let oe=de["@base"];if(null!==oe&&!m(oe)){if(!L(oe))throw new w('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:de});oe=D(he["@base"],oe)}he["@base"]=oe,ye.set("@base",!0)}if("@vocab"in de){const oe=de["@vocab"];if(null===oe)delete he["@vocab"];else{if(!y(oe))throw new w('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:de});if(!m(oe)&&W.processingMode(he,1))throw new w('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:de});{const Ne=Ee(he,oe,{vocab:!0,base:!0},void 0,void 0,B);m(Ne)||B.eventHandler&&P({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:Ne}},options:B}),he["@vocab"]=Ne}}ye.set("@vocab",!0)}if("@language"in de){const oe=de["@language"];if(null===oe)delete he["@language"];else{if(!y(oe))throw new w('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:de});oe.match(G)||B.eventHandler&&P({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:oe}},options:B}),he["@language"]=oe.toLowerCase()}ye.set("@language",!0)}if("@direction"in de){const oe=de["@direction"];if("json-ld-1.0"===S.processingMode)throw new w("Invalid JSON-LD syntax; @direction not compatible with "+S.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:de});if(null===oe)delete he["@direction"];else{if("ltr"!==oe&&"rtl"!==oe)throw new w('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:de});he["@direction"]=oe}ye.set("@direction",!0)}if("@propagate"in de){const oe=de["@propagate"];if("json-ld-1.0"===S.processingMode)throw new w("Invalid JSON-LD syntax; @propagate not compatible with "+S.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:de});if("boolean"!=typeof oe)throw new w("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:I});ye.set("@propagate",!0)}if("@import"in de){const oe=de["@import"];if("json-ld-1.0"===S.processingMode)throw new w("Invalid JSON-LD syntax; @import not compatible with "+S.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:de});if(!y(oe))throw new w("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:I});const Ne=yield B.contextResolver.resolve({activeCtx:S,context:oe,documentLoader:B.documentLoader,base:B.base});if(1!==Ne.length)throw new w("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:I});const Ze=Ne[0].getProcessed(S);if(Ze)de=Ze;else{const $e=Ne[0].document;if("@import"in $e)throw new w("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:I});for(const et in $e)de.hasOwnProperty(et)||(de[et]=$e[et]);Ne[0].setProcessed(S,de)}ye.set("@import",!0)}ye.set("@protected",de["@protected"]||!1);for(const oe in de)if(W.createTermDefinition({activeCtx:he,localCtx:de,term:oe,defined:ye,options:B,overrideProtected:se}),N(de[oe])&&"@context"in de[oe]){const Ne=de[oe]["@context"];let Ze=!0;if(y(Ne)){const $e=D(B.base,Ne);U.has($e)?Ze=!1:U.add($e)}if(Ze)try{yield W.process({activeCtx:he.clone(),localCtx:de[oe]["@context"],overrideProtected:!0,options:B,cycles:U})}catch{throw new w("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:de[oe]["@context"],term:oe})}}re.setProcessed(S,{context:he,events:be})}return he});return function(S){return R.apply(this,arguments)}}(),W.createTermDefinition=({activeCtx:R,localCtx:S,term:I,defined:B,options:te,overrideProtected:se=!1})=>{if(B.has(I)){if(B.get(I))return;throw new w("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:S,term:I})}let U;if(B.set(I,!1),S.hasOwnProperty(I)&&(U=S[I]),"@type"===I&&N(U)&&"@set"===(U["@container"]||"@set")&&W.processingMode(R,1.1)){const re=["@container","@id","@protected"],de=Object.keys(U);if(0===de.length||de.some(Re=>!re.includes(Re)))throw new w("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:S,term:I})}else{if(W.isKeyword(I))throw new w("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:S,term:I});if(I.match(_))return void(te.eventHandler&&P({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:I}},options:te}));if(""===I)throw new w("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:S})}const ie=R.mappings.get(I);R.mappings.has(I)&&R.mappings.delete(I);let be=!1;if((y(U)||null===U)&&(be=!0,U={"@id":U}),!N(U))throw new w("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:S});const ge={};R.mappings.set(I,ge),ge.reverse=!1;const Te=["@container","@id","@language","@reverse","@type"];W.processingMode(R,1.1)&&Te.push("@context","@direction","@index","@nest","@prefix","@protected");for(const re in U)if(!Te.includes(re))throw new w("Invalid JSON-LD syntax; a term definition must not contain "+re,"jsonld.SyntaxError",{code:"invalid term definition",context:S});const Ge=I.indexOf(":");if(ge._termHasColon=Ge>0,"@reverse"in U){if("@id"in U)throw new w("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:S});if("@nest"in U)throw new w("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:S});const re=U["@reverse"];if(!y(re))throw new w("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:S});if(re.match(_))return te.eventHandler&&P({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:re}},options:te}),void(ie?R.mappings.set(I,ie):R.mappings.delete(I));const de=Ee(R,re,{vocab:!0,base:!1},S,B,te);if(!m(de))throw new w("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:S});ge["@id"]=de,ge.reverse=!0}else if("@id"in U){let re=U["@id"];if(re&&!y(re))throw new w("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:S});if(null===re)ge["@id"]=null;else{if(!W.isKeyword(re)&&re.match(_))return te.eventHandler&&P({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:re}},options:te}),void(ie?R.mappings.set(I,ie):R.mappings.delete(I));if(re!==I){if(re=Ee(R,re,{vocab:!0,base:!1},S,B,te),!m(re)&&!W.isKeyword(re))throw new w("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:S});if(I.match(/(?::[^:])|\//)&&Ee(R,I,{vocab:!0,base:!1},S,new Map(B).set(I,!0),te)!==re)throw new w("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:S});ge["@id"]=re,ge._prefix=be&&!ge._termHasColon&&null!==re.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in ge))if(ge._termHasColon){const re=I.substr(0,Ge);if(S.hasOwnProperty(re)&&W.createTermDefinition({activeCtx:R,localCtx:S,term:re,defined:B,options:te}),R.mappings.has(re)){const de=I.substr(Ge+1);ge["@id"]=R.mappings.get(re)["@id"]+de}else ge["@id"]=I}else if("@type"===I)ge["@id"]=I;else{if(!("@vocab"in R))throw new w("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:S,term:I});ge["@id"]=R["@vocab"]+I}if((!0===U["@protected"]||!0===B.get("@protected")&&!1!==U["@protected"])&&(R.protected[I]=!0,ge.protected=!0),B.set(I,!0),"@type"in U){let re=U["@type"];if(!y(re))throw new w("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:S});if("@json"===re||"@none"===re){if(W.processingMode(R,1))throw new w(`Invalid JSON-LD syntax; an @context @type value must not be "${re}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:S})}else if("@id"!==re&&"@vocab"!==re){if(re=Ee(R,re,{vocab:!0,base:!1},S,B,te),!m(re))throw new w("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:S});if(0===re.indexOf("_:"))throw new w("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:S})}ge["@type"]=re}if("@container"in U){const re=y(U["@container"])?[U["@container"]]:U["@container"]||[],de=["@list","@set","@index","@language"];let Re=!0;const ye=re.includes("@set");if(W.processingMode(R,1.1)){if(de.push("@graph","@id","@type"),re.includes("@list")){if(1!==re.length)throw new w("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:S})}else if(re.includes("@graph")){if(re.some(oe=>"@graph"!==oe&&"@id"!==oe&&"@index"!==oe&&"@set"!==oe))throw new w("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:S})}else Re&=re.length<=(ye?2:1);if(re.includes("@type")&&(ge["@type"]=ge["@type"]||"@id",!["@id","@vocab"].includes(ge["@type"])))throw new w("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:S})}else Re&=!T(U["@container"]),Re&=re.length<=1;if(Re&=re.every(oe=>de.includes(oe)),Re&=!(ye&&re.includes("@list")),!Re)throw new w("Invalid JSON-LD syntax; @context @container value must be one of the following: "+de.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:S});if(ge.reverse&&!re.every(oe=>["@index","@set"].includes(oe)))throw new w("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:S});ge["@container"]=re}if("@index"in U){if(!("@container"in U)||!ge["@container"].includes("@index"))throw new w(`Invalid JSON-LD syntax; @index without @index in @container: "${U["@index"]}" on term "${I}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:S});if(!y(U["@index"])||0===U["@index"].indexOf("@"))throw new w(`Invalid JSON-LD syntax; @index must expand to an IRI: "${U["@index"]}" on term "${I}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:S});ge["@index"]=U["@index"]}if("@context"in U&&(ge["@context"]=U["@context"]),"@language"in U&&!("@type"in U)){let re=U["@language"];if(null!==re&&!y(re))throw new w("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:S});null!==re&&(re=re.toLowerCase()),ge["@language"]=re}if("@prefix"in U){if(I.match(/:|\//))throw new w("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:S});if(W.isKeyword(ge["@id"]))throw new w("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:S});if("boolean"!=typeof U["@prefix"])throw new w("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:S});ge._prefix=!0===U["@prefix"]}if("@direction"in U){const re=U["@direction"];if(null!==re&&"ltr"!==re&&"rtl"!==re)throw new w('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:S});ge["@direction"]=re}if("@nest"in U){const re=U["@nest"];if(!y(re)||"@nest"!==re&&0===re.indexOf("@"))throw new w("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:S});ge["@nest"]=re}const he=ge["@id"];if("@context"===he||"@preserve"===he)throw new w("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:S});if(ie&&ie.protected&&!se&&(R.protected[I]=!0,ge.protected=!0,!ae(ie,ge)))throw new w("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:S,term:I})},W.expandIri=(R,S,I,B)=>Ee(R,S,I,void 0,void 0,B),W.getInitialContext=R=>{const S=JSON.stringify({processingMode:R.processingMode}),I=k.get(S);if(I)return I;const B={processingMode:R.processingMode,mappings:new Map,inverse:null,getInverse:function te(){const ge=this;if(ge.inverse)return ge.inverse;const Te=ge.inverse={},Ge=ge.fastCurieMap={},he={},re=(ge["@language"]||"@none").toLowerCase(),de=ge["@direction"],Re=ge.mappings,ye=[...Re.keys()].sort(q);for(const oe of ye){const Ne=Re.get(oe);if(null===Ne)continue;let Ze=Ne["@container"]||"@none";if(Ze=[].concat(Ze).sort().join(""),null===Ne["@id"])continue;const $e=O(Ne["@id"]);for(const et of $e){let Pe=Te[et];const Ye=W.isKeyword(et);if(Pe)!Ye&&!Ne._termHasColon&&he[et].push(oe);else if(Te[et]=Pe={},!Ye&&!Ne._termHasColon){he[et]=[oe];const we={iri:et,terms:he[et]};et[0]in Ge?Ge[et[0]].push(we):Ge[et[0]]=[we]}if(Pe[Ze]||(Pe[Ze]={"@language":{},"@type":{},"@any":{}}),Pe=Pe[Ze],U(oe,Pe["@any"],"@none"),Ne.reverse)U(oe,Pe["@type"],"@reverse");else if("@none"===Ne["@type"])U(oe,Pe["@any"],"@none"),U(oe,Pe["@language"],"@none"),U(oe,Pe["@type"],"@none");else if("@type"in Ne)U(oe,Pe["@type"],Ne["@type"]);else if("@language"in Ne&&"@direction"in Ne){const we=Ne["@language"],le=Ne["@direction"];U(oe,Pe["@language"],we&&le?`${we}_${le}`.toLowerCase():we?we.toLowerCase():le?`_${le}`:"@null")}else"@language"in Ne?U(oe,Pe["@language"],(Ne["@language"]||"@null").toLowerCase()):"@direction"in Ne?U(oe,Pe["@language"],Ne["@direction"]?`_${Ne["@direction"]}`:"@none"):de?(U(oe,Pe["@language"],`_${de}`),U(oe,Pe["@language"],"@none"),U(oe,Pe["@type"],"@none")):(U(oe,Pe["@language"],re),U(oe,Pe["@language"],"@none"),U(oe,Pe["@type"],"@none"))}}for(const oe in Ge)se(Ge,oe,1);return Te},clone:function ie(){const ge={};return ge.mappings=M.clone(this.mappings),ge.clone=this.clone,ge.inverse=null,ge.getInverse=this.getInverse,ge.protected=M.clone(this.protected),this.previousContext&&(ge.previousContext=this.previousContext.clone()),ge.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(ge["@base"]=this["@base"]),"@language"in this&&(ge["@language"]=this["@language"]),"@vocab"in this&&(ge["@vocab"]=this["@vocab"]),ge},revertToPreviousContext:function be(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===k.size&&k.clear(),k.set(S,B),B;function se(ge,Te,Ge){const he=ge[Te],re=ge[Te]={};let de,Re;for(const ye of he)de=ye.iri,Re=Ge>=de.length?"":de[Ge],Re in re?re[Re].push(ye):re[Re]=[ye];for(const ye in re)""!==ye&&se(re,ye,Ge+1)}function U(ge,Te,Ge){Te.hasOwnProperty(Ge)||(Te[Ge]=ge)}},W.getContextValue=(R,S,I)=>{if(null===S)return"@context"===I?void 0:null;if(R.mappings.has(S)){const B=R.mappings.get(S);if(E(I))return B;if(B.hasOwnProperty(I))return B[I]}return"@language"===I&&I in R||"@direction"===I&&I in R?R[I]:"@context"!==I?null:void 0},W.processingMode=(R,S)=>S.toString()>="1.1"?!R.processingMode||R.processingMode>="json-ld-"+S.toString():"json-ld-1.0"===R.processingMode,W.isKeyword=R=>{if(!y(R)||"@"!==R[0])return!1;switch(R){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}},3120(Qe,Me,Y){"use strict";var Z=Y(9293).default;const{parseLinkHeader:M,buildHeaders:w}=Y(9420),{LINK_HEADER_CONTEXT:T}=Y(5315),N=Y(7881),y=Y(4808),{prependBase:E}=Y(2051),m=/(^|(\r\n))link:/i;Qe.exports=({secure:D,headers:P={},xhr:G}={headers:{}})=>{return P=w(P),(new y).wrapLoader(O);function O(k){return q.apply(this,arguments)}function q(){return q=Z(function*(k){if(0!==k.indexOf("http:")&&0!==k.indexOf("https:"))throw new N('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:k});if(D&&0!==k.indexOf("https"))throw new N('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:k});let ne;try{ne=yield function L(D,P,G){const _=new(D=D||XMLHttpRequest);return new Promise((O,q)=>{_.onload=()=>O(_),_.onerror=k=>q(k),_.open("GET",P,!0);for(const k in G)_.setRequestHeader(k,G[k]);_.send()})}(G,k,P)}catch(S){throw new N("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:k,cause:S})}if(ne.status>=400)throw new N("URL could not be dereferenced: "+ne.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:k,httpStatusCode:ne.status});let W={contextUrl:null,documentUrl:k,document:ne.response},Ee=null;const ae=ne.getResponseHeader("Content-Type");let R;if(m.test(ne.getAllResponseHeaders())&&(R=ne.getResponseHeader("Link")),R&&"application/ld+json"!==ae){const S=M(R),I=S[T];if(Array.isArray(I))throw new N("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:k});I&&(W.contextUrl=I.target),Ee=S.alternate,Ee&&"application/ld+json"==Ee.type&&!(ae||"").match(/^application\/(\w*\+)?json$/)&&(W=yield O(E(k,Ee.target)))}return W}),q.apply(this,arguments)}}},2585(Qe,Me,Y){"use strict";const Z=Y(7881),{isArray:M}=Y(2831),{asArray:w}=Y(9420),T={};function N({event:E,handlers:m}){let L=!0;for(let D=0;L&&D<m.length;++D){L=!1;const P=m[D];if(M(P))L=N({event:E,handlers:P});else if("function"==typeof P)P({event:E,next:()=>{L=!0}});else{if("object"!=typeof P)throw new Z("Invalid event handler.","jsonld.InvalidEventHandler",{event:E});E.code in P?P[E.code]({event:E,next:()=>{L=!0}}):L=!0}}return L}Qe.exports=T,T.defaultEventHandler=null,T.setupEventHandler=({options:E={}})=>{const m=[].concat(E.safe?T.safeEventHandler:[],E.eventHandler?w(E.eventHandler):[],T.defaultEventHandler?T.defaultEventHandler:[]);return 0===m.length?null:m},T.handleEvent=({event:E,options:m})=>{N({event:E,handlers:m.eventHandler})};const y=new Set(["empty object","free-floating scalar","invalid @language value","invalid property","null @id value","null @value value","object with only @id","object with only @language","object with only @list","object with only @value","relative @id reference","relative @type reference","relative @vocab reference","reserved @id value","reserved @reverse value","reserved term","blank node predicate","relative graph reference","relative object reference","relative predicate reference","relative subject reference","rdfDirection not set"]);T.safeEventHandler=function({event:m,next:L}){if("warning"===m.level&&y.has(m.code))throw new Z("Safe mode validation error.","jsonld.ValidationError",{event:m});L()},T.logEventHandler=function({event:m,next:L}){console.log(`EVENT: ${m.message}`,{event:m}),L()},T.logWarningEventHandler=function({event:m,next:L}){"warning"===m.level&&console.warn(`WARNING: ${m.message}`,{event:m}),L()},T.unhandledEventHandler=function({event:m}){throw new Z("No handler for event.","jsonld.UnhandledEvent",{event:m})},T.setDefaultEventHandler=function({eventHandler:E}={}){T.defaultEventHandler=E?w(E):null}},7336(Qe,Me,Y){"use strict";var Z=Y(9293).default;const M=Y(7881),{isArray:w,isObject:T,isEmptyObject:N,isString:y,isUndefined:E}=Y(2831),{isList:m,isValue:L,isGraph:D,isSubject:P}=Y(4209),{expandIri:G,getContextValue:_,isKeyword:O,process:q,processingMode:k}=Y(429),{isAbsolute:ne}=Y(2051),{REGEX_BCP47:W,REGEX_KEYWORD:Ee,addValue:ae,asArray:R,getValues:S,validateTypeValue:I}=Y(9420),{handleEvent:B}=Y(2585),te={};function se({value:he,count:re,options:de}){if(0===re||"@value"in he||"@list"in he||1===re&&"@id"in he){if(de.eventHandler){let Re,ye;0===re?(Re="empty object",ye="Dropping empty object."):"@value"in he?(Re="object with only @value",ye="Dropping object with only @value."):"@list"in he?(Re="object with only @list",ye="Dropping object with only @list."):1===re&&"@id"in he&&(Re="object with only @id",ye="Dropping object with only @id."),B({event:{type:["JsonLdEvent"],code:Re,level:"warning",message:ye,details:{value:he}},options:de})}return null}return he}function U(he){return ie.apply(this,arguments)}function ie(){return(ie=Z(function*({activeCtx:he,activeProperty:re,expandedActiveProperty:de,element:Re,expandedParent:ye,options:oe={},insideList:Ne,typeKey:Ze,typeScopedContext:$e}){const et=Object.keys(Re).sort(),Pe=[];let Ye;const we=Re[Ze]&&"@json"===G(he,w(Re[Ze])?Re[Ze][0]:Re[Ze],{vocab:!0},{...oe,typeExpansion:!0});for(const le of et){let We,ke=Re[le];if("@context"===le)continue;const Oe=G(he,le,{vocab:!0},oe);if(null===Oe||!ne(Oe)&&!O(Oe)){oe.eventHandler&&B({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:le,expandedProperty:Oe}},options:oe});continue}if(O(Oe)){if("@reverse"===de)throw new M("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:ke});if(Oe in ye&&"@included"!==Oe&&"@type"!==Oe)throw new M("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:Oe})}if("@id"===Oe){if(!y(ke)){if(!oe.isFrame)throw new M('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:ke});if(T(ke)){if(!N(ke))throw new M('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:ke})}else{if(!w(ke))throw new M('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:ke});if(!ke.every(nt=>y(nt)))throw new M('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:ke})}}ae(ye,"@id",R(ke).map(nt=>{if(y(nt)){const vt=G(he,nt,{base:!0},oe);return oe.eventHandler&&(null===vt?B(null===nt?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:nt}},options:oe}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:nt}},options:oe}):ne(vt)||B({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:nt,expandedId:vt}},options:oe})),vt}return nt}),{propertyIsArray:oe.isFrame});continue}if("@type"===Oe){T(ke)&&(ke=Object.fromEntries(Object.entries(ke).map(([nt,vt])=>[G($e,nt,{vocab:!0}),R(vt).map(At=>G($e,At,{base:!0,vocab:!0},{...oe,typeExpansion:!0}))]))),I(ke,oe.isFrame),ae(ye,"@type",R(ke).map(nt=>{if(y(nt)){const vt=G($e,nt,{base:!0,vocab:!0},{...oe,typeExpansion:!0});return"@json"!==vt&&!ne(vt)&&oe.eventHandler&&B({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:nt}},options:oe}),vt}return nt}),{propertyIsArray:!!oe.isFrame});continue}if("@included"===Oe&&k(he,1.1)){const nt=R(yield te.expand({activeCtx:he,activeProperty:re,element:ke,options:oe}));if(!nt.every(vt=>P(vt)))throw new M("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:ke});ae(ye,"@included",nt,{propertyIsArray:!0});continue}if("@graph"===Oe&&!T(ke)&&!w(ke))throw new M('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:ke});if("@value"===Oe){Ye=ke,we&&k(he,1.1)?ye["@value"]=ke:ae(ye,"@value",ke,{propertyIsArray:oe.isFrame});continue}if("@language"===Oe){if(null===ke)continue;if(!y(ke)&&!oe.isFrame)throw new M('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:ke});ke=R(ke).map(nt=>y(nt)?nt.toLowerCase():nt);for(const nt of ke)y(nt)&&!nt.match(W)&&oe.eventHandler&&B({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:nt}},options:oe});ae(ye,"@language",ke,{propertyIsArray:oe.isFrame});continue}if("@direction"===Oe){if(!y(ke)&&!oe.isFrame)throw new M('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:ke});ke=R(ke);for(const nt of ke)if(y(nt)&&"ltr"!==nt&&"rtl"!==nt)throw new M('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:ke});ae(ye,"@direction",ke,{propertyIsArray:oe.isFrame});continue}if("@index"===Oe){if(!y(ke))throw new M('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:ke});ae(ye,"@index",ke);continue}if("@reverse"===Oe){if(!T(ke))throw new M('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:ke});if(We=yield te.expand({activeCtx:he,activeProperty:"@reverse",element:ke,options:oe}),"@reverse"in We)for(const vt in We["@reverse"])ae(ye,vt,We["@reverse"][vt],{propertyIsArray:!0});let nt=ye["@reverse"]||null;for(const vt in We){if("@reverse"===vt)continue;null===nt&&(nt=ye["@reverse"]={}),ae(nt,vt,[],{propertyIsArray:!0});const At=We[vt];for(let qt=0;qt<At.length;++qt){const wr=At[qt];if(L(wr)||m(wr))throw new M('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:We});ae(nt,vt,wr,{propertyIsArray:!0})}}continue}if("@nest"===Oe){Pe.push(le);continue}let it=he;const Be=_(he,le,"@context");E(Be)||(it=yield q({activeCtx:he,localCtx:Be,propagate:!0,overrideProtected:!0,options:oe}));const wt=_(he,le,"@container")||[];if(wt.includes("@language")&&T(ke))We=ge(it,ke,_(it,le,"@direction"),oe);else if(wt.includes("@index")&&T(ke)){const nt=wt.includes("@graph"),vt=_(it,le,"@index")||"@index",At="@index"!==vt&&G(he,vt,{vocab:!0},oe);We=yield Te({activeCtx:it,options:oe,activeProperty:le,value:ke,asGraph:nt,indexKey:vt,propertyIndex:At})}else if(wt.includes("@id")&&T(ke)){const nt=wt.includes("@graph");We=yield Te({activeCtx:it,options:oe,activeProperty:le,value:ke,asGraph:nt,indexKey:"@id"})}else if(wt.includes("@type")&&T(ke))We=yield Te({activeCtx:it.revertToPreviousContext(),options:oe,activeProperty:le,value:ke,asGraph:!1,indexKey:"@type"});else{const nt="@list"===Oe;if(nt||"@set"===Oe){let vt=re;nt&&"@graph"===de&&(vt=null),We=yield te.expand({activeCtx:it,activeProperty:vt,element:ke,options:oe,insideList:nt})}else We="@json"===_(he,le,"@type")?{"@type":"@json","@value":ke}:yield te.expand({activeCtx:it,activeProperty:le,element:ke,options:oe,insideList:!1})}if(null!==We||"@value"===Oe){if("@list"!==Oe&&!m(We)&&wt.includes("@list")&&(We={"@list":R(We)}),wt.includes("@graph")&&!wt.some(nt=>"@id"===nt||"@index"===nt)){if(We=R(We),oe.isFrame||(We=We.filter(nt=>null!==se({value:nt,count:Object.keys(nt).length,options:oe}))),0===We.length)continue;We=We.map(nt=>({"@graph":R(nt)}))}if(it.mappings.has(le)&&it.mappings.get(le).reverse){const nt=ye["@reverse"]=ye["@reverse"]||{};We=R(We);for(let vt=0;vt<We.length;++vt){const At=We[vt];if(L(At)||m(At))throw new M('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:We});ae(nt,Oe,At,{propertyIsArray:!0})}continue}ae(ye,Oe,We,{propertyIsArray:!0})}}if("@value"in ye&&("@json"!==ye["@type"]||!k(he,1.1))&&(T(Ye)||w(Ye))&&!oe.isFrame)throw new M('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:Ye});for(const le of Pe){const ke=w(Re[le])?Re[le]:[Re[le]];for(const We of ke){if(!T(We)||Object.keys(We).some(Oe=>"@value"===G(he,Oe,{vocab:!0},oe)))throw new M("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:We});yield U({activeCtx:he,activeProperty:re,expandedActiveProperty:de,element:We,expandedParent:ye,options:oe,insideList:Ne,typeScopedContext:$e,typeKey:Ze})}}})).apply(this,arguments)}function be({activeCtx:he,activeProperty:re,value:de,options:Re}){if(null==de)return null;const ye=G(he,re,{vocab:!0},Re);if("@id"===ye)return G(he,de,{base:!0},Re);if("@type"===ye)return G(he,de,{vocab:!0,base:!0},{...Re,typeExpansion:!0});const oe=_(he,re,"@type");if(("@id"===oe||"@graph"===ye)&&y(de)){const Ze=G(he,de,{base:!0},Re);return null===Ze&&de.match(Ee)&&Re.eventHandler&&B({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:re}},options:Re}),{"@id":Ze}}if("@vocab"===oe&&y(de))return{"@id":G(he,de,{vocab:!0,base:!0},Re)};if(O(ye))return de;const Ne={};if(oe&&!["@id","@vocab","@none"].includes(oe))Ne["@type"]=oe;else if(y(de)){const Ze=_(he,re,"@language");null!==Ze&&(Ne["@language"]=Ze);const $e=_(he,re,"@direction");null!==$e&&(Ne["@direction"]=$e)}return["boolean","number","string"].includes(typeof de)||(de=de.toString()),Ne["@value"]=de,Ne}function ge(he,re,de,Re){const ye=[],oe=Object.keys(re).sort();for(const Ne of oe){const Ze=G(he,Ne,{vocab:!0},Re);let $e=re[Ne];w($e)||($e=[$e]);for(const et of $e){if(null===et)continue;if(!y(et))throw new M("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:re});const Pe={"@value":et};"@none"!==Ze&&(Ne.match(W)||Re.eventHandler&&B({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Ne}},options:Re}),Pe["@language"]=Ne.toLowerCase()),de&&(Pe["@direction"]=de),ye.push(Pe)}}return ye}function Te(he){return Ge.apply(this,arguments)}function Ge(){return(Ge=Z(function*({activeCtx:he,options:re,activeProperty:de,value:Re,asGraph:ye,indexKey:oe,propertyIndex:Ne}){const Ze=[],$e=Object.keys(Re).sort(),et="@type"===oe;for(let Pe of $e){if(et){const le=_(he,Pe,"@context");E(le)||(he=yield q({activeCtx:he,localCtx:le,propagate:!1,options:re}))}let we,Ye=Re[Pe];w(Ye)||(Ye=[Ye]),Ye=yield te.expand({activeCtx:he,activeProperty:de,element:Ye,options:re,insideList:!1,insideIndex:!0}),we=Ne?"@none"===Pe?"@none":be({activeCtx:he,activeProperty:oe,value:Pe,options:re}):G(he,Pe,{vocab:!0},re),"@id"===oe?Pe=G(he,Pe,{base:!0},re):et&&(Pe=we);for(let le of Ye){if(ye&&!D(le)&&(le={"@graph":[le]}),"@type"===oe)"@none"===we||(le["@type"]=le["@type"]?[Pe].concat(le["@type"]):[Pe]);else{if(L(le)&&!["@language","@type","@index"].includes(oe))throw new M(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${oe}".`,"jsonld.SyntaxError",{code:"invalid value object",value:le});Ne?"@none"!==we&&ae(le,Ne,we,{propertyIsArray:!0,prependValue:!0}):"@none"!==we&&!(oe in le)&&(le[oe]=Pe)}Ze.push(le)}}return Ze})).apply(this,arguments)}Qe.exports=te,te.expand=function(){var he=Z(function*({activeCtx:re,activeProperty:de=null,element:Re,options:ye={},insideList:oe=!1,insideIndex:Ne=!1,typeScopedContext:Ze=null}){if(null==Re)return null;if("@default"===de&&(ye=Object.assign({},ye,{isFrame:!1})),!w(Re)&&!T(Re))return oe||null!==de&&"@graph"!==G(re,de,{vocab:!0},ye)?be({activeCtx:re,activeProperty:de,value:Re,options:ye}):(ye.eventHandler&&B({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:Re}},options:ye}),null);if(w(Re)){let We=[];const Oe=_(re,de,"@container")||[];oe=oe||Oe.includes("@list");for(let it=0;it<Re.length;++it){let Be=yield te.expand({activeCtx:re,activeProperty:de,element:Re[it],options:ye,insideIndex:Ne,typeScopedContext:Ze});oe&&w(Be)&&(Be={"@list":Be}),null!==Be&&(w(Be)?We=We.concat(Be):We.push(Be))}return We}const $e=G(re,de,{vocab:!0},ye),et=_(re,de,"@context");Ze=Ze||(re.previousContext?re:null);let Pe=Object.keys(Re).sort(),Ye=!Ne;if(Ye&&Ze&&Pe.length<=2&&!Pe.includes("@context"))for(const We of Pe){const Oe=G(Ze,We,{vocab:!0},ye);if("@value"===Oe){Ye=!1,re=Ze;break}if("@id"===Oe&&1===Pe.length){Ye=!1;break}}Ye&&(re=re.revertToPreviousContext()),E(et)||(re=yield q({activeCtx:re,localCtx:et,propagate:!0,overrideProtected:!0,options:ye})),"@context"in Re&&(re=yield q({activeCtx:re,localCtx:Re["@context"],options:ye})),Ze=re;let we=null;for(const We of Pe)if("@type"===G(re,We,{vocab:!0},ye)){we=we||We;const it=Re[We],Be=Array.isArray(it)?it.length>1?it.slice().sort():it:[it];for(const wt of Be){const nt=_(Ze,wt,"@context");E(nt)||(re=yield q({activeCtx:re,localCtx:nt,options:ye,propagate:!1}))}}let le={};yield U({activeCtx:re,activeProperty:de,expandedActiveProperty:$e,element:Re,expandedParent:le,options:ye,insideList:oe,typeKey:we,typeScopedContext:Ze}),Pe=Object.keys(le);let ke=Pe.length;if("@value"in le){if("@type"in le&&("@language"in le||"@direction"in le))throw new M('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:le});let We=ke-1;if("@type"in le&&(We-=1),"@index"in le&&(We-=1),"@language"in le&&(We-=1),"@direction"in le&&(We-=1),0!==We)throw new M('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:le});const Oe=null===le["@value"]?[]:R(le["@value"]),it=S(le,"@type");if(!k(re,1.1)||!it.includes("@json")||1!==it.length)if(0===Oe.length)ye.eventHandler&&B({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:le}},options:ye}),le=null;else{if(!Oe.every(Be=>y(Be)||N(Be))&&"@language"in le)throw new M("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:le});if(!it.every(Be=>ne(Be)&&!(y(Be)&&0===Be.indexOf("_:"))||N(Be)))throw new M('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:le})}}else if("@type"in le&&!w(le["@type"]))le["@type"]=[le["@type"]];else if("@set"in le||"@list"in le){if(ke>1&&(2!==ke||!("@index"in le)))throw new M('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:le});"@set"in le&&(le=le["@set"],Pe=Object.keys(le),ke=Pe.length)}else 1===ke&&"@language"in le&&(ye.eventHandler&&B({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:le}},options:ye}),le=null);return T(le)&&!ye.keepFreeFloatingNodes&&!oe&&(null===de||"@graph"===$e||(_(re,de,"@container")||[]).includes("@graph"))&&(le=se({value:le,count:ke,options:ye})),le});return function(re){return he.apply(this,arguments)}}()},9392(Qe,Me,Y){"use strict";const{isSubjectReference:Z}=Y(4209),{createMergedNodeMap:M}=Y(5096),w={};Qe.exports=w,w.flatten=T=>{const N=M(T),y=[],E=Object.keys(N).sort();for(let m=0;m<E.length;++m){const L=N[E[m]];Z(L)||y.push(L)}return y}},7031(Qe,Me,Y){"use strict";const{isKeyword:Z}=Y(429),M=Y(4209),w=Y(2831),T=Y(9420),N=Y(2051),y=Y(7881),{createNodeMap:E,mergeNodeMapGraphs:m}=Y(5096),L={};function D(R){const S={};for(const I in R)void 0!==R[I]&&(S["@"+I]=[R[I]]);return[S]}function P(R,S,I){for(let B=I.length-1;B>=0;--B){const te=I[B];if(te.graph===S&&te.subject["@id"]===R["@id"])return!0}return!1}function G(R,S,I){const B="@"+I;let te=B in R?R[B][0]:S[I];if("embed"===I)if(!0===te)te="@once";else if(!1===te)te="@never";else if("@always"!==te&&"@never"!==te&&"@link"!==te&&"@first"!==te&&"@last"!==te&&"@once"!==te)throw new y("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:R});return te}function _(R){if(!w.isArray(R)||1!==R.length||!w.isObject(R[0]))throw new y("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:R});if("@id"in R[0])for(const S of T.asArray(R[0]["@id"]))if(!w.isObject(S)&&!N.isAbsolute(S)||w.isString(S)&&0===S.indexOf("_:"))throw new y("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:R});if("@type"in R[0])for(const S of T.asArray(R[0]["@type"]))if(!w.isObject(S)&&!N.isAbsolute(S)&&"@json"!==S||w.isString(S)&&0===S.indexOf("_:"))throw new y("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:R})}function q(R,S,I,B){let te=!0,se=!1;for(const U in I){let ie=!1;const be=T.getValues(S,U),ge=0===T.getValues(I,U).length;if("@id"===U){if(w.isEmptyObject(I["@id"][0]||{})?ie=!0:I["@id"].length>=0&&(ie=I["@id"].includes(be[0])),!B.requireAll)return ie}else if("@type"===U){if(te=!1,ge){if(be.length>0)return!1;ie=!0}else if(1===I["@type"].length&&w.isEmptyObject(I["@type"][0]))ie=be.length>0;else for(const Te of I["@type"])ie=!(!w.isObject(Te)||!("@default"in Te))||ie||be.some(Ge=>Ge===Te);if(!B.requireAll)return ie}else{if(Z(U))continue;{const Te=T.getValues(I,U)[0];let Ge=!1;if(Te&&(_([Te]),Ge="@default"in Te),te=!1,0===be.length&&Ge)continue;if(be.length>0&&ge)return!1;if(void 0===Te){if(be.length>0)return!1;ie=!0}else if(M.isList(Te)){const he=Te["@list"][0];if(M.isList(be[0])){const re=be[0]["@list"];M.isValue(he)?ie=re.some(de=>ae(he,de)):(M.isSubject(he)||M.isSubjectReference(he))&&(ie=re.some(de=>Ee(R,he,de,B)))}}else ie=M.isValue(Te)?be.some(he=>ae(Te,he)):M.isSubjectReference(Te)?be.some(he=>Ee(R,Te,he,B)):!!w.isObject(Te)&&be.length>0}}if(!ie&&B.requireAll)return!1;se=se||ie}return te||se}function k(R,S){const I=R.uniqueEmbeds[R.graph],B=I[S],te=B.parent,se=B.property,U={"@id":S};if(w.isArray(te)){for(let be=0;be<te.length;++be)if(T.compareValues(te[be],U)){te[be]=U;break}}else{const be=w.isArray(te[se]);T.removeValue(te,se,U,{propertyIsArray:be}),T.addValue(te,se,U,{propertyIsArray:be})}const ie=be=>{const ge=Object.keys(I);for(const Te of ge)Te in I&&w.isObject(I[Te].parent)&&I[Te].parent["@id"]===be&&(delete I[Te],ie(Te))};ie(S)}function ne(R,S){if(w.isArray(R))return R.map(I=>ne(I,S));if(w.isObject(R)){if("@preserve"in R)return R["@preserve"][0];if(M.isValue(R))return R;if(M.isList(R))return R["@list"]=ne(R["@list"],S),R;if("@id"in R){const I=R["@id"];if(S.link.hasOwnProperty(I)){const B=S.link[I].indexOf(R);if(-1!==B)return S.link[I][B];S.link[I].push(R)}else S.link[I]=[R]}for(const I in R)"@id"===I&&S.bnodesToClear.includes(R[I])?delete R["@id"]:R[I]=ne(R[I],S)}return R}function W(R,S,I){w.isObject(R)?T.addValue(R,S,I,{propertyIsArray:!0}):R.push(I)}function Ee(R,S,I,B){if(!("@id"in I))return!1;const te=R.subjects[I["@id"]];return te&&q(R,te,S,B)}function ae(R,S){const I=S["@value"],B=S["@type"],te=S["@language"],se=R["@value"]?w.isArray(R["@value"])?R["@value"]:[R["@value"]]:[],U=R["@type"]?w.isArray(R["@type"])?R["@type"]:[R["@type"]]:[],ie=R["@language"]?w.isArray(R["@language"])?R["@language"]:[R["@language"]]:[];return 0===se.length&&0===U.length&&0===ie.length||!(!se.includes(I)&&!w.isEmptyObject(se[0])||!(!B&&0===U.length||U.includes(B)||B&&w.isEmptyObject(U[0]))||!(!te&&0===ie.length||ie.includes(te)||te&&w.isEmptyObject(ie[0])))}Qe.exports=L,L.frameMergedOrDefault=(R,S,I)=>{const B={options:I,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},te=new T.IdentifierIssuer("_:b");E(R,B.graphMap,"@default",te),I.merged&&(B.graphMap["@merged"]=m(B.graphMap),B.graph="@merged"),B.subjects=B.graphMap[B.graph];const se=[];return L.frame(B,Object.keys(B.subjects).sort(),S,se),I.pruneBlankNodeIdentifiers&&(I.bnodesToClear=Object.keys(B.bnodeMap).filter(U=>1===B.bnodeMap[U].length)),I.link={},ne(se,I)},L.frame=(R,S,I,B,te=null)=>{_(I);const se=R.options,U={embed:G(I=I[0],se,"embed"),explicit:G(I,se,"explicit"),requireAll:G(I,se,"requireAll")};R.link.hasOwnProperty(R.graph)||(R.link[R.graph]={});const ie=R.link[R.graph],be=function O(R,S,I,B){const te={};for(const se of S){const U=R.graphMap[R.graph][se];q(R,U,I,B)&&(te[se]=U)}return te}(R,S,I,U),ge=Object.keys(be).sort();for(const Te of ge){const Ge=be[Te];if(null===te?R.uniqueEmbeds={[R.graph]:{}}:R.uniqueEmbeds[R.graph]=R.uniqueEmbeds[R.graph]||{},"@link"===U.embed&&Te in ie){W(B,te,ie[Te]);continue}const he={"@id":Te};if(0===Te.indexOf("_:")&&T.addValue(R.bnodeMap,Te,he,{propertyIsArray:!0}),ie[Te]=he,("@first"===U.embed||"@last"===U.embed)&&R.is11)throw new y("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:I});if(R.embedded||!R.uniqueEmbeds[R.graph].hasOwnProperty(Te)){if(R.embedded&&("@never"===U.embed||P(Ge,R.graph,R.subjectStack))){W(B,te,he);continue}if(R.embedded&&("@first"==U.embed||"@once"==U.embed)&&R.uniqueEmbeds[R.graph].hasOwnProperty(Te)){W(B,te,he);continue}if("@last"===U.embed&&Te in R.uniqueEmbeds[R.graph]&&k(R,Te),R.uniqueEmbeds[R.graph][Te]={parent:B,property:te},R.subjectStack.push({subject:Ge,graph:R.graph}),Te in R.graphMap){let re=!1,de=null;"@graph"in I?(de=I["@graph"][0],re=!("@merged"===Te||"@default"===Te),w.isObject(de)||(de={})):(re="@merged"!==R.graph,de={}),re&&L.frame({...R,graph:Te,embedded:!1},Object.keys(R.graphMap[Te]).sort(),[de],he,"@graph")}"@included"in I&&L.frame({...R,embedded:!1},S,I["@included"],he,"@included");for(const re of Object.keys(Ge).sort())if(Z(re)){if(he[re]=T.clone(Ge[re]),"@type"===re)for(const de of Ge["@type"])0===de.indexOf("_:")&&T.addValue(R.bnodeMap,de,he,{propertyIsArray:!0})}else if(!U.explicit||re in I)for(const de of Ge[re]){const Re=re in I?I[re]:D(U);if(M.isList(de)){const ye=I[re]&&I[re][0]&&I[re][0]["@list"]?I[re][0]["@list"]:D(U),oe={"@list":[]};W(he,re,oe);const Ne=de["@list"];for(const Ze of Ne)M.isSubjectReference(Ze)?L.frame({...R,embedded:!0},[Ze["@id"]],ye,oe,"@list"):W(oe,"@list",T.clone(Ze))}else M.isSubjectReference(de)?L.frame({...R,embedded:!0},[de["@id"]],Re,he,re):ae(Re[0],de)&&W(he,re,T.clone(de))}for(const re of Object.keys(I).sort()){if("@type"===re){if(!w.isObject(I[re][0])||!("@default"in I[re][0]))continue}else if(Z(re))continue;const de=I[re][0]||{};if(!G(de,se,"omitDefault")&&!(re in he)){let ye="@null";"@default"in de&&(ye=T.clone(de["@default"])),w.isArray(ye)||(ye=[ye]),he[re]=[{"@preserve":ye}]}}for(const re of Object.keys(I["@reverse"]||{}).sort()){const de=I["@reverse"][re];for(const Re of Object.keys(R.subjects))T.getValues(R.subjects[Re],re).some(oe=>oe["@id"]===Te)&&(he["@reverse"]=he["@reverse"]||{},T.addValue(he["@reverse"],re,[],{propertyIsArray:!0}),L.frame({...R,embedded:!0},[Re],de,he["@reverse"][re],te))}W(B,te,he),R.subjectStack.pop()}}},L.cleanupNull=(R,S)=>{if(w.isArray(R))return R.map(B=>L.cleanupNull(B,S)).filter(B=>B);if("@null"===R)return null;if(w.isObject(R)){if("@id"in R){const I=R["@id"];if(S.link.hasOwnProperty(I)){const B=S.link[I].indexOf(R);if(-1!==B)return S.link[I][B];S.link[I].push(R)}else S.link[I]=[R]}for(const I in R)R[I]=L.cleanupNull(R[I],S)}return R}},4814(Qe,Me,Y){"use strict";var Z=Y(9293).default;const M=Y(7881),w=Y(4209),T=Y(2831),{REGEX_BCP47:N,addValue:y}=Y(9420),{handleEvent:E}=Y(2585),{RDF_LIST:m,RDF_FIRST:L,RDF_REST:D,RDF_NIL:P,RDF_TYPE:G,RDF_JSON_LITERAL:_,XSD_BOOLEAN:O,XSD_DOUBLE:q,XSD_INTEGER:k,XSD_STRING:ne}=Y(5315),W={};function Ee(ae,R,S,I){if(ae.termType.endsWith("Node"))return{"@id":ae.value};const B={"@value":ae.value};if(ae.language)ae.language.match(N)||I.eventHandler&&E({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:ae.language}},options:I}),B["@language"]=ae.language;else{let te=ae.datatype.value;if(te||(te=ne),te===_){te="@json";try{B["@value"]=JSON.parse(B["@value"])}catch(se){throw new M("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:B["@value"],cause:se})}}if(R){if(te===O)"true"===B["@value"]?B["@value"]=!0:"false"===B["@value"]&&(B["@value"]=!1);else if(T.isNumeric(B["@value"]))if(te===k){const se=parseInt(B["@value"],10);se.toFixed(0)===B["@value"]&&(B["@value"]=se)}else te===q&&(B["@value"]=parseFloat(B["@value"]));[O,k,q,ne].includes(te)||(B["@type"]=te)}else if("i18n-datatype"===S&&te.startsWith("https://www.w3.org/ns/i18n#")){const[,se,U]=te.split(/[#_]/);se.length>0&&(B["@language"]=se,se.match(N)||I.eventHandler&&E({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:se}},options:I})),B["@direction"]=U}else te!==ne&&(B["@type"]=te)}return B}Qe.exports=W,W.fromRDF=function(){var ae=Z(function*(R,S){const{useRdfType:I=!1,useNativeTypes:B=!1,rdfDirection:te=null}=S,se={},U={"@default":se},ie={};if(te){if("compound-literal"===te)throw new M("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:te});if("i18n-datatype"!==te)throw new M("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:te})}for(const Te of R){const Ge="DefaultGraph"===Te.graph.termType?"@default":Te.graph.value;Ge in U||(U[Ge]={}),"@default"!==Ge&&!(Ge in se)&&(se[Ge]={"@id":Ge});const he=U[Ge],re=Te.subject.value,de=Te.predicate.value,Re=Te.object;re in he||(he[re]={"@id":re});const ye=he[re],oe=Re.termType.endsWith("Node");if(oe&&!(Re.value in he)&&(he[Re.value]={"@id":Re.value}),de===G&&!I&&oe){y(ye,"@type",Re.value,{propertyIsArray:!0});continue}const Ne=Ee(Re,B,te,S);if(y(ye,de,Ne,{propertyIsArray:!0}),oe)if(Re.value===P){const Ze=he[Re.value];"usages"in Ze||(Ze.usages=[]),Ze.usages.push({node:ye,property:de,value:Ne})}else ie[Re.value]=!(Re.value in ie)&&{node:ye,property:de,value:Ne}}for(const Te in U){const Ge=U[Te];if(!(P in Ge))continue;const he=Ge[P];if(he.usages){for(let re of he.usages){let de=re.node,Re=re.property,ye=re.value;const oe=[],Ne=[];let Ze=Object.keys(de).length;for(;Re===D&&T.isObject(ie[de["@id"]])&&T.isArray(de[L])&&1===de[L].length&&T.isArray(de[D])&&1===de[D].length&&(3===Ze||4===Ze&&T.isArray(de["@type"])&&1===de["@type"].length&&de["@type"][0]===m)&&(oe.push(de[L][0]),Ne.push(de["@id"]),re=ie[de["@id"]],de=re.node,Re=re.property,ye=re.value,Ze=Object.keys(de).length,w.isBlankNode(de)););delete ye["@id"],ye["@list"]=oe.reverse();for(const $e of Ne)delete Ge[$e]}delete he.usages}}const be=[],ge=Object.keys(se).sort();for(const Te of ge){const Ge=se[Te];if(Te in U){const he=Ge["@graph"]=[],re=U[Te],de=Object.keys(re).sort();for(const Re of de){const ye=re[Re];w.isSubjectReference(ye)||he.push(ye)}}w.isSubjectReference(Ge)||be.push(Ge)}return be});return function(R,S){return ae.apply(this,arguments)}}()},4209(Qe,Me,Y){"use strict";const Z=Y(2831),M={};Qe.exports=M,M.isSubject=w=>!(!Z.isObject(w)||"@value"in w||"@set"in w||"@list"in w)&&(Object.keys(w).length>1||!("@id"in w)),M.isSubjectReference=w=>Z.isObject(w)&&1===Object.keys(w).length&&"@id"in w,M.isValue=w=>Z.isObject(w)&&"@value"in w,M.isList=w=>Z.isObject(w)&&"@list"in w,M.isGraph=w=>Z.isObject(w)&&"@graph"in w&&1===Object.keys(w).filter(T=>"@id"!==T&&"@index"!==T).length,M.isSimpleGraph=w=>M.isGraph(w)&&!("@id"in w),M.isBlankNode=w=>{if(Z.isObject(w)){if("@id"in w){const T=w["@id"];return!Z.isString(T)||0===T.indexOf("_:")}return 0===Object.keys(w).length||!("@value"in w||"@set"in w||"@list"in w)}return!1}},2130(Qe,Me,Y){var Z=Y(9293).default;const M=Y(1224),w=Y(8666),T=Y(9420),N=Y(7839),y=T.IdentifierIssuer,E=Y(7881),m=Y(3052),L=Y(5426),{expand:D}=Y(7336),{flatten:P}=Y(9392),{fromRDF:G}=Y(4814),{toRDF:_}=Y(6397),{frameMergedOrDefault:O,cleanupNull:q}=Y(7031),{isArray:k,isObject:ne,isString:W}=Y(2831),{isSubjectReference:Ee}=Y(4209),{expandIri:ae,getInitialContext:R,process:S,processingMode:I}=Y(429),{compact:B,compactIri:te}=Y(3763),{createNodeMap:se,createMergedNodeMap:U,mergeNodeMaps:ie}=Y(5096),{logEventHandler:be,logWarningEventHandler:ge,safeEventHandler:Te,setDefaultEventHandler:Ge,setupEventHandler:he,strictEventHandler:re,unhandledEventHandler:de}=Y(2585),Re=function(oe){const Ne={},$e=new m({max:100});function et(Pe,{documentLoader:Ye=oe.documentLoader,...we}){if(Pe&&"compactionMap"in Pe)throw new E('"compactionMap" not supported.',"jsonld.OptionsError");if(Pe&&"expansionMap"in Pe)throw new E('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:Ye},we,Pe,{eventHandler:he({options:Pe})})}return oe.compact=function(){var Pe=Z(function*(Ye,we,le){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===we)throw new E("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===Ye)return null;let ke;(le=et(le,{base:W(Ye)?Ye:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new y("_:b"),contextResolver:new N({sharedCache:$e})})).link&&(le.skipExpansion=!0),le.compactToRelative||delete le.base,ke=le.skipExpansion?Ye:yield oe.expand(Ye,le);const We=yield oe.processContext(R(le),we,le);let Oe=yield B({activeCtx:We,element:ke,options:le});le.compactArrays&&!le.graph&&k(Oe)?1===Oe.length?Oe=Oe[0]:0===Oe.length&&(Oe={}):le.graph&&ne(Oe)&&(Oe=[Oe]),ne(we)&&"@context"in we&&(we=we["@context"]),we=T.clone(we),k(we)||(we=[we]);const it=we;we=[];for(let wt=0;wt<it.length;++wt)(!ne(it[wt])||Object.keys(it[wt]).length>0)&&we.push(it[wt]);const Be=we.length>0;if(1===we.length&&(we=we[0]),k(Oe)){const wt=te({activeCtx:We,iri:"@graph",relativeTo:{vocab:!0}}),nt=Oe;Oe={},Be&&(Oe["@context"]=we),Oe[wt]=nt}else if(ne(Oe)&&Be){const wt=Oe;Oe={"@context":we};for(const nt in wt)Oe[nt]=wt[nt]}return Oe});return function(Ye,we,le){return Pe.apply(this,arguments)}}(),oe.expand=function(){var Pe=Z(function*(Ye,we){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const le={},ke=[];if("expandContext"in(we=et(we,{keepFreeFloatingNodes:!1,contextResolver:new N({sharedCache:$e})}))){const Be=T.clone(we.expandContext);le.expandContext=ne(Be)&&"@context"in Be?Be:{"@context":Be},ke.push(le.expandContext)}let We;if(W(Ye)){const Be=yield oe.get(Ye,we);We=Be.documentUrl,le.input=Be.document,Be.contextUrl&&(le.remoteContext={"@context":Be.contextUrl},ke.push(le.remoteContext))}else le.input=T.clone(Ye);"base"in we||(we.base=We||"");let Oe=R(we);for(const Be of ke)Oe=yield S({activeCtx:Oe,localCtx:Be,options:we});let it=yield D({activeCtx:Oe,element:le.input,options:we});return ne(it)&&"@graph"in it&&1===Object.keys(it).length?it=it["@graph"]:null===it&&(it=[]),k(it)||(it=[it]),it});return function(Ye,we){return Pe.apply(this,arguments)}}(),oe.flatten=function(){var Pe=Z(function*(Ye,we,le){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");we="function"==typeof we?null:we||null,le=et(le,{base:W(Ye)?Ye:"",contextResolver:new N({sharedCache:$e})});const ke=yield oe.expand(Ye,le),We=P(ke);return null===we?We:(le.graph=!0,le.skipExpansion=!0,yield oe.compact(We,we,le))});return function(Ye,we,le){return Pe.apply(this,arguments)}}(),oe.frame=function(){var Pe=Z(function*(Ye,we,le){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(le=et(le,{base:W(Ye)?Ye:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new N({sharedCache:$e})}),W(we)){const At=yield oe.get(we,le);if(we=At.document,At.contextUrl){let qt=we["@context"];qt?k(qt)?qt.push(At.contextUrl):qt=[qt,At.contextUrl]:qt=At.contextUrl,we["@context"]=qt}}const ke=we&&we["@context"]||{},We=yield oe.processContext(R(le),ke,le);le.hasOwnProperty("omitGraph")||(le.omitGraph=I(We,1.1)),le.hasOwnProperty("pruneBlankNodeIdentifiers")||(le.pruneBlankNodeIdentifiers=I(We,1.1));const Oe=yield oe.expand(Ye,le),it={...le};it.isFrame=!0,it.keepFreeFloatingNodes=!0;const Be=yield oe.expand(we,it),wt=Object.keys(we).map(At=>ae(We,At,{vocab:!0}));it.merged=!wt.includes("@graph"),it.is11=I(We,1.1);const nt=O(Oe,Be,it);it.graph=!le.omitGraph,it.skipExpansion=!0,it.link={},it.framing=!0;let vt=yield oe.compact(nt,ke,it);return it.link={},vt=q(vt,it),vt});return function(Ye,we,le){return Pe.apply(this,arguments)}}(),oe.link=function(){var Pe=Z(function*(Ye,we,le){const ke={};return we&&(ke["@context"]=we),ke["@embed"]="@link",oe.frame(Ye,ke,le)});return function(Ye,we,le){return Pe.apply(this,arguments)}}(),oe.normalize=oe.canonize=function(){var Pe=Z(function*(Ye,we){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(we=et(we,{base:W(Ye)?Ye:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new N({sharedCache:$e})}))){if("application/n-quads"!==we.inputFormat&&"application/nquads"!==we.inputFormat)throw new E("Unknown canonicalization input format.","jsonld.CanonizeError");const We=L.parse(Ye);return M.canonize(We,we)}const le={...we};delete le.format,le.produceGeneralizedRdf=!1;const ke=yield oe.toRDF(Ye,le);return M.canonize(ke,we)});return function(Ye,we){return Pe.apply(this,arguments)}}(),oe.fromRDF=function(){var Pe=Z(function*(Ye,we){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");we=et(we,{format:W(Ye)?"application/n-quads":void 0});const{format:le}=we;let{rdfParser:ke}=we;if(le){if(ke=ke||Ne[le],!ke)throw new E("Unknown input format.","jsonld.UnknownFormat",{format:le})}else ke=()=>Ye;const We=yield ke(Ye);return G(We,we)});return function(Ye,we){return Pe.apply(this,arguments)}}(),oe.toRDF=function(){var Pe=Z(function*(Ye,we){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let le;le=(we=et(we,{base:W(Ye)?Ye:"",skipExpansion:!1,contextResolver:new N({sharedCache:$e})})).skipExpansion?Ye:yield oe.expand(Ye,we);const ke=_(le,we);if(we.format){if("application/n-quads"===we.format||"application/nquads"===we.format)return L.serialize(ke);throw new E("Unknown output format.","jsonld.UnknownFormat",{format:we.format})}return ke});return function(Ye,we){return Pe.apply(this,arguments)}}(),oe.createNodeMap=function(){var Pe=Z(function*(Ye,we){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");we=et(we,{base:W(Ye)?Ye:"",contextResolver:new N({sharedCache:$e})});const le=yield oe.expand(Ye,we);return U(le,we)});return function(Ye,we){return Pe.apply(this,arguments)}}(),oe.merge=function(){var Pe=Z(function*(Ye,we,le){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!k(Ye))throw new TypeError('Could not merge, "docs" must be an array.');we="function"==typeof we?null:we||null,le=et(le,{contextResolver:new N({sharedCache:$e})});const ke=yield Promise.all(Ye.map(At=>{const qt={...le};return oe.expand(At,qt)}));let We=!0;"mergeNodes"in le&&(We=le.mergeNodes);const Oe=le.issuer||new y("_:b"),it={"@default":{}};for(let At=0;At<ke.length;++At){const qt=T.relabelBlankNodes(ke[At],{issuer:new y("_:b"+At+"-")}),wr=We||0===At?it:{"@default":{}};if(se(qt,wr,"@default",Oe),wr!==it)for(const pn in wr){const ia=wr[pn];if(!(pn in it)){it[pn]=ia;continue}const Sr=it[pn];for(const sa in ia)sa in Sr||(Sr[sa]=ia[sa])}}const Be=ie(it),wt=[],nt=Object.keys(Be).sort();for(let At=0;At<nt.length;++At){const qt=Be[nt[At]];Ee(qt)||wt.push(qt)}return null===we?wt:(le.graph=!0,le.skipExpansion=!0,yield oe.compact(wt,we,le))});return function(Ye,we,le){return Pe.apply(this,arguments)}}(),Object.defineProperty(oe,"documentLoader",{get:()=>oe._documentLoader,set:Pe=>oe._documentLoader=Pe}),oe.documentLoader=function(){var Pe=Z(function*(Ye){throw new E("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:Ye})});return function(Ye){return Pe.apply(this,arguments)}}(),oe.get=function(){var Pe=Z(function*(Ye,we){let le;le="function"==typeof we.documentLoader?we.documentLoader:oe.documentLoader;const ke=yield le(Ye);try{if(!ke.document)throw new E("No remote document found at the given URL.","jsonld.NullRemoteDocument");W(ke.document)&&(ke.document=JSON.parse(ke.document))}catch(We){throw new E("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:We,remoteDoc:ke})}return ke});return function(Ye,we){return Pe.apply(this,arguments)}}(),oe.processContext=function(){var Pe=Z(function*(Ye,we,le){return le=et(le,{base:"",contextResolver:new N({sharedCache:$e})}),null===we?R(le):(we=T.clone(we),ne(we)&&"@context"in we||(we={"@context":we}),S({activeCtx:Ye,localCtx:we,options:le}))});return function(Ye,we,le){return Pe.apply(this,arguments)}}(),oe.getContextValue=Y(429).getContextValue,oe.documentLoaders={},oe.useDocumentLoader=function(Pe){if(!(Pe in oe.documentLoaders))throw new E('Unknown document loader type: "'+Pe+'"',"jsonld.UnknownDocumentLoader",{type:Pe});oe.documentLoader=oe.documentLoaders[Pe].apply(oe,Array.prototype.slice.call(arguments,1))},oe.registerRDFParser=function(Pe,Ye){Ne[Pe]=Ye},oe.unregisterRDFParser=function(Pe){delete Ne[Pe]},oe.registerRDFParser("application/n-quads",L.parse),oe.registerRDFParser("application/nquads",L.parse),oe.url=Y(2051),oe.logEventHandler=be,oe.logWarningEventHandler=ge,oe.safeEventHandler=Te,oe.setDefaultEventHandler=Ge,oe.strictEventHandler=re,oe.unhandledEventHandler=de,oe.util=T,Object.assign(oe,T),oe.promises=oe,oe.RequestQueue=Y(4808),oe.JsonLdProcessor=Y(1328)(oe),w.setupGlobals(oe),w.setupDocumentLoaders(oe),oe},ye=function(){return Re(function(){return ye()})};Re(ye),Qe.exports=ye},5096(Qe,Me,Y){"use strict";const{isKeyword:Z}=Y(429),M=Y(4209),w=Y(2831),T=Y(9420),N=Y(7881),y={};Qe.exports=y,y.createMergedNodeMap=(E,m)=>{const L=(m=m||{}).issuer||new T.IdentifierIssuer("_:b"),D={"@default":{}};return y.createNodeMap(E,D,"@default",L),y.mergeNodeMaps(D)},y.createNodeMap=(E,m,L,D,P,G)=>{if(w.isArray(E)){for(const k of E)y.createNodeMap(k,m,L,D,void 0,G);return}if(!w.isObject(E))return void(G&&G.push(E));if(M.isValue(E)){if("@type"in E){let k=E["@type"];0===k.indexOf("_:")&&(E["@type"]=k=D.getId(k))}return void(G&&G.push(E))}if(G&&M.isList(E)){const k=[];return y.createNodeMap(E["@list"],m,L,D,P,k),void G.push({"@list":k})}if("@type"in E){const k=E["@type"];for(const ne of k)0===ne.indexOf("_:")&&D.getId(ne)}w.isUndefined(P)&&(P=M.isBlankNode(E)?D.getId(E["@id"]):E["@id"]),G&&G.push({"@id":P});const _=m[L],O=_[P]=_[P]||{};O["@id"]=P;const q=Object.keys(E).sort();for(let k of q){if("@id"===k)continue;if("@reverse"===k){const W={"@id":P},Ee=E["@reverse"];for(const ae in Ee){const R=Ee[ae];for(const S of R){let I=S["@id"];M.isBlankNode(S)&&(I=D.getId(I)),y.createNodeMap(S,m,L,D,I),T.addValue(_[I],ae,W,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===k){P in m||(m[P]={}),y.createNodeMap(E[k],m,P,D);continue}if("@included"===k){y.createNodeMap(E[k],m,L,D);continue}if("@type"!==k&&Z(k)){if("@index"===k&&k in O&&(E[k]!==O[k]||E[k]["@id"]!==O[k]["@id"]))throw new N("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:O});O[k]=E[k];continue}const ne=E[k];if(0===k.indexOf("_:")&&(k=D.getId(k)),0!==ne.length)for(let W of ne)if("@type"===k&&(W=0===W.indexOf("_:")?D.getId(W):W),M.isSubject(W)||M.isSubjectReference(W)){if("@id"in W&&!W["@id"])continue;const Ee=M.isBlankNode(W)?D.getId(W["@id"]):W["@id"];T.addValue(O,k,{"@id":Ee},{propertyIsArray:!0,allowDuplicate:!1}),y.createNodeMap(W,m,L,D,Ee)}else if(M.isValue(W))T.addValue(O,k,W,{propertyIsArray:!0,allowDuplicate:!1});else if(M.isList(W)){const Ee=[];y.createNodeMap(W["@list"],m,L,D,P,Ee),W={"@list":Ee},T.addValue(O,k,W,{propertyIsArray:!0,allowDuplicate:!1})}else y.createNodeMap(W,m,L,D,P),T.addValue(O,k,W,{propertyIsArray:!0,allowDuplicate:!1});else T.addValue(O,k,[],{propertyIsArray:!0})}},y.mergeNodeMapGraphs=E=>{const m={};for(const L of Object.keys(E).sort())for(const D of Object.keys(E[L]).sort()){const P=E[L][D];D in m||(m[D]={"@id":D});const G=m[D];for(const _ of Object.keys(P).sort())if(Z(_)&&"@type"!==_)G[_]=T.clone(P[_]);else for(const O of P[_])T.addValue(G,_,T.clone(O),{propertyIsArray:!0,allowDuplicate:!1})}return m},y.mergeNodeMaps=E=>{const m=E["@default"],L=Object.keys(E).sort();for(const D of L){if("@default"===D)continue;const P=E[D];let G=m[D];G?"@graph"in G||(G["@graph"]=[]):m[D]=G={"@id":D,"@graph":[]};const _=G["@graph"];for(const O of Object.keys(P).sort()){const q=P[O];M.isSubjectReference(q)||_.push(q)}}return m}},8666(Qe,Me,Y){"use strict";const Z=Y(3120),M={};Qe.exports=M,M.setupDocumentLoaders=function(w){typeof XMLHttpRequest<"u"&&(w.documentLoaders.xhr=Z,w.useDocumentLoader("xhr"))},M.setupGlobals=function(w){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:w.JsonLdProcessor})}},6397(Qe,Me,Y){"use strict";const{createNodeMap:Z}=Y(5096),{isKeyword:M}=Y(429),w=Y(4209),T=Y(8846),N=Y(7881),y=Y(2831),E=Y(9420),{handleEvent:m}=Y(2585),{RDF_FIRST:L,RDF_REST:D,RDF_NIL:P,RDF_TYPE:G,RDF_JSON_LITERAL:_,RDF_LANGSTRING:O,XSD_BOOLEAN:q,XSD_DOUBLE:k,XSD_INTEGER:ne,XSD_STRING:W}=Y(5315),{isAbsolute:Ee}=Y(2051),ae={};function R(B,te,se,U,ie){const be=Object.keys(te).sort();for(const ge of be){const Te=te[ge],Ge=Object.keys(Te).sort();for(let he of Ge){const re=Te[he];if("@type"===he)he=G;else if(M(he))continue;for(const de of re){const Re={termType:ge.startsWith("_:")?"BlankNode":"NamedNode",value:ge};if(!Ee(ge)){ie.eventHandler&&m({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:ge}},options:ie});continue}const ye={termType:he.startsWith("_:")?"BlankNode":"NamedNode",value:he};if(!Ee(he)){ie.eventHandler&&m({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:he}},options:ie});continue}if("BlankNode"===ye.termType&&!ie.produceGeneralizedRdf){ie.eventHandler&&m({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:U.getOldIds().find(Ne=>U.getId(Ne)===he)}},options:ie});continue}const oe=I(de,U,B,se,ie.rdfDirection,ie);oe&&B.push({subject:Re,predicate:ye,object:oe,graph:se})}}}}function I(B,te,se,U,ie,be){const ge={};if(w.isValue(B)){ge.termType="Literal",ge.value=void 0,ge.datatype={termType:"NamedNode"};let Te=B["@value"];const Ge=B["@type"]||null;if("@json"===Ge)ge.value=T(Te),ge.datatype.value=_;else if(y.isBoolean(Te))ge.value=Te.toString(),ge.datatype.value=Ge||q;else if(y.isDouble(Te)||Ge===k)y.isDouble(Te)||(Te=parseFloat(Te)),ge.value=Te.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),ge.datatype.value=Ge||k;else if(y.isNumber(Te))ge.value=Te.toFixed(0),ge.datatype.value=Ge||ne;else if("@direction"in B&&"i18n-datatype"===ie){const he=(B["@language"]||"").toLowerCase();ge.datatype.value=`https://www.w3.org/ns/i18n#${he}_${B["@direction"]}`,ge.value=Te}else{if("@direction"in B&&"compound-literal"===ie)throw new N("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:ie});if("@direction"in B&&ie)throw new N("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:ie});"@language"in B?("@direction"in B&&!ie&&be.eventHandler&&m({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:ge.value}},options:be}),ge.value=Te,ge.datatype.value=Ge||O,ge.language=B["@language"]):("@direction"in B&&!ie&&be.eventHandler&&m({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:ge.value}},options:be}),ge.value=Te,ge.datatype.value=Ge||W)}}else if(w.isList(B)){const Te=function S(B,te,se,U,ie,be){const ge={termType:"NamedNode",value:L},Te={termType:"NamedNode",value:D},Ge={termType:"NamedNode",value:P},he=B.pop(),re=he?{termType:"BlankNode",value:te.getId()}:Ge;let de=re;for(const Re of B){const ye=I(Re,te,se,U,ie,be),oe={termType:"BlankNode",value:te.getId()};se.push({subject:de,predicate:ge,object:ye,graph:U}),se.push({subject:de,predicate:Te,object:oe,graph:U}),de=oe}if(he){const Re=I(he,te,se,U,ie,be);se.push({subject:de,predicate:ge,object:Re,graph:U}),se.push({subject:de,predicate:Te,object:Ge,graph:U})}return re}(B["@list"],te,se,U,ie,be);ge.termType=Te.termType,ge.value=Te.value}else{const Te=y.isObject(B)?B["@id"]:B;ge.termType=Te.startsWith("_:")?"BlankNode":"NamedNode",ge.value=Te}return"NamedNode"!==ge.termType||Ee(ge.value)?ge:(be.eventHandler&&m({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:ge.value}},options:be}),null)}Qe.exports=ae,ae.toRDF=(B,te)=>{const se=new E.IdentifierIssuer("_:b"),U={"@default":{}};Z(B,U,"@default",se);const ie=[],be=Object.keys(U).sort();for(const ge of be){let Te;if("@default"===ge)Te={termType:"DefaultGraph",value:""};else{if(!Ee(ge)){te.eventHandler&&m({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:ge}},options:te});continue}Te=ge.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},Te.value=ge}R(ie,U[ge],Te,se,te)}return ie}},2831(Qe){"use strict";const Me={};Qe.exports=Me,Me.isArray=Array.isArray,Me.isBoolean=Y=>"boolean"==typeof Y||"[object Boolean]"===Object.prototype.toString.call(Y),Me.isDouble=Y=>Me.isNumber(Y)&&(-1!==String(Y).indexOf(".")||Math.abs(Y)>=1e21),Me.isEmptyObject=Y=>Me.isObject(Y)&&0===Object.keys(Y).length,Me.isNumber=Y=>"number"==typeof Y||"[object Number]"===Object.prototype.toString.call(Y),Me.isNumeric=Y=>!isNaN(parseFloat(Y))&&isFinite(Y),Me.isObject=Y=>"[object Object]"===Object.prototype.toString.call(Y),Me.isString=Y=>"string"==typeof Y||"[object String]"===Object.prototype.toString.call(Y),Me.isUndefined=Y=>typeof Y>"u"},2051(Qe,Me,Y){"use strict";const Z=Y(2831),M={};Qe.exports=M,M.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},M.parse=(T,N)=>{const y={},E=M.parsers[N||"full"],m=E.regex.exec(T);let L=E.keys.length;for(;L--;)y[E.keys[L]]=void 0===m[L]?null:m[L];return("https"===y.scheme&&"443"===y.port||"http"===y.scheme&&"80"===y.port)&&(y.href=y.href.replace(":"+y.port,""),y.authority=y.authority.replace(":"+y.port,""),y.port=null),y.normalizedPath=M.removeDotSegments(y.path),y},M.prependBase=(T,N)=>{if(null===T||M.isAbsolute(N))return N;(!T||Z.isString(T))&&(T=M.parse(T||""));const y=M.parse(N),E={protocol:T.protocol||""};if(null!==y.authority)E.authority=y.authority,E.path=y.path,E.query=y.query;else if(E.authority=T.authority,""===y.path)E.path=T.path,E.query=null!==y.query?y.query:T.query;else{if(0===y.path.indexOf("/"))E.path=y.path;else{let L=T.path;L=L.substr(0,L.lastIndexOf("/")+1),(L.length>0||T.authority)&&"/"!==L.substr(-1)&&(L+="/"),L+=y.path,E.path=L}E.query=y.query}""!==y.path&&(E.path=M.removeDotSegments(E.path));let m=E.protocol;return null!==E.authority&&(m+="//"+E.authority),m+=E.path,null!==E.query&&(m+="?"+E.query),null!==y.fragment&&(m+="#"+y.fragment),""===m&&(m="./"),m},M.removeBase=(T,N)=>{if(null===T)return N;(!T||Z.isString(T))&&(T=M.parse(T||""));let y="";if(""!==T.href?y+=(T.protocol||"")+"//"+(T.authority||""):N.indexOf("//")&&(y+="//"),0!==N.indexOf(y))return N;const E=M.parse(N.substr(y.length)),m=T.normalizedPath.split("/"),L=E.normalizedPath.split("/"),D=E.fragment||E.query?0:1;for(;m.length>0&&L.length>D&&m[0]===L[0];)m.shift(),L.shift();let P="";if(m.length>0){m.pop();for(let G=0;G<m.length;++G)P+="../"}return P+=L.join("/"),null!==E.query&&(P+="?"+E.query),null!==E.fragment&&(P+="#"+E.fragment),""===P&&(P="./"),P},M.removeDotSegments=T=>{if(0===T.length)return"";const N=T.split("/"),y=[];for(;N.length>0;){const E=N.shift(),m=0===N.length;"."!==E?".."!==E?y.push(E):(y.pop(),m&&y.push("")):m&&y.push("")}return"/"===T[0]&&y.length>0&&""!==y[0]&&y.unshift(""),1===y.length&&""===y[0]?"/":y.join("/")};const w=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;M.isAbsolute=T=>Z.isString(T)&&w.test(T),M.isRelative=T=>Z.isString(T)},9420(Qe,Me,Y){"use strict";const Z=Y(4209),M=Y(2831),w=Y(1224).IdentifierIssuer,T=Y(7881),y=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,E=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,m=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,D_headers_accept="application/ld+json, application/json",P={};function G(_,O){if(M.isArray(O))for(let q=0;q<O.length;++q)O[q]=G(_,O[q]);else if(Z.isList(O))O["@list"]=G(_,O["@list"]);else if(M.isObject(O)){Z.isBlankNode(O)&&(O["@id"]=_.getId(O["@id"]));const q=Object.keys(O).sort();for(let k=0;k<q.length;++k){const ne=q[k];"@id"!==ne&&(O[ne]=G(_,O[ne]))}}return O}Qe.exports=P,P.IdentifierIssuer=w,P.REGEX_BCP47=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,P.REGEX_KEYWORD=/^@[a-zA-Z]+$/,P.clone=function(_){if(_&&"object"==typeof _){let O;if(M.isArray(_)){O=[];for(let q=0;q<_.length;++q)O[q]=P.clone(_[q])}else if(_ instanceof Map){O=new Map;for(const[q,k]of _)O.set(q,P.clone(k))}else if(_ instanceof Set){O=new Set;for(const q of _)O.add(P.clone(q))}else if(M.isObject(_)){O={};for(const q in _)O[q]=P.clone(_[q])}else O=_.toString();return O}return _},P.asArray=function(_){return Array.isArray(_)?_:[_]},P.buildHeaders=(_={})=>{if(Object.keys(_).some(q=>"accept"===q.toLowerCase()))throw new RangeError('Accept header may not be specified; only "'+D_headers_accept+'" is supported.');return Object.assign({Accept:D_headers_accept},_)},P.parseLinkHeader=_=>{const O={},q=_.match(y);for(let k=0;k<q.length;++k){let ne=q[k].match(E);if(!ne)continue;const W={target:ne[1]},Ee=ne[2];for(;ne=m.exec(Ee);)W[ne[1]]=void 0===ne[2]?ne[3]:ne[2];const ae=W.rel||"";Array.isArray(O[ae])?O[ae].push(W):O[ae]=O.hasOwnProperty(ae)?[O[ae],W]:W}return O},P.validateTypeValue=(_,O)=>{if(!(M.isString(_)||M.isArray(_)&&_.every(q=>M.isString(q)))){if(O&&M.isObject(_))switch(Object.keys(_).length){case 0:return;case 1:if("@default"in _&&P.asArray(_["@default"]).every(q=>M.isString(q)))return}throw new T('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:_})}},P.hasProperty=(_,O)=>{if(_.hasOwnProperty(O)){const q=_[O];return!M.isArray(q)||q.length>0}return!1},P.hasValue=(_,O,q)=>{if(P.hasProperty(_,O)){let k=_[O];const ne=Z.isList(k);if(M.isArray(k)||ne){ne&&(k=k["@list"]);for(let W=0;W<k.length;++W)if(P.compareValues(q,k[W]))return!0}else if(!M.isArray(q))return P.compareValues(q,k)}return!1},P.addValue=(_,O,q,k)=>{if("propertyIsArray"in(k=k||{})||(k.propertyIsArray=!1),"valueIsArray"in k||(k.valueIsArray=!1),"allowDuplicate"in k||(k.allowDuplicate=!0),"prependValue"in k||(k.prependValue=!1),k.valueIsArray)_[O]=q;else if(M.isArray(q)){0===q.length&&k.propertyIsArray&&!_.hasOwnProperty(O)&&(_[O]=[]),k.prependValue&&(q=q.concat(_[O]),_[O]=[]);for(let ne=0;ne<q.length;++ne)P.addValue(_,O,q[ne],k)}else if(_.hasOwnProperty(O)){const ne=!k.allowDuplicate&&P.hasValue(_,O,q);!M.isArray(_[O])&&(!ne||k.propertyIsArray)&&(_[O]=[_[O]]),ne||(k.prependValue?_[O].unshift(q):_[O].push(q))}else _[O]=k.propertyIsArray?[q]:q},P.getValues=(_,O)=>[].concat(_[O]||[]),P.removeProperty=(_,O)=>{delete _[O]},P.removeValue=(_,O,q,k)=>{"propertyIsArray"in(k=k||{})||(k.propertyIsArray=!1);const ne=P.getValues(_,O).filter(W=>!P.compareValues(W,q));0===ne.length?P.removeProperty(_,O):_[O]=1!==ne.length||k.propertyIsArray?ne:ne[0]},P.relabelBlankNodes=(_,O)=>G((O=O||{}).issuer||new w("_:b"),_),P.compareValues=(_,O)=>!!(_===O||Z.isValue(_)&&Z.isValue(O)&&_["@value"]===O["@value"]&&_["@type"]===O["@type"]&&_["@language"]===O["@language"]&&_["@index"]===O["@index"])||!!(M.isObject(_)&&"@id"in _&&M.isObject(O)&&"@id"in O)&&_["@id"]===O["@id"],P.compareShortestLeast=(_,O)=>_.length<O.length?-1:O.length<_.length?1:_===O?0:_<O?-1:1},3052(Qe,Me,Y){"use strict";const Z=Y(4842),M=Symbol("max"),w=Symbol("length"),T=Symbol("lengthCalculator"),N=Symbol("allowStale"),y=Symbol("maxAge"),E=Symbol("dispose"),m=Symbol("noDisposeOnSet"),L=Symbol("lruList"),D=Symbol("cache"),P=Symbol("updateAgeOnGet"),G=()=>1,O=(ae,R,S)=>{const I=ae[D].get(R);if(I){const B=I.value;if(q(ae,B)){if(ne(ae,I),!ae[N])return}else S&&(ae[P]&&(I.value.now=Date.now()),ae[L].unshiftNode(I));return B.value}},q=(ae,R)=>{if(!R||!R.maxAge&&!ae[y])return!1;const S=Date.now()-R.now;return R.maxAge?S>R.maxAge:ae[y]&&S>ae[y]},k=ae=>{if(ae[w]>ae[M])for(let R=ae[L].tail;ae[w]>ae[M]&&null!==R;){const S=R.prev;ne(ae,R),R=S}},ne=(ae,R)=>{if(R){const S=R.value;ae[E]&&ae[E](S.key,S.value),ae[w]-=S.length,ae[D].delete(S.key),ae[L].removeNode(R)}};class W{constructor(R,S,I,B,te){this.key=R,this.value=S,this.length=I,this.now=B,this.maxAge=te||0}}const Ee=(ae,R,S,I)=>{let B=S.value;q(ae,B)&&(ne(ae,S),ae[N]||(B=void 0)),B&&R.call(I,B.value,B.key,ae)};Qe.exports=class _{constructor(R){if("number"==typeof R&&(R={max:R}),R||(R={}),R.max&&("number"!=typeof R.max||R.max<0))throw new TypeError("max must be a non-negative number");this[M]=R.max||1/0;const I=R.length||G;if(this[T]="function"!=typeof I?G:I,this[N]=R.stale||!1,R.maxAge&&"number"!=typeof R.maxAge)throw new TypeError("maxAge must be a number");this[y]=R.maxAge||0,this[E]=R.dispose,this[m]=R.noDisposeOnSet||!1,this[P]=R.updateAgeOnGet||!1,this.reset()}set max(R){if("number"!=typeof R||R<0)throw new TypeError("max must be a non-negative number");this[M]=R||1/0,k(this)}get max(){return this[M]}set allowStale(R){this[N]=!!R}get allowStale(){return this[N]}set maxAge(R){if("number"!=typeof R)throw new TypeError("maxAge must be a non-negative number");this[y]=R,k(this)}get maxAge(){return this[y]}set lengthCalculator(R){"function"!=typeof R&&(R=G),R!==this[T]&&(this[T]=R,this[w]=0,this[L].forEach(S=>{S.length=this[T](S.value,S.key),this[w]+=S.length})),k(this)}get lengthCalculator(){return this[T]}get length(){return this[w]}get itemCount(){return this[L].length}rforEach(R,S){S=S||this;for(let I=this[L].tail;null!==I;){const B=I.prev;Ee(this,R,I,S),I=B}}forEach(R,S){S=S||this;for(let I=this[L].head;null!==I;){const B=I.next;Ee(this,R,I,S),I=B}}keys(){return this[L].toArray().map(R=>R.key)}values(){return this[L].toArray().map(R=>R.value)}reset(){this[E]&&this[L]&&this[L].length&&this[L].forEach(R=>this[E](R.key,R.value)),this[D]=new Map,this[L]=new Z,this[w]=0}dump(){return this[L].map(R=>!q(this,R)&&{k:R.key,v:R.value,e:R.now+(R.maxAge||0)}).toArray().filter(R=>R)}dumpLru(){return this[L]}set(R,S,I){if((I=I||this[y])&&"number"!=typeof I)throw new TypeError("maxAge must be a number");const B=I?Date.now():0,te=this[T](S,R);if(this[D].has(R)){if(te>this[M])return ne(this,this[D].get(R)),!1;const ie=this[D].get(R).value;return this[E]&&(this[m]||this[E](R,ie.value)),ie.now=B,ie.maxAge=I,ie.value=S,this[w]+=te-ie.length,ie.length=te,this.get(R),k(this),!0}const se=new W(R,S,te,B,I);return se.length>this[M]?(this[E]&&this[E](R,S),!1):(this[w]+=se.length,this[L].unshift(se),this[D].set(R,this[L].head),k(this),!0)}has(R){if(!this[D].has(R))return!1;const S=this[D].get(R).value;return!q(this,S)}get(R){return O(this,R,!0)}peek(R){return O(this,R,!1)}pop(){const R=this[L].tail;return R?(ne(this,R),R.value):null}del(R){ne(this,this[D].get(R))}load(R){this.reset();const S=Date.now();for(let I=R.length-1;I>=0;I--){const B=R[I],te=B.e||0;if(0===te)this.set(B.k,B.v);else{const se=te-S;se>0&&this.set(B.k,B.v,se)}}}prune(){this[D].forEach((R,S)=>O(this,S,!1))}}},7568(Qe){"use strict";Qe.exports=function(Me){Me.prototype[Symbol.iterator]=function*(){for(let Y=this.head;Y;Y=Y.next)yield Y.value}}},4842(Qe,Me,Y){"use strict";function Z(y){var E=this;if(E instanceof Z||(E=new Z),E.tail=null,E.head=null,E.length=0,y&&"function"==typeof y.forEach)y.forEach(function(D){E.push(D)});else if(arguments.length>0)for(var m=0,L=arguments.length;m<L;m++)E.push(arguments[m]);return E}function M(y,E,m){var L=E===y.head?new N(m,null,E,y):new N(m,E,E.next,y);return null===L.next&&(y.tail=L),null===L.prev&&(y.head=L),y.length++,L}function w(y,E){y.tail=new N(E,y.tail,null,y),y.head||(y.head=y.tail),y.length++}function T(y,E){y.head=new N(E,null,y.head,y),y.tail||(y.tail=y.head),y.length++}function N(y,E,m,L){if(!(this instanceof N))return new N(y,E,m,L);this.list=L,this.value=y,E?(E.next=this,this.prev=E):this.prev=null,m?(m.prev=this,this.next=m):this.next=null}Qe.exports=Z,Z.Node=N,Z.create=Z,Z.prototype.removeNode=function(y){if(y.list!==this)throw new Error("removing node which does not belong to this list");var E=y.next,m=y.prev;return E&&(E.prev=m),m&&(m.next=E),y===this.head&&(this.head=E),y===this.tail&&(this.tail=m),y.list.length--,y.next=null,y.prev=null,y.list=null,E},Z.prototype.unshiftNode=function(y){if(y!==this.head){y.list&&y.list.removeNode(y);var E=this.head;y.list=this,y.next=E,E&&(E.prev=y),this.head=y,this.tail||(this.tail=y),this.length++}},Z.prototype.pushNode=function(y){if(y!==this.tail){y.list&&y.list.removeNode(y);var E=this.tail;y.list=this,y.prev=E,E&&(E.next=y),this.tail=y,this.head||(this.head=y),this.length++}},Z.prototype.push=function(){for(var y=0,E=arguments.length;y<E;y++)w(this,arguments[y]);return this.length},Z.prototype.unshift=function(){for(var y=0,E=arguments.length;y<E;y++)T(this,arguments[y]);return this.length},Z.prototype.pop=function(){if(this.tail){var y=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,y}},Z.prototype.shift=function(){if(this.head){var y=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,y}},Z.prototype.forEach=function(y,E){E=E||this;for(var m=this.head,L=0;null!==m;L++)y.call(E,m.value,L,this),m=m.next},Z.prototype.forEachReverse=function(y,E){E=E||this;for(var m=this.tail,L=this.length-1;null!==m;L--)y.call(E,m.value,L,this),m=m.prev},Z.prototype.get=function(y){for(var E=0,m=this.head;null!==m&&E<y;E++)m=m.next;if(E===y&&null!==m)return m.value},Z.prototype.getReverse=function(y){for(var E=0,m=this.tail;null!==m&&E<y;E++)m=m.prev;if(E===y&&null!==m)return m.value},Z.prototype.map=function(y,E){E=E||this;for(var m=new Z,L=this.head;null!==L;)m.push(y.call(E,L.value,this)),L=L.next;return m},Z.prototype.mapReverse=function(y,E){E=E||this;for(var m=new Z,L=this.tail;null!==L;)m.push(y.call(E,L.value,this)),L=L.prev;return m},Z.prototype.reduce=function(y,E){var m,L=this.head;if(arguments.length>1)m=E;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");L=this.head.next,m=this.head.value}for(var D=0;null!==L;D++)m=y(m,L.value,D),L=L.next;return m},Z.prototype.reduceReverse=function(y,E){var m,L=this.tail;if(arguments.length>1)m=E;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");L=this.tail.prev,m=this.tail.value}for(var D=this.length-1;null!==L;D--)m=y(m,L.value,D),L=L.prev;return m},Z.prototype.toArray=function(){for(var y=new Array(this.length),E=0,m=this.head;null!==m;E++)y[E]=m.value,m=m.next;return y},Z.prototype.toArrayReverse=function(){for(var y=new Array(this.length),E=0,m=this.tail;null!==m;E++)y[E]=m.value,m=m.prev;return y},Z.prototype.slice=function(y,E){(E=E||this.length)<0&&(E+=this.length),(y=y||0)<0&&(y+=this.length);var m=new Z;if(E<y||E<0)return m;y<0&&(y=0),E>this.length&&(E=this.length);for(var L=0,D=this.head;null!==D&&L<y;L++)D=D.next;for(;null!==D&&L<E;L++,D=D.next)m.push(D.value);return m},Z.prototype.sliceReverse=function(y,E){(E=E||this.length)<0&&(E+=this.length),(y=y||0)<0&&(y+=this.length);var m=new Z;if(E<y||E<0)return m;y<0&&(y=0),E>this.length&&(E=this.length);for(var L=this.length,D=this.tail;null!==D&&L>E;L--)D=D.prev;for(;null!==D&&L>y;L--,D=D.prev)m.push(D.value);return m},Z.prototype.splice=function(y,E,...m){y>this.length&&(y=this.length-1),y<0&&(y=this.length+y);for(var L=0,D=this.head;null!==D&&L<y;L++)D=D.next;var P=[];for(L=0;D&&L<E;L++)P.push(D.value),D=this.removeNode(D);for(null===D&&(D=this.tail),D!==this.head&&D!==this.tail&&(D=D.prev),L=0;L<m.length;L++)D=M(this,D,m[L]);return P},Z.prototype.reverse=function(){for(var y=this.head,E=this.tail,m=y;null!==m;m=m.prev){var L=m.prev;m.prev=m.next,m.next=L}return this.head=E,this.tail=y,this};try{Y(7568)(Z)}catch{}},6556(Qe){Qe.exports=function(Me){var Y={};function Z(M){if(Y[M])return Y[M].exports;var w=Y[M]={i:M,l:!1,exports:{}};return Me[M].call(w.exports,w,w.exports,Z),w.l=!0,w.exports}return Z.m=Me,Z.c=Y,Z.i=function(M){return M},Z.d=function(M,w,T){Z.o(M,w)||Object.defineProperty(M,w,{configurable:!1,enumerable:!0,get:T})},Z.n=function(M){var w=M&&M.__esModule?function(){return M.default}:function(){return M};return Z.d(w,"a",w),w},Z.o=function(M,w){return Object.prototype.hasOwnProperty.call(M,w)},Z.p="",Z(Z.s=26)}([function(Me,Y,Z){"use strict";function M(){}M.QUALITY=1,M.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,M.DEFAULT_INCREMENTAL=!1,M.DEFAULT_ANIMATION_ON_LAYOUT=!0,M.DEFAULT_ANIMATION_DURING_LAYOUT=!1,M.DEFAULT_ANIMATION_PERIOD=50,M.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,M.DEFAULT_GRAPH_MARGIN=15,M.NODE_DIMENSIONS_INCLUDE_LABELS=!1,M.SIMPLE_NODE_HALF_SIZE=(M.SIMPLE_NODE_SIZE=40)/2,M.EMPTY_COMPOUND_NODE_SIZE=40,M.MIN_EDGE_LENGTH=1,M.INITIAL_WORLD_BOUNDARY=(M.WORLD_BOUNDARY=1e6)/1e3,M.WORLD_CENTER_X=1200,M.WORLD_CENTER_Y=900,Me.exports=M},function(Me,Y,Z){"use strict";var M=Z(2),w=Z(8),T=Z(9);function N(E,m,L){M.call(this,L),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=L,this.bendpoints=[],this.source=E,this.target=m}for(var y in N.prototype=Object.create(M.prototype),M)N[y]=M[y];N.prototype.getSource=function(){return this.source},N.prototype.getTarget=function(){return this.target},N.prototype.isInterGraph=function(){return this.isInterGraph},N.prototype.getLength=function(){return this.length},N.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},N.prototype.getBendpoints=function(){return this.bendpoints},N.prototype.getLca=function(){return this.lca},N.prototype.getSourceInLca=function(){return this.sourceInLca},N.prototype.getTargetInLca=function(){return this.targetInLca},N.prototype.getOtherEnd=function(E){if(this.source===E)return this.target;if(this.target===E)return this.source;throw"Node is not incident with this edge"},N.prototype.getOtherEndInGraph=function(E,m){for(var L=this.getOtherEnd(E),D=m.getGraphManager().getRoot();;){if(L.getOwner()==m)return L;if(L.getOwner()==D)break;L=L.getOwner().getParent()}return null},N.prototype.updateLength=function(){var E=new Array(4);this.isOverlapingSourceAndTarget=w.getIntersection(this.target.getRect(),this.source.getRect(),E),this.isOverlapingSourceAndTarget||(this.lengthX=E[0]-E[2],this.lengthY=E[1]-E[3],Math.abs(this.lengthX)<1&&(this.lengthX=T.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=T.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},N.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=T.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=T.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},Me.exports=N},function(Me,Y,Z){"use strict";Me.exports=function M(w){this.vGraphObject=w}},function(Me,Y,Z){"use strict";var M=Z(2),w=Z(10),T=Z(13),N=Z(0),y=Z(16),E=Z(4);function m(D,P,G,_){null==G&&null==_&&(_=P),M.call(this,_),null!=D.graphManager&&(D=D.graphManager),this.estimatedSize=w.MIN_VALUE,this.inclusionTreeDepth=w.MAX_VALUE,this.vGraphObject=_,this.edges=[],this.graphManager=D,this.rect=null!=G&&null!=P?new T(P.x,P.y,G.width,G.height):new T}for(var L in m.prototype=Object.create(M.prototype),M)m[L]=M[L];m.prototype.getEdges=function(){return this.edges},m.prototype.getChild=function(){return this.child},m.prototype.getOwner=function(){return this.owner},m.prototype.getWidth=function(){return this.rect.width},m.prototype.setWidth=function(D){this.rect.width=D},m.prototype.getHeight=function(){return this.rect.height},m.prototype.setHeight=function(D){this.rect.height=D},m.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},m.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},m.prototype.getCenter=function(){return new E(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},m.prototype.getLocation=function(){return new E(this.rect.x,this.rect.y)},m.prototype.getRect=function(){return this.rect},m.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},m.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},m.prototype.setRect=function(D,P){this.rect.x=D.x,this.rect.y=D.y,this.rect.width=P.width,this.rect.height=P.height},m.prototype.setCenter=function(D,P){this.rect.x=D-this.rect.width/2,this.rect.y=P-this.rect.height/2},m.prototype.setLocation=function(D,P){this.rect.x=D,this.rect.y=P},m.prototype.moveBy=function(D,P){this.rect.x+=D,this.rect.y+=P},m.prototype.getEdgeListToNode=function(D){var P=[],_=this;return _.edges.forEach(function(O){if(O.target==D){if(O.source!=_)throw"Incorrect edge source!";P.push(O)}}),P},m.prototype.getEdgesBetween=function(D){var P=[],_=this;return _.edges.forEach(function(O){if(O.source!=_&&O.target!=_)throw"Incorrect edge source and/or target";(O.target==D||O.source==D)&&P.push(O)}),P},m.prototype.getNeighborsList=function(){var D=new Set,P=this;return P.edges.forEach(function(G){if(G.source==P)D.add(G.target);else{if(G.target!=P)throw"Incorrect incidency!";D.add(G.source)}}),D},m.prototype.withChildren=function(){var D=new Set;if(D.add(this),null!=this.child)for(var _=this.child.getNodes(),O=0;O<_.length;O++)_[O].withChildren().forEach(function(q){D.add(q)});return D},m.prototype.getNoOfChildren=function(){var D=0;if(null==this.child)D=1;else for(var G=this.child.getNodes(),_=0;_<G.length;_++)D+=G[_].getNoOfChildren();return 0==D&&(D=1),D},m.prototype.getEstimatedSize=function(){if(this.estimatedSize==w.MIN_VALUE)throw"assert failed";return this.estimatedSize},m.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},m.prototype.scatter=function(){var D,P,G=-N.INITIAL_WORLD_BOUNDARY,_=N.INITIAL_WORLD_BOUNDARY;D=N.WORLD_CENTER_X+y.nextDouble()*(_-G)+G;var O=-N.INITIAL_WORLD_BOUNDARY,q=N.INITIAL_WORLD_BOUNDARY;P=N.WORLD_CENTER_Y+y.nextDouble()*(q-O)+O,this.rect.x=D,this.rect.y=P},m.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var D=this.getChild();if(D.updateBounds(!0),this.rect.x=D.getLeft(),this.rect.y=D.getTop(),this.setWidth(D.getRight()-D.getLeft()),this.setHeight(D.getBottom()-D.getTop()),N.NODE_DIMENSIONS_INCLUDE_LABELS){var P=D.getRight()-D.getLeft(),G=D.getBottom()-D.getTop();this.labelWidth>P&&(this.rect.x-=(this.labelWidth-P)/2,this.setWidth(this.labelWidth)),this.labelHeight>G&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-G)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-G),this.setHeight(this.labelHeight))}}},m.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==w.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},m.prototype.transform=function(D){var P=this.rect.x;P>N.WORLD_BOUNDARY?P=N.WORLD_BOUNDARY:P<-N.WORLD_BOUNDARY&&(P=-N.WORLD_BOUNDARY);var G=this.rect.y;G>N.WORLD_BOUNDARY?G=N.WORLD_BOUNDARY:G<-N.WORLD_BOUNDARY&&(G=-N.WORLD_BOUNDARY);var _=new E(P,G),O=D.inverseTransformPoint(_);this.setLocation(O.x,O.y)},m.prototype.getLeft=function(){return this.rect.x},m.prototype.getRight=function(){return this.rect.x+this.rect.width},m.prototype.getTop=function(){return this.rect.y},m.prototype.getBottom=function(){return this.rect.y+this.rect.height},m.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},Me.exports=m},function(Me,Y,Z){"use strict";function M(w,T){null==w&&null==T?(this.x=0,this.y=0):(this.x=w,this.y=T)}M.prototype.getX=function(){return this.x},M.prototype.getY=function(){return this.y},M.prototype.setX=function(w){this.x=w},M.prototype.setY=function(w){this.y=w},M.prototype.getDifference=function(w){return new DimensionD(this.x-w.x,this.y-w.y)},M.prototype.getCopy=function(){return new M(this.x,this.y)},M.prototype.translate=function(w){return this.x+=w.width,this.y+=w.height,this},Me.exports=M},function(Me,Y,Z){"use strict";var M=Z(2),w=Z(10),T=Z(0),N=Z(6),y=Z(3),E=Z(1),m=Z(13),L=Z(12),D=Z(11);function P(_,O,q){M.call(this,q),this.estimatedSize=w.MIN_VALUE,this.margin=T.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=_,null!=O&&O instanceof N?this.graphManager=O:null!=O&&O instanceof Layout&&(this.graphManager=O.graphManager)}for(var G in P.prototype=Object.create(M.prototype),M)P[G]=M[G];P.prototype.getNodes=function(){return this.nodes},P.prototype.getEdges=function(){return this.edges},P.prototype.getGraphManager=function(){return this.graphManager},P.prototype.getParent=function(){return this.parent},P.prototype.getLeft=function(){return this.left},P.prototype.getRight=function(){return this.right},P.prototype.getTop=function(){return this.top},P.prototype.getBottom=function(){return this.bottom},P.prototype.isConnected=function(){return this.isConnected},P.prototype.add=function(_,O,q){if(null==O&&null==q){var k=_;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(k)>-1)throw"Node already in graph!";return k.owner=this,this.getNodes().push(k),k}var ne=_;if(!(this.getNodes().indexOf(O)>-1&&this.getNodes().indexOf(q)>-1))throw"Source or target not in graph!";if(O.owner!=q.owner||O.owner!=this)throw"Both owners must be this graph!";return O.owner!=q.owner?null:(ne.source=O,ne.target=q,ne.isInterGraph=!1,this.getEdges().push(ne),O.edges.push(ne),q!=O&&q.edges.push(ne),ne)},P.prototype.remove=function(_){var O=_;if(_ instanceof y){if(null==O)throw"Node is null!";if(null==O.owner||O.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var q=O.edges.slice(),ne=q.length,W=0;W<ne;W++)(k=q[W]).isInterGraph?this.graphManager.remove(k):k.source.owner.remove(k);if(-1==(Ee=this.nodes.indexOf(O)))throw"Node not in owner node list!";this.nodes.splice(Ee,1)}else if(_ instanceof E){var k;if(null==(k=_))throw"Edge is null!";if(null==k.source||null==k.target)throw"Source and/or target is null!";if(null==k.source.owner||null==k.target.owner||k.source.owner!=this||k.target.owner!=this)throw"Source and/or target owner is invalid!";var Ee,ae=k.source.edges.indexOf(k),R=k.target.edges.indexOf(k);if(!(ae>-1&&R>-1))throw"Source and/or target doesn't know this edge!";if(k.source.edges.splice(ae,1),k.target!=k.source&&k.target.edges.splice(R,1),-1==(Ee=k.source.owner.getEdges().indexOf(k)))throw"Not in owner's edge list!";k.source.owner.getEdges().splice(Ee,1)}},P.prototype.updateLeftTop=function(){for(var q,k,ne,_=w.MAX_VALUE,O=w.MAX_VALUE,W=this.getNodes(),Ee=W.length,ae=0;ae<Ee;ae++){var R=W[ae];_>(q=R.getTop())&&(_=q),O>(k=R.getLeft())&&(O=k)}return _==w.MAX_VALUE?null:(ne=null!=W[0].getParent().paddingLeft?W[0].getParent().paddingLeft:this.margin,this.left=O-ne,this.top=_-ne,new L(this.left,this.top))},P.prototype.updateBounds=function(_){for(var W,Ee,ae,R,S,O=w.MAX_VALUE,q=-w.MAX_VALUE,k=w.MAX_VALUE,ne=-w.MAX_VALUE,I=this.nodes,B=I.length,te=0;te<B;te++){var se=I[te];_&&null!=se.child&&se.updateBounds(),O>(W=se.getLeft())&&(O=W),q<(Ee=se.getRight())&&(q=Ee),k>(ae=se.getTop())&&(k=ae),ne<(R=se.getBottom())&&(ne=R)}var U=new m(O,k,q-O,ne-k);O==w.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),S=null!=I[0].getParent().paddingLeft?I[0].getParent().paddingLeft:this.margin,this.left=U.x-S,this.right=U.x+U.width+S,this.top=U.y-S,this.bottom=U.y+U.height+S},P.calculateBounds=function(_){for(var W,Ee,ae,R,O=w.MAX_VALUE,q=-w.MAX_VALUE,k=w.MAX_VALUE,ne=-w.MAX_VALUE,S=_.length,I=0;I<S;I++){var B=_[I];O>(W=B.getLeft())&&(O=W),q<(Ee=B.getRight())&&(q=Ee),k>(ae=B.getTop())&&(k=ae),ne<(R=B.getBottom())&&(ne=R)}return new m(O,k,q-O,ne-k)},P.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},P.prototype.getEstimatedSize=function(){if(this.estimatedSize==w.MIN_VALUE)throw"assert failed";return this.estimatedSize},P.prototype.calcEstimatedSize=function(){for(var _=0,O=this.nodes,q=O.length,k=0;k<q;k++)_+=O[k].calcEstimatedSize();return this.estimatedSize=0==_?T.EMPTY_COMPOUND_NODE_SIZE:_/Math.sqrt(this.nodes.length),this.estimatedSize},P.prototype.updateConnected=function(){var _=this;if(0!=this.nodes.length){var ne,W,O=new D,q=new Set,k=this.nodes[0];for(k.withChildren().forEach(function(te){O.push(te),q.add(te)});0!==O.length;)for(var ae=(ne=(k=O.shift()).getEdges()).length,R=0;R<ae;R++)null==(W=ne[R].getOtherEndInGraph(k,this))||q.has(W)||W.withChildren().forEach(function(te){O.push(te),q.add(te)});if(this.isConnected=!1,q.size>=this.nodes.length){var B=0;q.forEach(function(te){te.owner==_&&B++}),B==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},Me.exports=P},function(Me,Y,Z){"use strict";var M,w=Z(1);function T(N){M=Z(5),this.layout=N,this.graphs=[],this.edges=[]}T.prototype.addRoot=function(){var N=this.layout.newGraph(),y=this.layout.newNode(null),E=this.add(N,y);return this.setRootGraph(E),this.rootGraph},T.prototype.add=function(N,y,E,m,L){if(null==E&&null==m&&null==L){if(null==N)throw"Graph is null!";if(null==y)throw"Parent node is null!";if(this.graphs.indexOf(N)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(N),null!=N.parent)throw"Already has a parent!";if(null!=y.child)throw"Already has a child!";return N.parent=y,y.child=N,N}L=E,E=N;var D=(m=y).getOwner(),P=L.getOwner();if(null==D||D.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==P||P.getGraphManager()!=this)throw"Target not in this graph mgr!";if(D==P)return E.isInterGraph=!1,D.add(E,m,L);if(E.isInterGraph=!0,E.source=m,E.target=L,this.edges.indexOf(E)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(E),null==E.source||null==E.target)throw"Edge source and/or target is null!";if(-1!=E.source.edges.indexOf(E)||-1!=E.target.edges.indexOf(E))throw"Edge already in source and/or target incidency list!";return E.source.edges.push(E),E.target.edges.push(E),E},T.prototype.remove=function(N){if(N instanceof M){var y=N;if(y.getGraphManager()!=this)throw"Graph not in this graph mgr";if(y!=this.rootGraph&&(null==y.parent||y.parent.graphManager!=this))throw"Invalid parent node!";for(var m,E=[],L=(E=E.concat(y.getEdges())).length,D=0;D<L;D++)y.remove(m=E[D]);var P=[];for(L=(P=P.concat(y.getNodes())).length,D=0;D<L;D++)y.remove(P[D]);y==this.rootGraph&&this.setRootGraph(null);var _=this.graphs.indexOf(y);this.graphs.splice(_,1),y.parent=null}else if(N instanceof w){if(null==(m=N))throw"Edge is null!";if(!m.isInterGraph)throw"Not an inter-graph edge!";if(null==m.source||null==m.target)throw"Source and/or target is null!";if(-1==m.source.edges.indexOf(m)||-1==m.target.edges.indexOf(m))throw"Source and/or target doesn't know this edge!";if(_=m.source.edges.indexOf(m),m.source.edges.splice(_,1),_=m.target.edges.indexOf(m),m.target.edges.splice(_,1),null==m.source.owner||null==m.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==m.source.owner.getGraphManager().edges.indexOf(m))throw"Not in owner graph manager's edge list!";_=m.source.owner.getGraphManager().edges.indexOf(m),m.source.owner.getGraphManager().edges.splice(_,1)}},T.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},T.prototype.getGraphs=function(){return this.graphs},T.prototype.getAllNodes=function(){if(null==this.allNodes){for(var N=[],y=this.getGraphs(),E=y.length,m=0;m<E;m++)N=N.concat(y[m].getNodes());this.allNodes=N}return this.allNodes},T.prototype.resetAllNodes=function(){this.allNodes=null},T.prototype.resetAllEdges=function(){this.allEdges=null},T.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},T.prototype.getAllEdges=function(){if(null==this.allEdges){for(var N=[],y=this.getGraphs(),m=0;m<y.length;m++)N=N.concat(y[m].getEdges());N=N.concat(this.edges),this.allEdges=N}return this.allEdges},T.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},T.prototype.setAllNodesToApplyGravitation=function(N){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=N},T.prototype.getRoot=function(){return this.rootGraph},T.prototype.setRootGraph=function(N){if(N.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=N,null==N.parent&&(N.parent=this.layout.newNode("Root node"))},T.prototype.getLayout=function(){return this.layout},T.prototype.isOneAncestorOfOther=function(N,y){if(null==N||null==y)throw"assert failed";if(N==y)return!0;for(var m,E=N.getOwner();null!=(m=E.getParent());){if(m==y)return!0;if(null==(E=m.getOwner()))break}for(E=y.getOwner();null!=(m=E.getParent());){if(m==N)return!0;if(null==(E=m.getOwner()))break}return!1},T.prototype.calcLowestCommonAncestors=function(){for(var N,y,E,m,L,D=this.getAllEdges(),P=D.length,G=0;G<P;G++)if(y=(N=D[G]).source,E=N.target,N.lca=null,N.sourceInLca=y,N.targetInLca=E,y!=E){for(m=y.getOwner();null==N.lca;){for(N.targetInLca=E,L=E.getOwner();null==N.lca;){if(L==m){N.lca=L;break}if(L==this.rootGraph)break;if(null!=N.lca)throw"assert failed";N.targetInLca=L.getParent(),L=N.targetInLca.getOwner()}if(m==this.rootGraph)break;null==N.lca&&(N.sourceInLca=m.getParent(),m=N.sourceInLca.getOwner())}if(null==N.lca)throw"assert failed"}else N.lca=y.getOwner()},T.prototype.calcLowestCommonAncestor=function(N,y){if(N==y)return N.getOwner();for(var E=N.getOwner();null!=E;){for(var m=y.getOwner();null!=m;){if(m==E)return m;m=m.getParent().getOwner()}E=E.getParent().getOwner()}return E},T.prototype.calcInclusionTreeDepths=function(N,y){null==N&&null==y&&(N=this.rootGraph,y=1);for(var E,m=N.getNodes(),L=m.length,D=0;D<L;D++)(E=m[D]).inclusionTreeDepth=y,null!=E.child&&this.calcInclusionTreeDepths(E.child,y+1)},T.prototype.includesInvalidEdge=function(){for(var N,y=this.edges.length,E=0;E<y;E++)if(this.isOneAncestorOfOther((N=this.edges[E]).source,N.target))return!0;return!1},Me.exports=T},function(Me,Y,Z){"use strict";var M=Z(0);function w(){}for(var T in M)w[T]=M[T];w.MAX_ITERATIONS=2500,w.DEFAULT_EDGE_LENGTH=50,w.DEFAULT_SPRING_STRENGTH=.45,w.DEFAULT_REPULSION_STRENGTH=4500,w.DEFAULT_GRAVITY_STRENGTH=.4,w.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,w.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,w.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,w.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,w.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,w.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,w.COOLING_ADAPTATION_FACTOR=.33,w.ADAPTATION_LOWER_NODE_LIMIT=1e3,w.ADAPTATION_UPPER_NODE_LIMIT=5e3,w.MAX_NODE_DISPLACEMENT=3*(w.MAX_NODE_DISPLACEMENT_INCREMENTAL=100),w.MIN_REPULSION_DIST=w.DEFAULT_EDGE_LENGTH/10,w.CONVERGENCE_CHECK_PERIOD=100,w.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,w.MIN_EDGE_LENGTH=1,w.GRID_CALCULATION_CHECK_PERIOD=10,Me.exports=w},function(Me,Y,Z){"use strict";var M=Z(12);function w(){}w.calcSeparationAmount=function(T,N,y,E){if(!T.intersects(N))throw"assert failed";var m=new Array(2);this.decideDirectionsForOverlappingNodes(T,N,m),y[0]=Math.min(T.getRight(),N.getRight())-Math.max(T.x,N.x),y[1]=Math.min(T.getBottom(),N.getBottom())-Math.max(T.y,N.y),T.getX()<=N.getX()&&T.getRight()>=N.getRight()?y[0]+=Math.min(N.getX()-T.getX(),T.getRight()-N.getRight()):N.getX()<=T.getX()&&N.getRight()>=T.getRight()&&(y[0]+=Math.min(T.getX()-N.getX(),N.getRight()-T.getRight())),T.getY()<=N.getY()&&T.getBottom()>=N.getBottom()?y[1]+=Math.min(N.getY()-T.getY(),T.getBottom()-N.getBottom()):N.getY()<=T.getY()&&N.getBottom()>=T.getBottom()&&(y[1]+=Math.min(T.getY()-N.getY(),N.getBottom()-T.getBottom()));var L=Math.abs((N.getCenterY()-T.getCenterY())/(N.getCenterX()-T.getCenterX()));N.getCenterY()===T.getCenterY()&&N.getCenterX()===T.getCenterX()&&(L=1);var D=L*y[0],P=y[1]/L;y[0]<P?P=y[0]:D=y[1],y[0]=-1*m[0]*(P/2+E),y[1]=-1*m[1]*(D/2+E)},w.decideDirectionsForOverlappingNodes=function(T,N,y){y[0]=T.getCenterX()<N.getCenterX()?-1:1,y[1]=T.getCenterY()<N.getCenterY()?-1:1},w.getIntersection2=function(T,N,y){var E=T.getCenterX(),m=T.getCenterY(),L=N.getCenterX(),D=N.getCenterY();if(T.intersects(N))return y[0]=E,y[1]=m,y[2]=L,y[3]=D,!0;var P=T.getX(),G=T.getY(),_=T.getRight(),O=T.getX(),q=T.getBottom(),k=T.getRight(),ne=T.getWidthHalf(),W=T.getHeightHalf(),Ee=N.getX(),ae=N.getY(),R=N.getRight(),S=N.getX(),I=N.getBottom(),B=N.getRight(),te=N.getWidthHalf(),se=N.getHeightHalf(),U=!1,ie=!1;if(E===L){if(m>D)return y[0]=E,y[1]=G,y[2]=L,y[3]=I,!1;if(m<D)return y[0]=E,y[1]=q,y[2]=L,y[3]=ae,!1}else if(m===D){if(E>L)return y[0]=P,y[1]=m,y[2]=R,y[3]=D,!1;if(E<L)return y[0]=_,y[1]=m,y[2]=Ee,y[3]=D,!1}else{var be=T.height/T.width,ge=N.height/N.width,Te=(D-m)/(L-E),Ge=void 0,he=void 0,de=void 0,ye=void 0;if(-be===Te?E>L?(y[0]=O,y[1]=q,U=!0):(y[0]=_,y[1]=G,U=!0):be===Te&&(E>L?(y[0]=P,y[1]=G,U=!0):(y[0]=k,y[1]=q,U=!0)),-ge===Te?L>E?(y[2]=S,y[3]=I,ie=!0):(y[2]=R,y[3]=ae,ie=!0):ge===Te&&(L>E?(y[2]=Ee,y[3]=ae,ie=!0):(y[2]=B,y[3]=I,ie=!0)),U&&ie)return!1;if(E>L?m>D?(Ge=this.getCardinalDirection(be,Te,4),he=this.getCardinalDirection(ge,Te,2)):(Ge=this.getCardinalDirection(-be,Te,3),he=this.getCardinalDirection(-ge,Te,1)):m>D?(Ge=this.getCardinalDirection(-be,Te,1),he=this.getCardinalDirection(-ge,Te,3)):(Ge=this.getCardinalDirection(be,Te,2),he=this.getCardinalDirection(ge,Te,4)),!U)switch(Ge){case 1:de=G,y[0]=E+-W/Te,y[1]=de;break;case 2:de=m+ne*Te,y[0]=k,y[1]=de;break;case 3:de=q,y[0]=E+W/Te,y[1]=de;break;case 4:de=m+-ne*Te,y[0]=O,y[1]=de}if(!ie)switch(he){case 1:ye=ae,y[2]=L+-se/Te,y[3]=ye;break;case 2:ye=D+te*Te,y[2]=B,y[3]=ye;break;case 3:ye=I,y[2]=L+se/Te,y[3]=ye;break;case 4:ye=D+-te*Te,y[2]=S,y[3]=ye}}return!1},w.getCardinalDirection=function(T,N,y){return T>N?y:1+y%4},w.getIntersection=function(T,N,y,E){if(null==E)return this.getIntersection2(T,N,y);var W,Ee,ae,R,S,I,B,m=T.x,L=T.y,D=N.x,P=N.y,G=y.x,_=y.y,O=E.x,q=E.y;return S=D*L-m*P,I=O*_-G*q,0===(B=(W=P-L)*(R=G-O)-(Ee=q-_)*(ae=m-D))?null:new M((ae*I-R*S)/B,(Ee*S-W*I)/B)},w.angleOfVector=function(T,N,y,E){var m=void 0;return T!==y?(m=Math.atan((E-N)/(y-T)),y<T?m+=Math.PI:E<N&&(m+=this.TWO_PI)):m=E<N?this.ONE_AND_HALF_PI:this.HALF_PI,m},w.doIntersect=function(T,N,y,E){var m=T.x,L=T.y,D=N.x,P=N.y,G=y.x,_=y.y,O=E.x,q=E.y,k=(D-m)*(q-_)-(O-G)*(P-L);if(0===k)return!1;var ne=((q-_)*(O-m)+(G-O)*(q-L))/k,W=((L-P)*(O-m)+(D-m)*(q-L))/k;return 0<ne&&ne<1&&0<W&&W<1},w.HALF_PI=.5*Math.PI,w.ONE_AND_HALF_PI=1.5*Math.PI,w.TWO_PI=2*Math.PI,w.THREE_PI=3*Math.PI,Me.exports=w},function(Me,Y,Z){"use strict";function M(){}M.sign=function(w){return w>0?1:w<0?-1:0},M.floor=function(w){return w<0?Math.ceil(w):Math.floor(w)},M.ceil=function(w){return w<0?Math.floor(w):Math.ceil(w)},Me.exports=M},function(Me,Y,Z){"use strict";function M(){}M.MAX_VALUE=2147483647,M.MIN_VALUE=-2147483648,Me.exports=M},function(Me,Y,Z){"use strict";var M=function(){function m(L,D){for(var P=0;P<D.length;P++){var G=D[P];G.enumerable=G.enumerable||!1,G.configurable=!0,"value"in G&&(G.writable=!0),Object.defineProperty(L,G.key,G)}}return function(L,D,P){return D&&m(L.prototype,D),P&&m(L,P),L}}();var T=function(L){return{value:L,next:null,prev:null}},N=function(L,D,P,G){return null!==L?L.next=D:G.head=D,null!==P?P.prev=D:G.tail=D,D.prev=L,D.next=P,G.length++,D},y=function(L,D){var P=L.prev,G=L.next;return null!==P?P.next=G:D.head=G,null!==G?G.prev=P:D.tail=P,L.prev=L.next=null,D.length--,L},E=function(){function m(L){var D=this;(function w(m,L){if(!(m instanceof L))throw new TypeError("Cannot call a class as a function")})(this,m),this.length=0,this.head=null,this.tail=null,L?.forEach(function(P){return D.push(P)})}return M(m,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(D,P){return N(P.prev,T(D),P,this)}},{key:"insertAfter",value:function(D,P){return N(P,T(D),P.next,this)}},{key:"insertNodeBefore",value:function(D,P){return N(P.prev,D,P,this)}},{key:"insertNodeAfter",value:function(D,P){return N(P,D,P.next,this)}},{key:"push",value:function(D){return N(this.tail,T(D),null,this)}},{key:"unshift",value:function(D){return N(null,T(D),this.head,this)}},{key:"remove",value:function(D){return y(D,this)}},{key:"pop",value:function(){return y(this.tail,this).value}},{key:"popNode",value:function(){return y(this.tail,this)}},{key:"shift",value:function(){return y(this.head,this).value}},{key:"shiftNode",value:function(){return y(this.head,this)}},{key:"get_object_at",value:function(D){if(D<=this.length()){for(var P=1,G=this.head;P<D;)G=G.next,P++;return G.value}}},{key:"set_object_at",value:function(D,P){if(D<=this.length()){for(var G=1,_=this.head;G<D;)_=_.next,G++;_.value=P}}}]),m}();Me.exports=E},function(Me,Y,Z){"use strict";function M(w,T,N){this.x=null,this.y=null,null==w&&null==T&&null==N?(this.x=0,this.y=0):"number"==typeof w&&"number"==typeof T&&null==N?(this.x=w,this.y=T):"Point"==w.constructor.name&&null==T&&null==N&&(this.x=(N=w).x,this.y=N.y)}M.prototype.getX=function(){return this.x},M.prototype.getY=function(){return this.y},M.prototype.getLocation=function(){return new M(this.x,this.y)},M.prototype.setLocation=function(w,T,N){"Point"==w.constructor.name&&null==T&&null==N?this.setLocation((N=w).x,N.y):"number"==typeof w&&"number"==typeof T&&null==N&&(parseInt(w)==w&&parseInt(T)==T?this.move(w,T):(this.x=Math.floor(w+.5),this.y=Math.floor(T+.5)))},M.prototype.move=function(w,T){this.x=w,this.y=T},M.prototype.translate=function(w,T){this.x+=w,this.y+=T},M.prototype.equals=function(w){return"Point"==w.constructor.name?this.x==w.x&&this.y==w.y:this==w},M.prototype.toString=function(){return(new M).constructor.name+"[x="+this.x+",y="+this.y+"]"},Me.exports=M},function(Me,Y,Z){"use strict";function M(w,T,N,y){this.x=0,this.y=0,this.width=0,this.height=0,null!=w&&null!=T&&null!=N&&null!=y&&(this.x=w,this.y=T,this.width=N,this.height=y)}M.prototype.getX=function(){return this.x},M.prototype.setX=function(w){this.x=w},M.prototype.getY=function(){return this.y},M.prototype.setY=function(w){this.y=w},M.prototype.getWidth=function(){return this.width},M.prototype.setWidth=function(w){this.width=w},M.prototype.getHeight=function(){return this.height},M.prototype.setHeight=function(w){this.height=w},M.prototype.getRight=function(){return this.x+this.width},M.prototype.getBottom=function(){return this.y+this.height},M.prototype.intersects=function(w){return!(this.getRight()<w.x||this.getBottom()<w.y||w.getRight()<this.x||w.getBottom()<this.y)},M.prototype.getCenterX=function(){return this.x+this.width/2},M.prototype.getMinX=function(){return this.getX()},M.prototype.getMaxX=function(){return this.getX()+this.width},M.prototype.getCenterY=function(){return this.y+this.height/2},M.prototype.getMinY=function(){return this.getY()},M.prototype.getMaxY=function(){return this.getY()+this.height},M.prototype.getWidthHalf=function(){return this.width/2},M.prototype.getHeightHalf=function(){return this.height/2},Me.exports=M},function(Me,Y,Z){"use strict";var M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(T){return typeof T}:function(T){return T&&"function"==typeof Symbol&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T};function w(){}w.lastID=0,w.createID=function(T){return w.isPrimitive(T)?T:(null!=T.uniqueID||(T.uniqueID=w.getString(),w.lastID++),T.uniqueID)},w.getString=function(T){return null==T&&(T=w.lastID),"Object#"+T},w.isPrimitive=function(T){var N=typeof T>"u"?"undefined":M(T);return null==T||"object"!=N&&"function"!=N},Me.exports=w},function(Me,Y,Z){"use strict";function M(G){if(Array.isArray(G)){for(var _=0,O=Array(G.length);_<G.length;_++)O[_]=G[_];return O}return Array.from(G)}var w=Z(0),T=Z(6),N=Z(3),y=Z(1),E=Z(5),m=Z(4),L=Z(17),D=Z(27);function P(G){D.call(this),this.layoutQuality=w.QUALITY,this.createBendsAsNeeded=w.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=w.DEFAULT_INCREMENTAL,this.animationOnLayout=w.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=w.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=w.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=w.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new T(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=G&&(this.isRemoteUse=G)}P.RANDOM_SEED=1,(P.prototype=Object.create(D.prototype)).getGraphManager=function(){return this.graphManager},P.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},P.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},P.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},P.prototype.newGraphManager=function(){var G=new T(this);return this.graphManager=G,G},P.prototype.newGraph=function(G){return new E(null,this.graphManager,G)},P.prototype.newNode=function(G){return new N(this.graphManager,G)},P.prototype.newEdge=function(G){return new y(null,null,G)},P.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},P.prototype.runLayout=function(){var G;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),G=!this.checkLayoutSuccess()&&this.layout(),"during"!==w.ANIMATE&&(G&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,G)},P.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},P.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var _=this.graphManager.getAllEdges(),O=0;O<_.length;O++);var k=this.graphManager.getRoot().getNodes();for(O=0;O<k.length;O++);this.update(this.graphManager.getRoot())}},P.prototype.update=function(G){if(null==G)this.update2();else if(G instanceof N){var _=G;if(null!=_.getChild())for(var O=_.getChild().getNodes(),q=0;q<O.length;q++)update(O[q]);null!=_.vGraphObject&&_.vGraphObject.update(_)}else G instanceof y?null!=G.vGraphObject&&G.vGraphObject.update(G):G instanceof E&&null!=G.vGraphObject&&G.vGraphObject.update(G)},P.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=w.QUALITY,this.animationDuringLayout=w.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=w.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=w.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=w.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=w.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=w.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},P.prototype.transform=function(G){if(null==G)this.transform(new m(0,0));else{var _=new L,O=this.graphManager.getRoot().updateLeftTop();if(null!=O){_.setWorldOrgX(G.x),_.setWorldOrgY(G.y),_.setDeviceOrgX(O.x),_.setDeviceOrgY(O.y);for(var q=this.getAllNodes(),ne=0;ne<q.length;ne++)q[ne].transform(_)}}},P.prototype.positionNodesRandomly=function(G){if(null==G)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var _,O,q=G.getNodes(),k=0;k<q.length;k++)null==(O=(_=q[k]).getChild())||0==O.getNodes().length?_.scatter():(this.positionNodesRandomly(O),_.updateBounds())},P.prototype.getFlatForest=function(){for(var G=[],_=!0,O=this.graphManager.getRoot().getNodes(),q=!0,k=0;k<O.length;k++)null!=O[k].getChild()&&(q=!1);if(!q)return G;var ne=new Set,W=[],Ee=new Map,ae=[];for(ae=ae.concat(O);ae.length>0&&_;){for(W.push(ae[0]);W.length>0&&_;){var R=W[0];W.splice(0,1),ne.add(R);var S=R.getEdges();for(k=0;k<S.length;k++){var I=S[k].getOtherEnd(R);if(Ee.get(R)!=I){if(ne.has(I)){_=!1;break}W.push(I),Ee.set(I,R)}}}if(_){var B=[].concat(M(ne));for(G.push(B),k=0;k<B.length;k++){var se=ae.indexOf(B[k]);se>-1&&ae.splice(se,1)}ne=new Set,Ee=new Map}else G=[]}return G},P.prototype.createDummyNodesForBendpoints=function(G){for(var _=[],O=G.source,q=this.graphManager.calcLowestCommonAncestor(G.source,G.target),k=0;k<G.bendpoints.length;k++){var ne=this.newNode(null);ne.setRect(new Point(0,0),new Dimension(1,1)),q.add(ne);var W=this.newEdge(null);this.graphManager.add(W,O,ne),_.add(ne),O=ne}return W=this.newEdge(null),this.graphManager.add(W,O,G.target),this.edgeToDummyNodes.set(G,_),G.isInterGraph()?this.graphManager.remove(G):q.remove(G),_},P.prototype.createBendpointsFromDummyNodes=function(){var G=[];G=G.concat(this.graphManager.getAllEdges()),G=[].concat(M(this.edgeToDummyNodes.keys())).concat(G);for(var _=0;_<G.length;_++){var O=G[_];if(O.bendpoints.length>0){for(var q=this.edgeToDummyNodes.get(O),k=0;k<q.length;k++){var ne=q[k],W=new m(ne.getCenterX(),ne.getCenterY()),Ee=O.bendpoints.get(k);Ee.x=W.x,Ee.y=W.y,ne.getOwner().remove(ne)}this.graphManager.add(O,O.source,O.target)}}},P.transform=function(G,_,O,q){if(null!=O&&null!=q){var k=_;return G<=50?k-=(_-_/O)/50*(50-G):k+=(_*q-_)/50*(G-50),k}var Ee,ae;return G<=50?(Ee=9*_/500,ae=_/10):(Ee=9*_/50,ae=-8*_),Ee*G+ae},P.findCenterOfTree=function(G){var _=[];_=_.concat(G);var O=[],q=new Map,k=!1,ne=null;(1==_.length||2==_.length)&&(k=!0,ne=_[0]);for(var W=0;W<_.length;W++){var ae=(Ee=_[W]).getNeighborsList().size;q.set(Ee,Ee.getNeighborsList().size),1==ae&&O.push(Ee)}var R=[];for(R=R.concat(O);!k;){var S=[];for(S=S.concat(R),R=[],W=0;W<_.length;W++){var Ee,I=_.indexOf(Ee=_[W]);I>=0&&_.splice(I,1),Ee.getNeighborsList().forEach(function(U){if(O.indexOf(U)<0){var be=q.get(U)-1;1==be&&R.push(U),q.set(U,be)}})}O=O.concat(R),(1==_.length||2==_.length)&&(k=!0,ne=_[0])}return ne},P.prototype.setGraphManager=function(G){this.graphManager=G},Me.exports=P},function(Me,Y,Z){"use strict";function M(){}M.seed=1,M.x=0,M.nextDouble=function(){return(M.x=1e4*Math.sin(M.seed++))-Math.floor(M.x)},Me.exports=M},function(Me,Y,Z){"use strict";var M=Z(4);function w(T,N){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}w.prototype.getWorldOrgX=function(){return this.lworldOrgX},w.prototype.setWorldOrgX=function(T){this.lworldOrgX=T},w.prototype.getWorldOrgY=function(){return this.lworldOrgY},w.prototype.setWorldOrgY=function(T){this.lworldOrgY=T},w.prototype.getWorldExtX=function(){return this.lworldExtX},w.prototype.setWorldExtX=function(T){this.lworldExtX=T},w.prototype.getWorldExtY=function(){return this.lworldExtY},w.prototype.setWorldExtY=function(T){this.lworldExtY=T},w.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},w.prototype.setDeviceOrgX=function(T){this.ldeviceOrgX=T},w.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},w.prototype.setDeviceOrgY=function(T){this.ldeviceOrgY=T},w.prototype.getDeviceExtX=function(){return this.ldeviceExtX},w.prototype.setDeviceExtX=function(T){this.ldeviceExtX=T},w.prototype.getDeviceExtY=function(){return this.ldeviceExtY},w.prototype.setDeviceExtY=function(T){this.ldeviceExtY=T},w.prototype.transformX=function(T){var N=0,y=this.lworldExtX;return 0!=y&&(N=this.ldeviceOrgX+(T-this.lworldOrgX)*this.ldeviceExtX/y),N},w.prototype.transformY=function(T){var N=0,y=this.lworldExtY;return 0!=y&&(N=this.ldeviceOrgY+(T-this.lworldOrgY)*this.ldeviceExtY/y),N},w.prototype.inverseTransformX=function(T){var N=0,y=this.ldeviceExtX;return 0!=y&&(N=this.lworldOrgX+(T-this.ldeviceOrgX)*this.lworldExtX/y),N},w.prototype.inverseTransformY=function(T){var N=0,y=this.ldeviceExtY;return 0!=y&&(N=this.lworldOrgY+(T-this.ldeviceOrgY)*this.lworldExtY/y),N},w.prototype.inverseTransformPoint=function(T){return new M(this.inverseTransformX(T.x),this.inverseTransformY(T.y))},Me.exports=w},function(Me,Y,Z){"use strict";var w=Z(15),T=Z(7),N=Z(0),y=Z(8),E=Z(9);function m(){w.call(this),this.useSmartIdealEdgeLengthCalculation=T.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=T.DEFAULT_EDGE_LENGTH,this.springConstant=T.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=T.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=T.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=T.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=T.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=T.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*T.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=T.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=T.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=T.MAX_ITERATIONS}for(var L in m.prototype=Object.create(w.prototype),w)m[L]=w[L];m.prototype.initParameters=function(){w.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=T.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},m.prototype.calcIdealEdgeLengths=function(){for(var D,P,G,_,O,q,k=this.getGraphManager().getAllEdges(),ne=0;ne<k.length;ne++)(D=k[ne]).idealLength=this.idealEdgeLength,D.isInterGraph&&(G=D.getSource(),_=D.getTarget(),O=D.getSourceInLca().getEstimatedSize(),q=D.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(D.idealLength+=O+q-2*N.SIMPLE_NODE_SIZE),P=D.getLca().getInclusionTreeDepth(),D.idealLength+=T.DEFAULT_EDGE_LENGTH*T.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(G.getInclusionTreeDepth()+_.getInclusionTreeDepth()-2*P))},m.prototype.initSpringEmbedder=function(){var D=this.getAllNodes().length;this.incremental?(D>T.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*T.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(D-T.ADAPTATION_LOWER_NODE_LIMIT)/(T.ADAPTATION_UPPER_NODE_LIMIT-T.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-T.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=T.MAX_NODE_DISPLACEMENT_INCREMENTAL):(this.coolingFactor=D>T.ADAPTATION_LOWER_NODE_LIMIT?Math.max(T.COOLING_ADAPTATION_FACTOR,1-(D-T.ADAPTATION_LOWER_NODE_LIMIT)/(T.ADAPTATION_UPPER_NODE_LIMIT-T.ADAPTATION_LOWER_NODE_LIMIT)*(1-T.COOLING_ADAPTATION_FACTOR)):1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=T.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},m.prototype.calcSpringForces=function(){for(var P,D=this.getAllEdges(),G=0;G<D.length;G++)this.calcSpringForce(P=D[G],P.idealLength)},m.prototype.calcRepulsionForces=function(){var G,_,O,q,ne,D=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],P=arguments.length>1&&void 0!==arguments[1]&&arguments[1],k=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%T.GRID_CALCULATION_CHECK_PERIOD==1&&D&&this.updateGrid(),ne=new Set,G=0;G<k.length;G++)this.calculateRepulsionForceOfANode(O=k[G],ne,D,P),ne.add(O);else for(G=0;G<k.length;G++)for(O=k[G],_=G+1;_<k.length;_++)q=k[_],O.getOwner()==q.getOwner()&&this.calcRepulsionForce(O,q)},m.prototype.calcGravitationalForces=function(){for(var P=this.getAllNodesToApplyGravitation(),G=0;G<P.length;G++)this.calcGravitationalForce(P[G])},m.prototype.moveNodes=function(){for(var D=this.getAllNodes(),G=0;G<D.length;G++)D[G].move()},m.prototype.calcSpringForce=function(D,P){var O,q,k,ne,G=D.getSource(),_=D.getTarget();if(this.uniformLeafNodeSizes&&null==G.getChild()&&null==_.getChild())D.updateLengthSimple();else if(D.updateLength(),D.isOverlapingSourceAndTarget)return;0!=(O=D.getLength())&&(ne=(q=this.springConstant*(O-P))*(D.lengthY/O),G.springForceX+=k=q*(D.lengthX/O),G.springForceY+=ne,_.springForceX-=k,_.springForceY-=ne)},m.prototype.calcRepulsionForce=function(D,P){var k,ne,W,Ee,ae,R,S,G=D.getRect(),_=P.getRect(),O=new Array(2),q=new Array(4);if(G.intersects(_)){y.calcSeparationAmount(G,_,O,T.DEFAULT_EDGE_LENGTH/2),S=2*O[1];var I=D.noOfChildren*P.noOfChildren/(D.noOfChildren+P.noOfChildren);D.repulsionForceX-=I*(R=2*O[0]),D.repulsionForceY-=I*S,P.repulsionForceX+=I*R,P.repulsionForceY+=I*S}else this.uniformLeafNodeSizes&&null==D.getChild()&&null==P.getChild()?(k=_.getCenterX()-G.getCenterX(),ne=_.getCenterY()-G.getCenterY()):(y.getIntersection(G,_,q),k=q[2]-q[0],ne=q[3]-q[1]),Math.abs(k)<T.MIN_REPULSION_DIST&&(k=E.sign(k)*T.MIN_REPULSION_DIST),Math.abs(ne)<T.MIN_REPULSION_DIST&&(ne=E.sign(ne)*T.MIN_REPULSION_DIST),W=k*k+ne*ne,Ee=Math.sqrt(W),S=(ae=this.repulsionConstant*D.noOfChildren*P.noOfChildren/W)*ne/Ee,D.repulsionForceX-=R=ae*k/Ee,D.repulsionForceY-=S,P.repulsionForceX+=R,P.repulsionForceY+=S},m.prototype.calcGravitationalForce=function(D){var P,G,_,O,q,k,ne,W;G=((P=D.getOwner()).getRight()+P.getLeft())/2,_=(P.getTop()+P.getBottom())/2,O=D.getCenterX()-G,q=D.getCenterY()-_,k=Math.abs(O)+D.getWidth()/2,ne=Math.abs(q)+D.getHeight()/2,D.getOwner()==this.graphManager.getRoot()?(k>(W=P.getEstimatedSize()*this.gravityRangeFactor)||ne>W)&&(D.gravitationForceX=-this.gravityConstant*O,D.gravitationForceY=-this.gravityConstant*q):(k>(W=P.getEstimatedSize()*this.compoundGravityRangeFactor)||ne>W)&&(D.gravitationForceX=-this.gravityConstant*O*this.compoundGravityConstant,D.gravitationForceY=-this.gravityConstant*q*this.compoundGravityConstant)},m.prototype.isConverged=function(){var D,P=!1;return this.totalIterations>this.maxIterations/3&&(P=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),D=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,D||P},m.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},m.prototype.calcNoOfChildrenForAllNodes=function(){for(var D,P=this.graphManager.getAllNodes(),G=0;G<P.length;G++)(D=P[G]).noOfChildren=D.getNoOfChildren()},m.prototype.calcGrid=function(D){var P,G;P=parseInt(Math.ceil((D.getRight()-D.getLeft())/this.repulsionRange)),G=parseInt(Math.ceil((D.getBottom()-D.getTop())/this.repulsionRange));for(var _=new Array(P),O=0;O<P;O++)_[O]=new Array(G);for(O=0;O<P;O++)for(var q=0;q<G;q++)_[O][q]=new Array;return _},m.prototype.addNodeToGrid=function(D,P,G){var _,O,q,k;_=parseInt(Math.floor((D.getRect().x-P)/this.repulsionRange)),O=parseInt(Math.floor((D.getRect().width+D.getRect().x-P)/this.repulsionRange)),q=parseInt(Math.floor((D.getRect().y-G)/this.repulsionRange)),k=parseInt(Math.floor((D.getRect().height+D.getRect().y-G)/this.repulsionRange));for(var ne=_;ne<=O;ne++)for(var W=q;W<=k;W++)this.grid[ne][W].push(D),D.setGridCoordinates(_,O,q,k)},m.prototype.updateGrid=function(){var D,G=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),D=0;D<G.length;D++)this.addNodeToGrid(G[D],this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},m.prototype.calculateRepulsionForceOfANode=function(D,P,G,_){if(this.totalIterations%T.GRID_CALCULATION_CHECK_PERIOD==1&&G||_){var O=new Set;D.surrounding=new Array;for(var q,k=this.grid,ne=D.startX-1;ne<D.finishX+2;ne++)for(var W=D.startY-1;W<D.finishY+2;W++)if(!(ne<0||W<0||ne>=k.length||W>=k[0].length))for(var Ee=0;Ee<k[ne][W].length;Ee++)if(q=k[ne][W][Ee],D.getOwner()==q.getOwner()&&D!=q&&!P.has(q)&&!O.has(q)){var ae=Math.abs(D.getCenterX()-q.getCenterX())-(D.getWidth()/2+q.getWidth()/2),R=Math.abs(D.getCenterY()-q.getCenterY())-(D.getHeight()/2+q.getHeight()/2);ae<=this.repulsionRange&&R<=this.repulsionRange&&O.add(q)}D.surrounding=[].concat(function M(D){if(Array.isArray(D)){for(var P=0,G=Array(D.length);P<D.length;P++)G[P]=D[P];return G}return Array.from(D)}(O))}for(ne=0;ne<D.surrounding.length;ne++)this.calcRepulsionForce(D,D.surrounding[ne])},m.prototype.calcRepulsionRange=function(){return 0},Me.exports=m},function(Me,Y,Z){"use strict";var M=Z(1),w=Z(7);function T(y,E,m){M.call(this,y,E,m),this.idealLength=w.DEFAULT_EDGE_LENGTH}for(var N in T.prototype=Object.create(M.prototype),M)T[N]=M[N];Me.exports=T},function(Me,Y,Z){"use strict";var M=Z(3);function w(N,y,E,m){M.call(this,N,y,E,m),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var T in w.prototype=Object.create(M.prototype),M)w[T]=M[T];w.prototype.setGridCoordinates=function(N,y,E,m){this.startX=N,this.finishX=y,this.startY=E,this.finishY=m},Me.exports=w},function(Me,Y,Z){"use strict";function M(w,T){this.width=0,this.height=0,null!==w&&null!==T&&(this.height=T,this.width=w)}M.prototype.getWidth=function(){return this.width},M.prototype.setWidth=function(w){this.width=w},M.prototype.getHeight=function(){return this.height},M.prototype.setHeight=function(w){this.height=w},Me.exports=M},function(Me,Y,Z){"use strict";var M=Z(14);function w(){this.map={},this.keys=[]}w.prototype.put=function(T,N){var y=M.createID(T);this.contains(y)||(this.map[y]=N,this.keys.push(T))},w.prototype.contains=function(T){return M.createID(T),null!=this.map[T]},w.prototype.get=function(T){var N=M.createID(T);return this.map[N]},w.prototype.keySet=function(){return this.keys},Me.exports=w},function(Me,Y,Z){"use strict";var M=Z(14);function w(){this.set={}}w.prototype.add=function(T){var N=M.createID(T);this.contains(N)||(this.set[N]=T)},w.prototype.remove=function(T){delete this.set[M.createID(T)]},w.prototype.clear=function(){this.set={}},w.prototype.contains=function(T){return this.set[M.createID(T)]==T},w.prototype.isEmpty=function(){return 0===this.size()},w.prototype.size=function(){return Object.keys(this.set).length},w.prototype.addAllTo=function(T){for(var N=Object.keys(this.set),y=N.length,E=0;E<y;E++)T.push(this.set[N[E]])},w.prototype.size=function(){return Object.keys(this.set).length},w.prototype.addAll=function(T){for(var N=T.length,y=0;y<N;y++)this.add(T[y])},Me.exports=w},function(Me,Y,Z){"use strict";var M=function(){function y(E,m){for(var L=0;L<m.length;L++){var D=m[L];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(E,D.key,D)}}return function(E,m,L){return m&&y(E.prototype,m),L&&y(E,L),E}}();var T=Z(11),N=function(){function y(E,m){(function w(y,E){if(!(y instanceof E))throw new TypeError("Cannot call a class as a function")})(this,y),(null!==m||void 0!==m)&&(this.compareFunction=this._defaultCompareFunction);var L;L=E instanceof T?E.size():E.length,this._quicksort(E,0,L-1)}return M(y,[{key:"_quicksort",value:function(m,L,D){if(L<D){var P=this._partition(m,L,D);this._quicksort(m,L,P),this._quicksort(m,P+1,D)}}},{key:"_partition",value:function(m,L,D){for(var P=this._get(m,L),G=L,_=D;;){for(;this.compareFunction(P,this._get(m,_));)_--;for(;this.compareFunction(this._get(m,G),P);)G++;if(!(G<_))return _;this._swap(m,G,_),G++,_--}}},{key:"_get",value:function(m,L){return m instanceof T?m.get_object_at(L):m[L]}},{key:"_set",value:function(m,L,D){m instanceof T?m.set_object_at(L,D):m[L]=D}},{key:"_swap",value:function(m,L,D){var P=this._get(m,L);this._set(m,L,this._get(m,D)),this._set(m,D,P)}},{key:"_defaultCompareFunction",value:function(m,L){return L>m}}]),y}();Me.exports=N},function(Me,Y,Z){"use strict";var M=function(){function N(y,E){for(var m=0;m<E.length;m++){var L=E[m];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(y,L.key,L)}}return function(y,E,m){return E&&N(y.prototype,E),m&&N(y,m),y}}();var T=function(){function N(y,E){var m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,L=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,D=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;(function w(N,y){if(!(N instanceof y))throw new TypeError("Cannot call a class as a function")})(this,N),this.sequence1=y,this.sequence2=E,this.match_score=m,this.mismatch_penalty=L,this.gap_penalty=D,this.iMax=y.length+1,this.jMax=E.length+1,this.grid=new Array(this.iMax);for(var P=0;P<this.iMax;P++){this.grid[P]=new Array(this.jMax);for(var G=0;G<this.jMax;G++)this.grid[P][G]=0}this.tracebackGrid=new Array(this.iMax);for(var _=0;_<this.iMax;_++){this.tracebackGrid[_]=new Array(this.jMax);for(var O=0;O<this.jMax;O++)this.tracebackGrid[_][O]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return M(N,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var E=1;E<this.jMax;E++)this.grid[0][E]=this.grid[0][E-1]+this.gap_penalty,this.tracebackGrid[0][E]=[!1,!1,!0];for(var m=1;m<this.iMax;m++)this.grid[m][0]=this.grid[m-1][0]+this.gap_penalty,this.tracebackGrid[m][0]=[!1,!0,!1];for(var L=1;L<this.iMax;L++)for(var D=1;D<this.jMax;D++){var O=[this.sequence1[L-1]===this.sequence2[D-1]?this.grid[L-1][D-1]+this.match_score:this.grid[L-1][D-1]+this.mismatch_penalty,this.grid[L-1][D]+this.gap_penalty,this.grid[L][D-1]+this.gap_penalty],q=this.arrayAllMaxIndexes(O);this.grid[L][D]=O[q[0]],this.tracebackGrid[L][D]=[q.includes(0),q.includes(1),q.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var E=[];for(E.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});E[0];){var m=E[0],L=this.tracebackGrid[m.pos[0]][m.pos[1]];L[0]&&E.push({pos:[m.pos[0]-1,m.pos[1]-1],seq1:this.sequence1[m.pos[0]-1]+m.seq1,seq2:this.sequence2[m.pos[1]-1]+m.seq2}),L[1]&&E.push({pos:[m.pos[0]-1,m.pos[1]],seq1:this.sequence1[m.pos[0]-1]+m.seq1,seq2:"-"+m.seq2}),L[2]&&E.push({pos:[m.pos[0],m.pos[1]-1],seq1:"-"+m.seq1,seq2:this.sequence2[m.pos[1]-1]+m.seq2}),0===m.pos[0]&&0===m.pos[1]&&this.alignments.push({sequence1:m.seq1,sequence2:m.seq2}),E.shift()}return this.alignments}},{key:"getAllIndexes",value:function(E,m){for(var L=[],D=-1;-1!==(D=E.indexOf(m,D+1));)L.push(D);return L}},{key:"arrayAllMaxIndexes",value:function(E){return this.getAllIndexes(E,Math.max.apply(null,E))}}]),N}();Me.exports=T},function(Me,Y,Z){"use strict";var M=function(){};M.FDLayout=Z(18),M.FDLayoutConstants=Z(7),M.FDLayoutEdge=Z(19),M.FDLayoutNode=Z(20),M.DimensionD=Z(21),M.HashMap=Z(22),M.HashSet=Z(23),M.IGeometry=Z(8),M.IMath=Z(9),M.Integer=Z(10),M.Point=Z(12),M.PointD=Z(4),M.RandomSeed=Z(16),M.RectangleD=Z(13),M.Transform=Z(17),M.UniqueIDGeneretor=Z(14),M.Quicksort=Z(24),M.LinkedList=Z(11),M.LGraphObject=Z(2),M.LGraph=Z(5),M.LEdge=Z(1),M.LGraphManager=Z(6),M.LNode=Z(3),M.Layout=Z(15),M.LayoutConstants=Z(0),M.NeedlemanWunsch=Z(25),Me.exports=M},function(Me,Y,Z){"use strict";function M(){this.listeners=[]}var w=M.prototype;w.addListener=function(T,N){this.listeners.push({event:T,callback:N})},w.removeListener=function(T,N){for(var y=this.listeners.length;y>=0;y--){var E=this.listeners[y];E.event===T&&E.callback===N&&this.listeners.splice(y,1)}},w.emit=function(T,N){for(var y=0;y<this.listeners.length;y++){var E=this.listeners[y];T===E.event&&E.callback(N)}},Me.exports=M}])},1224(Qe,Me,Y){Qe.exports=Y(4548)},250(Qe){"use strict";Qe.exports=class Xf{constructor(Y,Z=new Map,M=0){this.prefix=Y,this._existing=Z,this.counter=M}clone(){const{prefix:Y,_existing:Z,counter:M}=this;return new Xf(Y,new Map(Z),M)}getId(Y){const Z=Y&&this._existing.get(Y);if(Z)return Z;const M=this.prefix+this.counter;return this.counter++,Y&&this._existing.set(Y,M),M}hasId(Y){return this._existing.has(Y)}getOldIds(){return[...this._existing.keys()]}}},1126(Qe,Me,Y){"use strict";var Z=Y(9293).default;Y(7140);const M=self.crypto||self.msCrypto;Qe.exports=class{constructor(T){if(!M||!M.subtle)throw new Error("crypto.subtle not found.");if("sha256"===T)this.algorithm={name:"SHA-256"};else{if("sha1"!==T)throw new Error(`Unsupported algorithm "${T}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(T){this._content+=T}digest(){var T=this;return Z(function*(){const N=(new TextEncoder).encode(T._content),y=new Uint8Array(yield M.subtle.digest(T.algorithm,N));let E="";for(let m=0;m<y.length;++m)E+=y[m].toString(16).padStart(2,"0");return E})()}}},8276(Qe){"use strict";const Z="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",M="http://www.w3.org/2001/XMLSchema#string",w="NamedNode",T="BlankNode",N="Literal",y="DefaultGraph",E={};function m(_,O){return _.subject.termType===O.subject.termType&&_.object.termType===O.object.termType&&_.subject.value===O.subject.value&&_.predicate.value===O.predicate.value&&_.object.value===O.object.value&&(_.object.termType!==N||_.object.datatype.termType===O.object.datatype.termType&&_.object.language===O.object.language&&_.object.datatype.value===O.object.datatype.value)}(()=>{const _="(?:<([^:]+:[^>]*)>)",q="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd_",k=q+"0-9-\xb7\u0300-\u036f\u203f-\u2040",W="(_:(?:["+q+"0-9])(?:(?:["+k+".])*(?:["+k+"]))?)",I="[ \\t]+",B="[ \\t]*",te="(?:"+_+"|"+W+")"+I,se=_+I,U="(?:"+_+"|"+W+'|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^'+_+")|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))"+B,ie="(?:\\.|(?:(?:"+_+"|"+W+")"+B+"\\.))";E.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,E.empty=new RegExp("^"+B+"$"),E.quad=new RegExp("^"+B+te+se+U+ie+B+"$")})(),Qe.exports=class Yi{static parse(O){const q=[],k={},ne=O.split(E.eoln);let W=0;for(const Ee of ne){if(W++,E.empty.test(Ee))continue;const ae=Ee.match(E.quad);if(null===ae)throw new Error("N-Quads parse error on line "+W+".");const R={subject:null,predicate:null,object:null,graph:null};if(R.subject=void 0!==ae[1]?{termType:w,value:ae[1]}:{termType:T,value:ae[2]},R.predicate={termType:w,value:ae[3]},void 0!==ae[4]?R.object={termType:w,value:ae[4]}:void 0!==ae[5]?R.object={termType:T,value:ae[5]}:(R.object={termType:N,value:void 0,datatype:{termType:w}},void 0!==ae[7]?R.object.datatype.value=ae[7]:void 0!==ae[8]?(R.object.datatype.value=Z,R.object.language=ae[8]):R.object.datatype.value=M,R.object.value=G(ae[6])),R.graph=void 0!==ae[9]?{termType:w,value:ae[9]}:void 0!==ae[10]?{termType:T,value:ae[10]}:{termType:y,value:""},R.graph.value in k){let S=!0;const I=k[R.graph.value];for(const B of I)if(m(B,R)){S=!1;break}S&&(I.push(R),q.push(R))}else k[R.graph.value]=[R],q.push(R)}return q}static serialize(O){Array.isArray(O)||(O=Yi.legacyDatasetToQuads(O));const q=[];for(const k of O)q.push(Yi.serializeQuad(k));return q.sort().join("")}static serializeQuadComponents(O,q,k,ne){let W="";return W+=O.termType===w?`<${O.value}>`:`${O.value}`,W+=` <${q.value}> `,k.termType===w?W+=`<${k.value}>`:k.termType===T?W+=k.value:(W+=`"${function D(_){return _.replace(L,function(O){switch(O){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}})}(k.value)}"`,k.datatype.value===Z?k.language&&(W+=`@${k.language}`):k.datatype.value!==M&&(W+=`^^<${k.datatype.value}>`)),ne.termType===w?W+=` <${ne.value}>`:ne.termType===T&&(W+=` ${ne.value}`),W+=" .\n",W}static serializeQuad(O){return Yi.serializeQuadComponents(O.subject,O.predicate,O.object,O.graph)}static legacyDatasetToQuads(O){const q=[],k={"blank node":T,IRI:w,literal:N};for(const ne in O)O[ne].forEach(Ee=>{const ae={};for(const R in Ee){const S=Ee[R],I={termType:k[S.type],value:S.value};I.termType===N&&(I.datatype={termType:w},"datatype"in S&&(I.datatype.value=S.datatype),"language"in S?("datatype"in S||(I.datatype.value=Z),I.language=S.language):"datatype"in S||(I.datatype.value=M)),ae[R]=I}ae.graph="@default"===ne?{termType:y,value:""}:{termType:ne.startsWith("_:")?T:w,value:ne},q.push(ae)});return q}};const L=/["\\\n\r]/g,P=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function G(_){return _.replace(P,function(O,q,k,ne){if(q)switch(q){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(k)return String.fromCharCode(parseInt(k,16));if(ne)throw new Error("Unsupported U escape")})}},7794(Qe){"use strict";Qe.exports=class{constructor(Y){this.current=Y.sort(),this.done=!1,this.dir=new Map;for(let Z=0;Z<Y.length;++Z)this.dir.set(Y[Z],!0)}hasNext(){return!this.done}next(){const{current:Y,dir:Z}=this,M=Y.slice();let w=null,T=0;const N=Y.length;for(let y=0;y<N;++y){const E=Y[y],m=Z.get(E);(null===w||E>w)&&(m&&y>0&&E>Y[y-1]||!m&&y<N-1&&E>Y[y+1])&&(w=E,T=y)}if(null===w)this.done=!0;else{const y=Z.get(w)?T-1:T+1;Y[T]=Y[y],Y[y]=w;for(const E of Y)E>w&&Z.set(E,!Z.get(E))}return M}}},624(Qe,Me,Y){"use strict";var Z=Y(9293).default;const M=Y(250),w=Y(1126),T=Y(7794),N=Y(8276);function y(E,m){return E.hash<m.hash?-1:E.hash>m.hash?1:0}Qe.exports=class{constructor({createMessageDigest:m=()=>new w("sha256"),canonicalIdMap:L=new Map,maxDeepIterations:D=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new M("_:c14n",L),this.createMessageDigest=m,this.maxDeepIterations=D,this.quads=null,this.deepIterations=null}main(m){var L=this;return Z(function*(){L.deepIterations=new Map,L.quads=m;for(const k of m)L._addBlankNodeQuadInfo({quad:k,component:k.subject}),L._addBlankNodeQuadInfo({quad:k,component:k.object}),L._addBlankNodeQuadInfo({quad:k,component:k.graph});const D=new Map,P=[...L.blankNodeInfo.keys()];let G=0;for(const k of P)++G%100==0&&(yield L._yield()),yield L._hashAndTrackBlankNode({id:k,hashToBlankNodes:D});const _=[...D.keys()].sort(),O=[];for(const k of _){const ne=D.get(k);ne.length>1?O.push(ne):L.canonicalIssuer.getId(ne[0])}for(const k of O){const ne=[];for(const W of k){if(L.canonicalIssuer.hasId(W))continue;const Ee=new M("_:b");Ee.getId(W);const ae=yield L.hashNDegreeQuads(W,Ee);ne.push(ae)}ne.sort(y);for(const W of ne){const Ee=W.issuer.getOldIds();for(const ae of Ee)L.canonicalIssuer.getId(ae)}}const q=[];for(const k of L.quads){const ne=N.serializeQuadComponents(L._componentWithCanonicalId(k.subject),k.predicate,L._componentWithCanonicalId(k.object),L._componentWithCanonicalId(k.graph));q.push(ne)}return q.sort(),q.join("")})()}hashFirstDegreeQuads(m){var L=this;return Z(function*(){const D=[],P=L.blankNodeInfo.get(m),G=P.quads;for(const O of G){const q={subject:null,predicate:O.predicate,object:null,graph:null};q.subject=L.modifyFirstDegreeComponent(m,O.subject,"subject"),q.object=L.modifyFirstDegreeComponent(m,O.object,"object"),q.graph=L.modifyFirstDegreeComponent(m,O.graph,"graph"),D.push(N.serializeQuad(q))}D.sort();const _=L.createMessageDigest();for(const O of D)_.update(O);return P.hash=yield _.digest(),P.hash})()}hashRelatedBlankNode(m,L,D,P){var G=this;return Z(function*(){let _;_=G.canonicalIssuer.hasId(m)?G.canonicalIssuer.getId(m):D.hasId(m)?D.getId(m):G.blankNodeInfo.get(m).hash;const O=G.createMessageDigest();return O.update(P),"g"!==P&&O.update(G.getRelatedPredicate(L)),O.update(_),O.digest()})()}hashNDegreeQuads(m,L){var D=this;return Z(function*(){const P=D.deepIterations.get(m)||0;if(P>D.maxDeepIterations)throw new Error(`Maximum deep iterations (${D.maxDeepIterations}) exceeded.`);D.deepIterations.set(m,P+1);const G=D.createMessageDigest(),_=yield D.createHashToRelated(m,L),O=[..._.keys()].sort();for(const q of O){G.update(q);let ne,k="";const W=new T(_.get(q));let Ee=0;for(;W.hasNext();){const ae=W.next();++Ee%3==0&&(yield D._yield());let R=L.clone(),S="";const I=[];let B=!1;for(const te of ae)if(D.canonicalIssuer.hasId(te)?S+=D.canonicalIssuer.getId(te):(R.hasId(te)||I.push(te),S+=R.getId(te)),0!==k.length&&S>k){B=!0;break}if(!B){for(const te of I){const se=yield D.hashNDegreeQuads(te,R);if(S+=R.getId(te),S+=`<${se.hash}>`,R=se.issuer,0!==k.length&&S>k){B=!0;break}}B||(0===k.length||S<k)&&(k=S,ne=R)}}G.update(k),L=ne}return{hash:yield G.digest(),issuer:L}})()}modifyFirstDegreeComponent(m,L){return"BlankNode"!==L.termType?L:{termType:"BlankNode",value:L.value===m?"_:a":"_:z"}}getRelatedPredicate(m){return`<${m.predicate.value}>`}createHashToRelated(m,L){var D=this;return Z(function*(){const P=new Map,G=D.blankNodeInfo.get(m).quads;let _=0;for(const O of G)++_%100==0&&(yield D._yield()),yield Promise.all([D._addRelatedBlankNodeHash({quad:O,component:O.subject,position:"s",id:m,issuer:L,hashToRelated:P}),D._addRelatedBlankNodeHash({quad:O,component:O.object,position:"o",id:m,issuer:L,hashToRelated:P}),D._addRelatedBlankNodeHash({quad:O,component:O.graph,position:"g",id:m,issuer:L,hashToRelated:P})]);return P})()}_hashAndTrackBlankNode(m){var L=this;return Z(function*({id:D,hashToBlankNodes:P}){const G=yield L.hashFirstDegreeQuads(D),_=P.get(G);_?_.push(D):P.set(G,[D])}).apply(this,arguments)}_addBlankNodeQuadInfo({quad:m,component:L}){if("BlankNode"!==L.termType)return;const D=L.value,P=this.blankNodeInfo.get(D);P?P.quads.add(m):this.blankNodeInfo.set(D,{quads:new Set([m]),hash:null})}_addRelatedBlankNodeHash(m){var L=this;return Z(function*({quad:D,component:P,position:G,id:_,issuer:O,hashToRelated:q}){if("BlankNode"!==P.termType||P.value===_)return;const k=P.value,ne=yield L.hashRelatedBlankNode(k,D,O,G),W=q.get(ne);W?W.push(k):q.set(ne,[k])}).apply(this,arguments)}_componentWithCanonicalId(m){return"BlankNode"!==m.termType||m.value.startsWith(this.canonicalIssuer.prefix)?m:{termType:"BlankNode",value:this.canonicalIssuer.getId(m.value)}}_yield(){return Z(function*(){return new Promise(m=>setImmediate(m))})()}}},203(Qe,Me,Y){"use strict";const Z=Y(250),M=Y(1126),w=Y(7794),T=Y(8276);function N(y,E){return y.hash<E.hash?-1:y.hash>E.hash?1:0}Qe.exports=class{constructor({createMessageDigest:E=()=>new M("sha256"),canonicalIdMap:m=new Map,maxDeepIterations:L=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new Z("_:c14n",m),this.createMessageDigest=E,this.maxDeepIterations=L,this.quads=null,this.deepIterations=null}main(E){this.deepIterations=new Map,this.quads=E;for(const _ of E)this._addBlankNodeQuadInfo({quad:_,component:_.subject}),this._addBlankNodeQuadInfo({quad:_,component:_.object}),this._addBlankNodeQuadInfo({quad:_,component:_.graph});const m=new Map,L=[...this.blankNodeInfo.keys()];for(const _ of L)this._hashAndTrackBlankNode({id:_,hashToBlankNodes:m});const D=[...m.keys()].sort(),P=[];for(const _ of D){const O=m.get(_);O.length>1?P.push(O):this.canonicalIssuer.getId(O[0])}for(const _ of P){const O=[];for(const q of _){if(this.canonicalIssuer.hasId(q))continue;const k=new Z("_:b");k.getId(q);const ne=this.hashNDegreeQuads(q,k);O.push(ne)}O.sort(N);for(const q of O){const k=q.issuer.getOldIds();for(const ne of k)this.canonicalIssuer.getId(ne)}}const G=[];for(const _ of this.quads){const O=T.serializeQuadComponents(this._componentWithCanonicalId({component:_.subject}),_.predicate,this._componentWithCanonicalId({component:_.object}),this._componentWithCanonicalId({component:_.graph}));G.push(O)}return G.sort(),G.join("")}hashFirstDegreeQuads(E){const m=[],L=this.blankNodeInfo.get(E),D=L.quads;for(const G of D){const _={subject:null,predicate:G.predicate,object:null,graph:null};_.subject=this.modifyFirstDegreeComponent(E,G.subject,"subject"),_.object=this.modifyFirstDegreeComponent(E,G.object,"object"),_.graph=this.modifyFirstDegreeComponent(E,G.graph,"graph"),m.push(T.serializeQuad(_))}m.sort();const P=this.createMessageDigest();for(const G of m)P.update(G);return L.hash=P.digest(),L.hash}hashRelatedBlankNode(E,m,L,D){let P;P=this.canonicalIssuer.hasId(E)?this.canonicalIssuer.getId(E):L.hasId(E)?L.getId(E):this.blankNodeInfo.get(E).hash;const G=this.createMessageDigest();return G.update(D),"g"!==D&&G.update(this.getRelatedPredicate(m)),G.update(P),G.digest()}hashNDegreeQuads(E,m){const L=this.deepIterations.get(E)||0;if(L>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(E,L+1);const D=this.createMessageDigest(),P=this.createHashToRelated(E,m),G=[...P.keys()].sort();for(const _ of G){D.update(_);let q,O="";const k=new w(P.get(_));for(;k.hasNext();){const ne=k.next();let W=m.clone(),Ee="";const ae=[];let R=!1;for(const S of ne)if(this.canonicalIssuer.hasId(S)?Ee+=this.canonicalIssuer.getId(S):(W.hasId(S)||ae.push(S),Ee+=W.getId(S)),0!==O.length&&Ee>O){R=!0;break}if(!R){for(const S of ae){const I=this.hashNDegreeQuads(S,W);if(Ee+=W.getId(S),Ee+=`<${I.hash}>`,W=I.issuer,0!==O.length&&Ee>O){R=!0;break}}R||(0===O.length||Ee<O)&&(O=Ee,q=W)}}D.update(O),m=q}return{hash:D.digest(),issuer:m}}modifyFirstDegreeComponent(E,m){return"BlankNode"!==m.termType?m:{termType:"BlankNode",value:m.value===E?"_:a":"_:z"}}getRelatedPredicate(E){return`<${E.predicate.value}>`}createHashToRelated(E,m){const L=new Map,D=this.blankNodeInfo.get(E).quads;for(const P of D)this._addRelatedBlankNodeHash({quad:P,component:P.subject,position:"s",id:E,issuer:m,hashToRelated:L}),this._addRelatedBlankNodeHash({quad:P,component:P.object,position:"o",id:E,issuer:m,hashToRelated:L}),this._addRelatedBlankNodeHash({quad:P,component:P.graph,position:"g",id:E,issuer:m,hashToRelated:L});return L}_hashAndTrackBlankNode({id:E,hashToBlankNodes:m}){const L=this.hashFirstDegreeQuads(E),D=m.get(L);D?D.push(E):m.set(L,[E])}_addBlankNodeQuadInfo({quad:E,component:m}){if("BlankNode"!==m.termType)return;const L=m.value,D=this.blankNodeInfo.get(L);D?D.quads.add(E):this.blankNodeInfo.set(L,{quads:new Set([E]),hash:null})}_addRelatedBlankNodeHash({quad:E,component:m,position:L,id:D,issuer:P,hashToRelated:G}){if("BlankNode"!==m.termType||m.value===D)return;const _=m.value,O=this.hashRelatedBlankNode(_,E,P,L),q=G.get(O);q?q.push(_):G.set(O,[_])}_componentWithCanonicalId({component:E}){return"BlankNode"!==E.termType||E.value.startsWith(this.canonicalIssuer.prefix)?E:{termType:"BlankNode",value:this.canonicalIssuer.getId(E.value)}}}},6268(Qe,Me,Y){"use strict";var Z=Y(9293).default;const M=Y(1126),w=Y(624);Qe.exports=class extends w{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new M("sha1")}modifyFirstDegreeComponent(N,y,E){return"BlankNode"!==y.termType?y:"graph"===E?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:y.value===N?"_:a":"_:z"}}getRelatedPredicate(N){return N.predicate.value}createHashToRelated(N,y){var E=this;return Z(function*(){const m=new Map,L=E.blankNodeInfo.get(N).quads;let D=0;for(const P of L){let G,_;if("BlankNode"===P.subject.termType&&P.subject.value!==N)_=P.subject.value,G="p";else{if("BlankNode"!==P.object.termType||P.object.value===N)continue;_=P.object.value,G="r"}++D%100==0&&(yield E._yield());const O=yield E.hashRelatedBlankNode(_,P,y,G),q=m.get(O);q?q.push(_):m.set(O,[_])}return m})()}}},8911(Qe,Me,Y){"use strict";const Z=Y(1126),M=Y(203);Qe.exports=class extends M{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new Z("sha1")}modifyFirstDegreeComponent(T,N,y){return"BlankNode"!==N.termType?N:"graph"===y?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:N.value===T?"_:a":"_:z"}}getRelatedPredicate(T){return T.predicate.value}createHashToRelated(T,N){const y=new Map,E=this.blankNodeInfo.get(T).quads;for(const m of E){let L,D;if("BlankNode"===m.subject.termType&&m.subject.value!==T)D=m.subject.value,L="p";else{if("BlankNode"!==m.object.termType||m.object.value===T)continue;D=m.object.value,L="r"}const P=this.hashRelatedBlankNode(D,m,N,L),G=y.get(P);G?G.push(D):y.set(P,[D])}return y}}},4548(Qe,Me,Y){"use strict";var Z=Y(9293).default;const M=Y(624),w=Y(6268),T=Y(203),N=Y(8911);let y;try{y=Y(7789)}catch{}function E(m){return Array.isArray(m)?m:Me.NQuads.legacyDatasetToQuads(m)}Me.NQuads=Y(8276),Me.IdentifierIssuer=Y(250),Me._rdfCanonizeNative=function(m){return m&&(y=m),y},Me.canonize=function(){var m=Z(function*(L,D){const P=E(L);if(D.useNative){if(!y)throw new Error("rdf-canonize-native not available");if(D.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((G,_)=>y.canonize(P,D,(O,q)=>O?_(O):G(q)))}if("URDNA2015"===D.algorithm)return new M(D).main(P);if("URGNA2012"===D.algorithm){if(D.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new w(D).main(P)}throw"algorithm"in D?new Error("Invalid RDF Dataset Canonicalization algorithm: "+D.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")});return function(L,D){return m.apply(this,arguments)}}(),Me._canonizeSync=function(m,L){const D=E(m);if(L.useNative){if(!y)throw new Error("rdf-canonize-native not available");if(L.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return y.canonizeSync(D,L)}if("URDNA2015"===L.algorithm)return new T(L).main(D);if("URGNA2012"===L.algorithm){if(L.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new N(L).main(D)}throw"algorithm"in L?new Error("Invalid RDF Dataset Canonicalization algorithm: "+L.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}},7140(){!function(Qe){"use strict";if(!Qe.setImmediate){var T,Y=1,Z={},M=!1,w=Qe.document,q=Object.getPrototypeOf&&Object.getPrototypeOf(Qe);q=q&&q.setTimeout?q:Qe,"[object process]"==={}.toString.call(Qe.process)?function L(){T=function(k){process.nextTick(function(){m(k)})}}():function D(){if(Qe.postMessage&&!Qe.importScripts){var k=!0,ne=Qe.onmessage;return Qe.onmessage=function(){k=!1},Qe.postMessage("","*"),Qe.onmessage=ne,k}}()?function P(){var k="setImmediate$"+Math.random()+"$",ne=function(W){W.source===Qe&&"string"==typeof W.data&&0===W.data.indexOf(k)&&m(+W.data.slice(k.length))};Qe.addEventListener?Qe.addEventListener("message",ne,!1):Qe.attachEvent("onmessage",ne),T=function(W){Qe.postMessage(k+W,"*")}}():Qe.MessageChannel?function G(){var k=new MessageChannel;k.port1.onmessage=function(ne){m(ne.data)},T=function(ne){k.port2.postMessage(ne)}}():w&&"onreadystatechange"in w.createElement("script")?function _(){var k=w.documentElement;T=function(ne){var W=w.createElement("script");W.onreadystatechange=function(){m(ne),W.onreadystatechange=null,k.removeChild(W),W=null},k.appendChild(W)}}():function O(){T=function(k){setTimeout(m,0,k)}}(),q.setImmediate=function N(k){"function"!=typeof k&&(k=new Function(""+k));for(var ne=new Array(arguments.length-1),W=0;W<ne.length;W++)ne[W]=arguments[W+1];return Z[Y]={callback:k,args:ne},T(Y),Y++},q.clearImmediate=y}function y(k){delete Z[k]}function m(k){if(M)setTimeout(m,0,k);else{var ne=Z[k];if(ne){M=!0;try{!function E(k){var ne=k.callback,W=k.args;switch(W.length){case 0:ne();break;case 1:ne(W[0]);break;case 2:ne(W[0],W[1]);break;case 3:ne(W[0],W[1],W[2]);break;default:ne.apply(void 0,W)}}(ne)}finally{y(k),M=!1}}}}}(typeof self>"u"?typeof global>"u"?this:global:self)},7789(){}}]);
|