@qaecy/cue-ui 0.0.43 → 0.0.44

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/347.js DELETED
@@ -1 +0,0 @@
1
- (self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[347],{3347(Ke,Re,q){"use strict";q.d(Re,{CueEntityViewer:()=>mb});var ee=q(467),A=q(7705),I=q(2271),m=q(5802),N=q(5281),b=q(9769),T=q(9352),x=q(5381),R=q(1024),S=q(9421),_=q(5903),z=q(6117),P=q(8547),k=q(3319),K=q(5971),B=q(7573),y=q(5547);function Y(r,e){if(1&r&&(y.nrm(0,"cue-key-val",4),y.nI1(1,"transloco")),2&r){const t=y.XpG(2);y.Y8G("key",y.bMT(1,2,"components.entityInfo.labelValue"))("val",t.entity().value)}}function De(r,e){if(1&r&&(y.nrm(0,"cue-key-val-editable",5),y.nI1(1,"transloco"),y.nI1(2,"transloco")),2&r){const t=y.XpG(3);y.Y8G("key",1===t.entityCategories().length?y.bMT(1,4,"components.entityInfo.labelEntityCategory"):y.bMT(2,6,"components.entityInfo.labelEntityCategories"))("val",t.entityCategoriesString())("rdfConfig",t.rdfEditConfig())("editDisabled",!t.entityCategoriesEditable())}}function se(r,e){if(1&r&&(y.nrm(0,"hr"),y.nVh(1,De,3,8,"cue-key-val-editable",5)),2&r){const t=y.XpG(2);y.R7$(),y.vxM(t.entityCategories()&&t.entityCategories().length>0?1:-1)}}function O(r,e){if(1&r&&(y.j41(0,"cue-key-val-list"),y.nVh(1,Y,2,4,"cue-key-val",4),y.nVh(2,se,2,1),y.k0s()),2&r){const t=y.XpG();y.R7$(),y.vxM(t.entity().value?1:-1),y.R7$(),y.vxM(t.collapsed()?-1:2)}}function D(r,e){if(1&r&&(y.j41(0,"cue-flexcontainer",3)(1,"cue-menu",6)(2,"cue-button",7,0),y.nrm(4,"cue-button-icon",8),y.k0s(),y.nrm(5,"cue-menu-nested",9),y.k0s()()),2&r){y.XpG();const t=y.r8f(3);y.R7$(5),y.Y8G("items",t)}}let L=(()=>{class r{entity=A.hFB.required();handlers=A.hFB.required();entityCategoriesEditable=(0,A.hFB)(!1);menuItems=(0,A.hFB)([]);availableEntityCategories=(0,A.hFB)([]);collapsed=(0,A.hFB)(!1);dataChanged=(0,A.CGW)();_entityCategories=(0,I.uu)(()=>this.entity()?.categories||[]);entityCategories=(0,I.EW)(()=>this._entityCategories());entityCategoriesString=(0,I.EW)(()=>this._entityCategories().map(t=>this._iriToString(t)).sort().join(", "));infoChangeEntityCategory=(0,T.Xx)("components.entityInfo.infoChangeEntityCategory");rdfEditConfig=(0,I.EW)(()=>{var t=this;const n=this.handlers()?.requestRDFChange;var a;if(void 0!==n)return{message:this.infoChangeEntityCategory(),existingValue:this._entityCategories(),dataType:"multiselect",options:this.availableEntityCategories()?.map(a=>a.iri),optionLabelMap:this.availableEntityCategories()?.reduce((a,i)=>(a[i.iri]=i.label,a),{}),requestSave:(a=(0,ee.A)(function*(i){console.log(i);const s={subject:t.entity()?.iri,predicate:`${B.E.qcy}entityCategory`,objects:t._entityCategories(),newObjects:i.newValue,type:"entityCategory",comment:i.comment};yield n(s),t._entityCategories.set(i.newValue),t.dataChanged.emit({entityCategories:i.newValue})}),function(s){return a.apply(this,arguments)})};console.warn("No RDF change request handler defined")});_iriToString(t){const n=this.availableEntityCategories()?.find(a=>a.iri===t);return n?n.label:t}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=y.VBU({type:r,selectors:[["cue-entity-info"]],inputs:{entity:[1,"entity"],handlers:[1,"handlers"],entityCategoriesEditable:[1,"entityCategoriesEditable"],menuItems:[1,"menuItems"],availableEntityCategories:[1,"availableEntityCategories"],collapsed:[1,"collapsed"]},outputs:{dataChanged:"dataChanged"},decls:5,vars:3,consts:[["trigger",""],["direction","row",2,"min-height","50px"],["direction","column",2,"flex","1 1"],["direction","column",2,"width","50px"],["size","l",3,"key","val"],["size","s",3,"key","val","rdfConfig","editDisabled"],["positioning","bottomleft"],["trigger","","variant","tertiary"],["icon","more-vert"],["menu","",3,"items"]],template:function(n,a){if(1&n&&(y.j41(0,"cue-flexcontainer",1)(1,"cue-flexcontainer",2),y.nVh(2,O,3,2,"cue-key-val-list"),y.k0s(),y.SS7(3),y.nVh(4,D,6,1,"cue-flexcontainer",3),y.k0s()),2&n){y.R7$(2),y.vxM(a.entity()?2:-1),y.R7$();const i=y.bH3(a.menuItems());y.R7$(),y.vxM(void 0!==i&&i.length>0?4:-1)}},dependencies:[x.n,R.p,S.F,_.L,z.W,P.T,k.a,K.$,T.Kj],encapsulation:2,changeDetection:0})}return r})();var F=q(4879);class re{hideClassAssignmentTriples=!0;hideDatatypePropertyTriples=!0;collapseIntoClassificationLabels=[];preferredLabelLanguage="en";showClassLabelOnInstance=!0}var U=q(2130),ne=q(8402);class pe{_doc;_omitClassAssignments;_omitDatatypeProperties;_preferredLabelLanguage;_collapseIntoClassificationLabels;_context;_nodes=[];_edges=[];_seenNodes=[];_resourceLabels={};_resourceAltLabels={};_resolvedCollapsePredicates=new Set;_knownPrefixes={schema:"http://schema.org/"};constructor(e,t=!0,n=!0,a="en",i=[]){this._doc=e,this._omitClassAssignments=t,this._omitDatatypeProperties=n,this._preferredLabelLanguage=a,this._collapseIntoClassificationLabels=i}get elementData(){return{nodes:this._nodes,edges:this._edges}}init(){var e=this;return(0,ee.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,U.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,ee.A)(function*(){return(yield(0,U.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;return void 0!==i.size&&(""!=t.data.label&&(i.size=44),Array.isArray(i.boxLabels)&&(i.boxLabels=i.boxLabels.map(s=>{const o=this._expandIRI(s),l=this._resourceLabels[o]??this._resourceAltLabels[o];return Array.isArray(l)&&l.length>0?l[0].value:s}))),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){this._omitClassAssignments&&"a"===t||this._omitDatatypeProperties&&a||this._edges.push({data:{id:(0,ne.A)(),source:e,target:n,label:this._appendPrefix(t),iri:t},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 fe{_doc;_settings;_elementDataHandler;_elementData;constructor(e,t=new re){this._doc=e,this._settings=t,this._elementDataHandler=new pe(this._doc,this._settings.hideClassAssignmentTriples,this._settings.hideDatatypePropertyTriples,this._settings.preferredLabelLanguage,this._settings.collapseIntoClassificationLabels)}set settings(e){this._settings=e,this._elementDataHandler=new pe(this._doc,this._settings.hideClassAssignmentTriples,this._settings.hideDatatypePropertyTriples,this._settings.preferredLabelLanguage,this._settings.collapseIntoClassificationLabels)}init(){var e=this;return(0,ee.A)(function*(){return e._elementData=yield e._elementDataHandler.init(),e._elementData})()}appendElementData(e){var t=this;return(0,ee.A)(function*(){return t._elementData=yield t._elementDataHandler.append(e),t._elementData})()}compact(){console.log("COMPACT")}expand(){console.log("EXPAND")}}class Pe{props={display:!0,displayOnlyOnHover:!0};boxLabels={display:!0,displayOnlyOnHover:!1}}function he(r,e,t=new Pe){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 be(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 te(r){return getComputedStyle(document.documentElement).getPropertyValue(r).trim()}const ue={get backgroundColor(){return te("--cue-main-background")||"#f5f6f9"},get edgeColor(){return te("--cue-primary")||"#2859e1"},edgeFontSize:"5rem",edgeWidth:"1.5rem",get nodeColor(){return te("--cue-primary")||"#2859e1"},nodeOpacity:"0.9",font:"Poppins",directed:!0,labelSelector:"label",showNodeLabels:!0,showEdgeLabels:!0,get hoverBorderColor(){return te("--cue-primary")||"#2859e1"},get textColor(){return te("--cue-primaryContrast")||"#ffffff"}},Le=(r=ue)=>{const e=te("--cue-primary")||"#2859e1",t=te("--cue-primaryContrast")||"#ffffff",n=te("--cue-accent")||"#e2f552",a=te("--cue-accentContrast")||"#121c2b",i=te("--cue-neutral")||"#8394b0",s=te("--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",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 ae{_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 Oe=q(6894),$e=q.n(Oe);function je(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 ze(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ve(r,e,t){return e&&function me(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,tr(n.key),n)}}(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function _e(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=rn(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 et(r,e,t){return(e=tr(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qe(r,e){return function Ze(r){if(Array.isArray(r))return r}(r)||function nt(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)||rn(r,e)||function pt(){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 Et(r){return function Ne(r){if(Array.isArray(r))return je(r)}(r)||function Xe(r){if(typeof Symbol<"u"&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||rn(r)||function Dt(){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 tr(r){var e=function Bt(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 Xt(r){return(Xt="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 rn(r,e){if(r){if("string"==typeof r)return je(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)?je(r,e):void 0}}var ns,kl,as,_l,is,Bl,ss,Fl,os,Gl,ls,zl,us,Vl,ds,Hl,fs,Ul,hs,Xl,vs,Yl,gs,ql,ps,Wl,ys,$l,Zt=typeof window>"u"?null:window,ca=Zt?Zt.navigator:null,da=Xt(""),Sl=Xt({}),rh=Xt(function(){}),nh=typeof HTMLElement>"u"?"undefined":Xt(HTMLElement),fa=function(e){return e&&e.instanceString&&Jt(e.instanceString)?e.instanceString():null},vt=function(e){return null!=e&&Xt(e)==da},Jt=function(e){return null!=e&&Xt(e)===rh},Yt=function(e){return!Rr(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},kt=function(e){return null!=e&&Xt(e)===Sl&&!Yt(e)&&e.constructor===Object},tt=function(e){return null!=e&&Xt(e)===Xt(1)&&!isNaN(e)},Ka=function(e){if("undefined"!==nh)return null!=e&&e instanceof HTMLElement},Rr=function(e){return ha(e)||Il(e)},ha=function(e){return"collection"===fa(e)&&e._private.single},Il=function(e){return"collection"===fa(e)&&!e._private.single},ts=function(e){return"core"===fa(e)},Ll=function(e){return"stylesheet"===fa(e)},nn=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},uh=function(e){return function(e){return null!=e&&Xt(e)===Sl}(e)&&Jt(e.then)},Fn=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},rs=Fn(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Za=Fn(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Al=Fn(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),Rl=function(e){return nn(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},an=function(e,t){return e.slice(-1*t.length)===t},ir="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",dh="rgb[a]?\\(("+ir+"[%]?)\\s*,\\s*("+ir+"[%]?)\\s*,\\s*("+ir+"[%]?)(?:\\s*,\\s*("+ir+"))?\\)",fh="rgb[a]?\\((?:"+ir+"[%]?)\\s*,\\s*(?:"+ir+"[%]?)\\s*,\\s*(?:"+ir+"[%]?)(?:\\s*,\\s*(?:"+ir+"))?\\)",hh="hsl[a]?\\(("+ir+")\\s*,\\s*("+ir+"[%])\\s*,\\s*("+ir+"[%])(?:\\s*,\\s*("+ir+"))?\\)",vh="hsl[a]?\\((?:"+ir+")\\s*,\\s*(?:"+ir+"[%])\\s*,\\s*(?:"+ir+"[%])(?:\\s*,\\s*(?:"+ir+"))?\\)",Nl=function(e,t){return e<t?-1:e>t?1:0},bt=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},Ml=function(e){return(Yt(e)?e:null)||function(e){return Eh[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("^"+dh+"$").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,w,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?v+6*(w-v)*p:p<.5?w:p<2/3?v+(w-v)*(2/3-p)*6:v}var d=new RegExp("^"+hh+"$").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)},Eh={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]},Ol=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var s=n[i];if(kt(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}},Pl=function(e){for(var t=e.map,n=e.keys,a=n.length,i=0;i<a;i++){var s=n[i];if(kt(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 va(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ga(){return kl?ns:(kl=1,ns=function r(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)})}function Qa(){if(Bl)return is;Bl=1;var r=function Th(){return _l?as:(_l=1,as="object"==typeof Ja&&Ja&&Ja.Object===Object&&Ja)}(),e="object"==typeof self&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return is=t}function cs(){if(Vl)return us;Vl=1;var r=Qa();return us=r.Symbol}function jl(){if(Xl)return hs;Xl=1;var r=cs(),e=function Ih(){if(Hl)return ds;Hl=1;var r=cs(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,a=r?r.toStringTag:void 0;return ds=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 Lh(){if(Ul)return fs;Ul=1;var e=Object.prototype.toString;return fs=function t(n){return e.call(n)}}(),i=r?r.toStringTag:void 0;return hs=function s(o){return null==o?void 0===o?"[object Undefined]":"[object Null]":i&&i in Object(o)?e(o):t(o)}}function pa(){if(ql)return gs;ql=1;var r=jl(),e=function Ah(){return Yl?vs:(Yl=1,vs=function r(e){return null!=e&&"object"==typeof e})}();return gs=function n(a){return"symbol"==typeof a||e(a)&&"[object Symbol]"==r(a)}}var Mh=function Nh(){if($l)return ys;$l=1;var r=ga(),e=function Ch(){if(Fl)return ss;Fl=1;var r=Qa();return ss=function(){return r.Date.now()}}(),t=function Rh(){if(Wl)return ps;Wl=1;var r=function Sh(){if(zl)return ls;zl=1;var r=function Dh(){if(Gl)return os;Gl=1;var r=/\s/;return os=function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}}(),e=/^\s+/;return ls=function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}}(),e=ga(),t=pa(),a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;return ps=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 ys=function s(o,l,u){var c,d,f,h,v,w,p=0,g=!1,E=!1,C=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function M(Q){var oe=c,ce=d;return c=d=void 0,p=Q,h=o.apply(ce,oe)}function G(Q){var oe=Q-w;return void 0===w||oe>=l||oe<0||E&&Q-p>=f}function X(){var Q=e();if(G(Q))return W(Q);v=setTimeout(X,function H(Q){var de=l-(Q-w);return E?i(de,f-(Q-p)):de}(Q))}function W(Q){return v=void 0,C&&c?M(Q):(c=d=void 0,h)}function J(){var Q=e(),oe=G(Q);if(c=arguments,d=this,w=Q,oe){if(void 0===v)return function V(Q){return p=Q,v=setTimeout(X,l),g?M(Q):h}(w);if(E)return clearTimeout(v),v=setTimeout(X,l),M(w)}return void 0===v&&(v=setTimeout(X,l)),h}return l=t(l)||0,r(u)&&(g=!!u.leading,f=(E="maxWait"in u)?a(t(u.maxWait)||0,l):f,C="trailing"in u?!!u.trailing:C),J.cancel=function $(){void 0!==v&&clearTimeout(v),p=0,c=w=d=v=void 0},J.flush=function Z(){return void 0===v?h:W(e())},J},ys}(),ya=va(Mh),ms=Zt?Zt.performance:null,Kl=ms&&ms.now?function(){return ms.now()}:function(){return Date.now()},Oh=function(){if(Zt){if(Zt.requestAnimationFrame)return function(r){Zt.requestAnimationFrame(r)};if(Zt.mozRequestAnimationFrame)return function(r){Zt.mozRequestAnimationFrame(r)};if(Zt.webkitRequestAnimationFrame)return function(r){Zt.webkitRequestAnimationFrame(r)};if(Zt.msRequestAnimationFrame)return function(r){Zt.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(Kl())},1e3/60)}}(),ei=function(e){return Oh(e)},qr=Kl,Tn=9261,Gn=5381,Jl=function(e){for(var a,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tn;!(a=e.next()).done;)n=65599*n+a.value|0;return n},ma=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tn)+e|0},ba=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gn;return(t<<5)+t+e|0},sn=function(e){return 2097152*e[0]+e[1]},ti=function(e,t){return[ma(e[0],t[0]),ba(e[1],t[1])]},Ql=function(e,t){var n={value:0,done:!1},a=0,i=e.length;return Jl({next:function(){return a<i?n.value=e[a++]:n.done=!0,n}},t)},Cn=function(e,t){var n={value:0,done:!1},a=0,i=e.length;return Jl({next:function(){return a<i?n.value=e.charCodeAt(a++):n.done=!0,n}},t)},eu=function(){return kh(arguments)},kh=function(e){for(var t,n=0;n<e.length;n++){var a=e[n];t=0===n?Cn(a):Cn(a,t)}return t};var tu=!0,Gh=null!=console.warn,zh=null!=console.trace,bs=Number.MAX_SAFE_INTEGER||9007199254740991,ru=function(){return!0},ri=function(){return!1},nu=function(){return 0},xs=function(){},Kt=function(e){throw new Error(e)},au=function(e){if(void 0===e)return tu;tu=!!e},Gt=function(e){au()&&(Gh?console.warn(e):(console.log(e),zh&&console.trace()))},zr=function(e){return null==e?e:Yt(e)?e.slice():kt(e)?function(e){return bt({},e)}(e):e},iu=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},Uh={},su=function(){return Uh},hr=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}},on=function(e,t,n){for(var a=e.length-1;a>=0;a--)e[a]===t&&e.splice(a,1)},ws=function(e){e.splice(0,e.length)},Sr=function(e,t,n){return n&&(t=Al(n,t)),e[t]},Wr=function(e,t,n,a){n&&(t=Al(n,t)),e[t]=a},$r=typeof Map<"u"?Map:function(){return ve(function r(){ze(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]}}])}(),qh=function(){return ve(function r(e){if(ze(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)}}])}(),zn="undefined"!==(typeof Set>"u"?"undefined":Xt(Set))?Set:qh,ni=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&ts(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 zn,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=[];Yt(t.classes)?u=t.classes:vt(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&&(Gt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))}else Kt("An element must be of type `nodes` or `edges`; you specified `"+a+"`")}else Kt("An element must have a core reference and parameters set")},ou=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(n,a,i){var s;kt(n)&&!Rr(n)&&(n=(s=n).roots||s.root,a=s.visit,i=s.directed),i=2!==arguments.length||Jt(a)?i:a,a=Jt(a)?a:function(){};for(var w,o=this._private.cy,l=n=vt(n)?this.filter(n):n,u=[],c=[],d={},f={},h={},v=0,p=this.byGroup(),g=p.nodes,E=p.edges,C=0;C<l.length;C++){var M=l[C],V=M.id();M.isNode()&&(u.unshift(M),e.bfs&&(h[V]=!0,c.push(M)),f[V]=0)}for(var G,H=function(){var Q=e.bfs?u.shift():u.pop(),oe=Q.id();if(e.dfs){if(h[oe])return 0;h[oe]=!0,c.push(Q)}var Ie,ce=f[oe],de=d[oe],le=null!=de?de.source():null,ge=null!=de?de.target():null,Te=null==de?void 0:Q.same(le)?ge[0]:le[0];if(!0===(Ie=a(Q,de,Te,v++,ce)))return w=Q,1;if(!1===Ie)return 1;for(var ye=Q.connectedEdges().filter(function(qe){return(!i||qe.source().same(Q))&&E.has(qe)}),we=0;we<ye.length;we++){var Be=ye[we],Ue=Be.connectedNodes().filter(function(qe){return!qe.same(Q)&&g.has(qe)}),Fe=Ue.id();0!==Ue.length&&!h[Fe]&&(u.push(Ue=Ue[0]),e.bfs&&(h[Fe]=!0,c.push(Ue)),d[Fe]=Be,f[Fe]=f[oe]+1)}};0!==u.length&&(0===(G=H())||1!==G););for(var X=o.collection(),W=0;W<c.length;W++){var $=c[W],Z=d[$.id()];null!=Z&&X.push(Z),X.push($)}return{path:o.collection(X),found:o.collection(w)}}},xa={breadthFirstSearch:ou({bfs:!0}),depthFirstSearch:ou({dfs:!0})};xa.bfs=xa.breadthFirstSearch,xa.dfs=xa.depthFirstSearch;var lu,Es,uu,ai={exports:{}},Wh=ai.exports;var Cs,wa=va(function Kh(){return uu||(uu=1,Es=function $h(){return lu||(lu=1,r=ai,function(){var t,n,a,i,s,o,l,u,c,d,f,h,v,w,p;a=Math.floor,d=Math.min,n=function(g,E){return g<E?-1:g>E?1:0},c=function(g,E,C,M,V){var H;if(null==C&&(C=0),null==V&&(V=n),C<0)throw new Error("lo must be non-negative");for(null==M&&(M=g.length);C<M;)V(E,g[H=a((C+M)/2)])<0?M=H:C=H+1;return[].splice.apply(g,[C,C-C].concat(E)),E},o=function(g,E,C){return null==C&&(C=n),g.push(E),w(g,0,g.length-1,C)},s=function(g,E){var C,M;return null==E&&(E=n),C=g.pop(),g.length?(M=g[0],g[0]=C,p(g,0,E)):M=C,M},u=function(g,E,C){var M;return null==C&&(C=n),M=g[0],g[0]=E,p(g,0,C),M},l=function(g,E,C){var M;return null==C&&(C=n),g.length&&C(g[0],E)<0&&(E=(M=[g[0],E])[0],g[0]=M[1],p(g,0,C)),E},i=function(g,E){var M,V,H,G,X;for(null==E&&(E=n),G=[],M=0,V=(H=function(){X=[];for(var W=0,$=a(g.length/2);0<=$?W<$:W>$;0<=$?W++:W--)X.push(W);return X}.apply(this).reverse()).length;M<V;M++)G.push(p(g,H[M],E));return G},v=function(g,E,C){var M;if(null==C&&(C=n),-1!==(M=g.indexOf(E)))return w(g,0,M,C),p(g,M,C)},f=function(g,E,C){var V,H,G,X;if(null==C&&(C=n),!(V=g.slice(0,E)).length)return V;for(i(V,C),H=0,G=(X=g.slice(E)).length;H<G;H++)l(V,X[H],C);return V.sort(C).reverse()},h=function(g,E,C){var M,V,H,G,X,W,$,Z,J;if(null==C&&(C=n),10*E<=g.length){if(!(H=g.slice(0,E).sort(C)).length)return H;for(V=H[H.length-1],G=0,W=($=g.slice(E)).length;G<W;G++)C(M=$[G],V)<0&&(c(H,M,0,null,C),H.pop(),V=H[H.length-1]);return H}for(i(g,C),J=[],X=0,Z=d(E,g.length);0<=Z?X<Z:X>Z;0<=Z?++X:--X)J.push(s(g,C));return J},w=function(g,E,C,M){var V,H,G;for(null==M&&(M=n),V=g[C];C>E&&M(V,H=g[G=C-1>>1])<0;)g[C]=H,C=G;return g[C]=V},p=function(g,E,C){var M,V,H,G,X;for(null==C&&(C=n),V=g.length,X=E,H=g[E],M=2*E+1;M<V;)(G=M+1)<V&&!(C(g[M],g[G])<0)&&(M=G),g[E]=g[M],M=2*(E=M)+1;return g[E]=H,w(g,X,E,C)},t=function(){function g(E){this.cmp=E??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(E){return o(this.nodes,E,this.cmp)},g.prototype.pop=function(){return s(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(E){return-1!==this.nodes.indexOf(E)},g.prototype.replace=function(E){return u(this.nodes,E,this.cmp)},g.prototype.pushpop=function(E){return l(this.nodes,E,this.cmp)},g.prototype.heapify=function(){return i(this.nodes,this.cmp)},g.prototype.updateItem=function(E){return v(this.nodes,E,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 E;return(E=new g).nodes=this.nodes.slice(0),E},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(Wh)),ai.exports;var r}()),Es}()),Jh=hr({root:null,weight:function(e){return 1},directed:!1}),Qh={dijkstra:function(e){if(!kt(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Jh(e),a=n.root,s=n.directed,o=this,l=n.weight,u=vt(a)?this.filter(a)[0]:a[0],c={},d={},f={},h=this.byGroup(),v=h.nodes,w=h.edges;w.unmergeBy(function(ce){return ce.isLoop()});for(var p=function(de){return c[de.id()]},g=function(de,le){c[de.id()]=le,E.updateItem(de)},E=new wa(function(ce,de){return p(ce)-p(de)}),C=0;C<v.length;C++){var M=v[C];c[M.id()]=M.same(u)?0:1/0,E.push(M)}for(var V=function(de,le){for(var Ie,ge=(s?de.edgesTo(le):de.edgesWith(le)).intersect(w),Te=1/0,ye=0;ye<ge.length;ye++){var we=ge[ye],Be=l(we);(Be<Te||!Ie)&&(Te=Be,Ie=we)}return{edge:Ie,dist:Te}};E.size()>0;){var H=E.pop(),G=p(H),X=H.id();if(f[X]=G,G!==1/0)for(var W=H.neighborhood().intersect(v),$=0;$<W.length;$++){var Z=W[$],J=Z.id(),Q=V(H,Z),oe=G+Q.dist;oe<p(Z)&&(g(Z,oe),d[J]={node:H,edge:Q.edge})}}return{distanceTo:function(de){var le=vt(de)?v.filter(de)[0]:de[0];return f[le.id()]},pathTo:function(de){var le=vt(de)?v.filter(de)[0]:de[0],ge=[],Te=le,Ie=Te.id();if(le.length>0)for(ge.unshift(le);d[Ie];){var ye=d[Ie];ge.unshift(ye.edge),ge.unshift(ye.node),Ie=(Te=ye.node).id()}return o.spawn(ge)}}}},ev={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(M){for(var V=0;V<s.length;V++)if(s[V].has(M))return V},u=0;u<i;u++)s[u]=this.spawn(n[u]);for(var c=a.sort(function(C,M){return e(C)-e(M)}),d=0;d<c.length;d++){var f=c[d],h=f.source()[0],v=f.target()[0],w=l(h),p=l(v),g=s[w],E=s[p];w!==p&&(o.merge(f),g.merge(E),s.splice(p,1))}return o}},tv=hr({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),rv={aStar:function(e){var t=this.cy(),n=tv(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,M,u=a.id(),c=i.id(),d={},f={},h={},v=new wa(function(Ie,ye){return f[Ie.id()]-f[ye.id()]}),w=new zn,p={},g={},E=function(ye,we){v.push(ye),w.add(we)},V=function(){C=v.pop(),M=C.id(),w.delete(M)},H=function(ye){return w.has(ye)};E(a,u),d[u]=0,f[u]=s(a);for(var G=0;v.size()>0;){if(V(),G++,M===c){for(var X=[],W=i,$=c,Z=g[$];X.unshift(W),null!=Z&&X.unshift(Z),null!=(W=p[$]);)Z=g[$=W.id()];return{found:!0,distance:d[M],path:this.spawn(X),steps:G}}h[M]=!0;for(var J=C._private.edges,Q=0;Q<J.length;Q++){var oe=J[Q];if(this.hasElementWithId(oe.id())&&(!o||oe.data("source")===M)){var ce=oe.source(),de=oe.target(),le=ce.id()!==M?ce:de,ge=le.id();if(this.hasElementWithId(ge)&&!h[ge]){var Te=d[M]+l(oe);if(!H(ge)){d[ge]=Te,f[ge]=Te+s(le),E(le,ge),p[ge]=C,g[ge]=oe;continue}Te<d[ge]&&(d[ge]=Te,f[ge]=Te+s(le),p[ge]=C,g[ge]=oe)}}}}return{found:!1,distance:void 0,path:void 0,steps:G}}},nv=hr({weight:function(e){return 1},directed:!1}),av={floydWarshall:function(e){for(var t=this.cy(),n=nv(e),i=n.directed,s=n.weight,o=this.byGroup(),l=o.nodes,u=o.edges,c=l.length,d=c*c,f=function(Be){return l.indexOf(Be)},h=function(Be){return l[Be]},v=new Array(d),w=0;w<d;w++){var p=w%c;v[w]=(w-p)/c===p?0:1/0}for(var E=new Array(d),C=new Array(d),M=0;M<u.length;M++){var V=u[M],H=V.source()[0],G=V.target()[0];if(H!==G){var X=f(H),W=f(G),$=X*c+W,Z=s(V);if(v[$]>Z&&(v[$]=Z,E[$]=W,C[$]=V),!i){var J=W*c+X;!i&&v[J]>Z&&(v[J]=Z,E[J]=X,C[J]=V)}}}for(var Q=0;Q<c;Q++)for(var oe=0;oe<c;oe++)for(var ce=oe*c+Q,de=0;de<c;de++){var le=oe*c+de,ge=Q*c+de;v[ce]+v[ge]<v[le]&&(v[le]=v[ce]+v[ge],E[le]=E[ce])}var Ie=function(Be){return f(function(Be){return(vt(Be)?t.filter(Be):Be)[0]}(Be))};return{distance:function(Be,Ue){var Fe=Ie(Be),qe=Ie(Ue);return v[Fe*c+qe]},path:function(Be,Ue){var Fe=Ie(Be),qe=Ie(Ue),Je=h(Fe);if(Fe===qe)return Je.collection();if(null==E[Fe*c+qe])return t.collection();var at=t.collection();for(at.merge(Je);Fe!==qe;)at.merge(C[Fe*c+(Fe=E[Fe*c+qe])]),at.merge(h(Fe));return at}}}},iv=hr({weight:function(e){return 1},directed:!1,root:null}),sv={bellmanFord:function(e){var t=this,n=iv(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 $r,w=!1,p=[];s=u.collection(s)[0],d.unmergeBy(function(St){return St.isLoop()});for(var g=d.length,E=function(wt){var mt=v.get(wt.id());return mt||(mt={},v.set(wt.id(),mt)),mt},C=function(wt){return(vt(wt)?u.$(wt):wt)[0]},H=0;H<h;H++){var G=f[H],X=E(G);X.dist=G.same(s)?0:1/0,X.pred=null,X.edge=null}for(var W=!1,$=function(wt,mt,it,ht,gt,Ct){var yt=ht.dist+Ct;yt<gt.dist&&!it.same(ht.edge)&&(gt.dist=yt,gt.pred=wt,gt.edge=it,W=!0)},Z=1;Z<h;Z++){W=!1;for(var J=0;J<g;J++){var Q=d[J],oe=Q.source(),ce=Q.target(),de=o(Q),le=E(oe),ge=E(ce);$(oe,0,Q,le,ge,de),i||$(ce,0,Q,ge,le,de)}if(!W)break}if(W)for(var Te=[],Ie=0;Ie<g;Ie++){var ye=d[Ie],we=ye.source(),Be=ye.target(),Ue=o(ye),Fe=E(we).dist,qe=E(Be).dist;if(Fe+Ue<qe||!i&&qe+Ue<Fe){if(w||(Gt("Graph contains a negative weight cycle for Bellman-Ford"),w=!0),!1===e.findNegativeWeightCycles)break;var Je=[];Fe+Ue<qe&&Je.push(we),!i&&qe+Ue<Fe&&Je.push(Be);for(var at=Je.length,Ye=0;Ye<at;Ye++){var xe=Je[Ye],Ce=[xe];Ce.push(E(xe).edge);for(var Ae=E(xe).pred;-1===Ce.indexOf(Ae);)Ce.push(Ae),Ce.push(E(Ae).edge),Ae=E(Ae).pred;for(var Ve=(Ce=Ce.slice(Ce.indexOf(Ae)))[0].id(),rt=0,ft=2;ft<Ce.length;ft+=2)Ce[ft].id()<Ve&&(Ve=Ce[ft].id(),rt=ft);(Ce=Ce.slice(rt).concat(Ce.slice(0,rt))).push(Ce[0]);var Ot=Ce.map(function(St){return St.id()}).join(",");-1===Te.indexOf(Ot)&&(p.push(l.spawn(Ce)),Te.push(Ot))}}}return{distanceTo:function(wt){return E(C(wt)).dist},pathTo:function(wt){for(var mt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,ht=[],gt=C(wt);;){if(null==gt)return t.spawn();var Ct=E(gt),yt=Ct.edge,At=Ct.pred;if(ht.unshift(gt[0]),gt.same(mt)&&ht.length>0)break;null!=yt&&ht.unshift(yt),gt=At}return l.spawn(ht)},hasNegativeWeightCycle:w,negativeWeightCycles:p}}},ov=Math.sqrt(2),lv=function(e,t,n){0===n.length&&Kt("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 w=u[v];w[1]===l?(u[v]=w.slice(),u[v][1]=o):w[2]===l&&(u[v]=w.slice(),u[v][2]=o)}for(var p=0;p<t.length;p++)t[p]===l&&(t[p]=o);return u},Ts=function(e,t,n,a){for(;n>a;){var i=Math.floor(Math.random()*t.length);t=lv(i,e,t),n--}return t},uv={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,a=t.edges;a.unmergeBy(function(ge){return ge.isLoop()});var i=n.length,s=a.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/ov);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),w=new Array(i),p=new Array(i),g=function(Te,Ie){for(var ye=0;ye<i;ye++)Ie[ye]=Te[ye]},E=0;E<=o;E++){for(var C=0;C<i;C++)w[C]=C;var M=Ts(w,u.slice(),i,l),V=M.slice();g(w,p);var H=Ts(w,M,l,2),G=Ts(p,V,l,2);H.length<=G.length&&H.length<f?(f=H.length,h=H,g(w,v)):G.length<=H.length&&G.length<f&&(f=G.length,h=G,g(p,v))}for(var X=this.spawn(h.map(function(ge){return a[ge[0]]})),W=this.spawn(),$=this.spawn(),Z=v[0],J=0;J<v.length;J++){var oe=n[J];v[J]===Z?W.merge(oe):$.merge(oe)}var ce=function(Te){var Ie=e.spawn();return Te.forEach(function(ye){Ie.merge(ye),ye.connectedEdges().forEach(function(we){e.contains(we)&&!X.contains(we)&&Ie.merge(we)})}),Ie},de=[ce(W),ce($)];return{cut:X,components:de,partition1:W,partition2:$}}Kt("At least 2 nodes are required for Karger-Stein algorithm")}},ii=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},cu=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Vn=function(e){return{x:e[0],y:e[1]}},si=function(e,t){return Math.atan2(t,e)-Math.PI/2},Ds=Math.log2||function(r){return Math.log(r)/Math.log(2)},Ss=function(e){return e>0?1:e<0?-1:0},Dn=function(e,t){return Math.sqrt(Sn(e,t))},Sn=function(e,t){var n=t.x-e.x,a=t.y-e.y;return n*n+a*a},pv=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},ur=function(e,t,n,a){return(1-a)*(1-a)*e+2*(1-a)*a*t+a*a*n},Hn=function(e,t,n,a){return{x:ur(e.x,t.x,n.x,a),y:ur(e.y,t.y,n.y,a)}},Ea=function(e,t,n){return Math.max(e,Math.min(n,t))},Er=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}}},xv=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},du=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},oi=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},li=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=Qe(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},fu=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},Is=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)},ln=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},hu=function(e,t){return ln(e,t.x,t.y)},vu=function(e,t){return ln(e,t.x1,t.y1)&&ln(e,t.x2,t.y2)},wv=null!==(Cs=Math.hypot)&&void 0!==Cs?Cs:function(r,e){return Math.sqrt(r*r+e*e)};var gu=function(e,t,n,a,i,s,o){var v,ce,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",u="auto"===l?cn(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=un(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=un(e,t,n,a,C,a-d+u-o,C,a+d-u+o,!1)).length>0)return v}if(f){var X=a+d+o;if((v=un(e,t,n,a,n-c+u-o,X,n+c-u+o,X,!1)).length>0)return v}if(h){var Z=n-c-o;if((v=un(e,t,n,a,Z,a-d+u-o,Z,a+d-u+o,!1)).length>0)return v}var de=n-c+u,le=a-d+u;if((ce=Ta(e,t,n,a,de,le,u+o)).length>0&&ce[0]<=de&&ce[1]<=le)return[ce[0],ce[1]];var ge=n+c-u,Te=a-d+u;if((ce=Ta(e,t,n,a,ge,Te,u+o)).length>0&&ce[0]>=ge&&ce[1]<=Te)return[ce[0],ce[1]];var Ie=n+c-u,ye=a+d-u;if((ce=Ta(e,t,n,a,Ie,ye,u+o)).length>0&&ce[0]>=Ie&&ce[1]>=ye)return[ce[0],ce[1]];var we=n-c+u,Be=a+d-u;return(ce=Ta(e,t,n,a,we,Be,u+o)).length>0&&ce[0]<=we&&ce[1]>=Be?[ce[0],ce[1]]:[]},Cv=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},Dv=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)},Lv=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 w=[],p=0;p<6;p+=2)Math.abs(h[p+1])<1e-7&&h[p]>=0&&h[p]<=1&&w.push(h[p]);w.push(1),w.push(0);for(var E,C,M,g=-1,V=0;V<w.length;V++)E=Math.pow(1-w[V],2)*n+2*(1-w[V])*w[V]*i+w[V]*w[V]*o,C=Math.pow(1-w[V],2)*a+2*(1-w[V])*w[V]*s+w[V]*w[V]*l,M=Math.pow(E-e,2)+Math.pow(C-t,2),g>=0?M<g&&(g=M):g=M;return g},Av=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},Ir=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},Kr=function(e,t,n,a,i,s,o,l,u){var d,w,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=ci(c,-u);w=ui(p)}else w=c;return Ir(e,t,w)},ui=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=un(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},ci=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},In=function(e,t,n,a,i,s,o){return e-=i,t-=s,(e/=n/2+o)*e+(t/=a/2+o)*t<=1},Ta=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),w=(-d-Math.sqrt(h))/(2*c),p=Math.min(v,w),g=Math.max(v,w),E=[];if(p>=0&&p<=1&&E.push(p),g>=0&&g<=1&&E.push(g),0===E.length)return[];var C=E[0]*l[0]+e,M=E[0]*l[1]+t;return E.length>1?E[0]==E[1]?[C,M]:[C,M,E[1]*l[0]+e,E[1]*l[1]+t]:[C,M]},Ls=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},un=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,w=l-s,p=f*h-w*c,g=d*h-v*c,E=w*d-f*v;if(0!==E){var C=p/E,M=g/E,H=-.001;return H<=C&&C<=1.001&&H<=M&&M<=1.001||u?[e+C*d,t+C*v]:[]}return 0===p||0===g?Ls(e,n,o)===o?[o,l]:Ls(e,n,i)===i?[i,s]:Ls(i,o,n)===n?[n,a]:[]:[]},Mv=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},Ca=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 w=ci(d,-l);h=ui(w)}else h=d}else h=n;for(var E,C,M=0;M<h.length/2;M++)M<h.length/2-1?(E=h[2*(M+1)],C=h[2*(M+1)+1]):(E=h[0],C=h[1]),0!==(c=un(e,t,a,i,h[2*M],h[2*M+1],E,C)).length&&u.push(c[0],c[1]);return u},di=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]]},Tr=function(e,t){var n=As(e,t);return pu(n)},pu=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},As=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},cn=function(e,t){return Math.min(e/4,t/4,8)},yu=function(e,t){return Math.min(e/10,t/10,8)},Ns=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Ms(r,e){function t(d){for(var f=[],h=0;h<d.length;h++){var v=d[h],w=d[(h+1)%d.length],p={x:w.x-v.x,y:w.y-v.y},g={x:-p.y,y:p.x},E=Math.sqrt(g.x*g.x+g.y*g.y);f.push({x:g.x/E,y:g.y/E})}return f}function n(d,f){var p,h=1/0,v=-1/0,w=_e(d);try{for(w.s();!(p=w.n()).done;){var g=p.value,E=g.x*f.x+g.y*f.y;h=Math.min(h,E),v=Math.max(v,E)}}catch(C){w.e(C)}finally{w.f()}return{min:h,max:v}}function a(d,f){return!(d.max<f.min||f.max<d.min)}var o,s=_e([].concat(Et(t(r)),Et(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 kv=hr({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),_v={pageRank:function(e){for(var t=kv(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),w=new Array(d),p=(1-n)/d,g=0;g<d;g++){for(var E=0;E<d;E++)v[g*d+E]=0;w[g]=0}for(var M=0;M<h;M++){var V=c[M],H=V.data("source"),G=V.data("target");if(H!==G){var X=u.indexOfId(H),W=u.indexOfId(G),$=s(V);v[W*d+X]+=$,w[X]+=$}}for(var J=1/d+p,Q=0;Q<d;Q++)if(0===w[Q])for(var oe=0;oe<d;oe++)v[oe*d+Q]=J;else for(var de=0;de<d;de++){var le=de*d+Q;v[le]=v[le]/w[Q]+p}for(var Ie,ge=new Array(d),Te=new Array(d),ye=0;ye<d;ye++)ge[ye]=1;for(var we=0;we<i;we++){for(var Be=0;Be<d;Be++)Te[Be]=0;for(var Ue=0;Ue<d;Ue++)for(var Fe=0;Fe<d;Fe++)Te[Ue]+=v[Ue*d+Fe]*ge[Fe];pv(Te),Ie=ge,ge=Te,Te=Ie;for(var Je=0,at=0;at<d;at++){var Ye=Ie[at]-ge[at];Je+=Ye*Ye}if(Je<a)break}return{rank:function(Ae){return Ae=o.collection(Ae)[0],ge[u.indexOf(Ae)]}}}},mu=hr({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Un={degreeCentralityNormalized:function(e){e=mu(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 w=n[v],p=w.id();e.root=w;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:(vt(C)&&(C=t.filter(C)),c[C.id()]/f)},outdegree:function(C){return 0===h?0:(vt(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:(vt(C)&&(C=t.filter(C)),i[C.id()]/s)}}},degreeCentrality:function(e){e=mu(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)}),w=h.filter(function(H){return H.source().same(i)&&n.has(H)}),p=v.length,g=w.length,E=0,C=0,M=0;M<v.length;M++)E+=s(v[M]);for(var V=0;V<w.length;V++)C+=s(w[V]);return{indegree:Math.pow(p,1-l)*Math.pow(E,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)}}};Un.dc=Un.degreeCentrality,Un.dcn=Un.degreeCentralityNormalised=Un.degreeCentralityNormalized;var bu=hr({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Xn={closenessCentralityNormalized:function(e){for(var t=bu(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 w=c.distance(h,u[v]);f+=n?1/w:w}n||(f=1/f),l<f&&(l=f),o[h.id()]=f}return{closeness:function(g){return 0==l?0:(g=vt(g)?s.filter(g)[0].id():g.id(),o[g]/l)}}},closenessCentrality:function(e){var t=bu(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}};Xn.cc=Xn.closenessCentrality,Xn.ccn=Xn.closenessCentralityNormalised=Xn.closenessCentralityNormalized;var Bv=hr({weight:null,directed:!1}),Os={betweennessCentrality:function(e){for(var t=Bv(e),n=t.directed,a=t.weight,i=null!=a,s=this.cy(),o=this.nodes(),l={},u={},c=0,d={set:function(C,M){u[C]=M,M>c&&(c=M)},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 w=function(){for(var C=o[p].id(),M=[],V={},H={},G={},X=new wa(function(Ue,Fe){return G[Ue]-G[Fe]}),W=0;W<o.length;W++){var $=o[W].id();V[$]=[],H[$]=0,G[$]=1/0}for(H[C]=1,G[C]=0,X.push(C);!X.empty();){var Z=X.pop();if(M.push(Z),i)for(var J=0;J<l[Z].length;J++){var ce,Q=l[Z][J],oe=s.getElementById(Z);ce=oe.edgesTo(Q).length>0?oe.edgesTo(Q)[0]:Q.edgesTo(oe)[0];var de=a(ce);Q=Q.id(),G[Q]>G[Z]+de&&(G[Q]=G[Z]+de,X.nodes.indexOf(Q)<0?X.push(Q):X.updateItem(Q),H[Q]=0,V[Q]=[]),G[Q]==G[Z]+de&&(H[Q]=H[Q]+H[Z],V[Q].push(Z))}else for(var le=0;le<l[Z].length;le++){var ge=l[Z][le].id();G[ge]==1/0&&(X.push(ge),G[ge]=G[Z]+1),G[ge]==G[Z]+1&&(H[ge]=H[ge]+H[Z],V[ge].push(Z))}}for(var Te={},Ie=0;Ie<o.length;Ie++)Te[o[Ie].id()]=0;for(;M.length>0;){for(var ye=M.pop(),we=0;we<V[ye].length;we++){var Be=V[ye][we];Te[Be]=Te[Be]+H[Be]/H[ye]*(1+Te[ye])}ye!=o[p].id()&&d.set(ye,d.get(ye)+Te[ye])}},p=0;p<o.length;p++)w();var g={betweenness:function(C){var M=s.collection(C).id();return d.get(M)},betweennessNormalized:function(C){if(0==c)return 0;var M=s.collection(C).id();return d.get(M)/c}};return g.betweennessNormalised=g.betweennessNormalized,g}};Os.bc=Os.betweennessCentrality;var Fv=hr({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),zv=function(e,t){for(var n=0,a=0;a<t.length;a++)n+=t[a](e);return n},xu=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}},Hv=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},Uv=function(e,t,n){for(var a=e.slice(0),i=1;i<n;i++)e=Hv(e,a,t);return e},Xv=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 xu(a,t),a},jv=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},qv=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},wu=function(e){for(var t=this.nodes(),n=this.edges(),a=this.cy(),i=function(e){return Fv(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],w=s[v.source().id()],p=s[v.target().id()],g=zv(v,i.attributes);c[w*l+p]+=g,c[p*l+w]+=g}(function(e,t,n){for(var a=0;a<t;a++)e[a*t+a]=n})(c,l,i.multFactor),xu(c,l);for(var E=!0,C=0;E&&C<i.maxIterations;)E=!1,d=Uv(c,l,i.expandFactor),c=Xv(d,l,i.inflateFactor),jv(c,d,u,4)||(E=!0),C++;var M=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 M=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&qv(e[t],e[n])&&e.splice(n,1);return e}(M),M},$v={markovClustering:wu,mcl:wu},Kv=function(e){return e},Eu=function(e,t){return Math.abs(t-e)},Tu=function(e,t,n){return e+Eu(t,n)},Cu=function(e,t,n){return e+Math.pow(n-t,2)},Zv=function(e){return Math.sqrt(e)},Jv=function(e,t,n){return Math.max(e,Eu(t,n))},Da=function(e,t,n,a,i){for(var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Kv,o=a,c=0;c<e;c++)o=i(o,t(c),n(c));return s(o)},jn={euclidean:function(e,t,n){return e>=2?Da(e,t,n,0,Cu,Zv):Da(e,t,n,0,Tu)},squaredEuclidean:function(e,t,n){return Da(e,t,n,0,Cu)},manhattan:function(e,t,n){return Da(e,t,n,0,Tu)},max:function(e,t,n){return Da(e,t,n,-1/0,Jv)}};function fi(r,e,t,n,a,i){var s;return s=Jt(r)?r:jn[r]||jn.euclidean,0===e&&Jt(r)?s(a,i):s(e,t,n,a,i)}jn["squared-euclidean"]=jn.squaredEuclidean,jn.squaredeuclidean=jn.squaredEuclidean;var Qv=hr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Ps=function(e){return Qv(e)},hi=function(e,t,n,a,i){var o="kMedoids"!==i?function(d){return n[d]}:function(d){return a[d](n)};return fi(e,a.length,o,function(f){return a[f](t)},n,t)},ks=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},Du=function(e,t,n,a,i){for(var s=1/0,o=0,l=0;l<t.length;l++){var u=hi(n,e,t[l],a,i);u<s&&(s=u,o=l)}return o},Su=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},eg=function(e,t,n){return Math.abs(t-e)<=n},tg=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},rg=function(e,t,n){for(var a=0;a<n;a++)if(e===t[a])return!0;return!1},Iu=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)];rg(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},Lu=function(e,t,n){for(var a=0,i=0;i<t.length;i++)a+=hi("manhattan",t[i],e,n,"kMedoids");return a},ig=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}},sg=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=hi(i.distance,a[f],n[d],i.attributes,"cmeans"),u=hi(i.distance,a[f],n[h],i.attributes,"cmeans"),o+=Math.pow(l/u,c);e[f][d]=1/o}},Au=function(e){var i,s,o,l,u,t=this.cy(),n=this.nodes(),a=Ps(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 w=0;w<a.k;w++)o[f][w]=o[f][w]/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 E=!0,C=0;E&&C<a.maxIterations;)E=!1,ig(s,n,o,u,a),sg(o,l,s,n,a),tg(o,l,a.sensitivityThreshold)||(E=!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}},lg={kMeans:function(e){var l,t=this.cy(),n=this.nodes(),a=null,i=Ps(e),s=new Array(i.k),o={};l=i.testMode?"number"==typeof i.testCentroids?ks(n,i.k,i.attributes):"object"===Xt(i.testCentroids)?i.testCentroids:ks(n,i.k,i.attributes):ks(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()]=Du(a,l,i.distance,i.attributes,"kMeans");u=!1;for(var f=0;f<i.k;f++){var h=Su(f,n,o);if(0!==h.length){for(var v=i.attributes.length,w=l[f],p=new Array(v),g=new Array(v),E=0;E<v;E++){g[E]=0;for(var C=0;C<h.length;C++)g[E]+=i.attributes[E](a=h[C]);p[E]=g[E]/h.length,eg(p[E],w[E],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=Ps(e),s=new Array(i.k),l={},c=new Array(i.k);i.testMode?"number"==typeof i.testCentroids||(o="object"===Xt(i.testCentroids)?i.testCentroids:Iu(n,i.k)):o=Iu(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()]=Du(a,o,i.distance,i.attributes,"kMedoids");d=!1;for(var v=0;v<o.length;v++){var w=Su(v,n,l);if(0!==w.length){c[v]=Lu(o[v],w,i.attributes);for(var p=0;p<w.length;p++)(u=Lu(w[p],w,i.attributes))<c[v]&&(c[v]=u,o[v]=w[p],d=!0);s[v]=t.collection(w)}}f++}return s},fuzzyCMeans:Au,fcm:Au},ug=hr({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),cg={single:"min",complete:"max"},Ru=function(e,t,n,a,i){for(var l,s=0,o=1/0,u=i.attributes,c=function(W,$){return fi(i.distance,u.length,function(Z){return u[Z](W)},function(Z){return u[Z]($)},W,$)},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],w=t[a[s]];p="dendrogram"===i.mode?{left:v,right:w,key:v.key}:{value:v.value.concat(w.value),key:v.key},e[v.index]=p,e.splice(w.index,1),t[v.key]=p;for(var g=0;g<e.length;g++){var E=e[g];v.key===E.key?l=1/0:"min"===i.linkage?(l=n[v.key][E.key],n[v.key][E.key]>n[w.key][E.key]&&(l=n[w.key][E.key])):"max"===i.linkage?(l=n[v.key][E.key],n[v.key][E.key]<n[w.key][E.key]&&(l=n[w.key][E.key])):l="mean"===i.linkage?(n[v.key][E.key]*v.size+n[w.key][E.key]*w.size)/(v.size+w.size):"dendrogram"===i.mode?c(E.value,v.value):c(E.value[0],v.value[0]),n[v.key][E.key]=n[E.key][v.key]=l}for(var C=0;C<e.length;C++){var M=e[C].key;if(a[M]===v.key||a[M]===w.key){for(var V=M,H=0;H<e.length;H++){var G=e[H].key;n[M][G]<n[M][V]&&(V=G)}a[M]=V}e[C].index=C}return v.key=w.key=v.index=w.index=null,!0},Yn=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&Yn(e.left,t),e.right&&Yn(e.right,t)))},_s=function(e,t){if(!e)return"";if(e.left&&e.right){var n=_s(e.left,t),a=_s(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},Bs=function(e,t,n){if(!e)return[];var a=[],i=[],s=[];return 0===t?(e.left&&Yn(e.left,a),e.right&&Yn(e.right,i),s=a.concat(i),[n.collection(s)]):1===t?e.value?[n.collection(e.value)]:(e.left&&Yn(e.left,a),e.right&&Yn(e.right,i),[n.collection(a),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(a=Bs(e.left,t-1,n)),e.right&&(i=Bs(e.right,t-1,n)),a.concat(i))},Nu=function(e){for(var t=this.cy(),n=this.nodes(),a=function(e){var t=ug(e),n=cg[t.linkage];return null!=n&&(t.linkage=n),t}(e),i=a.attributes,s=function(C,M){return fi(a.distance,i.length,function(V){return i[V](C)},function(V){return i[V](M)},C,M)},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 w;w="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]=w,l[v][h]=w,w<l[h][u[h]]&&(u[h]=v)}for(var p=Ru(o,c,l,u,a);p;)p=Ru(o,c,l,u,a);var g;return"dendrogram"===a.mode?(g=Bs(o[0],a.dendrogramDepth,t),a.addDendrogram&&_s(o[0],t)):(g=new Array(o.length),o.forEach(function(E,C){E.key=E.index=null,g[C]=t.collection(E.value)})),g},fg={hierarchicalClustering:Nu,hca:Nu},hg=hr({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),gg=function(e,t,n,a){var i=function(o,l){return a[l](o)};return-fi(e,a.length,function(s){return i(t,s)},function(s){return i(n,s)},t,n)},Mu=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},Ou=function(e){for(var t=this.cy(),n=this.nodes(),a=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Kt("Damping must range on [0.5, 1). Got: ".concat(t));var a=["median","mean","min","max"];return a.some(function(i){return i===n})||tt(n)||Kt("Preference must be one of [".concat(a.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(n)),hg(e)}(e),i={},s=0;s<n.length;s++)i[n[s].id()]=s;var o,l,u,c,d,f,W;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 w=0;w<o;w++)v!==w&&(u[v*o+w]=gg(a.distance,n[v],n[w],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 E=0;E<l;E++)f[E]=0;for(var C=new Array(o),M=new Array(o),V=new Array(o),H=0;H<o;H++)C[H]=0,M[H]=0,V[H]=0;for(var G=new Array(o*a.minIterations),X=0;X<G.length;X++)G[X]=0;for(W=0;W<a.maxIterations;W++){for(var $=0;$<o;$++){for(var Z=-1/0,J=-1/0,Q=-1,oe=0,ce=0;ce<o;ce++)C[ce]=d[$*o+ce],(oe=f[$*o+ce]+u[$*o+ce])>=Z?(J=Z,Z=oe,Q=ce):oe>J&&(J=oe);for(var de=0;de<o;de++)d[$*o+de]=(1-a.damping)*(u[$*o+de]-Z)+a.damping*C[de];d[$*o+Q]=(1-a.damping)*(u[$*o+Q]-J)+a.damping*C[Q]}for(var le=0;le<o;le++){for(var ge=0,Te=0;Te<o;Te++)C[Te]=f[Te*o+le],M[Te]=Math.max(0,d[Te*o+le]),ge+=M[Te];ge-=M[le],M[le]=d[le*o+le],ge+=M[le];for(var Ie=0;Ie<o;Ie++)f[Ie*o+le]=(1-a.damping)*Math.min(0,ge-M[Ie])+a.damping*C[Ie];f[le*o+le]=(1-a.damping)*(ge-M[le])+a.damping*C[le]}for(var ye=0,we=0;we<o;we++){var Be=f[we*o+we]+d[we*o+we]>0?1:0;G[W%a.minIterations*o+we]=Be,ye+=Be}if(ye>0&&(W>=a.minIterations-1||W==a.maxIterations-1)){for(var Ue=0,Fe=0;Fe<o;Fe++){V[Fe]=0;for(var qe=0;qe<a.minIterations;qe++)V[Fe]+=G[qe*o+Fe];(0===V[Fe]||V[Fe]===a.minIterations)&&Ue++}if(Ue===o)break}}for(var Je=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=Mu(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 Mu(e,t,n)}(o,u,Je),Ye={},xe=0;xe<Je.length;xe++)Ye[Je[xe]]=[];for(var Ce=0;Ce<n.length;Ce++){var Ve=at[i[n[Ce].id()]];null!=Ve&&Ye[Ve].push(n[Ce])}for(var rt=new Array(Je.length),ft=0;ft<Je.length;ft++)rt[ft]=t.collection(Ye[Je[ft]]);return rt},bg={affinityPropagation:Ou,ap:Ou},xg=hr({root:void 0,directed:!1}),wg={hierholzer:function(e){if(!kt(e)){var t=arguments;e={root:t[0],directed:t[1]}}var l,u,c,n=xg(e),a=n.root,i=n.directed,s=this,o=!1;a&&(c=vt(a)?this.filter(a)[0].id():a[0].id());var d={},f={};s.forEach(i?function(E){var C=E.id();if(E.isNode()){var M=E.indegree(!0),V=E.outdegree(!0),H=M-V,G=V-M;1==H?l?o=!0:l=C:1==G?u?o=!0:u=C:(G>1||H>1)&&(o=!0),d[C]=[],E.outgoers().forEach(function(X){X.isEdge()&&d[C].push(X.id())})}else f[C]=[void 0,E.target().id()]}:function(E){var C=E.id();E.isNode()?(E.degree(!0)%2&&(l?u?o=!0:u=C:l=C),d[C]=[],E.connectedEdges().forEach(function(V){return d[C].push(V.id())})):f[C]=[E.source().id(),E.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,G,X,M=C,V=[C];d[M].length;)H=d[M].shift(),G=f[H][0],M!=(X=f[H][1])?(d[X]=d[X].filter(function(W){return W!=H}),M=X):!i&&M!=G&&(d[G]=d[G].filter(function(W){return W!=H}),M=G),V.unshift(H),V.unshift(M);return V},w=[],p=[];for(p=v(c);1!=p.length;)0==d[p[0]].length?(w.unshift(s.getElementById(p.shift())),w.unshift(s.getElementById(p.shift()))):p=v(p.shift()).concat(p);for(var g in w.unshift(s.getElementById(p.shift())),d)if(d[g].length)return h;return h.found=!0,h.trail=this.spawn(w,!0),h}},vi=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,E,C,w=e.getElementById(h).connectedEdges().intersection(e);0===w.size()?i.push(e.spawn(e.getElementById(h))):w.forEach(function(M){p=M.source().id(),g=M.target().id(),(E=p===h?g:p)!==v&&(C=M.id(),o[C]||(o[C]=!0,s.push({x:h,y:E,edge:M})),E in t?t[h].low=Math.min(t[h].low,t[E].id):(u(f,E,h),t[h].low=Math.min(t[h].low,t[E].low),t[h].id<=t[E].low&&(t[h].cutVertex=!0,function(f,h){for(var v=s.length-1,w=[],p=e.spawn();s[v].x!=f||s[v].y!=h;)w.push(s.pop().edge),v--;w.push(s.pop().edge),w.forEach(function(g){var E=g.connectedNodes().intersection(e);p.merge(g),E.forEach(function(C){var M=C.id(),V=C.connectedEdges().intersection(e);p.merge(C),p.merge(t[M].cutVertex?V.filter(function(H){return H.isLoop()}):V)})}),i.push(p)}(h,E))))})};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}},gi=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(w){var p=w.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}},Pu={};[xa,Qh,ev,rv,av,sv,uv,_v,Un,Xn,Os,$v,lg,fg,bg,wg,{hopcroftTarjanBiconnected:vi,htbc:vi,htb:vi,hopcroftTarjanBiconnectedComponents:vi},{tarjanStronglyConnected:gi,tsc:gi,tscc:gi,tarjanStronglyConnectedComponents:gi}].forEach(function(r){bt(Pu,r)});var kr=function(e){if(!(this instanceof kr))return new kr(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))};kr.prototype={fulfill:function(e){return Fu(this,1,"fulfillValue",e)},reject:function(e){return Fu(this,2,"rejectReason",e)},then:function(e,t){var n=this,a=new kr;return n.onFulfilled.push(Vu(e,a,"fulfill")),n.onRejected.push(Vu(t,a,"reject")),Gu(n),a.proxy}};var Fu=function(e,t,n,a){return 0===e.state&&(e.state=t,e[n]=a,Gu(e)),e},Gu=function(e){1===e.state?zu(e,"onFulfilled",e.fulfillValue):2===e.state&&zu(e,"onRejected",e.rejectReason)},zu=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)}},Vu=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)}Hu(t,i)}}},Hu=function(e,t){if(e!==t&&e.proxy!==t){var n;if("object"===Xt(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")):Hu(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"))};kr.all=function(r){return new kr(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)})},kr.resolve=function(r){return new kr(function(e,t){e(r)})},kr.reject=function(r){return new kr(function(e,t){t(r)})};var qn=typeof Promise<"u"?Promise:kr,Fs=function(e,t,n){var a=ts(e),i=!a,s=this._private=bt({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&&Jt(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},Ln=Fs.prototype;bt(Ln,{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),Rr(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 qn(function(a,i){n.push(function(){a()})})}}),Ln.complete=Ln.completed,Ln.run=Ln.play,Ln.running=Ln.playing;var Gs,Uu,zs,Xu,Vs,ju,Hs,Yu,Us,qu,Xs,Wu,js,$u,Ys,Ku,qs,Zu,$s,Ju,Ks,Qu,Zs,ec,Js,tc,Qs,rc,eo,nc,to,ac,ro,ic,no,sc,ao,lc,io,uc,so,cc,oo,dc,lo,fc,uo,hc,co,vc,fo,gc,ho,pc,vo,yc,go,mc,po,bc,yo,xc,mo,wc,bo,Ec,xo,Tc,wo,Cc,Eo,Dc,To,Ic,Co,Ac,Do,Rc,So,Mc,Io,Pc,Ao,kc,Ro,_c,Cg={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=bt({},t,n),0===Object.keys(t).length)return new Fs(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=cu(f,v,h)}if(l&&null!=t.panBy){var w=t.panBy,p=o.pan();t.pan={x:p.x+w.x,y:p.y+w.y}}var g=t.center||t.centre;if(l&&null!=g){var E=o.getCenterPan(g.eles,t.zoom);null!=E&&(t.pan=E)}if(l&&null!=t.fit){var C=t.fit,M=o.getFitViewport(C.eles||C.boundingBox,C.padding);null!=M&&(t.pan=M.pan,t.zoom=M.zoom)}if(l&&kt(t.zoom)){var V=o.getZoomedViewport(t.zoom);null!=V?(V.zoomed&&(t.zoom=V.zoom),V.panned&&(t.pan=V.pan)):t.zoom=null}return new Fs(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=bt({},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 pi(){return Uu?Gs:(Uu=1,Gs=Array.isArray)}function Rg(){if($u)return js;$u=1;var r=function Sg(){if(ju)return Vs;ju=1;var r=jl(),e=ga();return Vs=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 Lg(){if(qu)return Us;qu=1;var n,r=function Ig(){if(Yu)return Hs;Yu=1;var r=Qa();return Hs=r["__core-js_shared__"]}(),e=(n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";return Us=function t(n){return!!e&&e in n},Us}(),t=ga(),n=function Ag(){if(Wu)return Xs;Wu=1;var e=Function.prototype.toString;return Xs=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 js=function d(f){return!(!t(f)||e(f))&&(r(f)?c:i).test(n(f))}}function Ws(){if(Zu)return qs;Zu=1;var r=Rg(),e=function Ng(){return Ku?Ys:(Ku=1,Ys=function r(e,t){return e?.[t]})}();return qs=function t(n,a){var i=e(n,a);return r(i)?i:void 0}}function yi(){if(Ju)return $s;Ju=1;var e=Ws()(Object,"create");return $s=e}function oc(){return sc?no:(sc=1,no=function r(e,t){return e===t||e!=e&&t!=t})}function mi(){if(lc)return ao;lc=1;var r=oc();return ao=function e(t,n){for(var a=t.length;a--;)if(r(t[a][0],n))return a;return-1}}function jg(){if(gc)return fo;gc=1;var r=function Bg(){if(ac)return to;ac=1;var r=function Mg(){if(Qu)return Ks;Qu=1;var r=yi();return Ks=function e(){this.__data__=r?r(null):{},this.size=0}}(),e=function Og(){return ec?Zs:(ec=1,Zs=function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t})}(),t=function Pg(){if(tc)return Js;tc=1;var r=yi(),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 kg(){if(rc)return Qs;rc=1;var r=yi(),t=Object.prototype.hasOwnProperty;return Qs=function n(a){var i=this.__data__;return r?void 0!==i[a]:t.call(i,a)}}(),a=function _g(){if(nc)return eo;nc=1;var r=yi();return eo=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,to=i}(),e=function Ug(){if(hc)return uo;hc=1;var r=function Fg(){return ic?ro:(ic=1,ro=function r(){this.__data__=[],this.size=0})}(),e=function Gg(){if(uc)return io;uc=1;var r=mi(),t=Array.prototype.splice;return io=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 zg(){if(cc)return so;cc=1;var r=mi();return so=function e(t){var n=this.__data__,a=r(n,t);return a<0?void 0:n[a][1]}}(),n=function Vg(){if(dc)return oo;dc=1;var r=mi();return oo=function e(t){return r(this.__data__,t)>-1}}(),a=function Hg(){if(fc)return lo;fc=1;var r=mi();return lo=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,uo=i}(),t=function Xg(){if(vc)return co;vc=1;var t=Ws()(Qa(),"Map");return co=t}();return fo=function n(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}}function bi(){if(yc)return vo;yc=1;var r=function Yg(){return pc?ho:(pc=1,ho=function r(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e})}();return vo=function e(t,n){var a=t.__data__;return r(n)?a["string"==typeof n?"string":"hash"]:a.map}}function Qg(){if(Cc)return wo;Cc=1;var r=function Jg(){if(Tc)return xo;Tc=1;var r=function Zg(){if(Ec)return bo;Ec=1;var r=jg(),e=function qg(){if(mc)return go;mc=1;var r=bi();return go=function e(t){var n=r(this,t).delete(t);return this.size-=n?1:0,n}}(),t=function Wg(){if(bc)return po;bc=1;var r=bi();return po=function e(t){return r(this,t).get(t)}}(),n=function $g(){if(xc)return yo;xc=1;var r=bi();return yo=function e(t){return r(this,t).has(t)}}(),a=function Kg(){if(wc)return mo;wc=1;var r=bi();return mo=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,bo=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,xo=t}();return wo=function t(n){var a=r(n,function(s){return 500===i.size&&i.clear(),s}),i=a.cache;return a}}function Sc(){if(Dc)return Eo;Dc=1;var r=Qg(),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 Eo=n}function Lc(){return Ic?To:(Ic=1,To=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 Nc(){if(Rc)return Do;Rc=1;var r=function ep(){if(Ac)return Co;Ac=1;var r=cs(),e=Lc(),t=pi(),n=pa(),a=r?r.prototype:void 0,i=a?a.toString:void 0;return Co=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 Do=function e(t){return null==t?"":r(t)}}function Oc(){if(Mc)return So;Mc=1;var r=pi(),e=function Dg(){if(Xu)return zs;Xu=1;var r=pi(),e=pa(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return zs=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=Sc(),n=Nc();return So=function a(i,s){return r(i)?i:e(i,s)?[i]:t(n(i))}}function Lo(){if(Pc)return Io;Pc=1;var r=pa();return Io=function e(t){if("string"==typeof t||r(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}var No,Bc,Mo,Fc,Oo,Gc,Po,zc,ko,Vc,_o,Hc,np=function rp(){if(_c)return Ro;_c=1;var r=function tp(){if(kc)return Ao;kc=1;var r=Oc(),e=Lo();return Ao=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 Ro=function e(t,n,a){var i=null==t?void 0:r(t,n);return void 0===i?a:i}}(),ap=va(np);function up(){if(Vc)return ko;Vc=1;var r=function op(){if(Gc)return Oo;Gc=1;var r=function sp(){if(Fc)return Mo;Fc=1;var r=function ip(){if(Bc)return No;Bc=1;var r=Ws(),e=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}}();return No=e}();return Mo=function e(t,n,a){"__proto__"==n&&r?r(t,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):t[n]=a}}(),e=oc(),n=Object.prototype.hasOwnProperty;return Oo=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=Oc(),t=function lp(){if(zc)return Po;zc=1;var e=/^(?:0|[1-9]\d*)$/;return Po=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=ga(),a=Lo();return ko=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]),w=l;if("__proto__"===v||"constructor"===v||"prototype"===v)return s;if(c!=f){var p=h[v];void 0===(w=u?u(p,v,h):void 0)&&(w=n(p)?p:t(o[c+1])?[]:{})}r(h,v,w),h=h[v]}return s}}var Bo,Uc,Fo,Xc,fp=va(function cp(){if(Hc)return _o;Hc=1;var r=up();return _o=function e(t,n,a){return null==t?t:r(t,n,a)}}()),gp=function vp(){if(Xc)return Fo;Xc=1;var r=Lc(),e=function hp(){return Uc?Bo:(Uc=1,Bo=function r(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t})}(),t=pi(),n=pa(),a=Sc(),i=Lo(),s=Nc();return Fo=function o(l){return t(l)?r(l,i):n(l)?[l]:e(a(s(l)))}}(),pp=va(gp),yp={data:function(e){return e=bt({},{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(vt(a)){var h,f=-1!==a.indexOf(".")&&pp(a);if(s.allowGetting&&void 0===i)return c&&(s.beforeGet(c),h=f&&void 0===c._private[s.field][a]?ap(c._private[s.field],f):c._private[s.field][a]),h;if(s.allowSetting&&void 0!==i&&!s.immutableKeys[a]){var w=et({},a,i);s.beforeSet(o,w);for(var p=0,g=u.length;p<g;p++){var E=u[p];s.canSet(E)&&(f&&void 0===c._private[s.field][a]?fp(E._private[s.field],f,i):E._private[s.field][a]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}else if(s.allowSetting&&kt(a)){var M,V,C=a,H=Object.keys(C);s.beforeSet(o,C);for(var G=0;G<H.length;G++)if(V=C[M=H[G]],!s.immutableKeys[M])for(var W=0;W<u.length;W++){var $=u[W];s.canSet($)&&($._private[s.field][M]=V)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&Jt(a))o.on(s.bindingEvent,a);else if(s.allowGetting&&void 0===a){var J;return c&&(s.beforeGet(c),J=c._private[s.field]),J}return o}},removeData:function(e){return e=bt({},{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(vt(a)){for(var u=a.split(/\s+/),c=u.length,d=0;d<c;d++){var f=u[d];if(!nn(f)&&!i.immutableKeys[f])for(var v=0,w=l.length;v<w;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 E=l[p]._private[i.field],C=Object.keys(E),M=0;M<C.length;M++){var V=C[M];!i.immutableKeys[V]&&(E[V]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},mp={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 qn(function(o,l){var c=s.concat([function(h){i.off.apply(i,d),o(h)}]),d=c.concat([]);i.on.apply(i,c)})}}},zt={};[Cg,yp,mp].forEach(function(r){bt(zt,r)});var bp={animate:zt.animate(),animation:zt.animation(),animated:zt.animated(),clearQueue:zt.clearQueue(),delay:zt.delay(),delayAnimation:zt.delayAnimation(),stop:zt.stop()},xi={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}Yt(e)||(e=(e||"").match(/\S+/g)||[]);for(var a=[],i=new zn(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){Yt(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}};xi.className=xi.classNames=xi.classes;var _t={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:ir,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};_t.variable="(?:[\\w-.]|(?:\\\\"+_t.metaChar+"))+",_t.className="(?:[\\w-]|(?:\\\\"+_t.metaChar+"))+",_t.value=_t.string+"|"+_t.number,_t.id=_t.variable,function(){var r,e,t;for(r=_t.comparatorOp.split("|"),t=0;t<r.length;t++)_t.comparatorOp+="|@"+(e=r[t]);for(r=_t.comparatorOp.split("|"),t=0;t<r.length;t++)!((e=r[t]).indexOf("!")>=0)&&"="!==e&&(_t.comparatorOp+="|\\!"+e)}();var Go=[{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*Nl(e,t)}(r.selector,e.selector)}),xp=function(){for(var e,r={},t=0;t<Go.length;t++)r[(e=Go[t]).selector]=e.matches;return r}(),Ep="("+Go.map(function(r){return r.selector}).join("|")+")",Wn=function(e){return e.replace(new RegExp("\\\\("+_t.metaChar+")","g"),function(t,n){return n})},dn=function(e,t,n){e[e.length-1]=n},zo=[{name:"group",query:!0,regex:"("+_t.group+")",populate:function(e,t,n){var i=Qe(n,1)[0];t.checks.push({type:0,value:"*"===i?i:i+"s"})}},{name:"state",query:!0,regex:Ep,populate:function(e,t,n){var a=Qe(n,1);t.checks.push({type:7,value:a[0]})}},{name:"id",query:!0,regex:"\\#("+_t.id+")",populate:function(e,t,n){var a=Qe(n,1);t.checks.push({type:8,value:Wn(a[0])})}},{name:"className",query:!0,regex:"\\.("+_t.className+")",populate:function(e,t,n){var a=Qe(n,1);t.checks.push({type:9,value:Wn(a[0])})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+_t.variable+")\\s*\\]",populate:function(e,t,n){var a=Qe(n,1);t.checks.push({type:4,field:Wn(a[0])})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+_t.variable+")\\s*("+_t.comparatorOp+")\\s*("+_t.value+")\\s*\\]",populate:function(e,t,n){var a=Qe(n,3),i=a[0],s=a[1],o=a[2];o=null!=new RegExp("^"+_t.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:3,field:Wn(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+_t.boolOp+")\\s*("+_t.variable+")\\s*\\]",populate:function(e,t,n){var a=Qe(n,2),i=a[0];t.checks.push({type:5,field:Wn(a[1]),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+_t.meta+")\\s*("+_t.comparatorOp+")\\s*("+_t.number+")\\s*\\]\\]",populate:function(e,t,n){var a=Qe(n,3),s=a[1],o=a[2];t.checks.push({type:6,field:Wn(a[0]),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:_t.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:_t.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},i={checks:[]};return n.checks.push({type:11,source:t,target:i}),dn(e,0,n),e.edgeCount++,i}var s={checks:[]},l={checks:[]};return s.checks.push({type:12,source:t,target:l}),dn(e,0,s),e.edgeCount++,l}},{name:"undirectedEdge",separator:!0,regex:_t.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},i={checks:[]};return n.checks.push({type:10,nodes:[t,i]}),dn(e,0,n),e.edgeCount++,i}var s={checks:[]},l={checks:[]};return s.checks.push({type:14,node:t,neighbor:l}),dn(e,0,s),l}},{name:"child",separator:!0,regex:_t.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}),dn(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}),dn(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:_t.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}),dn(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}),dn(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:_t.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Gt("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)}}];zo.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var Tp=function(e){for(var t,n,a,i=0;i<zo.length;i++){var s=zo[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}},Ip={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=Tp(n);if(null==i.expr)return Gt("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 Gt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return Gt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===c.edgeCount&&Gt("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 vt(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 E=c.field;return"["+e(c.operator)+E+"]";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),G=i(c.subject,d),X=i(c.right,d);return H+(H.length>0?" ":"")+G+X;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}},jc=function(e,t,n){var a,l,u,i=vt(e),s=tt(e),o=vt(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},Vo=function(e,t){return e.data(t)},Qt=[],$t=function(e,t){return e.checks.every(function(n){return Qt[n.type](n,t)})};Qt[0]=function(r,e){var t=r.value;return"*"===t||t===e.group()},Qt[7]=function(r,e){return function(e,t){return xp[e](t)}(r.value,e)},Qt[8]=function(r,e){var t=r.value;return e.id()===t},Qt[9]=function(r,e){return e.hasClass(r.value)},Qt[6]=function(r,e){var n=r.operator,a=r.value;return jc(function(e,t){return e[t]()}(e,r.field),n,a)},Qt[3]=function(r,e){var n=r.operator,a=r.value;return jc(Vo(e,r.field),n,a)},Qt[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}}(Vo(e,r.field),n)},Qt[4]=function(r,e){return function(e){return void 0!==e}(Vo(e,r.field))},Qt[10]=function(r,e){var t=r.nodes[0],n=r.nodes[1],a=e.source(),i=e.target();return $t(t,a)&&$t(n,i)||$t(n,a)&&$t(t,i)},Qt[14]=function(r,e){return $t(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&$t(r.neighbor,t)})},Qt[11]=function(r,e){return $t(r.source,e.source())&&$t(r.target,e.target())},Qt[12]=function(r,e){return $t(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&$t(r.target,t)})},Qt[13]=function(r,e){return $t(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&$t(r.source,t)})},Qt[15]=function(r,e){return $t(r.child,e)&&$t(r.parent,e.parent())},Qt[17]=function(r,e){return $t(r.parent,e)&&e.children().some(function(t){return $t(r.child,t)})},Qt[16]=function(r,e){return $t(r.descendant,e)&&e.ancestors().some(function(t){return $t(r.ancestor,t)})},Qt[18]=function(r,e){return $t(r.ancestor,e)&&e.descendants().some(function(t){return $t(r.descendant,t)})},Qt[19]=function(r,e){return $t(r.subject,e)&&$t(r.left,e)&&$t(r.right,e)},Qt[20]=function(){return!0},Qt[1]=function(r,e){return r.value.has(e)},Qt[2]=function(r,e){return(0,r.value)(e)};var Op={matches:function(e){for(var n=0;n<this.length;n++)if($t(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($t(t[s],i))return!0;return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}},fn=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||vt(e)&&e.match(/^\s*$/)||(Rr(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):Jt(e)?this.addQuery({checks:[{type:2,value:e}]}):vt(e)?this.parse(e)||(this.invalid=!0):Kt("A selector must be created from a string; found "))},hn=fn.prototype;[Ip,Op].forEach(function(r){return bt(hn,r)}),hn.text=function(){return this.inputText},hn.size=function(){return this.length},hn.eq=function(r){return this[r]},hn.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()},hn.addQuery=function(r){this[this.length++]=r},hn.selector=hn.toString;var vn={allAre:function(e){var t=new fn(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new fn(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())})}};vn.allAreNeighbours=vn.allAreNeighbors,vn.has=vn.contains,vn.equal=vn.equals=vn.same;var Sa,Wc,Nr=function(e,t){return function(a,i,s,o){var c,l=a,u=this;if(null==l?c="":Rr(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=Cn(c);return h[v]||(h[v]=e.call(u,a,i,s,o))}return e.call(u,a,i,s,o)}},$n={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:Nr(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 Ho(r,e,t,n){for(var a=[],i=new zn,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 Yc(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 qc(r,e,t){if(t.isChild()){var n=t._private.parent;e.has(n.id())||r.push(n)}}function Pp(r,e,t){qc(r,e,t),Yc(r,e,t)}$n.forEachDown=function(r){return Ho(this,r,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Yc)},$n.forEachUp=function(r){return Ho(this,r,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],qc)},$n.forEachUpAndDown=function(r){return Ho(this,r,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Pp)},$n.ancestors=$n.parents,Sa=Wc={data:zt.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:zt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:zt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:zt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:zt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:zt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Sa.attr=Sa.data,Sa.removeAttr=Sa.removeData;var kp=Wc,wi={};function Uo(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 Kn(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}}bt(wi,{degree:Uo(function(r,e){return e.source().same(e.target())?2:1}),indegree:Uo(function(r,e){return e.target().same(r)?1:0}),outdegree:Uo(function(r,e){return e.source().same(r)?1:0})}),bt(wi,{minDegree:Kn("degree",function(r,e){return r<e}),maxDegree:Kn("degree",function(r,e){return r>e}),minIndegree:Kn("indegree",function(r,e){return r<e}),maxIndegree:Kn("indegree",function(r,e){return r>e}),minOutdegree:Kn("outdegree",function(r,e){return r<e}),maxOutdegree:Kn("outdegree",function(r,e){return r>e})}),bt(wi,{totalDegree:function(e){for(var t=0,n=this.nodes(),a=0;a<n.length;a++)t+=n[a].degree(e);return t}});var _r,$c,Kc=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()}}},Zc={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){Kc(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};_r=$c={position:zt.data(Zc),silentPosition:zt.data(bt({},Zc,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Kc(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(kt(e))t?this.silentPosition(e):this.position(e);else if(Jt(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(kt(e)?(a={x:tt(e.x)?e.x:0,y:tt(e.y)?e.y:0},n=t):vt(e)&&tt(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 kt(e)?this.shift(e,!0):vt(e)&&tt(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=kt(e)?e:void 0,l=void 0!==o||void 0!==t&&vt(e);if(n&&n.isNode()){if(!l){var d=n.position();return o=ii(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(cu(o,i,s))}}else if(!l)return;return this},relativePosition:function(e,t){var n=this[0],a=this.cy(),i=kt(e)?e:void 0,s=void 0!==i||void 0!==t&&vt(e),o=a.hasCompoundNodes();if(n&&n.isNode()){if(!s){var v=n.position(),w=o?n.parent():null,p=w&&w.length>0;p&&(w=w[0]);var E=p?w.position():{x:0,y:0};return i={x:v.x-E.x,y:v.y-E.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}},_r.modelPosition=_r.point=_r.position,_r.modelPositions=_r.points=_r.positions,_r.renderedPoint=_r.renderedPosition,_r.relativePoint=_r.relativePosition;var Zn,gn,_p=$c;Zn=gn={},gn.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}},gn.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},gn.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 w=c.width.left.value;"px"===c.width.left.units&&c.width.val>0&&(w=100*w/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 E=c.height.bottom.value;"px"===c.height.bottom.units&&c.height.val>0&&(E=100*E/c.height.val);var C=h(c.width.val-d.w,w,p),M=C.biasDiff,V=C.biasComplementDiff,H=h(c.height.val-d.h,g,E),G=H.biasDiff,X=H.biasComplementDiff;o.autoPadding=function v(W,$,Z,J){if("%"!==Z.units)return"px"===Z.units?Z.pfValue:0;switch(J){case"width":return W>0?Z.pfValue*W:0;case"height":return $>0?Z.pfValue*$:0;case"average":return W>0&&$>0?Z.pfValue*(W+$)/2:0;case"min":return W>0&&$>0?W>$?Z.pfValue*$:Z.pfValue*W:0;case"max":return W>0&&$>0?W>$?Z.pfValue*W:Z.pfValue*$: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=(-M+d.x1+d.x2+V)/2,o.autoHeight=Math.max(d.h,c.height.val),f.y=(-G+d.y1+d.y2+X)/2}function h(W,$,Z){var J=0,Q=0,oe=$+Z;return W>0&&oe>0&&(J=$/oe*W,Q=Z/oe*W),{biasDiff:J,biasComplementDiff:Q}}}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 Mr=function(e){return e===1/0||e===-1/0?0:e},Br=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)},pn=function(e,t){return null==t?e:Br(e,t.x1,t.y1,t.x2,t.y2)},Ia=function(e,t,n){return Sr(e,t,n)},Ei=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,oi(d,1),Br(e,d.x1,d.y1,d.x2,d.y2)}}},Xo=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 Z,J,Q,oe,l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),c=Ia(s,"labelWidth",n),d=Ia(s,"labelHeight",n),f=Ia(s,"labelX",n),h=Ia(s,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,w=t.pstyle(a+"text-margin-y").pfValue,p=t.isEdge(),g=t.pstyle(a+"text-rotation"),E=t.pstyle("text-outline-width").pfValue,M=t.pstyle("text-border-width").pfValue/2,V=t.pstyle("text-background-padding").pfValue,G=d,X=c,W=X/2,$=G/2;if(p)Z=f-W,J=f+W,Q=h-$,oe=h+$;else{switch(l.value){case"left":Z=f-X,J=f;break;case"center":Z=f-W,J=f+W;break;case"right":Z=f,J=f+X}switch(u.value){case"top":Q=h-G,oe=h;break;case"center":Q=h-$,oe=h+$;break;case"bottom":Q=h,oe=h+G}}var ce=v-Math.max(E,M)-V-2,de=v+Math.max(E,M)+V+2,le=w-Math.max(E,M)-V-2,ge=w+Math.max(E,M)+V+2;Z+=ce,J+=de,Q+=le,oe+=ge;var Te=n||"main",Ie=i.labelBounds,ye=Ie[Te]=Ie[Te]||{};ye.x1=Z,ye.y1=Q,ye.x2=J,ye.y2=oe,ye.w=J-Z,ye.h=oe-Q,ye.leftPad=ce,ye.rightPad=de,ye.topPad=le,ye.botPad=ge;var we=p&&"autorotate"===g.strValue;if(we||null!=g.pfValue&&0!==g.pfValue){var Ue=we?Ia(i.rstyle,"labelAngle",n):g.pfValue,Fe=Math.cos(Ue),qe=Math.sin(Ue),Je=(Z+J)/2,at=(Q+oe)/2;if(!p){switch(l.value){case"left":Je=J;break;case"right":Je=Z}switch(u.value){case"top":at=oe;break;case"bottom":at=Q}}var Ye=function(St,wt){return{x:(St-=Je)*Fe-(wt-=at)*qe+Je,y:St*qe+wt*Fe+at}},xe=Ye(Z,Q),Ce=Ye(Z,oe),Ae=Ye(J,Q),Ve=Ye(J,oe);Z=Math.min(xe.x,Ce.x,Ae.x,Ve.x),J=Math.max(xe.x,Ce.x,Ae.x,Ve.x),Q=Math.min(xe.y,Ce.y,Ae.y,Ve.y),oe=Math.max(xe.y,Ce.y,Ae.y,Ve.y)}var rt=Te+"Rot",ft=Ie[rt]=Ie[rt]||{};ft.x1=Z,ft.y1=Q,ft.x2=J,ft.y2=oe,ft.w=J-Z,ft.h=oe-Q,Br(e,Z,Q,J,oe),Br(i.labelBounds.all,Z,Q,J,oe)}return e}},Jc=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;Qc(e,t,n,s,"outside",s/2)}},Qc=function(e,t,n,a,i,s){if(!(0===n||a<=0||"inside"===i)){var o=t.cy(),l=t.pstyle("shape").value,u=o.renderer().nodeShapes[l],c=t.position(),d=c.x,f=c.y,h=t.width(),v=t.height();if(u.hasMiterBounds){"center"===i&&(a/=2);var w=u.miterBounds(d,f,h,v,a);pn(e,w)}else null!=s&&s>0&&li(e,[s,s,s,s])}},ed=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)},td=function(e){var t=function(o){return Math.round(o)};if(e.isEdge()){var n=e.source().position(),a=e.target().position();return Ql([t(n.x),t(n.y),t(a.x),t(a.y)])}var i=e.position();return Ql([t(i.x),t(i.y)])},rd=function(e,t){var a,n=e._private,i=e.isEdge(),o=(null==t?nd:ed(t))===nd;if(null==n.bbCache?(a=function(e,t){var c,d,f,h,v,w,n=e._private.cy,a=n.styleEnabled(),i=n.headless(),s=Er(),o=e._private,l=e.isNode(),u=e.isEdge(),p=o.rstyle,g=l&&a?e.pstyle("bounds-expansion").pfValue:[0],E=function(Ot){return"none"!==Ot.pstyle("display").value},C=!a||E(e)&&(!u||E(e.source())&&E(e.target()));if(C){var V=0;a&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(V=e.pstyle("overlay-padding").value);var G=0;a&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(G=e.pstyle("underlay-padding").value);var X=Math.max(V,G),$=0;if(a&&($=e.pstyle("width").pfValue/2),l&&t.includeNodes){var Z=e.position();v=Z.x,w=Z.y;var Q=e.outerWidth()/2,ce=e.outerHeight()/2;Br(s,c=v-Q,f=w-ce,d=v+Q,h=w+ce),a&&Jc(s,e),a&&t.includeOutlines&&!i&&Jc(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;Qc(e,t,n,a,i)}}(s,e)}else if(u&&t.includeEdges)if(a&&!i){var de=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),Br(s,c-=$,f-=$,d+=$,h+=$),"haystack"===de){var le=p.haystackPts;if(le&&2===le.length){if((c=le[0].x)>(d=le[1].x)){var ge=c;c=d,d=ge}if((f=le[0].y)>(h=le[1].y)){var Te=f;f=h,h=Te}Br(s,c-$,f-$,d+$,h+$)}}else if("bezier"===de||"unbundled-bezier"===de||an(de,"segments")||an(de,"taxi")){var Ie;switch(de){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 ye=0;ye<Ie.length;ye++){var we=Ie[ye];Br(s,c=we.x-$,f=we.y-$,d=we.x+$,h=we.y+$)}}}else{var Ue=e.source().position(),qe=e.target().position();if((c=Ue.x)>(d=qe.x)){var Je=c;c=d,d=Je}if((f=Ue.y)>(h=qe.y)){var at=f;f=h,h=at}Br(s,c-=$,f-=$,d+=$,h+=$)}if(a&&t.includeEdges&&u&&(Ei(s,e,"mid-source"),Ei(s,e,"mid-target"),Ei(s,e,"source"),Ei(s,e,"target")),a&&"yes"===e.pstyle("ghost").value){var xe=e.pstyle("ghost-offset-x").pfValue,Ce=e.pstyle("ghost-offset-y").pfValue;Br(s,s.x1+xe,s.y1+Ce,s.x2+xe,s.y2+Ce)}var Ae=o.bodyBounds=o.bodyBounds||{};fu(Ae,s),li(Ae,g),oi(Ae,1),a&&Br(s,(c=s.x1)-X,(f=s.y1)-X,(d=s.x2)+X,(h=s.y2)+X);var Ve=o.overlayBounds=o.overlayBounds||{};fu(Ve,s),li(Ve,g),oi(Ve,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=Er(),a&&t.includeLabels&&(t.includeMainLabels&&Xo(s,e,null),u&&(t.includeSourceLabels&&Xo(s,e,"source"),t.includeTargetLabels&&Xo(s,e,"target")))}return s.x1=Mr(s.x1),s.y1=Mr(s.y1),s.x2=Mr(s.x2),s.y2=Mr(s.y2),s.w=Mr(s.x2-s.x1),s.h=Mr(s.y2-s.y1),s.w>0&&s.h>0&&C&&(li(s,g),oi(s,1)),s}(e,La),n.bbCache=a,n.bbCachePosKey=td(e)):a=n.bbCache,!o){var l=e.isNode();a=Er(),(t.includeNodes&&l||t.includeEdges&&!l)&&pn(a,t.includeOverlays?n.overlayBounds:n.bodyBounds),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?pn(a,n.labelBounds.all):(t.includeMainLabels&&pn(a,n.labelBounds.mainRot),t.includeSourceLabels&&pn(a,n.labelBounds.sourceRot),t.includeTargetLabels&&pn(a,n.labelBounds.targetRot))),a.w=a.x2-a.x1,a.h=a.y2-a.y1}return a},La={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},nd=ed(La),ad=hr(La);gn.boundingBox=function(r){var e,t=void 0===r||void 0===r.useCache||!0===r.useCache,n=Fn(function(c){var d=c._private;return null==d.bbCache||d.styleDirty||d.bbCachePosKey!==td(c)},function(c){return c.id()});if(t&&1===this.length&&!n(this[0]))r=void 0===r?La:ad(r),e=rd(this[0],r);else{e=Er();var a=ad(r=r||La),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(),pn(e,rd(u,a))}}return e.x1=Mr(e.x1),e.y1=Mr(e.y1),e.x2=Mr(e.x2),e.y2=Mr(e.y2),e.w=Mr(e.x2-e.x1),e.h=Mr(e.y2-e.y1),e},gn.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},gn.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)),kt(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},Zn.boundingbox=Zn.bb=Zn.boundingBox,Zn.renderedBoundingbox=Zn.renderedBoundingBox;var Aa,Ra,Gp=gn;Aa=Ra={};var id=function(e){e.uppercaseName=Rl(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Rl(e.outerName),Aa[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}},Aa["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}},Aa["rendered"+e.uppercaseName]=function(){var n=this[0];if(n)return n[e.name]()*this.cy().zoom()},Aa["rendered"+e.uppercaseOuterName]=function(){var n=this[0];if(n)return n[e.outerName]()*this.cy().zoom()}};id({name:"width"}),id({name:"height"}),Ra.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},Ra.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()},Ra.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var zp=Ra,sd={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)}}},Kp=Object.keys(sd).reduce(function(r,e){var t=sd[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 ii(s,i,a)})}}(this,t.get)}:function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return ii(t(e),n.zoom(),n.pan())}}(this,t.get)},r},{}),Zp=bt({},_p,Gp,zp,Kp),od=function(e,t){this.recycle(e,t)};function Na(){return!1}function Ti(){return!0}od.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Na,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Ti:Na):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=Ti;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Ti;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Ti,this.stopPropagation()},isDefaultPrevented:Na,isPropagationStopped:Na,isImmediatePropagationStopped:Na};var ld=/^([^.]+)(\.(?:[^.]+))?$/,ud={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},cd=Object.keys(ud),Qp={};function Ci(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qp,e=arguments.length>1?arguments[1]:void 0,t=0;t<cd.length;t++){var n=cd[t];this[n]=r[n]||ud[n]}this.context=e||this.context,this.listeners=[],this.emitting=0}var yn=Ci.prototype,dd=function(e,t,n,a,i,s,o){Jt(a)&&(i=a,a=null),o&&(s=null==s?o:bt({},s,o));for(var l=Yt(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!nn(c)){var d=c.match(ld);if(d&&!1===t(e,c,d[1],d[2]?d[2]:null,a,i,s))break}}},fd=function(e,t){return e.addEventFields(e.context,t),new od(t.type,t)};yn.on=yn.addListener=function(r,e,t,n,a){return dd(this,function(i,s,o,l,u,c,d){Jt(c)&&i.listeners.push({event:s,callback:c,type:o,namespace:l,qualifier:u,conf:d})},r,e,t,n,a),this},yn.one=function(r,e,t,n){return this.on(r,e,t,n,{one:!0})},yn.removeListener=yn.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];dd(a,function(d,f,h,v,w,p){if((c.type===h||"*"===r)&&(!v&&".*"!==c.namespace||c.namespace===v)&&(!w||d.qualifierCompare(c.qualifier,w))&&(!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},yn.removeAllListeners=function(){return this.removeListener("*")},yn.emit=yn.trigger=function(r,e,t){var n=this.listeners,a=n.length;return this.emitting++,Yt(e)||(e=[e]),function(e,t,n){if(function(e){return"event"===fa(e)}(n))t(e,n);else if(kt(n))t(e,fd(e,n));else for(var a=Yt(n)?n:n.split(/\s+/),i=0;i<a.length;i++){var s=a[i];if(!nn(s)){var o=s.match(ld);o&&t(e,fd(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 ty={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&&ha(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()}},Di=function(e){return vt(e)?new fn(e):e},hd={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new Ci(ty,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var a=Di(t),i=0;i<this.length;i++)this[i].emitter().on(e,a,n);return this},removeListener:function(e,t,n){for(var a=Di(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=Di(t),i=0;i<this.length;i++)this[i].emitter().one(e,a,n);return this},once:function(e,t,n){for(var a=Di(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}};zt.eventAliasesOn(hd);var vd={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(vt(e)||Rr(e))return new fn(e).filter(this);if(Jt(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){vt(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(vt(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;vt(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;vt(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(vt(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&&vt(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&&vt(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}}},Ft=vd;Ft.u=Ft["|"]=Ft["+"]=Ft.union=Ft.or=Ft.add,Ft["\\"]=Ft["!"]=Ft["-"]=Ft.difference=Ft.relativeComplement=Ft.subtract=Ft.not,Ft.n=Ft["&"]=Ft["."]=Ft.and=Ft.intersection=Ft.intersect,Ft["^"]=Ft["(+)"]=Ft["(-)"]=Ft.symmetricDifference=Ft.symdiff=Ft.xor,Ft.fnFilter=Ft.filterFn=Ft.stdFilter=Ft.filter,Ft.complement=Ft.abscomp=Ft.absoluteComplement;var e,gd=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?bs: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()},Si={forEach:function(e,t){if(Jt(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(!Jt(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(gd)},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:bs-1}var s=t.target,o=t.source.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}};Si.each=Si.forEach,e="undefined",(typeof Symbol>"u"?"undefined":Xt(Symbol))!=e&&Xt(Symbol.iterator)!=e&&(Si[Symbol.iterator]=function(){var n=this,a={value:void 0,done:!1},i=0,s=this.length;return et({next:function(){return i<s?a.value=n[i++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})});var ay=hr({nodeDimensionsIncludeLabels:!1}),Ii={layoutDimensions:function(e){var t;if(e=ay(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(V){return!V.isParent()}),i=this.cy(),s=t.eles,o=function(H){return H.id()},l=Fn(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=Er(),G=0;G<a.length;G++){var W=l(a[G],G);du(H,W.x,W.y)}return H}(),h=Fn(function(V,H){var G=l(V,H);return c&&(G=function(H,G,X){var W_x=G.x1+G.w/2,W_y=G.y1+G.h/2;return{x:W_x+(X.x-W_x)*H,y:W_y+(X.y-W_y)*H}}(Math.abs(t.spacingFactor),f,G)),null!=t.transform&&(G=t.transform(V,G)),G},o);if(t.animate){for(var v=0;v<a.length;v++){var w=a[v],p=h(w,v);if(null==t.animateFilter||t.animateFilter(w,v)){var E=w.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(E)}else w.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 M=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(M)}e.animations.forEach(function(V){return V.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),qn.all(e.animations.map(function(V){return V.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(bt({},e,{eles:this}))}};function pd(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 Li(r,e){return r=Cn(r),function(n){return pd(r,e,n)}}function Ai(r,e){r=Cn(r);var t=function(a){return e.call(a)};return function(){var a=this[0];if(a)return pd(r,t,a)}}Ii.createLayout=Ii.makeLayout=Ii.layout;var vr={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(kt(e))i.applyBypass(this,e,a),this.emitAndNotify("style");else if(vt(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 jo(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 Yo(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||jo(i,n);var l=o.source,u=o.target;return t(l)&&(!s||jo(l,t))&&(l===u||t(u)&&(!s||jo(u,t)))}}}var Jn=Li("eleTakesUpSpace",function(r){return"element"===r.pstyle("display").value&&0!==r.width()&&(!r.isNode()||0!==r.height())});vr.takesUpSpace=Ai("takesUpSpace",Yo({ok:Jn}));var iy=Li("eleInteractive",function(r){return"yes"===r.pstyle("events").value&&"visible"===r.pstyle("visibility").value&&Jn(r)}),sy=Li("parentInteractive",function(r){return"visible"===r.pstyle("visibility").value&&Jn(r)});vr.interactive=Ai("interactive",Yo({ok:iy,parentOk:sy,edgeOkViaNode:Jn})),vr.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var oy=Li("eleVisible",function(r){return"visible"===r.pstyle("visibility").value&&0!==r.pstyle("opacity").pfValue&&Jn(r)});vr.visible=Ai("visible",Yo({ok:oy,edgeOkViaNode:Jn})),vr.hidden=function(){var r=this[0];if(r)return!r.visible()},vr.isBundledBezier=Ai("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),vr.bypass=vr.css=vr.style,vr.renderedCss=vr.renderedStyle,vr.removeBypass=vr.removeCss=vr.removeStyle,vr.pstyle=vr.parsedStyle;var mn={};function yd(r){return function(){var e=arguments,t=[];if(2===e.length)this.on(r.event,e[0],e[1]);else if(1===e.length&&Jt(e[0]))this.on(r.event,e[0]);else if(0===e.length||1===e.length&&Yt(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){mn[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]}},mn[r.on]=yd({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),mn[r.off]=yd({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"}),mn.deselect=mn.unselect,mn.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"}),mn.inactive=function(){var r=this[0];if(r)return!r._private.active};var mr={},md=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)}},bd=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)}},xd=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 wd(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 Ed(r){return function(t){var n=[],a=this._private.cy,i=r||{};vt(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 Td(r){return r=bt({},{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 w=h[v],p=w._private.data,g=p.target,E=p.source,C=g===f&&E===d;(s.codirected&&C||!s.codirected&&(C||d===g&&f===E))&&a.push(w)}return this.spawn(a,!0).filter(n)}}mr.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null},bt(mr,{roots:md({noIncomingEdges:!0}),leaves:md({noOutgoingEdges:!0}),outgoers:Nr(bd({outgoing:!0}),"outgoers"),successors:xd({outgoing:!0}),incomers:Nr(bd({incoming:!0}),"incomers"),predecessors:xd({})}),bt(mr,{neighborhood:Nr(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)}}),mr.neighbourhood=mr.neighborhood,mr.closedNeighbourhood=mr.closedNeighborhood,mr.openNeighbourhood=mr.openNeighborhood,bt(mr,{source:Nr(function(e){var n,t=this[0];return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:Nr(function(e){var n,t=this[0];return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:wd({attr:"source"}),targets:wd({attr:"target"})}),bt(mr,{edgesWith:Nr(Ed(),"edgesWith"),edgesTo:Nr(Ed({thisIsSrc:!0}),"edgesTo")}),bt(mr,{connectedEdges:Nr(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:Nr(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:Nr(Td(),"parallelEdges"),codirectedEdges:Nr(Td({codirected:!0}),"codirectedEdges")}),bt(mr,{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]}}),mr.componentsOf=mr.components;var gr=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 $r,s=!1;if(t){if(t.length>0&&kt(t[0])&&!ha(t[0])){s=!0;for(var o=[],l=new zn,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=iu();else if(e.hasElementWithId(f.id)||l.has(f.id))continue;var h=new ni(e,d,!1);o.push(h),l.add(f.id)}t=o}}else t=[];this.length=0;for(var v=0,w=t.length;v<w;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(E){this.lazyMap=E},rebuildMap:function(){for(var C=this.lazyMap=new $r,M=this.eles,V=0;V<M.length;V++){var H=M[V];C.set(H.id(),{index:V,ele:H})}}},n&&(this._private.map=i),s&&!a&&this.restore()}else Kt("A collection must have a reference to the core")},qt=ni.prototype=gr.prototype=Object.create(Array.prototype);qt.instanceString=function(){return"collection"},qt.spawn=function(r,e){return new gr(this.cy(),r,e)},qt.spawnSelf=function(){return this.spawn(this)},qt.cy=function(){return this._private.cy},qt.renderer=function(){return this._private.cy.renderer()},qt.element=function(){return this[0]},qt.collection=function(){return Il(this)?this:new gr(this._private.cy,[this])},qt.unique=function(){return new gr(this._private.cy,this,!0)},qt.hasElementWithId=function(r){return this._private.map.has(r=""+r)},qt.getElementById=function(r){var e=this._private.cy,t=this._private.map.get(r=""+r);return t?t.ele:new gr(e)},qt.$id=qt.getElementById,qt.poolIndex=function(){return this._private.cy._private.elements._private.map.get(this[0]._private.data.id).index},qt.indexOf=function(r){return this._private.map.get(r[0]._private.data.id).index},qt.indexOfId=function(r){return this._private.map.get(r=""+r).index},qt.json=function(r){var e=this.element(),t=this.cy();if(null==e&&r)return this;if(null!=e){var n=e._private;if(kt(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(w,p,g){var E=r[w];null!=E&&E!==n[w]&&(E?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:zr(n.data),position:zr(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}}},qt.jsons=function(){for(var r=[],e=0;e<this.length;e++){var n=this[e].json();r.push(n)}return r},qt.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var a=this[t].json(),i=new ni(r,a,!1);e.push(i)}return new gr(r,e)},qt.copy=qt.clone,qt.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,w=v.data;if(h.clearTraversalCache(),e||v.removed)if(void 0===w.id)w.id=iu();else if(tt(w.id))w.id=""+w.id;else{if(nn(w.id)||!vt(w.id)){Kt("Can not create element with invalid string ID `"+w.id+"`"),f();continue}if(n.hasElementWithId(w.id)){Kt("Can not create second element with ID `"+w.id+"`"),f();continue}}var p=w.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 E=h,C=["source","target"],M=C.length,V=!1,H=0;H<M;H++){var G=C[H],X=w[G];tt(X)&&(X=w[G]=""+w[G]),null==X||""===X?(Kt("Can not create edge `"+p+"` with unspecified "+G),V=!0):n.hasElementWithId(X)||(Kt("Can not create edge `"+p+"` with nonexistant "+G+" `"+X+"`"),V=!0)}if(V){f();continue}var W=n.getElementById(w.source),$=n.getElementById(w.target);W.same($)?W._private.edges.push(E):(W._private.edges.push(E),$._private.edges.push(E)),E._private.source=W,E._private.target=$}v.map=new $r,v.map.set(p,{ele:h,index:0}),v.removed=!1,e&&n.addToPool(h)}for(var Z=0;Z<i.length;Z++){var J=i[Z],Q=J._private.data;tt(Q.parent)&&(Q.parent=""+Q.parent);var oe=Q.parent;if(null!=oe||J._private.parent){var de=J._private.parent?n.collection().merge(J._private.parent):n.getElementById(oe);if(de.empty())Q.parent=void 0;else if(de[0].removed())Gt("Node added with missing parent, reference to parent removed"),Q.parent=void 0,J._private.parent=null;else{for(var le=!1,ge=de;!ge.empty();){if(J.same(ge)){le=!0,Q.parent=void 0;break}ge=ge.parent()}le||(de[0]._private.children.push(J),J._private.parent=de[0],a.hasCompoundNodes=!0)}}}if(o.length>0){for(var Te=o.length===t.length?t:new gr(n,o),Ie=0;Ie<Te.length;Ie++){var ye=Te[Ie];ye.isNode()||(ye.parallelEdges().clearTraversalCache(),ye.source().clearTraversalCache(),ye.target().clearTraversalCache())}(a.hasCompoundNodes?n.collection().merge(Te).merge(Te.connectedNodes()).merge(Te.parent()):Te).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?Te.emitAndNotify("add"):e&&Te.emit("add")}return t},qt.removed=function(){var r=this[0];return r&&r._private.removed},qt.inside=function(){var r=this[0];return r&&!r._private.removed},qt.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(oe){var ce=a[oe.id()];e&&oe.removed()||ce||(a[oe.id()]=!0,oe.isNode()?(n.push(oe),function s(oe){for(var ce=oe._private.edges,de=0;de<ce.length;de++)l(ce[de])}(oe),function o(oe){for(var ce=oe._private.children,de=0;de<ce.length;de++)l(ce[de])}(oe)):n.unshift(oe))}for(var u=0,c=t.length;u<c;u++)l(t[u]);function f(oe,ce){on(oe._private.edges,ce),oe.clearTraversalCache()}function h(oe){oe.clearTraversalCache()}var v=[];function w(oe,ce){ce=ce[0];var de=(oe=oe[0])._private.children,le=oe.id();on(de,ce),ce._private.parent=null,v.ids[le]||(v.ids[le]=!0,v.push(oe))}v.ids={},t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(n);for(var p=0;p<n.length;p++){var g=n[p];if(g.isEdge()){var E=g.source()[0],C=g.target()[0];f(E,g),f(C,g);for(var M=g.parallelEdges(),V=0;V<M.length;V++){var H=M[V];h(H),H.isBundledBezier()&&H.dirtyBoundingBoxCache()}}else{var G=g.parent();0!==G.length&&w(G,g)}e&&(g._private.removed=!0)}var X=i._private.elements;i._private.hasCompoundNodes=!1;for(var W=0;W<X.length;W++)if(X[W].isParent()){i._private.hasCompoundNodes=!0;break}var Z=new gr(this.cy(),n);Z.size()>0&&(r?Z.emitAndNotify("remove"):e&&Z.emit("remove"));for(var J=0;J<v.length;J++){var Q=v[J];(!e||!Q.removed())&&Q.updateStyle()}return Z},qt.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],w=v._private.data;v.isEdge()&&(l&&(w.source=s),u&&(w.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 w=t[v],p=w._private.data;w.isNode()&&(p.parent=f)}h.restore(n,a)}),t.emitAndNotify("move")}}return this},[Pu,bp,xi,vn,$n,kp,wi,Zp,hd,vd,{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}},Si,Ii,vr,mn,mr].forEach(function(r){bt(qt,r)});var uy={add:function(e){var t,n=this;if(Rr(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 gr(n,i)}}else if(Yt(e))t=new gr(n,e);else if(kt(e)&&(Yt(e.nodes)||Yt(e.edges))){for(var u=e,c=[],d=["nodes","edges"],f=0,h=d.length;f<h;f++){var v=d[f],w=u[v];if(Yt(w))for(var p=0,g=w.length;p<g;p++){var E=bt({group:v},w[p]);c.push(E)}}t=new gr(n,c)}else t=new ni(n,e).collection();return t},remove:function(e){return Rr(e)||vt(e)&&(e=this.$(e)),e.remove()}};function cy(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($,Z){return 1-3*Z+3*$}function v($,Z){return 3*Z-6*$}function w($){return 3*$}function p($,Z,J){return((h(Z,J)*$+v(Z,J))*$+w(Z))*$}function g($,Z,J){return 3*h(Z,J)*$*$+2*v(Z,J)*$+w(Z)}var H=!1;var X=function(Z){return H||function G(){H=!0,(r!==e||t!==n)&&function C(){for(var $=0;$<11;++$)f[$]=p($*u,r,t)}()}(),r===e&&t===n?Z:0===Z?0:1===Z?1:p(function V($){for(var Z=0,J=1;10!==J&&f[J]<=$;++J)Z+=u;--J;var ce=Z+($-f[J])/(f[J+1]-f[J])*u,de=g(ce,r,t);return de>=.001?function E($,Z){for(var J=0;J<4;++J){var Q=g(Z,r,t);if(0===Q)return Z;Z-=(p(Z,r,t)-$)/Q}return Z}($,ce):0===de?ce:function M($,Z,J){var Q,oe,ce=0;do{(Q=p(oe=Z+(J-Z)/2,r,t)-$)>0?J=oe:Z=oe}while(Math.abs(Q)>1e-7&&++ce<10);return oe}($,Z,Z+u)}(Z),e,n)};X.getControlPoints=function(){return[{x:r,y:e},{x:t,y:n}]};var W="generateBezier("+[r,e,t,n]+")";return X.toString=function(){return W},X}var dy=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(w){return l[w*(l.length-1)|0]}:u}}(),Wt=function(e,t,n,a){var i=cy(e,t,n,a);return function(s,o,l){return s+(o-s)*i(l)}},Ri={linear:function(e,t,n){return e+(t-e)*n},ease:Wt(.25,.1,.25,1),"ease-in":Wt(.42,0,1,1),"ease-out":Wt(0,0,.58,1),"ease-in-out":Wt(.42,0,.58,1),"ease-in-sine":Wt(.47,0,.745,.715),"ease-out-sine":Wt(.39,.575,.565,1),"ease-in-out-sine":Wt(.445,.05,.55,.95),"ease-in-quad":Wt(.55,.085,.68,.53),"ease-out-quad":Wt(.25,.46,.45,.94),"ease-in-out-quad":Wt(.455,.03,.515,.955),"ease-in-cubic":Wt(.55,.055,.675,.19),"ease-out-cubic":Wt(.215,.61,.355,1),"ease-in-out-cubic":Wt(.645,.045,.355,1),"ease-in-quart":Wt(.895,.03,.685,.22),"ease-out-quart":Wt(.165,.84,.44,1),"ease-in-out-quart":Wt(.77,0,.175,1),"ease-in-quint":Wt(.755,.05,.855,.06),"ease-out-quint":Wt(.23,1,.32,1),"ease-in-out-quint":Wt(.86,0,.07,1),"ease-in-expo":Wt(.95,.05,.795,.035),"ease-out-expo":Wt(.19,1,.22,1),"ease-in-out-expo":Wt(1,0,0,1),"ease-in-circ":Wt(.6,.04,.98,.335),"ease-out-circ":Wt(.075,.82,.165,1),"ease-in-out-circ":Wt(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Ri.linear;var a=dy(e,t,n);return function(i,s,o){return i+(s-i)*a(o)}},"cubic-bezier":Wt};function Cd(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 Dd(r,e){return null!=r.pfValue||null!=r.value?null==r.pfValue||null!=e&&"%"===e.type.units?r.value:r.pfValue:r}function ea(r,e,t,n,a){var i=null!=a?a.type:null;t<0?t=0:t>1&&(t=1);var s=Dd(r,a),o=Dd(e,a);if(tt(s)&&tt(o))return Cd(i,s,o,t,n);if(Yt(s)&&Yt(o)){for(var l=[],u=0;u<o.length;u++){var c=s[u],d=o[u];if(null!=c&&null!=d){var f=Cd(i,c,d,t,n);l.push(f)}else l.push(d)}return l}}function fy(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=Ri.linear;else{var d,h,v;d=vt(o)?c.parse("transition-timing-function",o).value:o,vt(d)?(h=d,v=[]):(h=d[1],v=d.slice(2).map(function(Te){return+Te})),v.length>0?("spring"===h&&v.push(s.duration),s.easingImpl=Ri[h].apply(null,v)):s.easingImpl=Ri[h]}var p,w=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,E=s.position;if(E&&a&&!r.locked()){var C={};Ma(g.x,E.x)&&(C.x=ea(g.x,E.x,p,w)),Ma(g.y,E.y)&&(C.y=ea(g.y,E.y,p,w)),r.position(C)}var M=s.startPan,V=s.pan,H=i.pan,G=null!=V&&n;G&&(Ma(M.x,V.x)&&(H.x=ea(M.x,V.x,p,w)),Ma(M.y,V.y)&&(H.y=ea(M.y,V.y,p,w)),r.emit("pan"));var X=s.startZoom,W=s.zoom,$=null!=W&&n;$&&(Ma(X,W)&&(i.zoom=Ea(i.minZoom,ea(X,W,p,w),i.maxZoom)),r.emit("zoom")),(G||$)&&r.emit("viewport");var Z=s.style;if(Z&&Z.length>0&&a){for(var J=0;J<Z.length;J++){var Q=Z[J],oe=Q.name,de=s.startStyle[oe],ge=ea(de,Q,p,w,c.properties[de.name]);c.overrideBypass(r,oe,ge)}r.emit("style")}}return s.progress=p,p}function Ma(r,e){return!!(null!=r&&null!=e&&(tt(r)&&tt(e)||r&&e))}function hy(r,e,t,n){var a=e._private;a.started=!0,a.startTime=t-a.progress*a.duration}function Sd(r,e){var t=e._private.aniEles,n=[];function a(c,d){var f=c._private,h=f.animation.current,v=f.animation.queue,w=!1;if(0===h.length){var p=v.shift();p&&h.push(p)}for(var g=function(H){for(var G=H.length-1;G>=0;G--)(0,H[G])();H.splice(0,H.length)},E=h.length-1;E>=0;E--){var C=h[E],M=C._private;M.stopped?(h.splice(E,1),M.hooked=!1,M.playing=!1,M.started=!1,g(M.frames)):!M.playing&&!M.applying||(M.playing&&M.applying&&(M.applying=!1),M.started||hy(0,C,r),fy(c,C,r,d),M.applying&&(M.applying=!1),g(M.frames),null!=M.step&&M.step(r),C.completed()&&(h.splice(E,1),M.hooked=!1,M.playing=!1,M.started=!1,g(M.completes)),w=!0)}return!d&&0===h.length&&0===v.length&&n.push(c),w}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 vy={animate:zt.animate(),animation:zt.animation(),animated:zt.animated(),clearQueue:zt.clearQueue(),delay:zt.delay(),delayAnimation:zt.delayAnimation(),stop:zt.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){Sd(s,e)},n.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&ei(function(i){Sd(i,e),t()})}()}}},gy={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&&ha(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}},Ni=function(e){return vt(e)?new fn(e):e},Id={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Ci(gy,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Ni(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Ni(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Ni(t),n),this},once:function(e,t,n){return this.emitter().one(e,Ni(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}};zt.eventAliasesOn(Id);var qo={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)}};qo.jpeg=qo.jpg;var Mi={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=vt(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new a(bt({},e,{cy:t,eles:i}));Kt("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Kt("A `name` must be specified to make a layout");else Kt("Layout options must be specified to make a layout")}};Mi.createLayout=Mi.makeLayout=Mi.layout;var py={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)}})}},yy=hr({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]}),Wo={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&&Gt("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=yy(e);a.cy=t,t._private.renderer=new n(a),this.notify("init")}else Kt("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)}};Wo.invalidateDimensions=Wo.resize;var Oi={collection:function(e,t){return vt(e)?this.$(e):Rr(e)?e.collection():Yt(e)?(t||(t={}),new gr(this,e,t.unique,t.removed)):new gr(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}};Oi.elements=Oi.filter=Oi.$;var cr={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 w=0;w<v.length;w++){for(var p=v[w],g=p.name,E=!1,C=l+1;C<t.length&&("t"!==e[C]||!(E=null!=t[C].properties[p.name]));C++);!o[g]&&!E&&(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(Ae,Ve,rt){return t.getPropertiesHash(Ae,Ve,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]]=[Tn,Gn];for(var d=function(Ae,Ve){return e.styleKeys[Ve][0]=ma(Ae,e.styleKeys[Ve][0])},f=function(Ae,Ve){return e.styleKeys[Ve][1]=ba(Ae,e.styleKeys[Ve][1])},h=function(Ae,Ve){d(Ae,Ve),f(Ae,Ve)},v=function(Ae,Ve){for(var rt=0;rt<Ae.length;rt++){var ft=Ae.charCodeAt(rt);d(ft,Ve),f(ft,Ve)}},p=function(Ae){return-128<Ae&&Ae<128&&Math.floor(Ae)!==Ae?2e9-(1024*Ae|0):Ae},g=0;g<n.length;g++){var E=n[g],C=l[E];if(null!=C){var M=this.properties[E],V=M.type,H=M.groupKey,G=void 0;null!=M.hashOverride?G=M.hashOverride(r,C):null!=C.pfValue&&(G=C.pfValue);var X=null==M.enums?C.value:null,W=null!=G,J=C.units;!V.number||!W&&null==X||V.multiple?v(C.strValue,H):(h(p(W?G:X),H),!W&&null!=J&&v(J,H))}}for(var oe=[Tn,Gn],ce=0;ce<a.length;ce++){var le=e.styleKeys[a[ce]];oe[0]=ma(le[0],oe[0]),oe[1]=ba(le[1],oe[1])}e.styleKey=function(e,t){return 2097152*e+t}(oe[0],oe[1]);var ge=e.styleKeys;e.labelDimsKey=sn(ge.labelDimensions);var Te=i(r,["label"],ge.labelDimensions);if(e.labelKey=sn(Te),e.labelStyleKey=sn(ti(ge.commonLabel,Te)),!o){var Ie=i(r,["source-label"],ge.labelDimensions);e.sourceLabelKey=sn(Ie),e.sourceLabelStyleKey=sn(ti(ge.commonLabel,Ie));var ye=i(r,["target-label"],ge.labelDimensions);e.targetLabelKey=sn(ye),e.targetLabelStyleKey=sn(ti(ge.commonLabel,ye))}if(o){var we=e.styleKeys,at=we.pie,Ye=we.stripe,xe=[we.nodeBody,we.nodeBorder,we.nodeOutline,we.backgroundImage,we.compound,at,Ye].filter(function(Ce){return null!=Ce}).reduce(ti,[Tn,Gn]);e.nodeKey=sn(xe),e.hasPie=null!=at&&at[0]!==Tn&&at[1]!==Gn,e.hasStripe=null!=Ye&&Ye[0]!==Tn&&Ye[1]!==Gn}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(Be){return null==Be?null:null!=Be.pfValue?Be.pfValue:Be.value},v=function(){var Be=h(u),Ue=h(n);t.checkTriggers(r,n.name,Be,Ue)};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 w=function(){Gt("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,E=0;E<p.length&&g;E++)g=g[p[E]];if(null==g)return w(),!1;var M;if(!tt(g))return Gt("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+g+"` for `"+r.id()+"` is non-numeric)"),!1;var V=n.fieldMax-n.fieldMin;if((M=0===V?0:(g-n.fieldMin)/V)<0?M=0:M>1&&(M=1),o.color){var H=n.valueMin[0],X=n.valueMin[1],W=n.valueMax[1],$=n.valueMin[2],Z=n.valueMax[2],J=null==n.valueMin[3]?1:n.valueMin[3],Q=null==n.valueMax[3]?1:n.valueMax[3],oe=[Math.round(H+(n.valueMax[0]-H)*M),Math.round(X+(W-X)*M),Math.round($+(Z-$)*M),Math.round(J+(Q-J)*M)];i={bypass:n.bypass,name:n.name,value:oe,strValue:"rgb("+oe[0]+", "+oe[1]+", "+oe[2]+")"}}else{if(!o.number)return!1;i=this.parse(n.name,n.valueMin+(n.valueMax-n.valueMin)*M,n.bypass,f)}if(!i)return w(),!1;i.mapping=n,n=i;break;case s.data:for(var de=n.field.split("."),le=d.data,ge=0;ge<de.length&&le;ge++)le=le[de[ge]];if(null!=le&&(i=this.parse(n.name,le,n.bypass,f)),!i)return w(),!1;i.mapping=n,n=i;break;case s.fn:var ye=null!=n.fnValue?n.fnValue:(0,n.value)(r);if(n.prevFnValue=ye,null==ye)return Gt("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+r.id()+"` is null)"),!1;if(!(i=this.parse(n.name,ye,n.bypass,f)))return Gt("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=zr(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,w=null!=f.next?f.next:d,p=!1,g=void 0,E=1e-6;v&&(tt(v.pfValue)&&tt(w.pfValue)?g=v.pfValue+E*(p=w.pfValue-v.pfValue):tt(v.value)&&tt(w.value)?g=v.value+E*(p=w.value-v.value):Yt(v.value)&&Yt(w.value)&&(p=v.value[0]!==w.value[0]||v.value[1]!==w.value[1]||v.value[2]!==w.value[2],g=v.strValue),p&&(o[c]=w.strValue,this.applyBypass(r,c,g),l=!0))}}if(!l)return;n.transitioning=!0,new qn(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)}},Pa={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(vt(e)){var d=this.parse(e,t,!0);d&&i.push(d)}else{if(!kt(e))return!1;var f=e;n=t;for(var h=Object.keys(f),v=0;v<h.length;v++){var w=h[v],p=f[w];if(void 0===p&&(p=f[Za(w)]),void 0!==p){var g=this.parse(w,p,!0);g&&i.push(g)}}}if(0===i.length)return!1;for(var E=!1,C=0;C<r.length;C++){for(var M=r[C],V={},H=void 0,G=0;G<i.length;G++){var X=i[G];if(n){var W=M.pstyle(X.name);H=V[X.name]={prev:W}}E=this.applyParsedProperty(M,zr(X))||E,n&&(H.next=M.pstyle(X.name))}E&&this.updateStyleHints(M),n&&this.updateTransitions(M,V,!0)}return E},overrideBypass:function(r,e,t){e=rs(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)}}},$o={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)}},Vr={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[Za(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&&tt(o)){var c=r.cy().zoom(),d=function(p){return p*c},f=function(p,g){return d(p)+g},h=Yt(o);return(h?l.every(function(w){return null!=w}):null!=l)?h?o.map(function(w,p){return f(w,l[p])}).join(" "):f(o,l):h?o.map(function(w){return vt(w)?w:""+d(w)}).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=kt(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[rs(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]=ma(o,n[0]),n[1]=ba(o,n[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),n[0]=ma(o,n[0]),n[1]=ba(o,n[1]);return n}};Vr.getPropertiesHash=Vr.getNonDefaultPropertiesHash;var Pi={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}},Ko={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){Gt("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 fn(d).invalid)Gt("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),o();else{var h=c[2],v=!1;i=h;for(var w=[];!i.match(/^\s*$/);){var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Gt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),v=!0;break}s=g[0];var E=g[1],C=g[2];this.properties[E]?t.parse(E,C)?(w.push({name:E,val:C}),l()):(Gt("Skipping property: Invalid property definition in: "+s),l()):(Gt("Skipping property: Invalid property name in: "+s),l())}if(v){o();break}t.selector(d);for(var H=0;H<w.length;H++){var G=w[H];t.css(G.name,G.val)}o()}}return t},fromString:function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e}},rr={};(function(){var r=ir,e=fh,t=vh,i=function(Ce){return"^"+Ce+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(Ce){var Ae=r+"|\\w+|"+e+"|"+t+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+Ce+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+Ae+")\\s*\\,\\s*("+Ae+")\\)$"},o=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];rr.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","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes: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(Ce,Ae){switch(Ce.length){case 2:return"deg"!==Ae[0]&&"rad"!==Ae[0]&&"deg"!==Ae[1]&&"rad"!==Ae[1];case 1:return vt(Ce[0])||"deg"===Ae[0]||"rad"===Ae[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(Ce){var Ae=Ce.length;return 1===Ae||2===Ae||4===Ae}}};var l={zeroNonZero:function(Ce,Ae){return(null==Ce||null==Ae)&&Ce!==Ae||0==Ce&&0!=Ae||0!=Ce&&0==Ae},any:function(Ce,Ae){return Ce!=Ae},emptyNonEmpty:function(Ce,Ae){var Ve=nn(Ce),rt=nn(Ae);return Ve&&!rt||!Ve&&rt}},u=rr.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:"box-select-labels",type:u.bool,triggersBounds:l.any}],w=[{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(Ce,Ae,Ve){return Ce!==Ae&&"bezier"===Ve.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}],E=[{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}],M=function(Ce,Ae){return"label"===Ae.value?-Ce.poolIndex():Ae.pfValue},V=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:M},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:M},{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}],G=[{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}],X=[{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}],W=[{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}],$=[{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(Ce,Ae){return Ce!==Ae&&("bezier"===Ce||"bezier"===Ae)}},{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}],Z=[{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}],J=[{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}],Q=[];rr.pieBackgroundN=16,Q.push({name:"pie-size",type:u.sizeMaybePercent}),Q.push({name:"pie-hole",type:u.sizeMaybePercent}),Q.push({name:"pie-start-angle",type:u.angle});for(var oe=1;oe<=rr.pieBackgroundN;oe++)Q.push({name:"pie-"+oe+"-background-color",type:u.color}),Q.push({name:"pie-"+oe+"-background-size",type:u.percent}),Q.push({name:"pie-"+oe+"-background-opacity",type:u.zeroOneNumber});var ce=[];rr.stripeBackgroundN=16,ce.push({name:"stripe-size",type:u.sizeMaybePercent}),ce.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var de=1;de<=rr.stripeBackgroundN;de++)ce.push({name:"stripe-"+de+"-background-color",type:u.color}),ce.push({name:"stripe-"+de+"-background-size",type:u.percent}),ce.push({name:"stripe-"+de+"-background-opacity",type:u.zeroOneNumber});var le=[],ge=rr.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(xe){ge.forEach(function(Ce){le.push({name:Ce+"-"+xe.name,type:xe.type,triggersBounds:xe.triggersBounds})})},{});var Te=rr.properties=[].concat(w,C,p,g,E,Z,v,h,c,d,f,V,H,G,X,Q,ce,W,$,le,J),Ie=rr.propertyGroups={behavior:w,transition:C,visibility:p,overlay:g,underlay:E,ghost:Z,commonLabel:v,labelDimensions:h,mainLabel:c,sourceLabel:d,targetLabel:f,nodeBody:V,nodeBorder:H,nodeOutline:G,backgroundImage:X,pie:Q,stripe:ce,compound:W,edgeLine:$,edgeArrow:le,core:J},ye=rr.propertyGroupNames={};(rr.propertyGroupKeys=Object.keys(Ie)).forEach(function(xe){ye[xe]=Ie[xe].map(function(Ce){return Ce.name}),Ie[xe].forEach(function(Ce){return Ce.groupKey=xe})});var Be=rr.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"}];rr.propertyNames=Te.map(function(xe){return xe.name});for(var Ue=0;Ue<Te.length;Ue++){var Fe=Te[Ue];Te[Fe.name]=Fe}for(var qe=0;qe<Be.length;qe++){var Je=Be[qe],Ye={name:Je.name,alias:!0,pointsTo:Te[Je.pointsTo]};Te.push(Ye),Te[Je.name]=Ye}})(),rr.getDefaultProperty=function(r){return this.getDefaultProperties()[r]},rr.getDefaultProperties=function(){var r=this._private;if(null!=r.defaultProperties)return r.defaultProperties;for(var e=bt({"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","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<=rr.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<=rr.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 rr.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},rr.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 ki={parse:function(r,e,t,n){var a=this;if(Jt(e))return a.parseImplWarn(r,e,t,n);var c,l=eu(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=zr(c))&&(c.value=zr(c.value)),c},parseImplWarn:function(r,e,t,n){var a=this.parseImpl(r,e,t,n);return!a&&null!=e&&Gt("The style property `".concat(r,": ").concat(e,"` is invalid")),a&&("width"===a.name||"height"===a.name)&&"label"===e&&Gt("The style value of `label` is deprecated for `"+a.name+"`"),a},parseImpl:function(r,e,t,n){var a=this;r=rs(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=vt(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(Jt(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 w=this.parse(r,d[5]);if(!w||w.mapped)return!1;if(v.pfValue===w.pfValue||v.strValue===w.strValue)return Gt("`"+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=w.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:w.value,bypass:t}}}if(u.multiple&&"multiple"!==n){var C;if(C=l?e.split(/\s+/):Yt(e)?e:[e],u.evenMultiple&&C.length%2!=0)return null;for(var M=[],V=[],H=[],G="",X=!1,W=0;W<C.length;W++){var $=a.parse(r,C[W],t,"multiple");X=X||vt($.value),M.push($.value),H.push(null!=$.pfValue?$.pfValue:$.value),V.push($.units),G+=(W>0?" ":"")+$.strValue}return u.validate&&!u.validate(M,V)?null:u.singleEnum&&X?1===M.length&&vt(M[0])?{name:r,value:M[0],strValue:M[0],bypass:t}:null:{name:r,value:M,pfValue:H,strValue:G,bypass:t,units:V}}var Z=function(){for(var Ye=0;Ye<u.enums.length;Ye++)if(u.enums[Ye]===e)return{name:r,value:e,strValue:""+e,bypass:t};return null};if(u.number){var J,Q="px";if(u.units&&(J=u.units),u.implicitUnits&&(Q=u.implicitUnits),!u.unitless)if(l){var oe="px|em"+(u.allowPercent?"|\\%":"");J&&(oe=J);var ce=e.match("^("+ir+")("+oe+")?$");ce&&(e=ce[1],J=ce[2]||Q)}else(!J||u.implicitUnits)&&(J=Q);if(e=parseFloat(e),isNaN(e)&&void 0===u.enums)return null;if(isNaN(e)&&void 0!==u.enums)return e=s,Z();if(u.integer&&!function(e){return tt(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 de={name:r,value:e,strValue:""+e+(J||""),units:J,bypass:t};return de.pfValue=u.unitless||"px"!==J&&"em"!==J?e:"px"!==J&&J?this.getEmSizeInPixels()*e:e,("ms"===J||"s"===J)&&(de.pfValue="ms"===J?e:1e3*e),("deg"===J||"rad"===J)&&(de.pfValue="rad"===J?e:function(e){return Math.PI*e/180}(e)),"%"===J&&(de.pfValue=e/100),de}if(u.propList){var le=[],ge=""+e;if("none"!==ge){for(var Te=ge.split(/\s*,\s*|\s+/),Ie=0;Ie<Te.length;Ie++){var ye=Te[Ie].trim();a.properties[ye]?le.push(ye):Gt("`"+ye+"` is not a valid property name")}if(0===le.length)return null}return{name:r,value:le,strValue:0===le.length?"none":le.join(" "),bypass:t}}if(u.color){var we=Ml(e);return we?{name:r,value:we,pfValue:we,strValue:"rgb("+we[0]+","+we[1]+","+we[2]+")",bypass:t}:null}if(u.regex||u.regexes){if(u.enums){var Be=Z();if(Be)return Be}for(var Ue=u.regexes?u.regexes:[u.regex],Fe=0;Fe<Ue.length;Fe++){var Je=new RegExp(Ue[Fe]).exec(e);if(Je)return{name:r,value:u.singleRegexMatchValue?Je[1]:Je,strValue:""+e,bypass:t}}return null}return u.string?{name:r,value:""+e,strValue:""+e,bypass:t}:u.enums?Z():null}},dr=function(e){if(!(this instanceof dr))return new dr(e);ts(e)?(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):Kt("A style must have a core reference")},br=dr.prototype;br.instanceString=function(){return"style"},br.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},br.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},br.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)},br.selector=function(r){var e="core"===r?null:new fn(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this},br.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[Za(a.name)]),void 0!==i&&this.cssRule(a.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},br.style=br.css,br.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},br.append=function(r){return Ll(r)?r.appendToStyle(this):Yt(r)?this.appendFromJson(r):vt(r)&&this.appendFromString(r),this},dr.fromJson=function(r,e){var t=new dr(r);return t.fromJson(e),t},dr.fromString=function(r,e){return new dr(r).fromString(e)},[cr,Pa,$o,Vr,Pi,Ko,rr,ki].forEach(function(r){bt(br,r)}),dr.types=br.types,dr.properties=br.properties,dr.propertyGroups=br.propertyGroups,dr.propertyGroupNames=br.propertyGroupNames,dr.propertyGroupKeys=br.propertyGroupKeys;var by={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return t.style=Ll(e)?e.generateStyle(this):Yt(e)?dr.fromJson(this,e):vt(e)?dr.fromString(this,e):dr(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},An={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(vt(e[0]))return t[n=e[0]];if(kt(e[0])){if(!this._private.panningEnabled)return this;o=(i=e[0]).y,tt(s=i.x)&&(t.x=s),tt(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)&&tt(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:kt(e)&&(u=(o=n[0]).y,tt(l=o.x)&&(a.x+=l),tt(u)&&(a.y+=u),this.emit("pan viewport"));break;case 2:s=t,("x"===(i=e)||"y"===i)&&tt(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((tt(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled)&&(vt(e)?e=this.$(e):!function(e){return kt(e)&&tt(e.x1)&&tt(e.x2)&&tt(e.y1)&&tt(e.y2)}(e)?Rr(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),!Rr(e)||!e.empty())){n=n||e.boundingBox();var l,s=this.width(),o=this.height();if(t=tt(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 tt(e)&&tt(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):tt(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:tt(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),tt(e)?s=e:kt(e)&&(s=e.level,null!=e.position?i=ii(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&&tt(s)&&s!==a&&(null==i||tt(i.x)&&tt(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(tt(e.zoom)||(n=!1),kt(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;tt(u.x)&&(t.pan.x=u.x,o=!1),tt(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(vt(e)){var n=e;e=this.mutableElements().filter(n)}else Rr(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}};An.centre=An.center,An.autolockNodes=An.autolock,An.autoungrabifyNodes=An.autoungrabify;var ka={data:zt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:zt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:zt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:zt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ka.attr=ka.data,ka.removeAttr=ka.removeData;var _a=function(e){var t=this,n=(e=bt({},e)).container;n&&!Ka(n)&&Ka(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!==Zt&&void 0!==n&&!e.headless,o=e;o.layout=bt({name:s?"grid":"null"},o.layout),o.renderer=bt({name:s?"canvas":"null"},o.renderer);var l=function(v,w,p){return void 0!==w?w:void 0!==p?p:v},u=this._private={container:n,ready:!1,options:o,elements:new gr(this),listeners:[],aniEles:new gr(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:tt(o.zoom)?o.zoom:1,pan:{x:kt(o.pan)&&tt(o.pan.x)?o.pan.x:0,y:kt(o.pan)&&tt(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=bt({},o,o.renderer);t.initRenderer(d),function(v,w){if(v.some(uh))return qn.all(v).then(w);w(v)}([o.style,o.elements],function(h){var v=h[0],w=h[1];u.styleEnabled&&t.style().append(v),function(v,w,p){t.notifications(!1);var g=t.mutableElements();g.length>0&&g.remove(),null!=v&&(kt(v)||Yt(v))&&t.add(v),t.one("layoutready",function(C){t.notifications(!0),t.emit(C),t.one("load",w),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var E=bt({},t._private.options.layout);E.eles=t.elements(),t.layout(E).run()}(w,function(){t.startAnimationLoop(),u.ready=!0,Jt(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)})},_i=_a.prototype;bt(_i,{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 Zt;var t=this._private.container.ownerDocument;return void 0===t||null==t?Zt:t.defaultView||Zt},mount:function(e){if(null!=e){var t=this,n=t._private,a=n.options;return!Ka(e)&&Ka(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(bt({},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 zr(this._private.options)},json:function(e){var t=this,n=t._private,a=t.mutableElements();if(kt(e)){if(t.startBatch(),e.elements){var s={},o=function(M,V){for(var H=[],G=[],X=0;X<M.length;X++){var W=M[X];if(W.data.id){var $=""+W.data.id,Z=t.getElementById($);s[$]=!0,0!==Z.length?G.push({ele:Z,json:W}):(V&&(W.group=V),H.push(W))}else Gt("cy.json() cannot handle elements without an ID attribute")}t.add(H);for(var J=0;J<G.length;J++){var Q=G[J];Q.ele.json(Q.json)}};if(Yt(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];Yt(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(M=C,t.getElementById(M.id())).remove();var M})}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 w=h[v];null!=e[w]&&t[w](e[w])}return t.endBatch(),this}var g={};e?g.elements=this.elements().map(function(C){return C.json()}):(g.elements={},a.forEach(function(C){var M=C.group();g.elements[M]||(g.elements[M]=[]),g.elements[M].push(C.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=zr(t.data());var E=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=zr(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=zr(E.renderer),g.hideEdgesOnViewport=E.hideEdgesOnViewport,g.textureOnViewport=E.textureOnViewport,g.wheelSensitivity=E.wheelSensitivity,g.motionBlur=E.motionBlur,g.multiClickDebounceTime=E.multiClickDebounceTime,g}}),_i.$id=_i.getElementById,[uy,vy,Id,qo,Mi,py,Wo,Oi,by,An,ka].forEach(function(r){bt(_i,r)});var wy={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}},Ey={maximal:!1,acyclic:!1},ta=function(e){return e.scratch("breadthfirst")},Ld=function(e,t){return e.scratch("breadthfirst",t)};function Ad(r){this.options=bt({},wy,Ey,r)}Ad.prototype.run=function(){var u,r=this.options,e=r.cy,t=r.eles,n=t.nodes().filter(function(mt){return mt.isChildless()}),a=t,i=r.directed,s=r.acyclic||r.maximal||r.maximalAdjustments>0,o=!!r.boundingBox,l=Er(o?r.boundingBox:structuredClone(e.extent()));if(Rr(r.roots))u=r.roots;else if(Yt(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(vt(r.roots))u=e.$(r.roots);else if(i)u=n.roots();else{var v=t.components();u=e.collection();for(var w=function(){var it=v[p],ht=it.maxDegree(!1),gt=it.filter(function(Ct){return Ct.degree(!1)===ht});u=u.add(gt)},p=0;p<v.length;p++)w()}var g=[],E={},C=function(it,ht){null==g[ht]&&(g[ht]=[]);var gt=g[ht].length;g[ht].push(it),Ld(it,{index:gt,depth:ht})};a.bfs({roots:u,directed:r.directed,visit:function(it,ht,gt,Ct,yt){var At=it[0],Pt=At.id();At.isChildless()&&C(At,yt),E[Pt]=!0}});for(var V=[],H=0;H<n.length;H++){var G=n[H];E[G.id()]||V.push(G)}var X=function(it){for(var ht=g[it],gt=0;gt<ht.length;gt++){var Ct=ht[gt];null!=Ct?Ld(Ct,{depth:it,index:gt}):(ht.splice(gt,1),gt--)}},W=function(it,ht){for(var gt=ta(it),Ct=it.incomers().filter(function(Tt){return Tt.isNode()&&t.has(Tt)}),yt=-1,At=it.id(),Pt=0;Pt<Ct.length;Pt++){var Ht=ta(Ct[Pt]);yt=Math.max(yt,Ht.depth)}if(gt.depth<=yt){if(!r.acyclic&&ht[At])return null;var Ut=yt+1;return function(it,ht){var gt=ta(it);g[gt.depth][gt.index]=null,it.isChildless()&&C(it,ht)}(it,Ut),ht[At]=Ut,!0}return!1};if(i&&s){var $=[],Z={},J=function(it){return $.push(it)},Q=function(){return $.shift()};for(n.forEach(function(mt){return $.push(mt)});$.length>0;){var oe=Q(),ce=W(oe,Z);if(ce)oe.outgoers().filter(function(mt){return mt.isNode()&&t.has(mt)}).forEach(J);else if(null===ce){Gt("Detected double maximal shift for node `"+oe.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var de=0;if(r.avoidOverlap)for(var le=0;le<n.length;le++){var Te=n[le].layoutDimensions(r);de=Math.max(de,Te.w,Te.h)}var we={},Be=function(it){if(we[it.id()])return we[it.id()];for(var ht=ta(it).depth,gt=it.neighborhood(),Ct=0,yt=0,At=0;At<gt.length;At++){var Pt=gt[At];if(!Pt.isEdge()&&!Pt.isParent()&&n.has(Pt)){var Vt=ta(Pt);if(null!=Vt){var Ht=Vt.index,Ut=Vt.depth;null!=Ht&&null!=Ut&&Ut<ht&&(Ct+=Ht/g[Ut].length,yt++)}}}return Ct/=yt=Math.max(1,yt),0===yt&&(Ct=0),we[it.id()]=Ct,Ct},Ue=function(it,ht){var yt=Be(it)-Be(ht);return 0===yt?Nl(it.id(),ht.id()):yt};void 0!==r.depthSort&&(Ue=r.depthSort);for(var Fe=g.length,qe=0;qe<Fe;qe++)g[qe].sort(Ue),X(qe);for(var Je=[],at=0;at<V.length;at++)Je.push(V[at]);Je.length&&(g.unshift(Je),Fe=g.length,function(){for(var it=0;it<Fe;it++)X(it)}());for(var xe=0,Ce=0;Ce<Fe;Ce++)xe=Math.max(g[Ce].length,xe);var Ae_x=l.x1+l.w/2,Ae_y=l.y1+l.h/2,Ve=n.reduce(function(mt,it){return ht=it.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}),{w:-1===mt.w?ht.w:(mt.w+ht.w)/2,h:-1===mt.h?ht.h:(mt.h+ht.h)/2};var ht},{w:-1,h:-1}),rt=Math.max(1===Fe?0:o?(l.h-2*r.padding-Ve.h)/(Fe-1):(l.h-2*r.padding-Ve.h)/(Fe+1),de),ft=g.reduce(function(mt,it){return Math.max(mt,it.length)},0),St={downward:0,leftward:90,upward:180,rightward:-90};return-1===Object.keys(St).indexOf(r.direction)&&Kt("Invalid direction '".concat(r.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(St).join(", "))),t.nodes().layoutPositions(this,r,function(it){return function Fh(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 _h(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(it){var ht=ta(it),gt=ht.depth,Ct=ht.index;if(r.circle){var yt=Math.min(l.w/2/Fe,l.h/2/Fe),At=(yt=Math.max(yt,de))*gt+yt-(Fe>0&&g[0].length<=3?yt/2:0),Pt=2*Math.PI/g[gt].length*Ct;return 0===gt&&1===g[0].length&&(At=1),{x:Ae_x+At*Math.cos(Pt),y:Ae_y+At*Math.sin(Pt)}}var Vt=g[gt].length,Ht=Math.max(1===Vt?0:o?(l.w-2*r.padding-Ve.w)/((r.grid?ft:Vt)-1):(l.w-2*r.padding-Ve.w)/((r.grid?ft:Vt)+1),de);return{x:Ae_x+(Ct+1-(Vt+1)/2)*Ht,y:Ae_y+(gt+1-(Fe+1)/2)*rt}}(it),l,St[r.direction])}),this};var Ty={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 Rd(r){this.options=bt({},Ty,r)}Rd.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=Er(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=tt(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),E=Math.sin(u)-Math.sin(0),C=Math.sqrt(d*d/(g*g+E*E));c=Math.max(C,c)}return n.nodes().layoutPositions(this,e,function(H,G){var X=e.startAngle+G*u*(a?1:-1),W=c*Math.cos(X),$=c*Math.sin(X);return{x:o.x+W,y:o.y+$}}),this};var Cy={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 Nd(r){this.options=bt({},Cy,r)}Nd.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=Er(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 w=i[h].layoutDimensions(e);u=Math.max(u,w.w,w.h)}l.sort(function(rt,ft){return ft.value-rt.value});for(var p=e.levelWidth(i),g=[[]],E=g[0],C=0;C<l.length;C++){var M=l[C];E.length>0&&Math.abs(E[0].value-M.value)>=p&&g.push(E=[]),E.push(M)}var H=u+e.minNodeSpacing;if(!e.avoidOverlap){var G=g.length>0&&g[0].length>1,X=Math.min(s.w,s.h)/2-H;H=Math.min(H,X/(g.length+G?1:0))}for(var $=0,Z=0;Z<g.length;Z++){var J=g[Z],Q=void 0===e.sweep?2*Math.PI-2*Math.PI/J.length:e.sweep,oe=J.dTheta=Q/Math.max(1,J.length-1);if(J.length>1&&e.avoidOverlap){var ce=Math.cos(oe)-Math.cos(0),de=Math.sin(oe)-Math.sin(0),le=Math.sqrt(H*H/(ce*ce+de*de));$=Math.max(le,$)}J.r=$,$+=H}if(e.equidistant){for(var ge=0,Te=0,Ie=0;Ie<g.length;Ie++)ge=Math.max(ge,g[Ie].r-Te);Te=0;for(var Be=0;Be<g.length;Be++){var Ue=g[Be];0===Be&&(Te=Ue.r),Ue.r=Te,Te+=ge}}for(var Fe={},qe=0;qe<g.length;qe++)for(var Je=g[qe],at=Je.dTheta,Ye=Je.r,xe=0;xe<Je.length;xe++){var Ce=Je[xe],Ae=e.startAngle+(t?1:-1)*at*xe,Ve={x:o.x+Ye*Math.cos(Ae),y:o.y+Ye*Math.sin(Ae)};Fe[Ce.node.id()]=Ve}return a.nodes().layoutPositions(this,e,function(rt){var ft=rt.id();return Fe[ft]}),this};var Zo,Dy={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 Bi(r){this.options=bt({},Dy,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)}Bi.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}),Zo=!0===r.debug;var n=Sy(e,t,r);Zo&&(void 0)(n),r.randomize&&Ay(n);var a=qr(),i=function(){Ry(n,e,r),!0===r.fit&&e.fit(r.padding)},s=function(f){return!(t.stopped||f>=r.numIter||(Ny(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=Od(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?(qr()-a>=r.animationThreshold&&i(),ei(c)):(_d(n,r),o())};c()}else{for(;u;)u=s(l),l++;_d(n,r),o()}return this},Bi.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Bi.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Sy=function(e,t,n){for(var a=n.eles.edges(),i=n.eles.nodes(),s=Er(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 w=(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=w.w,p.width=w.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=Jt(n.nodeRepulsion)?n.nodeRepulsion(v):n.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=c}var g=[],E=0,C=-1,M=[];for(c=0;c<o.nodeSize;c++){var v,V=(v=o.layoutNodes[c]).parentId;null!=V?o.layoutNodes[o.idToIndex[V]].children.push(v.id):(g[++C]=v.id,M.push(v.id))}for(o.graphSet.push(M);E<=C;){var H=g[E++],X=o.layoutNodes[o.idToIndex[H]].children;if(X.length>0)for(o.graphSet.push(X),c=0;c<X.length;c++)g[++C]=X[c]}for(c=0;c<o.graphSet.length;c++){var W=o.graphSet[c];for(f=0;f<W.length;f++)o.indexToGraph[o.idToIndex[W[f]]]=c}for(c=0;c<o.edgeSize;c++){var Z=a[c],J={};J.id=Z.data("id"),J.sourceId=Z.data("source"),J.targetId=Z.data("target");var Q=Jt(n.idealEdgeLength)?n.idealEdgeLength(Z):n.idealEdgeLength,oe=Jt(n.edgeElasticity)?n.edgeElasticity(Z):n.edgeElasticity,ce=o.idToIndex[J.sourceId],de=o.idToIndex[J.targetId];if(o.indexToGraph[ce]!=o.indexToGraph[de]){for(var Te=Iy(J.sourceId,J.targetId,o),Ie=o.graphSet[Te],ye=0,p=o.layoutNodes[ce];-1===Ie.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],ye++;for(p=o.layoutNodes[de];-1===Ie.indexOf(p.id);)p=o.layoutNodes[o.idToIndex[p.parentId]],ye++;Q*=ye*n.nestingFactor}J.idealLength=Q,J.elasticity=oe,o.layoutEdges.push(J)}return o},Iy=function(e,t,n){var a=Md(e,t,0,n);return 2>a.count?0:a.graph},Md=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=Md(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}},Ay=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)}},Od=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}}},Ry=function(e,t,n){var a=n.layout,i=n.eles.nodes(),s=Od(e,n,i);i.positions(s),!0!==e.ready&&(e.ready=!0,a.one("layoutready",n.ready),a.emit({type:"layoutready",layout:this}))},Ny=function(e,t,n){My(e,t),ky(e),_y(e,t),By(e),Fy(e)},My=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++)Oy(o,e.layoutNodes[e.idToIndex[a[l]]],e,t)},Pd=function(e){return 2*e*Math.random()-1},Oy=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=Pd(1),l=Pd(1));var c=Py(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,w=Fi(e,o,l),p=Fi(t,-1*o,-1*l),g=p.x-w.x,E=p.y-w.y,C=g*g+E*E,f=Math.sqrt(C);h=(d=(e.nodeRepulsion+t.nodeRepulsion)/C)*g/f,v=d*E/f}e.isLocked||(e.offsetX-=h,e.offsetY-=v),t.isLocked||(t.offsetX+=h,t.offsetY+=v)}},Py=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},Fi=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)},ky=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=Fi(s,u,c),f=Fi(l,-1*u,-1*c),h=f.x-d.x,v=f.y-d.y,w=Math.sqrt(h*h+v*v),p=Math.pow(a.idealLength-w,2)/a.elasticity;if(0!==w)var g=p*h/w,E=p*v/w;else g=0,E=0;s.isLocked||(s.offsetX+=g,s.offsetY+=E),l.isLocked||(l.offsetX-=g,l.offsetY-=E)}}},_y=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,w=Math.sqrt(h*h+v*v);if(w>1){var g=t.gravity*v/w;f.offsetX+=t.gravity*h/w,f.offsetY+=g}}}}},By=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}}},Fy=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=Gy(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,kd(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)}},Gy=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},kd=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 kd(a,t)}},_d=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(E,C){return C.w*C.h-E.w*E.h});var h=0,v=0,w=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,w+=c.w+t.componentSpacing,p=Math.max(p,c.h),w>g&&(v+=p+t.componentSpacing,h=0,w=0,p=0)}}},zy={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 Bd(r){this.options=bt({},zy,r)}Bd.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=Er(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(Be){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(Ue){if(null==Ue)return Math.min(l,u);Math.min(l,u)==l?l=Ue:u=Ue},d=function(Ue){if(null==Ue)return Math.max(l,u);Math.max(l,u)==l?l=Ue:u=Ue},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(),w=d();(v-1)*w>=s?c(v-1):(w-1)*v>=s&&d(w-1)}else for(;u*l<s;){var p=c(),g=d();(g+1)*p>=s?d(g+1):c(p+1)}var E=i.w/u,C=i.h/l;if(e.condense&&(E=0,C=0),e.avoidOverlap)for(var M=0;M<a.length;M++){var V=a[M],H=V._private.position;(null==H.x||null==H.y)&&(H.x=0,H.y=0);var G=V.layoutDimensions(e),X=e.avoidOverlapPadding,$=G.h+X;E=Math.max(E,G.w+X),C=Math.max(C,$)}for(var Z={},J=function(Ue,Fe){return!!Z["c-"+Ue+"-"+Fe]},Q=function(Ue,Fe){Z["c-"+Ue+"-"+Fe]=!0},oe=0,ce=0,de=function(){++ce>=u&&(ce=0,oe++)},le={},ge=0;ge<a.length;ge++){var Te=a[ge],Ie=e.position(Te);if(Ie&&(void 0!==Ie.row||void 0!==Ie.col)){var ye={row:Ie.row,col:Ie.col};if(void 0===ye.col)for(ye.col=0;J(ye.row,ye.col);)ye.col++;else if(void 0===ye.row)for(ye.row=0;J(ye.row,ye.col);)ye.row++;le[Te.id()]=ye,Q(ye.row,ye.col)}}a.layoutPositions(this,e,function(Ue,Fe){var qe,Je;if(Ue.locked()||Ue.isParent())return!1;var at=le[Ue.id()];if(at)qe=at.col*E+E/2+i.x1,Je=at.row*C+C/2+i.y1;else{for(;J(oe,ce);)de();qe=ce*E+E/2+i.x1,Je=oe*C+C/2+i.y1,Q(oe,ce),de()}return{x:qe,y:Je}})}return this};var Vy={ready:function(){},stop:function(){}};function Jo(r){this.options=bt({},Vy,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 Hy={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 Fd(r){this.options=bt({},Hy,r)}Fd.prototype.run=function(){var r=this.options,t=r.eles.nodes(),n=Jt(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 Uy={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 Gd(r){this.options=bt({},Uy,r)}Gd.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,n=Er(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 Xy=[{name:"breadthfirst",impl:Ad},{name:"circle",impl:Rd},{name:"concentric",impl:Nd},{name:"cose",impl:Bi},{name:"grid",impl:Bd},{name:"null",impl:Jo},{name:"preset",impl:Fd},{name:"random",impl:Gd}];function zd(r){this.options=r,this.notifications=0}var Vd=function(){},Hd=function(){throw new Error("A headless instance can not render images")};zd.prototype={recalculateRenderedStyle:Vd,notify:function(){this.notifications++},init:Vd,isHeadless:function(){return!0},png:Hd,jpg:Hd};var Qo={arrowShapeWidth:.3,registerArrowShapes:function(){var r=this.arrowShapes={},e=this,t=function(u,c,d,f,h,v,w){return h.x-d/2-w<=u&&u<=h.x+d/2+w&&h.y-d/2-w<=c&&c<=h.y+d/2+w},n=function(u,c,d,f,h){var v=u*Math.cos(f)-c*Math.sin(f),w=u*Math.sin(f)+c*Math.cos(f);return{x:v*d+h.x,y:w*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){vt(c)&&(c=r[c]),r[u]=bt({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(f,h,v,w,p,g){var E=i(a(this.points,v+2*g,w,p));return Ir(f,h,E)},roughCollide:t,draw:function(f,h,v,w){var p=a(this.points,h,v,w);e.arrowShapeImpl("polygon")(f,p)},spacing:function(f){return 0},gap:s},c)};o("none",{collide:ri,roughCollide:ri,draw:xs,spacing:nu,gap:nu}),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),w=this.controlPoint,p=n(w[0],w[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,w){var p=i(a(this.points,d+2*w,f,h)),g=i(a(this.pointsTee,d+2*w,f,h));return Ir(u,c,p)||Ir(u,c,g)},draw:function(u,c,d,f,h){var v=a(this.points,c,d,f),w=a(this.pointsTee,c,d,f);e.arrowShapeImpl(this.name)(u,v,w)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,c,d,f,h,v,w){var p=h,g=Math.pow(p.x-u,2)+Math.pow(p.y-c,2)<=Math.pow((d+2*w)*this.radius,2),E=i(a(this.points,d+2*w,f,h));return Ir(u,c,E)||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,w){var p=i(a(this.points,d+2*w,f,h)),g=i(a(this.crossLinePts(d,v),d+2*w,f,h));return Ir(u,c,p)||Ir(u,c,g)},draw:function(u,c,d,f,h){var v=a(this.points,c,d,f),w=a(this.crossLinePts(c,h),c,d,f);e.arrowShapeImpl(this.name)(u,v,w)}}),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,w){var p=h;return Math.pow(p.x-u,2)+Math.pow(p.y-c,2)<=Math.pow((d+2*w)*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}})}},Rn={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,w,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(G,X){if(G.isNode()){if(w)return;w=G,o.push(G)}if(G.isEdge()&&(null==X||X<h))if(v){if(v.pstyle("z-compound-depth").value===G.pstyle("z-compound-depth").value&&v.pstyle("z-compound-depth").value===G.pstyle("z-compound-depth").value)for(var W=0;W<o.length;W++)if(o[W].isEdge()){o[W]=G,v=G,h=X??h;break}}else o.push(G),v=G,h=X??h}function g(G){var X=G.outerWidth()+2*d,W=G.outerHeight()+2*d,$=X/2,Z=W/2,J=G.position(),Q="auto"===G.pstyle("corner-radius").value?"auto":G.pstyle("corner-radius").pfValue,oe=G._private.rscratch;if(J.x-$<=r&&r<=J.x+$&&J.y-Z<=e&&e<=J.y+Z&&i.nodeShapes[a.getNodeShape(G)].checkPoint(r,e,0,X,W,J.x,J.y,Q,oe))return p(G,0),!0}function E(G){var ce,X=G._private,W=X.rscratch,$=G.pstyle("width").pfValue,Z=G.pstyle("arrow-scale").value,J=$/2+c,Q=J*J,oe=2*J,ge=X.source,Te=X.target;if("segments"===W.edgeType||"straight"===W.edgeType||"haystack"===W.edgeType){for(var de=W.allpts,le=0;le+3<de.length;le+=2)if(Cv(r,e,de[le],de[le+1],de[le+2],de[le+3],oe)&&Q>(ce=Av(r,e,de[le],de[le+1],de[le+2],de[le+3])))return p(G,ce),!0}else if("bezier"===W.edgeType||"multibezier"===W.edgeType||"self"===W.edgeType||"compound"===W.edgeType)for(de=W.allpts,le=0;le+5<W.allpts.length;le+=4)if(Dv(r,e,de[le],de[le+1],de[le+2],de[le+3],de[le+4],de[le+5],oe)&&Q>(ce=Lv(r,e,de[le],de[le+1],de[le+2],de[le+3],de[le+4],de[le+5])))return p(G,ce),!0;ge=ge||X.source,Te=Te||X.target;var Ie=a.getArrowWidth($,Z),ye=[{name:"source",x:W.arrowStartX,y:W.arrowStartY,angle:W.srcArrowAngle},{name:"target",x:W.arrowEndX,y:W.arrowEndY,angle:W.tgtArrowAngle},{name:"mid-source",x:W.midX,y:W.midY,angle:W.midsrcArrowAngle},{name:"mid-target",x:W.midX,y:W.midY,angle:W.midtgtArrowAngle}];for(le=0;le<ye.length;le++){var we=ye[le],Be=i.arrowShapes[G.pstyle(we.name+"-arrow-shape").value],Ue=G.pstyle("width").pfValue;if(Be.roughCollide(r,e,Ie,we.angle,{x:we.x,y:we.y},Ue,c)&&Be.collide(r,e,Ie,we.angle,{x:we.x,y:we.y},Ue,c))return p(G),!0}u&&o.length>0&&(g(ge),g(Te))}function C(G,X,W){return Sr(G,X,W)}function M(G,X){var Z,W=G._private,$=f;Z=X?X+"-":"",G.boundingBox();var J=W.labelBounds[X||"main"],Q=G.pstyle(Z+"label").value;if("yes"===G.pstyle("text-events").strValue&&Q){var ce=C(W.rscratch,"labelX",X),de=C(W.rscratch,"labelY",X),le=C(W.rscratch,"labelAngle",X),ge=G.pstyle(Z+"text-margin-x").pfValue,Te=G.pstyle(Z+"text-margin-y").pfValue,Ie=J.x1-$-ge,ye=J.x2+$-ge,we=J.y1-$-Te,Be=J.y2+$-Te;if(le){var Ue=Math.cos(le),Fe=Math.sin(le),qe=function(Ve,rt){return{x:(Ve-=ce)*Ue-(rt-=de)*Fe+ce,y:Ve*Fe+rt*Ue+de}},Je=qe(Ie,we),at=qe(Ie,Be),Ye=qe(ye,we),xe=qe(ye,Be);if(Ir(r,e,[Je.x+ge,Je.y+Te,Ye.x+ge,Ye.y+Te,xe.x+ge,xe.y+Te,at.x+ge,at.y+Te]))return p(G),!0}else if(ln(J,r,e))return p(G),!0}}t&&(s=s.interactive);for(var V=s.length-1;V>=0;V--){var H=s[V];H.isNode()?g(H)||M(H):E(H)||M(H)||M(H,"source")||M(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=Er({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 w(Ve,rt,ft){return Sr(Ve,rt,ft)}function p(Ve,rt){var ft=Ve._private,Ot=s;Ve.boundingBox();var wt=ft.labelBounds.main;if(!wt)return null;var mt=w(ft.rscratch,"labelX",rt),it=w(ft.rscratch,"labelY",rt),ht=w(ft.rscratch,"labelAngle",rt),gt=Ve.pstyle("text-margin-x").pfValue,Ct=Ve.pstyle("text-margin-y").pfValue,yt=wt.x1-Ot-gt,At=wt.x2+Ot-gt,Pt=wt.y1-Ot-Ct,Vt=wt.y2+Ot-Ct;if(ht){var Ht=Math.cos(ht),Ut=Math.sin(ht),Tt=function(Ge,j){return{x:(Ge-=mt)*Ht-(j-=it)*Ut+mt,y:Ge*Ut+j*Ht+it}};return[Tt(yt,Pt),Tt(At,Pt),Tt(At,Vt),Tt(yt,Vt)]}return[{x:yt,y:Pt},{x:At,y:Pt},{x:At,y:Vt},{x:yt,y:Vt}]}function g(Ve,rt,ft,Ot){function St(wt,mt,it){return(it.y-wt.y)*(mt.x-wt.x)>(mt.y-wt.y)*(it.x-wt.x)}return St(Ve,ft,Ot)!==St(rt,ft,Ot)&&St(Ve,rt,ft)!==St(Ve,rt,Ot)}for(var E=0;E<a.length;E++){var C=a[E];if(C.isNode()){var M=C,V="yes"===M.pstyle("text-events").strValue,H=M.pstyle("box-selection").strValue,G="yes"===M.pstyle("box-select-labels").strValue;if("none"===H)continue;var W=M.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:("overlap"===H||G)&&V});if("contain"===H){var $=!1;if(G&&V){var Z=p(M);Z&&Ms(Z,h)&&(o.push(M),$=!0)}!$&&vu(f,W)&&o.push(M)}else if("overlap"===H&&Is(f,W)){var J=M.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(Ms([{x:J.x1,y:J.y1},{x:J.x2,y:J.y1},{x:J.x2,y:J.y2},{x:J.x1,y:J.y2}],h))o.push(M);else{var oe=p(M);oe&&Ms(oe,h)&&o.push(M)}}}else{var ce=C,de=ce._private,le=de.rscratch,ge=ce.pstyle("box-selection").strValue;if("none"===ge)continue;if("contain"===ge){if(null!=le.startX&&null!=le.startY&&!ln(f,le.startX,le.startY)||null!=le.endX&&null!=le.endY&&!ln(f,le.endX,le.endY))continue;if("bezier"===le.edgeType||"multibezier"===le.edgeType||"self"===le.edgeType||"compound"===le.edgeType||"segments"===le.edgeType||"haystack"===le.edgeType){for(var Te=de.rstyle.bezierPts||de.rstyle.linePts||de.rstyle.haystackPts,Ie=!0,ye=0;ye<Te.length;ye++)if(!hu(f,Te[ye])){Ie=!1;break}Ie&&o.push(ce)}else"straight"===le.edgeType&&o.push(ce)}else if("overlap"===ge){var we=!1;if(null!=le.startX&&null!=le.startY&&null!=le.endX&&null!=le.endY&&(ln(f,le.startX,le.startY)||ln(f,le.endX,le.endY)))o.push(ce),we=!0;else if(!we&&"haystack"===le.edgeType)for(var Be=de.rstyle.haystackPts,Ue=0;Ue<Be.length;Ue++)if(hu(f,Be[Ue])){o.push(ce),we=!0;break}if(!we){var Fe=de.rstyle.bezierPts||de.rstyle.linePts||de.rstyle.haystackPts;if((!Fe||Fe.length<2)&&"straight"===le.edgeType&&null!=le.startX&&null!=le.startY&&null!=le.endX&&null!=le.endY&&(Fe=[{x:le.startX,y:le.startY},{x:le.endX,y:le.endY}]),!Fe||Fe.length<2)continue;for(var qe=0;qe<Fe.length-1;qe++){for(var Je=Fe[qe],at=Fe[qe+1],Ye=0;Ye<v.length;Ye++){var xe=Qe(v[Ye],2);if(g(Je,at,xe[0],xe[1])){o.push(ce),we=!0;break}}if(we)break}}}}}return o}},Gi={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,E=e.midY,i?(l=c-e.segpts[0],u=d-e.segpts[1]):a||s||o||n?(l=c-ur((v=e.allpts)[0],v[2],v[4],.1),u=d-ur(v[1],v[3],v[5],.1)):(l=c-g,u=d-E),e.srcArrowAngle=si(l,u);var g=e.midX,E=e.midY;if(t&&(g=(c+f)/2,E=(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[M=C-2],u=v[C+1]-v[M+1];else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var M;l=v[C=v.length/2-1]-v[M=C-2],u=v[C+1]-v[M+1]}else if(a||s||o){var H,G,X,W,Z,$,J,v=e.allpts;e.ctrlpts.length/2%2==0?(H=ur(v[$=v.length/2-1],v[Z=$+2],v[J=Z+2],0),G=ur(v[$+1],v[Z+1],v[J+1],0),X=ur(v[$],v[Z],v[J],1e-4),W=ur(v[$+1],v[Z+1],v[J+1],1e-4)):(H=ur(v[$=(Z=v.length/2-1)-2],v[Z],v[J=Z+2],.4999),G=ur(v[$+1],v[Z+1],v[J+1],.4999),X=ur(v[$],v[Z],v[J],.5),W=ur(v[$+1],v[Z+1],v[J+1],.5)),l=X-H,u=W-G}if(e.midtgtArrowAngle=si(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i&&(v=e.allpts).length/2%2!=0&&!e.isRound){var C,Q=2+(C=v.length/2-1);l=-(v[Q]-v[C]),u=-(v[Q+1]-v[C+1])}if(e.midsrcArrowAngle=si(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 oe=(v=e.allpts).length;l=f-ur(v[oe-6],v[oe-4],v[oe-2],.9),u=h-ur(v[oe-5],v[oe-3],v[oe-1],.9)}else l=f-g,u=h-E;e.tgtArrowAngle=si(l,u)}};Gi.getArrowWidth=Gi.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 el,tl,Xd,Nn,zi,Zr,Mn,On,Ur,ra,Vi,jd,Yd,rl,nl,qd,Hr={},Or={},Wd=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 $d(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 al(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!==qd?Wd(t,e,Hr):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}(Or,Hr),Wd(t,n,Or),Xd=Hr.nx*Or.nx-Hr.ny*-Or.ny,Zr=Math.asin(Math.max(-1,Math.min(1,Hr.nx*Or.ny-Hr.ny*Or.nx))),Math.abs(Zr)<1e-6)return el=t.x,tl=t.y,void(On=ra=0);Nn=1,zi=!1,Xd<0?Zr<0?Zr=Math.PI+Zr:(Zr=Math.PI-Zr,Nn=-1,zi=!0):Zr>0&&(Nn=-1,zi=!0),ra=void 0!==t.radius?t.radius:a,Mn=Zr/2,Vi=Math.min(Hr.len/2,Or.len/2),i?(Ur=Math.abs(Math.cos(Mn)*ra/Math.sin(Mn)))>Vi?(Ur=Vi,On=Math.abs(Ur*Math.sin(Mn)/Math.cos(Mn))):On=ra:(Ur=Math.min(Vi,ra),On=Math.abs(Ur*Math.sin(Mn)/Math.cos(Mn))),el=(rl=t.x+Or.nx*Ur)-Or.ny*On*Nn,tl=(nl=t.y+Or.ny*Ur)+Or.nx*On*Nn,jd=t.x+Hr.nx*Ur,Yd=t.y+Hr.ny*Ur,qd=t}(r,e,t,n,!(arguments.length>4&&void 0!==arguments[4])||arguments[4]),{cx:el,cy:tl,radius:On,startX:jd,startY:Yd,stopX:rl,stopY:nl,startAngle:Hr.ang+Math.PI/2*Nn,endAngle:Or.ang-Math.PI/2*Nn,counterClockwise:zi})}var qy=Math.sqrt(.02),xr={};function Kd(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}}xr.findMidptPtsEtc=function(r,e){var i,W,$,Z,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=Qe(this.manualEndptToPx(r.source()[0],s),2),h=f[0],v=f[1],p=Qe(this.manualEndptToPx(r.target()[0],o),2),g=p[0],E=p[1],C={x1:h,y1:v,x2:g,y2:E};$=g-h,a={x:-(W=E-v)/(Z=Math.sqrt($*$+W*W)),y:$/Z},i=C}else Gt("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}},xr.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(),w=t.pstyle("haystack-radius").value/2;a.haystackPts=a.allpts=[a.source.x*c*w+l.x,a.source.y*f*w+l.y,a.target.x*d*w+u.x,a.target.y*h*w+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)}},xr.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,w=this.findMidptPtsEtc(r,e),p=w.midptPts,g=w.vectorNormInverse,E={x:p.x1*h+p.x2*v,y:p.y1*h+p.y2*v};t.segpts.push(E.x+g.x*f,E.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))}},xr.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,w=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(w)*h*(f/3+1),s.y+1.4*Math.sin(w)*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)]},xr.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,w=d;n&&(v=0,w=f?f.pfValue[0]:void 0);var g={x:i.x-o/2,y:i.y-l/2},E={x:s.x-u/2,y:s.y-c/2},C={x:Math.min(g.x,E.x),y:Math.min(g.y,E.y)},V=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)*w*(v/3+1)*V,C.x-(1+Math.pow(50,1.12)/100)*w*(v/3+1)*H,C.y]},xr.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"},xr.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 w,v=(.5-e.eles.length/2+t)*s*(a?-1:1),p=Ss(v);f&&(c=o?o.pfValue[h]:s,d=l.value[h]);var g=void 0!==(w=n?c:void 0!==c?p*c:void 0)?w:v,E=1-d,C=d,M=this.findMidptPtsEtc(r,e),V=M.midptPts,H=M.vectorNormInverse,G={x:V.x1*E+V.x2*C,y:V.y1*E+V.y2*C};i.ctrlpts.push(G.x+H.x*g,G.y+H.y*g)}},xr.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,E=g,C=r.pstyle("taxi-turn"),M="%"===C.units,V=C.pfValue,H=V<0,G=r.pstyle("taxi-turn-min-distance").pfValue,W=p?(f+v)/2:0,$=c.x2-c.x1,Z=c.y2-c.y1,J=function(j,Se){return j>0?Math.max(j-Se,0):Math.min(j+Se,0)},Q=J($,p?(d+h)/2:0),oe=J(Z,W),ce=!1;"auto"===E?g=Math.abs(Q)>Math.abs(oe)?a:n:E===l||E===o?(g=n,ce=!0):(E===i||E===s)&&(g=a,ce=!0);var ye,de=g===n,le=de?oe:Q,ge=de?Z:$,Te=Ss(ge),Ie=!1;(!ce||!M&&!H)&&(E===o&&ge<0||E===l&&ge>0||E===i&&ge>0||E===s&&ge<0)&&(le=(Te*=-1)*Math.abs(le),Ie=!0);var Ue=function(j){return Math.abs(j)<G||Math.abs(j)>=Math.abs(le)},Fe=Ue(ye=M?(V<0?1+V:V)*le:(V<0?le:0)+V*Te),qe=Ue(Math.abs(le)-Math.abs(ye));if(!Fe&&!qe||Ie)if(de){var yt=c.y1+ye+(p?f/2*Te:0);t.segpts=[c.x1,yt,c.x2,yt]}else{var Vt=c.x1+ye+(p?d/2*Te:0);t.segpts=[Vt,c.y1,Vt,c.y2]}else if(de){var at=Math.abs(ge)<=f/2,Ye=Math.abs($)<=h/2;if(at){var xe=(c.x1+c.x2)/2;t.segpts=[xe,c.y1,xe,c.y2]}else if(Ye){var Ve=(c.y1+c.y2)/2;t.segpts=[c.x1,Ve,c.x2,Ve]}else t.segpts=[c.x1,c.y2]}else{var Ot=Math.abs(ge)<=d/2,St=Math.abs(Z)<=v/2;if(Ot){var wt=(c.y1+c.y2)/2;t.segpts=[c.x1,wt,c.x2,wt]}else if(St){var ht=(c.x1+c.x2)/2;t.segpts=[ht,c.y1,ht,c.y2]}else t.segpts=[c.x2,c.y1]}if(t.isRound){var Tt=r.pstyle("taxi-radius").value,lt="arc-radius"===r.pstyle("radius-type").value[0];t.radii=new Array(t.segpts.length/2).fill(Tt),t.isArcRadius=new Array(t.segpts.length/2).fill(lt)}},xr.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,w=!tt(t.startX)||!tt(t.startY),p=!tt(t.arrowStartX)||!tt(t.arrowStartY),g=!tt(t.endX)||!tt(t.endY),E=!tt(t.arrowEndX)||!tt(t.arrowEndY),V=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,H=Dn({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),G=H<V,X=Dn({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),W=X<V,$=!1;if(w||p||G){$=!0;var Z={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},J=Math.sqrt(Z.x*Z.x+Z.y*Z.y),Q={x:Z.x/J,y:Z.y/J},oe=Math.max(i,s),ce={x:t.ctrlpts[0]+2*Q.x*oe,y:t.ctrlpts[1]+2*Q.y*oe},de=u.intersectLine(n.x,n.y,i,s,ce.x,ce.y,0,d,h);G?(t.ctrlpts[0]=t.ctrlpts[0]+Q.x*(V-H),t.ctrlpts[1]=t.ctrlpts[1]+Q.y*(V-H)):(t.ctrlpts[0]=de[0]+Q.x*V,t.ctrlpts[1]=de[1]+Q.y*V)}if(g||E||W){$=!0;var le={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},ge=Math.sqrt(le.x*le.x+le.y*le.y),Te={x:le.x/ge,y:le.y/ge},Ie=Math.max(i,s),ye={x:t.ctrlpts[0]+2*Te.x*Ie,y:t.ctrlpts[1]+2*Te.y*Ie},we=c.intersectLine(a.x,a.y,o,l,ye.x,ye.y,0,f,v);W?(t.ctrlpts[0]=t.ctrlpts[0]+Te.x*(V-X),t.ctrlpts[1]=t.ctrlpts[1]+Te.y*(V-X)):(t.ctrlpts[0]=we[0]+Te.x*V,t.ctrlpts[1]=we[1]+Te.y*V)}$&&this.findEndpoints(r)}},xr.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=ur(e.allpts[n=e.allpts.length/2-3],e.allpts[n+2],e.allpts[n+4],.5),e.midY=ur(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(al({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],w=f.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(p){return p*w}),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]}}},xr.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||tt(e.startX)&&tt(e.startY)&&tt(e.endX)&&tt(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Gt("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."))},xr.findEdgeControlPoints=function(r){var e=this;if(r&&0!==r.length){for(var t=this,a=t.cy.hasCompoundNodes(),i=new $r,s=function(W,$){return[].concat(Et(W),[$?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||an(f,"segments")||"straight"===f||"straight-triangle"===f||an(f,"taxi"),v="unbundled-bezier"===f||"bezier"===f,p=d.target,C=[d.source.poolIndex(),p.poolIndex()].sort(),M=s(C,h),V=i.get(M);null==V&&(V={eles:[]},o.push({pairId:C,edgeIsUnbundled:h}),i.set(M,V)),V.eles.push(c),h&&(V.hasUnbundled=!0),v&&(V.hasBezier=!0)}}for(var H=function(){var oe,W=o[G],J=s(W.pairId,W.edgeIsUnbundled),Q=i.get(J);if(!Q.hasUnbundled){var ce=Q.eles[0].parallelEdges().filter(function(lt){return lt.isBundledBezier()});ws(Q.eles),ce.forEach(function(lt){return Q.eles.push(lt)}),Q.eles.sort(function(lt,Ge){return lt.poolIndex()-Ge.poolIndex()})}var de=Q.eles[0],le=de.source(),ge=de.target();if(le.poolIndex()>ge.poolIndex()){var Te=le;le=ge,ge=Te}var Ie=Q.srcPos=le.position(),ye=Q.tgtPos=ge.position(),we=Q.srcW=le.outerWidth(),Be=Q.srcH=le.outerHeight(),Ue=Q.tgtW=ge.outerWidth(),Fe=Q.tgtH=ge.outerHeight(),qe=Q.srcShape=t.nodeShapes[e.getNodeShape(le)],Je=Q.tgtShape=t.nodeShapes[e.getNodeShape(ge)],at=Q.srcCornerRadius="auto"===le.pstyle("corner-radius").value?"auto":le.pstyle("corner-radius").pfValue,Ye=Q.tgtCornerRadius="auto"===ge.pstyle("corner-radius").value?"auto":ge.pstyle("corner-radius").pfValue,xe=Q.tgtRs=ge._private.rscratch,Ce=Q.srcRs=le._private.rscratch;Q.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Ae=0;Ae<Q.eles.length;Ae++){var Ve=Q.eles[Ae],rt=Ve[0]._private.rscratch,ft=Ve.pstyle("curve-style").value,Ot="unbundled-bezier"===ft||an(ft,"segments")||an(ft,"taxi"),St=!le.same(Ve.source());if(!Q.calculatedIntersection&&le!==ge&&(Q.hasBezier||Q.hasUnbundled)){Q.calculatedIntersection=!0;var wt=qe.intersectLine(Ie.x,Ie.y,we,Be,ye.x,ye.y,0,at,Ce),mt=Q.srcIntn=wt,it=Je.intersectLine(ye.x,ye.y,Ue,Fe,Ie.x,Ie.y,0,Ye,xe),ht=Q.tgtIntn=it,gt=Q.intersectionPts={x1:wt[0],x2:it[0],y1:wt[1],y2:it[1]},Ct=Q.posPts={x1:Ie.x,x2:ye.x,y1:Ie.y,y2:ye.y},yt=it[1]-wt[1],At=it[0]-wt[0],Pt=Math.sqrt(At*At+yt*yt);tt(Pt)&&Pt>=qy||(Pt=Math.sqrt(Math.max(At*At,.01)+Math.max(yt*yt,.01)));var Vt=Q.vector={x:At,y:yt},Ht=Q.vectorNorm={x:Vt.x/Pt,y:Vt.y/Pt},Ut={x:-Ht.y,y:Ht.x};Q.nodesOverlap=!tt(Pt)||Je.checkPoint(wt[0],wt[1],0,Ue,Fe,ye.x,ye.y,Ye,xe)||qe.checkPoint(it[0],it[1],0,we,Be,Ie.x,Ie.y,at,Ce),Q.vectorNormInverse=Ut,oe={nodesOverlap:Q.nodesOverlap,dirCounts:Q.dirCounts,calculatedIntersection:!0,hasBezier:Q.hasBezier,hasUnbundled:Q.hasUnbundled,eles:Q.eles,srcPos:ye,srcRs:xe,tgtPos:Ie,tgtRs:Ce,srcW:Ue,srcH:Fe,tgtW:we,tgtH:Be,srcIntn:ht,tgtIntn:mt,srcShape:Je,tgtShape:qe,posPts:{x1:Ct.x2,y1:Ct.y2,x2:Ct.x1,y2:Ct.y1},intersectionPts:{x1:gt.x2,y1:gt.y2,x2:gt.x1,y2:gt.y1},vector:{x:-Vt.x,y:-Vt.y},vectorNorm:{x:-Ht.x,y:-Ht.y},vectorNormInverse:{x:-Ut.x,y:-Ut.y}}}var Tt=St?oe:Q;rt.nodesOverlap=Tt.nodesOverlap,rt.srcIntn=Tt.srcIntn,rt.tgtIntn=Tt.tgtIntn,rt.isRound=ft.startsWith("round"),a&&(le.isParent()||le.isChild()||ge.isParent()||ge.isChild())&&(le.parents().anySame(ge)||ge.parents().anySame(le)||le.same(ge)&&le.isParent())?e.findCompoundLoopPoints(Ve,Tt,Ae,Ot):le===ge?e.findLoopPoints(Ve,Tt,Ae,Ot):ft.endsWith("segments")?e.findSegmentsPoints(Ve,Tt):ft.endsWith("taxi")?e.findTaxiPoints(Ve,Tt):"straight"===ft||!Ot&&Q.eles.length%2==1&&Ae===Math.floor(Q.eles.length/2)?e.findStraightEdgePoints(Ve):e.findBezierPoints(Ve,Tt,Ae,Ot,St),e.findEndpoints(Ve),e.tryToCorrectInvalidPoints(Ve,Tt),e.checkForInvalidEdgeWarning(Ve),e.storeAllpts(Ve),e.storeEdgeProjections(Ve),e.calculateArrowAngles(Ve),e.recalculateEdgeLabelProjections(Ve),e.calculateLabelAngles(Ve)}},G=0;G<o.length;G++)H();this.findHaystackPoints(l)}},xr.getSegmentPoints=function(r){var e=r[0]._private.rscratch;if(this.recalculateRenderedStyle(r),"segments"===e.edgeType)return Kd(e.segpts)},xr.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 Kd(e.ctrlpts)},xr.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Fa={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,w=o._private.rscratch,p=l._private.rscratch,g=r.pstyle("curve-style").value,E=r._private.rscratch,C=E.edgeType,M=an(g,"taxi"),V="self"===C||"compound"===C,H="bezier"===C||"multibezier"===C||V,G="bezier"!==C,X="straight"===C||"segments"===C,W="segments"===C,$=H||G||X,Z=V||M,J=r.pstyle("source-endpoint"),Q=Z?"outside-to-node":J.value,oe="auto"===o.pstyle("corner-radius").value?"auto":o.pstyle("corner-radius").pfValue,ce=r.pstyle("target-endpoint"),de=Z?"outside-to-node":ce.value,le="auto"===l.pstyle("corner-radius").value?"auto":l.pstyle("corner-radius").pfValue;E.srcManEndpt=J,E.tgtManEndpt=ce;var ge,Te,Ie,ye,we=null!==(e=2===(null==ce||null===(t=ce.pfValue)||void 0===t?void 0:t.length)?ce.pfValue:null)&&void 0!==e?e:[0,0],Be=null!==(n=2===(null==J||null===(a=J.pfValue)||void 0===a?void 0:a.length)?J.pfValue:null)&&void 0!==n?n:[0,0];if(H){var Ue=[E.ctrlpts[0],E.ctrlpts[1]];ge=G?[E.ctrlpts[E.ctrlpts.length-2],E.ctrlpts[E.ctrlpts.length-1]]:Ue,Te=Ue}else if(X){var qe=W?E.segpts.slice(0,2):[c.x+we[0],c.y+we[1]];ge=W?E.segpts.slice(E.segpts.length-2):[u.x+Be[0],u.y+Be[1]],Te=qe}if("inside-to-node"===de)s=[c.x,c.y];else if(ce.units)s=this.manualEndptToPx(l,ce);else if("outside-to-line"===de)s=E.tgtIntn;else if("outside-to-node"===de||"outside-to-node-or-label"===de?Ie=ge:("outside-to-line"===de||"outside-to-line-or-label"===de)&&(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,le,p),"outside-to-node-or-label"===de||"outside-to-line-or-label"===de){var at=l._private.rscratch,Ce=at.labelX,Ae=at.labelY,Ve=at.labelWidth/2,rt=at.labelHeight/2,ft=l.pstyle("text-valign").value;"top"===ft?Ae-=rt:"bottom"===ft&&(Ae+=rt);var Ot=l.pstyle("text-halign").value;"left"===Ot?Ce-=Ve:"right"===Ot&&(Ce+=Ve);var St=Ca(Ie[0],Ie[1],[Ce-Ve,Ae-rt,Ce+Ve,Ae-rt,Ce+Ve,Ae+rt,Ce-Ve,Ae+rt],c.x,c.y);if(St.length>0){var wt=u,mt=Sn(wt,Vn(s)),it=Sn(wt,Vn(St)),ht=mt;it<mt&&(s=St,ht=it),St.length>2&&Sn(wt,{x:St[2],y:St[3]})<ht&&(s=[St[2],St[3]])}}var Ct=di(s,ge,i.arrowShapes[d].spacing(r)+h),yt=di(s,ge,i.arrowShapes[d].gap(r)+h);if(E.endX=yt[0],E.endY=yt[1],E.arrowEndX=Ct[0],E.arrowEndY=Ct[1],"inside-to-node"===Q)s=[u.x,u.y];else if(J.units)s=this.manualEndptToPx(o,J);else if("outside-to-line"===Q)s=E.srcIntn;else if("outside-to-node"===Q||"outside-to-node-or-label"===Q?ye=Te:("outside-to-line"===Q||"outside-to-line-or-label"===Q)&&(ye=[c.x,c.y]),s=i.nodeShapes[this.getNodeShape(o)].intersectLine(u.x,u.y,o.outerWidth(),o.outerHeight(),ye[0],ye[1],0,oe,w),"outside-to-node-or-label"===Q||"outside-to-line-or-label"===Q){var At=o._private.rscratch,Ht=At.labelX,Ut=At.labelY,Tt=At.labelWidth/2,lt=At.labelHeight/2,Ge=o.pstyle("text-valign").value;"top"===Ge?Ut-=lt:"bottom"===Ge&&(Ut+=lt);var j=o.pstyle("text-halign").value;"left"===j?Ht-=Tt:"right"===j&&(Ht+=Tt);var Se=Ca(ye[0],ye[1],[Ht-Tt,Ut-lt,Ht+Tt,Ut-lt,Ht+Tt,Ut+lt,Ht-Tt,Ut+lt],u.x,u.y);if(Se.length>0){var Me=c,ke=Sn(Me,Vn(s)),He=Sn(Me,Vn(Se)),ot=ke;He<ke&&(s=[Se[0],Se[1]],ot=He),Se.length>2&&Sn(Me,{x:Se[2],y:Se[3]})<ot&&(s=[Se[2],Se[3]])}}var ct=di(s,Te,i.arrowShapes[f].spacing(r)+v),ut=di(s,Te,i.arrowShapes[f].gap(r)+v);E.startX=ut[0],E.startY=ut[1],E.arrowStartX=ct[0],E.arrowStartY=ct[1],$&&(E.badLine=!(tt(E.startX)&&tt(E.startY)&&tt(E.endX)&&tt(E.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}}},il={};function Wy(r,e,t){for(var n=function(u,c,d,f){return ur(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)})}}il.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)Wy(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},il.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var Xr={recalculateNodeLabelProjection:function(r){var e=r.pstyle("label").strValue;if(!nn(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"right":t=l.x+i/2+o;break;default:t=l.x}switch(c){case"top":n=l.y-s/2-o;break;case"bottom":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)}}},Zd=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},Jd=function(e,t){return Zd(t.x-e.x,t.y-e.y)};Xr.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){Wr(t.rscratch,d,f,h),Wr(t.rstyle,d,f,h)};s("labelX",null,(e={x:n.midX,y:n.midY}).x),s("labelY",null,e.y);var o=Zd(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 E(G,X,W,$,Z){var J=Dn(X,W),Q=G.segments[G.segments.length-1];G.segments.push({p0:X,p1:W,t0:$,t1:Z,startDist:Q?Q.startDist+Q.length:0,length:J}),G.length+=J}for(var C=0;C<d.length;C++){var M=d[C],V=d[C-1];V&&(M.startDist=V.startDist+V.length),E(M,M.p0,p[C*g],0,a.bezierProjPcts[0]);for(var H=0;H<g-1;H++)E(M,p[C*g+H],p[C*g+H+1],a.bezierProjPcts[H],a.bezierProjPcts[H+1]);E(M,p[C*g+g-1],M.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,w=l(),g=0,E=0,C=0;C<w.length;C++){for(var M=w[h?C:w.length-1-C],V=0;V<M.segments.length;V++){var H=M.segments[h?V:M.segments.length-1-V];if(g=E,(E+=H.length)>=v||C===w.length-1&&V===M.segments.length-1){p={cp:M,segment:H};break}}if(p)break}var X=p.cp,W=p.segment,$=(v-g)/W.length,Z=W.t1-W.t0,J=h?W.t0+Z*$:W.t1-Z*$;J=Ea(0,J,1),e=Hn(X.p0,X.p1,X.p2,J),f=function(e,t,n,a){var i=Ea(0,a-.001,1),s=Ea(0,a+.001,1),o=Hn(e,t,n,i),l=Hn(e,t,n,s);return Jd(o,l)}(X.p0,X.p1,X.p2,J);break;case"straight":case"segments":case"haystack":for(var oe,ce,de,le,Q=0,ge=n.allpts.length,Te=0;Te+3<ge&&(h?(de={x:n.allpts[Te],y:n.allpts[Te+1]},le={x:n.allpts[Te+2],y:n.allpts[Te+3]}):(de={x:n.allpts[ge-2-Te],y:n.allpts[ge-1-Te]},le={x:n.allpts[ge-4-Te],y:n.allpts[ge-3-Te]}),ce=Q,!((Q+=oe=Dn(de,le))>=v));Te+=2);var ye=(v-ce)/oe;ye=Ea(0,ye,1),e=function(e,t,n,a){var i_x=t.x-e.x,i_y=t.y-e.y,s=Dn(e,t);return n=n??0,{x:e.x+i_x/s*(a=a??n*s),y:e.y+i_y/s*a}}(de,le,ye),f=Jd(de,le)}s("labelX",d,e.x),s("labelY",d,e.y),s("labelAutoAngle",d,f)}};u("source"),u("target"),this.applyLabelDimensions(r)}},Xr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))},Xr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,n=this.getLabelText(r,e),a=Cn(n,r._private.labelDimsKey);if(Sr(t.rscratch,"prefixedLabelDimsKey",e)!==a){Wr(t.rscratch,"prefixedLabelDimsKey",e,a);var i=this.calculateLabelDimensions(r,n),s=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,l=Sr(t.rscratch,"labelWrapCachedLines",e)||[],u="wrap"!==o?1:Math.max(l.length,1),c=i.height/u,d=c*s,f=i.width,h=i.height+(u-1)*(s-1)*c;Wr(t.rstyle,"labelWidth",e,f),Wr(t.rscratch,"labelWidth",e,f),Wr(t.rstyle,"labelHeight",e,h),Wr(t.rscratch,"labelHeight",e,h),Wr(t.rscratch,"labelLineHeight",e,d)}},Xr.getLabelText=function(r,e){var t=r._private,a=r.pstyle((e?e+"-":"")+"label").strValue,i=r.pstyle("text-transform").value,s=function(Be,Ue){return Ue?(Wr(t.rscratch,Be,e,Ue),Ue):Sr(t.rscratch,Be,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=[],w=/[\s\u200b]+|$/g,p=0;p<c.length;p++){var g=c[p],C=this.calculateLabelDimensions(r,g).width;if(h){var M=g.split("").join("\u200b");g=M}if(C>d){var W,H="",G=0,X=_e(g.matchAll(w));try{for(X.s();!(W=X.n()).done;){var $=W.value,Z=$[0],J=g.substring(G,$.index);G=$.index+Z.length,this.calculateLabelDimensions(r,0===H.length?J:H+J+Z).width<=d?H+=J+Z:(H&&v.push(H),H=J+Z)}}catch(we){X.e(we)}finally{X.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 de=r.pstyle("text-max-width").pfValue,le="",Te=!1;if(this.calculateLabelDimensions(r,a).width<de)return a;for(var Ie=0;Ie<a.length&&!(this.calculateLabelDimensions(r,le+a[Ie]+"\u2026").width>de);Ie++)le+=a[Ie],Ie===a.length-1&&(Te=!0);return Te||(le+="\u2026"),le}return a},Xr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if("auto"!==e)return e;if(!r.isNode())return"center";switch(t){case"left":return"right";case"right":return"left";default:return"center"}},Xr.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=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=a.createElement("canvas"),d=this.labelCalcCanvasContext=c.getContext("2d");var f=c.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}d.font="".concat(s," ").concat(u," ").concat(o,"px ").concat(l);for(var h=0,v=0,w=e.split("\n"),p=0;p<w.length;p++){var E=d.measureText(w[p]),C=Math.ceil(E.width),M=o;h=Math.max(C,h),v+=M}return{width:h+=0,height:v+=0}},Xr.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},Xr.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 Qd={},tf=!1;Qd.getNodeShape=function(r){var t=r.pstyle("shape").value;if("cutrectangle"===t&&(r.width()<28||r.height()<28))return tf||(Gt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),tf=!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 Ui={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(gd),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e}},rf={};[Rn,Gi,xr,Fa,il,Xr,Qd,{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(M){return M._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,E=p.rscratch;g.srcX=E.arrowStartX,g.srcY=E.arrowStartY,g.tgtX=E.arrowEndX,g.tgtY=E.arrowEndY,g.midX=E.midX,g.midY=E.midY,g.labelAngle=E.labelAngle,g.sourceLabelAngle=E.sourceLabelAngle,g.targetLabelAngle=E.targetLabelAngle}}}}},Ui].forEach(function(r){bt(rf,r)});var nf={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}},na={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()}};na.load=function(){var r=this,e=r.cy.window(),t=function(j){return j.selected()},a=function(j,Se,Me,ke){null==j&&(j=r.cy);for(var He=0;He<Se.length;He++)j.emit({originalEvent:Me,type:Se[He],position:ke})},i=function(j){return j.shiftKey||j.metaKey||j.ctrlKey},s=function(j,Se){var Me=!0;if(r.cy.hasCompoundNodes()&&j&&j.pannable()){for(var ke=0;Se&&ke<Se.length;ke++)if((j=Se[ke]).isNode()&&j.isParent()&&!j.pannable()){Me=!1;break}}else Me=!0;return Me},u=function(j){j[0]._private.rscratch.inDragLayer=!0},d=function(j){j[0]._private.rscratch.isGrabTarget=!0},h=function(j,Se){var Me=Se.addToList;!Me.has(j)&&j.grabbable()&&!j.locked()&&(Me.merge(j),function(j){j[0]._private.grabbed=!0}(j))},w=function(j,Se){Se=Se||{};var Me=j.cy().hasCompoundNodes();Se.inDragLayer&&(j.forEach(u),j.neighborhood().stdFilter(function(ke){return!Me||ke.isEdge()}).forEach(u)),Se.addToList&&j.forEach(function(ke){h(ke,Se)}),function(j,Se){if(j.cy().hasCompoundNodes()&&(null!=Se.inDragLayer||null!=Se.addToList)){var Me=j.descendants();Se.inDragLayer&&(Me.forEach(u),Me.connectedEdges().forEach(u)),Se.addToList&&h(Me,Se)}}(j,Se),E(j,{inDragLayer:Se.inDragLayer}),r.updateCachedGrabbedEles()},p=w,g=function(j){j&&(r.getCachedZSortedEles().forEach(function(Se){(function(j){j[0]._private.grabbed=!1})(Se),function(j){j[0]._private.rscratch.inDragLayer=!1}(Se),function(j){j[0]._private.rscratch.isGrabTarget=!1}(Se)}),r.updateCachedGrabbedEles())},E=function(j,Se){if((null!=Se.inDragLayer||null!=Se.addToList)&&j.cy().hasCompoundNodes()){var Me=j.ancestors().orphans();if(!Me.same(j)){var ke=Me.descendants().spawnSelf().merge(Me).unmerge(j).unmerge(j.descendants()),He=ke.connectedEdges();Se.inDragLayer&&(He.forEach(u),ke.forEach(u)),Se.addToList&&ke.forEach(function(ot){h(ot,Se)})}}},C=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},M=typeof MutationObserver<"u",V=typeof ResizeObserver<"u";M?(r.removeObserver=new MutationObserver(function(Ge){for(var j=0;j<Ge.length;j++){var Me=Ge[j].removedNodes;if(Me)for(var ke=0;ke<Me.length;ke++)if(Me[ke]===r.container){r.destroy();break}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(Ge){r.destroy()});var H=ya(function(){r.cy.resize()},100);M&&(r.styleObserver=new MutationObserver(H),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",H),V&&(r.resizeObserver=new ResizeObserver(H),r.resizeObserver.observe(r.container));var X=function(){r.invalidateContainerClientCoordsCache()};(function(j,Se){for(;null!=j;)Se(j),j=j.parentNode})(r.container,function(Ge){r.registerBinding(Ge,"transitionend",X),r.registerBinding(Ge,"animationend",X),r.registerBinding(Ge,"scroll",X)}),r.registerBinding(r.container,"contextmenu",function(Ge){Ge.preventDefault()});var $=function(j){for(var Se=r.findContainerClientCoords(),Me=Se[0],ke=Se[1],He=Se[2],ot=Se[3],We=j.touches?j.touches:[j],ct=!1,ut=0;ut<We.length;ut++){var xt=We[ut];if(Me<=xt.clientX&&xt.clientX<=Me+He&&ke<=xt.clientY&&xt.clientY<=ke+ot){ct=!0;break}}if(!ct)return!1;for(var Rt=r.container,dt=j.target.parentNode,Mt=!1;dt;){if(dt===Rt){Mt=!0;break}dt=dt.parentNode}return!!Mt};r.registerBinding(r.container,"mousedown",function(j){if($(j)&&(1!==r.hoverData.which||1===j.which)){j.preventDefault(),C(),r.hoverData.capture=!0,r.hoverData.which=j.which;var Se=r.cy,Me=[j.clientX,j.clientY],ke=r.projectIntoViewport(Me[0],Me[1]),He=r.selection,ot=r.findNearestElements(ke[0],ke[1],!0,!1),We=ot[0],ct=r.dragData.possibleDragElements;r.hoverData.mdownPos=ke,r.hoverData.mdownGPos=Me;var ut=function(Nt){return{originalEvent:j,type:Nt,position:{x:ke[0],y:ke[1]}}};if(3==j.which){r.hoverData.cxtStarted=!0;var Rt={originalEvent:j,type:"cxttapstart",position:{x:ke[0],y:ke[1]}};We?(We.activate(),We.emit(Rt),r.hoverData.down=We):Se.emit(Rt),r.hoverData.downTime=(new Date).getTime(),r.hoverData.cxtDragged=!1}else if(1==j.which){if(We&&We.activate(),null!=We&&r.nodeIsGrabbable(We)){if(d(We),We.selected()){ct=r.dragData.possibleDragElements=Se.collection();var dt=Se.$(function(Mt){return Mt.isNode()&&Mt.selected()&&r.nodeIsGrabbable(Mt)});w(dt,{addToList:ct}),We.emit(ut("grabon")),dt.forEach(function(Nt){Nt.emit(ut("grab"))})}else ct=r.dragData.possibleDragElements=Se.collection(),p(We,{addToList:ct}),We.emit(ut("grabon")).emit(ut("grab"));r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=We,r.hoverData.downs=ot,r.hoverData.downTime=(new Date).getTime(),a(We,["mousedown","tapstart","vmousedown"],j,{x:ke[0],y:ke[1]}),null==We?(He[4]=1,r.data.bgActivePosistion={x:ke[0],y:ke[1]},r.redrawHint("select",!0),r.redraw()):We.pannable()&&(He[4]=1),r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var Nt=r.hoverData.down;Nt?Nt.emit(ut("taphold")):Se.emit(ut("taphold"))}},r.tapholdDuration)}He[0]=He[2]=ke[0],He[1]=He[3]=ke[1]}},!1);var J,Q,oe,Z=function(j){var Se=j.getRootNode();if(Se&&11===Se.nodeType&&void 0!==Se.host)return Se}(r.container);r.registerBinding([e,Z],"mousemove",function(j){var Pr;if(r.hoverData.capture||$(j)){var Me=!1,ke=r.cy,He=ke.zoom(),ot=[j.clientX,j.clientY],We=r.projectIntoViewport(ot[0],ot[1]),ct=r.hoverData.mdownPos,ut=r.hoverData.mdownGPos,xt=r.selection,Rt=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(Rt=r.findNearestElement(We[0],We[1],!0,!1));var or,It=r.hoverData.last,dt=r.hoverData.down,Mt=[We[0]-xt[2],We[1]-xt[3]],Nt=r.dragData.possibleDragElements;if(ut){var er=ot[0]-ut[0],nr=ot[1]-ut[1];r.hoverData.isOverThresholdDrag=or=er*er+nr*nr>=r.desktopTapThreshold2}var yr=i(j);or&&(r.hoverData.tapholdCancelled=!0),Me=!0,a(Rt,["mousemove","vmousemove","tapdrag"],j,{x:We[0],y:We[1]});var ar=function(Pr){return{originalEvent:j,type:Pr,position:{x:We[0],y:We[1]}}},en=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||ke.emit(ar("boxstart")),xt[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(3===r.hoverData.which){if(or){var tn=ar("cxtdrag");dt?dt.emit(tn):ke.emit(tn),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||Rt!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(ar("cxtdragout")),r.hoverData.cxtOver=Rt,Rt&&Rt.emit(ar("cxtdragover")))}}else if(r.hoverData.dragging){if(Me=!0,ke.panningEnabled()&&ke.userPanningEnabled()){var ua;if(r.hoverData.justStartedPan){var Ji=r.hoverData.mdownPos;ua={x:(We[0]-Ji[0])*He,y:(We[1]-Ji[1])*He},r.hoverData.justStartedPan=!1}else ua={x:Mt[0]*He,y:Mt[1]*He};ke.panBy(ua),ke.emit(ar("dragpan")),r.hoverData.dragged=!0}We=r.projectIntoViewport(j.clientX,j.clientY)}else if(1!=xt[4]||null!=dt&&!dt.pannable()){if(dt&&dt.pannable()&&dt.active()&&dt.unactivate(),(!dt||!dt.grabbed())&&Rt!=It&&(It&&a(It,["mouseout","tapdragout"],j,{x:We[0],y:We[1]}),Rt&&a(Rt,["mouseover","tapdragover"],j,{x:We[0],y:We[1]}),r.hoverData.last=Rt),dt)if(or){if(ke.boxSelectionEnabled()&&yr)dt&&dt.grabbed()&&(g(Nt),dt.emit(ar("freeon")),Nt.emit(ar("free")),r.dragData.didDrag&&(dt.emit(ar("dragfreeon")),Nt.emit(ar("dragfree")))),en();else if(dt&&dt.grabbed()&&r.nodeIsDraggable(dt)){var Lr=!r.dragData.didDrag;Lr&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||w(Nt,{inDragLayer:!0});var wr={x:0,y:0};if(tt(Mt[0])&&tt(Mt[1])&&(wr.x+=Mt[0],wr.y+=Mt[1],Lr)){var Ar=r.hoverData.dragDelta;Ar&&tt(Ar[0])&&tt(Ar[1])&&(wr.x+=Ar[0],wr.y+=Ar[1])}r.hoverData.draggingEles=!0,Nt.silentShift(wr).emit(ar("position")).emit(ar("drag")),r.redrawHint("drag",!0),r.redraw()}}else 0===(Pr=r.hoverData.dragDelta=r.hoverData.dragDelta||[]).length?(Pr.push(Mt[0]),Pr.push(Mt[1])):(Pr[0]+=Mt[0],Pr[1]+=Mt[1]);Me=!0}else or&&(r.hoverData.dragging||!ke.boxSelectionEnabled()||!yr&&ke.panningEnabled()&&ke.userPanningEnabled()?!r.hoverData.selecting&&ke.panningEnabled()&&ke.userPanningEnabled()&&s(dt,r.hoverData.downs)&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,xt[4]=0,r.data.bgActivePosistion=Vn(ct),r.redrawHint("select",!0),r.redraw()):en(),dt&&dt.pannable()&&dt.active()&&dt.unactivate());if(xt[2]=We[0],xt[3]=We[1],Me)return j.stopPropagation&&j.stopPropagation(),j.preventDefault&&j.preventDefault(),!1}},!1),r.registerBinding(e,"mouseup",function(j){if((1!==r.hoverData.which||1===j.which||!r.hoverData.capture)&&r.hoverData.capture){r.hoverData.capture=!1;var Me=r.cy,ke=r.projectIntoViewport(j.clientX,j.clientY),He=r.selection,ot=r.findNearestElement(ke[0],ke[1],!0,!1),We=r.dragData.possibleDragElements,ct=r.hoverData.down,ut=i(j);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,ct&&ct.unactivate();var xt=function(er){return{originalEvent:j,type:er,position:{x:ke[0],y:ke[1]}}};if(3===r.hoverData.which){var Rt=xt("cxttapend");if(ct?ct.emit(Rt):Me.emit(Rt),!r.hoverData.cxtDragged){var It=xt("cxttap");ct?ct.emit(It):Me.emit(It)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(1===r.hoverData.which){if(a(ot,["mouseup","tapend","vmouseup"],j,{x:ke[0],y:ke[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(ct,["click","tap","vclick"],j,{x:ke[0],y:ke[1]}),Q=!1,j.timeStamp-oe<=Me.multiClickDebounceTime()?(J&&clearTimeout(J),Q=!0,oe=null,a(ct,["dblclick","dbltap","vdblclick"],j,{x:ke[0],y:ke[1]})):(J=setTimeout(function(){Q||a(ct,["oneclick","onetap","voneclick"],j,{x:ke[0],y:ke[1]})},Me.multiClickDebounceTime()),oe=j.timeStamp)),null==ct&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(j)&&(Me.$(t).unselect(["tapunselect"]),We.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=We=Me.collection()),ot==ct&&!r.dragData.didDrag&&!r.hoverData.selecting&&null!=ot&&ot._private.selectable&&(r.hoverData.dragging||("additive"===Me.selectionType()||ut?ot.selected()?ot.unselect(["tapunselect"]):ot.select(["tapselect"]):ut||(Me.$(t).unmerge(ot).unselect(["tapunselect"]),ot.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var dt=Me.collection(r.getAllInBox(He[0],He[1],He[2],He[3]));r.redrawHint("select",!0),dt.length>0&&r.redrawHint("eles",!0),Me.emit(xt("boxend")),"additive"===Me.selectionType()||ut||Me.$(t).unmerge(dt).unselect(),dt.emit(xt("box")).stdFilter(function(er){return er.selectable()&&!er.selected()}).select().emit(xt("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!He[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var Nt=ct&&ct.grabbed();g(We),Nt&&(ct.emit(xt("freeon")),We.emit(xt("free")),r.dragData.didDrag&&(ct.emit(xt("dragfreeon")),We.emit(xt("dragfree"))))}}He[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 le,ce=[],ge=1e5,ye=function(j){var Se=!1,Me=j.deltaY;if(null==Me&&(null!=j.wheelDeltaY?Me=j.wheelDeltaY/4:null!=j.wheelDelta&&(Me=j.wheelDelta/4)),0!==Me){if(null==le)if(ce.length>=4){var ke=ce;if(le=function(j){for(var Me=0;Me<j.length;Me++)if(j[Me]%5!=0)return!1;return!0}(ke),!le){var He=Math.abs(ke[0]);le=function(j){for(var Se=Math.abs(j[0]),Me=1;Me<j.length;Me++)if(Math.abs(j[Me])!==Se)return!1;return!0}(ke)&&He>5}if(le)for(var ot=0;ot<ke.length;ot++)ge=Math.min(Math.abs(ke[ot]),ge)}else ce.push(Me),Se=!0;else le&&(ge=Math.min(Math.abs(Me),ge));if(!r.scrollingPage){var We=r.cy,ct=We.zoom(),ut=We.pan(),xt=r.projectIntoViewport(j.clientX,j.clientY),Rt=[xt[0]*ct+ut.x,xt[1]*ct+ut.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||0!==r.selection[4])return void j.preventDefault();if(We.panningEnabled()&&We.userPanningEnabled()&&We.zoomingEnabled()&&We.userZoomingEnabled()){var It;j.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),Se&&Math.abs(Me)>5&&(Me=5*Ss(Me)),It=Me/-250,le&&(It/=ge,It*=3),It*=r.wheelSensitivity,1===j.deltaMode&&(It*=33);var Mt=We.zoom()*Math.pow(10,It);"gesturechange"===j.type&&(Mt=r.gestureStartZoom*j.scale),We.zoom({level:Mt,renderedPosition:{x:Rt[0],y:Rt[1]}}),We.emit({type:"gesturechange"===j.type?"pinchzoom":"scrollzoom",originalEvent:j,position:{x:xt[0],y:xt[1]}})}}}};r.registerBinding(r.container,"wheel",ye,!0),r.registerBinding(e,"scroll",function(j){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(j){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||j.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(Ge){r.hasTouchStarted||ye(Ge)},!0),r.registerBinding(r.container,"mouseout",function(j){var Se=r.projectIntoViewport(j.clientX,j.clientY);r.cy.emit({originalEvent:j,type:"mouseout",position:{x:Se[0],y:Se[1]}})},!1),r.registerBinding(r.container,"mouseover",function(j){var Se=r.projectIntoViewport(j.clientX,j.clientY);r.cy.emit({originalEvent:j,type:"mouseover",position:{x:Se[0],y:Se[1]}})},!1);var we,Be,Ue,Fe,qe,Je,at,Ye,xe,Ce,Ae,Ve,rt,St,wt,mt,it,ht,gt,Ct,ft=function(j,Se,Me,ke){return Math.sqrt((Me-j)*(Me-j)+(ke-Se)*(ke-Se))},Ot=function(j,Se,Me,ke){return(Me-j)*(Me-j)+(ke-Se)*(ke-Se)};if(r.registerBinding(r.container,"touchstart",St=function(j){if(r.hasTouchStarted=!0,$(j)){C(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var Se=r.cy,Me=r.touchData.now,ke=r.touchData.earlier;if(j.touches[0]){var He=r.projectIntoViewport(j.touches[0].clientX,j.touches[0].clientY);Me[0]=He[0],Me[1]=He[1]}j.touches[1]&&(He=r.projectIntoViewport(j.touches[1].clientX,j.touches[1].clientY),Me[2]=He[0],Me[3]=He[1]),j.touches[2]&&(He=r.projectIntoViewport(j.touches[2].clientX,j.touches[2].clientY),Me[4]=He[0],Me[5]=He[1]);var ot=function(yr){return{originalEvent:j,type:yr,position:{x:Me[0],y:Me[1]}}};if(j.touches[1]){r.touchData.singleTouchMoved=!0,g(r.dragData.touchDragEles);var We=r.findContainerClientCoords();Ae=We[2],Ve=We[3],Be=j.touches[0].clientY-(Ce=We[1]),Ue=j.touches[1].clientX-(xe=We[0]),Fe=j.touches[1].clientY-Ce,rt=0<=(we=j.touches[0].clientX-xe)&&we<=Ae&&0<=Ue&&Ue<=Ae&&0<=Be&&Be<=Ve&&0<=Fe&&Fe<=Ve;var ct=Se.pan(),ut=Se.zoom();if(qe=ft(we,Be,Ue,Fe),Je=Ot(we,Be,Ue,Fe),Ye=[((at=[(we+Ue)/2,(Be+Fe)/2])[0]-ct.x)/ut,(at[1]-ct.y)/ut],Je<4e4&&!j.touches[2]){var It=r.findNearestElement(Me[0],Me[1],!0,!0),dt=r.findNearestElement(Me[2],Me[3],!0,!0);return It&&It.isNode()?(It.activate().emit(ot("cxttapstart")),r.touchData.start=It):dt&&dt.isNode()?(dt.activate().emit(ot("cxttapstart")),r.touchData.start=dt):Se.emit(ot("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(j.touches[2])Se.boxSelectionEnabled()&&j.preventDefault();else if(!j.touches[1]&&j.touches[0]){var Mt=r.findNearestElements(Me[0],Me[1],!0,!0),Nt=Mt[0];if(null!=Nt&&(Nt.activate(),r.touchData.start=Nt,r.touchData.starts=Mt,r.nodeIsGrabbable(Nt))){var or=r.dragData.touchDragEles=Se.collection(),er=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),Nt.selected()?(er=Se.$(function(lr){return lr.selected()&&r.nodeIsGrabbable(lr)}),w(er,{addToList:or})):p(Nt,{addToList:or}),d(Nt),Nt.emit(ot("grabon")),er?er.forEach(function(lr){lr.emit(ot("grab"))}):Nt.emit(ot("grab"))}a(Nt,["touchstart","tapstart","vmousedown"],j,{x:Me[0],y:Me[1]}),null==Nt&&(r.data.bgActivePosistion={x:He[0],y:He[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"],j,{x:Me[0],y:Me[1]})},r.tapholdDuration)}if(j.touches.length>=1){for(var Dr=r.touchData.startPosition=[null,null,null,null,null,null],nr=0;nr<Me.length;nr++)Dr[nr]=ke[nr]=Me[nr];var fr=j.touches[0];r.touchData.startGPosition=[fr.clientX,fr.clientY]}}},!1),r.registerBinding(e,"touchmove",wt=function(j){var Se=r.touchData.capture;if(Se||$(j)){var Me=r.selection,ke=r.cy,He=r.touchData.now,ot=r.touchData.earlier,We=ke.zoom();if(j.touches[0]){var ct=r.projectIntoViewport(j.touches[0].clientX,j.touches[0].clientY);He[0]=ct[0],He[1]=ct[1]}j.touches[1]&&(ct=r.projectIntoViewport(j.touches[1].clientX,j.touches[1].clientY),He[2]=ct[0],He[3]=ct[1]),j.touches[2]&&(ct=r.projectIntoViewport(j.touches[2].clientX,j.touches[2].clientY),He[4]=ct[0],He[5]=ct[1]);var Rt,ut=function(Lb){return{originalEvent:j,type:Lb,position:{x:He[0],y:He[1]}}},xt=r.touchData.startGPosition;if(Se&&j.touches[0]&&xt){for(var It=[],dt=0;dt<He.length;dt++)It[dt]=He[dt]-ot[dt];var Mt=j.touches[0].clientX-xt[0],or=j.touches[0].clientY-xt[1];Rt=Mt*Mt+or*or>=r.touchTapThreshold2}if(Se&&r.touchData.cxt){j.preventDefault();var En=Ot(nr=j.touches[0].clientX-xe,fr=j.touches[0].clientY-Ce,lr=j.touches[1].clientX-xe,yr=j.touches[1].clientY-Ce);if(En/Je>=2.25||En>=22500){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Bn=ut("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(Bn),r.touchData.start=null):ke.emit(Bn)}}if(Se&&r.touchData.cxt){Bn=ut("cxtdrag"),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Bn):ke.emit(Bn),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var Lr=r.findNearestElement(He[0],He[1],!0,!0);(!r.touchData.cxtOver||Lr!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(ut("cxtdragout")),r.touchData.cxtOver=Lr,Lr&&Lr.emit(ut("cxtdragover")))}else if(Se&&j.touches[2]&&ke.boxSelectionEnabled())j.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||ke.emit(ut("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,Me[4]=1,Me&&0!==Me.length&&void 0!==Me[0]?(Me[2]=(He[0]+He[2]+He[4])/3,Me[3]=(He[1]+He[3]+He[5])/3):(Me[0]=(He[0]+He[2]+He[4])/3,Me[1]=(He[1]+He[3]+He[5])/3,Me[2]=(He[0]+He[2]+He[4])/3+1,Me[3]=(He[1]+He[3]+He[5])/3+1),r.redrawHint("select",!0),r.redraw();else if(Se&&j.touches[1]&&!r.touchData.didSelect&&ke.zoomingEnabled()&&ke.panningEnabled()&&ke.userZoomingEnabled()&&ke.userPanningEnabled()){if(j.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),wr=r.dragData.touchDragEles){r.redrawHint("drag",!0);for(var Ar=0;Ar<wr.length;Ar++){var qa=wr[Ar]._private;qa.grabbed=!1,qa.rscratch.inDragLayer=!1}}var nr,fr,lr,yr,Pr=r.touchData.start,Zf=ft(nr=j.touches[0].clientX-xe,fr=j.touches[0].clientY-Ce,lr=j.touches[1].clientX-xe,yr=j.touches[1].clientY-Ce),bb=Zf/qe;if(rt){var Cb=(nr-we+(lr-Ue))/2,Db=(fr-Be+(yr-Fe))/2,Wa=ke.zoom(),Cl=Wa*bb,Qi=ke.pan(),Jf=Ye[0]*Wa+Qi.x,Qf=Ye[1]*Wa+Qi.y,Sb={x:-Cl/Wa*(Jf-Qi.x-Cb)+Jf,y:-Cl/Wa*(Qf-Qi.y-Db)+Qf};Pr&&Pr.active()&&(g(wr=r.dragData.touchDragEles),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Pr.unactivate().emit(ut("freeon")),wr.emit(ut("free")),r.dragData.didDrag&&(Pr.emit(ut("dragfreeon")),wr.emit(ut("dragfree")))),ke.viewport({zoom:Cl,pan:Sb,cancelOnFailedZoom:!0}),ke.emit(ut("pinchzoom")),qe=Zf,we=nr,Be=fr,Ue=lr,Fe=yr,r.pinching=!0}j.touches[0]&&(ct=r.projectIntoViewport(j.touches[0].clientX,j.touches[0].clientY),He[0]=ct[0],He[1]=ct[1]),j.touches[1]&&(ct=r.projectIntoViewport(j.touches[1].clientX,j.touches[1].clientY),He[2]=ct[0],He[3]=ct[1]),j.touches[2]&&(ct=r.projectIntoViewport(j.touches[2].clientX,j.touches[2].clientY),He[4]=ct[0],He[5]=ct[1])}else if(j.touches[0]&&!r.touchData.didSelect){var Fr=r.touchData.start,Dl=r.touchData.last;if(!r.hoverData.draggingEles&&!r.swipePanning&&(Lr=r.findNearestElement(He[0],He[1],!0,!0)),Se&&null!=Fr&&j.preventDefault(),Se&&null!=Fr&&r.nodeIsDraggable(Fr))if(Rt){var wr=r.dragData.touchDragEles,eh=!r.dragData.didDrag;eh&&w(wr,{inDragLayer:!0}),r.dragData.didDrag=!0;var $a={x:0,y:0};tt(It[0])&&tt(It[1])&&($a.x+=It[0],$a.y+=It[1],eh)&&(r.redrawHint("eles",!0),(Gr=r.touchData.dragDelta)&&tt(Gr[0])&&tt(Gr[1])&&($a.x+=Gr[0],$a.y+=Gr[1])),r.hoverData.draggingEles=!0,wr.silentShift($a).emit(ut("position")).emit(ut("drag")),r.redrawHint("drag",!0),r.touchData.startPosition[0]==ot[0]&&r.touchData.startPosition[1]==ot[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Gr;0===(Gr=r.touchData.dragDelta=r.touchData.dragDelta||[]).length?(Gr.push(It[0]),Gr.push(It[1])):(Gr[0]+=It[0],Gr[1]+=It[1])}if(a(Fr||Lr,["touchmove","tapdrag","vmousemove"],j,{x:He[0],y:He[1]}),(!Fr||!Fr.grabbed())&&Lr!=Dl&&(Dl&&Dl.emit(ut("tapdragout")),Lr&&Lr.emit(ut("tapdragover"))),r.touchData.last=Lr,Se)for(Ar=0;Ar<He.length;Ar++)He[Ar]&&r.touchData.startPosition[Ar]&&Rt&&(r.touchData.singleTouchMoved=!0);Se&&(null==Fr||Fr.pannable())&&ke.panningEnabled()&&ke.userPanningEnabled()&&(s(Fr,r.touchData.starts)&&(j.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Vn(r.touchData.startPosition)),r.swipePanning?(ke.panBy({x:It[0]*We,y:It[1]*We}),ke.emit(ut("dragpan"))):Rt&&(r.swipePanning=!0,ke.panBy({x:Mt*We,y:or*We}),ke.emit(ut("dragpan")),Fr&&(Fr.unactivate(),r.redrawHint("select",!0),r.touchData.start=null))),ct=r.projectIntoViewport(j.touches[0].clientX,j.touches[0].clientY),He[0]=ct[0],He[1]=ct[1])}for(dt=0;dt<He.length;dt++)ot[dt]=He[dt];Se&&j.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",mt=function(j){var Se=r.touchData.start;r.touchData.capture=!1,Se&&Se.unactivate()}),r.registerBinding(e,"touchend",it=function(j){var Se=r.touchData.start;if(r.touchData.capture){0===j.touches.length&&(r.touchData.capture=!1),j.preventDefault();var ke=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var He=r.cy,ot=He.zoom(),We=r.touchData.now,ct=r.touchData.earlier;if(j.touches[0]){var ut=r.projectIntoViewport(j.touches[0].clientX,j.touches[0].clientY);We[0]=ut[0],We[1]=ut[1]}j.touches[1]&&(ut=r.projectIntoViewport(j.touches[1].clientX,j.touches[1].clientY),We[2]=ut[0],We[3]=ut[1]),j.touches[2]&&(ut=r.projectIntoViewport(j.touches[2].clientX,j.touches[2].clientY),We[4]=ut[0],We[5]=ut[1]);var Rt,xt=function(tn){return{originalEvent:j,type:tn,position:{x:We[0],y:We[1]}}};if(Se&&Se.unactivate(),r.touchData.cxt){if(Rt=xt("cxttapend"),Se?Se.emit(Rt):He.emit(Rt),!r.touchData.cxtDragged){var It=xt("cxttap");Se?Se.emit(It):He.emit(It)}return r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,void r.redraw()}if(!j.touches[2]&&He.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var dt=He.collection(r.getAllInBox(ke[0],ke[1],ke[2],ke[3]));ke[0]=void 0,ke[1]=void 0,ke[2]=void 0,ke[3]=void 0,ke[4]=0,r.redrawHint("select",!0),He.emit(xt("boxend")),dt.emit(xt("box")).stdFilter(function(tn){return tn.selectable()&&!tn.selected()}).select().emit(xt("boxselect")),dt.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(Se?.unactivate(),j.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!j.touches[1]&&!j.touches[0]&&!j.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Nt=r.dragData.touchDragEles;if(null!=Se){var or=Se._private.grabbed;g(Nt),r.redrawHint("drag",!0),r.redrawHint("eles",!0),or&&(Se.emit(xt("freeon")),Nt.emit(xt("free")),r.dragData.didDrag&&(Se.emit(xt("dragfreeon")),Nt.emit(xt("dragfree")))),a(Se,["touchend","tapend","vmouseup","tapdragout"],j,{x:We[0],y:We[1]}),Se.unactivate(),r.touchData.start=null}else{var er=r.findNearestElement(We[0],We[1],!0,!0);a(er,["touchend","tapend","vmouseup","tapdragout"],j,{x:We[0],y:We[1]})}var Dr=r.touchData.startPosition[0]-We[0],fr=r.touchData.startPosition[1]-We[1],En=(Dr*Dr+fr*fr)*ot*ot;r.touchData.singleTouchMoved||(Se||He.$(":selected").unselect(["tapunselect"]),a(Se,["tap","vclick"],j,{x:We[0],y:We[1]}),ht=!1,j.timeStamp-Ct<=He.multiClickDebounceTime()?(gt&&clearTimeout(gt),ht=!0,Ct=null,a(Se,["dbltap","vdblclick"],j,{x:We[0],y:We[1]})):(gt=setTimeout(function(){ht||a(Se,["onetap","voneclick"],j,{x:We[0],y:We[1]})},He.multiClickDebounceTime()),Ct=j.timeStamp)),null!=Se&&!r.dragData.didDrag&&Se._private.selectable&&En<r.touchTapThreshold2&&!r.pinching&&("single"===He.selectionType()?(He.$(t).unmerge(Se).unselect(["tapunselect"]),Se.select(["tapselect"])):Se.selected()?Se.unselect(["tapunselect"]):Se.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}for(var ar=0;ar<We.length;ar++)ct[ar]=We[ar];r.dragData.didDrag=!1,0===j.touches.length&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),j.touches.length<2&&(1===j.touches.length&&(r.touchData.startGPosition=[j.touches[0].clientX,j.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())}},!1),typeof TouchEvent>"u"){var yt=[],At=function(j){return{clientX:j.clientX,clientY:j.clientY,force:1,identifier:j.pointerId,pageX:j.pageX,pageY:j.pageY,radiusX:j.width/2,radiusY:j.height/2,screenX:j.screenX,screenY:j.screenY,target:j.target}},Ht=function(j){for(var Se=0;Se<yt.length;Se++)if(yt[Se].event.pointerId===j.pointerId)return void yt.splice(Se,1)},Tt=function(j){j.touches=yt.map(function(Se){return Se.touch})},lt=function(j){return"mouse"===j.pointerType||4===j.pointerType};r.registerBinding(r.container,"pointerdown",function(Ge){lt(Ge)||(Ge.preventDefault(),yt.push(function(j){return{event:j,touch:At(j)}}(Ge)),Tt(Ge),St(Ge))}),r.registerBinding(r.container,"pointerup",function(Ge){lt(Ge)||(Ht(Ge),Tt(Ge),it(Ge))}),r.registerBinding(r.container,"pointercancel",function(Ge){lt(Ge)||(Ht(Ge),Tt(Ge),mt())}),r.registerBinding(r.container,"pointermove",function(Ge){var j,Se;lt(Ge)||(Ge.preventDefault(),j=Ge,(Se=yt.filter(function(Me){return Me.event.pointerId===j.pointerId})[0]).event=j,Se.touch=At(j),Tt(Ge),wt(Ge))})}};var Jr={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 Ca(o,l,this.points,n,a,i/2,s/2,u)},checkPoint:function(n,a,i,s,o,l,u,c){return Kr(n,a,this.points,l,u,s,o,[0,-1],i)},hasMiterBounds:"rectangle"!==r,miterBounds:function(n,a,i,s,o,l){return function Tv(r,e,t,n,a,i){var o=function Ev(r,e){if(r.length<3)throw new Error("Need at least 3 vertices");var t=function(X,W){return{x:X.x+W.x,y:X.y+W.y}},n=function(X,W){return{x:X.x-W.x,y:X.y-W.y}},a=function(X,W){return{x:X.x*W,y:X.y*W}},i=function(X,W){return X.x*W.y-X.y*W.x},s=function(X){var W=wv(X.x,X.y);return 0===W?{x:0,y:0}:{x:X.x/W,y:X.y/W}},l=function(X,W,$,Z){var J=n(W,X),Q=n(Z,$),oe=i(J,Q);if(Math.abs(oe)<1e-9)return t(X,a(J,.5));var ce=i(n($,X),Q)/oe;return t(X,a(J,ce))},u=r.map(function(G){return{x:G.x,y:G.y}});(function(X){for(var W=0,$=0;$<X.length;$++){var Z=X[$],J=X[($+1)%X.length];W+=Z.x*J.y-J.x*Z.y}return W/2})(u)<0&&u.reverse();for(var c=u.length,d=[],f=0;f<c;f++){var w=n(u[(f+1)%c],u[f]),p=s({x:w.y,y:-w.x});d.push(p)}for(var g=d.map(function(G,X){return{p1:t(u[X],a(G,e)),p2:t(u[(X+1)%c],a(G,e))}}),E=[],C=0;C<c;C++){var M=g[(C-1+c)%c],V=g[C],H=l(M.p1,M.p2,V.p1,V.p2);E.push(H)}return E}(Mv(r,e,t,n,a),i),l=Er();return o.forEach(function(u){return du(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 In(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?yu(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,w,p,g,E=f.length;for(w=f[E-1],v=0;v<E;v++)l[u][v]=al(w,p=f[v%E],g=f[(v+1)%E],o),w=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(E,C){0===C?(f[f.length-2]=E.startX,f[f.length-1]=E.startY):(f[4*C-2]=E.startX,f[4*C-1]=E.startY),f[4*C]=E.stopX,f[4*C+1]=E.stopY,0!==(d=Ta(e,t,a,i,E.cx,E.cy,E.radius)).length&&c.push(d[0],d[1])});for(var h=0;h<f.length/4;h++)0!==(d=un(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]],w=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<=w&&(v[0]=c[2*p],v[1]=c[2*p+1],w=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 Ir(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:Tr(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 gu(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?cn(a,i):l;var d=2*(l=Math.min(u,c,l));return!!(Kr(e,t,this.points,s,o,a,i-d,[0,-1],n)||Kr(e,t,this.points,s,o,a-d,i,[0,-1],n)||In(e,t,d,d,s-u+l,o-c+l,n)||In(e,t,d,d,s+u-l,o-c+l,n)||In(e,t,d,d,s+u-l,o+c-l,n)||In(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:Tr(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 Ca(i,s,c,e,t)},checkPoint:function(e,t,n,a,i,s,o,l){var u="auto"===l?this.cornerLength:l;if(Kr(e,t,this.points,s,o,a,i-2*u,[0,-1],n)||Kr(e,t,this.points,s,o,a-2*u,i,[0,-1],n))return!0;var c=this.generateCutTrianglePts(a,i,s,o);return Ir(e,t,c.topLeft)||Ir(e,t,c.topRight)||Ir(e,t,c.bottomRight)||Ir(e,t,c.bottomLeft)}}},generateBarrel:function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Tr(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=Hn({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},.15),E=Hn({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},.5),C=Hn({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,E.x,E.y,C.x,C.y,p[4],p[5]]},v=[].concat(h(f.topLeft),h(f.topRight),h(f.bottomRight),h(f.bottomLeft));return Ca(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=Ns(e,t),f=d.heightOffset,h=d.widthOffset,v=d.ctrlPtOffsetPct*e,w={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 w.topLeft.isTop=!0,w.topRight.isTop=!0,w.bottomLeft.isBottom=!0,w.bottomRight.isBottom=!0,w},checkPoint:function(e,t,n,a,i,s,o,l){var u=Ns(a,i),d=u.widthOffset;if(Kr(e,t,this.points,s,o,a,i-2*u.heightOffset,[0,-1],n)||Kr(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(X,W,$){var Z=$[4],J=$[2],Q=$[0],oe=$[5],ce=$[1],de=Math.min(Z,Q),le=Math.max(Z,Q),ge=Math.min(oe,ce),Te=Math.max(oe,ce);if(de<=X&&X<=le&&ge<=W&&W<=Te){var Ie=function(e,t,n){return[e-2*t+n,2*(t-e),e]}(Z,J,Q),ye=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],X),we=ye.filter(function(Be){return 0<=Be&&Be<=1});if(we.length>0)return we[0]}return null},v=Object.keys(f),w=0;w<v.length;w++){var g=f[v[w]],E=h(e,t,g);if(null!=E){var H=ur(g[5],g[3],g[1],E);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:Tr(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=un(i,s,e,t,e-(n/2+o),c,e+(n/2+o),c,!1);return h.length>0?h:gu(i,s,e,t,n,a,o,l)},checkPoint:function(e,t,n,a,i,s,o,l){var u=2*(l="auto"===l?cn(a,i):l);if(Kr(e,t,this.points,s,o,a,i-u,[0,-1],n)||Kr(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!!(Ir(e,t,[s-c,o-d,s-c,o,s+c,o,s+c,o-d])||In(e,t,u,u,s+a/2-l,o+i/2-l,n)||In(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",Tr(3,0)),this.generateRoundPolygon("round-triangle",Tr(3,0)),this.generatePolygon("rectangle",Tr(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",Tr(5,0)),this.generateRoundPolygon("round-pentagon",Tr(5,0)),this.generatePolygon("hexagon",Tr(6,0)),this.generateRoundPolygon("round-hexagon",Tr(6,0)),this.generatePolygon("heptagon",Tr(7,0)),this.generateRoundPolygon("round-heptagon",Tr(7,0)),this.generatePolygon("octagon",Tr(8,0)),this.generateRoundPolygon("round-octagon",Tr(8,0));var n=new Array(20),a=As(5,0),i=As(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=pu(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)}}},Ga={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(r){r=r||su();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&&Kt("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})}}},af=function(e,t,n){for(var a=e.beforeRenderCallbacks,i=0;i<a.length;i++)a[i].fn(t,n)};Ga.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){af(r,!0,a);var i=qr();r.render(r.renderOptions);var s=r.lastDrawTime=qr();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 af(r,!1,a);r.skipFrame=!1,ei(t)}};ei(t)}};var sf=function(e){this.init(e)},aa=sf.prototype;aa.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],aa.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")&&Gt("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=tt(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()},aa.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()}},aa.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{}},aa.isHeadless=function(){return!1},[Qo,rf,nf,na,Jr,Ga].forEach(function(r){bt(aa,r)});var sl=1e3/60,of_setupDequeueing=function(e){return function(){var n=this,a=this.renderer;if(!n.dequeueingSetup){n.dequeueingSetup=!0;var i=ya(function(){a.redrawHint("eles",!0),a.redrawHint("drag",!0),a.redraw()},e.deqRedrawThreshold);a.beforeRender(function(u,c){var d=qr(),f=a.averageRedrawTime,h=a.lastRedrawTime,v=[],w=a.cy.extent(),p=a.getPixelRatio();for(u||a.flushRenderedStyleQueue();;){var g=qr(),E=g-d,C=g-c;if(h<sl){if(C>=e.deqFastCost*(sl-(u?f:0)))break}else if(u){if(E>=e.deqCost*h||E>=e.deqAvgCost*f)break}else if(C>=e.deqNoDrawCost*sl)break;var V=e.deq(n,p,w);if(!(V.length>0))break;for(var H=0;H<V.length;H++)v.push(V[H])}v.length>0&&(e.onDeqd(n,v),!u&&e.shouldRedraw(n,v,p,w)&&i())},(e.priority||xs)(n))}}},Zy=function(){return ve(function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ri;ze(this,r),this.idsByKey=new $r,this.keyForId=new $r,this.cachesByLvl=new $r,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t},[{key:"getIdsFor",value:function(t){null==t&&Kt("Can not get id list for null key");var n=this.idsByKey,a=this.idsByKey.get(t);return a||(a=new zn,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 $r,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)}}])}(),ia={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},dm=hr({getKey:null,doesEleInvalidateKey:ri,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:ru,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),za=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var a=dm(t);bt(n,a),n.lookup=new Zy(a.getKey,a.doesEleInvalidateKey),n.setupDequeueing()},sr=za.prototype;sr.reasons=ia,sr.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]},sr.getRetiredTextureQueue=function(r){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[r]=t[r]||[]},sr.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new wa(function(t,n){return n.reqs-t.reqs})},sr.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},sr.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(Ds(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 w=i.getTextureQueue(v),p=w[w.length-2],g=function(){return i.recycleTexture(v,d)||i.addTexture(v,d)};p||(p=w[w.length-1]),p||(p=g()),p.width-p.usedWidth<d&&(p=g());for(var H,E=function(de){return de&&de.scaledLabelShown===f},C=a&&a===ia.dequeue,M=a&&a===ia.highQuality,V=a&&a===ia.downscale,G=n+1;G<=3;G++){var X=l.get(r,G);if(X){H=X;break}}var W=H&&H.level===n+1?H:null,$=function(){p.context.drawImage(W.texture.canvas,W.x,0,W.width,W.height,p.usedWidth,0,d,c)};if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,d,v),E(W))$();else if(E(H)){if(!M)return i.queueElement(r,H.level-1),H;for(var Z=H.level;Z>n;Z--)W=i.getElement(r,e,t,Z,ia.downscale);$()}else{var J;if(!C&&!M&&!V)for(var Q=n-1;Q>=-4;Q--){var oe=l.get(r,Q);if(oe){J=oe;break}}if(E(J))return i.queueElement(r,n),J;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},sr.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])},sr.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)}},sr.checkTextureUtility=function(r){r.invalidatedWidth>=.2*r.width&&this.retireTexture(r)},sr.checkTextureFullness=function(r){var t=this.getTextureQueue(r.height);r.usedWidth/r.width>.8&&r.fullnessChecks>=10?on(t,r):r.fullnessChecks++},sr.retireTexture=function(r){var t=r.height,n=this.getTextureQueue(t),a=this.lookup;on(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)}ws(i),this.getRetiredTextureQueue(t).push(r)},sr.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},sr.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,ws(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),on(a,s),n.push(s),s}},sr.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}},sr.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,ia.dequeue)}}return a},sr.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=bs,t.updateItem(i),t.pop(),n[a]=null):i.eles.unmerge(r))},sr.onDequeue=function(r){this.onDequeues.push(r)},sr.offDequeue=function(r){on(this.onDequeues,r)},sr.setupDequeueing=of_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(Is(l,a))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var ff=function(e){var t=this,n=t.renderer=e,a=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=qr()-500,t.skipping=!1,t.eleTxrDeqs=a.collection(),t.scheduleElementRefinement=ya(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 wa(function(o,l){return l.reqs-o.reqs}),t.setupDequeueing()},pr=ff.prototype,hf=0,Tm=Math.pow(2,53)-1;pr.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:hf=++hf%Tm,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},pr.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(Ds(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 $=function(ce){if(n.validateLayersElesOrdering(ce,r),n.levelIsComplete(ce,r))return h=l[ce],!0},Z=function(ce){if(!h)for(var de=t+ce;-4<=de&&de<=2&&!$(de);de+=ce);};Z(1),Z(-1);for(var J=c.length-1;J>=0;J--){var Q=c[J];Q.invalid&&on(c,Q)}}();var p=function($){var Z=($=$||{}).after;!function(){if(!d){d=Er();for(var $=0;$<r.length;$++)xv(d,r[$].boundingBox())}}();var J=Math.ceil(d.w*u),Q=Math.ceil(d.h*u);if(J>32767||Q>32767)return null;if(J*Q>16e6)return null;var ce=n.makeLayer(d,t);if(null!=Z){var de=c.indexOf(Z)+1;c.splice(de,0,ce)}else(void 0===$.insert||$.insert)&&c.unshift(ce);return ce};if(n.skipping&&!o)return null;for(var g=null,E=r.length/1,C=!o,M=0;M<r.length;M++){var V=r[M],H=V._private.rscratch,G=H.imgLayerCaches=H.imgLayerCaches||{},X=G[t];if(X)g=X;else{if((!g||g.eles.length>=E||!vu(g.bb,V.boundingBox()))&&!(g=p({insert:!0,after:g})))return null;h||C?n.queueLayer(g,V):n.drawEleInLayer(g,V,t,e),g.eles.push(V),G[t]=g}}return h||(C?null:c)},pr.getEleLevelForLayerLevel=function(r,e){return r},pr.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))},pr.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},pr.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}}}},pr.updateElementsInLayers=function(r,e){for(var n=ha(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))}},pr.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},pr.invalidateElements=function(r){var e=this;0!==r.length&&(e.lastInvalidationTime=qr(),0!==r.length&&e.haveLayers()&&e.updateElementsInLayers(r,function(n,a,i){e.invalidateLayer(n)}))},pr.invalidateLayer=function(r){if(this.lastInvalidationTime=qr(),!r.invalid){var e=r.level,t=r.eles;on(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)}}},pr.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])})},pr.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()},pr.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))}},pr.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},pr.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()}},pr.requestRedraw=ya(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100),pr.setupDequeueing=of_setupDequeueing({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:xs,shouldRedraw:ru,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var gf,vf={};function Cm(r,e){for(var t=0;t<e.length;t++){var n=e[t];r.lineTo(n.x,n.y)}}function Dm(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 pf(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 Sm(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 Im(r,e,t,n){r.arc(e,t,n,0,2*Math.PI,!1)}vf.arrowShapeImpl=function(r){return(gf||(gf={polygon:Cm,"triangle-backcurve":Dm,"triangle-tee":pf,"circle-triangle":Sm,"triangle-cross":pf,circle:Im}))[r]};var jr={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,E,C,M,V,X,f=s(l,e),h=u.x1,v=u.y1,w=u.w,p=u.h;if(0!==f){var H=t.getRotationPoint(e);r.translate(C=H.x,M=H.y),r.rotate(f),(V=l.getImgSmoothing(r))||l.setImgSmoothing(r,!0);var G=t.getRotationOffset(e);g=G.x,E=G.y}else g=h,E=v;1!==d&&(r.globalAlpha=(X=r.globalAlpha)*d),r.drawImage(c.texture.canvas,c.x,0,c.width,c.height,g,E,w,p),1!==d&&(r.globalAlpha=X),0!==f&&(r.rotate(-f),r.translate(-C,-M),V||l.setImgSmoothing(r,!1))}else t.drawElement(r,e)}}},Lm=function(){return 0},Am=function(e,t){return e.getTextAngle(t,null)},Rm=function(e,t){return e.getTextAngle(t,"source")},Nm=function(e,t){return e.getTextAngle(t,"target")},Mm=function(e,t){return t.effectiveOpacity()},ll=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};jr.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||Is(f,n))){var v=e.isEdge(),w=e.element()._private.rscratch.badLine;s.drawElementUnderlay(r,e),s.drawCachedElementPortion(r,e,l,t,a,h,Lm,Mm),(!v||!w)&&s.drawCachedElementPortion(r,e,u,t,a,h,Am,ll),v&&!w&&(s.drawCachedElementPortion(r,e,c,t,a,h,Rm,ll),s.drawCachedElementPortion(r,e,d,t,a,h,Nm,ll)),s.drawElementOverlay(r,e)}},jr.drawElements=function(r,e){for(var n=0;n<e.length;n++)this.drawElement(r,e[n])},jr.drawCachedElements=function(r,e,t,n){for(var i=0;i<e.length;i++)this.drawCachedElement(r,e[i],t,n)},jr.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)}},jr.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 Qr={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,w=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,g=u*c,E=u*c,C=function(){var ce=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;"straight-triangle"===d?(s.eleStrokeStyle(r,e,ce),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=h,r.lineCap=v,s.eleStrokeStyle(r,e,ce),s.drawEdgePath(e,r,o.allpts,f),r.lineCap="butt")},G=function(){s.drawArrowheads(r,e,arguments.length>0&&void 0!==arguments[0]?arguments[0]:E)};if(r.lineJoin="round","yes"===e.pstyle("ghost").value){var $=e.pstyle("ghost-offset-x").pfValue,Z=e.pstyle("ghost-offset-y").pfValue,J=e.pstyle("ghost-opacity").value,Q=g*J;r.translate($,Z),C(Q),G(Q),r.translate(-$,-Z)}else!function(){var ce=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;r.lineWidth=h+w,r.lineCap=v,w>0?(s.colorStrokeStyle(r,p[0],p[1],p[2],ce),"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(),G(),a&&s.drawEdgeOverlay(r,e),s.drawElementText(r,e,null,n),t&&r.translate(l.x1,l.y1)}}},yf=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")}}}};Qr.drawEdgeOverlay=yf("overlay"),Qr.drawEdgeUnderlay=yf("underlay"),Qr.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,w=_e(a.roundCorners);try{for(w.s();!(p=w.n()).done;)$d(e,p.value)}catch(C){w.e(C)}finally{w.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var E=2;E+1<t.length;E+=2)e.lineTo(t[E],t[E+1])}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])},Qr.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()}},Qr.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)},Qr.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 w=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=w);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)}}},Qr.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},w=r.pstyle("arrow-scale").value,p=this.getArrowWidth(n,w),g=u.arrowShapes[a];if(c){var E=u.arrowPathCache=u.arrowPathCache||[],C=Cn(a),M=E[C];null!=M?(f=e=M,d=!0):(f=e=new Path2D,E[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 ul={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){Gt(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(),w=2*t.padding(),p=h+("inner"===c(t,"background-width-relative-to","value",n)?0:w),g=v+("inner"===c(t,"background-height-relative-to","value",n)?0:w),E=t._private.rscratch,M="node"===c(t,"background-clip","value",n),V=c(t,"background-image-opacity","value",n)*a,H=c(t,"background-image-smoothing","value",n),G=t.pstyle("corner-radius").value;"auto"!==G&&(G=t.pstyle("corner-radius").pfValue);var X=e.width||e.cachedW,W=e.height||e.cachedH;(null==X||null==W)&&(document.body.appendChild(e),X=e.cachedW=e.width||e.offsetWidth,W=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var $=X,Z=W;if("auto"!==c(t,"background-width","value",n)&&($="%"===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)&&(Z="%"===c(t,"background-height","units",n)?c(t,"background-height","pfValue",n)*g:c(t,"background-height","pfValue",n)),0!==$&&0!==Z){if("contain"===d)$*=J=Math.min(p/$,g/Z),Z*=J;else if("cover"===d){var J;$*=J=Math.max(p/$,g/Z),Z*=J}var Q=o-p/2,oe=c(t,"background-position-x","units",n),ce=c(t,"background-position-x","pfValue",n);Q+="%"===oe?(p-$)*ce:ce;var de=c(t,"background-offset-x","units",n),le=c(t,"background-offset-x","pfValue",n);Q+="%"===de?(p-$)*le:le;var ge=l-g/2,Te=c(t,"background-position-y","units",n),Ie=c(t,"background-position-y","pfValue",n);ge+="%"===Te?(g-Z)*Ie:Ie;var ye=c(t,"background-offset-y","units",n),we=c(t,"background-offset-y","pfValue",n);ge+="%"===ye?(g-Z)*we:we,E.pathCache&&(Q-=o,ge-=l,o=0,l=0);var Be=r.globalAlpha;r.globalAlpha=V;var Ue=i.getImgSmoothing(r),Fe=!1;if("no"===H&&Ue?(i.setImgSmoothing(r,!1),Fe=!0):"yes"===H&&!Ue&&(i.setImgSmoothing(r,!0),Fe=!0),"no-repeat"===f)M&&(r.save(),E.pathCache?r.clip(E.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,o,l,p,g,G,E),r.clip())),i.safeDrawImage(r,e,0,0,X,W,Q,ge,$,Z),M&&r.restore();else{var qe=r.createPattern(e,f);r.fillStyle=qe,i.nodeShapes[i.getNodeShape(t)].draw(r,o,l,p,g,G,E),r.translate(Q,ge),r.fill(),r.translate(-Q,-ge)}r.globalAlpha=Be,Fe&&i.setImgSmoothing(r,Ue)}}},Pn={};function mf(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()}Pn.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),n=this.getPixelRatio(),a=Math.ceil(Ds(t*n));e=Math.pow(2,a)}return!(r.pstyle("font-size").pfValue*e<r.pstyle("min-zoomed-font-size").pfValue)},Pn.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);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,c=e.pstyle("label"),d=e.pstyle("source-label"),f=e.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!f||!f.value))return;r.textAlign="center",r.textBaseline="bottom"}var v,h=!t;t&&r.translate(-(v=t).x1,-v.y1),null==a?(s.drawText(r,e,null,h,i),e.isEdge()&&(s.drawText(r,e,"source",h,i),s.drawText(r,e,"target",h,i))):s.drawText(r,e,a,h,i),t&&r.translate(v.x1,v.y1)},Pn.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},Pn.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)},Pn.getTextAngle=function(r,e){var t,a=r._private.rscratch,s=r.pstyle((e?e+"-":"")+"text-rotation");if("autorotate"===s.strValue){var o=Sr(a,"labelAngle",e);t=r.isEdge()?o:0}else t="none"===s.strValue?0:s.pfValue;return t},Pn.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=Sr(s,"labelX",t),u=Sr(s,"labelY",t),f=this.getLabelText(e,t);if(null!=f&&""!==f&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,a);var V,h=t?t+"-":"",v=Sr(s,"labelWidth",t),w=Sr(s,"labelHeight",t),p=e.pstyle(h+"text-margin-x").pfValue,g=e.pstyle(h+"text-margin-y").pfValue,E=e.isEdge(),C=e.pstyle("text-halign").value,M=e.pstyle("text-valign").value;switch(E&&(C="center",M="center"),l+=p,u+=g,0!==(V=n?this.getTextAngle(e,t):0)&&(r.translate(c=l,d=u),r.rotate(V),l=0,u=0),M){case"top":break;case"center":u+=w/2;break;case"bottom":u+=w}var H=e.pstyle("text-background-opacity").value,G=e.pstyle("text-border-opacity").value,X=e.pstyle("text-border-width").pfValue,W=e.pstyle("text-background-padding").pfValue,$=e.pstyle("text-background-shape").strValue,Z="round-rectangle"===$||"roundrectangle"===$,J="circle"===$;if(H>0||X>0&&G>0){var oe=r.fillStyle,ce=r.strokeStyle,de=r.lineWidth,le=e.pstyle("text-background-color").value,ge=e.pstyle("text-border-color").value,Te=e.pstyle("text-border-style").value,Ie=H>0,ye=X>0&&G>0,we=l-W;switch(C){case"left":we-=v;break;case"center":we-=v/2}var Be=u-w-W,Ue=v+2*W,Fe=w+2*W;if(Ie&&(r.fillStyle="rgba(".concat(le[0],",").concat(le[1],",").concat(le[2],",").concat(H*o,")")),ye&&(r.strokeStyle="rgba(".concat(ge[0],",").concat(ge[1],",").concat(ge[2],",").concat(G*o,")"),r.lineWidth=X,r.setLineDash))switch(Te){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=X/4,r.setLineDash([]);break;default:r.setLineDash([])}if(Z?(r.beginPath(),mf(r,we,Be,Ue,Fe,2)):J?(r.beginPath(),function Om(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,we,Be,Ue,Fe)):(r.beginPath(),r.rect(we,Be,Ue,Fe)),Ie&&r.fill(),ye&&r.stroke(),ye&&"double"===Te){var qe=X/2;r.beginPath(),Z?mf(r,we+qe,Be+qe,Ue-2*qe,Fe-2*qe,2):r.rect(we+qe,Be+qe,Ue-2*qe,Fe-2*qe),r.stroke()}r.fillStyle=oe,r.strokeStyle=ce,r.lineWidth=de,r.setLineDash&&r.setLineDash([])}var Je=2*e.pstyle("text-outline-width").pfValue;if(Je>0&&(r.lineWidth=Je),"wrap"===e.pstyle("text-wrap").value){var at=Sr(s,"labelWrapCachedLines",t),Ye=Sr(s,"labelLineHeight",t),xe=v/2,Ce=this.getLabelJustification(e);switch("auto"===Ce||("left"===C?"left"===Ce?l+=-v:"center"===Ce&&(l+=-xe):"center"===C?"left"===Ce?l+=-xe:"right"===Ce&&(l+=xe):"right"===C&&("center"===Ce?l+=xe:"right"===Ce&&(l+=v))),M){case"top":case"center":case"bottom":u-=(at.length-1)*Ye}for(var Ae=0;Ae<at.length;Ae++)Je>0&&r.strokeText(at[Ae],l,u),r.fillText(at[Ae],l,u),u+=Ye}else Je>0&&r.strokeText(f,l,u),r.fillText(f,l,u);0!==V&&(r.rotate(-V),r.translate(-c,-d))}}};var bn={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(tt(d.x)&&tt(d.y)&&(!i||e.visible())){var v,g,f=i?e.effectiveOpacity():1,h=s.usePaths(),w=!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,M=new Array(C.length),V=new Array(C.length),H=0,G=0;G<C.length;G++){var X=C[G];if(M[G]=null!=X&&"none"!==X){var $=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",G);H++,V[G]=s.getCachedImage(X,$,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var Z=e.pstyle("background-blacken").value,J=e.pstyle("border-width").pfValue,Q=e.pstyle("background-opacity").value*f,oe=e.pstyle("border-color").value,ce=e.pstyle("border-style").value,de=e.pstyle("border-join").value,le=e.pstyle("border-cap").value,ge=e.pstyle("border-position").value,Te=e.pstyle("border-dash-pattern").pfValue,Ie=e.pstyle("border-dash-offset").pfValue,ye=e.pstyle("border-opacity").value*f,we=e.pstyle("outline-width").pfValue,Be=e.pstyle("outline-color").value,Ue=e.pstyle("outline-style").value,Fe=e.pstyle("outline-opacity").value*f,qe=e.pstyle("outline-offset").value,Je=e.pstyle("corner-radius").value;"auto"!==Je&&(Je=e.pstyle("corner-radius").pfValue);var at=function(){s.eleFillStyle(r,e,arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q)},Ye=function(){s.colorStrokeStyle(r,oe[0],oe[1],oe[2],arguments.length>0&&void 0!==arguments[0]?arguments[0]:ye)},xe=function(){s.colorStrokeStyle(r,Be[0],Be[1],Be[2],arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fe)},Ce=function(lt,Ge,j,Se){var ot,Me=s.nodePathCache=s.nodePathCache||[],ke=eu("polygon"===j?j+","+Se.join(","):j,""+Ge,""+lt,""+Je),He=Me[ke],We=!1;return null!=He?(We=!0,c.pathCache=ot=He):(ot=new Path2D,Me[ke]=c.pathCache=ot),{path:ot,cacheHit:We}},Ae=e.pstyle("shape").strValue,Ve=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(d.x,d.y);var rt=Ce(o,l,Ae,Ve);v=rt.path,w=rt.cacheHit}var ft=function(){if(!w){var lt=d;h&&(lt={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(v||r,lt.x,lt.y,o,l,Je,c)}h?r.fill(v):r.fill()},Ot=function(){for(var lt=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,Ge=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],j=u.backgrounding,Se=0,Me=0;Me<V.length;Me++){var ke=e.cy().style().getIndexedStyle(e,"background-image-containment","value",Me);Ge&&"over"===ke||!Ge&&"inside"===ke?Se++:M[Me]&&V[Me].complete&&!V[Me].error&&(Se++,s.drawInscribedImage(r,V[Me],e,Me,lt))}u.backgrounding=Se!==H,j!==u.backgrounding&&e.updateStyle(!1)},St=function(){var lt=arguments.length>0&&void 0!==arguments[0]&&arguments[0],Ge=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;s.hasPie(e)&&(s.drawPie(r,e,Ge),lt&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,d.x,d.y,o,l,Je,c)))},wt=function(){var lt=arguments.length>0&&void 0!==arguments[0]&&arguments[0],Ge=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,Je,c),r.clip()),s.drawStripe(r,e,Ge),r.restore(),lt&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,d.x,d.y,o,l,Je,c)))},mt=function(){var j=Z>0?0:255;0!==Z&&(s.colorFillStyle(r,j,j,j,(Z>0?Z:-Z)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:f)),h?r.fill(v):r.fill())},it=function(){if(J>0){if(r.lineWidth=J,r.lineCap=le,r.lineJoin=de,r.setLineDash)switch(ce){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(Te),r.lineDashOffset=Ie;break;case"solid":case"double":r.setLineDash([])}if("center"!==ge){if(r.save(),r.lineWidth*=2,"inside"===ge)h?r.clip(v):r.clip();else{var lt=new Path2D;lt.rect(-o/2-J,-l/2-J,o+2*J,l+2*J),lt.addPath(v),r.clip(lt,"evenodd")}h?r.stroke(v):r.stroke(),r.restore()}else h?r.stroke(v):r.stroke();if("double"===ce){r.lineWidth=J/3;var Ge=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(v):r.stroke(),r.globalCompositeOperation=Ge}r.setLineDash&&r.setLineDash([])}},ht=function(){if(we>0){if(r.lineWidth=we,r.lineCap="butt",r.setLineDash)switch(Ue){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([])}var lt=d;h&&(lt={x:0,y:0});var Ge=s.getNodeShape(e),j=J;"inside"===ge&&(j=0),"outside"===ge&&(j*=2);var We,Se=(o+j+(we+qe))/o,Me=(l+j+(we+qe))/l,ke=o*Se,He=l*Me,ot=s.nodeShapes[Ge].points;if(h&&(We=Ce(ke,He,Ge,ot).path),"ellipse"===Ge)s.drawEllipsePath(We||r,lt.x,lt.y,ke,He);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(Ge)){var ut=0,xt=0,Rt=0;"round-diamond"===Ge?ut=1.4*(j+qe+we):"round-heptagon"===Ge?(ut=1.075*(j+qe+we),Rt=-(j/2+qe+we)/35):"round-hexagon"===Ge?ut=1.12*(j+qe+we):"round-pentagon"===Ge?(ut=1.13*(j+qe+we),Rt=-(j/2+qe+we)/15):"round-tag"===Ge?(ut=1.12*(j+qe+we),xt=.07*(j/2+we+qe)):"round-triangle"===Ge&&(ut=(j+qe+we)*(Math.PI/2),Rt=-(j+qe/2+we)/Math.PI),0!==ut&&(ke=o*(Se=(o+ut)/o),["round-hexagon","round-tag"].includes(Ge)||(He=l*(Me=(l+ut)/l)));for(var It=ke/2,dt=He/2,Mt=(Je="auto"===Je?yu(ke,He):Je)+(j+we+qe)/2,Nt=new Array(ot.length/2),or=new Array(ot.length/2),er=0;er<ot.length/2;er++)Nt[er]={x:lt.x+xt+It*ot[2*er],y:lt.y+Rt+dt*ot[2*er+1]};var Dr,nr,fr,lr,yr=Nt.length;for(nr=Nt[yr-1],Dr=0;Dr<yr;Dr++)or[Dr]=al(nr,fr=Nt[Dr%yr],lr=Nt[(Dr+1)%yr],Mt),nr=fr,fr=lr;s.drawRoundPolygonPath(We||r,lt.x+xt,lt.y+Rt,o*Se,l*Me,ot,or)}else["roundrectangle","round-rectangle"].includes(Ge)?(Je="auto"===Je?cn(ke,He):Je,s.drawRoundRectanglePath(We||r,lt.x,lt.y,ke,He,Je+(j+we+qe)/2)):["cutrectangle","cut-rectangle"].includes(Ge)?s.drawCutRectanglePath(We||r,lt.x,lt.y,ke,He,null,(Je="auto"===Je?8:Je)+(j+we+qe)/4):["bottomroundrectangle","bottom-round-rectangle"].includes(Ge)?(Je="auto"===Je?cn(ke,He):Je,s.drawBottomRoundRectanglePath(We||r,lt.x,lt.y,ke,He,Je+(j+we+qe)/2)):"barrel"===Ge?s.drawBarrelPath(We||r,lt.x,lt.y,ke,He):Ge.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(Ge)?(ot=ui(ci(ot,(j+we+qe)/o)),s.drawPolygonPath(We||r,lt.x,lt.y,o,l,ot)):(ot=ui(ci(ot,-(j+we+qe)/o)),s.drawPolygonPath(We||r,lt.x,lt.y,o,l,ot));if(h?r.stroke(We):r.stroke(),"double"===Ue){r.lineWidth=j/3;var en=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(We):r.stroke(),r.globalCompositeOperation=en}r.setLineDash&&r.setLineDash([])}};if("yes"===e.pstyle("ghost").value){var Pt=e.pstyle("ghost-offset-x").pfValue,Vt=e.pstyle("ghost-offset-y").pfValue,Ht=e.pstyle("ghost-opacity").value,Ut=Ht*f;r.translate(Pt,Vt),xe(),ht(),at(Ht*Q),ft(),Ot(Ut,!0),Ye(Ht*ye),it(),St(0!==Z||0!==J),wt(0!==Z||0!==J),Ot(Ut,!1),mt(Ut),r.translate(-Pt,-Vt)}h&&r.translate(-d.x,-d.y),a&&s.drawNodeUnderlay(r,e,d,o,l),h&&r.translate(d.x,d.y),xe(),ht(),at(),ft(),Ot(f,!0),Ye(),it(),St(0!==Z||0!==J),wt(0!==Z||0!==J),Ot(f,!1),mt(),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)}}},bf=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()}}}};bn.drawNodeOverlay=bf("overlay"),bn.drawNodeUnderlay=bf("underlay"),bn.hasPie=function(r){return(r=r[0])._private.hasPie},bn.hasStripe=function(r){return(r=r[0])._private.hasStripe},bn.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,E=e.pstyle("pie-"+p+"-background-color").value,C=e.pstyle("pie-"+p+"-background-opacity").value*t,M=g/100;M+v>1&&(M=1-v);var V=1.5*Math.PI+2*Math.PI*v,G=(V+=o)+2*Math.PI*M;0===g||v>=1||v+M>1||(0===h?(r.beginPath(),r.moveTo(l,u),r.arc(l,u,f,V,G),r.closePath()):(r.beginPath(),r.arc(l,u,f,V,G),r.arc(l,u,h,G,V,!0),r.closePath()),this.colorFillStyle(r,E[0],E[1],E[2],C),r.fill(),v+=M)}},bn.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 w=1;w<=a.stripeBackgroundN;w++){var p=e.pstyle("stripe-"+w+"-background-size").value,g=e.pstyle("stripe-"+w+"-background-color").value,E=e.pstyle("stripe-"+w+"-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],E),r.fill(),u+=C)}r.restore()};var Ha,Cr={};function xf(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 _m(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 cl(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 Gm(r){return"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 zm(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 kn(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 sa(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 Vm(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function wf(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 Ef(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function Um(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 Yr(r,e,t,n){var i=Qe(wf(r,t),3),s=i[0],o=i[1],l=i[2],u=Ef(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]=Um(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,w,p){var g=f[v];g[0]=w,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}Cr.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)},Cr.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},Cr.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=Dn(u,d),h=Dn(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(),w=t.paddedWidth(),p=t.paddedHeight();i=r.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(w,p))}else if(t.isEdge()){var g=t.sourceEndpoint(),E=t.targetEndpoint();i=r.createLinearGradient(g.x,g.y,E.x,E.y)}else{var C=s?{x:0,y:0}:t.position(),H=t.paddedWidth()/2,G=t.paddedHeight()/2;switch(t.pstyle("background-gradient-direction").value){case"to-bottom":i=r.createLinearGradient(C.x,C.y-G,C.x,C.y+G);break;case"to-top":i=r.createLinearGradient(C.x,C.y+G,C.x,C.y-G);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-G,C.x+H,C.y+G);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(C.x-H,C.y+G,C.x+H,C.y-G);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(C.x+H,C.y-G,C.x-H,C.y+G);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(C.x+H,C.y+G,C.x-H,C.y-G)}}if(!i)return null;for(var W=l.length===o.length,$=o.length,Z=0;Z<$;Z++)i.addColorStop(W?l[Z]:Z/($-1),"rgba("+o[Z][0]+","+o[Z][1]+","+o[Z][2]+","+a+")");return i},Cr.gradientFillStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"background",e,t,n);if(!a)return null;r.fillStyle=a},Cr.colorFillStyle=function(r,e,t,n,a){r.fillStyle="rgba("+e+","+t+","+n+","+a+")"},Cr.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)}},Cr.gradientStrokeStyle=function(r,e,t,n){var a=this.createGradientStyleFor(r,"line",e,t,n);if(!a)return null;r.strokeStyle=a},Cr.colorStrokeStyle=function(r,e,t,n,a){r.strokeStyle="rgba("+e+","+t+","+n+","+a+")"},Cr.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)}},Cr.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}},Cr.renderTo=function(r,e,t,n){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:n})},Cr.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])},Cr.render=function(r){var e=this;r=r||su();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(),w=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 E=t.style(),C=t.zoom(),M=void 0!==s?s:C,V=t.pan(),H={x:V.x,y:V.y},G={zoom:C,pan:{x:V.x,y:V.y}},X=e.prevViewport;!(void 0===X||G.zoom!==X.zoom||G.pan.x!==X.pan.x||G.pan.y!==X.pan.y)&&!(w&&!v)&&(e.motionBlurPxRatio=1),o&&(H=o),M*=l,H.x*=l,H.y*=l;var $=e.getCachedZSortedEles();function Z(Ye,xe,Ce,Ae,Ve){var rt=Ye.globalCompositeOperation;Ye.globalCompositeOperation="destination-out",e.colorFillStyle(Ye,255,255,255,e.motionBlurTransparency),Ye.fillRect(xe,Ce,Ae,Ve),Ye.globalCompositeOperation=rt}function J(Ye,xe){var Ce,Ae,Ve,rt;e.clearingMotionBlur||Ye!==u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]&&Ye!==u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]?(Ce=H,Ae=M,Ve=e.canvasWidth,rt=e.canvasHeight):(Ce={x:V.x*h,y:V.y*h},Ae=C*h,Ve=e.canvasWidth*h,rt=e.canvasHeight*h),Ye.setTransform(1,0,0,1,0,0),"motionBlur"===xe?Z(Ye,0,0,Ve,rt):!n&&(void 0===xe||xe)&&Ye.clearRect(0,0,Ve,rt),a||(Ye.translate(Ce.x,Ce.y),Ye.scale(Ae,Ae)),o&&Ye.translate(o.x,o.y),s&&Ye.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 Q=e.data.bufferContexts[e.TEXTURE_BUFFER];Q.setTransform(1,0,0,1,0,0),Q.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:Q,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult}),(G=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight}).mpan={x:(0-G.pan.x)/G.zoom,y:(0-G.pan.y)/G.zoom}}c[e.DRAG]=!1,c[e.NODE]=!1;var ce=e.textureCache.texture;G=e.textureCache.viewport,(oe=u.contexts[e.NODE]).setTransform(1,0,0,1,0,0),f?Z(oe,0,0,G.width,G.height):oe.clearRect(0,0,G.width,G.height);var de=E.core("outside-texture-bg-color").value,le=E.core("outside-texture-bg-opacity").value;e.colorFillStyle(oe,de[0],de[1],de[2],le),oe.fillRect(0,0,G.width,G.height),C=t.zoom(),J(oe,!1),oe.clearRect(G.mpan.x,G.mpan.y,G.width/G.zoom/l,G.height/G.zoom/l),oe.drawImage(ce,G.mpan.x,G.mpan.y,G.width/G.zoom/l,G.height/G.zoom/l)}else e.textureOnViewport&&!n&&(e.textureCache=null);var oe,ge=t.extent(),Te=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),Ie=e.hideEdgesOnViewport&&Te,ye=[];if(ye[e.NODE]=!c[e.NODE]&&f&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,ye[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),ye[e.DRAG]=!c[e.DRAG]&&f&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,ye[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),c[e.NODE]||a||i||ye[e.NODE]){var we=f&&!ye[e.NODE]&&1!==h;J(oe=n||(we?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),f&&!we?"motionBlur":void 0),Ie?e.drawCachedNodes(oe,$.nondrag,l,ge):e.drawLayeredElements(oe,$.nondrag,l,ge),e.debug&&e.drawDebugPoints(oe,$.nondrag),!a&&!f&&(c[e.NODE]=!1)}!i&&(c[e.DRAG]||a||ye[e.DRAG])&&(we=f&&!ye[e.DRAG]&&1!==h,J(oe=n||(we?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]),f&&!we?"motionBlur":void 0),Ie?e.drawCachedNodes(oe,$.drag,l,ge):e.drawCachedElements(oe,$.drag,l,ge),e.debug&&e.drawDebugPoints(oe,$.drag),!a&&!f&&(c[e.DRAG]=!1));if(this.drawSelectionRectangle(r,J),f&&1!==h){var qe=u.contexts[e.DRAG],Je=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],at=function(xe,Ce,Ae){xe.setTransform(1,0,0,1,0,0),Ae||!g?xe.clearRect(0,0,e.canvasWidth,e.canvasHeight):Z(xe,0,0,e.canvasWidth,e.canvasHeight),xe.drawImage(Ce,0,0,e.canvasWidth*h,e.canvasHeight*h,0,0,e.canvasWidth,e.canvasHeight)};(c[e.NODE]||ye[e.NODE])&&(at(u.contexts[e.NODE],e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],ye[e.NODE]),c[e.NODE]=!1),(c[e.DRAG]||ye[e.DRAG])&&(at(qe,Je,ye[e.DRAG]),c[e.DRAG]=!1)}e.prevViewport=G,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")},Cr.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 w=Math.round(1e3/v),p="1 frame = "+v+" ms = "+w+" 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",!Ha){var g=c.measureText(p);Ha=g.actualBoundingBoxAscent}c.fillText(p,0,Ha),c.strokeRect(0,Ha+10,250,20),c.fillRect(0,Ha+10,250*Math.min(w/60,1),20)}o||(l[t.SELECT_BOX]=!1)}};var Tf=typeof Float32Array<"u"?Float32Array:Array;function dl(){var r=new Tf(9);return Tf!=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 Cf(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 qi(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 Df(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 fl(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 $m=function(){return ve(function r(e,t,n,a){ze(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,M){if(a&&M){var V=M.context,X=C.x,W=l*C.row;V.save(),V.translate(X,W),V.scale(c,c),a(V,n),V.restore()}},v=[null,null],w=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)w();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(g(),w()):this.enableWrapping?function(){var C=i.scratch,M=i.canvas;C.clear(),h({x:0,row:0},C);var V=s-i.freePointer.x,H=d-V,G=l,X=i.freePointer.x,W=i.freePointer.row*l,$=V;M.context.drawImage(C,0,0,$,G,X,W,$,G),v[0]={x:X,y:W,w:$,h:f};var J=(i.freePointer.row+1)*l,Q=H;M&&M.context.drawImage(C,V,0,Q,G,0,J,Q,G),v[1]={x:0,y:J,w:Q,h:f},i.freePointer.x=H,i.freePointer.row++}():(g(),w())}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 Hm(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}}])}(),Km=function(){return ve(function r(e,t,n,a){ze(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 $m(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=_e(this.atlases);try{var u=function(){var d=l.value,f=d.getKeys(),h=function Zm(r,e){return r.intersection?r.intersection(e):new Set(Et(r).filter(function(t){return e.has(t)}))}(n,f);if(0===h.size)return a.push(d),f.forEach(function(V){return i.set(V,d)}),1;s||(s=t._createAtlas(),a.push(s));var w,v=_e(f);try{for(v.s();!(w=v.n()).done;){var p=w.value;if(!h.has(p)){var E=Qe(d.getOffsets(p),2),C=E[0];s.canFit({w:C.w+E[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(V){v.e(V)}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=Qe(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}}}])}(),Jm=function(){return ve(function r(e,t){ze(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 Km(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=bt({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=_e(t);try{for(h.s();!(v=h.n()).done;){var w=v.value;if(l(w)){var g,p=_e(this.renderTypes.values());try{var E=function(){var M=g.value,V=M.type;if(c(V)){var H=n.collections.get(M.collection),G=M.getKey(w),X=Array.isArray(G)?G:[G];if(s)X.forEach(function(J){return H.markKeyForGC(J)}),f=!0;else{var W=M.getID?M.getID(w):w.id(),$=n._key(V,W),Z=n.typeAndIdToKey.get($);void 0!==Z&&!zm(X,Z)&&(d=!0,n.typeAndIdToKey.delete($),Z.forEach(function(J){return H.markKeyForGC(J)}))}}};for(p.s();!(g=p.n()).done;)E()}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=_e(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=Qe(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=_e(this.collections);try{for(n.s();!(a=n.n()).done;){var i=Qe(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}}])}(),Qm=function(){return ve(function r(e){ze(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}}])}(),Ua={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},a0=function(){return ve(function r(e,t,n){ze(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=_m,this.atlasManager=new Jm(e,n),this.batchManager=new Qm(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Ua.SCREEN),this.pickingProgram=this._createShaderProgram(Ua.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 km(r,e,t){var n=xf(r,r.VERTEX_SHADER,e),a=xf(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 Xm(r,e,t,n){var i=Qe(wf(r,e),2),s=i[0],o=i[1],l=Ef(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 jm(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=Yr(a,n,"vec4",i.aIndex),this.vertTypeBuffer=Yr(a,n,"int",i.aVertType),this.atlasIdBuffer=Yr(a,n,"int",i.aAtlasId),this.texBuffer=Yr(a,n,"vec4",i.aTex),this.pointAPointBBuffer=Yr(a,n,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Yr(a,n,"vec4",i.aPointCPointD),this.lineWidthBuffer=Yr(a,n,"vec2",i.aLineWidth),this.colorBuffer=Yr(a,n,"vec4",i.aColor),this.cornerRadiusBuffer=Yr(a,n,"vec4",i.aCornerRadius),this.borderColorBuffer=Yr(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 an(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]:Ua.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=_e(i.getAtlasInfo(t,a));try{for(c.s();!(d=c.n()).done;){var f=d.value,h=f.atlas,v=f.tex1,w=f.tex2;s.canAddToCurrentBatch(h)||this.endBatch();for(var p=s.getAtlasIndexForBatch(h),g=0,E=[[v,!0],[w,!1]];g<E.length;g++){var C=Qe(E[g],2),M=C[0],V=C[1];if(0!=M.w){var H=this.instanceCount;this.vertTypeBuffer.getView(H)[0]=0,sa(n,this.indexBuffer.getView(H)),this.atlasIdBuffer.getView(H)[0]=p;var W=this.texBuffer.getView(H);W[0]=M.x,W[1]=M.y,W[2]=M.w,W[3]=M.h;var $=this.transformBuffer.getMatrixView(H);this.setTransformMatrix(t,$,o,f,V),this.instanceCount++,V||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(Z){c.e(Z)}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;Cf(t);var l=a.getRotation?a.getRotation(i):0;if(0!==l){var u=a.getRotationPoint(i);qi(t,t,[u.x,u.y]),Df(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;qi(t,t,[s,o]),fl(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,sa(n,this.indexBuffer.getView(s)),kn([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))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)}sa(n,this.indexBuffer.getView(l)),kn(t.pstyle(s.color).value,t.pstyle(s.opacity).value,this.colorBuffer.getView(l));var p=this.lineWidthBuffer.getView(l);if(p[0]=0,p[1]=0,s.border){var g=t.pstyle("border-width").value;if(g>0){kn(t.pstyle("border-color").value,t.pstyle("border-opacity").value,this.borderColorBuffer.getView(l));var V=t.pstyle("border-position").value;if("inside"===V)p[0]=0,p[1]=-g;else if("outside"===V)p[0]=g,p[1]=0;else{var H=g/2;p[0]=H,p[1]=-H}}}var G=this.transformBuffer.getMatrixView(l);this.setTransformMatrix(t,G,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 cn(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,w=t.pstyle("arrow-scale").value,p=this.r.getArrowWidth(v,w),g=this.instanceCount,E=this.transformBuffer.getMatrixView(g);Cf(E),qi(E,E,[s,o]),fl(E,E,[p,p]),Df(E,E,l),this.vertTypeBuffer.getView(g)[0]=3,sa(n,this.indexBuffer.getView(g)),kn(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,sa(n,this.indexBuffer.getView(c)),kn(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 w=0;w<a.length-2;w+=2){var p=this.instanceCount;this.vertTypeBuffer.getView(p)[0]=2,sa(n,this.indexBuffer.getView(p)),kn(l,u,this.colorBuffer.getView(p)),this.lineWidthBuffer.getView(p)[0]=o;var M=a[w-2],V=a[w-1],H=a[w],G=a[w+1],X=a[w+2],W=a[w+3],$=a[w+4],Z=a[w+5];0==w&&(M=2*H-X+.001,V=2*G-W+.001),w==a.length-4&&($=2*X-H+.001,Z=2*W-G+.001);var J=this.pointAPointBBuffer.getView(p);J[0]=M,J[1]=V,J[2]=H,J[3]=G;var Q=this.pointCPointDBuffer.getView(p);Q[0]=X,Q[1]=W,Q[2]=$,Q[3]=Z,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=_e(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 Bm(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=kn(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}}}])}(),Lf={};function Af(r,e){return Sr(r._private.rscratch,"labelWrapCachedLines",e)||[]}Lf.initWebgl=function(r,e){var t=this,n=t.data.contexts[t.WEBGL];r.bgColor=function i0(r){var e=r.cy.container();return Ml(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 Ym(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 a0(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,w=d.outerWidth(),p=d.outerHeight();return{w,h:p,x1:h-w/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:Gm,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:gl(e.getLabelKey,null),getBoundingBox:pl(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:gl(e.getSourceLabelKey,"source"),getBoundingBox:pl(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:gl(e.getTargetLabelKey,"target"),getBoundingBox:pl(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:a("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var u=ya(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 s0(r){var e=r.render;r.render=function(i){i=i||{},r.webgl&&(r.cy.zoom()>7.99?(function o0(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}(r),e.call(r,i)):(function l0(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),Nf(r,i,Ua.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 v0(r,e,t){var i,s,l,n=function h0(r,e,t){var i,s,u=cl(r),f=function Fm(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=Qe(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),Nf(r,null,Ua.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 M=new Set,V=0;V<36;V++){var G=Vm(C.slice(4*V,4*V+4))-1;G>=0&&M.add(G)}return M}(r,e,t),a=r.getCachedZSortedEles(),o=_e(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 gl=function(e,t){return function(n){var a=e(n),i=Af(n,t);return i.length>1?i.map(function(s,o){return"".concat(a,"_").concat(o)}):a}},pl=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=Af(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 Rf(r,e){var t=r.canvasWidth,n=r.canvasHeight,a=cl(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 yl(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 Nf(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 c0(r,e){r.drawSelectionRectangle(e,function(t){return Rf(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 u0(r){var e=r.canvasWidth,t=r.canvasHeight,n=cl(r),a=n.pan,i=n.zoom,s=dl();qi(s,s,[a.x,a.y]),fl(s,s,[i,i]);var o=dl();!function Wm(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=dl();return function qm(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],w=t[3],p=t[4],g=t[5],E=t[6],C=t[7],M=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]=w*n+p*s+g*u,r[4]=w*a+p*o+g*c,r[5]=w*i+p*l+g*d,r[6]=E*n+C*s+M*u,r[7]=E*a+C*o+M*c,r[8]=E*i+C*l+M*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++)yl(r,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)yl(r,c,l.drag[c])}else if(t.picking)for(var d=0;d<l.length;d++)yl(r,d,l[d]);a.endFrame(),t.screen&&r.webglDebugShowAtlases&&(function d0(r){var e=r.data.contexts[r.NODE];e.save(),Rf(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 f0(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,w=h*c,p=f.height*s;l.save(),l.scale(.4,.4),l.drawImage(f,w,p),l.strokeStyle="black",l.rect(w,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),w=a.getDebugInfo(),p=["".concat(i," elements"),"".concat(w.totalInstances," instances"),"".concat(w.batchCount," batches"),"".concat(w.totalAtlases," atlases"),"".concat(w.wrappedCount," wrapped textures"),"".concat(w.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,E=_e(w.atlasInfo);try{for(E.s();!(C=E.n()).done;){var M=C.value;console.log(" ".concat(M.type,": ").concat(M.keyCount," keys, ").concat(M.atlasCount," atlases"))}}catch(V){E.e(V)}finally{E.f()}console.log("")}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,a.gc())}for(var xn={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 $d(r,o)}),r.closePath()},drawRoundRectanglePath:function(r,e,t,n,a,i){var s=n/2,o=a/2,l="auto"===i?cn(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?cn(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=Ns(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()}},Mf=Math.sin(0),Of=Math.cos(0),ml={},bl={},Pf=Math.PI/40,la=0*Math.PI;la<2*Math.PI;la+=Pf)ml[la]=Math.sin(la),bl[la]=Math.cos(la);xn.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+=Pf)i=e-o*ml[u]*Mf+o*bl[u]*Of,s=t+l*bl[u]*Mf+l*ml[u]*Of,0===u?r.moveTo(i,s):r.lineTo(i,s);r.closePath()};var Ya={};function kf(r){var e=r.indexOf(",");return r.substr(e+1)}function _f(r,e,t){var n=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new qn(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 g0(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})}(kf(n()),t);case"base64":return kf(n());default:return n()}}Ya.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]},Ya.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=tt(r.maxWidth)||tt(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;tt(r.maxWidth)&&(c=u*r.maxWidth/i),tt(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 w=e.pan(),p={x:w.x*u,y:w.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},Ya.png=function(r){return _f(r,this.bufferCanvasImage(r),"image/png")},Ya.jpg=function(r){return _f(r,this.bufferCanvasImage(r),"image/jpeg")};var p0=Ff,Lt=Ff.prototype;function Ff(r){var e=this,n=e.cy.window().document;r.webgl&&(Lt.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Lt.CANVAS_LAYERS),contexts:new Array(Lt.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Lt.CANVAS_LAYERS),bufferCanvases:new Array(Lt.BUFFER_COUNT),bufferContexts:new Array(Lt.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"};ca&&ca.userAgent.match(/msie|trident|edge/i)&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<Lt.CANVAS_LAYERS;u++){var c=e.data.canvases[u]=n.createElement("canvas"),d=Lt.CANVAS_TYPES[u];e.data.contexts[u]=c.getContext(d),e.data.contexts[u]||Kt("Could not create canvas of type "+d),Object.keys(l).forEach(function(Ye){c.style[Ye]=l[Ye]}),c.style.position="absolute",c.setAttribute("data-id","layer"+u),c.style.zIndex=String(Lt.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(c),e.data.canvasNeedsRedraw[u]=!1}for(e.data.topCanvas=e.data.canvases[0],e.data.canvases[Lt.NODE].setAttribute("data-id","layer"+Lt.NODE+"-node"),e.data.canvases[Lt.SELECT_BOX].setAttribute("data-id","layer"+Lt.SELECT_BOX+"-selectbox"),e.data.canvases[Lt.DRAG].setAttribute("data-id","layer"+Lt.DRAG+"-drag"),e.data.canvases[Lt.WEBGL]&&e.data.canvases[Lt.WEBGL].setAttribute("data-id","layer"+Lt.WEBGL+"-webgl"),u=0;u<Lt.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=Er(),v=function(xe){return{x:-xe.w/2,y:-xe.h/2}},p=function(xe){return xe[0]._private.nodeKey},g=function(xe){return xe[0]._private.labelStyleKey},E=function(xe){return xe[0]._private.sourceLabelStyleKey},C=function(xe){return xe[0]._private.targetLabelStyleKey},M=function(xe,Ce,Ae,Ve,rt){return e.drawElement(xe,Ce,Ae,!1,!1,rt)},V=function(xe,Ce,Ae,Ve,rt){return e.drawElementText(xe,Ce,Ae,Ve,"main",rt)},H=function(xe,Ce,Ae,Ve,rt){return e.drawElementText(xe,Ce,Ae,Ve,"source",rt)},G=function(xe,Ce,Ae,Ve,rt){return e.drawElementText(xe,Ce,Ae,Ve,"target",rt)},X=function(xe){return xe.boundingBox(),xe[0]._private.bodyBounds},W=function(xe){return xe.boundingBox(),xe[0]._private.labelBounds.main||f},$=function(xe){return xe.boundingBox(),xe[0]._private.labelBounds.source||f},Z=function(xe){return xe.boundingBox(),xe[0]._private.labelBounds.target||f},J=function(xe,Ce){return Ce},Q=function(xe){return function(xe){return{x:(xe.x1+xe.x2)/2,y:(xe.y1+xe.y2)/2}}(X(xe))},oe=function(xe,Ce,Ae){var Ve=xe?xe+"-":"";return{x:Ce.x+Ae.pstyle(Ve+"text-margin-x").pfValue,y:Ce.y+Ae.pstyle(Ve+"text-margin-y").pfValue}},ce=function(xe,Ce,Ae){var Ve=xe[0]._private.rscratch;return{x:Ve[Ce],y:Ve[Ae]}},de=function(xe){return oe("",ce(xe,"labelX","labelY"),xe)},le=function(xe){return oe("source",ce(xe,"sourceLabelX","sourceLabelY"),xe)},ge=function(xe){return oe("target",ce(xe,"targetLabelX","targetLabelY"),xe)},Te=function(xe){return v(X(xe))},Ie=function(xe){return v($(xe))},ye=function(xe){return v(Z(xe))},we=function(xe){var Ce=W(xe),Ae=v(W(xe));if(xe.isNode()){switch(xe.pstyle("text-halign").value){case"left":Ae.x=-Ce.w-(Ce.leftPad||0);break;case"right":Ae.x=-(Ce.rightPad||0)}switch(xe.pstyle("text-valign").value){case"top":Ae.y=-Ce.h-(Ce.topPad||0);break;case"bottom":Ae.y=-(Ce.botPad||0)}}return Ae},Be=e.data.eleTxrCache=new za(e,{getKey:p,doesEleInvalidateKey:function(xe){var Ce=xe[0]._private;return!(Ce.oldBackgroundTimestamp===Ce.backgroundTimestamp)},drawElement:M,getBoundingBox:X,getRotationPoint:Q,getRotationOffset:Te,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),Ue=e.data.lblTxrCache=new za(e,{getKey:g,drawElement:V,getBoundingBox:W,getRotationPoint:de,getRotationOffset:we,isVisible:J}),Fe=e.data.slbTxrCache=new za(e,{getKey:E,drawElement:H,getBoundingBox:$,getRotationPoint:le,getRotationOffset:Ie,isVisible:J}),qe=e.data.tlbTxrCache=new za(e,{getKey:C,drawElement:G,getBoundingBox:Z,getRotationPoint:ge,getRotationOffset:ye,isVisible:J}),Je=e.data.lyrTxrCache=new ff(e);e.onUpdateEleCalcs(function(xe,Ce){Be.invalidateElements(Ce),Ue.invalidateElements(Ce),Fe.invalidateElements(Ce),qe.invalidateElements(Ce),Je.invalidateElements(Ce);for(var Ae=0;Ae<Ce.length;Ae++){var Ve=Ce[Ae]._private;Ve.oldBackgroundTimestamp=Ve.backgroundTimestamp}});var at=function(xe){for(var Ce=0;Ce<xe.length;Ce++)Je.enqueueElementRefinement(xe[Ce].ele)};Be.onDequeue(at),Ue.onDequeue(at),Fe.onDequeue(at),qe.onDequeue(at),r.webgl&&e.initWebgl(r,{getStyleKey:p,getLabelKey:g,getSourceLabelKey:E,getTargetLabelKey:C,drawElement:M,drawLabel:V,drawSourceLabel:H,drawTargetLabel:G,getElementBox:X,getLabelBox:W,getSourceLabelBox:$,getTargetLabelBox:Z,getElementRotationPoint:Q,getElementRotationOffset:Te,getLabelRotationPoint:de,getSourceLabelRotationPoint:le,getTargetLabelRotationPoint:ge,getLabelRotationOffset:we,getSourceLabelRotationOffset:Ie,getTargetLabelRotationOffset:ye})}Lt.CANVAS_LAYERS=3,Lt.SELECT_BOX=0,Lt.DRAG=1,Lt.NODE=2,Lt.WEBGL=3,Lt.CANVAS_TYPES=["2d","2d","2d","webgl2"],Lt.BUFFER_COUNT=3,Lt.TEXTURE_BUFFER=0,Lt.MOTIONBLUR_BUFFER_NODE=1,Lt.MOTIONBLUR_BUFFER_DRAG=2,Lt.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[Lt.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[Lt.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[Lt.SELECT_BOX]=e;break;case"gc":t.data.gc=!0}};var y0=typeof Path2D<"u";Lt.path2dEnabled=function(r){if(void 0===r)return this.pathsEnabled;this.pathsEnabled=!!r},Lt.usePaths=function(){return y0&&this.pathsEnabled},Lt.setImgSmoothing=function(r,e){null!=r.imageSmoothingEnabled?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)},Lt.getImgSmoothing=function(r){return null!=r.imageSmoothingEnabled?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled},Lt.makeOffscreenCanvas=function(r,e){var t;return"undefined"!==(typeof OffscreenCanvas>"u"?"undefined":Xt(OffscreenCanvas))?t=new OffscreenCanvas(r,e):((t=this.cy.window().document.createElement("canvas")).width=r,t.height=e),t},[vf,jr,Qr,ul,Pn,bn,Cr,Lf,xn,Ya,{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){bt(Lt,r)});var b0=[{type:"layout",extensions:Xy},{type:"renderer",extensions:[{name:"null",impl:zd},{name:"base",impl:sf},{name:"canvas",impl:p0}]}],Gf={},zf={};function Vf(r,e,t){var n=t,a=function(X){Gt("Can not register `"+e+"` for `"+r+"` since `"+X+"` already exists in the prototype and can not be overridden")};if("core"===r){if(_a.prototype[e])return a(e);_a.prototype[e]=t}else if("collection"===r){if(gr.prototype[e])return a(e);gr.prototype[e]=t}else if("layout"===r){for(var i=function(X){this.options=X,t.call(this,X),kt(this._private)||(this._private={}),this._private.cy=X.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 G=this.options;if(G&&G.animate){var X=this.animations;if(X)for(var W=0;W<X.length;W++)X[W].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(X){return X._private.cy},f={addEventFields:function(X,W){W.layout=X,W.cy=d(X),W.target=X},bubble:function(){return!0},parent:function(X){return d(X)}};bt(s,{createEmitter:function(){return this._private.emitter=new Ci(f,this),this},emitter:function(){return this._private.emitter},on:function(X,W){return this.emitter().on(X,W),this},one:function(X,W){return this.emitter().one(X,W),this},once:function(X,W){return this.emitter().one(X,W),this},removeListener:function(X,W){return this.emitter().removeListener(X,W),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(X,W){return this.emitter().emit(X,W),this}}),zt.eventAliasesOn(s),n=i}else if("renderer"===r&&"null"!==e&&"base"!==e){var h=Hf("renderer","base"),v=h.prototype,w=t,p=t.prototype,g=function(){h.apply(this,arguments),w.apply(this,arguments)},E=g.prototype;for(var C in v){var M=v[C];if(null!=p[C])return a(C);E[C]=M}for(var H in p)E[H]=p[H];v.clientFunctions.forEach(function(G){E[G]=E[G]||function(){Kt("Renderer does not implement `renderer."+G+"()` on its prototype")}}),n=g}else if("__proto__"===r||"constructor"===r||"prototype"===r)return Kt(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return Ol({map:Gf,keys:[r,e],value:n})}function Hf(r,e){return Pl({map:Gf,keys:[r,e]})}function x0(r,e,t,n,a){return Ol({map:zf,keys:[r,e,t,n],value:a})}function w0(r,e,t,n){return Pl({map:zf,keys:[r,e,t,n]})}var xl=function(){return 2===arguments.length?Hf.apply(null,arguments):3===arguments.length?Vf.apply(null,arguments):4===arguments.length?w0.apply(null,arguments):5===arguments.length?x0.apply(null,arguments):void Kt("Invalid extension access syntax")};_a.prototype.extension=xl,b0.forEach(function(r){r.extensions.forEach(function(e){Vf(r.type,e.name,e.impl)})});var Ki=function(){if(!(this instanceof Ki))return new Ki;this.length=0},_n=Ki.prototype;_n.instanceString=function(){return"stylesheet"},_n.selector=function(r){return this[this.length++]={selector:r,properties:[]},this},_n.css=function(r,e){var t=this.length-1;if(vt(r))this[t].properties.push({name:r,value:e});else if(kt(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=dr.properties[s]||dr.properties[Za(s)];null!=l&&this[t].properties.push({name:l.name,value:o})}}return this},_n.style=_n.css,_n.generateStyle=function(r){var e=new dr(r);return this.appendToStyle(e)},_n.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 wn=function(e){return void 0===e&&(e={}),kt(e)?new _a(e):vt(e)?xl.apply(xl,arguments):void 0};wn.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(wn),r.apply(null,e),this},wn.warnings=function(r){return au(r)},wn.version="3.33.1",wn.stylesheet=wn.Stylesheet=Ki;var T0=q(5970);const C0=["graphContainer"],D0=(r,e)=>e.key,Uf=(r,e)=>e.id;function S0(r,e){if(1&r&&(y.j41(0,"div",5)(1,"span",6),y.EFF(2),y.k0s(),y.j41(3,"span",7),y.EFF(4),y.k0s()()),2&r){const t=e.$implicit;y.R7$(2),y.JRh(t.key),y.R7$(2),y.JRh(t.value)}}function I0(r,e){if(1&r&&(y.j41(0,"div",4),y.Z7z(1,S0,5,2,"div",5,D0),y.k0s()),2&r){const t=e;y.xc7("left",t.x,"px")("top",t.y,"px"),y.R7$(),y.Dyx(t.entries)}}function L0(r,e){if(1&r){const t=y.RV6();y.j41(0,"button",10),y.bIt("mousedown",function(a){return a.stopPropagation()})("click",function(){const a=m.eBV(t).$implicit,i=y.XpG(2);return m.Njj(i._onContextMenuAction(a.id))}),y.EFF(1),y.k0s()}if(2&r){const t=e.$implicit;y.R7$(),y.SpI(" ",t.label," ")}}function A0(r,e){if(1&r&&(y.j41(0,"div",8),y.Z7z(1,L0,2,1,"button",9,Uf),y.k0s()),2&r){const t=y.XpG();y.xc7("left",t.contextMenuPos().x,"px")("top",t.contextMenuPos().y,"px"),y.R7$(),y.Dyx(t.contextMenuItems())}}function R0(r,e){if(1&r){const t=y.RV6();y.j41(0,"button",10),y.bIt("mousedown",function(a){return a.stopPropagation()})("click",function(){const a=m.eBV(t).$implicit,i=y.XpG(2);return m.Njj(i._onEdgeContextMenuAction(a.id))}),y.EFF(1),y.k0s()}if(2&r){const t=e.$implicit;y.R7$(),y.SpI(" ",t.label," ")}}function N0(r,e){if(1&r&&(y.j41(0,"div",8),y.Z7z(1,R0,2,1,"button",9,Uf),y.k0s()),2&r){const t=y.XpG();y.xc7("left",t.edgeContextMenuPos().x,"px")("top",t.edgeContextMenuPos().y,"px"),y.R7$(),y.Dyx(t.edgeContextMenuItems())}}try{wn.use($e())}catch{}let wl=(()=>{class r{elements=A.hFB.required();animate=(0,A.hFB)(!1);stopAnimationAfterFirstNodeHover=(0,A.hFB)(!0);layout=(0,A.hFB)("cose-bilkent");highlightNeighborsOnHover=(0,A.hFB)(!0);userZoomingEnabled=(0,A.hFB)(!0);userPanningEnabled=(0,A.hFB)(!0);appendHTMLLabels=(0,A.hFB)(!0);directed=(0,A.hFB)(!0);labelPropsSettings=(0,A.hFB)(new Pe);contextMenuItems=(0,A.hFB)([]);edgeContextMenuItems=(0,A.hFB)([]);nodeHover=(0,A.CGW)();nodeClick=(0,A.CGW)();canvasClick=(0,A.CGW)();contextMenuAction=(0,A.CGW)();edgeContextMenuAction=(0,A.CGW)();_cy=(0,m.vPA)(void 0);_container=(0,m.vPA)(void 0);_animate;_positionCache=new Map;hoverNodeOverlay=(0,m.vPA)(null);contextMenuVisible=(0,m.vPA)(!1);contextMenuPos=(0,m.vPA)({x:0,y:0});_contextMenuNode=null;edgeContextMenuVisible=(0,m.vPA)(!1);edgeContextMenuPos=(0,m.vPA)({x:0,y:0});_edgeContextMenuLabel="";_edgeContextMenuEdge={source:"",target:""};graphContainer;handleElements=(0,m.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,m.QZP)(()=>{const t=this._cy();void 0!==t&&(this.animate()?this._setAnimation(t):this._stopAnimation())});handleHTMLLabels=(0,m.QZP)(()=>{const t=this._cy(),n=this._container();if(void 0===t||void 0===n)return;const a=this.labelPropsSettings(),i=new Pe;i.boxLabels={...a.boxLabels},i.props={display:!1,displayOnlyOnHover:a.props.displayOnlyOnHover},he(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={...ue,directed:this.directed(),backgroundColor:a};t.style(Le(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 ae(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 E=t.getElementById(g.data.id);E.data(g.data),E.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 E=c.has(g.data.source),C=c.has(g.data.target??"");if(E&&!C){const M=t.getElementById(g.data.target??"");M.length>0&&!f.has(g.data.source)&&f.set(g.data.source,{...M.position()})}if(C&&!E){const M=t.getElementById(g.data.source);M.length>0&&!f.has(g.data.target)&&f.set(g.data.target,{...M.position()})}}const h=[];let v=0;if(t.nodes().filter(g=>c.has(g.id())).forEach(g=>{const E=this._positionCache.get(g.id());if(E)g.position(E),g.lock(),this._positionCache.delete(g.id());else{const C=f.get(g.id());if(C){const M=v++*(2*Math.PI/Math.max(l.length,1)),V=100+60*Math.random();g.position({x:C.x+V*Math.cos(M),y:C.y+V*Math.sin(M)})}else h.push(g)}}),h.length>0&&d.length>0){const g=d.boundingBox({}),E=(g.x1+g.x2)/2,C=(g.y1+g.y2)/2,M=Math.max(g.x2-g.x1,g.y2-g.y1)/2+180,V=2*Math.PI/Math.max(h.length,1);h.forEach((H,G)=>{H.position({x:E+M*Math.cos(V*G),y:C+M*Math.sin(V*G)})})}const w=this._container();if(w&&this.appendHTMLLabels()){const g=new Pe,E=this.labelPropsSettings();g.boxLabels={...E.boxLabels},g.props={display:!1,displayOnlyOnHover:E.props.displayOnlyOnHover},he(t,w,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):ue.backgroundColor,a={...ue,directed:this.directed(),backgroundColor:n},i=Le(a),s=this._nodesHavePosition()?{name:"preset",padding:100,animate:!1}:{...this._layoutOptions(),padding:80,animate:!1},o=wn({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("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(w=>{const E=[w.data.label||"",...w.data.boxLabels||[]].filter(Boolean);return Math.max(...E.map(C=>C.length),0)}),o=s.length>0?s.reduce((w,p)=>w+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();t?.elements().forEach(n=>{n.removeClass("faded")})}_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")})}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=y.VBU({type:r,selectors:[["cue-simple-graph"]],viewQuery:function(n,a){if(1&n&&y.GBs(C0,5),2&n){let i;y.mGM(i=y.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&&(y.j41(0,"div",1,0),y.bIt("resized",function(){return a.onResize()}),y.nVh(2,I0,3,4,"div",2),y.nVh(3,A0,3,4,"div",3),y.nVh(4,N0,3,4,"div",3),y.k0s()),2&n){let i;y.R7$(2),y.vxM((i=a.hoverNodeOverlay())?2:-1,i),y.R7$(),y.vxM(a.contextMenuVisible()&&a.contextMenuItems().length>0?3:-1),y.R7$(),y.vxM(a.edgeContextMenuVisible()&&a.edgeContextMenuItems().length>0?4:-1)}},dependencies:[T0.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 Xf=["#2859e1","#4caf50","#fc2626","#f59e0b","#8b5cf6","#06b6d4","#f97316","#14b8a6","#ec4899","#6366f1"],El="__collapser__",Zi="__chain__";var _0=q(9134),B0=q(6034),F0=q(7517),Wf=q(6455),$f=q(8334);function G0(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-simple-graph",3),y.bIt("nodeHover",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onNodeHover(a))})("nodeClick",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onNodeClick(a))})("canvasClick",function(){m.eBV(t);const a=y.XpG();return m.Njj(a._onCanvasClick())})("contextMenuAction",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onContextMenuAction(a))})("edgeContextMenuAction",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onEdgeContextMenuAction(a))}),y.k0s()}if(2&r){const t=y.XpG();y.Y8G("elements",e)("labelPropsSettings",t.labelPropsSettings())("contextMenuItems",t._nodeMenuItems())("edgeContextMenuItems",t._edgeMenuItems())}}function z0(r,e){1&r&&y.EFF(0," No elements ")}function V0(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-draggable-card",4),y.nI1(1,"transloco"),y.bIt("clickedClose",function(){m.eBV(t);const a=y.XpG();return m.Njj(a._tabbedLegendClosed.set(!0))}),y.j41(2,"cue-tabs",5)(3,"cue-tab",6),y.nI1(4,"transloco"),y.j41(5,"div",7)(6,"cue-layer-legend",8),y.bIt("visibilityAll",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onNodeVisibilityAll(a))})("layerChange",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onNodeLayerChange(a))}),y.k0s()()(),y.j41(7,"cue-tab",6),y.nI1(8,"transloco"),y.j41(9,"div",7)(10,"cue-layer-legend",8),y.bIt("visibilityAll",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onPredicateVisibilityAll(a))})("layerChange",function(a){m.eBV(t);const i=y.XpG();return m.Njj(i._onPredicateLayerChange(a))}),y.k0s()()()()()}if(2&r){const t=y.XpG();y.Y8G("label",y.bMT(1,7,"components.graph.rdf.legendTitle"))("padded",!1)("position",t.legendPosition()),y.R7$(3),y.Y8G("label",y.bMT(4,9,"components.graph.rdf.legendEntities")),y.R7$(3),y.Y8G("layers",t._nodeLayers()),y.R7$(),y.Y8G("label",y.bMT(8,11,"components.graph.rdf.legendRelationships")),y.R7$(3),y.Y8G("layers",t._predicateLayers())}}function H0(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-color-legend-panel",11),y.nI1(1,"transloco"),y.bIt("close",function(){m.eBV(t);const a=y.XpG(2);return m.Njj(a._legendClosed.set(!0))})("layerChange",function(a){m.eBV(t);const i=y.XpG(2);return m.Njj(i._onCategoryLayerChange(a))})("visibilityAll",function(a){m.eBV(t);const i=y.XpG(2);return m.Njj(i._onCategoryVisibilityAll(a))}),y.k0s()}if(2&r){const t=y.XpG(2);y.Y8G("title",y.bMT(1,2,"components.graph.rdf.legendCategories"))("layers",t._categoryLayers())}}function U0(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-color-legend-panel",12),y.nI1(1,"transloco"),y.bIt("close",function(){m.eBV(t);const a=y.XpG(2);return m.Njj(a._predicateLegendClosed.set(!0))})("layerChange",function(a){m.eBV(t);const i=y.XpG(2);return m.Njj(i._onPredicateLayerChange(a))})("visibilityAll",function(a){m.eBV(t);const i=y.XpG(2);return m.Njj(i._onPredicateVisibilityAll(a))}),y.k0s()}if(2&r){const t=y.XpG(2);y.Y8G("title",y.bMT(1,3,"components.graph.rdf.legendRelationships"))("layers",t._predicateLayers())("position",t.legendPosition())}}function X0(r,e){if(1&r&&(y.nVh(0,H0,2,4,"cue-color-legend-panel",9),y.nVh(1,U0,2,5,"cue-color-legend-panel",10)),2&r){const t=y.XpG();y.vxM(t.colorByCategory()&&t._categoryLayers().length>0&&!t._legendClosed()?0:-1),y.R7$(),y.vxM(t.showRelationshipLegend()&&t._predicateLayers().length>0&&!t._predicateLegendClosed()?1:-1)}}let j0=(()=>{class r{_graph=(0,A.ebz)(wl);doc=(0,A.hFB)();collapseClasses=(0,A.hFB)(!0);collapseAttributes=(0,A.hFB)(!0);collapseRelationships=(0,A.hFB)(!0);classPredicates=(0,A.hFB)([]);focusNodes=(0,A.hFB)([]);focusNodeColor=(0,A.hFB)("red");zoomToFocusNodes=(0,A.hFB)(!1);colorByCategory=(0,A.hFB)(!1);showRelationshipLegend=(0,A.hFB)(!1);legendPosition=(0,A.hFB)("top-left");tabbedLegend=(0,A.hFB)(!1);categoryLabelsOnHover=(0,A.hFB)(!0);nodeMenuItems=(0,A.hFB)(void 0);edgeMenuItems=(0,A.hFB)(void 0);nodeHover=(0,A.CGW)();nodeClick=(0,A.CGW)();canvasClick=(0,A.CGW)();_fullElements=null;_collapserGroups=[];_chainGroups=[];_focusedNodeId=void 0;_hiddenPredicates=new Set;_hiddenNodeIds=new Set;_categoryColors=new Map;_labelFocusOnNeighbours=(0,T.Xx)("components.graph.rdf.labelFocusOnNeighbours");_labelUnhideEdges=(0,T.Xx)("components.graph.rdf.labelUnhideEdges");_labelHideEdgeType=(0,T.Xx)("components.graph.rdf.labelHideEdgeType");_labelCollapseRelationship=(0,T.Xx)("components.graph.rdf.labelCollapseRelationship");_hoveredNode=(0,m.vPA)(null);_nodeMenuItems=(0,I.EW)(()=>{const t=this.nodeMenuItems();if(void 0!==t)return t;const n=this._hoveredNode()?.id,a=!!n&&this._collapserGroups.some(i=>i.allTargetNodeIds.includes(n));return[{id:"focus",label:this._labelFocusOnNeighbours()},{id:"unhide-edges",label:this._labelUnhideEdges()},...a?[{id:"collapse-relationship",label:this._labelCollapseRelationship()}]:[]]});_edgeMenuItems=(0,I.EW)(()=>{const t=this.edgeMenuItems();return void 0!==t?t:[{id:"hide-edge-type",label:this._labelHideEdgeType()}]});elements=(0,m.vPA)(void 0);_categoryLayers=(0,m.vPA)([]);_legendClosed=(0,m.vPA)(!1);_predicateLayers=(0,m.vPA)([]);_predicateLegendClosed=(0,m.vPA)(!1);_nodeLayers=(0,m.vPA)([]);_tabbedLegendClosed=(0,m.vPA)(!1);onDoc=(0,m.QZP)((()=>{var t=this;return(0,ee.A)(function*(){const n=t.doc();if(void 0===n)return;const a=new re;a.hideClassAssignmentTriples=t.collapseClasses(),a.hideDatatypePropertyTriples=t.collapseAttributes(),a.collapseIntoClassificationLabels=t.classPredicates();const s=yield new fe(n,a).init();t._fullElements=s,t._collapserGroups=t.collapseRelationships()?function O0(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:`${El}${l}\0${u}`,sourceId:l,predicateLabel:u,allTargetNodeIds:c,visibleCount:0})}return a}(s):[],t._chainGroups=function P0(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,w)=>Math.max(v,w.data.target?a(w.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:`${Zi}${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(w=>w.data.target&&o.has(w.data.target)).sort((w,p)=>(n.get(p.data.target)??0)-(n.get(w.data.target)??0))[0]?.data.target}return o.size>0&&l.set("__orphan__",{id:`${Zi}__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.elements.set(t._display());const o=t.focusNodes();o.length>0&&t.zoomToFocusNodes()&&setTimeout(()=>t._graph()?.fitTo(o),450)})})());focusEffect=(0,m.QZP)(()=>{const t=this.focusNodes();this._fullElements&&(this.elements.set(this._display()),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($=>{const Z=$.position();return 0!==Z.x||0!==Z.y}))){const $=this._graph();return void($&&$._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)),M=o.nodes().length,V=o.edges().length,H=M>0?2*V/M:1;let G=2.5;H>10?G=1:H>6?G=1.5:H>3&&(G=2);const W=Math.min(Math.max(C,.2),G);n.animate(W!==C?{zoom:W,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,m.QZP)(()=>{this.colorByCategory()&&this._legendClosed.set(!1),this._fullElements&&this.elements.set(this._display())});showRelationshipLegendEffect=(0,m.QZP)(()=>{this.showRelationshipLegend()&&this._predicateLegendClosed.set(!1)});labelPropsSettings=(0,I.EW)(()=>{const t=new Pe;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)return a.visibleCount=n.isExpanded?0:Math.min(a.visibleCount+5,a.allTargetNodeIds.length),void this.elements.set(this._display())}if(n.isChainExpander&&n.chainGroupId){const a=this._chainGroups.find(i=>i.id===n.chainGroupId);if(a)return a.visibleCount=n.isExpanded?0:Math.min(a.visibleCount+5,a.hiddenNodeIds.length),void this.elements.set(this._display())}this.nodeClick.emit(t)}_onCanvasClick(){this.canvasClick.emit(),this._focusedNodeId&&(this._focusedNodeId=void 0,this.elements.set(this._display()))}_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.elements.set(this._display())}else if("unhide-edges"===t.actionId)this._hiddenPredicates.clear(),this._predicateLayers.update(a=>a.map(i=>({...i,visible:!0}))),this.elements.set(this._display());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.elements.set(this._display())}}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._hiddenPredicates.add(t.edgeLabel),this.elements.set(this._display())):n.find(a=>a.id===t.actionId)?.action(t.edge)}_onCategoryLayerChange(t){this._categoryLayers.update(n=>[...n]),this.elements.set(this._display())}_onCategoryVisibilityAll(t){this._categoryLayers.update(n=>[...n]),this.elements.set(this._display())}_onPredicateLayerChange(t){this._predicateLayers.update(n=>[...n]),this.elements.set(this._display())}_onPredicateVisibilityAll(t){this._predicateLayers.update(n=>[...n]),this.elements.set(this._display())}_onNodeLayerChange(t){this._syncHiddenNodeIds(),this._nodeLayers.update(n=>[...n]),this.elements.set(this._display())}_onNodeVisibilityAll(t){this._syncHiddenNodeIds(),this._nodeLayers.update(n=>[...n]),this.elements.set(this._display())}_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 Set,a=[];for(const i of t.edges){const s=i.data.label??"";s&&!n.has(s)&&(n.add(s),a.push(s))}return a.map(i=>({label:i,color:r._PREDICATE_COLOR,visible:!0}))}_buildCategoryLayers(t){const n=new Set,a=[];for(const i of t.nodes){if(i.data.id.startsWith(El)||i.data.id.startsWith(Zi))continue;const s=i.data.boxLabels?.[0];s&&!n.has(s)&&(n.add(s),a.push(s))}return this._categoryColors=function M0(r){const e=new Map;return r.forEach((t,n)=>{e.set(t,Xf[n%Xf.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(El)||i.data.id.startsWith(Zi))continue;const s=i.data.label||i.data.id;s&&!n.has(s)&&(n.add(s),a.push({label:s,color:void 0,visible:!0}))}return a.sort((i,s)=>i.label.localeCompare(s.label))}_display(){if(!this._fullElements)return{nodes:[],edges:[]};let t=function k0(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<=0)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:c?"\u2212":`+${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<=0)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:d?"\u2212":`+${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(o=>!o.visible).map(o=>o.label)),a=new Set([...this._hiddenPredicates,...n]);if(a.size>0){const o=t.edges.filter(u=>!a.has(u.data.label??"")),l=new Set;for(const u of o)l.add(u.data.source),l.add(u.data.target);t={nodes:t.nodes.filter(u=>l.has(u.data.id)),edges:o}}if(this._hiddenNodeIds.size>0){const o=new Set(t.nodes.filter(l=>this._hiddenNodeIds.has(l.data.label||l.data.id)).map(l=>l.data.id));o.size>0&&(t={nodes:t.nodes.filter(l=>!o.has(l.data.id)),edges:t.edges.filter(l=>!o.has(l.data.source)&&!o.has(l.data.target))})}if(this.colorByCategory()){const o=new Set(this._categoryLayers().filter(l=>!l.visible).map(l=>l.label));if(o.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&&o.has(f)},c=new Set(t.nodes.filter(d=>{const f=d.data.boxLabels?.[0];return void 0!==f&&o.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))}}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})}}this._focusedNodeId&&(t=this._applyFocus(t,this._focusedNodeId));const i=new Set(this.focusNodes()),s=this.focusNodeColor();return i.size>0&&(t={...t,nodes:t.nodes.map(o=>{if(!i.has(o.data.id))return o;const l=o.classes?o.classes.trim():"";return{...o,data:{...o.data,color:s},classes:l?`${l} focused`:"focused"}})}),t}_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=y.VBU({type:r,selectors:[["cue-rdf-graph"]],viewQuery:function(n,a){1&n&&y.wEZ(a._graph,wl,5),2&n&&y.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"],nodeMenuItems:[1,"nodeMenuItems"],edgeMenuItems:[1,"edgeMenuItems"]},outputs:{nodeHover:"nodeHover",nodeClick:"nodeClick",canvasClick:"canvasClick"},decls:5,vars:2,consts:[[2,"display","flex","flex-direction","column","position","relative","width","100%","flex","1","min-height","0"],[3,"elements","labelPropsSettings","contextMenuItems","edgeContextMenuItems"],[2,"position","absolute",3,"label","padded","position"],[3,"nodeHover","nodeClick","canvasClick","contextMenuAction","edgeContextMenuAction","elements","labelPropsSettings","contextMenuItems","edgeContextMenuItems"],[2,"position","absolute",3,"clickedClose","label","padded","position"],[1,"legend-tabs"],[3,"label"],[1,"legend-content"],[3,"visibilityAll","layerChange","layers"],["position","top-right",3,"title","layers"],[3,"title","layers","position"],["position","top-right",3,"close","layerChange","visibilityAll","title","layers"],[3,"close","layerChange","visibilityAll","title","layers","position"]],template:function(n,a){if(1&n&&(y.j41(0,"div",0),y.nVh(1,G0,1,4,"cue-simple-graph",1)(2,z0,1,0),y.nVh(3,V0,11,13,"cue-draggable-card",2)(4,X0,2,2),y.k0s()),2&n){let i;y.R7$(),y.vxM((i=a.elements())?1:2,i),y.R7$(2),y.vxM(a.tabbedLegend()&&!a._tabbedLegendClosed()?3:4)}},dependencies:[wl,_0.v,B0.y,F0.P,Wf.t,$f.o,T.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}"],changeDetection:0})}return r})();var Y0=q(4284);function q0(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-rdf-graph",1),y.bIt("nodeHover",function(a){m.eBV(t);const i=y.XpG(2);return m.Njj(i.hoveredNode.set(a))}),y.k0s()}if(2&r){const t=y.XpG(),n=y.XpG();y.Y8G("doc",t)("collapseClasses",!0)("collapseAttributes",!0)("collapseRelationships",!0)("colorByCategory",!1)("categoryLabelsOnHover",!0)("showRelationshipLegend",!0)("legendPosition",n.legendPosition())("nodeMenuItems",n.nodeMenuItems())("focusNodes",n.focusNodes())("focusNodeColor",n.focusNodeColor())("zoomToFocusNodes",!1)}}function W0(r,e){if(1&r&&y.nVh(0,q0,1,12,"cue-rdf-graph",0),2&r){const t=y.XpG();y.vxM(t._containerReady()?0:-1)}}let $0=(()=>{class r{entity=A.hFB.required();availableEntityCategories=A.hFB.required();availableEntityRelationships=(0,A.hFB)([]);relationships=(0,A.hFB)(void 0);legendPosition=(0,A.hFB)("top-left");showOpenEntityMenuItem=(0,A.hFB)(!0);clickedOpenEntity=(0,A.CGW)();doc=(0,m.vPA)(void 0);_containerReady=(0,m.vPA)(!1);_hostElement=(0,m.WQX)(y.aKT);_resolvedEntityIRI=(0,I.EW)(()=>{const t=this.entity()?.iri;if(t){if(!t.includes("://"))throw new Error(`Expected a full IRI but got: ${t}`);return t}});focusNodes=(0,I.EW)(()=>{const t=this._resolvedEntityIRI();return t?[t]:[]});focusNodeColor=(0,m.vPA)("green");_document=(0,m.WQX)(m.qQL);hoveredNode=(0,m.vPA)(void 0);labelOpenEntity=(0,T.Xx)("components.graph.entityGraph.labelOpenEntity");nodeMenuItems=(0,I.EW)(()=>{const t=[];return this.showOpenEntityMenuItem()&&this.hoveredNode()?.id!==this._resolvedEntityIRI()&&t.push({id:"open",label:this.labelOpenEntity(),action:n=>this.clickedOpenEntity.emit(n.id)}),t});constructor(){(0,y.mal)(()=>{const t=getComputedStyle(this._document.documentElement).getPropertyValue("--cue-color-green").trim();t&&this.focusNodeColor.set(t)}),(0,m.QZP)(()=>{const t=this.entity()?.iri,n=this.relationships();void 0===t||void 0===n||this._buildDoc(n)}),(0,y.mal)(()=>{if(this._containerReady())return;const t=this._hostElement.nativeElement,n=new ResizeObserver(a=>{if(this._containerReady())return void n.disconnect();const i=a[0]?.contentRect;i&&i.width>=100&&i.height>=100&&(this._containerReady.set(!0),n.disconnect())});return n.observe(t),()=>n.disconnect()})}ngAfterViewInit(){const t=this._hostElement.nativeElement;t.clientWidth>=100&&t.clientHeight>=100&&this._containerReady.set(!0)}_buildDoc(t){const{incoming:n,outgoing:a}=t,i={"@context":{qcy:`${B.E.qcy}`,"qcy-e":`${B.E["qcy-e"]}`,skos:`${Y0.B.skos}`},"@graph":[]},s=this._resolvedEntityIRI(),o={"@id":s,"qcy:value":this.entity()?.value,"@type":this.entity()?.categories};i["@graph"].push(o),a.forEach(c=>{i["@graph"].push({"@id":c.nodeIRI,"qcy:value":c.nodeValue,"@type":c.nodeCategories}),i["@graph"].push({"@id":s,[c.relIRI]:{"@id":c.nodeIRI}})}),n.forEach(c=>{i["@graph"].push({"@id":c.nodeIRI,"qcy:value":c.nodeValue,"@type":c.nodeCategories}),i["@graph"].push({"@id":c.nodeIRI,[c.relIRI]:{"@id":s}})});const l=new Set;n.forEach(c=>c.nodeCategories.forEach(d=>l.add(d))),a.forEach(c=>c.nodeCategories.forEach(d=>l.add(d))),this.entity()?.categories.forEach(c=>l.add(c)),l.forEach(c=>{const d=this.availableEntityCategories().find(f=>f.iri===c)?.label;void 0!==d&&i["@graph"].push({"@id":c,"skos:prefLabel":d})}),new Set(n.map(c=>c.relIRI).concat(a.map(c=>c.relIRI))).forEach(c=>{const d=this.availableEntityRelationships().find(f=>f.iri===c)?.label;void 0!==d&&i["@graph"].push({"@id":c,"skos:prefLabel":d})}),this.doc.update(()=>i)}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=y.VBU({type:r,selectors:[["cue-entity-graph"]],inputs:{entity:[1,"entity"],availableEntityCategories:[1,"availableEntityCategories"],availableEntityRelationships:[1,"availableEntityRelationships"],relationships:[1,"relationships"],legendPosition:[1,"legendPosition"],showOpenEntityMenuItem:[1,"showOpenEntityMenuItem"]},outputs:{clickedOpenEntity:"clickedOpenEntity"},decls:1,vars:1,consts:[[3,"doc","collapseClasses","collapseAttributes","collapseRelationships","colorByCategory","categoryLabelsOnHover","showRelationshipLegend","legendPosition","nodeMenuItems","focusNodes","focusNodeColor","zoomToFocusNodes"],[3,"nodeHover","doc","collapseClasses","collapseAttributes","collapseRelationships","colorByCategory","categoryLabelsOnHover","showRelationshipLegend","legendPosition","nodeMenuItems","focusNodes","focusNodeColor","zoomToFocusNodes"]],template:function(n,a){if(1&n&&y.nVh(0,W0,1,1),2&n){let i;y.vxM((i=a.doc())?0:-1,i)}},dependencies:[j0],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:400px;min-width:100px}"]})}return r})();var K0=q(8017),Z0=q(2306),J0=q(6103),Kf=q(2245),Q0=q(7851);function eb(r,e){1&r&&(y.j41(0,"cue-typography",2),y.EFF(1),y.nI1(2,"transloco"),y.k0s()),2&r&&(y.R7$(),y.SpI(" ",y.bMT(2,1,"components.entityData.infoNoData")," "))}function tb(r,e){if(1&r&&(y.j41(0,"div",0),y.nVh(1,eb,3,3,"cue-typography",2),y.k0s()),2&r){y.XpG();const t=y.r8f(6);y.Y8G("cueLogoLoader",t),y.R7$(),y.vxM(t?-1:1)}}function rb(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-tab",3),y.nI1(1,"transloco"),y.j41(2,"cue-entity-graph",5),y.bIt("clickedOpenEntity",function(a){let i;m.eBV(t);const s=y.XpG(2);return s.clickedOpenEntity.emit(a),m.Njj(null==(i=s.handlers())||null==i.openEntity?null:i.openEntity(a))}),y.k0s()()}if(2&r){y.XpG();const t=y.r8f(1),n=y.XpG(),a=y.r8f(0);y.Y8G("label",y.bMT(1,5,"components.entityData.titleEntityGraph")),y.R7$(2),y.Y8G("entity",t)("availableEntityCategories",n.availableEntityCategories())("availableEntityRelationships",n.availableEntityRelationships())("relationships",a)}}function nb(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-tab",4),y.nI1(1,"transloco"),y.j41(2,"cue-doc-list",6),y.bIt("clickedDocument",function(a){m.eBV(t);const i=y.XpG(2);return m.Njj(i.clickedDocument.emit(a))}),y.k0s()()}if(2&r){const t=y.XpG(2);y.Y8G("label",y.bMT(1,4,"components.entityData.titleRelatedDocuments")),y.R7$(2),y.Y8G("documentRefs",t.documentRefs())("handlers",t.internalDocumentListHandlers())("documentData",t.documentData())}}function ab(r,e){if(1&r){const t=y.RV6();y.j41(0,"cue-tab",4),y.nI1(1,"transloco"),y.j41(2,"div",7)(3,"cue-map",8),y.bIt("clickedFeature",function(a){m.eBV(t);const i=y.XpG(2);return m.Njj(i.mapFeatureClicked.emit(a))}),y.k0s()()()}if(2&r){y.XpG(2);const t=y.r8f(3),n=y.r8f(4);y.Y8G("label",y.bMT(1,3,"components.entityData.titleMap")),y.R7$(3),y.Y8G("layers",t)("settings",n)}}function ib(r,e){if(1&r&&(y.j41(0,"cue-tabs",1),y.SS7(1),y.nVh(2,rb,3,7,"cue-tab",3),y.nVh(3,nb,3,6,"cue-tab",4),y.nVh(4,ab,4,5,"cue-tab",4),y.k0s()),2&r){const t=y.XpG(),n=y.r8f(1),a=y.r8f(2),i=y.r8f(5);y.Y8G("variant",t.variant()),y.R7$();const s=y.bH3(t.entity());y.R7$(),y.vxM(n&&s?2:-1),y.R7$(),y.vxM(a?3:-1),y.R7$(),y.vxM(i?4:-1)}}let sb=(()=>{class r{iri=A.hFB.required();availableEntityCategories=A.hFB.required();availableEntityRelationships=(0,A.hFB)([]);mapboxToken=A.hFB.required();handlers=(0,A.hFB)(void 0);variant=(0,A.hFB)("none");clickedOpenEntity=(0,A.CGW)();clickedDocument=(0,A.CGW)();mapFeatureClicked=(0,A.CGW)();relationshipData=(0,A.hFB)(void 0);documentRefs=(0,A.hFB)([]);documentData=(0,A.hFB)({});entityDetailedData=(0,A.hFB)(void 0);_fetchedIRIs=new Set;_mapLayers=(0,m.vPA)([]);_isLoading=(0,m.vPA)(!1);mapSettings=(0,I.EW)(()=>{const t=this.mapboxToken();if(t)return{...new Z0.yY,mapboxToken:t}});mapLayers=this._mapLayers.asReadonly();isEntityLoading=this._isLoading.asReadonly();entity=(0,I.EW)(()=>{const t=this.entityDetailedData();return t?{iri:this.iri(),value:t.value,categories:t.categories}:void 0});internalDocumentListHandlers=(0,I.EW)(()=>{const t=this.handlers();return{requestData:n=>{t?.requestDocumentData?.(n)},requestDownload:t?.downloadDocument,requestOpen:t?.openDocument,requestOpenInDir:t?.openDocumentInFileManager}});constructor(){(0,m.QZP)(()=>{const t=this.iri(),n=this.handlers();if(!t||!n||this._fetchedIRIs.has(t))return;this._fetchedIRIs.add(t),this._isLoading.set(!0),this._mapLayers.set([]),n.requestEntityLocations?.([t]);const a=n.requestRelationships?.(t);a?a.then(()=>this._isLoading.set(!1)).catch(()=>this._isLoading.set(!1)):this._isLoading.set(!1)}),(0,m.QZP)(()=>{const t=this.entityDetailedData();if(!t)return;const n=this.iri(),a=(0,J0.N)({entityData:{[n]:t},availableEntityRelationships:this.availableEntityRelationships()});this._mapLayers.set(a)})}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=y.VBU({type:r,selectors:[["cue-entity-data"]],inputs:{iri:[1,"iri"],availableEntityCategories:[1,"availableEntityCategories"],availableEntityRelationships:[1,"availableEntityRelationships"],mapboxToken:[1,"mapboxToken"],handlers:[1,"handlers"],variant:[1,"variant"],relationshipData:[1,"relationshipData"],documentRefs:[1,"documentRefs"],documentData:[1,"documentData"],entityDetailedData:[1,"entityDetailedData"]},outputs:{clickedOpenEntity:"clickedOpenEntity",clickedDocument:"clickedDocument",mapFeatureClicked:"mapFeatureClicked"},decls:9,vars:8,consts:[[2,"height","400px","width","100%","display","flex","align-items","center","justify-content","center","background","var(--cue-color-background-subtle, #f8f9fa)","border-radius","4px",3,"cueLogoLoader"],[2,"width","100%","flex","1","min-height","400px","height","100%",3,"variant"],[2,"text-align","center","color","var(--cue-color-text-muted, #6c757d)"],[2,"height","100%",3,"label"],[3,"label"],["legendPosition","top-right",2,"flex","1","min-height","400px","width","100%",3,"clickedOpenEntity","entity","availableEntityCategories","availableEntityRelationships","relationships"],[3,"clickedDocument","documentRefs","handlers","documentData"],[2,"display","flex","flex-direction","column","flex","1","min-height","400px","width","100%","position","relative"],[2,"width","100%",3,"clickedFeature","layers","settings"]],template:function(n,a){if(1&n&&(y.SS7(0)(1)(2)(3)(4)(5)(6),y.nVh(7,tb,2,2,"div",0)(8,ib,5,5,"cue-tabs",1)),2&n){const i=y.bH3(a.relationshipData());y.R7$();const s=y.bH3(i&&i.incoming.length+i.outgoing.length>0);y.R7$();const o=y.bH3(a.documentRefs().length>0);y.R7$();const l=y.bH3(a.mapLayers());y.R7$();const u=y.bH3(a.mapSettings());y.R7$();const c=y.bH3(void 0!==u&&l.length>0);y.R7$(),y.bH3(a.isEntityLoading()),y.R7$(),y.vxM(s||o||c?8:7)}},dependencies:[$0,F.g,Wf.t,$f.o,K0.T,Kf.Typography,Q0.k,T.Kj],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return r})();var ob=q(2403),lb=q(7293);function ub(r,e){if(1&r&&(y.j41(0,"cue-flexcontainer",3)(1,"cue-typography",5),y.EFF(2),y.k0s()()),2&r){const t=y.XpG(2);y.R7$(2),y.SpI(" ",t.errorMessage()," ")}}function cb(r,e){1&r&&(y.j41(0,"cue-flexcontainer",3)(1,"cue-typography",6),y.EFF(2," No project connected. "),y.k0s()())}function db(r,e){1&r&&(y.j41(0,"cue-flexcontainer",3)(1,"cue-typography",6),y.EFF(2," No entity selected. "),y.k0s()())}function fb(r,e){if(1&r&&y.nrm(0,"cue-entity-info",7),2&r){y.XpG();const t=y.r8f(0),n=y.XpG(2);y.Y8G("entity",t)("entityCategoriesEditable",!1)("availableEntityCategories",n.availableEntityCategories())("collapsed",!1)("handlers",n._entityInfoHandlers)}}function hb(r,e){1&r&&(y.j41(0,"cue-typography",8),y.EFF(1),y.nI1(2,"transloco"),y.k0s()),2&r&&(y.Y8G("cuePulse",!0),y.R7$(),y.JRh(y.bMT(2,2,"common.infoLoading")))}function vb(r,e){if(1&r&&(y.SS7(0),y.nVh(1,fb,1,5,"cue-entity-info",7)(2,hb,3,4,"cue-typography",8),y.nrm(3,"div",9),y.j41(4,"div",10),y.nrm(5,"cue-entity-data",11),y.k0s()),2&r){const t=y.XpG(2),n=y.bH3(t._entity());y.R7$(),y.vxM(n?1:2),y.R7$(4),y.Y8G("iri",t._currentIri())("availableEntityCategories",t.availableEntityCategories())("availableEntityRelationships",t.availableEntityRelationships())("mapboxToken",t.mapboxToken()??"")("handlers",t._entityDataHandlers())("relationshipData",t.relationshipData())("documentRefs",t.documentRefs())("documentData",t.documentData())("entityDetailedData",t.entityData())}}function gb(r,e){if(1&r&&y.nrm(0,"cue-logo-link",4),2&r){const t=y.XpG(2);y.Y8G("projectId",t.projectId())("resourceId",t._resourceId())}}function pb(r,e){if(1&r&&(y.j41(0,"div",2),y.nVh(1,ub,3,1,"cue-flexcontainer",3)(2,cb,3,0,"cue-flexcontainer",3)(3,db,3,0,"cue-flexcontainer",3)(4,vb,6,11),y.nVh(5,gb,1,2,"cue-logo-link",4),y.k0s()),2&r){const t=y.XpG();y.R7$(),y.vxM("error"===t.state()?1:"idle"===t.state()?2:"no-entity"===t.state()?3:t._currentIri()?4:-1),y.R7$(4),y.vxM(t.showLogo()?5:-1)}}function Tl(r){return r.split("/").pop()}function yb(r){return{id:r.id,contentIRI:r.contentIRI??r.id,path:r.path??"",suffix:r.suffix??"",size:r.size??0,tags:r.tags??[],summary:r.summary??"",categories:r.categories??[],subject:r.subject,providerId:r.providerId,relevance:0}}let mb=(()=>{class r{cue=(0,A.hFB)(void 0);projectId=(0,A.hFB)(void 0);showLogo=(0,A.hFB)(!1);_resourceId=(0,I.EW)(()=>{const t=this._currentIri();return t?t.split("/").pop():void 0});iri=(0,A.hFB)(void 0);mapboxToken=(0,A.hFB)(void 0);variant=(0,A.hFB)("none");openEntity=(0,A.CGW)();state=(0,m.vPA)("idle");errorMessage=(0,m.vPA)(null);availableEntityCategories=(0,m.vPA)([]);availableEntityRelationships=(0,m.vPA)([]);relationshipData=(0,m.vPA)(void 0);documentRefs=(0,m.vPA)([]);documentData=(0,m.vPA)({});entityData=(0,m.vPA)(void 0);_entities=(0,m.vPA)(void 0);_documents=(0,m.vPA)(void 0);_unsubscribeEntities;_unsubscribeDocuments;_unsubscribeSchema;_lastIri;_inputWarningTimer;_currentIri=(0,I.EW)(()=>this.iri());_entity=(0,I.EW)(()=>{const t=this.entityData();return t?{iri:this.iri(),value:t.value,categories:t.categories}:void 0});_entityInfoHandlers={};_entityDataHandlers=(0,I.EW)(()=>{var t=this;const n=this._entities(),a=this._documents();return{requestRelationships:(i=(0,ee.A)(function*(s){yield Promise.all([n?.fetchEntityRelationships(s).then(o=>t.relationshipData.set(o)),n?.fetchEntityDocuments(s).then(o=>{t.documentRefs.set(o.map(l=>({id:l}))),a&&o.length>0&&a.requestDocumentData(o)})])}),function(o){return i.apply(this,arguments)}),requestDocumentData:i=>a?.requestDocumentData(i),requestEntityLocations:i=>{if(!this.mapboxToken())return void console.warn("[cue-entity-viewer] No mapboxToken provided \u2014 skipping map location fetch.");const s=i.map(Tl).filter(Boolean);n?.requestEntityLocations(s)},openEntity:i=>this.openEntity.emit(i)};var i});constructor(){this._inputWarningTimer=setTimeout(()=>{this.cue()||console.warn('[cue-entity-viewer] Required input "cue" is not set. Pass an authenticated Cue SDK instance.'),this.projectId()||console.warn('[cue-entity-viewer] Required input "projectId" is not set. Pass the Cue project ID to display entity data.')},3e3),(0,m.QZP)(()=>{this._setup(this.cue(),this.projectId())}),(0,m.QZP)(()=>{const t=this._entities(),n=this.iri();t&&n&&void 0===this._entity()&&t.requestEntityData([Tl(n)],!1)}),(0,m.QZP)(()=>{const t=this._entities(),n=this.iri();!t||!n||(n!==this._lastIri&&(this._lastIri=n,this.relationshipData.set(void 0),this.documentRefs.set([]),this.entityData.set(void 0),this.state.set("ready")),this._syncEntityData(t,n))})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._teardown()}_setup(t,n){if(this._teardown(),!t||!n)return this._entities.set(void 0),this._documents.set(void 0),void this.state.set("idle");const a=new N.g8(t.api,n),i=new N.f$(t.api,n);this._entities.set(a),this._documents.set(i),this._lastIri=void 0,this.state.set(this.iri()?"ready":"no-entity"),this._unsubscribeEntities=a.entityInfoMap.subscribe(()=>{const o=this.iri();o&&this._syncEntityData(a,o)}),this._unsubscribeDocuments=i.documentInfoMap.subscribe(()=>{this._syncDocumentData(i)}),a.contentCategoriesInProject(!0).then(o=>this.availableEntityCategories.set(o)).catch(o=>console.error("[cue-entity-viewer] Failed to fetch categories",o));const s=new N.Ug(t.api,n,t.api.language);this._unsubscribeSchema=s.availableEntityRelationships.subscribe(()=>{this.availableEntityRelationships.set(s.availableEntityRelationships.get())})}_syncEntityData(t,n){const a=Tl(n),i=t.entityInfoMap.get()[a];if(!i)return;const s=Array.isArray(i.documentRefs)?i.documentRefs.map(u=>"string"==typeof u?{id:u}:u):[],{documentRefs:o,...l}=i;this.entityData.set({...l,documentRefs:s}),s.length>0&&this.documentRefs.set(s)}_syncDocumentData(t){const n=t.documentInfoMap.get(),a={};for(const[i,s]of Object.entries(n))a[i]=yb(s);this.documentData.set(a)}_teardown(){this._unsubscribeEntities?.(),this._unsubscribeDocuments?.(),this._unsubscribeSchema?.(),this._unsubscribeEntities=void 0,this._unsubscribeDocuments=void 0,this._unsubscribeSchema=void 0}static \u0275fac=function(n){return new(n||r)};static \u0275cmp=y.VBU({type:r,selectors:[["cue-entity-viewer-wc"]],inputs:{cue:[1,"cue"],projectId:[1,"projectId"],showLogo:[1,"showLogo"],iri:[1,"iri"],mapboxToken:[1,"mapboxToken"],variant:[1,"variant"]},outputs:{openEntity:"openEntity"},decls:3,vars:1,consts:[["body",""],[3,"ngTemplateOutlet"],[2,"display","flex","flex-direction","column","height","100%","overflow","hidden","width","100%","position","relative"],["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","absolute","top","12px","right","12px","z-index","5",3,"projectId","resourceId"],[2,"color","#c44","font-size","13px"],[2,"color","#9ca3af","font-size","13px"],[3,"entity","entityCategoriesEditable","availableEntityCategories","collapsed","handlers"],["cuePulseMode","text",3,"cuePulse"],[2,"height","16px"],[2,"flex","1","min-height","0"],[2,"width","100%","height","100%",3,"iri","availableEntityCategories","availableEntityRelationships","mapboxToken","handlers","relationshipData","documentRefs","documentData","entityDetailedData"]],template:function(n,a){if(1&n&&(y.DNE(0,pb,6,2,"ng-template",null,0,y.C5r),y.eu8(2,1)),2&n){const i=y.sdS(1);y.R7$(2),y.Y8G("ngTemplateOutlet",i)}},dependencies:[L,sb,x.n,Kf.Typography,ob.V,b.T3,lb.x,T.Kj],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}"],changeDetection:0})}return r})()},8846(Ke){"use strict";Ke.exports=function Re(q){return null===q||"object"!=typeof q||null!=q.toJSON?JSON.stringify(q):Array.isArray(q)?"["+q.reduce((ee,A,I)=>ee+(0===I?"":",")+Re(void 0===A||"symbol"==typeof A?null:A),"")+"]":"{"+Object.keys(q).sort().reduce((ee,A,I)=>void 0===q[A]||"symbol"==typeof q[A]?ee:ee+(0===ee.length?"":",")+Re(A)+":"+Re(q[A]),"")+"}"}},1692(Ke,Re,q){var ee;Ke.exports=(ee=q(6556),function(A){var I={};function m(N){if(I[N])return I[N].exports;var b=I[N]={i:N,l:!1,exports:{}};return A[N].call(b.exports,b,b.exports,m),b.l=!0,b.exports}return m.m=A,m.c=I,m.i=function(N){return N},m.d=function(N,b,T){m.o(N,b)||Object.defineProperty(N,b,{configurable:!1,enumerable:!0,get:T})},m.n=function(N){var b=N&&N.__esModule?function(){return N.default}:function(){return N};return m.d(b,"a",b),b},m.o=function(N,b){return Object.prototype.hasOwnProperty.call(N,b)},m.p="",m(m.s=7)}([function(A,I){A.exports=ee},function(A,I,m){"use strict";var N=m(0).FDLayoutConstants;function b(){}for(var T in N)b[T]=N[T];b.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,b.DEFAULT_RADIAL_SEPARATION=N.DEFAULT_EDGE_LENGTH,b.DEFAULT_COMPONENT_SEPERATION=60,b.TILE=!0,b.TILING_PADDING_VERTICAL=10,b.TILING_PADDING_HORIZONTAL=10,b.TREE_REDUCTION_ON_INCREMENTAL=!1,A.exports=b},function(A,I,m){"use strict";var N=m(0).FDLayoutEdge;function b(x,R,S){N.call(this,x,R,S)}for(var T in b.prototype=Object.create(N.prototype),N)b[T]=N[T];A.exports=b},function(A,I,m){"use strict";var N=m(0).LGraph;function b(x,R,S){N.call(this,x,R,S)}for(var T in b.prototype=Object.create(N.prototype),N)b[T]=N[T];A.exports=b},function(A,I,m){"use strict";var N=m(0).LGraphManager;function b(x){N.call(this,x)}for(var T in b.prototype=Object.create(N.prototype),N)b[T]=N[T];A.exports=b},function(A,I,m){"use strict";var N=m(0).FDLayoutNode,b=m(0).IMath;function T(R,S,_,z){N.call(this,R,S,_,z)}for(var x in T.prototype=Object.create(N.prototype),N)T[x]=N[x];T.prototype.move=function(){var R=this.graphManager.getLayout();this.displacementX=R.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=R.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>R.coolingFactor*R.maxNodeDisplacement&&(this.displacementX=R.coolingFactor*R.maxNodeDisplacement*b.sign(this.displacementX)),Math.abs(this.displacementY)>R.coolingFactor*R.maxNodeDisplacement&&(this.displacementY=R.coolingFactor*R.maxNodeDisplacement*b.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),R.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},T.prototype.propogateDisplacementToChildren=function(R,S){for(var z,_=this.getChild().getNodes(),P=0;P<_.length;P++)null==(z=_[P]).getChild()?(z.moveBy(R,S),z.displacementX+=R,z.displacementY+=S):z.propogateDisplacementToChildren(R,S)},T.prototype.setPred1=function(R){this.pred1=R},T.prototype.getPred1=function(){return pred1},T.prototype.getPred2=function(){return pred2},T.prototype.setNext=function(R){this.next=R},T.prototype.getNext=function(){return next},T.prototype.setProcessed=function(R){this.processed=R},T.prototype.isProcessed=function(){return processed},A.exports=T},function(A,I,m){"use strict";var N=m(0).FDLayout,b=m(4),T=m(3),x=m(5),R=m(2),S=m(1),_=m(0).FDLayoutConstants,z=m(0).LayoutConstants,P=m(0).Point,k=m(0).PointD,K=m(0).Layout,B=m(0).Integer,y=m(0).IGeometry,Y=m(0).LGraph,De=m(0).Transform;function se(){N.call(this),this.toBeTiled={}}for(var O in se.prototype=Object.create(N.prototype),N)se[O]=N[O];se.prototype.newGraphManager=function(){var D=new b(this);return this.graphManager=D,D},se.prototype.newGraph=function(D){return new T(null,this.graphManager,D)},se.prototype.newNode=function(D){return new x(this.graphManager,D)},se.prototype.newEdge=function(D){return new R(null,null,D)},se.prototype.initParameters=function(){N.prototype.initParameters.call(this,arguments),this.isSubLayout||(this.idealEdgeLength=S.DEFAULT_EDGE_LENGTH<10?10:S.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=S.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=_.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=_.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=_.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=_.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=_.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=_.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/_.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=_.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},se.prototype.layout=function(){return z.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},se.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(S.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var L=new Set(this.getAllNodes()),F=this.nodesWithGravity.filter(function(U){return L.has(U)});this.graphManager.setAllNodesToApplyGravitation(F)}}else{var D=this.getFlatForest();D.length>0?this.positionNodesRadially(D):(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),L=new Set(this.getAllNodes()),F=this.nodesWithGravity.filter(function(re){return L.has(re)}),this.graphManager.setAllNodesToApplyGravitation(F),this.positionNodesRandomly())}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},se.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%_.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 D=new Set(this.getAllNodes()),L=this.nodesWithGravity.filter(function(ie){return D.has(ie)});this.graphManager.setAllNodesToApplyGravitation(L),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=_.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=_.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var F=!this.isTreeGrowing&&!this.isGrowthFinished,re=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(F,re),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},se.prototype.getPositionsData=function(){for(var D=this.graphManager.getAllNodes(),L={},F=0;F<D.length;F++){var re=D[F].rect,ie=D[F].id;L[ie]={id:ie,x:re.getCenterX(),y:re.getCenterY(),w:re.width,h:re.height}}return L},se.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var D=!1;if("during"===_.ANIMATE)this.emit("layoutstarted");else{for(;!D;)D=this.tick();this.graphManager.updateBounds()}},se.prototype.calculateNodesToApplyGravitationTo=function(){var L,ie,D=[],F=this.graphManager.getGraphs(),re=F.length;for(ie=0;ie<re;ie++)(L=F[ie]).updateConnected(),L.isConnected||(D=D.concat(L.getNodes()));return D},se.prototype.createBendpoints=function(){var D=[];D=D.concat(this.graphManager.getAllEdges());var F,L=new Set;for(F=0;F<D.length;F++){var re=D[F];if(!L.has(re)){var ie=re.getSource(),U=re.getTarget();if(ie==U)re.getBendpoints().push(new k),re.getBendpoints().push(new k),this.createDummyNodesForBendpoints(re),L.add(re);else{var ne=[];if(ne=(ne=ne.concat(ie.getEdgeListToNode(U))).concat(U.getEdgeListToNode(ie)),!L.has(ne[0])){var pe;if(ne.length>1)for(pe=0;pe<ne.length;pe++){var fe=ne[pe];fe.getBendpoints().push(new k),this.createDummyNodesForBendpoints(fe)}ne.forEach(function(be){L.add(be)})}}}if(L.size==D.length)break}},se.prototype.positionNodesRadially=function(D){for(var L=new P(0,0),F=Math.ceil(Math.sqrt(D.length)),re=0,ie=0,U=0,ne=new k(0,0),pe=0;pe<D.length;pe++){pe%F==0&&(U=0,ie=re,0!=pe&&(ie+=S.DEFAULT_COMPONENT_SEPERATION),re=0);var fe=D[pe],be=K.findCenterOfTree(fe);L.x=U,L.y=ie,(ne=se.radialLayout(fe,be,L)).y>re&&(re=Math.floor(ne.y)),U=Math.floor(ne.x+S.DEFAULT_COMPONENT_SEPERATION)}this.transform(new k(z.WORLD_CENTER_X-ne.x/2,z.WORLD_CENTER_Y-ne.y/2))},se.radialLayout=function(D,L,F){var re=Math.max(this.maxDiagonalInTree(D),S.DEFAULT_RADIAL_SEPARATION);se.branchRadialLayout(L,null,0,359,0,re);var ie=Y.calculateBounds(D),U=new De;U.setDeviceOrgX(ie.getMinX()),U.setDeviceOrgY(ie.getMinY()),U.setWorldOrgX(F.x),U.setWorldOrgY(F.y);for(var ne=0;ne<D.length;ne++)D[ne].transform(U);var fe=new k(ie.getMaxX(),ie.getMaxY());return U.inverseTransformPoint(fe)},se.branchRadialLayout=function(D,L,F,re,ie,U){var ne=(re-F+1)/2;ne<0&&(ne+=180);var fe=(ne+F)%360*y.TWO_PI/360,Pe=(Math.cos(fe),ie*Math.cos(fe)),he=ie*Math.sin(fe);D.setCenter(Pe,he);var te=[],ue=(te=te.concat(D.getEdges())).length;null!=L&&ue--;for(var ae,Le=0,Ee=te.length,Oe=D.getEdgesBetween(L);Oe.length>1;){var $e=Oe[0];Oe.splice(0,1);var je=te.indexOf($e);je>=0&&te.splice(je,1),Ee--,ue--}ae=null!=L?(te.indexOf(Oe[0])+1)%Ee:0;for(var Ze=Math.abs(re-F)/ue,Ne=ae;Le!=ue;Ne=++Ne%Ee){var ze=te[Ne].getOtherEnd(D);if(ze!=L){var me=(F+Le*Ze)%360;se.branchRadialLayout(ze,D,me,(me+Ze)%360,ie+U,U),Le++}}},se.maxDiagonalInTree=function(D){for(var L=B.MIN_VALUE,F=0;F<D.length;F++){var ie=D[F].getDiagonal();ie>L&&(L=ie)}return L},se.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},se.prototype.groupZeroDegreeMembers=function(){var D=this,L={};this.memberGroups={},this.idToDummyNode={};for(var F=[],re=this.graphManager.getAllNodes(),ie=0;ie<re.length;ie++){var ne=(U=re[ie]).getParent();0===this.getNodeDegreeWithChildren(U)&&(null==ne.id||!this.getToBeTiled(ne))&&F.push(U)}for(ie=0;ie<F.length;ie++){var U,pe=(U=F[ie]).getParent().id;typeof L[pe]>"u"&&(L[pe]=[]),L[pe]=L[pe].concat(U)}Object.keys(L).forEach(function(fe){if(L[fe].length>1){var be="DummyCompound_"+fe;D.memberGroups[be]=L[fe];var Pe=L[fe][0].getParent(),he=new x(D.graphManager);he.id=be,he.paddingLeft=Pe.paddingLeft||0,he.paddingRight=Pe.paddingRight||0,he.paddingBottom=Pe.paddingBottom||0,he.paddingTop=Pe.paddingTop||0,D.idToDummyNode[be]=he;var te=D.getGraphManager().add(D.newGraph(),he),ue=Pe.getChild();ue.add(he);for(var Le=0;Le<L[fe].length;Le++){var Ee=L[fe][Le];ue.remove(Ee),te.add(Ee)}}})},se.prototype.clearCompounds=function(){var D={},L={};this.performDFSOnCompounds();for(var F=0;F<this.compoundOrder.length;F++)L[this.compoundOrder[F].id]=this.compoundOrder[F],D[this.compoundOrder[F].id]=[].concat(this.compoundOrder[F].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[F].getChild()),this.compoundOrder[F].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(D,L)},se.prototype.clearZeroDegreeMembers=function(){var D=this,L=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(F){var re=D.idToDummyNode[F];L[F]=D.tileNodes(D.memberGroups[F],re.paddingLeft+re.paddingRight),re.rect.width=L[F].width,re.rect.height=L[F].height})},se.prototype.repopulateCompounds=function(){for(var D=this.compoundOrder.length-1;D>=0;D--){var L=this.compoundOrder[D];this.adjustLocations(this.tiledMemberPack[L.id],L.rect.x,L.rect.y,L.paddingLeft,L.paddingTop)}},se.prototype.repopulateZeroDegreeMembers=function(){var D=this,L=this.tiledZeroDegreePack;Object.keys(L).forEach(function(F){var re=D.idToDummyNode[F];D.adjustLocations(L[F],re.rect.x,re.rect.y,re.paddingLeft,re.paddingTop)})},se.prototype.getToBeTiled=function(D){var L=D.id;if(null!=this.toBeTiled[L])return this.toBeTiled[L];var F=D.getChild();if(null==F)return this.toBeTiled[L]=!1,!1;for(var re=F.getNodes(),ie=0;ie<re.length;ie++){var U=re[ie];if(this.getNodeDegree(U)>0)return this.toBeTiled[L]=!1,!1;if(null!=U.getChild()){if(!this.getToBeTiled(U))return this.toBeTiled[L]=!1,!1}else this.toBeTiled[U.id]=!1}return this.toBeTiled[L]=!0,!0},se.prototype.getNodeDegree=function(D){for(var F=D.getEdges(),re=0,ie=0;ie<F.length;ie++){var U=F[ie];U.getSource().id!==U.getTarget().id&&(re+=1)}return re},se.prototype.getNodeDegreeWithChildren=function(D){var L=this.getNodeDegree(D);if(null==D.getChild())return L;for(var F=D.getChild().getNodes(),re=0;re<F.length;re++)L+=this.getNodeDegreeWithChildren(F[re]);return L},se.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},se.prototype.fillCompexOrderByDFS=function(D){for(var L=0;L<D.length;L++){var F=D[L];null!=F.getChild()&&this.fillCompexOrderByDFS(F.getChild().getNodes()),this.getToBeTiled(F)&&this.compoundOrder.push(F)}},se.prototype.adjustLocations=function(D,L,F,re,ie){F+=ie;for(var U=L+=re,ne=0;ne<D.rows.length;ne++){var pe=D.rows[ne];L=U;for(var fe=0,be=0;be<pe.length;be++){var Pe=pe[be];Pe.rect.x=L,Pe.rect.y=F,L+=Pe.rect.width+D.horizontalPadding,Pe.rect.height>fe&&(fe=Pe.rect.height)}F+=fe+D.verticalPadding}},se.prototype.tileCompoundMembers=function(D,L){var F=this;this.tiledMemberPack=[],Object.keys(D).forEach(function(re){var ie=L[re];F.tiledMemberPack[re]=F.tileNodes(D[re],ie.paddingLeft+ie.paddingRight),ie.rect.width=F.tiledMemberPack[re].width,ie.rect.height=F.tiledMemberPack[re].height})},se.prototype.tileNodes=function(D,L){var ie={rows:[],rowWidth:[],rowHeight:[],width:0,height:L,verticalPadding:S.TILING_PADDING_VERTICAL,horizontalPadding:S.TILING_PADDING_HORIZONTAL};D.sort(function(pe,fe){return pe.rect.width*pe.rect.height>fe.rect.width*fe.rect.height?-1:pe.rect.width*pe.rect.height<fe.rect.width*fe.rect.height?1:0});for(var U=0;U<D.length;U++){var ne=D[U];0==ie.rows.length?this.insertNodeToRow(ie,ne,0,L):this.canAddHorizontal(ie,ne.rect.width,ne.rect.height)?this.insertNodeToRow(ie,ne,this.getShortestRowIndex(ie),L):this.insertNodeToRow(ie,ne,ie.rows.length,L),this.shiftToLastRow(ie)}return ie},se.prototype.insertNodeToRow=function(D,L,F,re){var ie=re;F==D.rows.length&&(D.rows.push([]),D.rowWidth.push(ie),D.rowHeight.push(0));var ne=D.rowWidth[F]+L.rect.width;D.rows[F].length>0&&(ne+=D.horizontalPadding),D.rowWidth[F]=ne,D.width<ne&&(D.width=ne);var pe=L.rect.height;F>0&&(pe+=D.verticalPadding);var fe=0;pe>D.rowHeight[F]&&(fe=D.rowHeight[F],D.rowHeight[F]=pe,fe=D.rowHeight[F]-fe),D.height+=fe,D.rows[F].push(L)},se.prototype.getShortestRowIndex=function(D){for(var L=-1,F=Number.MAX_VALUE,re=0;re<D.rows.length;re++)D.rowWidth[re]<F&&(L=re,F=D.rowWidth[re]);return L},se.prototype.getLongestRowIndex=function(D){for(var L=-1,F=Number.MIN_VALUE,re=0;re<D.rows.length;re++)D.rowWidth[re]>F&&(L=re,F=D.rowWidth[re]);return L},se.prototype.canAddHorizontal=function(D,L,F){var re=this.getShortestRowIndex(D);if(re<0)return!0;var ie=D.rowWidth[re];if(ie+D.horizontalPadding+L<=D.width)return!0;var ne,pe,U=0;return D.rowHeight[re]<F&&re>0&&(U=F+D.verticalPadding-D.rowHeight[re]),ne=D.width-ie>=L+D.horizontalPadding?(D.height+U)/(ie+L+D.horizontalPadding):(D.height+U)/D.width,U=F+D.verticalPadding,(pe=D.width<L?(D.height+U)/L:(D.height+U)/D.width)<1&&(pe=1/pe),ne<1&&(ne=1/ne),ne<pe},se.prototype.shiftToLastRow=function(D){var L=this.getLongestRowIndex(D),F=D.rowWidth.length-1,re=D.rows[L],ie=re[re.length-1],U=ie.width+D.horizontalPadding;if(D.width-D.rowWidth[F]>U&&L!=F){re.splice(-1,1),D.rows[F].push(ie),D.rowWidth[L]=D.rowWidth[L]-U,D.rowWidth[F]=D.rowWidth[F]+U,D.width=D.rowWidth[instance.getLongestRowIndex(D)];for(var ne=Number.MIN_VALUE,pe=0;pe<re.length;pe++)re[pe].height>ne&&(ne=re[pe].height);L>0&&(ne+=D.verticalPadding);var fe=D.rowHeight[L]+D.rowHeight[F];D.rowHeight[L]=ne,D.rowHeight[F]<ie.height+D.verticalPadding&&(D.rowHeight[F]=ie.height+D.verticalPadding),D.height+=D.rowHeight[L]+D.rowHeight[F]-fe,this.shiftToLastRow(D)}},se.prototype.tilingPreLayout=function(){S.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},se.prototype.tilingPostLayout=function(){S.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},se.prototype.reduceTrees=function(){for(var F,D=[],L=!0;L;){var re=this.graphManager.getAllNodes(),ie=[];L=!1;for(var U=0;U<re.length;U++)1==(F=re[U]).getEdges().length&&!F.getEdges()[0].isInterGraph&&null==F.getChild()&&(ie.push([F,F.getEdges()[0],F.getOwner()]),L=!0);if(1==L){for(var ne=[],pe=0;pe<ie.length;pe++)1==ie[pe][0].getEdges().length&&(ne.push(ie[pe]),ie[pe][0].getOwner().remove(ie[pe][0]));D.push(ne),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=D},se.prototype.growTree=function(D){for(var re,F=D[D.length-1],ie=0;ie<F.length;ie++)this.findPlaceforPrunedNode(re=F[ie]),re[2].add(re[0]),re[2].add(re[1],re[1].source,re[1].target);D.splice(D.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},se.prototype.findPlaceforPrunedNode=function(D){var L,F,re=D[0],ie=(F=re==D[1].source?D[1].target:D[1].source).startX,U=F.finishX,ne=F.startY,pe=F.finishY,te=[0,0,0,0];if(ne>0)for(var ue=ie;ue<=U;ue++)te[0]+=this.grid[ue][ne-1].length+this.grid[ue][ne].length-1;if(U<this.grid.length-1)for(ue=ne;ue<=pe;ue++)te[1]+=this.grid[U+1][ue].length+this.grid[U][ue].length-1;if(pe<this.grid[0].length-1)for(ue=ie;ue<=U;ue++)te[2]+=this.grid[ue][pe+1].length+this.grid[ue][pe].length-1;if(ie>0)for(ue=ne;ue<=pe;ue++)te[3]+=this.grid[ie-1][ue].length+this.grid[ie][ue].length-1;for(var Ee,ae,Le=B.MAX_VALUE,Oe=0;Oe<te.length;Oe++)te[Oe]<Le?(Le=te[Oe],Ee=1,ae=Oe):te[Oe]==Le&&Ee++;if(3==Ee&&0==Le)0==te[0]&&0==te[1]&&0==te[2]?L=1:0==te[0]&&0==te[1]&&0==te[3]?L=0:0==te[0]&&0==te[2]&&0==te[3]?L=3:0==te[1]&&0==te[2]&&0==te[3]&&(L=2);else if(2==Ee&&0==Le){var $e=Math.floor(2*Math.random());L=0==te[0]&&0==te[1]?0==$e?0:1:0==te[0]&&0==te[2]?0==$e?0:2:0==te[0]&&0==te[3]?0==$e?0:3:0==te[1]&&0==te[2]?0==$e?1:2:0==te[1]&&0==te[3]?0==$e?1:3:0==$e?2:3}else L=4==Ee&&0==Le?$e=Math.floor(4*Math.random()):ae;0==L?re.setCenter(F.getCenterX(),F.getCenterY()-F.getHeight()/2-_.DEFAULT_EDGE_LENGTH-re.getHeight()/2):1==L?re.setCenter(F.getCenterX()+F.getWidth()/2+_.DEFAULT_EDGE_LENGTH+re.getWidth()/2,F.getCenterY()):2==L?re.setCenter(F.getCenterX(),F.getCenterY()+F.getHeight()/2+_.DEFAULT_EDGE_LENGTH+re.getHeight()/2):re.setCenter(F.getCenterX()-F.getWidth()/2-_.DEFAULT_EDGE_LENGTH-re.getWidth()/2,F.getCenterY())},A.exports=se},function(A,I,m){"use strict";var N={};N.layoutBase=m(0),N.CoSEConstants=m(1),N.CoSEEdge=m(2),N.CoSEGraph=m(3),N.CoSEGraphManager=m(4),N.CoSELayout=m(6),N.CoSENode=m(5),A.exports=N}]))},6894(Ke,Re,q){var ee;Ke.exports=(ee=q(1692),function(A){var I={};function m(N){if(I[N])return I[N].exports;var b=I[N]={i:N,l:!1,exports:{}};return A[N].call(b.exports,b,b.exports,m),b.l=!0,b.exports}return m.m=A,m.c=I,m.i=function(N){return N},m.d=function(N,b,T){m.o(N,b)||Object.defineProperty(N,b,{configurable:!1,enumerable:!0,get:T})},m.n=function(N){var b=N&&N.__esModule?function(){return N.default}:function(){return N};return m.d(b,"a",b),b},m.o=function(N,b){return Object.prototype.hasOwnProperty.call(N,b)},m.p="",m(m.s=1)}([function(A,I){A.exports=ee},function(A,I,m){"use strict";var N=m(0).layoutBase.LayoutConstants,b=m(0).layoutBase.FDLayoutConstants,T=m(0).CoSEConstants,x=m(0).CoSELayout,R=m(0).CoSENode,S=m(0).layoutBase.PointD,_=m(0).layoutBase.DimensionD,z={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 k(y){this.options=function P(y,Y){var De={};for(var se in y)De[se]=y[se];for(var se in Y)De[se]=Y[se];return De}(z,y),K(this.options)}var K=function(Y){null!=Y.nodeRepulsion&&(T.DEFAULT_REPULSION_STRENGTH=b.DEFAULT_REPULSION_STRENGTH=Y.nodeRepulsion),null!=Y.idealEdgeLength&&(T.DEFAULT_EDGE_LENGTH=b.DEFAULT_EDGE_LENGTH=Y.idealEdgeLength),null!=Y.edgeElasticity&&(T.DEFAULT_SPRING_STRENGTH=b.DEFAULT_SPRING_STRENGTH=Y.edgeElasticity),null!=Y.nestingFactor&&(T.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=b.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=Y.nestingFactor),null!=Y.gravity&&(T.DEFAULT_GRAVITY_STRENGTH=b.DEFAULT_GRAVITY_STRENGTH=Y.gravity),null!=Y.numIter&&(T.MAX_ITERATIONS=b.MAX_ITERATIONS=Y.numIter),null!=Y.gravityRange&&(T.DEFAULT_GRAVITY_RANGE_FACTOR=b.DEFAULT_GRAVITY_RANGE_FACTOR=Y.gravityRange),null!=Y.gravityCompound&&(T.DEFAULT_COMPOUND_GRAVITY_STRENGTH=b.DEFAULT_COMPOUND_GRAVITY_STRENGTH=Y.gravityCompound),null!=Y.gravityRangeCompound&&(T.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=b.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=Y.gravityRangeCompound),null!=Y.initialEnergyOnIncremental&&(T.DEFAULT_COOLING_FACTOR_INCREMENTAL=b.DEFAULT_COOLING_FACTOR_INCREMENTAL=Y.initialEnergyOnIncremental),N.QUALITY="draft"==Y.quality?0:"proof"==Y.quality?2:1,T.NODE_DIMENSIONS_INCLUDE_LABELS=b.NODE_DIMENSIONS_INCLUDE_LABELS=N.NODE_DIMENSIONS_INCLUDE_LABELS=Y.nodeDimensionsIncludeLabels,T.DEFAULT_INCREMENTAL=b.DEFAULT_INCREMENTAL=N.DEFAULT_INCREMENTAL=!Y.randomize,T.ANIMATE=b.ANIMATE=N.ANIMATE=Y.animate,T.TILE=Y.tile,T.TILING_PADDING_VERTICAL="function"==typeof Y.tilingPaddingVertical?Y.tilingPaddingVertical.call():Y.tilingPaddingVertical,T.TILING_PADDING_HORIZONTAL="function"==typeof Y.tilingPaddingHorizontal?Y.tilingPaddingHorizontal.call():Y.tilingPaddingHorizontal};k.prototype.run=function(){var y,Y,De=this.options,O=(this.idToLNode={},this.layout=new x),D=this;D.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var L=O.newGraphManager();this.gm=L;var F=this.options.eles.nodes(),re=this.options.eles.edges();this.root=L.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(F),O);for(var ie=0;ie<re.length;ie++){var U=re[ie],ne=this.idToLNode[U.data("source")],pe=this.idToLNode[U.data("target")];ne!==pe&&0==ne.getEdgesBetween(pe).length&&(L.add(O.newEdge(),ne,pe).id=U.id())}var be=function(te,ue){"number"==typeof te&&(te=ue);var Le=te.data("id"),Ee=D.idToLNode[Le];return{x:Ee.getRect().getCenterX(),y:Ee.getRect().getCenterY()}},Pe=function he(){for(var Le,te=function(){De.fit&&De.cy.fit(De.eles,De.padding),y||(y=!0,D.cy.one("layoutready",De.ready),D.cy.trigger({type:"layoutready",layout:D}))},ue=D.options.refresh,Ee=0;Ee<ue&&!Le;Ee++)Le=D.stopped||D.layout.tick();if(Le)return O.checkLayoutSuccess()&&!O.isSubLayout&&O.doPostLayout(),O.tilingPostLayout&&O.tilingPostLayout(),O.isLayoutFinished=!0,D.options.eles.nodes().positions(be),te(),D.cy.one("layoutstop",D.options.stop),D.cy.trigger({type:"layoutstop",layout:D}),Y&&cancelAnimationFrame(Y),void(y=!1);var ae=D.layout.getPositionsData();De.eles.nodes().positions(function(Oe,$e){if("number"==typeof Oe&&(Oe=$e),!Oe.isParent()){for(var je=Oe.id(),Ze=ae[je],Ne=Oe;null==Ze&&(Ze=ae[Ne.data("parent")]||ae["DummyCompound_"+Ne.data("parent")],ae[je]=Ze,null!=(Ne=Ne.parent()[0])););return null!=Ze?{x:Ze.x,y:Ze.y}:{x:Oe.position("x"),y:Oe.position("y")}}}),te(),Y=requestAnimationFrame(he)};return O.addListener("layoutstarted",function(){"during"===D.options.animate&&(Y=requestAnimationFrame(Pe))}),O.runLayout(),"during"!==this.options.animate&&(D.options.eles.nodes().not(":parent").layoutPositions(D,D.options,be),y=!1),this},k.prototype.getTopMostNodes=function(y){for(var Y={},De=0;De<y.length;De++)Y[y[De].id()]=!0;return y.filter(function(O,D){"number"==typeof O&&(O=D);for(var L=O.parent()[0];null!=L;){if(Y[L.id()])return!1;L=L.parent()[0]}return!0})},k.prototype.processChildrenList=function(y,Y,De){for(var se=Y.length,O=0;O<se;O++){var F,pe,D=Y[O],L=D.children(),re=D.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if((F=null!=D.outerWidth()&&null!=D.outerHeight()?y.add(new R(De.graphManager,new S(D.position("x")-re.w/2,D.position("y")-re.h/2),new _(parseFloat(re.w),parseFloat(re.h)))):y.add(new R(this.graphManager))).id=D.data("id"),F.paddingLeft=parseInt(D.css("padding")),F.paddingTop=parseInt(D.css("padding")),F.paddingRight=parseInt(D.css("padding")),F.paddingBottom=parseInt(D.css("padding")),this.options.nodeDimensionsIncludeLabels&&D.isParent()){var ie=D.boundingBox({includeLabels:!0,includeNodes:!1}).w,U=D.boundingBox({includeLabels:!0,includeNodes:!1}).h,ne=D.css("text-halign");F.labelWidth=ie,F.labelHeight=U,F.labelPos=ne}this.idToLNode[D.data("id")]=F,isNaN(F.rect.x)&&(F.rect.x=0),isNaN(F.rect.y)&&(F.rect.y=0),null!=L&&L.length>0&&(pe=De.getGraphManager().add(De.newGraph(),F),this.processChildrenList(pe,L,De))}},k.prototype.stop=function(){return this.stopped=!0,this};var B=function(Y){Y("layout","cose-bilkent",k)};typeof cytoscape<"u"&&B(cytoscape),A.exports=B}]))},7839(Ke,Re,q){"use strict";var ee=q(9293).default;const{isArray:A,isObject:I,isString:m}=q(2831),{asArray:N}=q(9420),{prependBase:b}=q(2051),T=q(262),x=q(6181);function S(z){throw new T("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:z})}function _({context:z,base:P}){if(!z)return;const k=z["@context"];if(m(k))z["@context"]=b(P,k);else if(A(k))for(let K=0;K<k.length;++K){const B=k[K];m(B)?k[K]=b(P,B):I(B)&&_({context:{"@context":B},base:P})}else if(I(k))for(const K in k)_({context:k[K],base:P})}Ke.exports=class{constructor({sharedCache:P}){this.perOpCache=new Map,this.sharedCache=P}resolve(P){var k=this;return ee(function*({activeCtx:K,context:B,documentLoader:y,base:Y,cycles:De=new Set}){B&&I(B)&&B["@context"]&&(B=B["@context"]),B=N(B);const se=[];for(const O of B){if(m(O)){let F=k._get(O);F||(F=yield k._resolveRemoteContext({activeCtx:K,url:O,documentLoader:y,base:Y,cycles:De})),A(F)?se.push(...F):se.push(F);continue}if(null===O){se.push(new x({document:null}));continue}I(O)||S(B);const D=JSON.stringify(O);let L=k._get(D);L||(L=new x({document:O}),k._cacheResolvedContext({key:D,resolved:L,tag:"static"})),se.push(L)}return se}).apply(this,arguments)}_get(P){let k=this.perOpCache.get(P);if(!k){const K=this.sharedCache.get(P);K&&(k=K.get("static"),k&&this.perOpCache.set(P,k))}return k}_cacheResolvedContext({key:P,resolved:k,tag:K}){if(this.perOpCache.set(P,k),void 0!==K){let B=this.sharedCache.get(P);B||(B=new Map,this.sharedCache.set(P,B)),B.set(K,k)}return k}_resolveRemoteContext(P){var k=this;return ee(function*({activeCtx:K,url:B,documentLoader:y,base:Y,cycles:De}){B=b(Y,B);const{context:se,remoteDoc:O}=yield k._fetchContext({activeCtx:K,url:B,documentLoader:y,cycles:De});_({context:se,base:Y=O.documentUrl||B});const D=yield k.resolve({activeCtx:K,context:se,documentLoader:y,base:Y,cycles:De});return k._cacheResolvedContext({key:B,resolved:D,tag:O.tag}),D}).apply(this,arguments)}_fetchContext(P){return ee(function*({activeCtx:k,url:K,documentLoader:B,cycles:y}){if(y.size>10)throw new T("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===k.processingMode?"loading remote context failed":"context overflow",max:10});if(y.has(K))throw new T("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===k.processingMode?"recursive context inclusion":"context overflow",url:K});let Y,De;y.add(K);try{De=yield B(K),Y=De.document||null,m(Y)&&(Y=JSON.parse(Y))}catch(se){throw new T(`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: "${K}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:K,cause:se})}if(!I(Y))throw new T(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${K}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:K});return Y="@context"in Y?{"@context":Y["@context"]}:{"@context":{}},De.contextUrl&&(A(Y["@context"])||(Y["@context"]=[Y["@context"]]),Y["@context"].push(De.contextUrl)),{context:Y,remoteDoc:De}}).apply(this,arguments)}}},262(Ke){"use strict";Ke.exports=class extends Error{constructor(q="An unspecified JSON-LD error occurred.",ee="jsonld.Error",A={}){super(q),this.name=ee,this.message=q,this.details=A}}},1328(Ke){"use strict";Ke.exports=Re=>{class q{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(q,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(q.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:q}),q.compact=function(ee,A){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):Re.compact(ee,A)},q.expand=function(ee){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):Re.expand(ee)},q.flatten=function(ee){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):Re.flatten(ee)},q}},5426(Ke,Re,q){"use strict";Ke.exports=q(1224).NQuads},4808(Ke,Re,q){"use strict";var ee=q(9293).default;Ke.exports=class{constructor(){this._requests={}}wrapLoader(I){const m=this;return m._loader=I,function(){return m.add.apply(m,arguments)}}add(I){var m=this;return ee(function*(){let N=m._requests[I];if(N)return Promise.resolve(N);N=m._requests[I]=m._loader(I);try{return yield N}finally{delete m._requests[I]}})()}}},6181(Ke,Re,q){"use strict";const ee=q(3052);Ke.exports=class{constructor({document:m}){this.document=m,this.cache=new ee({max:10})}getProcessed(m){return this.cache.get(m)}setProcessed(m,N){this.cache.set(m,N)}}},3763(Ke,Re,q){"use strict";var ee=q(9293).default;const A=q(262),{isArray:I,isObject:m,isString:N,isUndefined:b}=q(2831),{isList:T,isValue:x,isGraph:R,isSimpleGraph:S,isSubjectReference:_}=q(4209),{expandIri:z,getContextValue:P,isKeyword:k,process:K,processingMode:B}=q(429),{removeBase:y,prependBase:Y}=q(2051),{REGEX_KEYWORD:De,addValue:se,asArray:O,compareShortestLeast:D}=q(9420),L={};function re(ie,U,ne){if("@nest"!==z(ie,U,{vocab:!0},ne))throw new A("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}Ke.exports=L,L.compact=function(){var ie=ee(function*({activeCtx:U,activeProperty:ne=null,element:pe,options:fe={}}){if(I(pe)){let Pe=[];for(let he=0;he<pe.length;++he){const te=yield L.compact({activeCtx:U,activeProperty:ne,element:pe[he],options:fe});null!==te&&Pe.push(te)}return fe.compactArrays&&1===Pe.length&&0===(P(U,ne,"@container")||[]).length&&(Pe=Pe[0]),Pe}const be=P(U,ne,"@context");if(b(be)||(U=yield K({activeCtx:U,localCtx:be,propagate:!0,overrideProtected:!0,options:fe})),m(pe)){if(fe.link&&"@id"in pe&&fe.link.hasOwnProperty(pe["@id"])){const Oe=fe.link[pe["@id"]];for(let $e=0;$e<Oe.length;++$e)if(Oe[$e].expanded===pe)return Oe[$e].compacted}if(x(pe)||_(pe)){const Oe=L.compactValue({activeCtx:U,activeProperty:ne,value:pe,options:fe});return fe.link&&_(pe)&&(fe.link.hasOwnProperty(pe["@id"])||(fe.link[pe["@id"]]=[]),fe.link[pe["@id"]].push({expanded:pe,compacted:Oe})),Oe}if(T(pe)&&(P(U,ne,"@container")||[]).includes("@list"))return L.compact({activeCtx:U,activeProperty:ne,element:pe["@list"],options:fe});const Pe="@reverse"===ne,he={},te=U;!x(pe)&&!_(pe)&&(U=U.revertToPreviousContext());const ue=P(te,ne,"@context");b(ue)||(U=yield K({activeCtx:U,localCtx:ue,propagate:!0,overrideProtected:!0,options:fe})),fe.link&&"@id"in pe&&(fe.link.hasOwnProperty(pe["@id"])||(fe.link[pe["@id"]]=[]),fe.link[pe["@id"]].push({expanded:pe,compacted:he}));let Le=pe["@type"]||[];Le.length>1&&(Le=Array.from(Le).sort());const Ee=U;for(const Oe of Le){const $e=L.compactIri({activeCtx:Ee,iri:Oe,relativeTo:{vocab:!0}}),je=P(te,$e,"@context");b(je)||(U=yield K({activeCtx:U,localCtx:je,options:fe,propagate:!1}))}const ae=Object.keys(pe).sort();for(const Oe of ae){const $e=pe[Oe];if("@id"===Oe){let je=O($e).map(Ne=>L.compactIri({activeCtx:U,iri:Ne,relativeTo:{vocab:!1},base:fe.base}));1===je.length&&(je=je[0]),he[L.compactIri({activeCtx:U,iri:"@id",relativeTo:{vocab:!0}})]=je;continue}if("@type"===Oe){let je=O($e).map(ve=>L.compactIri({activeCtx:te,iri:ve,relativeTo:{vocab:!0}}));1===je.length&&(je=je[0]);const Ze=L.compactIri({activeCtx:U,iri:"@type",relativeTo:{vocab:!0}}),me=(P(U,Ze,"@container")||[]).includes("@set")&&B(U,1.1)||I(je)&&0===$e.length;se(he,Ze,je,{propertyIsArray:me});continue}if("@reverse"===Oe){const je=yield L.compact({activeCtx:U,activeProperty:"@reverse",element:$e,options:fe});for(const Ze in je)if(U.mappings.has(Ze)&&U.mappings.get(Ze).reverse){const Ne=je[Ze],me=(P(U,Ze,"@container")||[]).includes("@set")||!fe.compactArrays;se(he,Ze,Ne,{propertyIsArray:me}),delete je[Ze]}if(Object.keys(je).length>0){const Ze=L.compactIri({activeCtx:U,iri:Oe,relativeTo:{vocab:!0}});se(he,Ze,je)}continue}if("@preserve"===Oe){const je=yield L.compact({activeCtx:U,activeProperty:ne,element:$e,options:fe});I(je)&&0===je.length||se(he,Oe,je);continue}if("@index"===Oe){if((P(U,ne,"@container")||[]).includes("@index"))continue;const Ze=L.compactIri({activeCtx:U,iri:Oe,relativeTo:{vocab:!0}});se(he,Ze,$e);continue}if("@graph"!==Oe&&"@list"!==Oe&&"@included"!==Oe&&k(Oe)){const je=L.compactIri({activeCtx:U,iri:Oe,relativeTo:{vocab:!0}});se(he,je,$e);continue}if(!I($e))throw new A("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===$e.length){const je=L.compactIri({activeCtx:U,iri:Oe,value:$e,relativeTo:{vocab:!0},reverse:Pe}),Ze=U.mappings.has(je)?U.mappings.get(je)["@nest"]:null;let Ne=he;Ze&&(re(U,Ze,fe),m(he[Ze])||(he[Ze]={}),Ne=he[Ze]),se(Ne,je,$e,{propertyIsArray:!0})}for(const je of $e){const Ze=L.compactIri({activeCtx:U,iri:Oe,value:je,relativeTo:{vocab:!0},reverse:Pe}),Ne=U.mappings.has(Ze)?U.mappings.get(Ze)["@nest"]:null;let ze=he;Ne&&(re(U,Ne,fe),m(he[Ne])||(he[Ne]={}),ze=he[Ne]);const me=P(U,Ze,"@container")||[],ve=R(je),_e=T(je);let et;_e?et=je["@list"]:ve&&(et=je["@graph"]);let Xe=yield L.compact({activeCtx:U,activeProperty:Ze,element:_e||ve?et:je,options:fe});if(_e){if(I(Xe)||(Xe=[Xe]),me.includes("@list")){se(ze,Ze,Xe,{valueIsArray:!0,allowDuplicate:!0});continue}Xe={[L.compactIri({activeCtx:U,iri:"@list",relativeTo:{vocab:!0}})]:Xe},"@index"in je&&(Xe[L.compactIri({activeCtx:U,iri:"@index",relativeTo:{vocab:!0}})]=je["@index"])}if(ve)if(me.includes("@graph")&&(me.includes("@id")||me.includes("@index")&&S(je))){let nt;ze.hasOwnProperty(Ze)?nt=ze[Ze]:ze[Ze]=nt={};const pt=(me.includes("@id")?je["@id"]:je["@index"])||L.compactIri({activeCtx:U,iri:"@none",relativeTo:{vocab:!0}});se(nt,pt,Xe,{propertyIsArray:!fe.compactArrays||me.includes("@set")})}else me.includes("@graph")&&S(je)?(I(Xe)&&Xe.length>1&&(Xe={"@included":Xe}),se(ze,Ze,Xe,{propertyIsArray:!fe.compactArrays||me.includes("@set")})):(I(Xe)&&1===Xe.length&&fe.compactArrays&&(Xe=Xe[0]),Xe={[L.compactIri({activeCtx:U,iri:"@graph",relativeTo:{vocab:!0}})]:Xe},"@id"in je&&(Xe[L.compactIri({activeCtx:U,iri:"@id",relativeTo:{vocab:!0}})]=je["@id"]),"@index"in je&&(Xe[L.compactIri({activeCtx:U,iri:"@index",relativeTo:{vocab:!0}})]=je["@index"]),se(ze,Ze,Xe,{propertyIsArray:!fe.compactArrays||me.includes("@set")}));else if(me.includes("@language")||me.includes("@index")||me.includes("@id")||me.includes("@type")){let nt,pt;if(ze.hasOwnProperty(Ze)?nt=ze[Ze]:ze[Ze]=nt={},me.includes("@language"))x(Xe)&&(Xe=Xe["@value"]),pt=je["@language"];else if(me.includes("@index")){const Dt=P(U,Ze,"@index")||"@index",Qe=L.compactIri({activeCtx:U,iri:Dt,relativeTo:{vocab:!0}});if("@index"===Dt)pt=je["@index"],delete Xe[Qe];else{let Et;if([pt,...Et]=O(Xe[Dt]||[]),N(pt))switch(Et.length){case 0:delete Xe[Dt];break;case 1:Xe[Dt]=Et[0];break;default:Xe[Dt]=Et}else pt=null}}else if(me.includes("@id")){const Dt=L.compactIri({activeCtx:U,iri:"@id",relativeTo:{vocab:!0}});pt=Xe[Dt],delete Xe[Dt]}else if(me.includes("@type")){const Dt=L.compactIri({activeCtx:U,iri:"@type",relativeTo:{vocab:!0}});let Qe;switch([pt,...Qe]=O(Xe[Dt]||[]),Qe.length){case 0:delete Xe[Dt];break;case 1:Xe[Dt]=Qe[0];break;default:Xe[Dt]=Qe}1===Object.keys(Xe).length&&"@id"in je&&(Xe=yield L.compact({activeCtx:U,activeProperty:Ze,element:{"@id":je["@id"]},options:fe}))}pt||(pt=L.compactIri({activeCtx:U,iri:"@none",relativeTo:{vocab:!0}})),se(nt,pt,Xe,{propertyIsArray:me.includes("@set")})}else{const nt=!fe.compactArrays||me.includes("@set")||me.includes("@list")||I(Xe)&&0===Xe.length||"@list"===Oe||"@graph"===Oe;se(ze,Ze,Xe,{propertyIsArray:nt})}}}return he}return pe});return function(U){return ie.apply(this,arguments)}}(),L.compactIri=({activeCtx:ie,iri:U,value:ne=null,relativeTo:pe={vocab:!1},reverse:fe=!1,base:be=null})=>{if(null===U)return U;ie.isPropertyTermScoped&&ie.previousContext&&(ie=ie.previousContext);const Pe=ie.getInverse();if(k(U)&&U in Pe&&"@none"in Pe[U]&&"@type"in Pe[U]["@none"]&&"@none"in Pe[U]["@none"]["@type"])return Pe[U]["@none"]["@type"]["@none"];if(pe.vocab&&U in Pe){const Ee=ie["@language"]||"@none",ae=[];m(ne)&&"@index"in ne&&!("@graph"in ne)&&ae.push("@index","@index@set"),m(ne)&&"@preserve"in ne&&(ne=ne["@preserve"][0]),R(ne)?("@index"in ne&&ae.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in ne&&ae.push("@graph@id","@graph@id@set"),ae.push("@graph","@graph@set","@set"),"@index"in ne||ae.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in ne||ae.push("@graph@id","@graph@id@set")):m(ne)&&!x(ne)&&ae.push("@id","@id@set","@type","@set@type");let Oe="@language",$e="@null";if(fe)Oe="@type",$e="@reverse",ae.push("@set");else if(T(ne)){"@index"in ne||ae.push("@list");const Ze=ne["@list"];if(0===Ze.length)Oe="@any",$e="@none";else{let Ne=0===Ze.length?Ee:null,ze=null;for(let me=0;me<Ze.length;++me){const ve=Ze[me];let _e="@none",et="@none";if(x(ve)?"@direction"in ve?_e=`${(ve["@language"]||"").toLowerCase()}_${ve["@direction"]}`:"@language"in ve?_e=ve["@language"].toLowerCase():"@type"in ve?et=ve["@type"]:_e="@null":et="@id",null===Ne?Ne=_e:_e!==Ne&&x(ve)&&(Ne="@none"),null===ze?ze=et:et!==ze&&(ze="@none"),"@none"===Ne&&"@none"===ze)break}Ne=Ne||"@none",ze=ze||"@none","@none"!==ze?(Oe="@type",$e=ze):$e=Ne}}else{if(x(ne))if("@language"in ne&&!("@index"in ne)){ae.push("@language","@language@set"),$e=ne["@language"];const Ze=ne["@direction"];Ze&&($e=`${$e}_${Ze}`)}else"@direction"in ne&&!("@index"in ne)?$e=`_${ne["@direction"]}`:"@type"in ne&&(Oe="@type",$e=ne["@type"]);else Oe="@type",$e="@id";ae.push("@set")}ae.push("@none"),m(ne)&&!("@index"in ne)&&ae.push("@index","@index@set"),x(ne)&&1===Object.keys(ne).length&&ae.push("@language","@language@set");const je=function F(ie,U,ne,pe,fe,be){null===be&&(be="@null");const Pe=[];if(("@id"===be||"@reverse"===be)&&m(ne)&&"@id"in ne){"@reverse"===be&&Pe.push("@reverse");const te=L.compactIri({activeCtx:ie,iri:ne["@id"],relativeTo:{vocab:!0}});ie.mappings.has(te)&&ie.mappings.get(te)&&ie.mappings.get(te)["@id"]===ne["@id"]?Pe.push.apply(Pe,["@vocab","@id"]):Pe.push.apply(Pe,["@id","@vocab"])}else{Pe.push(be);const te=Pe.find(ue=>ue.includes("_"));te&&Pe.push(te.replace(/^[^_]+_/,"_"))}Pe.push("@none");const he=ie.inverse[U];for(const te of pe){if(!(te in he))continue;const ue=he[te][fe];for(const Le of Pe)if(Le in ue)return ue[Le]}return null}(ie,U,ne,ae,Oe,$e);if(null!==je)return je}if(pe.vocab&&"@vocab"in ie){const Ee=ie["@vocab"];if(0===U.indexOf(Ee)&&U!==Ee){const ae=U.substr(Ee.length);if(!ie.mappings.has(ae))return ae}}let he=null;const te=[];let ue=ie.fastCurieMap;const Le=U.length-1;for(let Ee=0;Ee<Le&&U[Ee]in ue;++Ee)ue=ue[U[Ee]],""in ue&&te.push(ue[""][0]);for(let Ee=te.length-1;Ee>=0;--Ee){const ae=te[Ee],Oe=ae.terms;for(const $e of Oe){const je=$e+":"+U.substr(ae.iri.length);ie.mappings.get($e)._prefix&&(!ie.mappings.has(je)||null===ne&&ie.mappings.get(je)["@id"]===U)&&(null===he||D(je,he)<0)&&(he=je)}}if(null!==he)return he;for(const[Ee,ae]of ie.mappings)if(ae&&ae._prefix&&U.startsWith(Ee+":"))throw new A(`Absolute IRI "${U}" confused with prefix "${Ee}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:ie});if(!pe.vocab){if("@base"in ie){if(ie["@base"]){const Ee=y(Y(be,ie["@base"]),U);return De.test(Ee)?`./${Ee}`:Ee}return U}return y(be,U)}return U},L.compactValue=({activeCtx:ie,activeProperty:U,value:ne,options:pe})=>{if(x(ne)){const he=P(ie,U,"@type"),te=P(ie,U,"@language"),ue=P(ie,U,"@direction"),Le=P(ie,U,"@container")||[],Ee="@index"in ne&&!Le.includes("@index");if(!Ee&&"@none"!==he&&(ne["@type"]===he||"@language"in ne&&ne["@language"]===te&&"@direction"in ne&&ne["@direction"]===ue||"@language"in ne&&ne["@language"]===te||"@direction"in ne&&ne["@direction"]===ue))return ne["@value"];const ae=Object.keys(ne).length,Oe=1===ae||2===ae&&"@index"in ne&&!Ee,$e="@language"in ie,je=N(ne["@value"]),Ze=ie.mappings.has(U)&&null===ie.mappings.get(U)["@language"];if(Oe&&"@none"!==he&&(!$e||!je||Ze))return ne["@value"];const Ne={};return Ee&&(Ne[L.compactIri({activeCtx:ie,iri:"@index",relativeTo:{vocab:!0}})]=ne["@index"]),"@type"in ne?Ne[L.compactIri({activeCtx:ie,iri:"@type",relativeTo:{vocab:!0}})]=L.compactIri({activeCtx:ie,iri:ne["@type"],relativeTo:{vocab:!0}}):"@language"in ne&&(Ne[L.compactIri({activeCtx:ie,iri:"@language",relativeTo:{vocab:!0}})]=ne["@language"]),"@direction"in ne&&(Ne[L.compactIri({activeCtx:ie,iri:"@direction",relativeTo:{vocab:!0}})]=ne["@direction"]),Ne[L.compactIri({activeCtx:ie,iri:"@value",relativeTo:{vocab:!0}})]=ne["@value"],Ne}const fe=z(ie,U,{vocab:!0},pe),be=P(ie,U,"@type"),Pe=L.compactIri({activeCtx:ie,iri:ne["@id"],relativeTo:{vocab:"@vocab"===be},base:pe.base});return"@id"===be||"@vocab"===be||"@graph"===fe?Pe:{[L.compactIri({activeCtx:ie,iri:"@id",relativeTo:{vocab:!0}})]:Pe}}},5315(Ke){"use strict";const Re="http://www.w3.org/1999/02/22-rdf-syntax-ns#",q="http://www.w3.org/2001/XMLSchema#";Ke.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:Re,RDF_LIST:Re+"List",RDF_FIRST:Re+"first",RDF_REST:Re+"rest",RDF_NIL:Re+"nil",RDF_TYPE:Re+"type",RDF_PLAIN_LITERAL:Re+"PlainLiteral",RDF_XML_LITERAL:Re+"XMLLiteral",RDF_JSON_LITERAL:Re+"JSON",RDF_OBJECT:Re+"object",RDF_LANGSTRING:Re+"langString",XSD:q,XSD_BOOLEAN:q+"boolean",XSD_DOUBLE:q+"double",XSD_INTEGER:q+"integer",XSD_STRING:q+"string"}},429(Ke,Re,q){"use strict";var ee=q(9293).default;const A=q(9420),I=q(262),{isArray:m,isObject:N,isString:b,isUndefined:T}=q(2831),{isAbsolute:x,isRelative:R,prependBase:S}=q(2051),{handleEvent:_}=q(2585),{REGEX_BCP47:z,REGEX_KEYWORD:P,asArray:k,compareShortestLeast:K}=q(9420),B=new Map,Y={};function De(O,D,L,F,re,ie){if(null===D||!b(D)||Y.isKeyword(D))return D;if(D.match(P))return null;if(F&&F.hasOwnProperty(D)&&!0!==re.get(D)&&Y.createTermDefinition({activeCtx:O,localCtx:F,term:D,defined:re,options:ie}),(L=L||{}).vocab){const ne=O.mappings.get(D);if(null===ne)return null;if(N(ne)&&"@id"in ne)return ne["@id"]}const U=D.indexOf(":");if(U>0){const ne=D.substr(0,U),pe=D.substr(U+1);if("_"===ne||0===pe.indexOf("//"))return D;F&&F.hasOwnProperty(ne)&&Y.createTermDefinition({activeCtx:O,localCtx:F,term:ne,defined:re,options:ie});const fe=O.mappings.get(ne);if(fe&&fe._prefix)return fe["@id"]+pe;if(x(D))return D}if(L.vocab&&"@vocab"in O)D=O["@vocab"]+D;else if(L.base){let ne,pe;"@base"in O?O["@base"]?(pe=S(ie.base,O["@base"]),ne=S(pe,D)):(pe=O["@base"],ne=D):(pe=ie.base,ne=S(ie.base,D)),D=ne}return D}function se(O,D){if(!O||"object"!=typeof O||!D||"object"!=typeof D)return O===D;const L=Array.isArray(O);if(L!==Array.isArray(D))return!1;if(L){if(O.length!==D.length)return!1;for(let ie=0;ie<O.length;++ie)if(!se(O[ie],D[ie]))return!1;return!0}const F=Object.keys(O),re=Object.keys(D);if(F.length!==re.length)return!1;for(const ie in O){let U=O[ie],ne=D[ie];if("@container"===ie&&Array.isArray(U)&&Array.isArray(ne)&&(U=U.slice().sort(),ne=ne.slice().sort()),!se(U,ne))return!1}return!0}Ke.exports=Y,Y.process=function(){var O=ee(function*({activeCtx:D,localCtx:L,options:F,propagate:re=!0,overrideProtected:ie=!1,cycles:U=new Set}){if(N(L)&&"@context"in L&&m(L["@context"])&&(L=L["@context"]),0===k(L).length)return D;const pe=[],fe=[({event:te,next:ue})=>{pe.push(te),ue()}];F.eventHandler&&fe.push(F.eventHandler);const be=F;F={...F,eventHandler:fe};const Pe=yield F.contextResolver.resolve({activeCtx:D,context:L,documentLoader:F.documentLoader,base:F.base});N(Pe[0].document)&&"boolean"==typeof Pe[0].document["@propagate"]&&(re=Pe[0].document["@propagate"]);let he=D;!re&&!he.previousContext&&(he=he.clone(),he.previousContext=D);for(const te of Pe){let{document:ue}=te;if(D=he,null===ue){if(!ie&&0!==Object.keys(D.protected).length)throw new I("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});he=D=Y.getInitialContext(F).clone();continue}const Le=te.getProcessed(D);if(Le){if(be.eventHandler)for(const ae of Le.events)_({event:ae,options:be});he=D=Le.context;continue}if(N(ue)&&"@context"in ue&&(ue=ue["@context"]),!N(ue))throw new I("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:ue});he=he.clone();const Ee=new Map;if("@version"in ue){if(1.1!==ue["@version"])throw new I("Unsupported JSON-LD version: "+ue["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:ue});if(D.processingMode&&"json-ld-1.0"===D.processingMode)throw new I("@version: "+ue["@version"]+" not compatible with "+D.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:ue});he.processingMode="json-ld-1.1",he["@version"]=ue["@version"],Ee.set("@version",!0)}if(he.processingMode=he.processingMode||D.processingMode,"@base"in ue){let ae=ue["@base"];if(null!==ae&&!x(ae)){if(!R(ae))throw new I('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:ue});ae=S(he["@base"],ae)}he["@base"]=ae,Ee.set("@base",!0)}if("@vocab"in ue){const ae=ue["@vocab"];if(null===ae)delete he["@vocab"];else{if(!b(ae))throw new I('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:ue});if(!x(ae)&&Y.processingMode(he,1))throw new I('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:ue});{const Oe=De(he,ae,{vocab:!0,base:!0},void 0,void 0,F);x(Oe)||F.eventHandler&&_({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:Oe}},options:F}),he["@vocab"]=Oe}}Ee.set("@vocab",!0)}if("@language"in ue){const ae=ue["@language"];if(null===ae)delete he["@language"];else{if(!b(ae))throw new I('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:ue});ae.match(z)||F.eventHandler&&_({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:ae}},options:F}),he["@language"]=ae.toLowerCase()}Ee.set("@language",!0)}if("@direction"in ue){const ae=ue["@direction"];if("json-ld-1.0"===D.processingMode)throw new I("Invalid JSON-LD syntax; @direction not compatible with "+D.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:ue});if(null===ae)delete he["@direction"];else{if("ltr"!==ae&&"rtl"!==ae)throw new I('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:ue});he["@direction"]=ae}Ee.set("@direction",!0)}if("@propagate"in ue){const ae=ue["@propagate"];if("json-ld-1.0"===D.processingMode)throw new I("Invalid JSON-LD syntax; @propagate not compatible with "+D.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:ue});if("boolean"!=typeof ae)throw new I("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:L});Ee.set("@propagate",!0)}if("@import"in ue){const ae=ue["@import"];if("json-ld-1.0"===D.processingMode)throw new I("Invalid JSON-LD syntax; @import not compatible with "+D.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:ue});if(!b(ae))throw new I("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:L});const Oe=yield F.contextResolver.resolve({activeCtx:D,context:ae,documentLoader:F.documentLoader,base:F.base});if(1!==Oe.length)throw new I("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:L});const $e=Oe[0].getProcessed(D);if($e)ue=$e;else{const je=Oe[0].document;if("@import"in je)throw new I("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:L});for(const Ze in je)ue.hasOwnProperty(Ze)||(ue[Ze]=je[Ze]);Oe[0].setProcessed(D,ue)}Ee.set("@import",!0)}Ee.set("@protected",ue["@protected"]||!1);for(const ae in ue)if(Y.createTermDefinition({activeCtx:he,localCtx:ue,term:ae,defined:Ee,options:F,overrideProtected:ie}),N(ue[ae])&&"@context"in ue[ae]){const Oe=ue[ae]["@context"];let $e=!0;if(b(Oe)){const je=S(F.base,Oe);U.has(je)?$e=!1:U.add(je)}if($e)try{yield Y.process({activeCtx:he.clone(),localCtx:ue[ae]["@context"],overrideProtected:!0,options:F,cycles:U})}catch{throw new I("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:ue[ae]["@context"],term:ae})}}te.setProcessed(D,{context:he,events:pe})}return he});return function(D){return O.apply(this,arguments)}}(),Y.createTermDefinition=({activeCtx:O,localCtx:D,term:L,defined:F,options:re,overrideProtected:ie=!1})=>{if(F.has(L)){if(F.get(L))return;throw new I("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:D,term:L})}let U;if(F.set(L,!1),D.hasOwnProperty(L)&&(U=D[L]),"@type"===L&&N(U)&&"@set"===(U["@container"]||"@set")&&Y.processingMode(O,1.1)){const te=["@container","@id","@protected"],ue=Object.keys(U);if(0===ue.length||ue.some(Le=>!te.includes(Le)))throw new I("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:D,term:L})}else{if(Y.isKeyword(L))throw new I("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:D,term:L});if(L.match(P))return void(re.eventHandler&&_({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:L}},options:re}));if(""===L)throw new I("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:D})}const ne=O.mappings.get(L);O.mappings.has(L)&&O.mappings.delete(L);let pe=!1;if((b(U)||null===U)&&(pe=!0,U={"@id":U}),!N(U))throw new I("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:D});const fe={};O.mappings.set(L,fe),fe.reverse=!1;const be=["@container","@id","@language","@reverse","@type"];Y.processingMode(O,1.1)&&be.push("@context","@direction","@index","@nest","@prefix","@protected");for(const te in U)if(!be.includes(te))throw new I("Invalid JSON-LD syntax; a term definition must not contain "+te,"jsonld.SyntaxError",{code:"invalid term definition",context:D});const Pe=L.indexOf(":");if(fe._termHasColon=Pe>0,"@reverse"in U){if("@id"in U)throw new I("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:D});if("@nest"in U)throw new I("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:D});const te=U["@reverse"];if(!b(te))throw new I("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:D});if(te.match(P))return re.eventHandler&&_({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:te}},options:re}),void(ne?O.mappings.set(L,ne):O.mappings.delete(L));const ue=De(O,te,{vocab:!0,base:!1},D,F,re);if(!x(ue))throw new I("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:D});fe["@id"]=ue,fe.reverse=!0}else if("@id"in U){let te=U["@id"];if(te&&!b(te))throw new I("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:D});if(null===te)fe["@id"]=null;else{if(!Y.isKeyword(te)&&te.match(P))return re.eventHandler&&_({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:te}},options:re}),void(ne?O.mappings.set(L,ne):O.mappings.delete(L));if(te!==L){if(te=De(O,te,{vocab:!0,base:!1},D,F,re),!x(te)&&!Y.isKeyword(te))throw new I("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:D});if(L.match(/(?::[^:])|\//)&&De(O,L,{vocab:!0,base:!1},D,new Map(F).set(L,!0),re)!==te)throw new I("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:D});fe["@id"]=te,fe._prefix=pe&&!fe._termHasColon&&null!==te.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in fe))if(fe._termHasColon){const te=L.substr(0,Pe);if(D.hasOwnProperty(te)&&Y.createTermDefinition({activeCtx:O,localCtx:D,term:te,defined:F,options:re}),O.mappings.has(te)){const ue=L.substr(Pe+1);fe["@id"]=O.mappings.get(te)["@id"]+ue}else fe["@id"]=L}else if("@type"===L)fe["@id"]=L;else{if(!("@vocab"in O))throw new I("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:D,term:L});fe["@id"]=O["@vocab"]+L}if((!0===U["@protected"]||!0===F.get("@protected")&&!1!==U["@protected"])&&(O.protected[L]=!0,fe.protected=!0),F.set(L,!0),"@type"in U){let te=U["@type"];if(!b(te))throw new I("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:D});if("@json"===te||"@none"===te){if(Y.processingMode(O,1))throw new I(`Invalid JSON-LD syntax; an @context @type value must not be "${te}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:D})}else if("@id"!==te&&"@vocab"!==te){if(te=De(O,te,{vocab:!0,base:!1},D,F,re),!x(te))throw new I("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:D});if(0===te.indexOf("_:"))throw new I("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:D})}fe["@type"]=te}if("@container"in U){const te=b(U["@container"])?[U["@container"]]:U["@container"]||[],ue=["@list","@set","@index","@language"];let Le=!0;const Ee=te.includes("@set");if(Y.processingMode(O,1.1)){if(ue.push("@graph","@id","@type"),te.includes("@list")){if(1!==te.length)throw new I("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:D})}else if(te.includes("@graph")){if(te.some(ae=>"@graph"!==ae&&"@id"!==ae&&"@index"!==ae&&"@set"!==ae))throw new I("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:D})}else Le&=te.length<=(Ee?2:1);if(te.includes("@type")&&(fe["@type"]=fe["@type"]||"@id",!["@id","@vocab"].includes(fe["@type"])))throw new I("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:D})}else Le&=!m(U["@container"]),Le&=te.length<=1;if(Le&=te.every(ae=>ue.includes(ae)),Le&=!(Ee&&te.includes("@list")),!Le)throw new I("Invalid JSON-LD syntax; @context @container value must be one of the following: "+ue.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:D});if(fe.reverse&&!te.every(ae=>["@index","@set"].includes(ae)))throw new I("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:D});fe["@container"]=te}if("@index"in U){if(!("@container"in U)||!fe["@container"].includes("@index"))throw new I(`Invalid JSON-LD syntax; @index without @index in @container: "${U["@index"]}" on term "${L}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:D});if(!b(U["@index"])||0===U["@index"].indexOf("@"))throw new I(`Invalid JSON-LD syntax; @index must expand to an IRI: "${U["@index"]}" on term "${L}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:D});fe["@index"]=U["@index"]}if("@context"in U&&(fe["@context"]=U["@context"]),"@language"in U&&!("@type"in U)){let te=U["@language"];if(null!==te&&!b(te))throw new I("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:D});null!==te&&(te=te.toLowerCase()),fe["@language"]=te}if("@prefix"in U){if(L.match(/:|\//))throw new I("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:D});if(Y.isKeyword(fe["@id"]))throw new I("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:D});if("boolean"!=typeof U["@prefix"])throw new I("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:D});fe._prefix=!0===U["@prefix"]}if("@direction"in U){const te=U["@direction"];if(null!==te&&"ltr"!==te&&"rtl"!==te)throw new I('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:D});fe["@direction"]=te}if("@nest"in U){const te=U["@nest"];if(!b(te)||"@nest"!==te&&0===te.indexOf("@"))throw new I("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:D});fe["@nest"]=te}const he=fe["@id"];if("@context"===he||"@preserve"===he)throw new I("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:D});if(ne&&ne.protected&&!ie&&(O.protected[L]=!0,fe.protected=!0,!se(ne,fe)))throw new I("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:D,term:L})},Y.expandIri=(O,D,L,F)=>De(O,D,L,void 0,void 0,F),Y.getInitialContext=O=>{const D=JSON.stringify({processingMode:O.processingMode}),L=B.get(D);if(L)return L;const F={processingMode:O.processingMode,mappings:new Map,inverse:null,getInverse:function re(){const fe=this;if(fe.inverse)return fe.inverse;const be=fe.inverse={},Pe=fe.fastCurieMap={},he={},te=(fe["@language"]||"@none").toLowerCase(),ue=fe["@direction"],Le=fe.mappings,Ee=[...Le.keys()].sort(K);for(const ae of Ee){const Oe=Le.get(ae);if(null===Oe)continue;let $e=Oe["@container"]||"@none";if($e=[].concat($e).sort().join(""),null===Oe["@id"])continue;const je=k(Oe["@id"]);for(const Ze of je){let Ne=be[Ze];const ze=Y.isKeyword(Ze);if(Ne)!ze&&!Oe._termHasColon&&he[Ze].push(ae);else if(be[Ze]=Ne={},!ze&&!Oe._termHasColon){he[Ze]=[ae];const me={iri:Ze,terms:he[Ze]};Ze[0]in Pe?Pe[Ze[0]].push(me):Pe[Ze[0]]=[me]}if(Ne[$e]||(Ne[$e]={"@language":{},"@type":{},"@any":{}}),Ne=Ne[$e],U(ae,Ne["@any"],"@none"),Oe.reverse)U(ae,Ne["@type"],"@reverse");else if("@none"===Oe["@type"])U(ae,Ne["@any"],"@none"),U(ae,Ne["@language"],"@none"),U(ae,Ne["@type"],"@none");else if("@type"in Oe)U(ae,Ne["@type"],Oe["@type"]);else if("@language"in Oe&&"@direction"in Oe){const me=Oe["@language"],ve=Oe["@direction"];U(ae,Ne["@language"],me&&ve?`${me}_${ve}`.toLowerCase():me?me.toLowerCase():ve?`_${ve}`:"@null")}else"@language"in Oe?U(ae,Ne["@language"],(Oe["@language"]||"@null").toLowerCase()):"@direction"in Oe?U(ae,Ne["@language"],Oe["@direction"]?`_${Oe["@direction"]}`:"@none"):ue?(U(ae,Ne["@language"],`_${ue}`),U(ae,Ne["@language"],"@none"),U(ae,Ne["@type"],"@none")):(U(ae,Ne["@language"],te),U(ae,Ne["@language"],"@none"),U(ae,Ne["@type"],"@none"))}}for(const ae in Pe)ie(Pe,ae,1);return be},clone:function ne(){const fe={};return fe.mappings=A.clone(this.mappings),fe.clone=this.clone,fe.inverse=null,fe.getInverse=this.getInverse,fe.protected=A.clone(this.protected),this.previousContext&&(fe.previousContext=this.previousContext.clone()),fe.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(fe["@base"]=this["@base"]),"@language"in this&&(fe["@language"]=this["@language"]),"@vocab"in this&&(fe["@vocab"]=this["@vocab"]),fe},revertToPreviousContext:function pe(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===B.size&&B.clear(),B.set(D,F),F;function ie(fe,be,Pe){const he=fe[be],te=fe[be]={};let ue,Le;for(const Ee of he)ue=Ee.iri,Le=Pe>=ue.length?"":ue[Pe],Le in te?te[Le].push(Ee):te[Le]=[Ee];for(const Ee in te)""!==Ee&&ie(te,Ee,Pe+1)}function U(fe,be,Pe){be.hasOwnProperty(Pe)||(be[Pe]=fe)}},Y.getContextValue=(O,D,L)=>{if(null===D)return"@context"===L?void 0:null;if(O.mappings.has(D)){const F=O.mappings.get(D);if(T(L))return F;if(F.hasOwnProperty(L))return F[L]}return"@language"===L&&L in O||"@direction"===L&&L in O?O[L]:"@context"!==L?null:void 0},Y.processingMode=(O,D)=>D.toString()>="1.1"?!O.processingMode||O.processingMode>="json-ld-"+D.toString():"json-ld-1.0"===O.processingMode,Y.isKeyword=O=>{if(!b(O)||"@"!==O[0])return!1;switch(O){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(Ke,Re,q){"use strict";var ee=q(9293).default;const{parseLinkHeader:A,buildHeaders:I}=q(9420),{LINK_HEADER_CONTEXT:m}=q(5315),N=q(262),b=q(4808),{prependBase:T}=q(2051),x=/(^|(\r\n))link:/i;Ke.exports=({secure:S,headers:_={},xhr:z}={headers:{}})=>{return _=I(_),(new b).wrapLoader(k);function k(B){return K.apply(this,arguments)}function K(){return K=ee(function*(B){if(0!==B.indexOf("http:")&&0!==B.indexOf("https:"))throw new N('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:B});if(S&&0!==B.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:B});let y;try{y=yield function R(S,_,z){const P=new(S=S||XMLHttpRequest);return new Promise((k,K)=>{P.onload=()=>k(P),P.onerror=B=>K(B),P.open("GET",_,!0);for(const B in z)P.setRequestHeader(B,z[B]);P.send()})}(z,B,_)}catch(D){throw new N("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:B,cause:D})}if(y.status>=400)throw new N("URL could not be dereferenced: "+y.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:B,httpStatusCode:y.status});let Y={contextUrl:null,documentUrl:B,document:y.response},De=null;const se=y.getResponseHeader("Content-Type");let O;if(x.test(y.getAllResponseHeaders())&&(O=y.getResponseHeader("Link")),O&&"application/ld+json"!==se){const D=A(O),L=D[m];if(Array.isArray(L))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:B});L&&(Y.contextUrl=L.target),De=D.alternate,De&&"application/ld+json"==De.type&&!(se||"").match(/^application\/(\w*\+)?json$/)&&(Y=yield k(T(B,De.target)))}return Y}),K.apply(this,arguments)}}},2585(Ke,Re,q){"use strict";const ee=q(262),{isArray:A}=q(2831),{asArray:I}=q(9420),m={};function N({event:T,handlers:x}){let R=!0;for(let S=0;R&&S<x.length;++S){R=!1;const _=x[S];if(A(_))R=N({event:T,handlers:_});else if("function"==typeof _)_({event:T,next:()=>{R=!0}});else{if("object"!=typeof _)throw new ee("Invalid event handler.","jsonld.InvalidEventHandler",{event:T});T.code in _?_[T.code]({event:T,next:()=>{R=!0}}):R=!0}}return R}Ke.exports=m,m.defaultEventHandler=null,m.setupEventHandler=({options:T={}})=>{const x=[].concat(T.safe?m.safeEventHandler:[],T.eventHandler?I(T.eventHandler):[],m.defaultEventHandler?m.defaultEventHandler:[]);return 0===x.length?null:x},m.handleEvent=({event:T,options:x})=>{N({event:T,handlers:x.eventHandler})};const b=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"]);m.safeEventHandler=function({event:x,next:R}){if("warning"===x.level&&b.has(x.code))throw new ee("Safe mode validation error.","jsonld.ValidationError",{event:x});R()},m.logEventHandler=function({event:x,next:R}){console.log(`EVENT: ${x.message}`,{event:x}),R()},m.logWarningEventHandler=function({event:x,next:R}){"warning"===x.level&&console.warn(`WARNING: ${x.message}`,{event:x}),R()},m.unhandledEventHandler=function({event:x}){throw new ee("No handler for event.","jsonld.UnhandledEvent",{event:x})},m.setDefaultEventHandler=function({eventHandler:T}={}){m.defaultEventHandler=T?I(T):null}},7336(Ke,Re,q){"use strict";var ee=q(9293).default;const A=q(262),{isArray:I,isObject:m,isEmptyObject:N,isString:b,isUndefined:T}=q(2831),{isList:x,isValue:R,isGraph:S,isSubject:_}=q(4209),{expandIri:z,getContextValue:P,isKeyword:k,process:K,processingMode:B}=q(429),{isAbsolute:y}=q(2051),{REGEX_BCP47:Y,REGEX_KEYWORD:De,addValue:se,asArray:O,getValues:D,validateTypeValue:L}=q(9420),{handleEvent:F}=q(2585),re={};function ie({value:he,count:te,options:ue}){if(0===te||"@value"in he||"@list"in he||1===te&&"@id"in he){if(ue.eventHandler){let Le,Ee;0===te?(Le="empty object",Ee="Dropping empty object."):"@value"in he?(Le="object with only @value",Ee="Dropping object with only @value."):"@list"in he?(Le="object with only @list",Ee="Dropping object with only @list."):1===te&&"@id"in he&&(Le="object with only @id",Ee="Dropping object with only @id."),F({event:{type:["JsonLdEvent"],code:Le,level:"warning",message:Ee,details:{value:he}},options:ue})}return null}return he}function U(he){return ne.apply(this,arguments)}function ne(){return(ne=ee(function*({activeCtx:he,activeProperty:te,expandedActiveProperty:ue,element:Le,expandedParent:Ee,options:ae={},insideList:Oe,typeKey:$e,typeScopedContext:je}){const Ze=Object.keys(Le).sort(),Ne=[];let ze;const me=Le[$e]&&"@json"===z(he,I(Le[$e])?Le[$e][0]:Le[$e],{vocab:!0},{...ae,typeExpansion:!0});for(const ve of Ze){let et,_e=Le[ve];if("@context"===ve)continue;const Xe=z(he,ve,{vocab:!0},ae);if(null===Xe||!y(Xe)&&!k(Xe)){ae.eventHandler&&F({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:ve,expandedProperty:Xe}},options:ae});continue}if(k(Xe)){if("@reverse"===ue)throw new A("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:_e});if(Xe in Ee&&"@included"!==Xe&&"@type"!==Xe)throw new A("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:Xe})}if("@id"===Xe){if(!b(_e)){if(!ae.isFrame)throw new A('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:_e});if(m(_e)){if(!N(_e))throw new A('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:_e})}else{if(!I(_e))throw new A('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:_e});if(!_e.every(Qe=>b(Qe)))throw new A('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:_e})}}se(Ee,"@id",O(_e).map(Qe=>{if(b(Qe)){const Et=z(he,Qe,{base:!0},ae);return ae.eventHandler&&(null===Et?F(null===Qe?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:Qe}},options:ae}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:Qe}},options:ae}):y(Et)||F({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:Qe,expandedId:Et}},options:ae})),Et}return Qe}),{propertyIsArray:ae.isFrame});continue}if("@type"===Xe){m(_e)&&(_e=Object.fromEntries(Object.entries(_e).map(([Qe,Et])=>[z(je,Qe,{vocab:!0}),O(Et).map(Bt=>z(je,Bt,{base:!0,vocab:!0},{...ae,typeExpansion:!0}))]))),L(_e,ae.isFrame),se(Ee,"@type",O(_e).map(Qe=>{if(b(Qe)){const Et=z(je,Qe,{base:!0,vocab:!0},{...ae,typeExpansion:!0});return"@json"!==Et&&!y(Et)&&ae.eventHandler&&F({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:Qe}},options:ae}),Et}return Qe}),{propertyIsArray:!!ae.isFrame});continue}if("@included"===Xe&&B(he,1.1)){const Qe=O(yield re.expand({activeCtx:he,activeProperty:te,element:_e,options:ae}));if(!Qe.every(Et=>_(Et)))throw new A("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:_e});se(Ee,"@included",Qe,{propertyIsArray:!0});continue}if("@graph"===Xe&&!m(_e)&&!I(_e))throw new A('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:_e});if("@value"===Xe){ze=_e,me&&B(he,1.1)?Ee["@value"]=_e:se(Ee,"@value",_e,{propertyIsArray:ae.isFrame});continue}if("@language"===Xe){if(null===_e)continue;if(!b(_e)&&!ae.isFrame)throw new A('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:_e});_e=O(_e).map(Qe=>b(Qe)?Qe.toLowerCase():Qe);for(const Qe of _e)b(Qe)&&!Qe.match(Y)&&ae.eventHandler&&F({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Qe}},options:ae});se(Ee,"@language",_e,{propertyIsArray:ae.isFrame});continue}if("@direction"===Xe){if(!b(_e)&&!ae.isFrame)throw new A('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:_e});_e=O(_e);for(const Qe of _e)if(b(Qe)&&"ltr"!==Qe&&"rtl"!==Qe)throw new A('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:_e});se(Ee,"@direction",_e,{propertyIsArray:ae.isFrame});continue}if("@index"===Xe){if(!b(_e))throw new A('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:_e});se(Ee,"@index",_e);continue}if("@reverse"===Xe){if(!m(_e))throw new A('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:_e});if(et=yield re.expand({activeCtx:he,activeProperty:"@reverse",element:_e,options:ae}),"@reverse"in et)for(const Et in et["@reverse"])se(Ee,Et,et["@reverse"][Et],{propertyIsArray:!0});let Qe=Ee["@reverse"]||null;for(const Et in et){if("@reverse"===Et)continue;null===Qe&&(Qe=Ee["@reverse"]={}),se(Qe,Et,[],{propertyIsArray:!0});const Bt=et[Et];for(let tr=0;tr<Bt.length;++tr){const Xt=Bt[tr];if(R(Xt)||x(Xt))throw new A('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:et});se(Qe,Et,Xt,{propertyIsArray:!0})}}continue}if("@nest"===Xe){Ne.push(ve);continue}let nt=he;const pt=P(he,ve,"@context");T(pt)||(nt=yield K({activeCtx:he,localCtx:pt,propagate:!0,overrideProtected:!0,options:ae}));const Dt=P(he,ve,"@container")||[];if(Dt.includes("@language")&&m(_e))et=fe(nt,_e,P(nt,ve,"@direction"),ae);else if(Dt.includes("@index")&&m(_e)){const Qe=Dt.includes("@graph"),Et=P(nt,ve,"@index")||"@index",Bt="@index"!==Et&&z(he,Et,{vocab:!0},ae);et=yield be({activeCtx:nt,options:ae,activeProperty:ve,value:_e,asGraph:Qe,indexKey:Et,propertyIndex:Bt})}else if(Dt.includes("@id")&&m(_e)){const Qe=Dt.includes("@graph");et=yield be({activeCtx:nt,options:ae,activeProperty:ve,value:_e,asGraph:Qe,indexKey:"@id"})}else if(Dt.includes("@type")&&m(_e))et=yield be({activeCtx:nt.revertToPreviousContext(),options:ae,activeProperty:ve,value:_e,asGraph:!1,indexKey:"@type"});else{const Qe="@list"===Xe;if(Qe||"@set"===Xe){let Et=te;Qe&&"@graph"===ue&&(Et=null),et=yield re.expand({activeCtx:nt,activeProperty:Et,element:_e,options:ae,insideList:Qe})}else et="@json"===P(he,ve,"@type")?{"@type":"@json","@value":_e}:yield re.expand({activeCtx:nt,activeProperty:ve,element:_e,options:ae,insideList:!1})}if(null!==et||"@value"===Xe){if("@list"!==Xe&&!x(et)&&Dt.includes("@list")&&(et={"@list":O(et)}),Dt.includes("@graph")&&!Dt.some(Qe=>"@id"===Qe||"@index"===Qe)){if(et=O(et),ae.isFrame||(et=et.filter(Qe=>null!==ie({value:Qe,count:Object.keys(Qe).length,options:ae}))),0===et.length)continue;et=et.map(Qe=>({"@graph":O(Qe)}))}if(nt.mappings.has(ve)&&nt.mappings.get(ve).reverse){const Qe=Ee["@reverse"]=Ee["@reverse"]||{};et=O(et);for(let Et=0;Et<et.length;++Et){const Bt=et[Et];if(R(Bt)||x(Bt))throw new A('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:et});se(Qe,Xe,Bt,{propertyIsArray:!0})}continue}se(Ee,Xe,et,{propertyIsArray:!0})}}if("@value"in Ee&&("@json"!==Ee["@type"]||!B(he,1.1))&&(m(ze)||I(ze))&&!ae.isFrame)throw new A('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:ze});for(const ve of Ne){const _e=I(Le[ve])?Le[ve]:[Le[ve]];for(const et of _e){if(!m(et)||Object.keys(et).some(Xe=>"@value"===z(he,Xe,{vocab:!0},ae)))throw new A("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:et});yield U({activeCtx:he,activeProperty:te,expandedActiveProperty:ue,element:et,expandedParent:Ee,options:ae,insideList:Oe,typeScopedContext:je,typeKey:$e})}}})).apply(this,arguments)}function pe({activeCtx:he,activeProperty:te,value:ue,options:Le}){if(null==ue)return null;const Ee=z(he,te,{vocab:!0},Le);if("@id"===Ee)return z(he,ue,{base:!0},Le);if("@type"===Ee)return z(he,ue,{vocab:!0,base:!0},{...Le,typeExpansion:!0});const ae=P(he,te,"@type");if(("@id"===ae||"@graph"===Ee)&&b(ue)){const $e=z(he,ue,{base:!0},Le);return null===$e&&ue.match(De)&&Le.eventHandler&&F({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:te}},options:Le}),{"@id":$e}}if("@vocab"===ae&&b(ue))return{"@id":z(he,ue,{vocab:!0,base:!0},Le)};if(k(Ee))return ue;const Oe={};if(ae&&!["@id","@vocab","@none"].includes(ae))Oe["@type"]=ae;else if(b(ue)){const $e=P(he,te,"@language");null!==$e&&(Oe["@language"]=$e);const je=P(he,te,"@direction");null!==je&&(Oe["@direction"]=je)}return["boolean","number","string"].includes(typeof ue)||(ue=ue.toString()),Oe["@value"]=ue,Oe}function fe(he,te,ue,Le){const Ee=[],ae=Object.keys(te).sort();for(const Oe of ae){const $e=z(he,Oe,{vocab:!0},Le);let je=te[Oe];I(je)||(je=[je]);for(const Ze of je){if(null===Ze)continue;if(!b(Ze))throw new A("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:te});const Ne={"@value":Ze};"@none"!==$e&&(Oe.match(Y)||Le.eventHandler&&F({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Oe}},options:Le}),Ne["@language"]=Oe.toLowerCase()),ue&&(Ne["@direction"]=ue),Ee.push(Ne)}}return Ee}function be(he){return Pe.apply(this,arguments)}function Pe(){return(Pe=ee(function*({activeCtx:he,options:te,activeProperty:ue,value:Le,asGraph:Ee,indexKey:ae,propertyIndex:Oe}){const $e=[],je=Object.keys(Le).sort(),Ze="@type"===ae;for(let Ne of je){if(Ze){const ve=P(he,Ne,"@context");T(ve)||(he=yield K({activeCtx:he,localCtx:ve,propagate:!1,options:te}))}let me,ze=Le[Ne];I(ze)||(ze=[ze]),ze=yield re.expand({activeCtx:he,activeProperty:ue,element:ze,options:te,insideList:!1,insideIndex:!0}),me=Oe?"@none"===Ne?"@none":pe({activeCtx:he,activeProperty:ae,value:Ne,options:te}):z(he,Ne,{vocab:!0},te),"@id"===ae?Ne=z(he,Ne,{base:!0},te):Ze&&(Ne=me);for(let ve of ze){if(Ee&&!S(ve)&&(ve={"@graph":[ve]}),"@type"===ae)"@none"===me||(ve["@type"]=ve["@type"]?[Ne].concat(ve["@type"]):[Ne]);else{if(R(ve)&&!["@language","@type","@index"].includes(ae))throw new A(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${ae}".`,"jsonld.SyntaxError",{code:"invalid value object",value:ve});Oe?"@none"!==me&&se(ve,Oe,me,{propertyIsArray:!0,prependValue:!0}):"@none"!==me&&!(ae in ve)&&(ve[ae]=Ne)}$e.push(ve)}}return $e})).apply(this,arguments)}Ke.exports=re,re.expand=function(){var he=ee(function*({activeCtx:te,activeProperty:ue=null,element:Le,options:Ee={},insideList:ae=!1,insideIndex:Oe=!1,typeScopedContext:$e=null}){if(null==Le)return null;if("@default"===ue&&(Ee=Object.assign({},Ee,{isFrame:!1})),!I(Le)&&!m(Le))return ae||null!==ue&&"@graph"!==z(te,ue,{vocab:!0},Ee)?pe({activeCtx:te,activeProperty:ue,value:Le,options:Ee}):(Ee.eventHandler&&F({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:Le}},options:Ee}),null);if(I(Le)){let et=[];const Xe=P(te,ue,"@container")||[];ae=ae||Xe.includes("@list");for(let nt=0;nt<Le.length;++nt){let pt=yield re.expand({activeCtx:te,activeProperty:ue,element:Le[nt],options:Ee,insideIndex:Oe,typeScopedContext:$e});ae&&I(pt)&&(pt={"@list":pt}),null!==pt&&(I(pt)?et=et.concat(pt):et.push(pt))}return et}const je=z(te,ue,{vocab:!0},Ee),Ze=P(te,ue,"@context");$e=$e||(te.previousContext?te:null);let Ne=Object.keys(Le).sort(),ze=!Oe;if(ze&&$e&&Ne.length<=2&&!Ne.includes("@context"))for(const et of Ne){const Xe=z($e,et,{vocab:!0},Ee);if("@value"===Xe){ze=!1,te=$e;break}if("@id"===Xe&&1===Ne.length){ze=!1;break}}ze&&(te=te.revertToPreviousContext()),T(Ze)||(te=yield K({activeCtx:te,localCtx:Ze,propagate:!0,overrideProtected:!0,options:Ee})),"@context"in Le&&(te=yield K({activeCtx:te,localCtx:Le["@context"],options:Ee})),$e=te;let me=null;for(const et of Ne)if("@type"===z(te,et,{vocab:!0},Ee)){me=me||et;const nt=Le[et],pt=Array.isArray(nt)?nt.length>1?nt.slice().sort():nt:[nt];for(const Dt of pt){const Qe=P($e,Dt,"@context");T(Qe)||(te=yield K({activeCtx:te,localCtx:Qe,options:Ee,propagate:!1}))}}let ve={};yield U({activeCtx:te,activeProperty:ue,expandedActiveProperty:je,element:Le,expandedParent:ve,options:Ee,insideList:ae,typeKey:me,typeScopedContext:$e}),Ne=Object.keys(ve);let _e=Ne.length;if("@value"in ve){if("@type"in ve&&("@language"in ve||"@direction"in ve))throw new A('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:ve});let et=_e-1;if("@type"in ve&&(et-=1),"@index"in ve&&(et-=1),"@language"in ve&&(et-=1),"@direction"in ve&&(et-=1),0!==et)throw new A('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:ve});const Xe=null===ve["@value"]?[]:O(ve["@value"]),nt=D(ve,"@type");if(!B(te,1.1)||!nt.includes("@json")||1!==nt.length)if(0===Xe.length)Ee.eventHandler&&F({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:ve}},options:Ee}),ve=null;else{if(!Xe.every(pt=>b(pt)||N(pt))&&"@language"in ve)throw new A("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:ve});if(!nt.every(pt=>y(pt)&&!(b(pt)&&0===pt.indexOf("_:"))||N(pt)))throw new A('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:ve})}}else if("@type"in ve&&!I(ve["@type"]))ve["@type"]=[ve["@type"]];else if("@set"in ve||"@list"in ve){if(_e>1&&(2!==_e||!("@index"in ve)))throw new A('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:ve});"@set"in ve&&(ve=ve["@set"],Ne=Object.keys(ve),_e=Ne.length)}else 1===_e&&"@language"in ve&&(Ee.eventHandler&&F({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:ve}},options:Ee}),ve=null);return m(ve)&&!Ee.keepFreeFloatingNodes&&!ae&&(null===ue||"@graph"===je||(P(te,ue,"@container")||[]).includes("@graph"))&&(ve=ie({value:ve,count:_e,options:Ee})),ve});return function(te){return he.apply(this,arguments)}}()},9392(Ke,Re,q){"use strict";const{isSubjectReference:ee}=q(4209),{createMergedNodeMap:A}=q(5096),I={};Ke.exports=I,I.flatten=m=>{const N=A(m),b=[],T=Object.keys(N).sort();for(let x=0;x<T.length;++x){const R=N[T[x]];ee(R)||b.push(R)}return b}},7031(Ke,Re,q){"use strict";const{isKeyword:ee}=q(429),A=q(4209),I=q(2831),m=q(9420),N=q(2051),b=q(262),{createNodeMap:T,mergeNodeMapGraphs:x}=q(5096),R={};function S(O){const D={};for(const L in O)void 0!==O[L]&&(D["@"+L]=[O[L]]);return[D]}function _(O,D,L){for(let F=L.length-1;F>=0;--F){const re=L[F];if(re.graph===D&&re.subject["@id"]===O["@id"])return!0}return!1}function z(O,D,L){const F="@"+L;let re=F in O?O[F][0]:D[L];if("embed"===L)if(!0===re)re="@once";else if(!1===re)re="@never";else if("@always"!==re&&"@never"!==re&&"@link"!==re&&"@first"!==re&&"@last"!==re&&"@once"!==re)throw new b("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:O});return re}function P(O){if(!I.isArray(O)||1!==O.length||!I.isObject(O[0]))throw new b("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:O});if("@id"in O[0])for(const D of m.asArray(O[0]["@id"]))if(!I.isObject(D)&&!N.isAbsolute(D)||I.isString(D)&&0===D.indexOf("_:"))throw new b("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:O});if("@type"in O[0])for(const D of m.asArray(O[0]["@type"]))if(!I.isObject(D)&&!N.isAbsolute(D)&&"@json"!==D||I.isString(D)&&0===D.indexOf("_:"))throw new b("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:O})}function K(O,D,L,F){let re=!0,ie=!1;for(const U in L){let ne=!1;const pe=m.getValues(D,U),fe=0===m.getValues(L,U).length;if("@id"===U){if(I.isEmptyObject(L["@id"][0]||{})?ne=!0:L["@id"].length>=0&&(ne=L["@id"].includes(pe[0])),!F.requireAll)return ne}else if("@type"===U){if(re=!1,fe){if(pe.length>0)return!1;ne=!0}else if(1===L["@type"].length&&I.isEmptyObject(L["@type"][0]))ne=pe.length>0;else for(const be of L["@type"])ne=!(!I.isObject(be)||!("@default"in be))||ne||pe.some(Pe=>Pe===be);if(!F.requireAll)return ne}else{if(ee(U))continue;{const be=m.getValues(L,U)[0];let Pe=!1;if(be&&(P([be]),Pe="@default"in be),re=!1,0===pe.length&&Pe)continue;if(pe.length>0&&fe)return!1;if(void 0===be){if(pe.length>0)return!1;ne=!0}else if(A.isList(be)){const he=be["@list"][0];if(A.isList(pe[0])){const te=pe[0]["@list"];A.isValue(he)?ne=te.some(ue=>se(he,ue)):(A.isSubject(he)||A.isSubjectReference(he))&&(ne=te.some(ue=>De(O,he,ue,F)))}}else ne=A.isValue(be)?pe.some(he=>se(be,he)):A.isSubjectReference(be)?pe.some(he=>De(O,be,he,F)):!!I.isObject(be)&&pe.length>0}}if(!ne&&F.requireAll)return!1;ie=ie||ne}return re||ie}function B(O,D){const L=O.uniqueEmbeds[O.graph],F=L[D],re=F.parent,ie=F.property,U={"@id":D};if(I.isArray(re)){for(let pe=0;pe<re.length;++pe)if(m.compareValues(re[pe],U)){re[pe]=U;break}}else{const pe=I.isArray(re[ie]);m.removeValue(re,ie,U,{propertyIsArray:pe}),m.addValue(re,ie,U,{propertyIsArray:pe})}const ne=pe=>{const fe=Object.keys(L);for(const be of fe)be in L&&I.isObject(L[be].parent)&&L[be].parent["@id"]===pe&&(delete L[be],ne(be))};ne(D)}function y(O,D){if(I.isArray(O))return O.map(L=>y(L,D));if(I.isObject(O)){if("@preserve"in O)return O["@preserve"][0];if(A.isValue(O))return O;if(A.isList(O))return O["@list"]=y(O["@list"],D),O;if("@id"in O){const L=O["@id"];if(D.link.hasOwnProperty(L)){const F=D.link[L].indexOf(O);if(-1!==F)return D.link[L][F];D.link[L].push(O)}else D.link[L]=[O]}for(const L in O)"@id"===L&&D.bnodesToClear.includes(O[L])?delete O["@id"]:O[L]=y(O[L],D)}return O}function Y(O,D,L){I.isObject(O)?m.addValue(O,D,L,{propertyIsArray:!0}):O.push(L)}function De(O,D,L,F){if(!("@id"in L))return!1;const re=O.subjects[L["@id"]];return re&&K(O,re,D,F)}function se(O,D){const L=D["@value"],F=D["@type"],re=D["@language"],ie=O["@value"]?I.isArray(O["@value"])?O["@value"]:[O["@value"]]:[],U=O["@type"]?I.isArray(O["@type"])?O["@type"]:[O["@type"]]:[],ne=O["@language"]?I.isArray(O["@language"])?O["@language"]:[O["@language"]]:[];return 0===ie.length&&0===U.length&&0===ne.length||!(!ie.includes(L)&&!I.isEmptyObject(ie[0])||!(!F&&0===U.length||U.includes(F)||F&&I.isEmptyObject(U[0]))||!(!re&&0===ne.length||ne.includes(re)||re&&I.isEmptyObject(ne[0])))}Ke.exports=R,R.frameMergedOrDefault=(O,D,L)=>{const F={options:L,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},re=new m.IdentifierIssuer("_:b");T(O,F.graphMap,"@default",re),L.merged&&(F.graphMap["@merged"]=x(F.graphMap),F.graph="@merged"),F.subjects=F.graphMap[F.graph];const ie=[];return R.frame(F,Object.keys(F.subjects).sort(),D,ie),L.pruneBlankNodeIdentifiers&&(L.bnodesToClear=Object.keys(F.bnodeMap).filter(U=>1===F.bnodeMap[U].length)),L.link={},y(ie,L)},R.frame=(O,D,L,F,re=null)=>{P(L);const ie=O.options,U={embed:z(L=L[0],ie,"embed"),explicit:z(L,ie,"explicit"),requireAll:z(L,ie,"requireAll")};O.link.hasOwnProperty(O.graph)||(O.link[O.graph]={});const ne=O.link[O.graph],pe=function k(O,D,L,F){const re={};for(const ie of D){const U=O.graphMap[O.graph][ie];K(O,U,L,F)&&(re[ie]=U)}return re}(O,D,L,U),fe=Object.keys(pe).sort();for(const be of fe){const Pe=pe[be];if(null===re?O.uniqueEmbeds={[O.graph]:{}}:O.uniqueEmbeds[O.graph]=O.uniqueEmbeds[O.graph]||{},"@link"===U.embed&&be in ne){Y(F,re,ne[be]);continue}const he={"@id":be};if(0===be.indexOf("_:")&&m.addValue(O.bnodeMap,be,he,{propertyIsArray:!0}),ne[be]=he,("@first"===U.embed||"@last"===U.embed)&&O.is11)throw new b("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:L});if(O.embedded||!O.uniqueEmbeds[O.graph].hasOwnProperty(be)){if(O.embedded&&("@never"===U.embed||_(Pe,O.graph,O.subjectStack))){Y(F,re,he);continue}if(O.embedded&&("@first"==U.embed||"@once"==U.embed)&&O.uniqueEmbeds[O.graph].hasOwnProperty(be)){Y(F,re,he);continue}if("@last"===U.embed&&be in O.uniqueEmbeds[O.graph]&&B(O,be),O.uniqueEmbeds[O.graph][be]={parent:F,property:re},O.subjectStack.push({subject:Pe,graph:O.graph}),be in O.graphMap){let te=!1,ue=null;"@graph"in L?(ue=L["@graph"][0],te=!("@merged"===be||"@default"===be),I.isObject(ue)||(ue={})):(te="@merged"!==O.graph,ue={}),te&&R.frame({...O,graph:be,embedded:!1},Object.keys(O.graphMap[be]).sort(),[ue],he,"@graph")}"@included"in L&&R.frame({...O,embedded:!1},D,L["@included"],he,"@included");for(const te of Object.keys(Pe).sort())if(ee(te)){if(he[te]=m.clone(Pe[te]),"@type"===te)for(const ue of Pe["@type"])0===ue.indexOf("_:")&&m.addValue(O.bnodeMap,ue,he,{propertyIsArray:!0})}else if(!U.explicit||te in L)for(const ue of Pe[te]){const Le=te in L?L[te]:S(U);if(A.isList(ue)){const Ee=L[te]&&L[te][0]&&L[te][0]["@list"]?L[te][0]["@list"]:S(U),ae={"@list":[]};Y(he,te,ae);const Oe=ue["@list"];for(const $e of Oe)A.isSubjectReference($e)?R.frame({...O,embedded:!0},[$e["@id"]],Ee,ae,"@list"):Y(ae,"@list",m.clone($e))}else A.isSubjectReference(ue)?R.frame({...O,embedded:!0},[ue["@id"]],Le,he,te):se(Le[0],ue)&&Y(he,te,m.clone(ue))}for(const te of Object.keys(L).sort()){if("@type"===te){if(!I.isObject(L[te][0])||!("@default"in L[te][0]))continue}else if(ee(te))continue;const ue=L[te][0]||{};if(!z(ue,ie,"omitDefault")&&!(te in he)){let Ee="@null";"@default"in ue&&(Ee=m.clone(ue["@default"])),I.isArray(Ee)||(Ee=[Ee]),he[te]=[{"@preserve":Ee}]}}for(const te of Object.keys(L["@reverse"]||{}).sort()){const ue=L["@reverse"][te];for(const Le of Object.keys(O.subjects))m.getValues(O.subjects[Le],te).some(ae=>ae["@id"]===be)&&(he["@reverse"]=he["@reverse"]||{},m.addValue(he["@reverse"],te,[],{propertyIsArray:!0}),R.frame({...O,embedded:!0},[Le],ue,he["@reverse"][te],re))}Y(F,re,he),O.subjectStack.pop()}}},R.cleanupNull=(O,D)=>{if(I.isArray(O))return O.map(F=>R.cleanupNull(F,D)).filter(F=>F);if("@null"===O)return null;if(I.isObject(O)){if("@id"in O){const L=O["@id"];if(D.link.hasOwnProperty(L)){const F=D.link[L].indexOf(O);if(-1!==F)return D.link[L][F];D.link[L].push(O)}else D.link[L]=[O]}for(const L in O)O[L]=R.cleanupNull(O[L],D)}return O}},4814(Ke,Re,q){"use strict";var ee=q(9293).default;const A=q(262),I=q(4209),m=q(2831),{REGEX_BCP47:N,addValue:b}=q(9420),{handleEvent:T}=q(2585),{RDF_LIST:x,RDF_FIRST:R,RDF_REST:S,RDF_NIL:_,RDF_TYPE:z,RDF_JSON_LITERAL:P,XSD_BOOLEAN:k,XSD_DOUBLE:K,XSD_INTEGER:B,XSD_STRING:y}=q(5315),Y={};function De(se,O,D,L){if(se.termType.endsWith("Node"))return{"@id":se.value};const F={"@value":se.value};if(se.language)se.language.match(N)||L.eventHandler&&T({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:se.language}},options:L}),F["@language"]=se.language;else{let re=se.datatype.value;if(re||(re=y),re===P){re="@json";try{F["@value"]=JSON.parse(F["@value"])}catch(ie){throw new A("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:F["@value"],cause:ie})}}if(O){if(re===k)"true"===F["@value"]?F["@value"]=!0:"false"===F["@value"]&&(F["@value"]=!1);else if(m.isNumeric(F["@value"]))if(re===B){const ie=parseInt(F["@value"],10);ie.toFixed(0)===F["@value"]&&(F["@value"]=ie)}else re===K&&(F["@value"]=parseFloat(F["@value"]));[k,B,K,y].includes(re)||(F["@type"]=re)}else if("i18n-datatype"===D&&re.startsWith("https://www.w3.org/ns/i18n#")){const[,ie,U]=re.split(/[#_]/);ie.length>0&&(F["@language"]=ie,ie.match(N)||L.eventHandler&&T({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:ie}},options:L})),F["@direction"]=U}else re!==y&&(F["@type"]=re)}return F}Ke.exports=Y,Y.fromRDF=function(){var se=ee(function*(O,D){const{useRdfType:L=!1,useNativeTypes:F=!1,rdfDirection:re=null}=D,ie={},U={"@default":ie},ne={};if(re){if("compound-literal"===re)throw new A("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:re});if("i18n-datatype"!==re)throw new A("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:re})}for(const be of O){const Pe="DefaultGraph"===be.graph.termType?"@default":be.graph.value;Pe in U||(U[Pe]={}),"@default"!==Pe&&!(Pe in ie)&&(ie[Pe]={"@id":Pe});const he=U[Pe],te=be.subject.value,ue=be.predicate.value,Le=be.object;te in he||(he[te]={"@id":te});const Ee=he[te],ae=Le.termType.endsWith("Node");if(ae&&!(Le.value in he)&&(he[Le.value]={"@id":Le.value}),ue===z&&!L&&ae){b(Ee,"@type",Le.value,{propertyIsArray:!0});continue}const Oe=De(Le,F,re,D);if(b(Ee,ue,Oe,{propertyIsArray:!0}),ae)if(Le.value===_){const $e=he[Le.value];"usages"in $e||($e.usages=[]),$e.usages.push({node:Ee,property:ue,value:Oe})}else ne[Le.value]=!(Le.value in ne)&&{node:Ee,property:ue,value:Oe}}for(const be in U){const Pe=U[be];if(!(_ in Pe))continue;const he=Pe[_];if(he.usages){for(let te of he.usages){let ue=te.node,Le=te.property,Ee=te.value;const ae=[],Oe=[];let $e=Object.keys(ue).length;for(;Le===S&&m.isObject(ne[ue["@id"]])&&m.isArray(ue[R])&&1===ue[R].length&&m.isArray(ue[S])&&1===ue[S].length&&(3===$e||4===$e&&m.isArray(ue["@type"])&&1===ue["@type"].length&&ue["@type"][0]===x)&&(ae.push(ue[R][0]),Oe.push(ue["@id"]),te=ne[ue["@id"]],ue=te.node,Le=te.property,Ee=te.value,$e=Object.keys(ue).length,I.isBlankNode(ue)););delete Ee["@id"],Ee["@list"]=ae.reverse();for(const je of Oe)delete Pe[je]}delete he.usages}}const pe=[],fe=Object.keys(ie).sort();for(const be of fe){const Pe=ie[be];if(be in U){const he=Pe["@graph"]=[],te=U[be],ue=Object.keys(te).sort();for(const Le of ue){const Ee=te[Le];I.isSubjectReference(Ee)||he.push(Ee)}}I.isSubjectReference(Pe)||pe.push(Pe)}return pe});return function(O,D){return se.apply(this,arguments)}}()},4209(Ke,Re,q){"use strict";const ee=q(2831),A={};Ke.exports=A,A.isSubject=I=>!(!ee.isObject(I)||"@value"in I||"@set"in I||"@list"in I)&&(Object.keys(I).length>1||!("@id"in I)),A.isSubjectReference=I=>ee.isObject(I)&&1===Object.keys(I).length&&"@id"in I,A.isValue=I=>ee.isObject(I)&&"@value"in I,A.isList=I=>ee.isObject(I)&&"@list"in I,A.isGraph=I=>ee.isObject(I)&&"@graph"in I&&1===Object.keys(I).filter(m=>"@id"!==m&&"@index"!==m).length,A.isSimpleGraph=I=>A.isGraph(I)&&!("@id"in I),A.isBlankNode=I=>{if(ee.isObject(I)){if("@id"in I){const m=I["@id"];return!ee.isString(m)||0===m.indexOf("_:")}return 0===Object.keys(I).length||!("@value"in I||"@set"in I||"@list"in I)}return!1}},2130(Ke,Re,q){var ee=q(9293).default;const A=q(1224),I=q(8666),m=q(9420),N=q(7839),b=m.IdentifierIssuer,T=q(262),x=q(3052),R=q(5426),{expand:S}=q(7336),{flatten:_}=q(9392),{fromRDF:z}=q(4814),{toRDF:P}=q(6397),{frameMergedOrDefault:k,cleanupNull:K}=q(7031),{isArray:B,isObject:y,isString:Y}=q(2831),{isSubjectReference:De}=q(4209),{expandIri:se,getInitialContext:O,process:D,processingMode:L}=q(429),{compact:F,compactIri:re}=q(3763),{createNodeMap:ie,createMergedNodeMap:U,mergeNodeMaps:ne}=q(5096),{logEventHandler:pe,logWarningEventHandler:fe,safeEventHandler:be,setDefaultEventHandler:Pe,setupEventHandler:he,strictEventHandler:te,unhandledEventHandler:ue}=q(2585),Le=function(ae){const Oe={},je=new x({max:100});function Ze(Ne,{documentLoader:ze=ae.documentLoader,...me}){if(Ne&&"compactionMap"in Ne)throw new T('"compactionMap" not supported.',"jsonld.OptionsError");if(Ne&&"expansionMap"in Ne)throw new T('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:ze},me,Ne,{eventHandler:he({options:Ne})})}return ae.compact=function(){var Ne=ee(function*(ze,me,ve){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===me)throw new T("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===ze)return null;let _e;(ve=Ze(ve,{base:Y(ze)?ze:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new b("_:b"),contextResolver:new N({sharedCache:je})})).link&&(ve.skipExpansion=!0),ve.compactToRelative||delete ve.base,_e=ve.skipExpansion?ze:yield ae.expand(ze,ve);const et=yield ae.processContext(O(ve),me,ve);let Xe=yield F({activeCtx:et,element:_e,options:ve});ve.compactArrays&&!ve.graph&&B(Xe)?1===Xe.length?Xe=Xe[0]:0===Xe.length&&(Xe={}):ve.graph&&y(Xe)&&(Xe=[Xe]),y(me)&&"@context"in me&&(me=me["@context"]),me=m.clone(me),B(me)||(me=[me]);const nt=me;me=[];for(let Dt=0;Dt<nt.length;++Dt)(!y(nt[Dt])||Object.keys(nt[Dt]).length>0)&&me.push(nt[Dt]);const pt=me.length>0;if(1===me.length&&(me=me[0]),B(Xe)){const Dt=re({activeCtx:et,iri:"@graph",relativeTo:{vocab:!0}}),Qe=Xe;Xe={},pt&&(Xe["@context"]=me),Xe[Dt]=Qe}else if(y(Xe)&&pt){const Dt=Xe;Xe={"@context":me};for(const Qe in Dt)Xe[Qe]=Dt[Qe]}return Xe});return function(ze,me,ve){return Ne.apply(this,arguments)}}(),ae.expand=function(){var Ne=ee(function*(ze,me){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const ve={},_e=[];if("expandContext"in(me=Ze(me,{keepFreeFloatingNodes:!1,contextResolver:new N({sharedCache:je})}))){const pt=m.clone(me.expandContext);ve.expandContext=y(pt)&&"@context"in pt?pt:{"@context":pt},_e.push(ve.expandContext)}let et;if(Y(ze)){const pt=yield ae.get(ze,me);et=pt.documentUrl,ve.input=pt.document,pt.contextUrl&&(ve.remoteContext={"@context":pt.contextUrl},_e.push(ve.remoteContext))}else ve.input=m.clone(ze);"base"in me||(me.base=et||"");let Xe=O(me);for(const pt of _e)Xe=yield D({activeCtx:Xe,localCtx:pt,options:me});let nt=yield S({activeCtx:Xe,element:ve.input,options:me});return y(nt)&&"@graph"in nt&&1===Object.keys(nt).length?nt=nt["@graph"]:null===nt&&(nt=[]),B(nt)||(nt=[nt]),nt});return function(ze,me){return Ne.apply(this,arguments)}}(),ae.flatten=function(){var Ne=ee(function*(ze,me,ve){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");me="function"==typeof me?null:me||null,ve=Ze(ve,{base:Y(ze)?ze:"",contextResolver:new N({sharedCache:je})});const _e=yield ae.expand(ze,ve),et=_(_e);return null===me?et:(ve.graph=!0,ve.skipExpansion=!0,yield ae.compact(et,me,ve))});return function(ze,me,ve){return Ne.apply(this,arguments)}}(),ae.frame=function(){var Ne=ee(function*(ze,me,ve){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(ve=Ze(ve,{base:Y(ze)?ze:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new N({sharedCache:je})}),Y(me)){const Bt=yield ae.get(me,ve);if(me=Bt.document,Bt.contextUrl){let tr=me["@context"];tr?B(tr)?tr.push(Bt.contextUrl):tr=[tr,Bt.contextUrl]:tr=Bt.contextUrl,me["@context"]=tr}}const _e=me&&me["@context"]||{},et=yield ae.processContext(O(ve),_e,ve);ve.hasOwnProperty("omitGraph")||(ve.omitGraph=L(et,1.1)),ve.hasOwnProperty("pruneBlankNodeIdentifiers")||(ve.pruneBlankNodeIdentifiers=L(et,1.1));const Xe=yield ae.expand(ze,ve),nt={...ve};nt.isFrame=!0,nt.keepFreeFloatingNodes=!0;const pt=yield ae.expand(me,nt),Dt=Object.keys(me).map(Bt=>se(et,Bt,{vocab:!0}));nt.merged=!Dt.includes("@graph"),nt.is11=L(et,1.1);const Qe=k(Xe,pt,nt);nt.graph=!ve.omitGraph,nt.skipExpansion=!0,nt.link={},nt.framing=!0;let Et=yield ae.compact(Qe,_e,nt);return nt.link={},Et=K(Et,nt),Et});return function(ze,me,ve){return Ne.apply(this,arguments)}}(),ae.link=function(){var Ne=ee(function*(ze,me,ve){const _e={};return me&&(_e["@context"]=me),_e["@embed"]="@link",ae.frame(ze,_e,ve)});return function(ze,me,ve){return Ne.apply(this,arguments)}}(),ae.normalize=ae.canonize=function(){var Ne=ee(function*(ze,me){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(me=Ze(me,{base:Y(ze)?ze:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new N({sharedCache:je})}))){if("application/n-quads"!==me.inputFormat&&"application/nquads"!==me.inputFormat)throw new T("Unknown canonicalization input format.","jsonld.CanonizeError");const et=R.parse(ze);return A.canonize(et,me)}const ve={...me};delete ve.format,ve.produceGeneralizedRdf=!1;const _e=yield ae.toRDF(ze,ve);return A.canonize(_e,me)});return function(ze,me){return Ne.apply(this,arguments)}}(),ae.fromRDF=function(){var Ne=ee(function*(ze,me){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");me=Ze(me,{format:Y(ze)?"application/n-quads":void 0});const{format:ve}=me;let{rdfParser:_e}=me;if(ve){if(_e=_e||Oe[ve],!_e)throw new T("Unknown input format.","jsonld.UnknownFormat",{format:ve})}else _e=()=>ze;const et=yield _e(ze);return z(et,me)});return function(ze,me){return Ne.apply(this,arguments)}}(),ae.toRDF=function(){var Ne=ee(function*(ze,me){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let ve;ve=(me=Ze(me,{base:Y(ze)?ze:"",skipExpansion:!1,contextResolver:new N({sharedCache:je})})).skipExpansion?ze:yield ae.expand(ze,me);const _e=P(ve,me);if(me.format){if("application/n-quads"===me.format||"application/nquads"===me.format)return R.serialize(_e);throw new T("Unknown output format.","jsonld.UnknownFormat",{format:me.format})}return _e});return function(ze,me){return Ne.apply(this,arguments)}}(),ae.createNodeMap=function(){var Ne=ee(function*(ze,me){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");me=Ze(me,{base:Y(ze)?ze:"",contextResolver:new N({sharedCache:je})});const ve=yield ae.expand(ze,me);return U(ve,me)});return function(ze,me){return Ne.apply(this,arguments)}}(),ae.merge=function(){var Ne=ee(function*(ze,me,ve){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!B(ze))throw new TypeError('Could not merge, "docs" must be an array.');me="function"==typeof me?null:me||null,ve=Ze(ve,{contextResolver:new N({sharedCache:je})});const _e=yield Promise.all(ze.map(Bt=>{const tr={...ve};return ae.expand(Bt,tr)}));let et=!0;"mergeNodes"in ve&&(et=ve.mergeNodes);const Xe=ve.issuer||new b("_:b"),nt={"@default":{}};for(let Bt=0;Bt<_e.length;++Bt){const tr=m.relabelBlankNodes(_e[Bt],{issuer:new b("_:b"+Bt+"-")}),Xt=et||0===Bt?nt:{"@default":{}};if(ie(tr,Xt,"@default",Xe),Xt!==nt)for(const rn in Xt){const Zt=Xt[rn];if(!(rn in nt)){nt[rn]=Zt;continue}const ca=nt[rn];for(const da in Zt)da in ca||(ca[da]=Zt[da])}}const pt=ne(nt),Dt=[],Qe=Object.keys(pt).sort();for(let Bt=0;Bt<Qe.length;++Bt){const tr=pt[Qe[Bt]];De(tr)||Dt.push(tr)}return null===me?Dt:(ve.graph=!0,ve.skipExpansion=!0,yield ae.compact(Dt,me,ve))});return function(ze,me,ve){return Ne.apply(this,arguments)}}(),Object.defineProperty(ae,"documentLoader",{get:()=>ae._documentLoader,set:Ne=>ae._documentLoader=Ne}),ae.documentLoader=function(){var Ne=ee(function*(ze){throw new T("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:ze})});return function(ze){return Ne.apply(this,arguments)}}(),ae.get=function(){var Ne=ee(function*(ze,me){let ve;ve="function"==typeof me.documentLoader?me.documentLoader:ae.documentLoader;const _e=yield ve(ze);try{if(!_e.document)throw new T("No remote document found at the given URL.","jsonld.NullRemoteDocument");Y(_e.document)&&(_e.document=JSON.parse(_e.document))}catch(et){throw new T("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:et,remoteDoc:_e})}return _e});return function(ze,me){return Ne.apply(this,arguments)}}(),ae.processContext=function(){var Ne=ee(function*(ze,me,ve){return ve=Ze(ve,{base:"",contextResolver:new N({sharedCache:je})}),null===me?O(ve):(me=m.clone(me),y(me)&&"@context"in me||(me={"@context":me}),D({activeCtx:ze,localCtx:me,options:ve}))});return function(ze,me,ve){return Ne.apply(this,arguments)}}(),ae.getContextValue=q(429).getContextValue,ae.documentLoaders={},ae.useDocumentLoader=function(Ne){if(!(Ne in ae.documentLoaders))throw new T('Unknown document loader type: "'+Ne+'"',"jsonld.UnknownDocumentLoader",{type:Ne});ae.documentLoader=ae.documentLoaders[Ne].apply(ae,Array.prototype.slice.call(arguments,1))},ae.registerRDFParser=function(Ne,ze){Oe[Ne]=ze},ae.unregisterRDFParser=function(Ne){delete Oe[Ne]},ae.registerRDFParser("application/n-quads",R.parse),ae.registerRDFParser("application/nquads",R.parse),ae.url=q(2051),ae.logEventHandler=pe,ae.logWarningEventHandler=fe,ae.safeEventHandler=be,ae.setDefaultEventHandler=Pe,ae.strictEventHandler=te,ae.unhandledEventHandler=ue,ae.util=m,Object.assign(ae,m),ae.promises=ae,ae.RequestQueue=q(4808),ae.JsonLdProcessor=q(1328)(ae),I.setupGlobals(ae),I.setupDocumentLoaders(ae),ae},Ee=function(){return Le(function(){return Ee()})};Le(Ee),Ke.exports=Ee},5096(Ke,Re,q){"use strict";const{isKeyword:ee}=q(429),A=q(4209),I=q(2831),m=q(9420),N=q(262),b={};Ke.exports=b,b.createMergedNodeMap=(T,x)=>{const R=(x=x||{}).issuer||new m.IdentifierIssuer("_:b"),S={"@default":{}};return b.createNodeMap(T,S,"@default",R),b.mergeNodeMaps(S)},b.createNodeMap=(T,x,R,S,_,z)=>{if(I.isArray(T)){for(const B of T)b.createNodeMap(B,x,R,S,void 0,z);return}if(!I.isObject(T))return void(z&&z.push(T));if(A.isValue(T)){if("@type"in T){let B=T["@type"];0===B.indexOf("_:")&&(T["@type"]=B=S.getId(B))}return void(z&&z.push(T))}if(z&&A.isList(T)){const B=[];return b.createNodeMap(T["@list"],x,R,S,_,B),void z.push({"@list":B})}if("@type"in T){const B=T["@type"];for(const y of B)0===y.indexOf("_:")&&S.getId(y)}I.isUndefined(_)&&(_=A.isBlankNode(T)?S.getId(T["@id"]):T["@id"]),z&&z.push({"@id":_});const P=x[R],k=P[_]=P[_]||{};k["@id"]=_;const K=Object.keys(T).sort();for(let B of K){if("@id"===B)continue;if("@reverse"===B){const Y={"@id":_},De=T["@reverse"];for(const se in De){const O=De[se];for(const D of O){let L=D["@id"];A.isBlankNode(D)&&(L=S.getId(L)),b.createNodeMap(D,x,R,S,L),m.addValue(P[L],se,Y,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===B){_ in x||(x[_]={}),b.createNodeMap(T[B],x,_,S);continue}if("@included"===B){b.createNodeMap(T[B],x,R,S);continue}if("@type"!==B&&ee(B)){if("@index"===B&&B in k&&(T[B]!==k[B]||T[B]["@id"]!==k[B]["@id"]))throw new N("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:k});k[B]=T[B];continue}const y=T[B];if(0===B.indexOf("_:")&&(B=S.getId(B)),0!==y.length)for(let Y of y)if("@type"===B&&(Y=0===Y.indexOf("_:")?S.getId(Y):Y),A.isSubject(Y)||A.isSubjectReference(Y)){if("@id"in Y&&!Y["@id"])continue;const De=A.isBlankNode(Y)?S.getId(Y["@id"]):Y["@id"];m.addValue(k,B,{"@id":De},{propertyIsArray:!0,allowDuplicate:!1}),b.createNodeMap(Y,x,R,S,De)}else if(A.isValue(Y))m.addValue(k,B,Y,{propertyIsArray:!0,allowDuplicate:!1});else if(A.isList(Y)){const De=[];b.createNodeMap(Y["@list"],x,R,S,_,De),Y={"@list":De},m.addValue(k,B,Y,{propertyIsArray:!0,allowDuplicate:!1})}else b.createNodeMap(Y,x,R,S,_),m.addValue(k,B,Y,{propertyIsArray:!0,allowDuplicate:!1});else m.addValue(k,B,[],{propertyIsArray:!0})}},b.mergeNodeMapGraphs=T=>{const x={};for(const R of Object.keys(T).sort())for(const S of Object.keys(T[R]).sort()){const _=T[R][S];S in x||(x[S]={"@id":S});const z=x[S];for(const P of Object.keys(_).sort())if(ee(P)&&"@type"!==P)z[P]=m.clone(_[P]);else for(const k of _[P])m.addValue(z,P,m.clone(k),{propertyIsArray:!0,allowDuplicate:!1})}return x},b.mergeNodeMaps=T=>{const x=T["@default"],R=Object.keys(T).sort();for(const S of R){if("@default"===S)continue;const _=T[S];let z=x[S];z?"@graph"in z||(z["@graph"]=[]):x[S]=z={"@id":S,"@graph":[]};const P=z["@graph"];for(const k of Object.keys(_).sort()){const K=_[k];A.isSubjectReference(K)||P.push(K)}}return x}},8666(Ke,Re,q){"use strict";const ee=q(3120),A={};Ke.exports=A,A.setupDocumentLoaders=function(I){typeof XMLHttpRequest<"u"&&(I.documentLoaders.xhr=ee,I.useDocumentLoader("xhr"))},A.setupGlobals=function(I){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:I.JsonLdProcessor})}},6397(Ke,Re,q){"use strict";const{createNodeMap:ee}=q(5096),{isKeyword:A}=q(429),I=q(4209),m=q(8846),N=q(262),b=q(2831),T=q(9420),{handleEvent:x}=q(2585),{RDF_FIRST:R,RDF_REST:S,RDF_NIL:_,RDF_TYPE:z,RDF_JSON_LITERAL:P,RDF_LANGSTRING:k,XSD_BOOLEAN:K,XSD_DOUBLE:B,XSD_INTEGER:y,XSD_STRING:Y}=q(5315),{isAbsolute:De}=q(2051),se={};function O(F,re,ie,U,ne){const pe=Object.keys(re).sort();for(const fe of pe){const be=re[fe],Pe=Object.keys(be).sort();for(let he of Pe){const te=be[he];if("@type"===he)he=z;else if(A(he))continue;for(const ue of te){const Le={termType:fe.startsWith("_:")?"BlankNode":"NamedNode",value:fe};if(!De(fe)){ne.eventHandler&&x({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:fe}},options:ne});continue}const Ee={termType:he.startsWith("_:")?"BlankNode":"NamedNode",value:he};if(!De(he)){ne.eventHandler&&x({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:he}},options:ne});continue}if("BlankNode"===Ee.termType&&!ne.produceGeneralizedRdf){ne.eventHandler&&x({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:U.getOldIds().find(Oe=>U.getId(Oe)===he)}},options:ne});continue}const ae=L(ue,U,F,ie,ne.rdfDirection,ne);ae&&F.push({subject:Le,predicate:Ee,object:ae,graph:ie})}}}}function L(F,re,ie,U,ne,pe){const fe={};if(I.isValue(F)){fe.termType="Literal",fe.value=void 0,fe.datatype={termType:"NamedNode"};let be=F["@value"];const Pe=F["@type"]||null;if("@json"===Pe)fe.value=m(be),fe.datatype.value=P;else if(b.isBoolean(be))fe.value=be.toString(),fe.datatype.value=Pe||K;else if(b.isDouble(be)||Pe===B)b.isDouble(be)||(be=parseFloat(be)),fe.value=be.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),fe.datatype.value=Pe||B;else if(b.isNumber(be))fe.value=be.toFixed(0),fe.datatype.value=Pe||y;else if("@direction"in F&&"i18n-datatype"===ne){const he=(F["@language"]||"").toLowerCase();fe.datatype.value=`https://www.w3.org/ns/i18n#${he}_${F["@direction"]}`,fe.value=be}else{if("@direction"in F&&"compound-literal"===ne)throw new N("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:ne});if("@direction"in F&&ne)throw new N("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:ne});"@language"in F?("@direction"in F&&!ne&&pe.eventHandler&&x({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:fe.value}},options:pe}),fe.value=be,fe.datatype.value=Pe||k,fe.language=F["@language"]):("@direction"in F&&!ne&&pe.eventHandler&&x({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:fe.value}},options:pe}),fe.value=be,fe.datatype.value=Pe||Y)}}else if(I.isList(F)){const be=function D(F,re,ie,U,ne,pe){const fe={termType:"NamedNode",value:R},be={termType:"NamedNode",value:S},Pe={termType:"NamedNode",value:_},he=F.pop(),te=he?{termType:"BlankNode",value:re.getId()}:Pe;let ue=te;for(const Le of F){const Ee=L(Le,re,ie,U,ne,pe),ae={termType:"BlankNode",value:re.getId()};ie.push({subject:ue,predicate:fe,object:Ee,graph:U}),ie.push({subject:ue,predicate:be,object:ae,graph:U}),ue=ae}if(he){const Le=L(he,re,ie,U,ne,pe);ie.push({subject:ue,predicate:fe,object:Le,graph:U}),ie.push({subject:ue,predicate:be,object:Pe,graph:U})}return te}(F["@list"],re,ie,U,ne,pe);fe.termType=be.termType,fe.value=be.value}else{const be=b.isObject(F)?F["@id"]:F;fe.termType=be.startsWith("_:")?"BlankNode":"NamedNode",fe.value=be}return"NamedNode"!==fe.termType||De(fe.value)?fe:(pe.eventHandler&&x({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:fe.value}},options:pe}),null)}Ke.exports=se,se.toRDF=(F,re)=>{const ie=new T.IdentifierIssuer("_:b"),U={"@default":{}};ee(F,U,"@default",ie);const ne=[],pe=Object.keys(U).sort();for(const fe of pe){let be;if("@default"===fe)be={termType:"DefaultGraph",value:""};else{if(!De(fe)){re.eventHandler&&x({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:fe}},options:re});continue}be=fe.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},be.value=fe}O(ne,U[fe],be,ie,re)}return ne}},2831(Ke){"use strict";const Re={};Ke.exports=Re,Re.isArray=Array.isArray,Re.isBoolean=q=>"boolean"==typeof q||"[object Boolean]"===Object.prototype.toString.call(q),Re.isDouble=q=>Re.isNumber(q)&&(-1!==String(q).indexOf(".")||Math.abs(q)>=1e21),Re.isEmptyObject=q=>Re.isObject(q)&&0===Object.keys(q).length,Re.isNumber=q=>"number"==typeof q||"[object Number]"===Object.prototype.toString.call(q),Re.isNumeric=q=>!isNaN(parseFloat(q))&&isFinite(q),Re.isObject=q=>"[object Object]"===Object.prototype.toString.call(q),Re.isString=q=>"string"==typeof q||"[object String]"===Object.prototype.toString.call(q),Re.isUndefined=q=>typeof q>"u"},2051(Ke,Re,q){"use strict";const ee=q(2831),A={};Ke.exports=A,A.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*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},A.parse=(m,N)=>{const b={},T=A.parsers[N||"full"],x=T.regex.exec(m);let R=T.keys.length;for(;R--;)b[T.keys[R]]=void 0===x[R]?null:x[R];return("https"===b.scheme&&"443"===b.port||"http"===b.scheme&&"80"===b.port)&&(b.href=b.href.replace(":"+b.port,""),b.authority=b.authority.replace(":"+b.port,""),b.port=null),b.normalizedPath=A.removeDotSegments(b.path),b},A.prependBase=(m,N)=>{if(null===m||A.isAbsolute(N))return N;(!m||ee.isString(m))&&(m=A.parse(m||""));const b=A.parse(N),T={protocol:m.protocol||""};if(null!==b.authority)T.authority=b.authority,T.path=b.path,T.query=b.query;else if(T.authority=m.authority,""===b.path)T.path=m.path,T.query=null!==b.query?b.query:m.query;else{if(0===b.path.indexOf("/"))T.path=b.path;else{let R=m.path;R=R.substr(0,R.lastIndexOf("/")+1),(R.length>0||m.authority)&&"/"!==R.substr(-1)&&(R+="/"),R+=b.path,T.path=R}T.query=b.query}""!==b.path&&(T.path=A.removeDotSegments(T.path));let x=T.protocol;return null!==T.authority&&(x+="//"+T.authority),x+=T.path,null!==T.query&&(x+="?"+T.query),null!==b.fragment&&(x+="#"+b.fragment),""===x&&(x="./"),x},A.removeBase=(m,N)=>{if(null===m)return N;(!m||ee.isString(m))&&(m=A.parse(m||""));let b="";if(""!==m.href?b+=(m.protocol||"")+"//"+(m.authority||""):N.indexOf("//")&&(b+="//"),0!==N.indexOf(b))return N;const T=A.parse(N.substr(b.length)),x=m.normalizedPath.split("/"),R=T.normalizedPath.split("/"),S=T.fragment||T.query?0:1;for(;x.length>0&&R.length>S&&x[0]===R[0];)x.shift(),R.shift();let _="";if(x.length>0){x.pop();for(let z=0;z<x.length;++z)_+="../"}return _+=R.join("/"),null!==T.query&&(_+="?"+T.query),null!==T.fragment&&(_+="#"+T.fragment),""===_&&(_="./"),_},A.removeDotSegments=m=>{if(0===m.length)return"";const N=m.split("/"),b=[];for(;N.length>0;){const T=N.shift(),x=0===N.length;"."!==T?".."!==T?b.push(T):(b.pop(),x&&b.push("")):x&&b.push("")}return"/"===m[0]&&b.length>0&&""!==b[0]&&b.unshift(""),1===b.length&&""===b[0]?"/":b.join("/")};const I=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;A.isAbsolute=m=>ee.isString(m)&&I.test(m),A.isRelative=m=>ee.isString(m)},9420(Ke,Re,q){"use strict";const ee=q(4209),A=q(2831),I=q(1224).IdentifierIssuer,m=q(262),b=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,T=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,x=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,S_headers_accept="application/ld+json, application/json",_={};function z(P,k){if(A.isArray(k))for(let K=0;K<k.length;++K)k[K]=z(P,k[K]);else if(ee.isList(k))k["@list"]=z(P,k["@list"]);else if(A.isObject(k)){ee.isBlankNode(k)&&(k["@id"]=P.getId(k["@id"]));const K=Object.keys(k).sort();for(let B=0;B<K.length;++B){const y=K[B];"@id"!==y&&(k[y]=z(P,k[y]))}}return k}Ke.exports=_,_.IdentifierIssuer=I,_.REGEX_BCP47=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,_.REGEX_KEYWORD=/^@[a-zA-Z]+$/,_.clone=function(P){if(P&&"object"==typeof P){let k;if(A.isArray(P)){k=[];for(let K=0;K<P.length;++K)k[K]=_.clone(P[K])}else if(P instanceof Map){k=new Map;for(const[K,B]of P)k.set(K,_.clone(B))}else if(P instanceof Set){k=new Set;for(const K of P)k.add(_.clone(K))}else if(A.isObject(P)){k={};for(const K in P)k[K]=_.clone(P[K])}else k=P.toString();return k}return P},_.asArray=function(P){return Array.isArray(P)?P:[P]},_.buildHeaders=(P={})=>{if(Object.keys(P).some(K=>"accept"===K.toLowerCase()))throw new RangeError('Accept header may not be specified; only "'+S_headers_accept+'" is supported.');return Object.assign({Accept:S_headers_accept},P)},_.parseLinkHeader=P=>{const k={},K=P.match(b);for(let B=0;B<K.length;++B){let y=K[B].match(T);if(!y)continue;const Y={target:y[1]},De=y[2];for(;y=x.exec(De);)Y[y[1]]=void 0===y[2]?y[3]:y[2];const se=Y.rel||"";Array.isArray(k[se])?k[se].push(Y):k[se]=k.hasOwnProperty(se)?[k[se],Y]:Y}return k},_.validateTypeValue=(P,k)=>{if(!(A.isString(P)||A.isArray(P)&&P.every(K=>A.isString(K)))){if(k&&A.isObject(P))switch(Object.keys(P).length){case 0:return;case 1:if("@default"in P&&_.asArray(P["@default"]).every(K=>A.isString(K)))return}throw new m('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=(P,k)=>{if(P.hasOwnProperty(k)){const K=P[k];return!A.isArray(K)||K.length>0}return!1},_.hasValue=(P,k,K)=>{if(_.hasProperty(P,k)){let B=P[k];const y=ee.isList(B);if(A.isArray(B)||y){y&&(B=B["@list"]);for(let Y=0;Y<B.length;++Y)if(_.compareValues(K,B[Y]))return!0}else if(!A.isArray(K))return _.compareValues(K,B)}return!1},_.addValue=(P,k,K,B)=>{if("propertyIsArray"in(B=B||{})||(B.propertyIsArray=!1),"valueIsArray"in B||(B.valueIsArray=!1),"allowDuplicate"in B||(B.allowDuplicate=!0),"prependValue"in B||(B.prependValue=!1),B.valueIsArray)P[k]=K;else if(A.isArray(K)){0===K.length&&B.propertyIsArray&&!P.hasOwnProperty(k)&&(P[k]=[]),B.prependValue&&(K=K.concat(P[k]),P[k]=[]);for(let y=0;y<K.length;++y)_.addValue(P,k,K[y],B)}else if(P.hasOwnProperty(k)){const y=!B.allowDuplicate&&_.hasValue(P,k,K);!A.isArray(P[k])&&(!y||B.propertyIsArray)&&(P[k]=[P[k]]),y||(B.prependValue?P[k].unshift(K):P[k].push(K))}else P[k]=B.propertyIsArray?[K]:K},_.getValues=(P,k)=>[].concat(P[k]||[]),_.removeProperty=(P,k)=>{delete P[k]},_.removeValue=(P,k,K,B)=>{"propertyIsArray"in(B=B||{})||(B.propertyIsArray=!1);const y=_.getValues(P,k).filter(Y=>!_.compareValues(Y,K));0===y.length?_.removeProperty(P,k):P[k]=1!==y.length||B.propertyIsArray?y:y[0]},_.relabelBlankNodes=(P,k)=>z((k=k||{}).issuer||new I("_:b"),P),_.compareValues=(P,k)=>!!(P===k||ee.isValue(P)&&ee.isValue(k)&&P["@value"]===k["@value"]&&P["@type"]===k["@type"]&&P["@language"]===k["@language"]&&P["@index"]===k["@index"])||!!(A.isObject(P)&&"@id"in P&&A.isObject(k)&&"@id"in k)&&P["@id"]===k["@id"],_.compareShortestLeast=(P,k)=>P.length<k.length?-1:k.length<P.length?1:P===k?0:P<k?-1:1},3052(Ke,Re,q){"use strict";const ee=q(4842),A=Symbol("max"),I=Symbol("length"),m=Symbol("lengthCalculator"),N=Symbol("allowStale"),b=Symbol("maxAge"),T=Symbol("dispose"),x=Symbol("noDisposeOnSet"),R=Symbol("lruList"),S=Symbol("cache"),_=Symbol("updateAgeOnGet"),z=()=>1,k=(se,O,D)=>{const L=se[S].get(O);if(L){const F=L.value;if(K(se,F)){if(y(se,L),!se[N])return}else D&&(se[_]&&(L.value.now=Date.now()),se[R].unshiftNode(L));return F.value}},K=(se,O)=>{if(!O||!O.maxAge&&!se[b])return!1;const D=Date.now()-O.now;return O.maxAge?D>O.maxAge:se[b]&&D>se[b]},B=se=>{if(se[I]>se[A])for(let O=se[R].tail;se[I]>se[A]&&null!==O;){const D=O.prev;y(se,O),O=D}},y=(se,O)=>{if(O){const D=O.value;se[T]&&se[T](D.key,D.value),se[I]-=D.length,se[S].delete(D.key),se[R].removeNode(O)}};class Y{constructor(O,D,L,F,re){this.key=O,this.value=D,this.length=L,this.now=F,this.maxAge=re||0}}const De=(se,O,D,L)=>{let F=D.value;K(se,F)&&(y(se,D),se[N]||(F=void 0)),F&&O.call(L,F.value,F.key,se)};Ke.exports=class P{constructor(O){if("number"==typeof O&&(O={max:O}),O||(O={}),O.max&&("number"!=typeof O.max||O.max<0))throw new TypeError("max must be a non-negative number");this[A]=O.max||1/0;const L=O.length||z;if(this[m]="function"!=typeof L?z:L,this[N]=O.stale||!1,O.maxAge&&"number"!=typeof O.maxAge)throw new TypeError("maxAge must be a number");this[b]=O.maxAge||0,this[T]=O.dispose,this[x]=O.noDisposeOnSet||!1,this[_]=O.updateAgeOnGet||!1,this.reset()}set max(O){if("number"!=typeof O||O<0)throw new TypeError("max must be a non-negative number");this[A]=O||1/0,B(this)}get max(){return this[A]}set allowStale(O){this[N]=!!O}get allowStale(){return this[N]}set maxAge(O){if("number"!=typeof O)throw new TypeError("maxAge must be a non-negative number");this[b]=O,B(this)}get maxAge(){return this[b]}set lengthCalculator(O){"function"!=typeof O&&(O=z),O!==this[m]&&(this[m]=O,this[I]=0,this[R].forEach(D=>{D.length=this[m](D.value,D.key),this[I]+=D.length})),B(this)}get lengthCalculator(){return this[m]}get length(){return this[I]}get itemCount(){return this[R].length}rforEach(O,D){D=D||this;for(let L=this[R].tail;null!==L;){const F=L.prev;De(this,O,L,D),L=F}}forEach(O,D){D=D||this;for(let L=this[R].head;null!==L;){const F=L.next;De(this,O,L,D),L=F}}keys(){return this[R].toArray().map(O=>O.key)}values(){return this[R].toArray().map(O=>O.value)}reset(){this[T]&&this[R]&&this[R].length&&this[R].forEach(O=>this[T](O.key,O.value)),this[S]=new Map,this[R]=new ee,this[I]=0}dump(){return this[R].map(O=>!K(this,O)&&{k:O.key,v:O.value,e:O.now+(O.maxAge||0)}).toArray().filter(O=>O)}dumpLru(){return this[R]}set(O,D,L){if((L=L||this[b])&&"number"!=typeof L)throw new TypeError("maxAge must be a number");const F=L?Date.now():0,re=this[m](D,O);if(this[S].has(O)){if(re>this[A])return y(this,this[S].get(O)),!1;const ne=this[S].get(O).value;return this[T]&&(this[x]||this[T](O,ne.value)),ne.now=F,ne.maxAge=L,ne.value=D,this[I]+=re-ne.length,ne.length=re,this.get(O),B(this),!0}const ie=new Y(O,D,re,F,L);return ie.length>this[A]?(this[T]&&this[T](O,D),!1):(this[I]+=ie.length,this[R].unshift(ie),this[S].set(O,this[R].head),B(this),!0)}has(O){if(!this[S].has(O))return!1;const D=this[S].get(O).value;return!K(this,D)}get(O){return k(this,O,!0)}peek(O){return k(this,O,!1)}pop(){const O=this[R].tail;return O?(y(this,O),O.value):null}del(O){y(this,this[S].get(O))}load(O){this.reset();const D=Date.now();for(let L=O.length-1;L>=0;L--){const F=O[L],re=F.e||0;if(0===re)this.set(F.k,F.v);else{const ie=re-D;ie>0&&this.set(F.k,F.v,ie)}}}prune(){this[S].forEach((O,D)=>k(this,D,!1))}}},7568(Ke){"use strict";Ke.exports=function(Re){Re.prototype[Symbol.iterator]=function*(){for(let q=this.head;q;q=q.next)yield q.value}}},4842(Ke,Re,q){"use strict";function ee(b){var T=this;if(T instanceof ee||(T=new ee),T.tail=null,T.head=null,T.length=0,b&&"function"==typeof b.forEach)b.forEach(function(S){T.push(S)});else if(arguments.length>0)for(var x=0,R=arguments.length;x<R;x++)T.push(arguments[x]);return T}function A(b,T,x){var R=T===b.head?new N(x,null,T,b):new N(x,T,T.next,b);return null===R.next&&(b.tail=R),null===R.prev&&(b.head=R),b.length++,R}function I(b,T){b.tail=new N(T,b.tail,null,b),b.head||(b.head=b.tail),b.length++}function m(b,T){b.head=new N(T,null,b.head,b),b.tail||(b.tail=b.head),b.length++}function N(b,T,x,R){if(!(this instanceof N))return new N(b,T,x,R);this.list=R,this.value=b,T?(T.next=this,this.prev=T):this.prev=null,x?(x.prev=this,this.next=x):this.next=null}Ke.exports=ee,ee.Node=N,ee.create=ee,ee.prototype.removeNode=function(b){if(b.list!==this)throw new Error("removing node which does not belong to this list");var T=b.next,x=b.prev;return T&&(T.prev=x),x&&(x.next=T),b===this.head&&(this.head=T),b===this.tail&&(this.tail=x),b.list.length--,b.next=null,b.prev=null,b.list=null,T},ee.prototype.unshiftNode=function(b){if(b!==this.head){b.list&&b.list.removeNode(b);var T=this.head;b.list=this,b.next=T,T&&(T.prev=b),this.head=b,this.tail||(this.tail=b),this.length++}},ee.prototype.pushNode=function(b){if(b!==this.tail){b.list&&b.list.removeNode(b);var T=this.tail;b.list=this,b.prev=T,T&&(T.next=b),this.tail=b,this.head||(this.head=b),this.length++}},ee.prototype.push=function(){for(var b=0,T=arguments.length;b<T;b++)I(this,arguments[b]);return this.length},ee.prototype.unshift=function(){for(var b=0,T=arguments.length;b<T;b++)m(this,arguments[b]);return this.length},ee.prototype.pop=function(){if(this.tail){var b=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,b}},ee.prototype.shift=function(){if(this.head){var b=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,b}},ee.prototype.forEach=function(b,T){T=T||this;for(var x=this.head,R=0;null!==x;R++)b.call(T,x.value,R,this),x=x.next},ee.prototype.forEachReverse=function(b,T){T=T||this;for(var x=this.tail,R=this.length-1;null!==x;R--)b.call(T,x.value,R,this),x=x.prev},ee.prototype.get=function(b){for(var T=0,x=this.head;null!==x&&T<b;T++)x=x.next;if(T===b&&null!==x)return x.value},ee.prototype.getReverse=function(b){for(var T=0,x=this.tail;null!==x&&T<b;T++)x=x.prev;if(T===b&&null!==x)return x.value},ee.prototype.map=function(b,T){T=T||this;for(var x=new ee,R=this.head;null!==R;)x.push(b.call(T,R.value,this)),R=R.next;return x},ee.prototype.mapReverse=function(b,T){T=T||this;for(var x=new ee,R=this.tail;null!==R;)x.push(b.call(T,R.value,this)),R=R.prev;return x},ee.prototype.reduce=function(b,T){var x,R=this.head;if(arguments.length>1)x=T;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");R=this.head.next,x=this.head.value}for(var S=0;null!==R;S++)x=b(x,R.value,S),R=R.next;return x},ee.prototype.reduceReverse=function(b,T){var x,R=this.tail;if(arguments.length>1)x=T;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");R=this.tail.prev,x=this.tail.value}for(var S=this.length-1;null!==R;S--)x=b(x,R.value,S),R=R.prev;return x},ee.prototype.toArray=function(){for(var b=new Array(this.length),T=0,x=this.head;null!==x;T++)b[T]=x.value,x=x.next;return b},ee.prototype.toArrayReverse=function(){for(var b=new Array(this.length),T=0,x=this.tail;null!==x;T++)b[T]=x.value,x=x.prev;return b},ee.prototype.slice=function(b,T){(T=T||this.length)<0&&(T+=this.length),(b=b||0)<0&&(b+=this.length);var x=new ee;if(T<b||T<0)return x;b<0&&(b=0),T>this.length&&(T=this.length);for(var R=0,S=this.head;null!==S&&R<b;R++)S=S.next;for(;null!==S&&R<T;R++,S=S.next)x.push(S.value);return x},ee.prototype.sliceReverse=function(b,T){(T=T||this.length)<0&&(T+=this.length),(b=b||0)<0&&(b+=this.length);var x=new ee;if(T<b||T<0)return x;b<0&&(b=0),T>this.length&&(T=this.length);for(var R=this.length,S=this.tail;null!==S&&R>T;R--)S=S.prev;for(;null!==S&&R>b;R--,S=S.prev)x.push(S.value);return x},ee.prototype.splice=function(b,T,...x){b>this.length&&(b=this.length-1),b<0&&(b=this.length+b);for(var R=0,S=this.head;null!==S&&R<b;R++)S=S.next;var _=[];for(R=0;S&&R<T;R++)_.push(S.value),S=this.removeNode(S);for(null===S&&(S=this.tail),S!==this.head&&S!==this.tail&&(S=S.prev),R=0;R<x.length;R++)S=A(this,S,x[R]);return _},ee.prototype.reverse=function(){for(var b=this.head,T=this.tail,x=b;null!==x;x=x.prev){var R=x.prev;x.prev=x.next,x.next=R}return this.head=T,this.tail=b,this};try{q(7568)(ee)}catch{}},6556(Ke){Ke.exports=function(Re){var q={};function ee(A){if(q[A])return q[A].exports;var I=q[A]={i:A,l:!1,exports:{}};return Re[A].call(I.exports,I,I.exports,ee),I.l=!0,I.exports}return ee.m=Re,ee.c=q,ee.i=function(A){return A},ee.d=function(A,I,m){ee.o(A,I)||Object.defineProperty(A,I,{configurable:!1,enumerable:!0,get:m})},ee.n=function(A){var I=A&&A.__esModule?function(){return A.default}:function(){return A};return ee.d(I,"a",I),I},ee.o=function(A,I){return Object.prototype.hasOwnProperty.call(A,I)},ee.p="",ee(ee.s=26)}([function(Re,q,ee){"use strict";function A(){}A.QUALITY=1,A.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,A.DEFAULT_INCREMENTAL=!1,A.DEFAULT_ANIMATION_ON_LAYOUT=!0,A.DEFAULT_ANIMATION_DURING_LAYOUT=!1,A.DEFAULT_ANIMATION_PERIOD=50,A.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,A.DEFAULT_GRAPH_MARGIN=15,A.NODE_DIMENSIONS_INCLUDE_LABELS=!1,A.SIMPLE_NODE_HALF_SIZE=(A.SIMPLE_NODE_SIZE=40)/2,A.EMPTY_COMPOUND_NODE_SIZE=40,A.MIN_EDGE_LENGTH=1,A.INITIAL_WORLD_BOUNDARY=(A.WORLD_BOUNDARY=1e6)/1e3,A.WORLD_CENTER_X=1200,A.WORLD_CENTER_Y=900,Re.exports=A},function(Re,q,ee){"use strict";var A=ee(2),I=ee(8),m=ee(9);function N(T,x,R){A.call(this,R),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=R,this.bendpoints=[],this.source=T,this.target=x}for(var b in N.prototype=Object.create(A.prototype),A)N[b]=A[b];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(T){if(this.source===T)return this.target;if(this.target===T)return this.source;throw"Node is not incident with this edge"},N.prototype.getOtherEndInGraph=function(T,x){for(var R=this.getOtherEnd(T),S=x.getGraphManager().getRoot();;){if(R.getOwner()==x)return R;if(R.getOwner()==S)break;R=R.getOwner().getParent()}return null},N.prototype.updateLength=function(){var T=new Array(4);this.isOverlapingSourceAndTarget=I.getIntersection(this.target.getRect(),this.source.getRect(),T),this.isOverlapingSourceAndTarget||(this.lengthX=T[0]-T[2],this.lengthY=T[1]-T[3],Math.abs(this.lengthX)<1&&(this.lengthX=m.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=m.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=m.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=m.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},Re.exports=N},function(Re,q,ee){"use strict";Re.exports=function A(I){this.vGraphObject=I}},function(Re,q,ee){"use strict";var A=ee(2),I=ee(10),m=ee(13),N=ee(0),b=ee(16),T=ee(4);function x(S,_,z,P){null==z&&null==P&&(P=_),A.call(this,P),null!=S.graphManager&&(S=S.graphManager),this.estimatedSize=I.MIN_VALUE,this.inclusionTreeDepth=I.MAX_VALUE,this.vGraphObject=P,this.edges=[],this.graphManager=S,this.rect=null!=z&&null!=_?new m(_.x,_.y,z.width,z.height):new m}for(var R in x.prototype=Object.create(A.prototype),A)x[R]=A[R];x.prototype.getEdges=function(){return this.edges},x.prototype.getChild=function(){return this.child},x.prototype.getOwner=function(){return this.owner},x.prototype.getWidth=function(){return this.rect.width},x.prototype.setWidth=function(S){this.rect.width=S},x.prototype.getHeight=function(){return this.rect.height},x.prototype.setHeight=function(S){this.rect.height=S},x.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},x.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},x.prototype.getCenter=function(){return new T(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},x.prototype.getLocation=function(){return new T(this.rect.x,this.rect.y)},x.prototype.getRect=function(){return this.rect},x.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},x.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},x.prototype.setRect=function(S,_){this.rect.x=S.x,this.rect.y=S.y,this.rect.width=_.width,this.rect.height=_.height},x.prototype.setCenter=function(S,_){this.rect.x=S-this.rect.width/2,this.rect.y=_-this.rect.height/2},x.prototype.setLocation=function(S,_){this.rect.x=S,this.rect.y=_},x.prototype.moveBy=function(S,_){this.rect.x+=S,this.rect.y+=_},x.prototype.getEdgeListToNode=function(S){var _=[],P=this;return P.edges.forEach(function(k){if(k.target==S){if(k.source!=P)throw"Incorrect edge source!";_.push(k)}}),_},x.prototype.getEdgesBetween=function(S){var _=[],P=this;return P.edges.forEach(function(k){if(k.source!=P&&k.target!=P)throw"Incorrect edge source and/or target";(k.target==S||k.source==S)&&_.push(k)}),_},x.prototype.getNeighborsList=function(){var S=new Set,_=this;return _.edges.forEach(function(z){if(z.source==_)S.add(z.target);else{if(z.target!=_)throw"Incorrect incidency!";S.add(z.source)}}),S},x.prototype.withChildren=function(){var S=new Set;if(S.add(this),null!=this.child)for(var P=this.child.getNodes(),k=0;k<P.length;k++)P[k].withChildren().forEach(function(K){S.add(K)});return S},x.prototype.getNoOfChildren=function(){var S=0;if(null==this.child)S=1;else for(var z=this.child.getNodes(),P=0;P<z.length;P++)S+=z[P].getNoOfChildren();return 0==S&&(S=1),S},x.prototype.getEstimatedSize=function(){if(this.estimatedSize==I.MIN_VALUE)throw"assert failed";return this.estimatedSize},x.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)},x.prototype.scatter=function(){var S,_,z=-N.INITIAL_WORLD_BOUNDARY,P=N.INITIAL_WORLD_BOUNDARY;S=N.WORLD_CENTER_X+b.nextDouble()*(P-z)+z;var k=-N.INITIAL_WORLD_BOUNDARY,K=N.INITIAL_WORLD_BOUNDARY;_=N.WORLD_CENTER_Y+b.nextDouble()*(K-k)+k,this.rect.x=S,this.rect.y=_},x.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var S=this.getChild();if(S.updateBounds(!0),this.rect.x=S.getLeft(),this.rect.y=S.getTop(),this.setWidth(S.getRight()-S.getLeft()),this.setHeight(S.getBottom()-S.getTop()),N.NODE_DIMENSIONS_INCLUDE_LABELS){var _=S.getRight()-S.getLeft(),z=S.getBottom()-S.getTop();this.labelWidth>_&&(this.rect.x-=(this.labelWidth-_)/2,this.setWidth(this.labelWidth)),this.labelHeight>z&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-z)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-z),this.setHeight(this.labelHeight))}}},x.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==I.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},x.prototype.transform=function(S){var _=this.rect.x;_>N.WORLD_BOUNDARY?_=N.WORLD_BOUNDARY:_<-N.WORLD_BOUNDARY&&(_=-N.WORLD_BOUNDARY);var z=this.rect.y;z>N.WORLD_BOUNDARY?z=N.WORLD_BOUNDARY:z<-N.WORLD_BOUNDARY&&(z=-N.WORLD_BOUNDARY);var P=new T(_,z),k=S.inverseTransformPoint(P);this.setLocation(k.x,k.y)},x.prototype.getLeft=function(){return this.rect.x},x.prototype.getRight=function(){return this.rect.x+this.rect.width},x.prototype.getTop=function(){return this.rect.y},x.prototype.getBottom=function(){return this.rect.y+this.rect.height},x.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},Re.exports=x},function(Re,q,ee){"use strict";function A(I,m){null==I&&null==m?(this.x=0,this.y=0):(this.x=I,this.y=m)}A.prototype.getX=function(){return this.x},A.prototype.getY=function(){return this.y},A.prototype.setX=function(I){this.x=I},A.prototype.setY=function(I){this.y=I},A.prototype.getDifference=function(I){return new DimensionD(this.x-I.x,this.y-I.y)},A.prototype.getCopy=function(){return new A(this.x,this.y)},A.prototype.translate=function(I){return this.x+=I.width,this.y+=I.height,this},Re.exports=A},function(Re,q,ee){"use strict";var A=ee(2),I=ee(10),m=ee(0),N=ee(6),b=ee(3),T=ee(1),x=ee(13),R=ee(12),S=ee(11);function _(P,k,K){A.call(this,K),this.estimatedSize=I.MIN_VALUE,this.margin=m.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=P,null!=k&&k instanceof N?this.graphManager=k:null!=k&&k instanceof Layout&&(this.graphManager=k.graphManager)}for(var z in _.prototype=Object.create(A.prototype),A)_[z]=A[z];_.prototype.getNodes=function(){return this.nodes},_.prototype.getEdges=function(){return this.edges},_.prototype.getGraphManager=function(){return this.graphManager},_.prototype.getParent=function(){return this.parent},_.prototype.getLeft=function(){return this.left},_.prototype.getRight=function(){return this.right},_.prototype.getTop=function(){return this.top},_.prototype.getBottom=function(){return this.bottom},_.prototype.isConnected=function(){return this.isConnected},_.prototype.add=function(P,k,K){if(null==k&&null==K){var B=P;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(B)>-1)throw"Node already in graph!";return B.owner=this,this.getNodes().push(B),B}var y=P;if(!(this.getNodes().indexOf(k)>-1&&this.getNodes().indexOf(K)>-1))throw"Source or target not in graph!";if(k.owner!=K.owner||k.owner!=this)throw"Both owners must be this graph!";return k.owner!=K.owner?null:(y.source=k,y.target=K,y.isInterGraph=!1,this.getEdges().push(y),k.edges.push(y),K!=k&&K.edges.push(y),y)},_.prototype.remove=function(P){var k=P;if(P instanceof b){if(null==k)throw"Node is null!";if(null==k.owner||k.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var K=k.edges.slice(),y=K.length,Y=0;Y<y;Y++)(B=K[Y]).isInterGraph?this.graphManager.remove(B):B.source.owner.remove(B);if(-1==(De=this.nodes.indexOf(k)))throw"Node not in owner node list!";this.nodes.splice(De,1)}else if(P instanceof T){var B;if(null==(B=P))throw"Edge is null!";if(null==B.source||null==B.target)throw"Source and/or target is null!";if(null==B.source.owner||null==B.target.owner||B.source.owner!=this||B.target.owner!=this)throw"Source and/or target owner is invalid!";var De,se=B.source.edges.indexOf(B),O=B.target.edges.indexOf(B);if(!(se>-1&&O>-1))throw"Source and/or target doesn't know this edge!";if(B.source.edges.splice(se,1),B.target!=B.source&&B.target.edges.splice(O,1),-1==(De=B.source.owner.getEdges().indexOf(B)))throw"Not in owner's edge list!";B.source.owner.getEdges().splice(De,1)}},_.prototype.updateLeftTop=function(){for(var K,B,y,P=I.MAX_VALUE,k=I.MAX_VALUE,Y=this.getNodes(),De=Y.length,se=0;se<De;se++){var O=Y[se];P>(K=O.getTop())&&(P=K),k>(B=O.getLeft())&&(k=B)}return P==I.MAX_VALUE?null:(y=null!=Y[0].getParent().paddingLeft?Y[0].getParent().paddingLeft:this.margin,this.left=k-y,this.top=P-y,new R(this.left,this.top))},_.prototype.updateBounds=function(P){for(var Y,De,se,O,D,k=I.MAX_VALUE,K=-I.MAX_VALUE,B=I.MAX_VALUE,y=-I.MAX_VALUE,L=this.nodes,F=L.length,re=0;re<F;re++){var ie=L[re];P&&null!=ie.child&&ie.updateBounds(),k>(Y=ie.getLeft())&&(k=Y),K<(De=ie.getRight())&&(K=De),B>(se=ie.getTop())&&(B=se),y<(O=ie.getBottom())&&(y=O)}var U=new x(k,B,K-k,y-B);k==I.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),D=null!=L[0].getParent().paddingLeft?L[0].getParent().paddingLeft:this.margin,this.left=U.x-D,this.right=U.x+U.width+D,this.top=U.y-D,this.bottom=U.y+U.height+D},_.calculateBounds=function(P){for(var Y,De,se,O,k=I.MAX_VALUE,K=-I.MAX_VALUE,B=I.MAX_VALUE,y=-I.MAX_VALUE,D=P.length,L=0;L<D;L++){var F=P[L];k>(Y=F.getLeft())&&(k=Y),K<(De=F.getRight())&&(K=De),B>(se=F.getTop())&&(B=se),y<(O=F.getBottom())&&(y=O)}return new x(k,B,K-k,y-B)},_.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},_.prototype.getEstimatedSize=function(){if(this.estimatedSize==I.MIN_VALUE)throw"assert failed";return this.estimatedSize},_.prototype.calcEstimatedSize=function(){for(var P=0,k=this.nodes,K=k.length,B=0;B<K;B++)P+=k[B].calcEstimatedSize();return this.estimatedSize=0==P?m.EMPTY_COMPOUND_NODE_SIZE:P/Math.sqrt(this.nodes.length),this.estimatedSize},_.prototype.updateConnected=function(){var P=this;if(0!=this.nodes.length){var y,Y,k=new S,K=new Set,B=this.nodes[0];for(B.withChildren().forEach(function(re){k.push(re),K.add(re)});0!==k.length;)for(var se=(y=(B=k.shift()).getEdges()).length,O=0;O<se;O++)null==(Y=y[O].getOtherEndInGraph(B,this))||K.has(Y)||Y.withChildren().forEach(function(re){k.push(re),K.add(re)});if(this.isConnected=!1,K.size>=this.nodes.length){var F=0;K.forEach(function(re){re.owner==P&&F++}),F==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},Re.exports=_},function(Re,q,ee){"use strict";var A,I=ee(1);function m(N){A=ee(5),this.layout=N,this.graphs=[],this.edges=[]}m.prototype.addRoot=function(){var N=this.layout.newGraph(),b=this.layout.newNode(null),T=this.add(N,b);return this.setRootGraph(T),this.rootGraph},m.prototype.add=function(N,b,T,x,R){if(null==T&&null==x&&null==R){if(null==N)throw"Graph is null!";if(null==b)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!=b.child)throw"Already has a child!";return N.parent=b,b.child=N,N}R=T,T=N;var S=(x=b).getOwner(),_=R.getOwner();if(null==S||S.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==_||_.getGraphManager()!=this)throw"Target not in this graph mgr!";if(S==_)return T.isInterGraph=!1,S.add(T,x,R);if(T.isInterGraph=!0,T.source=x,T.target=R,this.edges.indexOf(T)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(T),null==T.source||null==T.target)throw"Edge source and/or target is null!";if(-1!=T.source.edges.indexOf(T)||-1!=T.target.edges.indexOf(T))throw"Edge already in source and/or target incidency list!";return T.source.edges.push(T),T.target.edges.push(T),T},m.prototype.remove=function(N){if(N instanceof A){var b=N;if(b.getGraphManager()!=this)throw"Graph not in this graph mgr";if(b!=this.rootGraph&&(null==b.parent||b.parent.graphManager!=this))throw"Invalid parent node!";for(var x,T=[],R=(T=T.concat(b.getEdges())).length,S=0;S<R;S++)b.remove(x=T[S]);var _=[];for(R=(_=_.concat(b.getNodes())).length,S=0;S<R;S++)b.remove(_[S]);b==this.rootGraph&&this.setRootGraph(null);var P=this.graphs.indexOf(b);this.graphs.splice(P,1),b.parent=null}else if(N instanceof I){if(null==(x=N))throw"Edge is null!";if(!x.isInterGraph)throw"Not an inter-graph edge!";if(null==x.source||null==x.target)throw"Source and/or target is null!";if(-1==x.source.edges.indexOf(x)||-1==x.target.edges.indexOf(x))throw"Source and/or target doesn't know this edge!";if(P=x.source.edges.indexOf(x),x.source.edges.splice(P,1),P=x.target.edges.indexOf(x),x.target.edges.splice(P,1),null==x.source.owner||null==x.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==x.source.owner.getGraphManager().edges.indexOf(x))throw"Not in owner graph manager's edge list!";P=x.source.owner.getGraphManager().edges.indexOf(x),x.source.owner.getGraphManager().edges.splice(P,1)}},m.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},m.prototype.getGraphs=function(){return this.graphs},m.prototype.getAllNodes=function(){if(null==this.allNodes){for(var N=[],b=this.getGraphs(),T=b.length,x=0;x<T;x++)N=N.concat(b[x].getNodes());this.allNodes=N}return this.allNodes},m.prototype.resetAllNodes=function(){this.allNodes=null},m.prototype.resetAllEdges=function(){this.allEdges=null},m.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},m.prototype.getAllEdges=function(){if(null==this.allEdges){for(var N=[],b=this.getGraphs(),x=0;x<b.length;x++)N=N.concat(b[x].getEdges());N=N.concat(this.edges),this.allEdges=N}return this.allEdges},m.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},m.prototype.setAllNodesToApplyGravitation=function(N){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=N},m.prototype.getRoot=function(){return this.rootGraph},m.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"))},m.prototype.getLayout=function(){return this.layout},m.prototype.isOneAncestorOfOther=function(N,b){if(null==N||null==b)throw"assert failed";if(N==b)return!0;for(var x,T=N.getOwner();null!=(x=T.getParent());){if(x==b)return!0;if(null==(T=x.getOwner()))break}for(T=b.getOwner();null!=(x=T.getParent());){if(x==N)return!0;if(null==(T=x.getOwner()))break}return!1},m.prototype.calcLowestCommonAncestors=function(){for(var N,b,T,x,R,S=this.getAllEdges(),_=S.length,z=0;z<_;z++)if(b=(N=S[z]).source,T=N.target,N.lca=null,N.sourceInLca=b,N.targetInLca=T,b!=T){for(x=b.getOwner();null==N.lca;){for(N.targetInLca=T,R=T.getOwner();null==N.lca;){if(R==x){N.lca=R;break}if(R==this.rootGraph)break;if(null!=N.lca)throw"assert failed";N.targetInLca=R.getParent(),R=N.targetInLca.getOwner()}if(x==this.rootGraph)break;null==N.lca&&(N.sourceInLca=x.getParent(),x=N.sourceInLca.getOwner())}if(null==N.lca)throw"assert failed"}else N.lca=b.getOwner()},m.prototype.calcLowestCommonAncestor=function(N,b){if(N==b)return N.getOwner();for(var T=N.getOwner();null!=T;){for(var x=b.getOwner();null!=x;){if(x==T)return x;x=x.getParent().getOwner()}T=T.getParent().getOwner()}return T},m.prototype.calcInclusionTreeDepths=function(N,b){null==N&&null==b&&(N=this.rootGraph,b=1);for(var T,x=N.getNodes(),R=x.length,S=0;S<R;S++)(T=x[S]).inclusionTreeDepth=b,null!=T.child&&this.calcInclusionTreeDepths(T.child,b+1)},m.prototype.includesInvalidEdge=function(){for(var N,b=this.edges.length,T=0;T<b;T++)if(this.isOneAncestorOfOther((N=this.edges[T]).source,N.target))return!0;return!1},Re.exports=m},function(Re,q,ee){"use strict";var A=ee(0);function I(){}for(var m in A)I[m]=A[m];I.MAX_ITERATIONS=2500,I.DEFAULT_EDGE_LENGTH=50,I.DEFAULT_SPRING_STRENGTH=.45,I.DEFAULT_REPULSION_STRENGTH=4500,I.DEFAULT_GRAVITY_STRENGTH=.4,I.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,I.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,I.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,I.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,I.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,I.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,I.COOLING_ADAPTATION_FACTOR=.33,I.ADAPTATION_LOWER_NODE_LIMIT=1e3,I.ADAPTATION_UPPER_NODE_LIMIT=5e3,I.MAX_NODE_DISPLACEMENT=3*(I.MAX_NODE_DISPLACEMENT_INCREMENTAL=100),I.MIN_REPULSION_DIST=I.DEFAULT_EDGE_LENGTH/10,I.CONVERGENCE_CHECK_PERIOD=100,I.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,I.MIN_EDGE_LENGTH=1,I.GRID_CALCULATION_CHECK_PERIOD=10,Re.exports=I},function(Re,q,ee){"use strict";var A=ee(12);function I(){}I.calcSeparationAmount=function(m,N,b,T){if(!m.intersects(N))throw"assert failed";var x=new Array(2);this.decideDirectionsForOverlappingNodes(m,N,x),b[0]=Math.min(m.getRight(),N.getRight())-Math.max(m.x,N.x),b[1]=Math.min(m.getBottom(),N.getBottom())-Math.max(m.y,N.y),m.getX()<=N.getX()&&m.getRight()>=N.getRight()?b[0]+=Math.min(N.getX()-m.getX(),m.getRight()-N.getRight()):N.getX()<=m.getX()&&N.getRight()>=m.getRight()&&(b[0]+=Math.min(m.getX()-N.getX(),N.getRight()-m.getRight())),m.getY()<=N.getY()&&m.getBottom()>=N.getBottom()?b[1]+=Math.min(N.getY()-m.getY(),m.getBottom()-N.getBottom()):N.getY()<=m.getY()&&N.getBottom()>=m.getBottom()&&(b[1]+=Math.min(m.getY()-N.getY(),N.getBottom()-m.getBottom()));var R=Math.abs((N.getCenterY()-m.getCenterY())/(N.getCenterX()-m.getCenterX()));N.getCenterY()===m.getCenterY()&&N.getCenterX()===m.getCenterX()&&(R=1);var S=R*b[0],_=b[1]/R;b[0]<_?_=b[0]:S=b[1],b[0]=-1*x[0]*(_/2+T),b[1]=-1*x[1]*(S/2+T)},I.decideDirectionsForOverlappingNodes=function(m,N,b){b[0]=m.getCenterX()<N.getCenterX()?-1:1,b[1]=m.getCenterY()<N.getCenterY()?-1:1},I.getIntersection2=function(m,N,b){var T=m.getCenterX(),x=m.getCenterY(),R=N.getCenterX(),S=N.getCenterY();if(m.intersects(N))return b[0]=T,b[1]=x,b[2]=R,b[3]=S,!0;var _=m.getX(),z=m.getY(),P=m.getRight(),k=m.getX(),K=m.getBottom(),B=m.getRight(),y=m.getWidthHalf(),Y=m.getHeightHalf(),De=N.getX(),se=N.getY(),O=N.getRight(),D=N.getX(),L=N.getBottom(),F=N.getRight(),re=N.getWidthHalf(),ie=N.getHeightHalf(),U=!1,ne=!1;if(T===R){if(x>S)return b[0]=T,b[1]=z,b[2]=R,b[3]=L,!1;if(x<S)return b[0]=T,b[1]=K,b[2]=R,b[3]=se,!1}else if(x===S){if(T>R)return b[0]=_,b[1]=x,b[2]=O,b[3]=S,!1;if(T<R)return b[0]=P,b[1]=x,b[2]=De,b[3]=S,!1}else{var pe=m.height/m.width,fe=N.height/N.width,be=(S-x)/(R-T),Pe=void 0,he=void 0,ue=void 0,Ee=void 0;if(-pe===be?T>R?(b[0]=k,b[1]=K,U=!0):(b[0]=P,b[1]=z,U=!0):pe===be&&(T>R?(b[0]=_,b[1]=z,U=!0):(b[0]=B,b[1]=K,U=!0)),-fe===be?R>T?(b[2]=D,b[3]=L,ne=!0):(b[2]=O,b[3]=se,ne=!0):fe===be&&(R>T?(b[2]=De,b[3]=se,ne=!0):(b[2]=F,b[3]=L,ne=!0)),U&&ne)return!1;if(T>R?x>S?(Pe=this.getCardinalDirection(pe,be,4),he=this.getCardinalDirection(fe,be,2)):(Pe=this.getCardinalDirection(-pe,be,3),he=this.getCardinalDirection(-fe,be,1)):x>S?(Pe=this.getCardinalDirection(-pe,be,1),he=this.getCardinalDirection(-fe,be,3)):(Pe=this.getCardinalDirection(pe,be,2),he=this.getCardinalDirection(fe,be,4)),!U)switch(Pe){case 1:ue=z,b[0]=T+-Y/be,b[1]=ue;break;case 2:ue=x+y*be,b[0]=B,b[1]=ue;break;case 3:ue=K,b[0]=T+Y/be,b[1]=ue;break;case 4:ue=x+-y*be,b[0]=k,b[1]=ue}if(!ne)switch(he){case 1:Ee=se,b[2]=R+-ie/be,b[3]=Ee;break;case 2:Ee=S+re*be,b[2]=F,b[3]=Ee;break;case 3:Ee=L,b[2]=R+ie/be,b[3]=Ee;break;case 4:Ee=S+-re*be,b[2]=D,b[3]=Ee}}return!1},I.getCardinalDirection=function(m,N,b){return m>N?b:1+b%4},I.getIntersection=function(m,N,b,T){if(null==T)return this.getIntersection2(m,N,b);var Y,De,se,O,D,L,F,x=m.x,R=m.y,S=N.x,_=N.y,z=b.x,P=b.y,k=T.x,K=T.y;return D=S*R-x*_,L=k*P-z*K,0===(F=(Y=_-R)*(O=z-k)-(De=K-P)*(se=x-S))?null:new A((se*L-O*D)/F,(De*D-Y*L)/F)},I.angleOfVector=function(m,N,b,T){var x=void 0;return m!==b?(x=Math.atan((T-N)/(b-m)),b<m?x+=Math.PI:T<N&&(x+=this.TWO_PI)):x=T<N?this.ONE_AND_HALF_PI:this.HALF_PI,x},I.doIntersect=function(m,N,b,T){var x=m.x,R=m.y,S=N.x,_=N.y,z=b.x,P=b.y,k=T.x,K=T.y,B=(S-x)*(K-P)-(k-z)*(_-R);if(0===B)return!1;var y=((K-P)*(k-x)+(z-k)*(K-R))/B,Y=((R-_)*(k-x)+(S-x)*(K-R))/B;return 0<y&&y<1&&0<Y&&Y<1},I.HALF_PI=.5*Math.PI,I.ONE_AND_HALF_PI=1.5*Math.PI,I.TWO_PI=2*Math.PI,I.THREE_PI=3*Math.PI,Re.exports=I},function(Re,q,ee){"use strict";function A(){}A.sign=function(I){return I>0?1:I<0?-1:0},A.floor=function(I){return I<0?Math.ceil(I):Math.floor(I)},A.ceil=function(I){return I<0?Math.floor(I):Math.ceil(I)},Re.exports=A},function(Re,q,ee){"use strict";function A(){}A.MAX_VALUE=2147483647,A.MIN_VALUE=-2147483648,Re.exports=A},function(Re,q,ee){"use strict";var A=function(){function x(R,S){for(var _=0;_<S.length;_++){var z=S[_];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(R,z.key,z)}}return function(R,S,_){return S&&x(R.prototype,S),_&&x(R,_),R}}();var m=function(R){return{value:R,next:null,prev:null}},N=function(R,S,_,z){return null!==R?R.next=S:z.head=S,null!==_?_.prev=S:z.tail=S,S.prev=R,S.next=_,z.length++,S},b=function(R,S){var _=R.prev,z=R.next;return null!==_?_.next=z:S.head=z,null!==z?z.prev=_:S.tail=_,R.prev=R.next=null,S.length--,R},T=function(){function x(R){var S=this;(function I(x,R){if(!(x instanceof R))throw new TypeError("Cannot call a class as a function")})(this,x),this.length=0,this.head=null,this.tail=null,R?.forEach(function(_){return S.push(_)})}return A(x,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(S,_){return N(_.prev,m(S),_,this)}},{key:"insertAfter",value:function(S,_){return N(_,m(S),_.next,this)}},{key:"insertNodeBefore",value:function(S,_){return N(_.prev,S,_,this)}},{key:"insertNodeAfter",value:function(S,_){return N(_,S,_.next,this)}},{key:"push",value:function(S){return N(this.tail,m(S),null,this)}},{key:"unshift",value:function(S){return N(null,m(S),this.head,this)}},{key:"remove",value:function(S){return b(S,this)}},{key:"pop",value:function(){return b(this.tail,this).value}},{key:"popNode",value:function(){return b(this.tail,this)}},{key:"shift",value:function(){return b(this.head,this).value}},{key:"shiftNode",value:function(){return b(this.head,this)}},{key:"get_object_at",value:function(S){if(S<=this.length()){for(var _=1,z=this.head;_<S;)z=z.next,_++;return z.value}}},{key:"set_object_at",value:function(S,_){if(S<=this.length()){for(var z=1,P=this.head;z<S;)P=P.next,z++;P.value=_}}}]),x}();Re.exports=T},function(Re,q,ee){"use strict";function A(I,m,N){this.x=null,this.y=null,null==I&&null==m&&null==N?(this.x=0,this.y=0):"number"==typeof I&&"number"==typeof m&&null==N?(this.x=I,this.y=m):"Point"==I.constructor.name&&null==m&&null==N&&(this.x=(N=I).x,this.y=N.y)}A.prototype.getX=function(){return this.x},A.prototype.getY=function(){return this.y},A.prototype.getLocation=function(){return new A(this.x,this.y)},A.prototype.setLocation=function(I,m,N){"Point"==I.constructor.name&&null==m&&null==N?this.setLocation((N=I).x,N.y):"number"==typeof I&&"number"==typeof m&&null==N&&(parseInt(I)==I&&parseInt(m)==m?this.move(I,m):(this.x=Math.floor(I+.5),this.y=Math.floor(m+.5)))},A.prototype.move=function(I,m){this.x=I,this.y=m},A.prototype.translate=function(I,m){this.x+=I,this.y+=m},A.prototype.equals=function(I){return"Point"==I.constructor.name?this.x==I.x&&this.y==I.y:this==I},A.prototype.toString=function(){return(new A).constructor.name+"[x="+this.x+",y="+this.y+"]"},Re.exports=A},function(Re,q,ee){"use strict";function A(I,m,N,b){this.x=0,this.y=0,this.width=0,this.height=0,null!=I&&null!=m&&null!=N&&null!=b&&(this.x=I,this.y=m,this.width=N,this.height=b)}A.prototype.getX=function(){return this.x},A.prototype.setX=function(I){this.x=I},A.prototype.getY=function(){return this.y},A.prototype.setY=function(I){this.y=I},A.prototype.getWidth=function(){return this.width},A.prototype.setWidth=function(I){this.width=I},A.prototype.getHeight=function(){return this.height},A.prototype.setHeight=function(I){this.height=I},A.prototype.getRight=function(){return this.x+this.width},A.prototype.getBottom=function(){return this.y+this.height},A.prototype.intersects=function(I){return!(this.getRight()<I.x||this.getBottom()<I.y||I.getRight()<this.x||I.getBottom()<this.y)},A.prototype.getCenterX=function(){return this.x+this.width/2},A.prototype.getMinX=function(){return this.getX()},A.prototype.getMaxX=function(){return this.getX()+this.width},A.prototype.getCenterY=function(){return this.y+this.height/2},A.prototype.getMinY=function(){return this.getY()},A.prototype.getMaxY=function(){return this.getY()+this.height},A.prototype.getWidthHalf=function(){return this.width/2},A.prototype.getHeightHalf=function(){return this.height/2},Re.exports=A},function(Re,q,ee){"use strict";var A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(m){return typeof m}:function(m){return m&&"function"==typeof Symbol&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m};function I(){}I.lastID=0,I.createID=function(m){return I.isPrimitive(m)?m:(null!=m.uniqueID||(m.uniqueID=I.getString(),I.lastID++),m.uniqueID)},I.getString=function(m){return null==m&&(m=I.lastID),"Object#"+m},I.isPrimitive=function(m){var N=typeof m>"u"?"undefined":A(m);return null==m||"object"!=N&&"function"!=N},Re.exports=I},function(Re,q,ee){"use strict";function A(z){if(Array.isArray(z)){for(var P=0,k=Array(z.length);P<z.length;P++)k[P]=z[P];return k}return Array.from(z)}var I=ee(0),m=ee(6),N=ee(3),b=ee(1),T=ee(5),x=ee(4),R=ee(17),S=ee(27);function _(z){S.call(this),this.layoutQuality=I.QUALITY,this.createBendsAsNeeded=I.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=I.DEFAULT_INCREMENTAL,this.animationOnLayout=I.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=I.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=I.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=I.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new m(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=z&&(this.isRemoteUse=z)}_.RANDOM_SEED=1,(_.prototype=Object.create(S.prototype)).getGraphManager=function(){return this.graphManager},_.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},_.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},_.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},_.prototype.newGraphManager=function(){var z=new m(this);return this.graphManager=z,z},_.prototype.newGraph=function(z){return new T(null,this.graphManager,z)},_.prototype.newNode=function(z){return new N(this.graphManager,z)},_.prototype.newEdge=function(z){return new b(null,null,z)},_.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},_.prototype.runLayout=function(){var z;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),z=!this.checkLayoutSuccess()&&this.layout(),"during"!==I.ANIMATE&&(z&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,z)},_.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},_.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var P=this.graphManager.getAllEdges(),k=0;k<P.length;k++);var B=this.graphManager.getRoot().getNodes();for(k=0;k<B.length;k++);this.update(this.graphManager.getRoot())}},_.prototype.update=function(z){if(null==z)this.update2();else if(z instanceof N){var P=z;if(null!=P.getChild())for(var k=P.getChild().getNodes(),K=0;K<k.length;K++)update(k[K]);null!=P.vGraphObject&&P.vGraphObject.update(P)}else z instanceof b?null!=z.vGraphObject&&z.vGraphObject.update(z):z instanceof T&&null!=z.vGraphObject&&z.vGraphObject.update(z)},_.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=I.QUALITY,this.animationDuringLayout=I.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=I.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=I.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=I.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=I.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=I.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},_.prototype.transform=function(z){if(null==z)this.transform(new x(0,0));else{var P=new R,k=this.graphManager.getRoot().updateLeftTop();if(null!=k){P.setWorldOrgX(z.x),P.setWorldOrgY(z.y),P.setDeviceOrgX(k.x),P.setDeviceOrgY(k.y);for(var K=this.getAllNodes(),y=0;y<K.length;y++)K[y].transform(P)}}},_.prototype.positionNodesRandomly=function(z){if(null==z)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var P,k,K=z.getNodes(),B=0;B<K.length;B++)null==(k=(P=K[B]).getChild())||0==k.getNodes().length?P.scatter():(this.positionNodesRandomly(k),P.updateBounds())},_.prototype.getFlatForest=function(){for(var z=[],P=!0,k=this.graphManager.getRoot().getNodes(),K=!0,B=0;B<k.length;B++)null!=k[B].getChild()&&(K=!1);if(!K)return z;var y=new Set,Y=[],De=new Map,se=[];for(se=se.concat(k);se.length>0&&P;){for(Y.push(se[0]);Y.length>0&&P;){var O=Y[0];Y.splice(0,1),y.add(O);var D=O.getEdges();for(B=0;B<D.length;B++){var L=D[B].getOtherEnd(O);if(De.get(O)!=L){if(y.has(L)){P=!1;break}Y.push(L),De.set(L,O)}}}if(P){var F=[].concat(A(y));for(z.push(F),B=0;B<F.length;B++){var ie=se.indexOf(F[B]);ie>-1&&se.splice(ie,1)}y=new Set,De=new Map}else z=[]}return z},_.prototype.createDummyNodesForBendpoints=function(z){for(var P=[],k=z.source,K=this.graphManager.calcLowestCommonAncestor(z.source,z.target),B=0;B<z.bendpoints.length;B++){var y=this.newNode(null);y.setRect(new Point(0,0),new Dimension(1,1)),K.add(y);var Y=this.newEdge(null);this.graphManager.add(Y,k,y),P.add(y),k=y}return Y=this.newEdge(null),this.graphManager.add(Y,k,z.target),this.edgeToDummyNodes.set(z,P),z.isInterGraph()?this.graphManager.remove(z):K.remove(z),P},_.prototype.createBendpointsFromDummyNodes=function(){var z=[];z=z.concat(this.graphManager.getAllEdges()),z=[].concat(A(this.edgeToDummyNodes.keys())).concat(z);for(var P=0;P<z.length;P++){var k=z[P];if(k.bendpoints.length>0){for(var K=this.edgeToDummyNodes.get(k),B=0;B<K.length;B++){var y=K[B],Y=new x(y.getCenterX(),y.getCenterY()),De=k.bendpoints.get(B);De.x=Y.x,De.y=Y.y,y.getOwner().remove(y)}this.graphManager.add(k,k.source,k.target)}}},_.transform=function(z,P,k,K){if(null!=k&&null!=K){var B=P;return z<=50?B-=(P-P/k)/50*(50-z):B+=(P*K-P)/50*(z-50),B}var De,se;return z<=50?(De=9*P/500,se=P/10):(De=9*P/50,se=-8*P),De*z+se},_.findCenterOfTree=function(z){var P=[];P=P.concat(z);var k=[],K=new Map,B=!1,y=null;(1==P.length||2==P.length)&&(B=!0,y=P[0]);for(var Y=0;Y<P.length;Y++){var se=(De=P[Y]).getNeighborsList().size;K.set(De,De.getNeighborsList().size),1==se&&k.push(De)}var O=[];for(O=O.concat(k);!B;){var D=[];for(D=D.concat(O),O=[],Y=0;Y<P.length;Y++){var De,L=P.indexOf(De=P[Y]);L>=0&&P.splice(L,1),De.getNeighborsList().forEach(function(U){if(k.indexOf(U)<0){var pe=K.get(U)-1;1==pe&&O.push(U),K.set(U,pe)}})}k=k.concat(O),(1==P.length||2==P.length)&&(B=!0,y=P[0])}return y},_.prototype.setGraphManager=function(z){this.graphManager=z},Re.exports=_},function(Re,q,ee){"use strict";function A(){}A.seed=1,A.x=0,A.nextDouble=function(){return(A.x=1e4*Math.sin(A.seed++))-Math.floor(A.x)},Re.exports=A},function(Re,q,ee){"use strict";var A=ee(4);function I(m,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}I.prototype.getWorldOrgX=function(){return this.lworldOrgX},I.prototype.setWorldOrgX=function(m){this.lworldOrgX=m},I.prototype.getWorldOrgY=function(){return this.lworldOrgY},I.prototype.setWorldOrgY=function(m){this.lworldOrgY=m},I.prototype.getWorldExtX=function(){return this.lworldExtX},I.prototype.setWorldExtX=function(m){this.lworldExtX=m},I.prototype.getWorldExtY=function(){return this.lworldExtY},I.prototype.setWorldExtY=function(m){this.lworldExtY=m},I.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},I.prototype.setDeviceOrgX=function(m){this.ldeviceOrgX=m},I.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},I.prototype.setDeviceOrgY=function(m){this.ldeviceOrgY=m},I.prototype.getDeviceExtX=function(){return this.ldeviceExtX},I.prototype.setDeviceExtX=function(m){this.ldeviceExtX=m},I.prototype.getDeviceExtY=function(){return this.ldeviceExtY},I.prototype.setDeviceExtY=function(m){this.ldeviceExtY=m},I.prototype.transformX=function(m){var N=0,b=this.lworldExtX;return 0!=b&&(N=this.ldeviceOrgX+(m-this.lworldOrgX)*this.ldeviceExtX/b),N},I.prototype.transformY=function(m){var N=0,b=this.lworldExtY;return 0!=b&&(N=this.ldeviceOrgY+(m-this.lworldOrgY)*this.ldeviceExtY/b),N},I.prototype.inverseTransformX=function(m){var N=0,b=this.ldeviceExtX;return 0!=b&&(N=this.lworldOrgX+(m-this.ldeviceOrgX)*this.lworldExtX/b),N},I.prototype.inverseTransformY=function(m){var N=0,b=this.ldeviceExtY;return 0!=b&&(N=this.lworldOrgY+(m-this.ldeviceOrgY)*this.lworldExtY/b),N},I.prototype.inverseTransformPoint=function(m){return new A(this.inverseTransformX(m.x),this.inverseTransformY(m.y))},Re.exports=I},function(Re,q,ee){"use strict";var I=ee(15),m=ee(7),N=ee(0),b=ee(8),T=ee(9);function x(){I.call(this),this.useSmartIdealEdgeLengthCalculation=m.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=m.DEFAULT_EDGE_LENGTH,this.springConstant=m.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=m.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=m.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=m.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=m.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*m.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=m.MAX_ITERATIONS}for(var R in x.prototype=Object.create(I.prototype),I)x[R]=I[R];x.prototype.initParameters=function(){I.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=m.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},x.prototype.calcIdealEdgeLengths=function(){for(var S,_,z,P,k,K,B=this.getGraphManager().getAllEdges(),y=0;y<B.length;y++)(S=B[y]).idealLength=this.idealEdgeLength,S.isInterGraph&&(z=S.getSource(),P=S.getTarget(),k=S.getSourceInLca().getEstimatedSize(),K=S.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(S.idealLength+=k+K-2*N.SIMPLE_NODE_SIZE),_=S.getLca().getInclusionTreeDepth(),S.idealLength+=m.DEFAULT_EDGE_LENGTH*m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(z.getInclusionTreeDepth()+P.getInclusionTreeDepth()-2*_))},x.prototype.initSpringEmbedder=function(){var S=this.getAllNodes().length;this.incremental?(S>m.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*m.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(S-m.ADAPTATION_LOWER_NODE_LIMIT)/(m.ADAPTATION_UPPER_NODE_LIMIT-m.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-m.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=m.MAX_NODE_DISPLACEMENT_INCREMENTAL):(this.coolingFactor=S>m.ADAPTATION_LOWER_NODE_LIMIT?Math.max(m.COOLING_ADAPTATION_FACTOR,1-(S-m.ADAPTATION_LOWER_NODE_LIMIT)/(m.ADAPTATION_UPPER_NODE_LIMIT-m.ADAPTATION_LOWER_NODE_LIMIT)*(1-m.COOLING_ADAPTATION_FACTOR)):1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=m.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},x.prototype.calcSpringForces=function(){for(var _,S=this.getAllEdges(),z=0;z<S.length;z++)this.calcSpringForce(_=S[z],_.idealLength)},x.prototype.calcRepulsionForces=function(){var z,P,k,K,y,S=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],_=arguments.length>1&&void 0!==arguments[1]&&arguments[1],B=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%m.GRID_CALCULATION_CHECK_PERIOD==1&&S&&this.updateGrid(),y=new Set,z=0;z<B.length;z++)this.calculateRepulsionForceOfANode(k=B[z],y,S,_),y.add(k);else for(z=0;z<B.length;z++)for(k=B[z],P=z+1;P<B.length;P++)K=B[P],k.getOwner()==K.getOwner()&&this.calcRepulsionForce(k,K)},x.prototype.calcGravitationalForces=function(){for(var _=this.getAllNodesToApplyGravitation(),z=0;z<_.length;z++)this.calcGravitationalForce(_[z])},x.prototype.moveNodes=function(){for(var S=this.getAllNodes(),z=0;z<S.length;z++)S[z].move()},x.prototype.calcSpringForce=function(S,_){var k,K,B,y,z=S.getSource(),P=S.getTarget();if(this.uniformLeafNodeSizes&&null==z.getChild()&&null==P.getChild())S.updateLengthSimple();else if(S.updateLength(),S.isOverlapingSourceAndTarget)return;0!=(k=S.getLength())&&(y=(K=this.springConstant*(k-_))*(S.lengthY/k),z.springForceX+=B=K*(S.lengthX/k),z.springForceY+=y,P.springForceX-=B,P.springForceY-=y)},x.prototype.calcRepulsionForce=function(S,_){var B,y,Y,De,se,O,D,z=S.getRect(),P=_.getRect(),k=new Array(2),K=new Array(4);if(z.intersects(P)){b.calcSeparationAmount(z,P,k,m.DEFAULT_EDGE_LENGTH/2),D=2*k[1];var L=S.noOfChildren*_.noOfChildren/(S.noOfChildren+_.noOfChildren);S.repulsionForceX-=L*(O=2*k[0]),S.repulsionForceY-=L*D,_.repulsionForceX+=L*O,_.repulsionForceY+=L*D}else this.uniformLeafNodeSizes&&null==S.getChild()&&null==_.getChild()?(B=P.getCenterX()-z.getCenterX(),y=P.getCenterY()-z.getCenterY()):(b.getIntersection(z,P,K),B=K[2]-K[0],y=K[3]-K[1]),Math.abs(B)<m.MIN_REPULSION_DIST&&(B=T.sign(B)*m.MIN_REPULSION_DIST),Math.abs(y)<m.MIN_REPULSION_DIST&&(y=T.sign(y)*m.MIN_REPULSION_DIST),Y=B*B+y*y,De=Math.sqrt(Y),D=(se=this.repulsionConstant*S.noOfChildren*_.noOfChildren/Y)*y/De,S.repulsionForceX-=O=se*B/De,S.repulsionForceY-=D,_.repulsionForceX+=O,_.repulsionForceY+=D},x.prototype.calcGravitationalForce=function(S){var _,z,P,k,K,B,y,Y;z=((_=S.getOwner()).getRight()+_.getLeft())/2,P=(_.getTop()+_.getBottom())/2,k=S.getCenterX()-z,K=S.getCenterY()-P,B=Math.abs(k)+S.getWidth()/2,y=Math.abs(K)+S.getHeight()/2,S.getOwner()==this.graphManager.getRoot()?(B>(Y=_.getEstimatedSize()*this.gravityRangeFactor)||y>Y)&&(S.gravitationForceX=-this.gravityConstant*k,S.gravitationForceY=-this.gravityConstant*K):(B>(Y=_.getEstimatedSize()*this.compoundGravityRangeFactor)||y>Y)&&(S.gravitationForceX=-this.gravityConstant*k*this.compoundGravityConstant,S.gravitationForceY=-this.gravityConstant*K*this.compoundGravityConstant)},x.prototype.isConverged=function(){var S,_=!1;return this.totalIterations>this.maxIterations/3&&(_=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),S=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,S||_},x.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},x.prototype.calcNoOfChildrenForAllNodes=function(){for(var S,_=this.graphManager.getAllNodes(),z=0;z<_.length;z++)(S=_[z]).noOfChildren=S.getNoOfChildren()},x.prototype.calcGrid=function(S){var _,z;_=parseInt(Math.ceil((S.getRight()-S.getLeft())/this.repulsionRange)),z=parseInt(Math.ceil((S.getBottom()-S.getTop())/this.repulsionRange));for(var P=new Array(_),k=0;k<_;k++)P[k]=new Array(z);for(k=0;k<_;k++)for(var K=0;K<z;K++)P[k][K]=new Array;return P},x.prototype.addNodeToGrid=function(S,_,z){var P,k,K,B;P=parseInt(Math.floor((S.getRect().x-_)/this.repulsionRange)),k=parseInt(Math.floor((S.getRect().width+S.getRect().x-_)/this.repulsionRange)),K=parseInt(Math.floor((S.getRect().y-z)/this.repulsionRange)),B=parseInt(Math.floor((S.getRect().height+S.getRect().y-z)/this.repulsionRange));for(var y=P;y<=k;y++)for(var Y=K;Y<=B;Y++)this.grid[y][Y].push(S),S.setGridCoordinates(P,k,K,B)},x.prototype.updateGrid=function(){var S,z=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),S=0;S<z.length;S++)this.addNodeToGrid(z[S],this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},x.prototype.calculateRepulsionForceOfANode=function(S,_,z,P){if(this.totalIterations%m.GRID_CALCULATION_CHECK_PERIOD==1&&z||P){var k=new Set;S.surrounding=new Array;for(var K,B=this.grid,y=S.startX-1;y<S.finishX+2;y++)for(var Y=S.startY-1;Y<S.finishY+2;Y++)if(!(y<0||Y<0||y>=B.length||Y>=B[0].length))for(var De=0;De<B[y][Y].length;De++)if(K=B[y][Y][De],S.getOwner()==K.getOwner()&&S!=K&&!_.has(K)&&!k.has(K)){var se=Math.abs(S.getCenterX()-K.getCenterX())-(S.getWidth()/2+K.getWidth()/2),O=Math.abs(S.getCenterY()-K.getCenterY())-(S.getHeight()/2+K.getHeight()/2);se<=this.repulsionRange&&O<=this.repulsionRange&&k.add(K)}S.surrounding=[].concat(function A(S){if(Array.isArray(S)){for(var _=0,z=Array(S.length);_<S.length;_++)z[_]=S[_];return z}return Array.from(S)}(k))}for(y=0;y<S.surrounding.length;y++)this.calcRepulsionForce(S,S.surrounding[y])},x.prototype.calcRepulsionRange=function(){return 0},Re.exports=x},function(Re,q,ee){"use strict";var A=ee(1),I=ee(7);function m(b,T,x){A.call(this,b,T,x),this.idealLength=I.DEFAULT_EDGE_LENGTH}for(var N in m.prototype=Object.create(A.prototype),A)m[N]=A[N];Re.exports=m},function(Re,q,ee){"use strict";var A=ee(3);function I(N,b,T,x){A.call(this,N,b,T,x),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 m in I.prototype=Object.create(A.prototype),A)I[m]=A[m];I.prototype.setGridCoordinates=function(N,b,T,x){this.startX=N,this.finishX=b,this.startY=T,this.finishY=x},Re.exports=I},function(Re,q,ee){"use strict";function A(I,m){this.width=0,this.height=0,null!==I&&null!==m&&(this.height=m,this.width=I)}A.prototype.getWidth=function(){return this.width},A.prototype.setWidth=function(I){this.width=I},A.prototype.getHeight=function(){return this.height},A.prototype.setHeight=function(I){this.height=I},Re.exports=A},function(Re,q,ee){"use strict";var A=ee(14);function I(){this.map={},this.keys=[]}I.prototype.put=function(m,N){var b=A.createID(m);this.contains(b)||(this.map[b]=N,this.keys.push(m))},I.prototype.contains=function(m){return A.createID(m),null!=this.map[m]},I.prototype.get=function(m){var N=A.createID(m);return this.map[N]},I.prototype.keySet=function(){return this.keys},Re.exports=I},function(Re,q,ee){"use strict";var A=ee(14);function I(){this.set={}}I.prototype.add=function(m){var N=A.createID(m);this.contains(N)||(this.set[N]=m)},I.prototype.remove=function(m){delete this.set[A.createID(m)]},I.prototype.clear=function(){this.set={}},I.prototype.contains=function(m){return this.set[A.createID(m)]==m},I.prototype.isEmpty=function(){return 0===this.size()},I.prototype.size=function(){return Object.keys(this.set).length},I.prototype.addAllTo=function(m){for(var N=Object.keys(this.set),b=N.length,T=0;T<b;T++)m.push(this.set[N[T]])},I.prototype.size=function(){return Object.keys(this.set).length},I.prototype.addAll=function(m){for(var N=m.length,b=0;b<N;b++)this.add(m[b])},Re.exports=I},function(Re,q,ee){"use strict";var A=function(){function b(T,x){for(var R=0;R<x.length;R++){var S=x[R];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}return function(T,x,R){return x&&b(T.prototype,x),R&&b(T,R),T}}();var m=ee(11),N=function(){function b(T,x){(function I(b,T){if(!(b instanceof T))throw new TypeError("Cannot call a class as a function")})(this,b),(null!==x||void 0!==x)&&(this.compareFunction=this._defaultCompareFunction);var R;R=T instanceof m?T.size():T.length,this._quicksort(T,0,R-1)}return A(b,[{key:"_quicksort",value:function(x,R,S){if(R<S){var _=this._partition(x,R,S);this._quicksort(x,R,_),this._quicksort(x,_+1,S)}}},{key:"_partition",value:function(x,R,S){for(var _=this._get(x,R),z=R,P=S;;){for(;this.compareFunction(_,this._get(x,P));)P--;for(;this.compareFunction(this._get(x,z),_);)z++;if(!(z<P))return P;this._swap(x,z,P),z++,P--}}},{key:"_get",value:function(x,R){return x instanceof m?x.get_object_at(R):x[R]}},{key:"_set",value:function(x,R,S){x instanceof m?x.set_object_at(R,S):x[R]=S}},{key:"_swap",value:function(x,R,S){var _=this._get(x,R);this._set(x,R,this._get(x,S)),this._set(x,S,_)}},{key:"_defaultCompareFunction",value:function(x,R){return R>x}}]),b}();Re.exports=N},function(Re,q,ee){"use strict";var A=function(){function N(b,T){for(var x=0;x<T.length;x++){var R=T[x];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(b,R.key,R)}}return function(b,T,x){return T&&N(b.prototype,T),x&&N(b,x),b}}();var m=function(){function N(b,T){var x=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,R=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,S=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;(function I(N,b){if(!(N instanceof b))throw new TypeError("Cannot call a class as a function")})(this,N),this.sequence1=b,this.sequence2=T,this.match_score=x,this.mismatch_penalty=R,this.gap_penalty=S,this.iMax=b.length+1,this.jMax=T.length+1,this.grid=new Array(this.iMax);for(var _=0;_<this.iMax;_++){this.grid[_]=new Array(this.jMax);for(var z=0;z<this.jMax;z++)this.grid[_][z]=0}this.tracebackGrid=new Array(this.iMax);for(var P=0;P<this.iMax;P++){this.tracebackGrid[P]=new Array(this.jMax);for(var k=0;k<this.jMax;k++)this.tracebackGrid[P][k]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return A(N,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var T=1;T<this.jMax;T++)this.grid[0][T]=this.grid[0][T-1]+this.gap_penalty,this.tracebackGrid[0][T]=[!1,!1,!0];for(var x=1;x<this.iMax;x++)this.grid[x][0]=this.grid[x-1][0]+this.gap_penalty,this.tracebackGrid[x][0]=[!1,!0,!1];for(var R=1;R<this.iMax;R++)for(var S=1;S<this.jMax;S++){var k=[this.sequence1[R-1]===this.sequence2[S-1]?this.grid[R-1][S-1]+this.match_score:this.grid[R-1][S-1]+this.mismatch_penalty,this.grid[R-1][S]+this.gap_penalty,this.grid[R][S-1]+this.gap_penalty],K=this.arrayAllMaxIndexes(k);this.grid[R][S]=k[K[0]],this.tracebackGrid[R][S]=[K.includes(0),K.includes(1),K.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var T=[];for(T.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});T[0];){var x=T[0],R=this.tracebackGrid[x.pos[0]][x.pos[1]];R[0]&&T.push({pos:[x.pos[0]-1,x.pos[1]-1],seq1:this.sequence1[x.pos[0]-1]+x.seq1,seq2:this.sequence2[x.pos[1]-1]+x.seq2}),R[1]&&T.push({pos:[x.pos[0]-1,x.pos[1]],seq1:this.sequence1[x.pos[0]-1]+x.seq1,seq2:"-"+x.seq2}),R[2]&&T.push({pos:[x.pos[0],x.pos[1]-1],seq1:"-"+x.seq1,seq2:this.sequence2[x.pos[1]-1]+x.seq2}),0===x.pos[0]&&0===x.pos[1]&&this.alignments.push({sequence1:x.seq1,sequence2:x.seq2}),T.shift()}return this.alignments}},{key:"getAllIndexes",value:function(T,x){for(var R=[],S=-1;-1!==(S=T.indexOf(x,S+1));)R.push(S);return R}},{key:"arrayAllMaxIndexes",value:function(T){return this.getAllIndexes(T,Math.max.apply(null,T))}}]),N}();Re.exports=m},function(Re,q,ee){"use strict";var A=function(){};A.FDLayout=ee(18),A.FDLayoutConstants=ee(7),A.FDLayoutEdge=ee(19),A.FDLayoutNode=ee(20),A.DimensionD=ee(21),A.HashMap=ee(22),A.HashSet=ee(23),A.IGeometry=ee(8),A.IMath=ee(9),A.Integer=ee(10),A.Point=ee(12),A.PointD=ee(4),A.RandomSeed=ee(16),A.RectangleD=ee(13),A.Transform=ee(17),A.UniqueIDGeneretor=ee(14),A.Quicksort=ee(24),A.LinkedList=ee(11),A.LGraphObject=ee(2),A.LGraph=ee(5),A.LEdge=ee(1),A.LGraphManager=ee(6),A.LNode=ee(3),A.Layout=ee(15),A.LayoutConstants=ee(0),A.NeedlemanWunsch=ee(25),Re.exports=A},function(Re,q,ee){"use strict";function A(){this.listeners=[]}var I=A.prototype;I.addListener=function(m,N){this.listeners.push({event:m,callback:N})},I.removeListener=function(m,N){for(var b=this.listeners.length;b>=0;b--){var T=this.listeners[b];T.event===m&&T.callback===N&&this.listeners.splice(b,1)}},I.emit=function(m,N){for(var b=0;b<this.listeners.length;b++){var T=this.listeners[b];m===T.event&&T.callback(N)}},Re.exports=A}])},1224(Ke,Re,q){Ke.exports=q(4548)},250(Ke){"use strict";Ke.exports=class th{constructor(q,ee=new Map,A=0){this.prefix=q,this._existing=ee,this.counter=A}clone(){const{prefix:q,_existing:ee,counter:A}=this;return new th(q,new Map(ee),A)}getId(q){const ee=q&&this._existing.get(q);if(ee)return ee;const A=this.prefix+this.counter;return this.counter++,q&&this._existing.set(q,A),A}hasId(q){return this._existing.has(q)}getOldIds(){return[...this._existing.keys()]}}},1126(Ke,Re,q){"use strict";var ee=q(9293).default;q(7140);const A=self.crypto||self.msCrypto;Ke.exports=class{constructor(m){if(!A||!A.subtle)throw new Error("crypto.subtle not found.");if("sha256"===m)this.algorithm={name:"SHA-256"};else{if("sha1"!==m)throw new Error(`Unsupported algorithm "${m}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(m){this._content+=m}digest(){var m=this;return ee(function*(){const N=(new TextEncoder).encode(m._content),b=new Uint8Array(yield A.subtle.digest(m.algorithm,N));let T="";for(let x=0;x<b.length;++x)T+=b[x].toString(16).padStart(2,"0");return T})()}}},8276(Ke){"use strict";const ee="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",A="http://www.w3.org/2001/XMLSchema#string",I="NamedNode",m="BlankNode",N="Literal",b="DefaultGraph",T={};function x(P,k){return P.subject.termType===k.subject.termType&&P.object.termType===k.object.termType&&P.subject.value===k.subject.value&&P.predicate.value===k.predicate.value&&P.object.value===k.object.value&&(P.object.termType!==N||P.object.datatype.termType===k.object.datatype.termType&&P.object.language===k.object.language&&P.object.datatype.value===k.object.datatype.value)}(()=>{const P="(?:<([^:]+:[^>]*)>)",K="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_",B=K+"0-9-\xb7\u0300-\u036f\u203f-\u2040",Y="(_:(?:["+K+"0-9])(?:(?:["+B+".])*(?:["+B+"]))?)",L="[ \\t]+",F="[ \\t]*",re="(?:"+P+"|"+Y+")"+L,ie=P+L,U="(?:"+P+"|"+Y+'|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^'+P+")|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))"+F,ne="(?:\\.|(?:(?:"+P+"|"+Y+")"+F+"\\.))";T.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,T.empty=new RegExp("^"+F+"$"),T.quad=new RegExp("^"+F+re+ie+U+ne+F+"$")})(),Ke.exports=class es{static parse(k){const K=[],B={},y=k.split(T.eoln);let Y=0;for(const De of y){if(Y++,T.empty.test(De))continue;const se=De.match(T.quad);if(null===se)throw new Error("N-Quads parse error on line "+Y+".");const O={subject:null,predicate:null,object:null,graph:null};if(O.subject=void 0!==se[1]?{termType:I,value:se[1]}:{termType:m,value:se[2]},O.predicate={termType:I,value:se[3]},void 0!==se[4]?O.object={termType:I,value:se[4]}:void 0!==se[5]?O.object={termType:m,value:se[5]}:(O.object={termType:N,value:void 0,datatype:{termType:I}},void 0!==se[7]?O.object.datatype.value=se[7]:void 0!==se[8]?(O.object.datatype.value=ee,O.object.language=se[8]):O.object.datatype.value=A,O.object.value=z(se[6])),O.graph=void 0!==se[9]?{termType:I,value:se[9]}:void 0!==se[10]?{termType:m,value:se[10]}:{termType:b,value:""},O.graph.value in B){let D=!0;const L=B[O.graph.value];for(const F of L)if(x(F,O)){D=!1;break}D&&(L.push(O),K.push(O))}else B[O.graph.value]=[O],K.push(O)}return K}static serialize(k){Array.isArray(k)||(k=es.legacyDatasetToQuads(k));const K=[];for(const B of k)K.push(es.serializeQuad(B));return K.sort().join("")}static serializeQuadComponents(k,K,B,y){let Y="";return Y+=k.termType===I?`<${k.value}>`:`${k.value}`,Y+=` <${K.value}> `,B.termType===I?Y+=`<${B.value}>`:B.termType===m?Y+=B.value:(Y+=`"${function S(P){return P.replace(R,function(k){switch(k){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}})}(B.value)}"`,B.datatype.value===ee?B.language&&(Y+=`@${B.language}`):B.datatype.value!==A&&(Y+=`^^<${B.datatype.value}>`)),y.termType===I?Y+=` <${y.value}>`:y.termType===m&&(Y+=` ${y.value}`),Y+=" .\n",Y}static serializeQuad(k){return es.serializeQuadComponents(k.subject,k.predicate,k.object,k.graph)}static legacyDatasetToQuads(k){const K=[],B={"blank node":m,IRI:I,literal:N};for(const y in k)k[y].forEach(De=>{const se={};for(const O in De){const D=De[O],L={termType:B[D.type],value:D.value};L.termType===N&&(L.datatype={termType:I},"datatype"in D&&(L.datatype.value=D.datatype),"language"in D?("datatype"in D||(L.datatype.value=ee),L.language=D.language):"datatype"in D||(L.datatype.value=A)),se[O]=L}se.graph="@default"===y?{termType:b,value:""}:{termType:y.startsWith("_:")?m:I,value:y},K.push(se)});return K}};const R=/["\\\n\r]/g,_=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function z(P){return P.replace(_,function(k,K,B,y){if(K)switch(K){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(B)return String.fromCharCode(parseInt(B,16));if(y)throw new Error("Unsupported U escape")})}},7794(Ke){"use strict";Ke.exports=class{constructor(q){this.current=q.sort(),this.done=!1,this.dir=new Map;for(let ee=0;ee<q.length;++ee)this.dir.set(q[ee],!0)}hasNext(){return!this.done}next(){const{current:q,dir:ee}=this,A=q.slice();let I=null,m=0;const N=q.length;for(let b=0;b<N;++b){const T=q[b],x=ee.get(T);(null===I||T>I)&&(x&&b>0&&T>q[b-1]||!x&&b<N-1&&T>q[b+1])&&(I=T,m=b)}if(null===I)this.done=!0;else{const b=ee.get(I)?m-1:m+1;q[m]=q[b],q[b]=I;for(const T of q)T>I&&ee.set(T,!ee.get(T))}return A}}},624(Ke,Re,q){"use strict";var ee=q(9293).default;const A=q(250),I=q(1126),m=q(7794),N=q(8276);function b(T,x){return T.hash<x.hash?-1:T.hash>x.hash?1:0}Ke.exports=class{constructor({createMessageDigest:x=()=>new I("sha256"),canonicalIdMap:R=new Map,maxDeepIterations:S=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new A("_:c14n",R),this.createMessageDigest=x,this.maxDeepIterations=S,this.quads=null,this.deepIterations=null}main(x){var R=this;return ee(function*(){R.deepIterations=new Map,R.quads=x;for(const B of x)R._addBlankNodeQuadInfo({quad:B,component:B.subject}),R._addBlankNodeQuadInfo({quad:B,component:B.object}),R._addBlankNodeQuadInfo({quad:B,component:B.graph});const S=new Map,_=[...R.blankNodeInfo.keys()];let z=0;for(const B of _)++z%100==0&&(yield R._yield()),yield R._hashAndTrackBlankNode({id:B,hashToBlankNodes:S});const P=[...S.keys()].sort(),k=[];for(const B of P){const y=S.get(B);y.length>1?k.push(y):R.canonicalIssuer.getId(y[0])}for(const B of k){const y=[];for(const Y of B){if(R.canonicalIssuer.hasId(Y))continue;const De=new A("_:b");De.getId(Y);const se=yield R.hashNDegreeQuads(Y,De);y.push(se)}y.sort(b);for(const Y of y){const De=Y.issuer.getOldIds();for(const se of De)R.canonicalIssuer.getId(se)}}const K=[];for(const B of R.quads){const y=N.serializeQuadComponents(R._componentWithCanonicalId(B.subject),B.predicate,R._componentWithCanonicalId(B.object),R._componentWithCanonicalId(B.graph));K.push(y)}return K.sort(),K.join("")})()}hashFirstDegreeQuads(x){var R=this;return ee(function*(){const S=[],_=R.blankNodeInfo.get(x),z=_.quads;for(const k of z){const K={subject:null,predicate:k.predicate,object:null,graph:null};K.subject=R.modifyFirstDegreeComponent(x,k.subject,"subject"),K.object=R.modifyFirstDegreeComponent(x,k.object,"object"),K.graph=R.modifyFirstDegreeComponent(x,k.graph,"graph"),S.push(N.serializeQuad(K))}S.sort();const P=R.createMessageDigest();for(const k of S)P.update(k);return _.hash=yield P.digest(),_.hash})()}hashRelatedBlankNode(x,R,S,_){var z=this;return ee(function*(){let P;P=z.canonicalIssuer.hasId(x)?z.canonicalIssuer.getId(x):S.hasId(x)?S.getId(x):z.blankNodeInfo.get(x).hash;const k=z.createMessageDigest();return k.update(_),"g"!==_&&k.update(z.getRelatedPredicate(R)),k.update(P),k.digest()})()}hashNDegreeQuads(x,R){var S=this;return ee(function*(){const _=S.deepIterations.get(x)||0;if(_>S.maxDeepIterations)throw new Error(`Maximum deep iterations (${S.maxDeepIterations}) exceeded.`);S.deepIterations.set(x,_+1);const z=S.createMessageDigest(),P=yield S.createHashToRelated(x,R),k=[...P.keys()].sort();for(const K of k){z.update(K);let y,B="";const Y=new m(P.get(K));let De=0;for(;Y.hasNext();){const se=Y.next();++De%3==0&&(yield S._yield());let O=R.clone(),D="";const L=[];let F=!1;for(const re of se)if(S.canonicalIssuer.hasId(re)?D+=S.canonicalIssuer.getId(re):(O.hasId(re)||L.push(re),D+=O.getId(re)),0!==B.length&&D>B){F=!0;break}if(!F){for(const re of L){const ie=yield S.hashNDegreeQuads(re,O);if(D+=O.getId(re),D+=`<${ie.hash}>`,O=ie.issuer,0!==B.length&&D>B){F=!0;break}}F||(0===B.length||D<B)&&(B=D,y=O)}}z.update(B),R=y}return{hash:yield z.digest(),issuer:R}})()}modifyFirstDegreeComponent(x,R){return"BlankNode"!==R.termType?R:{termType:"BlankNode",value:R.value===x?"_:a":"_:z"}}getRelatedPredicate(x){return`<${x.predicate.value}>`}createHashToRelated(x,R){var S=this;return ee(function*(){const _=new Map,z=S.blankNodeInfo.get(x).quads;let P=0;for(const k of z)++P%100==0&&(yield S._yield()),yield Promise.all([S._addRelatedBlankNodeHash({quad:k,component:k.subject,position:"s",id:x,issuer:R,hashToRelated:_}),S._addRelatedBlankNodeHash({quad:k,component:k.object,position:"o",id:x,issuer:R,hashToRelated:_}),S._addRelatedBlankNodeHash({quad:k,component:k.graph,position:"g",id:x,issuer:R,hashToRelated:_})]);return _})()}_hashAndTrackBlankNode(x){var R=this;return ee(function*({id:S,hashToBlankNodes:_}){const z=yield R.hashFirstDegreeQuads(S),P=_.get(z);P?P.push(S):_.set(z,[S])}).apply(this,arguments)}_addBlankNodeQuadInfo({quad:x,component:R}){if("BlankNode"!==R.termType)return;const S=R.value,_=this.blankNodeInfo.get(S);_?_.quads.add(x):this.blankNodeInfo.set(S,{quads:new Set([x]),hash:null})}_addRelatedBlankNodeHash(x){var R=this;return ee(function*({quad:S,component:_,position:z,id:P,issuer:k,hashToRelated:K}){if("BlankNode"!==_.termType||_.value===P)return;const B=_.value,y=yield R.hashRelatedBlankNode(B,S,k,z),Y=K.get(y);Y?Y.push(B):K.set(y,[B])}).apply(this,arguments)}_componentWithCanonicalId(x){return"BlankNode"!==x.termType||x.value.startsWith(this.canonicalIssuer.prefix)?x:{termType:"BlankNode",value:this.canonicalIssuer.getId(x.value)}}_yield(){return ee(function*(){return new Promise(x=>setImmediate(x))})()}}},203(Ke,Re,q){"use strict";const ee=q(250),A=q(1126),I=q(7794),m=q(8276);function N(b,T){return b.hash<T.hash?-1:b.hash>T.hash?1:0}Ke.exports=class{constructor({createMessageDigest:T=()=>new A("sha256"),canonicalIdMap:x=new Map,maxDeepIterations:R=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new ee("_:c14n",x),this.createMessageDigest=T,this.maxDeepIterations=R,this.quads=null,this.deepIterations=null}main(T){this.deepIterations=new Map,this.quads=T;for(const P of T)this._addBlankNodeQuadInfo({quad:P,component:P.subject}),this._addBlankNodeQuadInfo({quad:P,component:P.object}),this._addBlankNodeQuadInfo({quad:P,component:P.graph});const x=new Map,R=[...this.blankNodeInfo.keys()];for(const P of R)this._hashAndTrackBlankNode({id:P,hashToBlankNodes:x});const S=[...x.keys()].sort(),_=[];for(const P of S){const k=x.get(P);k.length>1?_.push(k):this.canonicalIssuer.getId(k[0])}for(const P of _){const k=[];for(const K of P){if(this.canonicalIssuer.hasId(K))continue;const B=new ee("_:b");B.getId(K);const y=this.hashNDegreeQuads(K,B);k.push(y)}k.sort(N);for(const K of k){const B=K.issuer.getOldIds();for(const y of B)this.canonicalIssuer.getId(y)}}const z=[];for(const P of this.quads){const k=m.serializeQuadComponents(this._componentWithCanonicalId({component:P.subject}),P.predicate,this._componentWithCanonicalId({component:P.object}),this._componentWithCanonicalId({component:P.graph}));z.push(k)}return z.sort(),z.join("")}hashFirstDegreeQuads(T){const x=[],R=this.blankNodeInfo.get(T),S=R.quads;for(const z of S){const P={subject:null,predicate:z.predicate,object:null,graph:null};P.subject=this.modifyFirstDegreeComponent(T,z.subject,"subject"),P.object=this.modifyFirstDegreeComponent(T,z.object,"object"),P.graph=this.modifyFirstDegreeComponent(T,z.graph,"graph"),x.push(m.serializeQuad(P))}x.sort();const _=this.createMessageDigest();for(const z of x)_.update(z);return R.hash=_.digest(),R.hash}hashRelatedBlankNode(T,x,R,S){let _;_=this.canonicalIssuer.hasId(T)?this.canonicalIssuer.getId(T):R.hasId(T)?R.getId(T):this.blankNodeInfo.get(T).hash;const z=this.createMessageDigest();return z.update(S),"g"!==S&&z.update(this.getRelatedPredicate(x)),z.update(_),z.digest()}hashNDegreeQuads(T,x){const R=this.deepIterations.get(T)||0;if(R>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(T,R+1);const S=this.createMessageDigest(),_=this.createHashToRelated(T,x),z=[..._.keys()].sort();for(const P of z){S.update(P);let K,k="";const B=new I(_.get(P));for(;B.hasNext();){const y=B.next();let Y=x.clone(),De="";const se=[];let O=!1;for(const D of y)if(this.canonicalIssuer.hasId(D)?De+=this.canonicalIssuer.getId(D):(Y.hasId(D)||se.push(D),De+=Y.getId(D)),0!==k.length&&De>k){O=!0;break}if(!O){for(const D of se){const L=this.hashNDegreeQuads(D,Y);if(De+=Y.getId(D),De+=`<${L.hash}>`,Y=L.issuer,0!==k.length&&De>k){O=!0;break}}O||(0===k.length||De<k)&&(k=De,K=Y)}}S.update(k),x=K}return{hash:S.digest(),issuer:x}}modifyFirstDegreeComponent(T,x){return"BlankNode"!==x.termType?x:{termType:"BlankNode",value:x.value===T?"_:a":"_:z"}}getRelatedPredicate(T){return`<${T.predicate.value}>`}createHashToRelated(T,x){const R=new Map,S=this.blankNodeInfo.get(T).quads;for(const _ of S)this._addRelatedBlankNodeHash({quad:_,component:_.subject,position:"s",id:T,issuer:x,hashToRelated:R}),this._addRelatedBlankNodeHash({quad:_,component:_.object,position:"o",id:T,issuer:x,hashToRelated:R}),this._addRelatedBlankNodeHash({quad:_,component:_.graph,position:"g",id:T,issuer:x,hashToRelated:R});return R}_hashAndTrackBlankNode({id:T,hashToBlankNodes:x}){const R=this.hashFirstDegreeQuads(T),S=x.get(R);S?S.push(T):x.set(R,[T])}_addBlankNodeQuadInfo({quad:T,component:x}){if("BlankNode"!==x.termType)return;const R=x.value,S=this.blankNodeInfo.get(R);S?S.quads.add(T):this.blankNodeInfo.set(R,{quads:new Set([T]),hash:null})}_addRelatedBlankNodeHash({quad:T,component:x,position:R,id:S,issuer:_,hashToRelated:z}){if("BlankNode"!==x.termType||x.value===S)return;const P=x.value,k=this.hashRelatedBlankNode(P,T,_,R),K=z.get(k);K?K.push(P):z.set(k,[P])}_componentWithCanonicalId({component:T}){return"BlankNode"!==T.termType||T.value.startsWith(this.canonicalIssuer.prefix)?T:{termType:"BlankNode",value:this.canonicalIssuer.getId(T.value)}}}},6268(Ke,Re,q){"use strict";var ee=q(9293).default;const A=q(1126),I=q(624);Ke.exports=class extends I{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new A("sha1")}modifyFirstDegreeComponent(N,b,T){return"BlankNode"!==b.termType?b:"graph"===T?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:b.value===N?"_:a":"_:z"}}getRelatedPredicate(N){return N.predicate.value}createHashToRelated(N,b){var T=this;return ee(function*(){const x=new Map,R=T.blankNodeInfo.get(N).quads;let S=0;for(const _ of R){let z,P;if("BlankNode"===_.subject.termType&&_.subject.value!==N)P=_.subject.value,z="p";else{if("BlankNode"!==_.object.termType||_.object.value===N)continue;P=_.object.value,z="r"}++S%100==0&&(yield T._yield());const k=yield T.hashRelatedBlankNode(P,_,b,z),K=x.get(k);K?K.push(P):x.set(k,[P])}return x})()}}},8911(Ke,Re,q){"use strict";const ee=q(1126),A=q(203);Ke.exports=class extends A{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new ee("sha1")}modifyFirstDegreeComponent(m,N,b){return"BlankNode"!==N.termType?N:"graph"===b?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:N.value===m?"_:a":"_:z"}}getRelatedPredicate(m){return m.predicate.value}createHashToRelated(m,N){const b=new Map,T=this.blankNodeInfo.get(m).quads;for(const x of T){let R,S;if("BlankNode"===x.subject.termType&&x.subject.value!==m)S=x.subject.value,R="p";else{if("BlankNode"!==x.object.termType||x.object.value===m)continue;S=x.object.value,R="r"}const _=this.hashRelatedBlankNode(S,x,N,R),z=b.get(_);z?z.push(S):b.set(_,[S])}return b}}},4548(Ke,Re,q){"use strict";var ee=q(9293).default;const A=q(624),I=q(6268),m=q(203),N=q(8911);let b;try{b=q(7789)}catch{}function T(x){return Array.isArray(x)?x:Re.NQuads.legacyDatasetToQuads(x)}Re.NQuads=q(8276),Re.IdentifierIssuer=q(250),Re._rdfCanonizeNative=function(x){return x&&(b=x),b},Re.canonize=function(){var x=ee(function*(R,S){const _=T(R);if(S.useNative){if(!b)throw new Error("rdf-canonize-native not available");if(S.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((z,P)=>b.canonize(_,S,(k,K)=>k?P(k):z(K)))}if("URDNA2015"===S.algorithm)return new A(S).main(_);if("URGNA2012"===S.algorithm){if(S.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new I(S).main(_)}throw"algorithm"in S?new Error("Invalid RDF Dataset Canonicalization algorithm: "+S.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")});return function(R,S){return x.apply(this,arguments)}}(),Re._canonizeSync=function(x,R){const S=T(x);if(R.useNative){if(!b)throw new Error("rdf-canonize-native not available");if(R.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return b.canonizeSync(S,R)}if("URDNA2015"===R.algorithm)return new m(R).main(S);if("URGNA2012"===R.algorithm){if(R.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new N(R).main(S)}throw"algorithm"in R?new Error("Invalid RDF Dataset Canonicalization algorithm: "+R.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}},7140(){!function(Ke){"use strict";if(!Ke.setImmediate){var m,q=1,ee={},A=!1,I=Ke.document,K=Object.getPrototypeOf&&Object.getPrototypeOf(Ke);K=K&&K.setTimeout?K:Ke,"[object process]"==={}.toString.call(Ke.process)?function R(){m=function(B){process.nextTick(function(){x(B)})}}():function S(){if(Ke.postMessage&&!Ke.importScripts){var B=!0,y=Ke.onmessage;return Ke.onmessage=function(){B=!1},Ke.postMessage("","*"),Ke.onmessage=y,B}}()?function _(){var B="setImmediate$"+Math.random()+"$",y=function(Y){Y.source===Ke&&"string"==typeof Y.data&&0===Y.data.indexOf(B)&&x(+Y.data.slice(B.length))};Ke.addEventListener?Ke.addEventListener("message",y,!1):Ke.attachEvent("onmessage",y),m=function(Y){Ke.postMessage(B+Y,"*")}}():Ke.MessageChannel?function z(){var B=new MessageChannel;B.port1.onmessage=function(y){x(y.data)},m=function(y){B.port2.postMessage(y)}}():I&&"onreadystatechange"in I.createElement("script")?function P(){var B=I.documentElement;m=function(y){var Y=I.createElement("script");Y.onreadystatechange=function(){x(y),Y.onreadystatechange=null,B.removeChild(Y),Y=null},B.appendChild(Y)}}():function k(){m=function(B){setTimeout(x,0,B)}}(),K.setImmediate=function N(B){"function"!=typeof B&&(B=new Function(""+B));for(var y=new Array(arguments.length-1),Y=0;Y<y.length;Y++)y[Y]=arguments[Y+1];return ee[q]={callback:B,args:y},m(q),q++},K.clearImmediate=b}function b(B){delete ee[B]}function x(B){if(A)setTimeout(x,0,B);else{var y=ee[B];if(y){A=!0;try{!function T(B){var y=B.callback,Y=B.args;switch(Y.length){case 0:y();break;case 1:y(Y[0]);break;case 2:y(Y[0],Y[1]);break;case 3:y(Y[0],Y[1],Y[2]);break;default:y.apply(void 0,Y)}}(y)}finally{b(B),A=!1}}}}}(typeof self>"u"?typeof global>"u"?this:global:self)},7789(){},9293(Ke){function Re(ee,A,I,m,N,b,T){try{var x=ee[b](T),R=x.value}catch(S){return void I(S)}x.done?A(R):Promise.resolve(R).then(m,N)}Ke.exports=function q(ee){return function(){var A=this,I=arguments;return new Promise(function(m,N){var b=ee.apply(A,I);function T(R){Re(b,m,N,T,x,"next",R)}function x(R){Re(b,m,N,T,x,"throw",R)}T(void 0)})}},Ke.exports.__esModule=!0,Ke.exports.default=Ke.exports}}]);