cc-viewer 1.6.183 → 1.6.192
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/dist/assets/App-DuGHwadX.js +31 -0
- package/dist/assets/{AppHeader-Dc7WvorH.css → AppHeader-D8MCV07q.css} +3 -3
- package/dist/assets/AppHeader.module-CozRDKfP.js +573 -0
- package/dist/assets/Mobile-Bab634xx.js +10 -0
- package/dist/assets/_baseUniq-DJPPdHyT.js +1 -0
- package/dist/assets/arc-DZ3Bjq-l.js +1 -0
- package/dist/assets/architectureDiagram-Q4EWVU46-xy0J2lr0.js +36 -0
- package/dist/assets/blockDiagram-DXYQGD6D-CoUm8UC5.js +132 -0
- package/dist/assets/c4Diagram-AHTNJAMY-CFHX4Dfx.js +10 -0
- package/dist/assets/channel-G3S1FOvm.js +1 -0
- package/dist/assets/chunk-4BX2VUAB-CiktxOyY.js +1 -0
- package/dist/assets/chunk-4TB4RGXK-DHl7ZlQV.js +206 -0
- package/dist/assets/chunk-55IACEB6-DcgWxDD5.js +1 -0
- package/dist/assets/chunk-EDXVE4YY-DeUzWpQx.js +1 -0
- package/dist/assets/{chunk-FMBD7UC4-Bb0LARSp.js → chunk-FMBD7UC4-BCaKpugk.js} +2 -2
- package/dist/assets/chunk-OYMX7WX6-DKMEMbG9.js +231 -0
- package/dist/assets/chunk-QZHKN3VN-BREApeQ-.js +1 -0
- package/dist/assets/chunk-YZCP3GAM-BYW1PNda.js +1 -0
- package/dist/assets/classDiagram-6PBFFD2Q-B0-7EUsz.js +1 -0
- package/dist/assets/classDiagram-v2-HSJHXN6E-B0-7EUsz.js +1 -0
- package/dist/assets/clone-CX_D5SrR.js +1 -0
- package/dist/assets/cose-bilkent-S5V4N54A-DpwiMCiq.js +1 -0
- package/dist/assets/cytoscape.esm-BMgRe88L.js +331 -0
- package/dist/assets/dagre-KV5264BT-Dc7qbya2.js +4 -0
- package/dist/assets/defaultLocale-CcTwRAjA.js +1 -0
- package/dist/assets/diagram-5BDNPKRD-v7FsHeLQ.js +10 -0
- package/dist/assets/diagram-G4DWMVQ6-BhKNBlcE.js +24 -0
- package/dist/assets/diagram-MMDJMWI5-C-3cRdzG.js +43 -0
- package/dist/assets/diagram-TYMM5635-HfNcJIfT.js +24 -0
- package/dist/assets/erDiagram-SMLLAGMA-Ckj0dkk7.js +85 -0
- package/dist/assets/flowDiagram-DWJPFMVM-yf315tJr.js +162 -0
- package/dist/assets/ganttDiagram-T4ZO3ILL-Ch2bINVC.js +292 -0
- package/dist/assets/gitGraphDiagram-UUTBAWPF-CesdgsJi.js +106 -0
- package/dist/assets/graph-CRpmapJV.js +1 -0
- package/dist/assets/html2canvas.esm-B8c0f9Wq.js +22 -0
- package/dist/assets/index-DJ0iGKLy.js +2 -0
- package/dist/assets/infoDiagram-42DDH7IO-CuD16P9Y.js +2 -0
- package/dist/assets/init-C7FSzFHJ.js +1 -0
- package/dist/assets/ishikawaDiagram-UXIWVN3A-4y8aG54G.js +70 -0
- package/dist/assets/journeyDiagram-VCZTEJTY-B6TtR2Zk.js +139 -0
- package/dist/assets/kanban-definition-6JOO6SKY-DTcNHYUS.js +89 -0
- package/dist/assets/katex-CJRKSY_b.js +257 -0
- package/dist/assets/layout-CX5hpkD2.js +1 -0
- package/dist/assets/linear-tWlC-NXc.js +1 -0
- package/dist/assets/mermaid.core-DNvsWVDx.js +308 -0
- package/dist/assets/min-CDExe3RN.js +1 -0
- package/dist/assets/mindmap-definition-QFDTVHPH-CW0yNQcb.js +96 -0
- package/dist/assets/ordinal-aRyHI6gl.js +1 -0
- package/dist/assets/pieDiagram-DEJITSTG-DNrnOqmz.js +30 -0
- package/dist/assets/quadrantDiagram-34T5L4WZ-Cl176vnh.js +7 -0
- package/dist/assets/requirementDiagram-MS252O5E-DKp3A5f_.js +84 -0
- package/dist/assets/sankeyDiagram-XADWPNL6-BMV0lAz8.js +10 -0
- package/dist/assets/sequenceDiagram-FGHM5R23-CQ4preep.js +157 -0
- package/dist/assets/stateDiagram-FHFEXIEX-BKqYYN8H.js +1 -0
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-C1W1ECmZ.js +1 -0
- package/dist/assets/timeline-definition-GMOUNBTQ-4kgeuumv.js +120 -0
- package/dist/assets/vendor-antd-Dk5s46Ag.js +406 -0
- package/dist/assets/vendor-codemirror-DxvDOrio.js +46 -0
- package/dist/assets/vendor-highlight-DVwgAdJY.js +3 -0
- package/dist/assets/vendor-markdown-DO-Ppp4f.js +60 -0
- package/dist/assets/vendor-qrcode-hI5wlAgK.js +9 -0
- package/dist/assets/vendor-virtuoso-HW77kTCh.js +1 -0
- package/dist/assets/vendor-xterm-D2cUrYEx.js +140 -0
- package/dist/assets/vennDiagram-DHZGUBPP-CqBcUIdK.js +34 -0
- package/dist/assets/wardley-RL74JXVD-CbEnkKx8.js +162 -0
- package/dist/assets/wardleyDiagram-NUSXRM2D-BJrjkZMg.js +20 -0
- package/dist/assets/xychartDiagram-5P7HB3ND-D8aBEz8e.js +7 -0
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/server.js +13 -4
- package/dist/assets/App-BHfyP8-J.js +0 -31
- package/dist/assets/AppHeader.module-W_78JZt9.js +0 -573
- package/dist/assets/Mobile-ca5EOMpN.js +0 -10
- package/dist/assets/_baseUniq-DYSZB4Xx.js +0 -1
- package/dist/assets/arc-BChSP8hM.js +0 -1
- package/dist/assets/architectureDiagram-Q4EWVU46-vlr5Q6DQ.js +0 -36
- package/dist/assets/blockDiagram-DXYQGD6D-4C3Amh2i.js +0 -132
- package/dist/assets/c4Diagram-AHTNJAMY-wI0efLSs.js +0 -10
- package/dist/assets/channel-d8DITadq.js +0 -1
- package/dist/assets/chunk-4BX2VUAB-BX9brpDB.js +0 -1
- package/dist/assets/chunk-4TB4RGXK-DvFQ-X9V.js +0 -206
- package/dist/assets/chunk-55IACEB6-BNmYjPNf.js +0 -1
- package/dist/assets/chunk-EDXVE4YY-BNvDPqBE.js +0 -1
- package/dist/assets/chunk-OYMX7WX6-BwlvIpeD.js +0 -231
- package/dist/assets/chunk-QZHKN3VN-BS6RK8_X.js +0 -1
- package/dist/assets/chunk-YZCP3GAM-oOqmydQz.js +0 -1
- package/dist/assets/classDiagram-6PBFFD2Q-B1oRrMCc.js +0 -1
- package/dist/assets/classDiagram-v2-HSJHXN6E-B1oRrMCc.js +0 -1
- package/dist/assets/clone-BrNOd7Lq.js +0 -1
- package/dist/assets/cose-bilkent-S5V4N54A-CamsIqkY.js +0 -1
- package/dist/assets/cytoscape.esm-DxGcaOPV.js +0 -331
- package/dist/assets/dagre-KV5264BT-CPAWWiBh.js +0 -4
- package/dist/assets/defaultLocale-DX6XiGOO.js +0 -1
- package/dist/assets/diagram-5BDNPKRD-D6TmzGhl.js +0 -10
- package/dist/assets/diagram-G4DWMVQ6-DDuJnMCL.js +0 -24
- package/dist/assets/diagram-MMDJMWI5-CQWhvrpz.js +0 -43
- package/dist/assets/diagram-TYMM5635-CEDj3w_h.js +0 -24
- package/dist/assets/erDiagram-SMLLAGMA-B_eQqha6.js +0 -85
- package/dist/assets/flowDiagram-DWJPFMVM-B985i3uQ.js +0 -162
- package/dist/assets/ganttDiagram-T4ZO3ILL-DKp62vr3.js +0 -292
- package/dist/assets/gitGraphDiagram-UUTBAWPF-Cc1gyz1Q.js +0 -106
- package/dist/assets/graph-C-1-3bsA.js +0 -1
- package/dist/assets/html2canvas.esm-QH1iLAAe.js +0 -22
- package/dist/assets/index-LH2WLu05.js +0 -2
- package/dist/assets/infoDiagram-42DDH7IO-DqXaAHZz.js +0 -2
- package/dist/assets/init-Gi6I4Gst.js +0 -1
- package/dist/assets/ishikawaDiagram-UXIWVN3A-zdUdDJX2.js +0 -70
- package/dist/assets/journeyDiagram-VCZTEJTY-ip5SzODy.js +0 -139
- package/dist/assets/kanban-definition-6JOO6SKY-D5EYh6AP.js +0 -89
- package/dist/assets/katex-DkKDou_j.js +0 -257
- package/dist/assets/layout-Cjq8AL8G.js +0 -1
- package/dist/assets/linear-U0KsEJ2u.js +0 -1
- package/dist/assets/mermaid.core-CT-5crLN.js +0 -308
- package/dist/assets/min-C7G6pq26.js +0 -1
- package/dist/assets/mindmap-definition-QFDTVHPH-CIzhFOw1.js +0 -96
- package/dist/assets/ordinal-Cboi1Yqb.js +0 -1
- package/dist/assets/pieDiagram-DEJITSTG-Cp1Zd1MQ.js +0 -30
- package/dist/assets/quadrantDiagram-34T5L4WZ-Cp31xM90.js +0 -7
- package/dist/assets/requirementDiagram-MS252O5E-Dbg_eQqB.js +0 -84
- package/dist/assets/sankeyDiagram-XADWPNL6-CMrzwpwC.js +0 -10
- package/dist/assets/sequenceDiagram-FGHM5R23-KJegoBnN.js +0 -157
- package/dist/assets/stateDiagram-FHFEXIEX-BDWprYzE.js +0 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-CCUmB0qI.js +0 -1
- package/dist/assets/timeline-definition-GMOUNBTQ-BOWeG5LY.js +0 -120
- package/dist/assets/vendor-antd-CtdKd5xs.js +0 -406
- package/dist/assets/vendor-codemirror-CdXaVX4e.js +0 -46
- package/dist/assets/vendor-highlight-D4ATuRwX.js +0 -3
- package/dist/assets/vendor-markdown-CO-jRjTB.js +0 -60
- package/dist/assets/vendor-qrcode-D05RfzwB.js +0 -9
- package/dist/assets/vendor-virtuoso-BhnFrbmh.js +0 -1
- package/dist/assets/vendor-xterm-DWMOrwSy.js +0 -140
- package/dist/assets/vennDiagram-DHZGUBPP-B6mLodPk.js +0 -34
- package/dist/assets/wardley-RL74JXVD-CovHs24Z.js +0 -162
- package/dist/assets/wardleyDiagram-NUSXRM2D-CBg_VXF7.js +0 -20
- package/dist/assets/xychartDiagram-5P7HB3ND-BRxgk_oX.js +0 -7
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
function _arrayLikeToArray(r,a){(a==null||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _createForOfIteratorHelper(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e){t&&(r=t);var n=0,F=function(){};return{s:F,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r2){throw r2},f:F}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,a=!0,u=!1;return{s:function(){t=t.call(r)},n:function(){var r2=t.next();return a=r2.done,r2},e:function(r2){u=!0,o=r2},f:function(){try{a||t.return==null||t.return()}finally{if(u)throw o}}}}function _defineProperty$1(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _iterableToArray(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function _iterableToArrayLimit(r,l){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,l===0){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r2){o=!0,n=r2}finally{try{if(!f&&t.return!=null&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _toPrimitive(t,r){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,r);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return typeof i=="symbol"?i:i+""}function _typeof(o){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o2){return typeof o2}:function(o2){return o2&&typeof Symbol=="function"&&o2.constructor===Symbol&&o2!==Symbol.prototype?"symbol":typeof o2},_typeof(o)}function _unsupportedIterableToArray(r,a){if(r){if(typeof r=="string")return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}var _window=typeof window>"u"?null:window,navigator=_window?_window.navigator:null;_window&&_window.document;var typeofstr=_typeof(""),typeofobj=_typeof({}),typeoffn=_typeof(function(){}),typeofhtmlele=typeof HTMLElement>"u"?"undefined":_typeof(HTMLElement),instanceStr=function(obj){return obj&&obj.instanceString&&fn$6(obj.instanceString)?obj.instanceString():null},string=function(obj){return obj!=null&&_typeof(obj)==typeofstr},fn$6=function(obj){return obj!=null&&_typeof(obj)===typeoffn},array=function(obj){return!elementOrCollection(obj)&&(Array.isArray?Array.isArray(obj):obj!=null&&obj instanceof Array)},plainObject=function(obj){return obj!=null&&_typeof(obj)===typeofobj&&!array(obj)&&obj.constructor===Object},object=function(obj){return obj!=null&&_typeof(obj)===typeofobj},number$1=function(obj){return obj!=null&&_typeof(obj)===_typeof(1)&&!isNaN(obj)},integer=function(obj){return number$1(obj)&&Math.floor(obj)===obj},htmlElement=function(obj){if(typeofhtmlele!=="undefined")return obj!=null&&obj instanceof HTMLElement},elementOrCollection=function(obj){return element(obj)||collection(obj)},element=function(obj){return instanceStr(obj)==="collection"&&obj._private.single},collection=function(obj){return instanceStr(obj)==="collection"&&!obj._private.single},core=function(obj){return instanceStr(obj)==="core"},stylesheet=function(obj){return instanceStr(obj)==="stylesheet"},event=function(obj){return instanceStr(obj)==="event"},emptyString=function(obj){return obj==null?!0:!!(obj===""||obj.match(/^\s+$/))},domElement=function(obj){return typeof HTMLElement>"u"?!1:obj instanceof HTMLElement},boundingBox=function(obj){return plainObject(obj)&&number$1(obj.x1)&&number$1(obj.x2)&&number$1(obj.y1)&&number$1(obj.y2)},promise=function(obj){return object(obj)&&fn$6(obj.then)},ms=function(){return navigator&&navigator.userAgent.match(/msie|trident|edge/i)},memoize=function(fn3,keyFn){keyFn||(keyFn=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var args=[],i=0;i<arguments.length;i++)args.push(arguments[i]);return args.join("$")});var _memoizedFn=function(){var self2=this,args=arguments,ret,k=keyFn.apply(self2,args),cache3=_memoizedFn.cache;return(ret=cache3[k])||(ret=cache3[k]=fn3.apply(self2,args)),ret};return _memoizedFn.cache={},_memoizedFn},camel2dash=memoize(function(str){return str.replace(/([A-Z])/g,function(v){return"-"+v.toLowerCase()})}),dash2camel=memoize(function(str){return str.replace(/(-\w)/g,function(v){return v[1].toUpperCase()})}),prependCamel=memoize(function(prefix,str){return prefix+str[0].toUpperCase()+str.substring(1)},function(prefix,str){return prefix+"$"+str}),capitalize=function(str){return emptyString(str)?str:str.charAt(0).toUpperCase()+str.substring(1)},endsWith=function(string3,suffix){return string3.slice(-1*suffix.length)===suffix},number2="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",rgba="rgb[a]?\\(("+number2+"[%]?)\\s*,\\s*("+number2+"[%]?)\\s*,\\s*("+number2+"[%]?)(?:\\s*,\\s*("+number2+"))?\\)",rgbaNoBackRefs="rgb[a]?\\((?:"+number2+"[%]?)\\s*,\\s*(?:"+number2+"[%]?)\\s*,\\s*(?:"+number2+"[%]?)(?:\\s*,\\s*(?:"+number2+"))?\\)",hsla="hsl[a]?\\(("+number2+")\\s*,\\s*("+number2+"[%])\\s*,\\s*("+number2+"[%])(?:\\s*,\\s*("+number2+"))?\\)",hslaNoBackRefs="hsl[a]?\\((?:"+number2+")\\s*,\\s*(?:"+number2+"[%])\\s*,\\s*(?:"+number2+"[%])(?:\\s*,\\s*(?:"+number2+"))?\\)",hex3="\\#[0-9a-fA-F]{3}",hex6="\\#[0-9a-fA-F]{6}",ascending=function(a,b){return a<b?-1:a>b?1:0},descending=function(a,b){return-1*ascending(a,b)},extend=Object.assign!=null?Object.assign.bind(Object):function(tgt){for(var args=arguments,i=1;i<args.length;i++){var obj=args[i];if(obj!=null)for(var keys=Object.keys(obj),j=0;j<keys.length;j++){var k=keys[j];tgt[k]=obj[k]}}return tgt},hex2tuple=function(hex){if(!(!(hex.length===4||hex.length===7)||hex[0]!=="#")){var shortHex=hex.length===4,r,g,b,base=16;return shortHex?(r=parseInt(hex[1]+hex[1],base),g=parseInt(hex[2]+hex[2],base),b=parseInt(hex[3]+hex[3],base)):(r=parseInt(hex[1]+hex[2],base),g=parseInt(hex[3]+hex[4],base),b=parseInt(hex[5]+hex[6],base)),[r,g,b]}},hsl2tuple=function(hsl){var ret,h,s,l,a,r,g,b;function hue2rgb(p3,q2,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?p3+(q2-p3)*6*t:t<1/2?q2:t<2/3?p3+(q2-p3)*(2/3-t)*6:p3}var m=new RegExp("^"+hsla+"$").exec(hsl);if(m){if(h=parseInt(m[1]),h<0?h=(360- -1*h%360)%360:h>360&&(h=h%360),h/=360,s=parseFloat(m[2]),s<0||s>100||(s=s/100,l=parseFloat(m[3]),l<0||l>100)||(l=l/100,a=m[4],a!==void 0&&(a=parseFloat(a),a<0||a>1)))return;if(s===0)r=g=b=Math.round(l*255);else{var q=l<.5?l*(1+s):l+s-l*s,p2=2*l-q;r=Math.round(255*hue2rgb(p2,q,h+1/3)),g=Math.round(255*hue2rgb(p2,q,h)),b=Math.round(255*hue2rgb(p2,q,h-1/3))}ret=[r,g,b,a]}return ret},rgb2tuple=function(rgb){var ret,m=new RegExp("^"+rgba+"$").exec(rgb);if(m){ret=[];for(var isPct=[],i=1;i<=3;i++){var channel=m[i];if(channel[channel.length-1]==="%"&&(isPct[i]=!0),channel=parseFloat(channel),isPct[i]&&(channel=channel/100*255),channel<0||channel>255)return;ret.push(Math.floor(channel))}var atLeastOneIsPct=isPct[1]||isPct[2]||isPct[3],allArePct=isPct[1]&&isPct[2]&&isPct[3];if(atLeastOneIsPct&&!allArePct)return;var alpha=m[4];if(alpha!==void 0){if(alpha=parseFloat(alpha),alpha<0||alpha>1)return;ret.push(alpha)}}return ret},colorname2tuple=function(color){return colors[color.toLowerCase()]},color2tuple=function(color){return(array(color)?color:null)||colorname2tuple(color)||hex2tuple(color)||rgb2tuple(color)||hsl2tuple(color)},colors={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]},setMap=function(options2){for(var obj=options2.map,keys=options2.keys,l=keys.length,i=0;i<l;i++){var key=keys[i];if(plainObject(key))throw Error("Tried to set map with object key");i<keys.length-1?(obj[key]==null&&(obj[key]={}),obj=obj[key]):obj[key]=options2.value}},getMap=function(options2){for(var obj=options2.map,keys=options2.keys,l=keys.length,i=0;i<l;i++){var key=keys[i];if(plainObject(key))throw Error("Tried to get map with object key");if(obj=obj[key],obj==null)return obj}return obj},commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(x2){return x2&&x2.__esModule&&Object.prototype.hasOwnProperty.call(x2,"default")?x2.default:x2}var isObject_1,hasRequiredIsObject;function requireIsObject(){if(hasRequiredIsObject)return isObject_1;hasRequiredIsObject=1;function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}return isObject_1=isObject,isObject_1}var _freeGlobal,hasRequired_freeGlobal;function require_freeGlobal(){if(hasRequired_freeGlobal)return _freeGlobal;hasRequired_freeGlobal=1;var freeGlobal=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;return _freeGlobal=freeGlobal,_freeGlobal}var _root,hasRequired_root;function require_root(){if(hasRequired_root)return _root;hasRequired_root=1;var freeGlobal=require_freeGlobal(),freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")();return _root=root,_root}var now_1,hasRequiredNow;function requireNow(){if(hasRequiredNow)return now_1;hasRequiredNow=1;var root=require_root(),now=function(){return root.Date.now()};return now_1=now,now_1}var _trimmedEndIndex,hasRequired_trimmedEndIndex;function require_trimmedEndIndex(){if(hasRequired_trimmedEndIndex)return _trimmedEndIndex;hasRequired_trimmedEndIndex=1;var reWhitespace=/\s/;function trimmedEndIndex(string3){for(var index=string3.length;index--&&reWhitespace.test(string3.charAt(index)););return index}return _trimmedEndIndex=trimmedEndIndex,_trimmedEndIndex}var _baseTrim,hasRequired_baseTrim;function require_baseTrim(){if(hasRequired_baseTrim)return _baseTrim;hasRequired_baseTrim=1;var trimmedEndIndex=require_trimmedEndIndex(),reTrimStart=/^\s+/;function baseTrim(string3){return string3&&string3.slice(0,trimmedEndIndex(string3)+1).replace(reTrimStart,"")}return _baseTrim=baseTrim,_baseTrim}var _Symbol,hasRequired_Symbol;function require_Symbol(){if(hasRequired_Symbol)return _Symbol;hasRequired_Symbol=1;var root=require_root(),Symbol2=root.Symbol;return _Symbol=Symbol2,_Symbol}var _getRawTag,hasRequired_getRawTag;function require_getRawTag(){if(hasRequired_getRawTag)return _getRawTag;hasRequired_getRawTag=1;var Symbol2=require_Symbol(),objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=Symbol2?Symbol2.toStringTag:void 0;function getRawTag(value){var isOwn=hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=void 0;var unmasked=!0}catch{}var result=nativeObjectToString.call(value);return unmasked&&(isOwn?value[symToStringTag]=tag:delete value[symToStringTag]),result}return _getRawTag=getRawTag,_getRawTag}var _objectToString,hasRequired_objectToString;function require_objectToString(){if(hasRequired_objectToString)return _objectToString;hasRequired_objectToString=1;var objectProto=Object.prototype,nativeObjectToString=objectProto.toString;function objectToString(value){return nativeObjectToString.call(value)}return _objectToString=objectToString,_objectToString}var _baseGetTag,hasRequired_baseGetTag;function require_baseGetTag(){if(hasRequired_baseGetTag)return _baseGetTag;hasRequired_baseGetTag=1;var Symbol2=require_Symbol(),getRawTag=require_getRawTag(),objectToString=require_objectToString(),nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol2?Symbol2.toStringTag:void 0;function baseGetTag(value){return value==null?value===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}return _baseGetTag=baseGetTag,_baseGetTag}var isObjectLike_1,hasRequiredIsObjectLike;function requireIsObjectLike(){if(hasRequiredIsObjectLike)return isObjectLike_1;hasRequiredIsObjectLike=1;function isObjectLike(value){return value!=null&&typeof value=="object"}return isObjectLike_1=isObjectLike,isObjectLike_1}var isSymbol_1,hasRequiredIsSymbol;function requireIsSymbol(){if(hasRequiredIsSymbol)return isSymbol_1;hasRequiredIsSymbol=1;var baseGetTag=require_baseGetTag(),isObjectLike=requireIsObjectLike(),symbolTag="[object Symbol]";function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}return isSymbol_1=isSymbol,isSymbol_1}var toNumber_1,hasRequiredToNumber;function requireToNumber(){if(hasRequiredToNumber)return toNumber_1;hasRequiredToNumber=1;var baseTrim=require_baseTrim(),isObject=requireIsObject(),isSymbol=requireIsSymbol(),NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber(value){if(typeof value=="number")return value;if(isSymbol(value))return NAN;if(isObject(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string")return value===0?value:+value;value=baseTrim(value);var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}return toNumber_1=toNumber,toNumber_1}var debounce_1,hasRequiredDebounce;function requireDebounce(){if(hasRequiredDebounce)return debounce_1;hasRequiredDebounce=1;var isObject=requireIsObject(),now=requireNow(),toNumber=requireToNumber(),FUNC_ERROR_TEXT="Expected a function",nativeMax=Math.max,nativeMin=Math.min;function debounce2(func,wait,options2){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=!1,maxing=!1,trailing=!0;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);wait=toNumber(wait)||0,isObject(options2)&&(leading=!!options2.leading,maxing="maxWait"in options2,maxWait=maxing?nativeMax(toNumber(options2.maxWait)||0,wait):maxWait,trailing="trailing"in options2?!!options2.trailing:trailing);function invokeFunc(time2){var args=lastArgs,thisArg=lastThis;return lastArgs=lastThis=void 0,lastInvokeTime=time2,result=func.apply(thisArg,args),result}function leadingEdge(time2){return lastInvokeTime=time2,timerId=setTimeout(timerExpired,wait),leading?invokeFunc(time2):result}function remainingWait(time2){var timeSinceLastCall=time2-lastCallTime,timeSinceLastInvoke=time2-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}function shouldInvoke(time2){var timeSinceLastCall=time2-lastCallTime,timeSinceLastInvoke=time2-lastInvokeTime;return lastCallTime===void 0||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time2=now();if(shouldInvoke(time2))return trailingEdge(time2);timerId=setTimeout(timerExpired,remainingWait(time2))}function trailingEdge(time2){return timerId=void 0,trailing&&lastArgs?invokeFunc(time2):(lastArgs=lastThis=void 0,result)}function cancel(){timerId!==void 0&&clearTimeout(timerId),lastInvokeTime=0,lastArgs=lastCallTime=lastThis=timerId=void 0}function flush(){return timerId===void 0?result:trailingEdge(now())}function debounced(){var time2=now(),isInvoking=shouldInvoke(time2);if(lastArgs=arguments,lastThis=this,lastCallTime=time2,isInvoking){if(timerId===void 0)return leadingEdge(lastCallTime);if(maxing)return clearTimeout(timerId),timerId=setTimeout(timerExpired,wait),invokeFunc(lastCallTime)}return timerId===void 0&&(timerId=setTimeout(timerExpired,wait)),result}return debounced.cancel=cancel,debounced.flush=flush,debounced}return debounce_1=debounce2,debounce_1}var debounceExports=requireDebounce(),debounce=getDefaultExportFromCjs(debounceExports),performance$1=_window?_window.performance:null,pnow=performance$1&&performance$1.now?function(){return performance$1.now()}:function(){return Date.now()},raf=(function(){if(_window){if(_window.requestAnimationFrame)return function(fn3){_window.requestAnimationFrame(fn3)};if(_window.mozRequestAnimationFrame)return function(fn3){_window.mozRequestAnimationFrame(fn3)};if(_window.webkitRequestAnimationFrame)return function(fn3){_window.webkitRequestAnimationFrame(fn3)};if(_window.msRequestAnimationFrame)return function(fn3){_window.msRequestAnimationFrame(fn3)}}return function(fn3){fn3&&setTimeout(function(){fn3(pnow())},1e3/60)}})(),requestAnimationFrame=function(fn3){return raf(fn3)},performanceNow=pnow,DEFAULT_HASH_SEED=9261,K=65599,DEFAULT_HASH_SEED_ALT=5381,hashIterableInts=function(iterator){for(var seed=arguments.length>1&&arguments[1]!==void 0?arguments[1]:DEFAULT_HASH_SEED,hash=seed,entry;entry=iterator.next(),!entry.done;)hash=hash*K+entry.value|0;return hash},hashInt=function(num){var seed=arguments.length>1&&arguments[1]!==void 0?arguments[1]:DEFAULT_HASH_SEED;return seed*K+num|0},hashIntAlt=function(num){var seed=arguments.length>1&&arguments[1]!==void 0?arguments[1]:DEFAULT_HASH_SEED_ALT;return(seed<<5)+seed+num|0},combineHashes=function(hash1,hash2){return hash1*2097152+hash2},combineHashesArray=function(hashes){return hashes[0]*2097152+hashes[1]},hashArrays=function(hashes1,hashes2){return[hashInt(hashes1[0],hashes2[0]),hashIntAlt(hashes1[1],hashes2[1])]},hashIntsArray=function(ints,seed){var entry={value:0,done:!1},i=0,length=ints.length,iterator={next:function(){return i<length?entry.value=ints[i++]:entry.done=!0,entry}};return hashIterableInts(iterator,seed)},hashString=function(str,seed){var entry={value:0,done:!1},i=0,length=str.length,iterator={next:function(){return i<length?entry.value=str.charCodeAt(i++):entry.done=!0,entry}};return hashIterableInts(iterator,seed)},hashStrings=function(){return hashStringsArray(arguments)},hashStringsArray=function(strs){for(var hash,i=0;i<strs.length;i++){var str=strs[i];i===0?hash=hashString(str):hash=hashString(str,hash)}return hash};function rotatePoint(x2,y2,centerX,centerY,angleDegrees){var angleRadians=angleDegrees*Math.PI/180,rotatedX=Math.cos(angleRadians)*(x2-centerX)-Math.sin(angleRadians)*(y2-centerY)+centerX,rotatedY=Math.sin(angleRadians)*(x2-centerX)+Math.cos(angleRadians)*(y2-centerY)+centerY;return{x:rotatedX,y:rotatedY}}var movePointByBoxAspect=function(x2,y2,boxX,boxY,skewX,skewY){return{x:(x2-boxX)*skewX+boxX,y:(y2-boxY)*skewY+boxY}};function rotatePosAndSkewByBox(pos,box,angleDegrees){if(angleDegrees===0)return pos;var centerX=(box.x1+box.x2)/2,centerY=(box.y1+box.y2)/2,skewX=box.w/box.h,skewY=1/skewX,rotated=rotatePoint(pos.x,pos.y,centerX,centerY,angleDegrees),skewed=movePointByBoxAspect(rotated.x,rotated.y,centerX,centerY,skewX,skewY);return{x:skewed.x,y:skewed.y}}var warningsEnabled=!0,warnSupported=console.warn!=null,traceSupported=console.trace!=null,MAX_INT$1=Number.MAX_SAFE_INTEGER||9007199254740991,trueify=function(){return!0},falsify=function(){return!1},zeroify=function(){return 0},noop$1=function(){},error=function(msg){throw new Error(msg)},warnings=function(enabled){if(enabled!==void 0)warningsEnabled=!!enabled;else return warningsEnabled},warn=function(msg){warnings()&&(warnSupported?console.warn(msg):(console.log(msg),traceSupported&&console.trace()))},clone=function(obj){return extend({},obj)},copy=function(obj){return obj==null?obj:array(obj)?obj.slice():plainObject(obj)?clone(obj):obj},copyArray=function(arr){return arr.slice()},uuid=function(a,b){for(b=a="";a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):"-");return b},_staticEmptyObject={},staticEmptyObject=function(){return _staticEmptyObject},defaults$g=function(_defaults){var keys=Object.keys(_defaults);return function(opts){for(var filledOpts={},i=0;i<keys.length;i++){var key=keys[i],optVal=opts==null?void 0:opts[key];filledOpts[key]=optVal===void 0?_defaults[key]:optVal}return filledOpts}},removeFromArray=function(arr,ele,oneCopy){for(var i=arr.length-1;i>=0;i--)arr[i]===ele&&arr.splice(i,1)},clearArray=function(arr){arr.splice(0,arr.length)},push=function(arr,otherArr){for(var i=0;i<otherArr.length;i++){var el=otherArr[i];arr.push(el)}},getPrefixedProperty=function(obj,propName,prefix){return prefix&&(propName=prependCamel(prefix,propName)),obj[propName]},setPrefixedProperty=function(obj,propName,prefix,value){prefix&&(propName=prependCamel(prefix,propName)),obj[propName]=value},ObjectMap=(function(){function ObjectMap2(){_classCallCheck(this,ObjectMap2),this._obj={}}return _createClass(ObjectMap2,[{key:"set",value:function(key,val){return this._obj[key]=val,this}},{key:"delete",value:function(key){return this._obj[key]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(key){return this._obj[key]!==void 0}},{key:"get",value:function(key){return this._obj[key]}}])})(),Map$1=typeof Map<"u"?Map:ObjectMap,undef="undefined",ObjectSet=(function(){function ObjectSet2(arrayOrObjectSet){if(_classCallCheck(this,ObjectSet2),this._obj=Object.create(null),this.size=0,arrayOrObjectSet!=null){var arr;arrayOrObjectSet.instanceString!=null&&arrayOrObjectSet.instanceString()===this.instanceString()?arr=arrayOrObjectSet.toArray():arr=arrayOrObjectSet;for(var i=0;i<arr.length;i++)this.add(arr[i])}}return _createClass(ObjectSet2,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(val){var o=this._obj;o[val]!==1&&(o[val]=1,this.size++)}},{key:"delete",value:function(val){var o=this._obj;o[val]===1&&(o[val]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(val){return this._obj[val]===1}},{key:"toArray",value:function(){var _this=this;return Object.keys(this._obj).filter(function(key){return _this.has(key)})}},{key:"forEach",value:function(callback,thisArg){return this.toArray().forEach(callback,thisArg)}}])})(),Set$1=(typeof Set>"u"?"undefined":_typeof(Set))!==undef?Set:ObjectSet,Element=function(cy,params){var restore=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(cy===void 0||params===void 0||!core(cy)){error("An element must have a core reference and parameters set");return}var group2=params.group;if(group2==null&&(params.data&¶ms.data.source!=null&¶ms.data.target!=null?group2="edges":group2="nodes"),group2!=="nodes"&&group2!=="edges"){error("An element must be of type `nodes` or `edges`; you specified `"+group2+"`");return}this.length=1,this[0]=this;var _p=this._private={cy,single:!0,data:params.data||{},position:params.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:group2,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!params.selected,selectable:params.selectable===void 0?!0:!!params.selectable,locked:!!params.locked,grabbed:!1,grabbable:params.grabbable===void 0?!0:!!params.grabbable,pannable:params.pannable===void 0?group2==="edges":!!params.pannable,active:!1,classes:new Set$1,animation:{current:[],queue:[]},rscratch:{},scratch:params.scratch||{},edges:[],children:[],parent:params.parent&¶ms.parent.isNode()?params.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(_p.position.x==null&&(_p.position.x=0),_p.position.y==null&&(_p.position.y=0),params.renderedPosition){var rpos=params.renderedPosition,pan2=cy.pan(),zoom2=cy.zoom();_p.position={x:(rpos.x-pan2.x)/zoom2,y:(rpos.y-pan2.y)/zoom2}}var classes2=[];array(params.classes)?classes2=params.classes:string(params.classes)&&(classes2=params.classes.split(/\s+/));for(var i=0,l=classes2.length;i<l;i++){var cls=classes2[i];!cls||cls===""||_p.classes.add(cls)}this.createEmitter(),(restore===void 0||restore)&&this.restore();var bypass=params.style||params.css;bypass&&(warn("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(bypass))},defineSearch=function(params){return params={bfs:params.bfs||!params.dfs,dfs:params.dfs||!params.bfs},function(roots,fn3,directed){var options2;plainObject(roots)&&!elementOrCollection(roots)&&(options2=roots,roots=options2.roots||options2.root,fn3=options2.visit,directed=options2.directed),directed=arguments.length===2&&!fn$6(fn3)?fn3:directed,fn3=fn$6(fn3)?fn3:function(){};for(var cy=this._private.cy,v=roots=string(roots)?this.filter(roots):roots,Q=[],connectedNodes=[],connectedBy={},id2depth={},V={},j=0,found,_this$byGroup=this.byGroup(),nodes3=_this$byGroup.nodes,edges3=_this$byGroup.edges,i=0;i<v.length;i++){var vi=v[i],viId=vi.id();vi.isNode()&&(Q.unshift(vi),params.bfs&&(V[viId]=!0,connectedNodes.push(vi)),id2depth[viId]=0)}for(var _loop=function(){var v3=params.bfs?Q.shift():Q.pop(),vId=v3.id();if(params.dfs){if(V[vId])return 0;V[vId]=!0,connectedNodes.push(v3)}var depth=id2depth[vId],prevEdge=connectedBy[vId],src=prevEdge!=null?prevEdge.source():null,tgt=prevEdge!=null?prevEdge.target():null,prevNode=prevEdge==null?void 0:v3.same(src)?tgt[0]:src[0],ret;if(ret=fn3(v3,prevEdge,prevNode,j++,depth),ret===!0)return found=v3,1;if(ret===!1)return 1;for(var vwEdges=v3.connectedEdges().filter(function(e2){return(!directed||e2.source().same(v3))&&edges3.has(e2)}),_i2=0;_i2<vwEdges.length;_i2++){var e=vwEdges[_i2],w=e.connectedNodes().filter(function(n){return!n.same(v3)&&nodes3.has(n)}),wId=w.id();w.length!==0&&!V[wId]&&(w=w[0],Q.push(w),params.bfs&&(V[wId]=!0,connectedNodes.push(w)),connectedBy[wId]=e,id2depth[wId]=id2depth[vId]+1)}},_ret;Q.length!==0&&(_ret=_loop(),!(_ret!==0&&_ret===1)););for(var connectedEles=cy.collection(),_i=0;_i<connectedNodes.length;_i++){var node=connectedNodes[_i],edge=connectedBy[node.id()];edge!=null&&connectedEles.push(edge),connectedEles.push(node)}return{path:cy.collection(connectedEles),found:cy.collection(found)}}},elesfn$v={breadthFirstSearch:defineSearch({bfs:!0}),depthFirstSearch:defineSearch({dfs:!0})};elesfn$v.bfs=elesfn$v.breadthFirstSearch;elesfn$v.dfs=elesfn$v.depthFirstSearch;var heap$2={exports:{}},heap$1=heap$2.exports,hasRequiredHeap$1;function requireHeap$1(){return hasRequiredHeap$1||(hasRequiredHeap$1=1,(function(module,exports$1){(function(){var Heap2,defaultCmp,floor,heapify,heappop,heappush,heappushpop,heapreplace,insort,min4,nlargest,nsmallest,updateItem,_siftdown,_siftup;floor=Math.floor,min4=Math.min,defaultCmp=function(x2,y2){return x2<y2?-1:x2>y2?1:0},insort=function(a,x2,lo,hi,cmp){var mid;if(lo==null&&(lo=0),cmp==null&&(cmp=defaultCmp),lo<0)throw new Error("lo must be non-negative");for(hi==null&&(hi=a.length);lo<hi;)mid=floor((lo+hi)/2),cmp(x2,a[mid])<0?hi=mid:lo=mid+1;return[].splice.apply(a,[lo,lo-lo].concat(x2)),x2},heappush=function(array3,item,cmp){return cmp==null&&(cmp=defaultCmp),array3.push(item),_siftdown(array3,0,array3.length-1,cmp)},heappop=function(array3,cmp){var lastelt,returnitem;return cmp==null&&(cmp=defaultCmp),lastelt=array3.pop(),array3.length?(returnitem=array3[0],array3[0]=lastelt,_siftup(array3,0,cmp)):returnitem=lastelt,returnitem},heapreplace=function(array3,item,cmp){var returnitem;return cmp==null&&(cmp=defaultCmp),returnitem=array3[0],array3[0]=item,_siftup(array3,0,cmp),returnitem},heappushpop=function(array3,item,cmp){var _ref;return cmp==null&&(cmp=defaultCmp),array3.length&&cmp(array3[0],item)<0&&(_ref=[array3[0],item],item=_ref[0],array3[0]=_ref[1],_siftup(array3,0,cmp)),item},heapify=function(array3,cmp){var i,_i,_len,_ref1,_results,_results1;for(cmp==null&&(cmp=defaultCmp),_ref1=(function(){_results1=[];for(var _j=0,_ref=floor(array3.length/2);0<=_ref?_j<_ref:_j>_ref;0<=_ref?_j++:_j--)_results1.push(_j);return _results1}).apply(this).reverse(),_results=[],_i=0,_len=_ref1.length;_i<_len;_i++)i=_ref1[_i],_results.push(_siftup(array3,i,cmp));return _results},updateItem=function(array3,item,cmp){var pos;if(cmp==null&&(cmp=defaultCmp),pos=array3.indexOf(item),pos!==-1)return _siftdown(array3,0,pos,cmp),_siftup(array3,pos,cmp)},nlargest=function(array3,n,cmp){var elem,result,_i,_len,_ref;if(cmp==null&&(cmp=defaultCmp),result=array3.slice(0,n),!result.length)return result;for(heapify(result,cmp),_ref=array3.slice(n),_i=0,_len=_ref.length;_i<_len;_i++)elem=_ref[_i],heappushpop(result,elem,cmp);return result.sort(cmp).reverse()},nsmallest=function(array3,n,cmp){var elem,los,result,_i,_j,_len,_ref,_ref1,_results;if(cmp==null&&(cmp=defaultCmp),n*10<=array3.length){if(result=array3.slice(0,n).sort(cmp),!result.length)return result;for(los=result[result.length-1],_ref=array3.slice(n),_i=0,_len=_ref.length;_i<_len;_i++)elem=_ref[_i],cmp(elem,los)<0&&(insort(result,elem,0,null,cmp),result.pop(),los=result[result.length-1]);return result}for(heapify(array3,cmp),_results=[],_j=0,_ref1=min4(n,array3.length);0<=_ref1?_j<_ref1:_j>_ref1;0<=_ref1?++_j:--_j)_results.push(heappop(array3,cmp));return _results},_siftdown=function(array3,startpos,pos,cmp){var newitem,parent4,parentpos;for(cmp==null&&(cmp=defaultCmp),newitem=array3[pos];pos>startpos;){if(parentpos=pos-1>>1,parent4=array3[parentpos],cmp(newitem,parent4)<0){array3[pos]=parent4,pos=parentpos;continue}break}return array3[pos]=newitem},_siftup=function(array3,pos,cmp){var childpos,endpos,newitem,rightpos,startpos;for(cmp==null&&(cmp=defaultCmp),endpos=array3.length,startpos=pos,newitem=array3[pos],childpos=2*pos+1;childpos<endpos;)rightpos=childpos+1,rightpos<endpos&&!(cmp(array3[childpos],array3[rightpos])<0)&&(childpos=rightpos),array3[pos]=array3[childpos],pos=childpos,childpos=2*pos+1;return array3[pos]=newitem,_siftdown(array3,startpos,pos,cmp)},Heap2=(function(){Heap3.push=heappush,Heap3.pop=heappop,Heap3.replace=heapreplace,Heap3.pushpop=heappushpop,Heap3.heapify=heapify,Heap3.updateItem=updateItem,Heap3.nlargest=nlargest,Heap3.nsmallest=nsmallest;function Heap3(cmp){this.cmp=cmp??defaultCmp,this.nodes=[]}return Heap3.prototype.push=function(x2){return heappush(this.nodes,x2,this.cmp)},Heap3.prototype.pop=function(){return heappop(this.nodes,this.cmp)},Heap3.prototype.peek=function(){return this.nodes[0]},Heap3.prototype.contains=function(x2){return this.nodes.indexOf(x2)!==-1},Heap3.prototype.replace=function(x2){return heapreplace(this.nodes,x2,this.cmp)},Heap3.prototype.pushpop=function(x2){return heappushpop(this.nodes,x2,this.cmp)},Heap3.prototype.heapify=function(){return heapify(this.nodes,this.cmp)},Heap3.prototype.updateItem=function(x2){return updateItem(this.nodes,x2,this.cmp)},Heap3.prototype.clear=function(){return this.nodes=[]},Heap3.prototype.empty=function(){return this.nodes.length===0},Heap3.prototype.size=function(){return this.nodes.length},Heap3.prototype.clone=function(){var heap2;return heap2=new Heap3,heap2.nodes=this.nodes.slice(0),heap2},Heap3.prototype.toArray=function(){return this.nodes.slice(0)},Heap3.prototype.insert=Heap3.prototype.push,Heap3.prototype.top=Heap3.prototype.peek,Heap3.prototype.front=Heap3.prototype.peek,Heap3.prototype.has=Heap3.prototype.contains,Heap3.prototype.copy=Heap3.prototype.clone,Heap3})(),(function(root,factory){return module.exports=factory()})(this,function(){return Heap2})}).call(heap$1)})(heap$2)),heap$2.exports}var heap,hasRequiredHeap;function requireHeap(){return hasRequiredHeap||(hasRequiredHeap=1,heap=requireHeap$1()),heap}var heapExports=requireHeap(),Heap=getDefaultExportFromCjs(heapExports),dijkstraDefaults=defaults$g({root:null,weight:function(edge){return 1},directed:!1}),elesfn$u={dijkstra:function(options2){if(!plainObject(options2)){var args=arguments;options2={root:args[0],weight:args[1],directed:args[2]}}var _dijkstraDefaults=dijkstraDefaults(options2),root=_dijkstraDefaults.root,weight8=_dijkstraDefaults.weight,directed=_dijkstraDefaults.directed,eles=this,weightFn=weight8,source=string(root)?this.filter(root)[0]:root[0],dist3={},prev={},knownDist={},_this$byGroup=this.byGroup(),nodes3=_this$byGroup.nodes,edges3=_this$byGroup.edges;edges3.unmergeBy(function(ele){return ele.isLoop()});for(var getDist3=function(node2){return dist3[node2.id()]},setDist=function(node2,d){dist3[node2.id()]=d,Q.updateItem(node2)},Q=new Heap(function(a,b){return getDist3(a)-getDist3(b)}),i=0;i<nodes3.length;i++){var node=nodes3[i];dist3[node.id()]=node.same(source)?0:1/0,Q.push(node)}for(var distBetween=function(u2,v3){for(var uvs=(directed?u2.edgesTo(v3):u2.edgesWith(v3)).intersect(edges3),smallestDistance=1/0,smallestEdge,_i=0;_i<uvs.length;_i++){var edge=uvs[_i],_weight=weightFn(edge);(_weight<smallestDistance||!smallestEdge)&&(smallestDistance=_weight,smallestEdge=edge)}return{edge:smallestEdge,dist:smallestDistance}};Q.size()>0;){var u=Q.pop(),smalletsDist=getDist3(u),uid=u.id();if(knownDist[uid]=smalletsDist,smalletsDist!==1/0)for(var neighbors=u.neighborhood().intersect(nodes3),_i2=0;_i2<neighbors.length;_i2++){var v=neighbors[_i2],vid=v.id(),vDist=distBetween(u,v),alt=smalletsDist+vDist.dist;alt<getDist3(v)&&(setDist(v,alt),prev[vid]={node:u,edge:vDist.edge})}}return{distanceTo:function(node2){var target=string(node2)?nodes3.filter(node2)[0]:node2[0];return knownDist[target.id()]},pathTo:function(node2){var target=string(node2)?nodes3.filter(node2)[0]:node2[0],S=[],u2=target,uid2=u2.id();if(target.length>0)for(S.unshift(target);prev[uid2];){var p2=prev[uid2];S.unshift(p2.edge),S.unshift(p2.node),u2=p2.node,uid2=u2.id()}return eles.spawn(S)}}}},elesfn$t={kruskal:function(weightFn){weightFn=weightFn||function(edge2){return 1};for(var _this$byGroup=this.byGroup(),nodes3=_this$byGroup.nodes,edges3=_this$byGroup.edges,numNodes=nodes3.length,forest=new Array(numNodes),A=nodes3,findSetIndex=function(ele){for(var i2=0;i2<forest.length;i2++){var eles=forest[i2];if(eles.has(ele))return i2}},i=0;i<numNodes;i++)forest[i]=this.spawn(nodes3[i]);for(var S=edges3.sort(function(a,b){return weightFn(a)-weightFn(b)}),_i=0;_i<S.length;_i++){var edge=S[_i],u=edge.source()[0],v=edge.target()[0],setUIndex=findSetIndex(u),setVIndex=findSetIndex(v),setU=forest[setUIndex],setV=forest[setVIndex];setUIndex!==setVIndex&&(A.merge(edge),setU.merge(setV),forest.splice(setVIndex,1))}return A}},aStarDefaults=defaults$g({root:null,goal:null,weight:function(edge){return 1},heuristic:function(edge){return 0},directed:!1}),elesfn$s={aStar:function(options2){var cy=this.cy(),_aStarDefaults=aStarDefaults(options2),root=_aStarDefaults.root,goal=_aStarDefaults.goal,heuristic2=_aStarDefaults.heuristic,directed=_aStarDefaults.directed,weight8=_aStarDefaults.weight;root=cy.collection(root)[0],goal=cy.collection(goal)[0];var sid=root.id(),tid=goal.id(),gScore={},fScore={},closedSetIds={},openSet=new Heap(function(a,b){return fScore[a.id()]-fScore[b.id()]}),openSetIds=new Set$1,cameFrom={},cameFromEdge={},addToOpenSet=function(ele,id2){openSet.push(ele),openSetIds.add(id2)},cMin,cMinId,popFromOpenSet=function(){cMin=openSet.pop(),cMinId=cMin.id(),openSetIds.delete(cMinId)},isInOpenSet=function(id2){return openSetIds.has(id2)};addToOpenSet(root,sid),gScore[sid]=0,fScore[sid]=heuristic2(root);for(var steps=0;openSet.size()>0;){if(popFromOpenSet(),steps++,cMinId===tid){for(var path=[],pathNode=goal,pathNodeId=tid,pathEdge=cameFromEdge[pathNodeId];path.unshift(pathNode),pathEdge!=null&&path.unshift(pathEdge),pathNode=cameFrom[pathNodeId],pathNode!=null;)pathNodeId=pathNode.id(),pathEdge=cameFromEdge[pathNodeId];return{found:!0,distance:gScore[cMinId],path:this.spawn(path),steps}}closedSetIds[cMinId]=!0;for(var vwEdges=cMin._private.edges,i=0;i<vwEdges.length;i++){var e=vwEdges[i];if(this.hasElementWithId(e.id())&&!(directed&&e.data("source")!==cMinId)){var wSrc=e.source(),wTgt=e.target(),w=wSrc.id()!==cMinId?wSrc:wTgt,wid=w.id();if(this.hasElementWithId(wid)&&!closedSetIds[wid]){var tempScore=gScore[cMinId]+weight8(e);if(!isInOpenSet(wid)){gScore[wid]=tempScore,fScore[wid]=tempScore+heuristic2(w),addToOpenSet(w,wid),cameFrom[wid]=cMin,cameFromEdge[wid]=e;continue}tempScore<gScore[wid]&&(gScore[wid]=tempScore,fScore[wid]=tempScore+heuristic2(w),cameFrom[wid]=cMin,cameFromEdge[wid]=e)}}}}return{found:!1,distance:void 0,path:void 0,steps}}},floydWarshallDefaults=defaults$g({weight:function(edge){return 1},directed:!1}),elesfn$r={floydWarshall:function(options2){for(var cy=this.cy(),_floydWarshallDefault=floydWarshallDefaults(options2),weight8=_floydWarshallDefault.weight,directed=_floydWarshallDefault.directed,weightFn=weight8,_this$byGroup=this.byGroup(),nodes3=_this$byGroup.nodes,edges3=_this$byGroup.edges,N=nodes3.length,Nsq=N*N,indexOf=function(node){return nodes3.indexOf(node)},atIndex=function(i2){return nodes3[i2]},dist3=new Array(Nsq),n=0;n<Nsq;n++){var j=n%N,i=(n-j)/N;i===j?dist3[n]=0:dist3[n]=1/0}for(var next=new Array(Nsq),edgeNext=new Array(Nsq),_i=0;_i<edges3.length;_i++){var edge=edges3[_i],src=edge.source()[0],tgt=edge.target()[0];if(src!==tgt){var s=indexOf(src),t=indexOf(tgt),st=s*N+t,_weight=weightFn(edge);if(dist3[st]>_weight&&(dist3[st]=_weight,next[st]=t,edgeNext[st]=edge),!directed){var ts=t*N+s;!directed&&dist3[ts]>_weight&&(dist3[ts]=_weight,next[ts]=s,edgeNext[ts]=edge)}}}for(var k=0;k<N;k++)for(var _i2=0;_i2<N;_i2++)for(var ik=_i2*N+k,_j=0;_j<N;_j++){var ij=_i2*N+_j,kj=k*N+_j;dist3[ik]+dist3[kj]<dist3[ij]&&(dist3[ij]=dist3[ik]+dist3[kj],next[ij]=next[ik])}var getArgEle=function(ele){return(string(ele)?cy.filter(ele):ele)[0]},indexOfArgEle=function(ele){return indexOf(getArgEle(ele))},res={distance:function(from,to){var i2=indexOfArgEle(from),j2=indexOfArgEle(to);return dist3[i2*N+j2]},path:function(from,to){var i2=indexOfArgEle(from),j2=indexOfArgEle(to),fromNode=atIndex(i2);if(i2===j2)return fromNode.collection();if(next[i2*N+j2]==null)return cy.collection();var path2=cy.collection(),prev=i2,edge2;for(path2.merge(fromNode);i2!==j2;)prev=i2,i2=next[i2*N+j2],edge2=edgeNext[prev*N+i2],path2.merge(edge2),path2.merge(atIndex(i2));return path2}};return res}},bellmanFordDefaults=defaults$g({weight:function(edge){return 1},directed:!1,root:null}),elesfn$q={bellmanFord:function(options2){var _this=this,_bellmanFordDefaults=bellmanFordDefaults(options2),weight8=_bellmanFordDefaults.weight,directed=_bellmanFordDefaults.directed,root=_bellmanFordDefaults.root,weightFn=weight8,eles=this,cy=this.cy(),_this$byGroup=this.byGroup(),edges3=_this$byGroup.edges,nodes3=_this$byGroup.nodes,numNodes=nodes3.length,infoMap=new Map$1,hasNegativeWeightCycle=!1,negativeWeightCycles=[];root=cy.collection(root)[0],edges3.unmergeBy(function(edge2){return edge2.isLoop()});for(var numEdges=edges3.length,getInfo3=function(node2){var obj=infoMap.get(node2.id());return obj||(obj={},infoMap.set(node2.id(),obj)),obj},getNodeFromTo=function(to){return(string(to)?cy.$(to):to)[0]},distanceTo=function(to){return getInfo3(getNodeFromTo(to)).dist},pathTo=function(to){for(var thisStart=arguments.length>1&&arguments[1]!==void 0?arguments[1]:root,end=getNodeFromTo(to),path=[],node2=end;;){if(node2==null)return _this.spawn();var _getInfo=getInfo3(node2),edge2=_getInfo.edge,pred=_getInfo.pred;if(path.unshift(node2[0]),node2.same(thisStart)&&path.length>0)break;edge2!=null&&path.unshift(edge2),node2=pred}return eles.spawn(path)},i=0;i<numNodes;i++){var node=nodes3[i],info=getInfo3(node);node.same(root)?info.dist=0:info.dist=1/0,info.pred=null,info.edge=null}for(var replacedEdge=!1,checkForEdgeReplacement=function(node1,node2,edge2,info1,info2,weight9){var dist3=info1.dist+weight9;dist3<info2.dist&&!edge2.same(info1.edge)&&(info2.dist=dist3,info2.pred=node1,info2.edge=edge2,replacedEdge=!0)},_i=1;_i<numNodes;_i++){replacedEdge=!1;for(var e=0;e<numEdges;e++){var edge=edges3[e],src=edge.source(),tgt=edge.target(),_weight=weightFn(edge),srcInfo=getInfo3(src),tgtInfo=getInfo3(tgt);checkForEdgeReplacement(src,tgt,edge,srcInfo,tgtInfo,_weight),directed||checkForEdgeReplacement(tgt,src,edge,tgtInfo,srcInfo,_weight)}if(!replacedEdge)break}if(replacedEdge)for(var negativeWeightCycleIds=[],_e=0;_e<numEdges;_e++){var _edge=edges3[_e],_src=_edge.source(),_tgt=_edge.target(),_weight2=weightFn(_edge),srcDist=getInfo3(_src).dist,tgtDist=getInfo3(_tgt).dist;if(srcDist+_weight2<tgtDist||!directed&&tgtDist+_weight2<srcDist)if(hasNegativeWeightCycle||(warn("Graph contains a negative weight cycle for Bellman-Ford"),hasNegativeWeightCycle=!0),options2.findNegativeWeightCycles!==!1){var negativeNodes=[];srcDist+_weight2<tgtDist&&negativeNodes.push(_src),!directed&&tgtDist+_weight2<srcDist&&negativeNodes.push(_tgt);for(var numNegativeNodes=negativeNodes.length,n=0;n<numNegativeNodes;n++){var start=negativeNodes[n],cycle=[start];cycle.push(getInfo3(start).edge);for(var _node=getInfo3(start).pred;cycle.indexOf(_node)===-1;)cycle.push(_node),cycle.push(getInfo3(_node).edge),_node=getInfo3(_node).pred;cycle=cycle.slice(cycle.indexOf(_node));for(var smallestId=cycle[0].id(),smallestIndex=0,c=2;c<cycle.length;c+=2)cycle[c].id()<smallestId&&(smallestId=cycle[c].id(),smallestIndex=c);cycle=cycle.slice(smallestIndex).concat(cycle.slice(0,smallestIndex)),cycle.push(cycle[0]);var cycleId=cycle.map(function(el){return el.id()}).join(",");negativeWeightCycleIds.indexOf(cycleId)===-1&&(negativeWeightCycles.push(eles.spawn(cycle)),negativeWeightCycleIds.push(cycleId))}}else break}return{distanceTo,pathTo,hasNegativeWeightCycle,negativeWeightCycles}}},sqrt2=Math.sqrt(2),collapse=function(edgeIndex,nodeMap,remainingEdges){remainingEdges.length===0&&error("Karger-Stein must be run on a connected (sub)graph");for(var edgeInfo=remainingEdges[edgeIndex],sourceIn=edgeInfo[1],targetIn=edgeInfo[2],partition1=nodeMap[sourceIn],partition2=nodeMap[targetIn],newEdges=remainingEdges,i=newEdges.length-1;i>=0;i--){var edge=newEdges[i],src=edge[1],tgt=edge[2];(nodeMap[src]===partition1&&nodeMap[tgt]===partition2||nodeMap[src]===partition2&&nodeMap[tgt]===partition1)&&newEdges.splice(i,1)}for(var _i=0;_i<newEdges.length;_i++){var _edge=newEdges[_i];_edge[1]===partition2?(newEdges[_i]=_edge.slice(),newEdges[_i][1]=partition1):_edge[2]===partition2&&(newEdges[_i]=_edge.slice(),newEdges[_i][2]=partition1)}for(var _i2=0;_i2<nodeMap.length;_i2++)nodeMap[_i2]===partition2&&(nodeMap[_i2]=partition1);return newEdges},contractUntil=function(metaNodeMap,remainingEdges,size3,sizeLimit){for(;size3>sizeLimit;){var edgeIndex=Math.floor(Math.random()*remainingEdges.length);remainingEdges=collapse(edgeIndex,metaNodeMap,remainingEdges),size3--}return remainingEdges},elesfn$p={kargerStein:function(){var _this=this,_this$byGroup=this.byGroup(),nodes3=_this$byGroup.nodes,edges3=_this$byGroup.edges;edges3.unmergeBy(function(edge){return edge.isLoop()});var numNodes=nodes3.length,numEdges=edges3.length,numIter=Math.ceil(Math.pow(Math.log(numNodes)/Math.LN2,2)),stopSize=Math.floor(numNodes/sqrt2);if(numNodes<2){error("At least 2 nodes are required for Karger-Stein algorithm");return}for(var edgeIndexes=[],i=0;i<numEdges;i++){var e=edges3[i];edgeIndexes.push([i,nodes3.indexOf(e.source()),nodes3.indexOf(e.target())])}for(var minCutSize=1/0,minCutEdgeIndexes=[],minCutNodeMap=new Array(numNodes),metaNodeMap=new Array(numNodes),metaNodeMap2=new Array(numNodes),copyNodesMap=function(from,to){for(var _i3=0;_i3<numNodes;_i3++)to[_i3]=from[_i3]},iter=0;iter<=numIter;iter++){for(var _i4=0;_i4<numNodes;_i4++)metaNodeMap[_i4]=_i4;var edgesState=contractUntil(metaNodeMap,edgeIndexes.slice(),numNodes,stopSize),edgesState2=edgesState.slice();copyNodesMap(metaNodeMap,metaNodeMap2);var res1=contractUntil(metaNodeMap,edgesState,stopSize,2),res2=contractUntil(metaNodeMap2,edgesState2,stopSize,2);res1.length<=res2.length&&res1.length<minCutSize?(minCutSize=res1.length,minCutEdgeIndexes=res1,copyNodesMap(metaNodeMap,minCutNodeMap)):res2.length<=res1.length&&res2.length<minCutSize&&(minCutSize=res2.length,minCutEdgeIndexes=res2,copyNodesMap(metaNodeMap2,minCutNodeMap))}for(var cut=this.spawn(minCutEdgeIndexes.map(function(e2){return edges3[e2[0]]})),partition1=this.spawn(),partition2=this.spawn(),witnessNodePartition=minCutNodeMap[0],_i5=0;_i5<minCutNodeMap.length;_i5++){var partitionId=minCutNodeMap[_i5],node=nodes3[_i5];partitionId===witnessNodePartition?partition1.merge(node):partition2.merge(node)}var constructComponent=function(subset){var component2=_this.spawn();return subset.forEach(function(node2){component2.merge(node2),node2.connectedEdges().forEach(function(edge){_this.contains(edge)&&!cut.contains(edge)&&component2.merge(edge)})}),component2},components2=[constructComponent(partition1),constructComponent(partition2)],ret={cut,components:components2,partition1,partition2};return ret}},_Math$hypot,copyPosition=function(p2){return{x:p2.x,y:p2.y}},modelToRenderedPosition$1=function(p2,zoom2,pan2){return{x:p2.x*zoom2+pan2.x,y:p2.y*zoom2+pan2.y}},renderedToModelPosition=function(p2,zoom2,pan2){return{x:(p2.x-pan2.x)/zoom2,y:(p2.y-pan2.y)/zoom2}},array2point=function(arr){return{x:arr[0],y:arr[1]}},min=function(arr){for(var begin=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,end=arguments.length>2&&arguments[2]!==void 0?arguments[2]:arr.length,min4=1/0,i=begin;i<end;i++){var val=arr[i];isFinite(val)&&(min4=Math.min(val,min4))}return min4},max=function(arr){for(var begin=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,end=arguments.length>2&&arguments[2]!==void 0?arguments[2]:arr.length,max5=-1/0,i=begin;i<end;i++){var val=arr[i];isFinite(val)&&(max5=Math.max(val,max5))}return max5},mean=function(arr){for(var begin=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,end=arguments.length>2&&arguments[2]!==void 0?arguments[2]:arr.length,total=0,n=0,i=begin;i<end;i++){var val=arr[i];isFinite(val)&&(total+=val,n++)}return total/n},median=function(arr){var begin=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,end=arguments.length>2&&arguments[2]!==void 0?arguments[2]:arr.length,copy3=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,sort2=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,includeHoles=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;copy3?arr=arr.slice(begin,end):(end<arr.length&&arr.splice(end,arr.length-end),begin>0&&arr.splice(0,begin));for(var off=0,i=arr.length-1;i>=0;i--){var v=arr[i];includeHoles?isFinite(v)||(arr[i]=-1/0,off++):arr.splice(i,1)}sort2&&arr.sort(function(a,b){return a-b});var len=arr.length,mid=Math.floor(len/2);return len%2!==0?arr[mid+1+off]:(arr[mid-1+off]+arr[mid+off])/2},deg2rad=function(deg){return Math.PI*deg/180},getAngleFromDisp=function(dispX,dispY){return Math.atan2(dispY,dispX)-Math.PI/2},log2=Math.log2||function(n){return Math.log(n)/Math.log(2)},signum=function(x2){return x2>0?1:x2<0?-1:0},dist=function(p1,p2){return Math.sqrt(sqdist(p1,p2))},sqdist=function(p1,p2){var dx=p2.x-p1.x,dy=p2.y-p1.y;return dx*dx+dy*dy},inPlaceSumNormalize=function(v){for(var length=v.length,total=0,i=0;i<length;i++)total+=v[i];for(var _i=0;_i<length;_i++)v[_i]=v[_i]/total;return v},qbezierAt=function(p0,p1,p2,t){return(1-t)*(1-t)*p0+2*(1-t)*t*p1+t*t*p2},qbezierPtAt=function(p0,p1,p2,t){return{x:qbezierAt(p0.x,p1.x,p2.x,t),y:qbezierAt(p0.y,p1.y,p2.y,t)}},lineAt=function(p0,p1,t,d){var vec={x:p1.x-p0.x,y:p1.y-p0.y},vecDist=dist(p0,p1),normVec={x:vec.x/vecDist,y:vec.y/vecDist};return t=t??0,d=d??t*vecDist,{x:p0.x+normVec.x*d,y:p0.y+normVec.y*d}},bound=function(min4,val,max5){return Math.max(min4,Math.min(max5,val))},makeBoundingBox=function(bb){if(bb==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(bb.x1!=null&&bb.y1!=null){if(bb.x2!=null&&bb.y2!=null&&bb.x2>=bb.x1&&bb.y2>=bb.y1)return{x1:bb.x1,y1:bb.y1,x2:bb.x2,y2:bb.y2,w:bb.x2-bb.x1,h:bb.y2-bb.y1};if(bb.w!=null&&bb.h!=null&&bb.w>=0&&bb.h>=0)return{x1:bb.x1,y1:bb.y1,x2:bb.x1+bb.w,y2:bb.y1+bb.h,w:bb.w,h:bb.h}}},copyBoundingBox=function(bb){return{x1:bb.x1,x2:bb.x2,w:bb.w,y1:bb.y1,y2:bb.y2,h:bb.h}},clearBoundingBox=function(bb){bb.x1=1/0,bb.y1=1/0,bb.x2=-1/0,bb.y2=-1/0,bb.w=0,bb.h=0},updateBoundingBox=function(bb1,bb2){bb1.x1=Math.min(bb1.x1,bb2.x1),bb1.x2=Math.max(bb1.x2,bb2.x2),bb1.w=bb1.x2-bb1.x1,bb1.y1=Math.min(bb1.y1,bb2.y1),bb1.y2=Math.max(bb1.y2,bb2.y2),bb1.h=bb1.y2-bb1.y1},expandBoundingBoxByPoint=function(bb,x2,y2){bb.x1=Math.min(bb.x1,x2),bb.x2=Math.max(bb.x2,x2),bb.w=bb.x2-bb.x1,bb.y1=Math.min(bb.y1,y2),bb.y2=Math.max(bb.y2,y2),bb.h=bb.y2-bb.y1},expandBoundingBox=function(bb){var padding=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return bb.x1-=padding,bb.x2+=padding,bb.y1-=padding,bb.y2+=padding,bb.w=bb.x2-bb.x1,bb.h=bb.y2-bb.y1,bb},expandBoundingBoxSides=function(bb){var padding=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],top,right,bottom,left;if(padding.length===1)top=right=bottom=left=padding[0];else if(padding.length===2)top=bottom=padding[0],left=right=padding[1];else if(padding.length===4){var _padding=_slicedToArray(padding,4);top=_padding[0],right=_padding[1],bottom=_padding[2],left=_padding[3]}return bb.x1-=left,bb.x2+=right,bb.y1-=top,bb.y2+=bottom,bb.w=bb.x2-bb.x1,bb.h=bb.y2-bb.y1,bb},assignBoundingBox=function(bb1,bb2){bb1.x1=bb2.x1,bb1.y1=bb2.y1,bb1.x2=bb2.x2,bb1.y2=bb2.y2,bb1.w=bb1.x2-bb1.x1,bb1.h=bb1.y2-bb1.y1},boundingBoxesIntersect=function(bb1,bb2){return!(bb1.x1>bb2.x2||bb2.x1>bb1.x2||bb1.x2<bb2.x1||bb2.x2<bb1.x1||bb1.y2<bb2.y1||bb2.y2<bb1.y1||bb1.y1>bb2.y2||bb2.y1>bb1.y2)},inBoundingBox=function(bb,x2,y2){return bb.x1<=x2&&x2<=bb.x2&&bb.y1<=y2&&y2<=bb.y2},pointInBoundingBox=function(bb,pt){return inBoundingBox(bb,pt.x,pt.y)},boundingBoxInBoundingBox=function(bb1,bb2){return inBoundingBox(bb1,bb2.x1,bb2.y1)&&inBoundingBox(bb1,bb2.x2,bb2.y2)},hypot=(_Math$hypot=Math.hypot)!==null&&_Math$hypot!==void 0?_Math$hypot:function(x2,y2){return Math.sqrt(x2*x2+y2*y2)};function inflatePolygon(polygon2,d){if(polygon2.length<3)throw new Error("Need at least 3 vertices");var add3=function(a,b){return{x:a.x+b.x,y:a.y+b.y}},sub=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},scale2=function(v,s){return{x:v.x*s,y:v.y*s}},cross=function(u,v){return u.x*v.y-u.y*v.x},normalize3=function(v){var len=hypot(v.x,v.y);return len===0?{x:0,y:0}:{x:v.x/len,y:v.y/len}},signedArea=function(pts3){for(var A=0,i2=0;i2<pts3.length;i2++){var p3=pts3[i2],q2=pts3[(i2+1)%pts3.length];A+=p3.x*q2.y-q2.x*p3.y}return A/2},intersectLines=function(p1,p22,p3,p4){var r=sub(p22,p1),s=sub(p4,p3),denom=cross(r,s);if(Math.abs(denom)<1e-9)return add3(p1,scale2(r,.5));var t=cross(sub(p3,p1),s)/denom;return add3(p1,scale2(r,t))},pts2=polygon2.map(function(p3){return{x:p3.x,y:p3.y}});signedArea(pts2)<0&&pts2.reverse();for(var n=pts2.length,normals=[],i=0;i<n;i++){var p2=pts2[i],q=pts2[(i+1)%n],edge=sub(q,p2),out=normalize3({x:edge.y,y:-edge.x});normals.push(out)}for(var offsetEdges=normals.map(function(nrm,i2){var p1=add3(pts2[i2],scale2(nrm,d)),p22=add3(pts2[(i2+1)%n],scale2(nrm,d));return{p1,p2:p22}}),inflated=[],_i2=0;_i2<n;_i2++){var prevEdge=offsetEdges[(_i2-1+n)%n],currEdge=offsetEdges[_i2],ip=intersectLines(prevEdge.p1,prevEdge.p2,currEdge.p1,currEdge.p2);inflated.push(ip)}return inflated}function miterBox(pts2,centerX,centerY,width2,height2,strokeWidth){var tpts=transformPoints(pts2,centerX,centerY,width2,height2),offsetPoints=inflatePolygon(tpts,strokeWidth),bb=makeBoundingBox();return offsetPoints.forEach(function(pt){return expandBoundingBoxByPoint(bb,pt.x,pt.y)}),bb}var roundRectangleIntersectLine=function(x2,y2,nodeX,nodeY,width2,height2,padding){var radius2=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",cornerRadius=radius2==="auto"?getRoundRectangleRadius(width2,height2):radius2,halfWidth=width2/2,halfHeight=height2/2;cornerRadius=Math.min(cornerRadius,halfWidth,halfHeight);var doWidth=cornerRadius!==halfWidth,doHeight=cornerRadius!==halfHeight,straightLineIntersections;if(doWidth){var topStartX=nodeX-halfWidth+cornerRadius-padding,topStartY=nodeY-halfHeight-padding,topEndX=nodeX+halfWidth-cornerRadius+padding,topEndY=topStartY;if(straightLineIntersections=finiteLinesIntersect(x2,y2,nodeX,nodeY,topStartX,topStartY,topEndX,topEndY,!1),straightLineIntersections.length>0)return straightLineIntersections}if(doHeight){var rightStartX=nodeX+halfWidth+padding,rightStartY=nodeY-halfHeight+cornerRadius-padding,rightEndX=rightStartX,rightEndY=nodeY+halfHeight-cornerRadius+padding;if(straightLineIntersections=finiteLinesIntersect(x2,y2,nodeX,nodeY,rightStartX,rightStartY,rightEndX,rightEndY,!1),straightLineIntersections.length>0)return straightLineIntersections}if(doWidth){var bottomStartX=nodeX-halfWidth+cornerRadius-padding,bottomStartY=nodeY+halfHeight+padding,bottomEndX=nodeX+halfWidth-cornerRadius+padding,bottomEndY=bottomStartY;if(straightLineIntersections=finiteLinesIntersect(x2,y2,nodeX,nodeY,bottomStartX,bottomStartY,bottomEndX,bottomEndY,!1),straightLineIntersections.length>0)return straightLineIntersections}if(doHeight){var leftStartX=nodeX-halfWidth-padding,leftStartY=nodeY-halfHeight+cornerRadius-padding,leftEndX=leftStartX,leftEndY=nodeY+halfHeight-cornerRadius+padding;if(straightLineIntersections=finiteLinesIntersect(x2,y2,nodeX,nodeY,leftStartX,leftStartY,leftEndX,leftEndY,!1),straightLineIntersections.length>0)return straightLineIntersections}var arcIntersections;{var topLeftCenterX=nodeX-halfWidth+cornerRadius,topLeftCenterY=nodeY-halfHeight+cornerRadius;if(arcIntersections=intersectLineCircle(x2,y2,nodeX,nodeY,topLeftCenterX,topLeftCenterY,cornerRadius+padding),arcIntersections.length>0&&arcIntersections[0]<=topLeftCenterX&&arcIntersections[1]<=topLeftCenterY)return[arcIntersections[0],arcIntersections[1]]}{var topRightCenterX=nodeX+halfWidth-cornerRadius,topRightCenterY=nodeY-halfHeight+cornerRadius;if(arcIntersections=intersectLineCircle(x2,y2,nodeX,nodeY,topRightCenterX,topRightCenterY,cornerRadius+padding),arcIntersections.length>0&&arcIntersections[0]>=topRightCenterX&&arcIntersections[1]<=topRightCenterY)return[arcIntersections[0],arcIntersections[1]]}{var bottomRightCenterX=nodeX+halfWidth-cornerRadius,bottomRightCenterY=nodeY+halfHeight-cornerRadius;if(arcIntersections=intersectLineCircle(x2,y2,nodeX,nodeY,bottomRightCenterX,bottomRightCenterY,cornerRadius+padding),arcIntersections.length>0&&arcIntersections[0]>=bottomRightCenterX&&arcIntersections[1]>=bottomRightCenterY)return[arcIntersections[0],arcIntersections[1]]}{var bottomLeftCenterX=nodeX-halfWidth+cornerRadius,bottomLeftCenterY=nodeY+halfHeight-cornerRadius;if(arcIntersections=intersectLineCircle(x2,y2,nodeX,nodeY,bottomLeftCenterX,bottomLeftCenterY,cornerRadius+padding),arcIntersections.length>0&&arcIntersections[0]<=bottomLeftCenterX&&arcIntersections[1]>=bottomLeftCenterY)return[arcIntersections[0],arcIntersections[1]]}return[]},inLineVicinity=function(x2,y2,lx1,ly1,lx2,ly2,tolerance){var t=tolerance,x1=Math.min(lx1,lx2),x22=Math.max(lx1,lx2),y1=Math.min(ly1,ly2),y22=Math.max(ly1,ly2);return x1-t<=x2&&x2<=x22+t&&y1-t<=y2&&y2<=y22+t},inBezierVicinity=function(x2,y2,x1,y1,x22,y22,x3,y3,tolerance){var bb={x1:Math.min(x1,x3,x22)-tolerance,x2:Math.max(x1,x3,x22)+tolerance,y1:Math.min(y1,y3,y22)-tolerance,y2:Math.max(y1,y3,y22)+tolerance};return!(x2<bb.x1||x2>bb.x2||y2<bb.y1||y2>bb.y2)},solveQuadratic=function(a,b,c,val){c-=val;var r=b*b-4*a*c;if(r<0)return[];var sqrtR=Math.sqrt(r),denom=2*a,root1=(-b+sqrtR)/denom,root2=(-b-sqrtR)/denom;return[root1,root2]},solveCubic=function(a,b,c,d,result){var epsilon=1e-5;a===0&&(a=epsilon),b/=a,c/=a,d/=a;var discriminant,q,r,dum1,s,t,term1,r13;if(q=(3*c-b*b)/9,r=-(27*d)+b*(9*c-2*(b*b)),r/=54,discriminant=q*q*q+r*r,result[1]=0,term1=b/3,discriminant>0){s=r+Math.sqrt(discriminant),s=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),t=r-Math.sqrt(discriminant),t=t<0?-Math.pow(-t,1/3):Math.pow(t,1/3),result[0]=-term1+s+t,term1+=(s+t)/2,result[4]=result[2]=-term1,term1=Math.sqrt(3)*(-t+s)/2,result[3]=term1,result[5]=-term1;return}if(result[5]=result[3]=0,discriminant===0){r13=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3),result[0]=-term1+2*r13,result[4]=result[2]=-(r13+term1);return}q=-q,dum1=q*q*q,dum1=Math.acos(r/Math.sqrt(dum1)),r13=2*Math.sqrt(q),result[0]=-term1+r13*Math.cos(dum1/3),result[2]=-term1+r13*Math.cos((dum1+2*Math.PI)/3),result[4]=-term1+r13*Math.cos((dum1+4*Math.PI)/3)},sqdistToQuadraticBezier=function(x2,y2,x1,y1,x22,y22,x3,y3){var a=1*x1*x1-4*x1*x22+2*x1*x3+4*x22*x22-4*x22*x3+x3*x3+y1*y1-4*y1*y22+2*y1*y3+4*y22*y22-4*y22*y3+y3*y3,b=9*x1*x22-3*x1*x1-3*x1*x3-6*x22*x22+3*x22*x3+9*y1*y22-3*y1*y1-3*y1*y3-6*y22*y22+3*y22*y3,c=3*x1*x1-6*x1*x22+x1*x3-x1*x2+2*x22*x22+2*x22*x2-x3*x2+3*y1*y1-6*y1*y22+y1*y3-y1*y2+2*y22*y22+2*y22*y2-y3*y2,d=1*x1*x22-x1*x1+x1*x2-x22*x2+y1*y22-y1*y1+y1*y2-y22*y2,roots=[];solveCubic(a,b,c,d,roots);for(var zeroThreshold=1e-7,params=[],index=0;index<6;index+=2)Math.abs(roots[index+1])<zeroThreshold&&roots[index]>=0&&roots[index]<=1&¶ms.push(roots[index]);params.push(1),params.push(0);for(var minDistanceSquared=-1,curX,curY,distSquared,i=0;i<params.length;i++)curX=Math.pow(1-params[i],2)*x1+2*(1-params[i])*params[i]*x22+params[i]*params[i]*x3,curY=Math.pow(1-params[i],2)*y1+2*(1-params[i])*params[i]*y22+params[i]*params[i]*y3,distSquared=Math.pow(curX-x2,2)+Math.pow(curY-y2,2),minDistanceSquared>=0?distSquared<minDistanceSquared&&(minDistanceSquared=distSquared):minDistanceSquared=distSquared;return minDistanceSquared},sqdistToFiniteLine=function(x2,y2,x1,y1,x22,y22){var offset=[x2-x1,y2-y1],line=[x22-x1,y22-y1],lineSq=line[0]*line[0]+line[1]*line[1],hypSq=offset[0]*offset[0]+offset[1]*offset[1],dotProduct=offset[0]*line[0]+offset[1]*line[1],adjSq=dotProduct*dotProduct/lineSq;return dotProduct<0?hypSq:adjSq>lineSq?(x2-x22)*(x2-x22)+(y2-y22)*(y2-y22):hypSq-adjSq},pointInsidePolygonPoints=function(x2,y2,points){for(var x1,y1,x22,y22,y3,up=0,i=0;i<points.length/2;i++)if(x1=points[i*2],y1=points[i*2+1],i+1<points.length/2?(x22=points[(i+1)*2],y22=points[(i+1)*2+1]):(x22=points[(i+1-points.length/2)*2],y22=points[(i+1-points.length/2)*2+1]),!(x1==x2&&x22==x2))if(x1>=x2&&x2>=x22||x1<=x2&&x2<=x22)y3=(x2-x1)/(x22-x1)*(y22-y1)+y1,y3>y2&&up++;else continue;return up%2!==0},pointInsidePolygon=function(x2,y2,basePoints,centerX,centerY,width2,height2,direction,padding){var transformedPoints=new Array(basePoints.length),angle2;direction[0]!=null?(angle2=Math.atan(direction[1]/direction[0]),direction[0]<0?angle2=angle2+Math.PI/2:angle2=-angle2-Math.PI/2):angle2=direction;for(var cos2=Math.cos(-angle2),sin2=Math.sin(-angle2),i=0;i<transformedPoints.length/2;i++)transformedPoints[i*2]=width2/2*(basePoints[i*2]*cos2-basePoints[i*2+1]*sin2),transformedPoints[i*2+1]=height2/2*(basePoints[i*2+1]*cos2+basePoints[i*2]*sin2),transformedPoints[i*2]+=centerX,transformedPoints[i*2+1]+=centerY;var points;if(padding>0){var expandedLineSet=expandPolygon(transformedPoints,-padding);points=joinLines(expandedLineSet)}else points=transformedPoints;return pointInsidePolygonPoints(x2,y2,points)},pointInsideRoundPolygon=function(x2,y2,basePoints,centerX,centerY,width2,height2,corners){for(var cutPolygonPoints=new Array(basePoints.length*2),i=0;i<corners.length;i++){var corner=corners[i];cutPolygonPoints[i*4+0]=corner.startX,cutPolygonPoints[i*4+1]=corner.startY,cutPolygonPoints[i*4+2]=corner.stopX,cutPolygonPoints[i*4+3]=corner.stopY;var squaredDistance=Math.pow(corner.cx-x2,2)+Math.pow(corner.cy-y2,2);if(squaredDistance<=Math.pow(corner.radius,2))return!0}return pointInsidePolygonPoints(x2,y2,cutPolygonPoints)},joinLines=function(lineSet){for(var vertices=new Array(lineSet.length/2),currentLineStartX,currentLineStartY,currentLineEndX,currentLineEndY,nextLineStartX,nextLineStartY,nextLineEndX,nextLineEndY,i=0;i<lineSet.length/4;i++){currentLineStartX=lineSet[i*4],currentLineStartY=lineSet[i*4+1],currentLineEndX=lineSet[i*4+2],currentLineEndY=lineSet[i*4+3],i<lineSet.length/4-1?(nextLineStartX=lineSet[(i+1)*4],nextLineStartY=lineSet[(i+1)*4+1],nextLineEndX=lineSet[(i+1)*4+2],nextLineEndY=lineSet[(i+1)*4+3]):(nextLineStartX=lineSet[0],nextLineStartY=lineSet[1],nextLineEndX=lineSet[2],nextLineEndY=lineSet[3]);var intersection2=finiteLinesIntersect(currentLineStartX,currentLineStartY,currentLineEndX,currentLineEndY,nextLineStartX,nextLineStartY,nextLineEndX,nextLineEndY,!0);vertices[i*2]=intersection2[0],vertices[i*2+1]=intersection2[1]}return vertices},expandPolygon=function(points,pad){for(var expandedLineSet=new Array(points.length*2),currentPointX,currentPointY,nextPointX,nextPointY,i=0;i<points.length/2;i++){currentPointX=points[i*2],currentPointY=points[i*2+1],i<points.length/2-1?(nextPointX=points[(i+1)*2],nextPointY=points[(i+1)*2+1]):(nextPointX=points[0],nextPointY=points[1]);var offsetX=nextPointY-currentPointY,offsetY=-(nextPointX-currentPointX),offsetLength=Math.sqrt(offsetX*offsetX+offsetY*offsetY),normalizedOffsetX=offsetX/offsetLength,normalizedOffsetY=offsetY/offsetLength;expandedLineSet[i*4]=currentPointX+normalizedOffsetX*pad,expandedLineSet[i*4+1]=currentPointY+normalizedOffsetY*pad,expandedLineSet[i*4+2]=nextPointX+normalizedOffsetX*pad,expandedLineSet[i*4+3]=nextPointY+normalizedOffsetY*pad}return expandedLineSet},intersectLineEllipse=function(x2,y2,centerX,centerY,ellipseWradius,ellipseHradius){var dispX=centerX-x2,dispY=centerY-y2;dispX/=ellipseWradius,dispY/=ellipseHradius;var len=Math.sqrt(dispX*dispX+dispY*dispY),newLength=len-1;if(newLength<0)return[];var lenProportion=newLength/len;return[(centerX-x2)*lenProportion+x2,(centerY-y2)*lenProportion+y2]},checkInEllipse=function(x2,y2,width2,height2,centerX,centerY,padding){return x2-=centerX,y2-=centerY,x2/=width2/2+padding,y2/=height2/2+padding,x2*x2+y2*y2<=1},intersectLineCircle=function(x1,y1,x2,y2,centerX,centerY,radius2){var d=[x2-x1,y2-y1],f=[x1-centerX,y1-centerY],a=d[0]*d[0]+d[1]*d[1],b=2*(f[0]*d[0]+f[1]*d[1]),c=f[0]*f[0]+f[1]*f[1]-radius2*radius2,discriminant=b*b-4*a*c;if(discriminant<0)return[];var t1=(-b+Math.sqrt(discriminant))/(2*a),t2=(-b-Math.sqrt(discriminant))/(2*a),tMin=Math.min(t1,t2),tMax=Math.max(t1,t2),inRangeParams=[];if(tMin>=0&&tMin<=1&&inRangeParams.push(tMin),tMax>=0&&tMax<=1&&inRangeParams.push(tMax),inRangeParams.length===0)return[];var nearIntersectionX=inRangeParams[0]*d[0]+x1,nearIntersectionY=inRangeParams[0]*d[1]+y1;if(inRangeParams.length>1){if(inRangeParams[0]==inRangeParams[1])return[nearIntersectionX,nearIntersectionY];var farIntersectionX=inRangeParams[1]*d[0]+x1,farIntersectionY=inRangeParams[1]*d[1]+y1;return[nearIntersectionX,nearIntersectionY,farIntersectionX,farIntersectionY]}else return[nearIntersectionX,nearIntersectionY]},midOfThree=function(a,b,c){return b<=a&&a<=c||c<=a&&a<=b?a:a<=b&&b<=c||c<=b&&b<=a?b:c},finiteLinesIntersect=function(x1,y1,x2,y2,x3,y3,x4,y4,infiniteLines){var dx13=x1-x3,dx21=x2-x1,dx43=x4-x3,dy13=y1-y3,dy21=y2-y1,dy43=y4-y3,ua_t=dx43*dy13-dy43*dx13,ub_t=dx21*dy13-dy21*dx13,u_b=dy43*dx21-dx43*dy21;if(u_b!==0){var ua=ua_t/u_b,ub=ub_t/u_b,flptThreshold=.001,_min=0-flptThreshold,_max=1+flptThreshold;return _min<=ua&&ua<=_max&&_min<=ub&&ub<=_max?[x1+ua*dx21,y1+ua*dy21]:infiniteLines?[x1+ua*dx21,y1+ua*dy21]:[]}else return ua_t===0||ub_t===0?midOfThree(x1,x2,x4)===x4?[x4,y4]:midOfThree(x1,x2,x3)===x3?[x3,y3]:midOfThree(x3,x4,x2)===x2?[x2,y2]:[]:[]},transformPoints=function(points,centerX,centerY,width2,height2){var ret=[],halfW=width2/2,halfH=height2/2,x2=centerX,y2=centerY;ret.push({x:x2+halfW*points[0],y:y2+halfH*points[1]});for(var i=1;i<points.length/2;i++)ret.push({x:x2+halfW*points[i*2],y:y2+halfH*points[i*2+1]});return ret},polygonIntersectLine=function(x2,y2,basePoints,centerX,centerY,width2,height2,padding){var intersections=[],intersection2,transformedPoints=new Array(basePoints.length),doTransform=!0;width2==null&&(doTransform=!1);var points;if(doTransform){for(var i=0;i<transformedPoints.length/2;i++)transformedPoints[i*2]=basePoints[i*2]*width2+centerX,transformedPoints[i*2+1]=basePoints[i*2+1]*height2+centerY;if(padding>0){var expandedLineSet=expandPolygon(transformedPoints,-padding);points=joinLines(expandedLineSet)}else points=transformedPoints}else points=basePoints;for(var currentX,currentY,nextX,nextY,_i3=0;_i3<points.length/2;_i3++)currentX=points[_i3*2],currentY=points[_i3*2+1],_i3<points.length/2-1?(nextX=points[(_i3+1)*2],nextY=points[(_i3+1)*2+1]):(nextX=points[0],nextY=points[1]),intersection2=finiteLinesIntersect(x2,y2,centerX,centerY,currentX,currentY,nextX,nextY),intersection2.length!==0&&intersections.push(intersection2[0],intersection2[1]);return intersections},roundPolygonIntersectLine=function(x2,y2,basePoints,centerX,centerY,width2,height2,padding,corners){var intersections=[],intersection2,lines=new Array(basePoints.length*2);corners.forEach(function(corner,i2){i2===0?(lines[lines.length-2]=corner.startX,lines[lines.length-1]=corner.startY):(lines[i2*4-2]=corner.startX,lines[i2*4-1]=corner.startY),lines[i2*4]=corner.stopX,lines[i2*4+1]=corner.stopY,intersection2=intersectLineCircle(x2,y2,centerX,centerY,corner.cx,corner.cy,corner.radius),intersection2.length!==0&&intersections.push(intersection2[0],intersection2[1])});for(var i=0;i<lines.length/4;i++)intersection2=finiteLinesIntersect(x2,y2,centerX,centerY,lines[i*4],lines[i*4+1],lines[i*4+2],lines[i*4+3],!1),intersection2.length!==0&&intersections.push(intersection2[0],intersection2[1]);if(intersections.length>2){for(var lowestIntersection=[intersections[0],intersections[1]],lowestSquaredDistance=Math.pow(lowestIntersection[0]-x2,2)+Math.pow(lowestIntersection[1]-y2,2),_i4=1;_i4<intersections.length/2;_i4++){var squaredDistance=Math.pow(intersections[_i4*2]-x2,2)+Math.pow(intersections[_i4*2+1]-y2,2);squaredDistance<=lowestSquaredDistance&&(lowestIntersection[0]=intersections[_i4*2],lowestIntersection[1]=intersections[_i4*2+1],lowestSquaredDistance=squaredDistance)}return lowestIntersection}return intersections},shortenIntersection=function(intersection2,offset,amount){var disp=[intersection2[0]-offset[0],intersection2[1]-offset[1]],length=Math.sqrt(disp[0]*disp[0]+disp[1]*disp[1]),lenRatio=(length-amount)/length;return lenRatio<0&&(lenRatio=1e-5),[offset[0]+lenRatio*disp[0],offset[1]+lenRatio*disp[1]]},generateUnitNgonPointsFitToSquare=function(sides,rotationRadians){var points=generateUnitNgonPoints(sides,rotationRadians);return points=fitPolygonToSquare(points),points},fitPolygonToSquare=function(points){for(var x2,y2,sides=points.length/2,minX=1/0,minY=1/0,maxX=-1/0,maxY=-1/0,i=0;i<sides;i++)x2=points[2*i],y2=points[2*i+1],minX=Math.min(minX,x2),maxX=Math.max(maxX,x2),minY=Math.min(minY,y2),maxY=Math.max(maxY,y2);for(var sx=2/(maxX-minX),sy=2/(maxY-minY),_i5=0;_i5<sides;_i5++)x2=points[2*_i5]=points[2*_i5]*sx,y2=points[2*_i5+1]=points[2*_i5+1]*sy,minX=Math.min(minX,x2),maxX=Math.max(maxX,x2),minY=Math.min(minY,y2),maxY=Math.max(maxY,y2);if(minY<-1)for(var _i6=0;_i6<sides;_i6++)y2=points[2*_i6+1]=points[2*_i6+1]+(-1-minY);return points},generateUnitNgonPoints=function(sides,rotationRadians){var increment=1/sides*2*Math.PI,startAngle=sides%2===0?Math.PI/2+increment/2:Math.PI/2;startAngle+=rotationRadians;for(var points=new Array(sides*2),currentAngle,i=0;i<sides;i++)currentAngle=i*increment+startAngle,points[2*i]=Math.cos(currentAngle),points[2*i+1]=Math.sin(-currentAngle);return points},getRoundRectangleRadius=function(width2,height2){return Math.min(width2/4,height2/4,8)},getRoundPolygonRadius=function(width2,height2){return Math.min(width2/10,height2/10,8)},getCutRectangleCornerLength=function(){return 8},bezierPtsToQuadCoeff=function(p0,p1,p2){return[p0-2*p1+p2,2*(p1-p0),p0]},getBarrelCurveConstants=function(width2,height2){return{heightOffset:Math.min(15,.05*height2),widthOffset:Math.min(100,.25*width2),ctrlPtOffsetPct:.05}};function satPolygonIntersection(poly1,poly2){function getAxes(polygon2){for(var axes2=[],i=0;i<polygon2.length;i++){var p1=polygon2[i],p2=polygon2[(i+1)%polygon2.length],edge={x:p2.x-p1.x,y:p2.y-p1.y},normal={x:-edge.y,y:edge.x},length=Math.sqrt(normal.x*normal.x+normal.y*normal.y);axes2.push({x:normal.x/length,y:normal.y/length})}return axes2}function project(polygon2,axis2){var min4=1/0,max5=-1/0,_iterator=_createForOfIteratorHelper(polygon2),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var point=_step.value,projection2=point.x*axis2.x+point.y*axis2.y;min4=Math.min(min4,projection2),max5=Math.max(max5,projection2)}}catch(err){_iterator.e(err)}finally{_iterator.f()}return{min:min4,max:max5}}function overlaps(proj12,proj22){return!(proj12.max<proj22.min||proj22.max<proj12.min)}var axes=[].concat(_toConsumableArray(getAxes(poly1)),_toConsumableArray(getAxes(poly2))),_iterator2=_createForOfIteratorHelper(axes),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var axis=_step2.value,proj1=project(poly1,axis),proj2=project(poly2,axis);if(!overlaps(proj1,proj2))return!1}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}return!0}var pageRankDefaults=defaults$g({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(edge){return 1}}),elesfn$o={pageRank:function(options2){for(var _pageRankDefaults=pageRankDefaults(options2),dampingFactor=_pageRankDefaults.dampingFactor,precision=_pageRankDefaults.precision,iterations=_pageRankDefaults.iterations,weight8=_pageRankDefaults.weight,cy=this._private.cy,_this$byGroup=this.byGroup(),nodes3=_this$byGroup.nodes,edges3=_this$byGroup.edges,numNodes=nodes3.length,numNodesSqd=numNodes*numNodes,numEdges=edges3.length,matrix=new Array(numNodesSqd),columnSum=new Array(numNodes),additionalProb=(1-dampingFactor)/numNodes,i=0;i<numNodes;i++){for(var j=0;j<numNodes;j++){var n=i*numNodes+j;matrix[n]=0}columnSum[i]=0}for(var _i=0;_i<numEdges;_i++){var edge=edges3[_i],srcId=edge.data("source"),tgtId=edge.data("target");if(srcId!==tgtId){var s=nodes3.indexOfId(srcId),t=nodes3.indexOfId(tgtId),w=weight8(edge),_n=t*numNodes+s;matrix[_n]+=w,columnSum[s]+=w}}for(var p2=1/numNodes+additionalProb,_j=0;_j<numNodes;_j++)if(columnSum[_j]===0)for(var _i2=0;_i2<numNodes;_i2++){var _n2=_i2*numNodes+_j;matrix[_n2]=p2}else for(var _i3=0;_i3<numNodes;_i3++){var _n3=_i3*numNodes+_j;matrix[_n3]=matrix[_n3]/columnSum[_j]+additionalProb}for(var eigenvector=new Array(numNodes),temp=new Array(numNodes),previous,_i4=0;_i4<numNodes;_i4++)eigenvector[_i4]=1;for(var iter=0;iter<iterations;iter++){for(var _i5=0;_i5<numNodes;_i5++)temp[_i5]=0;for(var _i6=0;_i6<numNodes;_i6++)for(var _j2=0;_j2<numNodes;_j2++){var _n4=_i6*numNodes+_j2;temp[_i6]+=matrix[_n4]*eigenvector[_j2]}inPlaceSumNormalize(temp),previous=eigenvector,eigenvector=temp,temp=previous;for(var diff2=0,_i7=0;_i7<numNodes;_i7++){var delta=previous[_i7]-eigenvector[_i7];diff2+=delta*delta}if(diff2<precision)break}var res={rank:function(node){return node=cy.collection(node)[0],eigenvector[nodes3.indexOf(node)]}};return res}},defaults$f=defaults$g({root:null,weight:function(edge){return 1},directed:!1,alpha:0}),elesfn$n={degreeCentralityNormalized:function(options2){options2=defaults$f(options2);var cy=this.cy(),nodes3=this.nodes(),numNodes=nodes3.length;if(options2.directed){for(var indegrees={},outdegrees={},maxIndegree=0,maxOutdegree=0,_i=0;_i<numNodes;_i++){var _node=nodes3[_i],id2=_node.id();options2.root=_node;var _currDegree=this.degreeCentrality(options2);maxIndegree<_currDegree.indegree&&(maxIndegree=_currDegree.indegree),maxOutdegree<_currDegree.outdegree&&(maxOutdegree=_currDegree.outdegree),indegrees[id2]=_currDegree.indegree,outdegrees[id2]=_currDegree.outdegree}return{indegree:function(node2){return maxIndegree==0?0:(string(node2)&&(node2=cy.filter(node2)),indegrees[node2.id()]/maxIndegree)},outdegree:function(node2){return maxOutdegree===0?0:(string(node2)&&(node2=cy.filter(node2)),outdegrees[node2.id()]/maxOutdegree)}}}else{for(var degrees={},maxDegree=0,i=0;i<numNodes;i++){var node=nodes3[i];options2.root=node;var currDegree=this.degreeCentrality(options2);maxDegree<currDegree.degree&&(maxDegree=currDegree.degree),degrees[node.id()]=currDegree.degree}return{degree:function(node2){return maxDegree===0?0:(string(node2)&&(node2=cy.filter(node2)),degrees[node2.id()]/maxDegree)}}}},degreeCentrality:function(options2){options2=defaults$f(options2);var cy=this.cy(),callingEles=this,_options=options2,root=_options.root,weight8=_options.weight,directed=_options.directed,alpha=_options.alpha;if(root=cy.collection(root)[0],directed){for(var edges3=root.connectedEdges(),incoming=edges3.filter(function(edge){return edge.target().same(root)&&callingEles.has(edge)}),outgoing=edges3.filter(function(edge){return edge.source().same(root)&&callingEles.has(edge)}),k_in=incoming.length,k_out=outgoing.length,s_in=0,s_out=0,_i2=0;_i2<incoming.length;_i2++)s_in+=weight8(incoming[_i2]);for(var _i3=0;_i3<outgoing.length;_i3++)s_out+=weight8(outgoing[_i3]);return{indegree:Math.pow(k_in,1-alpha)*Math.pow(s_in,alpha),outdegree:Math.pow(k_out,1-alpha)*Math.pow(s_out,alpha)}}else{for(var connEdges=root.connectedEdges().intersection(callingEles),k=connEdges.length,s=0,i=0;i<connEdges.length;i++)s+=weight8(connEdges[i]);return{degree:Math.pow(k,1-alpha)*Math.pow(s,alpha)}}}};elesfn$n.dc=elesfn$n.degreeCentrality;elesfn$n.dcn=elesfn$n.degreeCentralityNormalised=elesfn$n.degreeCentralityNormalized;var defaults$e=defaults$g({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),elesfn$m={closenessCentralityNormalized:function(options2){for(var _defaults=defaults$e(options2),harmonic=_defaults.harmonic,weight8=_defaults.weight,directed=_defaults.directed,cy=this.cy(),closenesses={},maxCloseness=0,nodes3=this.nodes(),fw=this.floydWarshall({weight:weight8,directed}),i=0;i<nodes3.length;i++){for(var currCloseness=0,node_i=nodes3[i],j=0;j<nodes3.length;j++)if(i!==j){var d=fw.distance(node_i,nodes3[j]);harmonic?currCloseness+=1/d:currCloseness+=d}harmonic||(currCloseness=1/currCloseness),maxCloseness<currCloseness&&(maxCloseness=currCloseness),closenesses[node_i.id()]=currCloseness}return{closeness:function(node){return maxCloseness==0?0:(string(node)?node=cy.filter(node)[0].id():node=node.id(),closenesses[node]/maxCloseness)}}},closenessCentrality:function(options2){var _defaults2=defaults$e(options2),root=_defaults2.root,weight8=_defaults2.weight,directed=_defaults2.directed,harmonic=_defaults2.harmonic;root=this.filter(root)[0];for(var dijkstra2=this.dijkstra({root,weight:weight8,directed}),totalDistance=0,nodes3=this.nodes(),i=0;i<nodes3.length;i++){var n=nodes3[i];if(!n.same(root)){var d=dijkstra2.distanceTo(n);harmonic?totalDistance+=1/d:totalDistance+=d}}return harmonic?totalDistance:1/totalDistance}};elesfn$m.cc=elesfn$m.closenessCentrality;elesfn$m.ccn=elesfn$m.closenessCentralityNormalised=elesfn$m.closenessCentralityNormalized;var defaults$d=defaults$g({weight:null,directed:!1}),elesfn$l={betweennessCentrality:function(options2){for(var _defaults=defaults$d(options2),directed=_defaults.directed,weight8=_defaults.weight,weighted=weight8!=null,cy=this.cy(),V=this.nodes(),A={},_C={},max5=0,C={set:function(key,val){_C[key]=val,val>max5&&(max5=val)},get:function(key){return _C[key]}},i=0;i<V.length;i++){var v=V[i],vid=v.id();directed?A[vid]=v.outgoers().nodes():A[vid]=v.openNeighborhood().nodes(),C.set(vid,0)}for(var _loop=function(){for(var sid=V[s].id(),S=[],P={},g={},d={},Q=new Heap(function(a,b){return d[a]-d[b]}),_i=0;_i<V.length;_i++){var _vid=V[_i].id();P[_vid]=[],g[_vid]=0,d[_vid]=1/0}for(g[sid]=1,d[sid]=0,Q.push(sid);!Q.empty();){var _v=Q.pop();if(S.push(_v),weighted)for(var j=0;j<A[_v].length;j++){var w=A[_v][j],vEle=cy.getElementById(_v),edge=void 0;vEle.edgesTo(w).length>0?edge=vEle.edgesTo(w)[0]:edge=w.edgesTo(vEle)[0];var edgeWeight=weight8(edge);w=w.id(),d[w]>d[_v]+edgeWeight&&(d[w]=d[_v]+edgeWeight,Q.nodes.indexOf(w)<0?Q.push(w):Q.updateItem(w),g[w]=0,P[w]=[]),d[w]==d[_v]+edgeWeight&&(g[w]=g[w]+g[_v],P[w].push(_v))}else for(var _j=0;_j<A[_v].length;_j++){var _w=A[_v][_j].id();d[_w]==1/0&&(Q.push(_w),d[_w]=d[_v]+1),d[_w]==d[_v]+1&&(g[_w]=g[_w]+g[_v],P[_w].push(_v))}}for(var e={},_i2=0;_i2<V.length;_i2++)e[V[_i2].id()]=0;for(;S.length>0;){for(var _w2=S.pop(),_j2=0;_j2<P[_w2].length;_j2++){var _v2=P[_w2][_j2];e[_v2]=e[_v2]+g[_v2]/g[_w2]*(1+e[_w2])}_w2!=V[s].id()&&C.set(_w2,C.get(_w2)+e[_w2])}},s=0;s<V.length;s++)_loop();var ret={betweenness:function(node){var id2=cy.collection(node).id();return C.get(id2)},betweennessNormalized:function(node){if(max5==0)return 0;var id2=cy.collection(node).id();return C.get(id2)/max5}};return ret.betweennessNormalised=ret.betweennessNormalized,ret}};elesfn$l.bc=elesfn$l.betweennessCentrality;var defaults$c=defaults$g({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(edge){return 1}]}),setOptions$3=function(options2){return defaults$c(options2)},getSimilarity$1=function(edge,attributes){for(var total=0,i=0;i<attributes.length;i++)total+=attributes[i](edge);return total},addLoops=function(M,n,val){for(var i=0;i<n;i++)M[i*n+i]=val},normalize=function(M,n){for(var sum,col=0;col<n;col++){sum=0;for(var row=0;row<n;row++)sum+=M[row*n+col];for(var _row=0;_row<n;_row++)M[_row*n+col]=M[_row*n+col]/sum}},mmult=function(A,B,n){for(var C=new Array(n*n),i=0;i<n;i++){for(var j=0;j<n;j++)C[i*n+j]=0;for(var k=0;k<n;k++)for(var _j=0;_j<n;_j++)C[i*n+_j]+=A[i*n+k]*B[k*n+_j]}return C},expand=function(M,n,expandFactor){for(var _M=M.slice(0),p2=1;p2<expandFactor;p2++)M=mmult(M,_M,n);return M},inflate=function(M,n,inflateFactor){for(var _M=new Array(n*n),i=0;i<n*n;i++)_M[i]=Math.pow(M[i],inflateFactor);return normalize(_M,n),_M},hasConverged=function(M,_M,n2,roundFactor){for(var i=0;i<n2;i++){var v12=Math.round(M[i]*Math.pow(10,roundFactor))/Math.pow(10,roundFactor),v22=Math.round(_M[i]*Math.pow(10,roundFactor))/Math.pow(10,roundFactor);if(v12!==v22)return!1}return!0},assign$2=function(M,n,nodes3,cy){for(var clusters=[],i=0;i<n;i++){for(var cluster=[],j=0;j<n;j++)Math.round(M[i*n+j]*1e3)/1e3>0&&cluster.push(nodes3[j]);cluster.length!==0&&clusters.push(cy.collection(cluster))}return clusters},isDuplicate=function(c1,c2){for(var i=0;i<c1.length;i++)if(!c2[i]||c1[i].id()!==c2[i].id())return!1;return!0},removeDuplicates=function(clusters){for(var i=0;i<clusters.length;i++)for(var j=0;j<clusters.length;j++)i!=j&&isDuplicate(clusters[i],clusters[j])&&clusters.splice(j,1);return clusters},markovClustering=function(options2){for(var nodes3=this.nodes(),edges3=this.edges(),cy=this.cy(),opts=setOptions$3(options2),id2position={},i=0;i<nodes3.length;i++)id2position[nodes3[i].id()]=i;for(var n=nodes3.length,n2=n*n,M=new Array(n2),_M,_i=0;_i<n2;_i++)M[_i]=0;for(var e=0;e<edges3.length;e++){var edge=edges3[e],_i2=id2position[edge.source().id()],j=id2position[edge.target().id()],sim=getSimilarity$1(edge,opts.attributes);M[_i2*n+j]+=sim,M[j*n+_i2]+=sim}addLoops(M,n,opts.multFactor),normalize(M,n);for(var isStillMoving=!0,iterations=0;isStillMoving&&iterations<opts.maxIterations;)isStillMoving=!1,_M=expand(M,n,opts.expandFactor),M=inflate(_M,n,opts.inflateFactor),hasConverged(M,_M,n2,4)||(isStillMoving=!0),iterations++;var clusters=assign$2(M,n,nodes3,cy);return clusters=removeDuplicates(clusters),clusters},markovClustering$1={markovClustering,mcl:markovClustering},identity$1=function(x2){return x2},absDiff=function(p2,q){return Math.abs(q-p2)},addAbsDiff=function(total,p2,q){return total+absDiff(p2,q)},addSquaredDiff=function(total,p2,q){return total+Math.pow(q-p2,2)},sqrt=function(x2){return Math.sqrt(x2)},maxAbsDiff=function(currentMax,p2,q){return Math.max(currentMax,absDiff(p2,q))},getDistance=function(length,getP,getQ,init,visit){for(var post=arguments.length>5&&arguments[5]!==void 0?arguments[5]:identity$1,ret=init,p2,q,dim=0;dim<length;dim++)p2=getP(dim),q=getQ(dim),ret=visit(ret,p2,q);return post(ret)},distances={euclidean:function(length,getP,getQ){return length>=2?getDistance(length,getP,getQ,0,addSquaredDiff,sqrt):getDistance(length,getP,getQ,0,addAbsDiff)},squaredEuclidean:function(length,getP,getQ){return getDistance(length,getP,getQ,0,addSquaredDiff)},manhattan:function(length,getP,getQ){return getDistance(length,getP,getQ,0,addAbsDiff)},max:function(length,getP,getQ){return getDistance(length,getP,getQ,-1/0,maxAbsDiff)}};distances["squared-euclidean"]=distances.squaredEuclidean;distances.squaredeuclidean=distances.squaredEuclidean;function clusteringDistance(method,length,getP,getQ,nodeP,nodeQ){var impl2;return fn$6(method)?impl2=method:impl2=distances[method]||distances.euclidean,length===0&&fn$6(method)?impl2(nodeP,nodeQ):impl2(length,getP,getQ,nodeP,nodeQ)}var defaults$b=defaults$g({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),setOptions$2=function(options2){return defaults$b(options2)},getDist=function(type,node,centroid,attributes,mode){var noNodeP=mode!=="kMedoids",getP=noNodeP?function(i){return centroid[i]}:function(i){return attributes[i](centroid)},getQ=function(i){return attributes[i](node)},nodeP=centroid,nodeQ=node;return clusteringDistance(type,attributes.length,getP,getQ,nodeP,nodeQ)},randomCentroids=function(nodes3,k,attributes){for(var ndim=attributes.length,min4=new Array(ndim),max5=new Array(ndim),centroids=new Array(k),centroid=null,i=0;i<ndim;i++)min4[i]=nodes3.min(attributes[i]).value,max5[i]=nodes3.max(attributes[i]).value;for(var c=0;c<k;c++){centroid=[];for(var _i=0;_i<ndim;_i++)centroid[_i]=Math.random()*(max5[_i]-min4[_i])+min4[_i];centroids[c]=centroid}return centroids},classify=function(node,centroids,distance,attributes,type){for(var min4=1/0,index=0,i=0;i<centroids.length;i++){var dist3=getDist(distance,node,centroids[i],attributes,type);dist3<min4&&(min4=dist3,index=i)}return index},buildCluster=function(centroid,nodes3,assignment){for(var cluster=[],node=null,n=0;n<nodes3.length;n++)node=nodes3[n],assignment[node.id()]===centroid&&cluster.push(node);return cluster},haveValuesConverged=function(v12,v22,sensitivityThreshold){return Math.abs(v22-v12)<=sensitivityThreshold},haveMatricesConverged=function(v12,v22,sensitivityThreshold){for(var i=0;i<v12.length;i++)for(var j=0;j<v12[i].length;j++){var diff2=Math.abs(v12[i][j]-v22[i][j]);if(diff2>sensitivityThreshold)return!1}return!0},seenBefore=function(node,medoids,n){for(var i=0;i<n;i++)if(node===medoids[i])return!0;return!1},randomMedoids=function(nodes3,k){var medoids=new Array(k);if(nodes3.length<50)for(var i=0;i<k;i++){for(var node=nodes3[Math.floor(Math.random()*nodes3.length)];seenBefore(node,medoids,i);)node=nodes3[Math.floor(Math.random()*nodes3.length)];medoids[i]=node}else for(var _i2=0;_i2<k;_i2++)medoids[_i2]=nodes3[Math.floor(Math.random()*nodes3.length)];return medoids},findCost=function(potentialNewMedoid,cluster,attributes){for(var cost=0,n=0;n<cluster.length;n++)cost+=getDist("manhattan",cluster[n],potentialNewMedoid,attributes,"kMedoids");return cost},kMeans=function(options2){var cy=this.cy(),nodes3=this.nodes(),node=null,opts=setOptions$2(options2),clusters=new Array(opts.k),assignment={},centroids;opts.testMode?typeof opts.testCentroids=="number"?(opts.testCentroids,centroids=randomCentroids(nodes3,opts.k,opts.attributes)):_typeof(opts.testCentroids)==="object"?centroids=opts.testCentroids:centroids=randomCentroids(nodes3,opts.k,opts.attributes):centroids=randomCentroids(nodes3,opts.k,opts.attributes);for(var isStillMoving=!0,iterations=0;isStillMoving&&iterations<opts.maxIterations;){for(var n=0;n<nodes3.length;n++)node=nodes3[n],assignment[node.id()]=classify(node,centroids,opts.distance,opts.attributes,"kMeans");isStillMoving=!1;for(var c=0;c<opts.k;c++){var cluster=buildCluster(c,nodes3,assignment);if(cluster.length!==0){for(var ndim=opts.attributes.length,centroid=centroids[c],newCentroid=new Array(ndim),sum=new Array(ndim),d=0;d<ndim;d++){sum[d]=0;for(var i=0;i<cluster.length;i++)node=cluster[i],sum[d]+=opts.attributes[d](node);newCentroid[d]=sum[d]/cluster.length,haveValuesConverged(newCentroid[d],centroid[d],opts.sensitivityThreshold)||(isStillMoving=!0)}centroids[c]=newCentroid,clusters[c]=cy.collection(cluster)}}iterations++}return clusters},kMedoids=function(options2){var cy=this.cy(),nodes3=this.nodes(),node=null,opts=setOptions$2(options2),clusters=new Array(opts.k),medoids,assignment={},curCost,minCosts=new Array(opts.k);opts.testMode?typeof opts.testCentroids=="number"||(_typeof(opts.testCentroids)==="object"?medoids=opts.testCentroids:medoids=randomMedoids(nodes3,opts.k)):medoids=randomMedoids(nodes3,opts.k);for(var isStillMoving=!0,iterations=0;isStillMoving&&iterations<opts.maxIterations;){for(var n=0;n<nodes3.length;n++)node=nodes3[n],assignment[node.id()]=classify(node,medoids,opts.distance,opts.attributes,"kMedoids");isStillMoving=!1;for(var m=0;m<medoids.length;m++){var cluster=buildCluster(m,nodes3,assignment);if(cluster.length!==0){minCosts[m]=findCost(medoids[m],cluster,opts.attributes);for(var _n=0;_n<cluster.length;_n++)curCost=findCost(cluster[_n],cluster,opts.attributes),curCost<minCosts[m]&&(minCosts[m]=curCost,medoids[m]=cluster[_n],isStillMoving=!0);clusters[m]=cy.collection(cluster)}}iterations++}return clusters},updateCentroids=function(centroids,nodes3,U,weight8,opts){for(var numerator,denominator,n=0;n<nodes3.length;n++)for(var c=0;c<centroids.length;c++)weight8[n][c]=Math.pow(U[n][c],opts.m);for(var _c=0;_c<centroids.length;_c++)for(var dim=0;dim<opts.attributes.length;dim++){numerator=0,denominator=0;for(var _n2=0;_n2<nodes3.length;_n2++)numerator+=weight8[_n2][_c]*opts.attributes[dim](nodes3[_n2]),denominator+=weight8[_n2][_c];centroids[_c][dim]=numerator/denominator}},updateMembership=function(U,_U,centroids,nodes3,opts){for(var i=0;i<U.length;i++)_U[i]=U[i].slice();for(var sum,numerator,denominator,pow=2/(opts.m-1),c=0;c<centroids.length;c++)for(var n=0;n<nodes3.length;n++){sum=0;for(var k=0;k<centroids.length;k++)numerator=getDist(opts.distance,nodes3[n],centroids[c],opts.attributes,"cmeans"),denominator=getDist(opts.distance,nodes3[n],centroids[k],opts.attributes,"cmeans"),sum+=Math.pow(numerator/denominator,pow);U[n][c]=1/sum}},assign$1=function(nodes3,U,opts,cy){for(var clusters=new Array(opts.k),c=0;c<clusters.length;c++)clusters[c]=[];for(var max5,index,n=0;n<U.length;n++){max5=-1/0,index=-1;for(var _c2=0;_c2<U[0].length;_c2++)U[n][_c2]>max5&&(max5=U[n][_c2],index=_c2);clusters[index].push(nodes3[n])}for(var _c3=0;_c3<clusters.length;_c3++)clusters[_c3]=cy.collection(clusters[_c3]);return clusters},fuzzyCMeans=function(options2){var cy=this.cy(),nodes3=this.nodes(),opts=setOptions$2(options2),clusters,centroids,U,_U,weight8;_U=new Array(nodes3.length);for(var i=0;i<nodes3.length;i++)_U[i]=new Array(opts.k);U=new Array(nodes3.length);for(var _i3=0;_i3<nodes3.length;_i3++)U[_i3]=new Array(opts.k);for(var _i4=0;_i4<nodes3.length;_i4++){for(var total=0,j=0;j<opts.k;j++)U[_i4][j]=Math.random(),total+=U[_i4][j];for(var _j=0;_j<opts.k;_j++)U[_i4][_j]=U[_i4][_j]/total}centroids=new Array(opts.k);for(var _i5=0;_i5<opts.k;_i5++)centroids[_i5]=new Array(opts.attributes.length);weight8=new Array(nodes3.length);for(var _i6=0;_i6<nodes3.length;_i6++)weight8[_i6]=new Array(opts.k);for(var isStillMoving=!0,iterations=0;isStillMoving&&iterations<opts.maxIterations;)isStillMoving=!1,updateCentroids(centroids,nodes3,U,weight8,opts),updateMembership(U,_U,centroids,nodes3,opts),haveMatricesConverged(U,_U,opts.sensitivityThreshold)||(isStillMoving=!0),iterations++;return clusters=assign$1(nodes3,U,opts,cy),{clusters,degreeOfMembership:U}},kClustering={kMeans,kMedoids,fuzzyCMeans,fcm:fuzzyCMeans},defaults$a=defaults$g({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),linkageAliases={single:"min",complete:"max"},setOptions$1=function(options2){var opts=defaults$a(options2),preferredAlias=linkageAliases[opts.linkage];return preferredAlias!=null&&(opts.linkage=preferredAlias),opts},mergeClosest=function(clusters,index,dists,mins,opts){for(var minKey=0,min4=1/0,dist3,attrs=opts.attributes,getDist3=function(n1,n2){return clusteringDistance(opts.distance,attrs.length,function(i2){return attrs[i2](n1)},function(i2){return attrs[i2](n2)},n1,n2)},i=0;i<clusters.length;i++){var key=clusters[i].key,_dist=dists[key][mins[key]];_dist<min4&&(minKey=key,min4=_dist)}if(opts.mode==="threshold"&&min4>=opts.threshold||opts.mode==="dendrogram"&&clusters.length===1)return!1;var c1=index[minKey],c2=index[mins[minKey]],merged;opts.mode==="dendrogram"?merged={left:c1,right:c2,key:c1.key}:merged={value:c1.value.concat(c2.value),key:c1.key},clusters[c1.index]=merged,clusters.splice(c2.index,1),index[c1.key]=merged;for(var _i=0;_i<clusters.length;_i++){var cur=clusters[_i];c1.key===cur.key?dist3=1/0:opts.linkage==="min"?(dist3=dists[c1.key][cur.key],dists[c1.key][cur.key]>dists[c2.key][cur.key]&&(dist3=dists[c2.key][cur.key])):opts.linkage==="max"?(dist3=dists[c1.key][cur.key],dists[c1.key][cur.key]<dists[c2.key][cur.key]&&(dist3=dists[c2.key][cur.key])):opts.linkage==="mean"?dist3=(dists[c1.key][cur.key]*c1.size+dists[c2.key][cur.key]*c2.size)/(c1.size+c2.size):opts.mode==="dendrogram"?dist3=getDist3(cur.value,c1.value):dist3=getDist3(cur.value[0],c1.value[0]),dists[c1.key][cur.key]=dists[cur.key][c1.key]=dist3}for(var _i2=0;_i2<clusters.length;_i2++){var key1=clusters[_i2].key;if(mins[key1]===c1.key||mins[key1]===c2.key){for(var _min=key1,j=0;j<clusters.length;j++){var key2=clusters[j].key;dists[key1][key2]<dists[key1][_min]&&(_min=key2)}mins[key1]=_min}clusters[_i2].index=_i2}return c1.key=c2.key=c1.index=c2.index=null,!0},_getAllChildren=function(root,arr,cy){root&&(root.value?arr.push(root.value):(root.left&&_getAllChildren(root.left,arr),root.right&&_getAllChildren(root.right,arr)))},_buildDendrogram=function(root,cy){if(!root)return"";if(root.left&&root.right){var leftStr=_buildDendrogram(root.left,cy),rightStr=_buildDendrogram(root.right,cy),node=cy.add({group:"nodes",data:{id:leftStr+","+rightStr}});return cy.add({group:"edges",data:{source:leftStr,target:node.id()}}),cy.add({group:"edges",data:{source:rightStr,target:node.id()}}),node.id()}else if(root.value)return root.value.id()},_buildClustersFromTree=function(root,k,cy){if(!root)return[];var left=[],right=[],leaves=[];return k===0?(root.left&&_getAllChildren(root.left,left),root.right&&_getAllChildren(root.right,right),leaves=left.concat(right),[cy.collection(leaves)]):k===1?root.value?[cy.collection(root.value)]:(root.left&&_getAllChildren(root.left,left),root.right&&_getAllChildren(root.right,right),[cy.collection(left),cy.collection(right)]):root.value?[cy.collection(root.value)]:(root.left&&(left=_buildClustersFromTree(root.left,k-1,cy)),root.right&&(right=_buildClustersFromTree(root.right,k-1,cy)),left.concat(right))},hierarchicalClustering=function(options2){for(var cy=this.cy(),nodes3=this.nodes(),opts=setOptions$1(options2),attrs=opts.attributes,getDist3=function(n1,n2){return clusteringDistance(opts.distance,attrs.length,function(i2){return attrs[i2](n1)},function(i2){return attrs[i2](n2)},n1,n2)},clusters=[],dists=[],mins=[],index=[],n=0;n<nodes3.length;n++){var cluster={value:opts.mode==="dendrogram"?nodes3[n]:[nodes3[n]],key:n,index:n};clusters[n]=cluster,index[n]=cluster,dists[n]=[],mins[n]=0}for(var i=0;i<clusters.length;i++)for(var j=0;j<=i;j++){var dist3=void 0;opts.mode==="dendrogram"?dist3=i===j?1/0:getDist3(clusters[i].value,clusters[j].value):dist3=i===j?1/0:getDist3(clusters[i].value[0],clusters[j].value[0]),dists[i][j]=dist3,dists[j][i]=dist3,dist3<dists[i][mins[i]]&&(mins[i]=j)}for(var merged=mergeClosest(clusters,index,dists,mins,opts);merged;)merged=mergeClosest(clusters,index,dists,mins,opts);var retClusters;return opts.mode==="dendrogram"?(retClusters=_buildClustersFromTree(clusters[0],opts.dendrogramDepth,cy),opts.addDendrogram&&_buildDendrogram(clusters[0],cy)):(retClusters=new Array(clusters.length),clusters.forEach(function(cluster2,i2){cluster2.key=cluster2.index=null,retClusters[i2]=cy.collection(cluster2.value)})),retClusters},hierarchicalClustering$1={hierarchicalClustering,hca:hierarchicalClustering},defaults$9=defaults$g({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),setOptions4=function(options2){var dmp=options2.damping,pref=options2.preference;.5<=dmp&&dmp<1||error("Damping must range on [0.5, 1). Got: ".concat(dmp));var validPrefs=["median","mean","min","max"];return validPrefs.some(function(v){return v===pref})||number$1(pref)||error("Preference must be one of [".concat(validPrefs.map(function(p2){return"'".concat(p2,"'")}).join(", "),"] or a number. Got: ").concat(pref)),defaults$9(options2)},getSimilarity2=function(type,n1,n2,attributes){var attr=function(n,i){return attributes[i](n)};return-clusteringDistance(type,attributes.length,function(i){return attr(n1,i)},function(i){return attr(n2,i)},n1,n2)},getPreference=function(S,preference){var p2=null;return preference==="median"?p2=median(S):preference==="mean"?p2=mean(S):preference==="min"?p2=min(S):preference==="max"?p2=max(S):p2=preference,p2},findExemplars=function(n,R,A){for(var indices=[],i=0;i<n;i++)R[i*n+i]+A[i*n+i]>0&&indices.push(i);return indices},assignClusters=function(n,S,exemplars){for(var clusters=[],i=0;i<n;i++){for(var index=-1,max5=-1/0,ei=0;ei<exemplars.length;ei++){var e=exemplars[ei];S[i*n+e]>max5&&(index=e,max5=S[i*n+e])}index>0&&clusters.push(index)}for(var _ei=0;_ei<exemplars.length;_ei++)clusters[exemplars[_ei]]=exemplars[_ei];return clusters},assign3=function(n,S,exemplars){for(var clusters=assignClusters(n,S,exemplars),ei=0;ei<exemplars.length;ei++){for(var ii=[],c=0;c<clusters.length;c++)clusters[c]===exemplars[ei]&&ii.push(c);for(var maxI=-1,maxSum=-1/0,i=0;i<ii.length;i++){for(var sum=0,j=0;j<ii.length;j++)sum+=S[ii[j]*n+ii[i]];sum>maxSum&&(maxI=i,maxSum=sum)}exemplars[ei]=ii[maxI]}return clusters=assignClusters(n,S,exemplars),clusters},affinityPropagation=function(options2){for(var cy=this.cy(),nodes3=this.nodes(),opts=setOptions4(options2),id2position={},i=0;i<nodes3.length;i++)id2position[nodes3[i].id()]=i;var n,n2,S,p2,R,A;n=nodes3.length,n2=n*n,S=new Array(n2);for(var _i=0;_i<n2;_i++)S[_i]=-1/0;for(var _i2=0;_i2<n;_i2++)for(var j=0;j<n;j++)_i2!==j&&(S[_i2*n+j]=getSimilarity2(opts.distance,nodes3[_i2],nodes3[j],opts.attributes));p2=getPreference(S,opts.preference);for(var _i3=0;_i3<n;_i3++)S[_i3*n+_i3]=p2;R=new Array(n2);for(var _i4=0;_i4<n2;_i4++)R[_i4]=0;A=new Array(n2);for(var _i5=0;_i5<n2;_i5++)A[_i5]=0;for(var old=new Array(n),Rp=new Array(n),se=new Array(n),_i6=0;_i6<n;_i6++)old[_i6]=0,Rp[_i6]=0,se[_i6]=0;for(var e=new Array(n*opts.minIterations),_i7=0;_i7<e.length;_i7++)e[_i7]=0;var iter;for(iter=0;iter<opts.maxIterations;iter++){for(var _i8=0;_i8<n;_i8++){for(var max5=-1/0,max22=-1/0,maxI=-1,AS=0,_j=0;_j<n;_j++)old[_j]=R[_i8*n+_j],AS=A[_i8*n+_j]+S[_i8*n+_j],AS>=max5?(max22=max5,max5=AS,maxI=_j):AS>max22&&(max22=AS);for(var _j2=0;_j2<n;_j2++)R[_i8*n+_j2]=(1-opts.damping)*(S[_i8*n+_j2]-max5)+opts.damping*old[_j2];R[_i8*n+maxI]=(1-opts.damping)*(S[_i8*n+maxI]-max22)+opts.damping*old[maxI]}for(var _i9=0;_i9<n;_i9++){for(var sum=0,_j3=0;_j3<n;_j3++)old[_j3]=A[_j3*n+_i9],Rp[_j3]=Math.max(0,R[_j3*n+_i9]),sum+=Rp[_j3];sum-=Rp[_i9],Rp[_i9]=R[_i9*n+_i9],sum+=Rp[_i9];for(var _j4=0;_j4<n;_j4++)A[_j4*n+_i9]=(1-opts.damping)*Math.min(0,sum-Rp[_j4])+opts.damping*old[_j4];A[_i9*n+_i9]=(1-opts.damping)*(sum-Rp[_i9])+opts.damping*old[_i9]}for(var K2=0,_i10=0;_i10<n;_i10++){var E=A[_i10*n+_i10]+R[_i10*n+_i10]>0?1:0;e[iter%opts.minIterations*n+_i10]=E,K2+=E}if(K2>0&&(iter>=opts.minIterations-1||iter==opts.maxIterations-1)){for(var _sum=0,_i11=0;_i11<n;_i11++){se[_i11]=0;for(var _j5=0;_j5<opts.minIterations;_j5++)se[_i11]+=e[_j5*n+_i11];(se[_i11]===0||se[_i11]===opts.minIterations)&&_sum++}if(_sum===n)break}}for(var exemplarsIndices=findExemplars(n,R,A),clusterIndices=assign3(n,S,exemplarsIndices),clusters={},c=0;c<exemplarsIndices.length;c++)clusters[exemplarsIndices[c]]=[];for(var _i12=0;_i12<nodes3.length;_i12++){var pos=id2position[nodes3[_i12].id()],clusterIndex=clusterIndices[pos];clusterIndex!=null&&clusters[clusterIndex].push(nodes3[_i12])}for(var retClusters=new Array(exemplarsIndices.length),_c=0;_c<exemplarsIndices.length;_c++)retClusters[_c]=cy.collection(clusters[exemplarsIndices[_c]]);return retClusters},affinityPropagation$1={affinityPropagation,ap:affinityPropagation},hierholzerDefaults=defaults$g({root:void 0,directed:!1}),elesfn$k={hierholzer:function(options2){if(!plainObject(options2)){var args=arguments;options2={root:args[0],directed:args[1]}}var _hierholzerDefaults=hierholzerDefaults(options2),root=_hierholzerDefaults.root,directed=_hierholzerDefaults.directed,eles=this,dflag=!1,oddIn,oddOut,startVertex;root&&(startVertex=string(root)?this.filter(root)[0].id():root[0].id());var nodes3={},edges3={};directed?eles.forEach(function(ele){var id2=ele.id();if(ele.isNode()){var ind=ele.indegree(!0),outd=ele.outdegree(!0),d1=ind-outd,d2=outd-ind;d1==1?oddIn?dflag=!0:oddIn=id2:d2==1?oddOut?dflag=!0:oddOut=id2:(d2>1||d1>1)&&(dflag=!0),nodes3[id2]=[],ele.outgoers().forEach(function(e){e.isEdge()&&nodes3[id2].push(e.id())})}else edges3[id2]=[void 0,ele.target().id()]}):eles.forEach(function(ele){var id2=ele.id();if(ele.isNode()){var d2=ele.degree(!0);d2%2&&(oddIn?oddOut?dflag=!0:oddOut=id2:oddIn=id2),nodes3[id2]=[],ele.connectedEdges().forEach(function(e){return nodes3[id2].push(e.id())})}else edges3[id2]=[ele.source().id(),ele.target().id()]});var result={found:!1,trail:void 0};if(dflag)return result;if(oddOut&&oddIn)if(directed){if(startVertex&&oddOut!=startVertex)return result;startVertex=oddOut}else{if(startVertex&&oddOut!=startVertex&&oddIn!=startVertex)return result;startVertex||(startVertex=oddOut)}else startVertex||(startVertex=eles[0].id());var walk=function(v){for(var currentNode=v,subtour2=[v],adj,adjTail,adjHead;nodes3[currentNode].length;)adj=nodes3[currentNode].shift(),adjTail=edges3[adj][0],adjHead=edges3[adj][1],currentNode!=adjHead?(nodes3[adjHead]=nodes3[adjHead].filter(function(e){return e!=adj}),currentNode=adjHead):!directed&¤tNode!=adjTail&&(nodes3[adjTail]=nodes3[adjTail].filter(function(e){return e!=adj}),currentNode=adjTail),subtour2.unshift(adj),subtour2.unshift(currentNode);return subtour2},trail=[],subtour=[];for(subtour=walk(startVertex);subtour.length!=1;)nodes3[subtour[0]].length==0?(trail.unshift(eles.getElementById(subtour.shift())),trail.unshift(eles.getElementById(subtour.shift()))):subtour=walk(subtour.shift()).concat(subtour);trail.unshift(eles.getElementById(subtour.shift()));for(var d in nodes3)if(nodes3[d].length)return result;return result.found=!0,result.trail=this.spawn(trail,!0),result}},hopcroftTarjanBiconnected=function(){var eles=this,nodes3={},id2=0,edgeCount=0,components2=[],stack=[],visitedEdges={},buildComponent=function(x2,y2){for(var i=stack.length-1,cutset=[],component2=eles.spawn();stack[i].x!=x2||stack[i].y!=y2;)cutset.push(stack.pop().edge),i--;cutset.push(stack.pop().edge),cutset.forEach(function(edge){var connectedNodes=edge.connectedNodes().intersection(eles);component2.merge(edge),connectedNodes.forEach(function(node){var nodeId=node.id(),connectedEdges=node.connectedEdges().intersection(eles);component2.merge(node),nodes3[nodeId].cutVertex?component2.merge(connectedEdges.filter(function(edge2){return edge2.isLoop()})):component2.merge(connectedEdges)})}),components2.push(component2)},_biconnectedSearch=function(root,currentNode,parent4){root===parent4&&(edgeCount+=1),nodes3[currentNode]={id:id2,low:id2++,cutVertex:!1};var edges3=eles.getElementById(currentNode).connectedEdges().intersection(eles);if(edges3.size()===0)components2.push(eles.spawn(eles.getElementById(currentNode)));else{var sourceId,targetId,otherNodeId,edgeId;edges3.forEach(function(edge){sourceId=edge.source().id(),targetId=edge.target().id(),otherNodeId=sourceId===currentNode?targetId:sourceId,otherNodeId!==parent4&&(edgeId=edge.id(),visitedEdges[edgeId]||(visitedEdges[edgeId]=!0,stack.push({x:currentNode,y:otherNodeId,edge})),otherNodeId in nodes3?nodes3[currentNode].low=Math.min(nodes3[currentNode].low,nodes3[otherNodeId].id):(_biconnectedSearch(root,otherNodeId,currentNode),nodes3[currentNode].low=Math.min(nodes3[currentNode].low,nodes3[otherNodeId].low),nodes3[currentNode].id<=nodes3[otherNodeId].low&&(nodes3[currentNode].cutVertex=!0,buildComponent(currentNode,otherNodeId))))})}};eles.forEach(function(ele){if(ele.isNode()){var nodeId=ele.id();nodeId in nodes3||(edgeCount=0,_biconnectedSearch(nodeId,nodeId),nodes3[nodeId].cutVertex=edgeCount>1)}});var cutVertices=Object.keys(nodes3).filter(function(id3){return nodes3[id3].cutVertex}).map(function(id3){return eles.getElementById(id3)});return{cut:eles.spawn(cutVertices),components:components2}},hopcroftTarjanBiconnected$1={hopcroftTarjanBiconnected,htbc:hopcroftTarjanBiconnected,htb:hopcroftTarjanBiconnected,hopcroftTarjanBiconnectedComponents:hopcroftTarjanBiconnected},tarjanStronglyConnected=function(){var eles=this,nodes3={},index=0,components2=[],stack=[],cut=eles.spawn(eles),_stronglyConnectedSearch=function(sourceNodeId){stack.push(sourceNodeId),nodes3[sourceNodeId]={index,low:index++,explored:!1};var connectedEdges=eles.getElementById(sourceNodeId).connectedEdges().intersection(eles);if(connectedEdges.forEach(function(edge){var targetNodeId=edge.target().id();targetNodeId!==sourceNodeId&&(targetNodeId in nodes3||_stronglyConnectedSearch(targetNodeId),nodes3[targetNodeId].explored||(nodes3[sourceNodeId].low=Math.min(nodes3[sourceNodeId].low,nodes3[targetNodeId].low)))}),nodes3[sourceNodeId].index===nodes3[sourceNodeId].low){for(var componentNodes=eles.spawn();;){var nodeId=stack.pop();if(componentNodes.merge(eles.getElementById(nodeId)),nodes3[nodeId].low=nodes3[sourceNodeId].index,nodes3[nodeId].explored=!0,nodeId===sourceNodeId)break}var componentEdges=componentNodes.edgesWith(componentNodes),component2=componentNodes.merge(componentEdges);components2.push(component2),cut=cut.difference(component2)}};return eles.forEach(function(ele){if(ele.isNode()){var nodeId=ele.id();nodeId in nodes3||_stronglyConnectedSearch(nodeId)}}),{cut,components:components2}},tarjanStronglyConnected$1={tarjanStronglyConnected,tsc:tarjanStronglyConnected,tscc:tarjanStronglyConnected,tarjanStronglyConnectedComponents:tarjanStronglyConnected},elesfn$j={};[elesfn$v,elesfn$u,elesfn$t,elesfn$s,elesfn$r,elesfn$q,elesfn$p,elesfn$o,elesfn$n,elesfn$m,elesfn$l,markovClustering$1,kClustering,hierarchicalClustering$1,affinityPropagation$1,elesfn$k,hopcroftTarjanBiconnected$1,tarjanStronglyConnected$1].forEach(function(props){extend(elesfn$j,props)});/*!
|
|
5
|
+
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
6
|
+
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
7
|
+
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
8
|
+
*/var STATE_PENDING=0,STATE_FULFILLED=1,STATE_REJECTED=2,_api=function(executor){if(!(this instanceof _api))return new _api(executor);this.id="Thenable/1.0.7",this.state=STATE_PENDING,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof executor=="function"&&executor.call(this,this.fulfill.bind(this),this.reject.bind(this))};_api.prototype={fulfill:function(value){return deliver(this,STATE_FULFILLED,"fulfillValue",value)},reject:function(value){return deliver(this,STATE_REJECTED,"rejectReason",value)},then:function(onFulfilled,onRejected){var curr=this,next=new _api;return curr.onFulfilled.push(resolver(onFulfilled,next,"fulfill")),curr.onRejected.push(resolver(onRejected,next,"reject")),execute(curr),next.proxy}};var deliver=function(curr,state,name,value){return curr.state===STATE_PENDING&&(curr.state=state,curr[name]=value,execute(curr)),curr},execute=function(curr){curr.state===STATE_FULFILLED?execute_handlers(curr,"onFulfilled",curr.fulfillValue):curr.state===STATE_REJECTED&&execute_handlers(curr,"onRejected",curr.rejectReason)},execute_handlers=function(curr,name,value){if(curr[name].length!==0){var handlers=curr[name];curr[name]=[];var func=function(){for(var i=0;i<handlers.length;i++)handlers[i](value)};typeof setImmediate=="function"?setImmediate(func):setTimeout(func,0)}},resolver=function(cb,next,method){return function(value){if(typeof cb!="function")next[method].call(next,value);else{var result;try{result=cb(value)}catch(e){next.reject(e);return}_resolve(next,result)}}},_resolve=function(promise4,x2){if(promise4===x2||promise4.proxy===x2){promise4.reject(new TypeError("cannot resolve promise with itself"));return}var then2;if(_typeof(x2)==="object"&&x2!==null||typeof x2=="function")try{then2=x2.then}catch(e){promise4.reject(e);return}if(typeof then2=="function"){var resolved=!1;try{then2.call(x2,function(y2){resolved||(resolved=!0,y2===x2?promise4.reject(new TypeError("circular thenable chain")):_resolve(promise4,y2))},function(r){resolved||(resolved=!0,promise4.reject(r))})}catch(e){resolved||promise4.reject(e)}return}promise4.fulfill(x2)};_api.all=function(ps){return new _api(function(resolveAll,rejectAll){for(var vals=new Array(ps.length),doneCount=0,fulfill2=function(i2,val){vals[i2]=val,doneCount++,doneCount===ps.length&&resolveAll(vals)},i=0;i<ps.length;i++)(function(i2){var p2=ps[i2],isPromise=p2!=null&&p2.then!=null;if(isPromise)p2.then(function(val2){fulfill2(i2,val2)},function(err){rejectAll(err)});else{var val=p2;fulfill2(i2,val)}})(i)})};_api.resolve=function(val){return new _api(function(resolve2,reject2){resolve2(val)})};_api.reject=function(val){return new _api(function(resolve2,reject2){reject2(val)})};var Promise$1=typeof Promise<"u"?Promise:_api,Animation=function(target,opts,opts2){var isCore=core(target),isEle=!isCore,_p=this._private=extend({duration:1e3},opts,opts2);if(_p.target=target,_p.style=_p.style||_p.css,_p.started=!1,_p.playing=!1,_p.hooked=!1,_p.applying=!1,_p.progress=0,_p.completes=[],_p.frames=[],_p.complete&&fn$6(_p.complete)&&_p.completes.push(_p.complete),isEle){var pos=target.position();_p.startPosition=_p.startPosition||{x:pos.x,y:pos.y},_p.startStyle=_p.startStyle||target.cy().style().getAnimationStartStyle(target,_p.style)}if(isCore){var pan2=target.pan();_p.startPan={x:pan2.x,y:pan2.y},_p.startZoom=target.zoom()}this.length=1,this[0]=this},anifn=Animation.prototype;extend(anifn,{instanceString:function(){return"animation"},hook:function(){var _p=this._private;if(!_p.hooked){var q,tAni=_p.target._private.animation;_p.queue?q=tAni.queue:q=tAni.current,q.push(this),elementOrCollection(_p.target)&&_p.target.cy().addToAnimationPool(_p.target),_p.hooked=!0}return this},play:function(){var _p=this._private;return _p.progress===1&&(_p.progress=0),_p.playing=!0,_p.started=!1,_p.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var _p=this._private;return _p.applying=!0,_p.started=!1,_p.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var _p=this._private;return _p.playing=!1,_p.started=!1,this},stop:function(){var _p=this._private;return _p.playing=!1,_p.started=!1,_p.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(t){var _p=this._private;return t===void 0?_p.progress*_p.duration:this.progress(t/_p.duration)},progress:function(p2){var _p=this._private,wasPlaying=_p.playing;return p2===void 0?_p.progress:(wasPlaying&&this.pause(),_p.progress=p2,_p.started=!1,wasPlaying&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var _p=this._private,wasPlaying=_p.playing;wasPlaying&&this.pause(),_p.progress=1-_p.progress,_p.started=!1;var swap=function(a,b){var _pa=_p[a];_pa!=null&&(_p[a]=_p[b],_p[b]=_pa)};if(swap("zoom","startZoom"),swap("pan","startPan"),swap("position","startPosition"),_p.style)for(var i=0;i<_p.style.length;i++){var prop=_p.style[i],name=prop.name,startStyleProp=_p.startStyle[name];_p.startStyle[name]=prop,_p.style[i]=startStyleProp}return wasPlaying&&this.play(),this},promise:function(type){var _p=this._private,arr;switch(type){case"frame":arr=_p.frames;break;default:case"complete":case"completed":arr=_p.completes}return new Promise$1(function(resolve2,reject2){arr.push(function(){resolve2()})})}});anifn.complete=anifn.completed;anifn.run=anifn.play;anifn.running=anifn.playing;var define$3={animated:function(){return function(){var self2=this,selfIsArrayLike=self2.length!==void 0,all=selfIsArrayLike?self2:[self2],cy=this._private.cy||this;if(!cy.styleEnabled())return!1;var ele=all[0];if(ele)return ele._private.animation.current.length>0}},clearQueue:function(){return function(){var self2=this,selfIsArrayLike=self2.length!==void 0,all=selfIsArrayLike?self2:[self2],cy=this._private.cy||this;if(!cy.styleEnabled())return this;for(var i=0;i<all.length;i++){var ele=all[i];ele._private.animation.queue=[]}return this}},delay:function(){return function(time2,complete){var cy=this._private.cy||this;return cy.styleEnabled()?this.animate({delay:time2,duration:time2,complete}):this}},delayAnimation:function(){return function(time2,complete){var cy=this._private.cy||this;return cy.styleEnabled()?this.animation({delay:time2,duration:time2,complete}):this}},animation:function(){return function(properties,params){var self2=this,selfIsArrayLike=self2.length!==void 0,all=selfIsArrayLike?self2:[self2],cy=this._private.cy||this,isCore=!selfIsArrayLike,isEles=!isCore;if(!cy.styleEnabled())return this;var style3=cy.style();properties=extend({},properties,params);var propertiesEmpty=Object.keys(properties).length===0;if(propertiesEmpty)return new Animation(all[0],properties);switch(properties.duration===void 0&&(properties.duration=400),properties.duration){case"slow":properties.duration=600;break;case"fast":properties.duration=200;break}if(isEles&&(properties.style=style3.getPropsList(properties.style||properties.css),properties.css=void 0),isEles&&properties.renderedPosition!=null){var rpos=properties.renderedPosition,pan2=cy.pan(),zoom2=cy.zoom();properties.position=renderedToModelPosition(rpos,zoom2,pan2)}if(isCore&&properties.panBy!=null){var panBy2=properties.panBy,cyPan=cy.pan();properties.pan={x:cyPan.x+panBy2.x,y:cyPan.y+panBy2.y}}var center2=properties.center||properties.centre;if(isCore&¢er2!=null){var centerPan=cy.getCenterPan(center2.eles,properties.zoom);centerPan!=null&&(properties.pan=centerPan)}if(isCore&&properties.fit!=null){var fit2=properties.fit,fitVp=cy.getFitViewport(fit2.eles||fit2.boundingBox,fit2.padding);fitVp!=null&&(properties.pan=fitVp.pan,properties.zoom=fitVp.zoom)}if(isCore&&plainObject(properties.zoom)){var vp=cy.getZoomedViewport(properties.zoom);vp!=null?(vp.zoomed&&(properties.zoom=vp.zoom),vp.panned&&(properties.pan=vp.pan)):properties.zoom=null}return new Animation(all[0],properties)}},animate:function(){return function(properties,params){var self2=this,selfIsArrayLike=self2.length!==void 0,all=selfIsArrayLike?self2:[self2],cy=this._private.cy||this;if(!cy.styleEnabled())return this;params&&(properties=extend({},properties,params));for(var i=0;i<all.length;i++){var ele=all[i],queue=ele.animated()&&(properties.queue===void 0||properties.queue),ani=ele.animation(properties,queue?{queue:!0}:void 0);ani.play()}return this}},stop:function(){return function(clearQueue2,jumpToEnd){var self2=this,selfIsArrayLike=self2.length!==void 0,all=selfIsArrayLike?self2:[self2],cy=this._private.cy||this;if(!cy.styleEnabled())return this;for(var i=0;i<all.length;i++){for(var ele=all[i],_p=ele._private,anis=_p.animation.current,j=0;j<anis.length;j++){var ani=anis[j],ani_p=ani._private;jumpToEnd&&(ani_p.duration=0)}clearQueue2&&(_p.animation.queue=[]),jumpToEnd||(_p.animation.current=[])}return cy.notify("draw"),this}}},isArray_1,hasRequiredIsArray;function requireIsArray(){if(hasRequiredIsArray)return isArray_1;hasRequiredIsArray=1;var isArray=Array.isArray;return isArray_1=isArray,isArray_1}var _isKey,hasRequired_isKey;function require_isKey(){if(hasRequired_isKey)return _isKey;hasRequired_isKey=1;var isArray=requireIsArray(),isSymbol=requireIsSymbol(),reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(value,object3){if(isArray(value))return!1;var type=typeof value;return type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value)?!0:reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object3!=null&&value in Object(object3)}return _isKey=isKey,_isKey}var isFunction_1,hasRequiredIsFunction;function requireIsFunction(){if(hasRequiredIsFunction)return isFunction_1;hasRequiredIsFunction=1;var baseGetTag=require_baseGetTag(),isObject=requireIsObject(),asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(value){if(!isObject(value))return!1;var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}return isFunction_1=isFunction,isFunction_1}var _coreJsData,hasRequired_coreJsData;function require_coreJsData(){if(hasRequired_coreJsData)return _coreJsData;hasRequired_coreJsData=1;var root=require_root(),coreJsData=root["__core-js_shared__"];return _coreJsData=coreJsData,_coreJsData}var _isMasked,hasRequired_isMasked;function require_isMasked(){if(hasRequired_isMasked)return _isMasked;hasRequired_isMasked=1;var coreJsData=require_coreJsData(),maskSrcKey=(function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""})();function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}return _isMasked=isMasked,_isMasked}var _toSource,hasRequired_toSource;function require_toSource(){if(hasRequired_toSource)return _toSource;hasRequired_toSource=1;var funcProto=Function.prototype,funcToString=funcProto.toString;function toSource(func){if(func!=null){try{return funcToString.call(func)}catch{}try{return func+""}catch{}}return""}return _toSource=toSource,_toSource}var _baseIsNative,hasRequired_baseIsNative;function require_baseIsNative(){if(hasRequired_baseIsNative)return _baseIsNative;hasRequired_baseIsNative=1;var isFunction=requireIsFunction(),isMasked=require_isMasked(),isObject=requireIsObject(),toSource=require_toSource(),reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(value){if(!isObject(value)||isMasked(value))return!1;var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}return _baseIsNative=baseIsNative,_baseIsNative}var _getValue,hasRequired_getValue;function require_getValue(){if(hasRequired_getValue)return _getValue;hasRequired_getValue=1;function getValue2(object3,key){return object3==null?void 0:object3[key]}return _getValue=getValue2,_getValue}var _getNative,hasRequired_getNative;function require_getNative(){if(hasRequired_getNative)return _getNative;hasRequired_getNative=1;var baseIsNative=require_baseIsNative(),getValue2=require_getValue();function getNative(object3,key){var value=getValue2(object3,key);return baseIsNative(value)?value:void 0}return _getNative=getNative,_getNative}var _nativeCreate,hasRequired_nativeCreate;function require_nativeCreate(){if(hasRequired_nativeCreate)return _nativeCreate;hasRequired_nativeCreate=1;var getNative=require_getNative(),nativeCreate=getNative(Object,"create");return _nativeCreate=nativeCreate,_nativeCreate}var _hashClear,hasRequired_hashClear;function require_hashClear(){if(hasRequired_hashClear)return _hashClear;hasRequired_hashClear=1;var nativeCreate=require_nativeCreate();function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}return _hashClear=hashClear,_hashClear}var _hashDelete,hasRequired_hashDelete;function require_hashDelete(){if(hasRequired_hashDelete)return _hashDelete;hasRequired_hashDelete=1;function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];return this.size-=result?1:0,result}return _hashDelete=hashDelete,_hashDelete}var _hashGet,hasRequired_hashGet;function require_hashGet(){if(hasRequired_hashGet)return _hashGet;hasRequired_hashGet=1;var nativeCreate=require_nativeCreate(),HASH_UNDEFINED="__lodash_hash_undefined__",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashGet(key){var data4=this.__data__;if(nativeCreate){var result=data4[key];return result===HASH_UNDEFINED?void 0:result}return hasOwnProperty.call(data4,key)?data4[key]:void 0}return _hashGet=hashGet,_hashGet}var _hashHas,hasRequired_hashHas;function require_hashHas(){if(hasRequired_hashHas)return _hashHas;hasRequired_hashHas=1;var nativeCreate=require_nativeCreate(),objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(key){var data4=this.__data__;return nativeCreate?data4[key]!==void 0:hasOwnProperty.call(data4,key)}return _hashHas=hashHas,_hashHas}var _hashSet,hasRequired_hashSet;function require_hashSet(){if(hasRequired_hashSet)return _hashSet;hasRequired_hashSet=1;var nativeCreate=require_nativeCreate(),HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(key,value){var data4=this.__data__;return this.size+=this.has(key)?0:1,data4[key]=nativeCreate&&value===void 0?HASH_UNDEFINED:value,this}return _hashSet=hashSet,_hashSet}var _Hash,hasRequired_Hash;function require_Hash(){if(hasRequired_Hash)return _Hash;hasRequired_Hash=1;var hashClear=require_hashClear(),hashDelete=require_hashDelete(),hashGet=require_hashGet(),hashHas=require_hashHas(),hashSet=require_hashSet();function Hash(entries){var index=-1,length=entries==null?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}return Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,_Hash=Hash,_Hash}var _listCacheClear,hasRequired_listCacheClear;function require_listCacheClear(){if(hasRequired_listCacheClear)return _listCacheClear;hasRequired_listCacheClear=1;function listCacheClear(){this.__data__=[],this.size=0}return _listCacheClear=listCacheClear,_listCacheClear}var eq_1,hasRequiredEq;function requireEq(){if(hasRequiredEq)return eq_1;hasRequiredEq=1;function eq2(value,other){return value===other||value!==value&&other!==other}return eq_1=eq2,eq_1}var _assocIndexOf,hasRequired_assocIndexOf;function require_assocIndexOf(){if(hasRequired_assocIndexOf)return _assocIndexOf;hasRequired_assocIndexOf=1;var eq2=requireEq();function assocIndexOf(array3,key){for(var length=array3.length;length--;)if(eq2(array3[length][0],key))return length;return-1}return _assocIndexOf=assocIndexOf,_assocIndexOf}var _listCacheDelete,hasRequired_listCacheDelete;function require_listCacheDelete(){if(hasRequired_listCacheDelete)return _listCacheDelete;hasRequired_listCacheDelete=1;var assocIndexOf=require_assocIndexOf(),arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(key){var data4=this.__data__,index=assocIndexOf(data4,key);if(index<0)return!1;var lastIndex=data4.length-1;return index==lastIndex?data4.pop():splice.call(data4,index,1),--this.size,!0}return _listCacheDelete=listCacheDelete,_listCacheDelete}var _listCacheGet,hasRequired_listCacheGet;function require_listCacheGet(){if(hasRequired_listCacheGet)return _listCacheGet;hasRequired_listCacheGet=1;var assocIndexOf=require_assocIndexOf();function listCacheGet(key){var data4=this.__data__,index=assocIndexOf(data4,key);return index<0?void 0:data4[index][1]}return _listCacheGet=listCacheGet,_listCacheGet}var _listCacheHas,hasRequired_listCacheHas;function require_listCacheHas(){if(hasRequired_listCacheHas)return _listCacheHas;hasRequired_listCacheHas=1;var assocIndexOf=require_assocIndexOf();function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}return _listCacheHas=listCacheHas,_listCacheHas}var _listCacheSet,hasRequired_listCacheSet;function require_listCacheSet(){if(hasRequired_listCacheSet)return _listCacheSet;hasRequired_listCacheSet=1;var assocIndexOf=require_assocIndexOf();function listCacheSet(key,value){var data4=this.__data__,index=assocIndexOf(data4,key);return index<0?(++this.size,data4.push([key,value])):data4[index][1]=value,this}return _listCacheSet=listCacheSet,_listCacheSet}var _ListCache,hasRequired_ListCache;function require_ListCache(){if(hasRequired_ListCache)return _ListCache;hasRequired_ListCache=1;var listCacheClear=require_listCacheClear(),listCacheDelete=require_listCacheDelete(),listCacheGet=require_listCacheGet(),listCacheHas=require_listCacheHas(),listCacheSet=require_listCacheSet();function ListCache(entries){var index=-1,length=entries==null?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}return ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,_ListCache=ListCache,_ListCache}var _Map,hasRequired_Map;function require_Map(){if(hasRequired_Map)return _Map;hasRequired_Map=1;var getNative=require_getNative(),root=require_root(),Map2=getNative(root,"Map");return _Map=Map2,_Map}var _mapCacheClear,hasRequired_mapCacheClear;function require_mapCacheClear(){if(hasRequired_mapCacheClear)return _mapCacheClear;hasRequired_mapCacheClear=1;var Hash=require_Hash(),ListCache=require_ListCache(),Map2=require_Map();function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map2||ListCache),string:new Hash}}return _mapCacheClear=mapCacheClear,_mapCacheClear}var _isKeyable,hasRequired_isKeyable;function require_isKeyable(){if(hasRequired_isKeyable)return _isKeyable;hasRequired_isKeyable=1;function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}return _isKeyable=isKeyable,_isKeyable}var _getMapData,hasRequired_getMapData;function require_getMapData(){if(hasRequired_getMapData)return _getMapData;hasRequired_getMapData=1;var isKeyable=require_isKeyable();function getMapData(map2,key){var data4=map2.__data__;return isKeyable(key)?data4[typeof key=="string"?"string":"hash"]:data4.map}return _getMapData=getMapData,_getMapData}var _mapCacheDelete,hasRequired_mapCacheDelete;function require_mapCacheDelete(){if(hasRequired_mapCacheDelete)return _mapCacheDelete;hasRequired_mapCacheDelete=1;var getMapData=require_getMapData();function mapCacheDelete(key){var result=getMapData(this,key).delete(key);return this.size-=result?1:0,result}return _mapCacheDelete=mapCacheDelete,_mapCacheDelete}var _mapCacheGet,hasRequired_mapCacheGet;function require_mapCacheGet(){if(hasRequired_mapCacheGet)return _mapCacheGet;hasRequired_mapCacheGet=1;var getMapData=require_getMapData();function mapCacheGet(key){return getMapData(this,key).get(key)}return _mapCacheGet=mapCacheGet,_mapCacheGet}var _mapCacheHas,hasRequired_mapCacheHas;function require_mapCacheHas(){if(hasRequired_mapCacheHas)return _mapCacheHas;hasRequired_mapCacheHas=1;var getMapData=require_getMapData();function mapCacheHas(key){return getMapData(this,key).has(key)}return _mapCacheHas=mapCacheHas,_mapCacheHas}var _mapCacheSet,hasRequired_mapCacheSet;function require_mapCacheSet(){if(hasRequired_mapCacheSet)return _mapCacheSet;hasRequired_mapCacheSet=1;var getMapData=require_getMapData();function mapCacheSet(key,value){var data4=getMapData(this,key),size3=data4.size;return data4.set(key,value),this.size+=data4.size==size3?0:1,this}return _mapCacheSet=mapCacheSet,_mapCacheSet}var _MapCache,hasRequired_MapCache;function require_MapCache(){if(hasRequired_MapCache)return _MapCache;hasRequired_MapCache=1;var mapCacheClear=require_mapCacheClear(),mapCacheDelete=require_mapCacheDelete(),mapCacheGet=require_mapCacheGet(),mapCacheHas=require_mapCacheHas(),mapCacheSet=require_mapCacheSet();function MapCache(entries){var index=-1,length=entries==null?0:entries.length;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}return MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet,_MapCache=MapCache,_MapCache}var memoize_1,hasRequiredMemoize;function requireMemoize(){if(hasRequiredMemoize)return memoize_1;hasRequiredMemoize=1;var MapCache=require_MapCache(),FUNC_ERROR_TEXT="Expected a function";function memoize3(func,resolver3){if(typeof func!="function"||resolver3!=null&&typeof resolver3!="function")throw new TypeError(FUNC_ERROR_TEXT);var memoized=function(){var args=arguments,key=resolver3?resolver3.apply(this,args):args[0],cache3=memoized.cache;if(cache3.has(key))return cache3.get(key);var result=func.apply(this,args);return memoized.cache=cache3.set(key,result)||cache3,result};return memoized.cache=new(memoize3.Cache||MapCache),memoized}return memoize3.Cache=MapCache,memoize_1=memoize3,memoize_1}var _memoizeCapped,hasRequired_memoizeCapped;function require_memoizeCapped(){if(hasRequired_memoizeCapped)return _memoizeCapped;hasRequired_memoizeCapped=1;var memoize3=requireMemoize(),MAX_MEMOIZE_SIZE=500;function memoizeCapped(func){var result=memoize3(func,function(key){return cache3.size===MAX_MEMOIZE_SIZE&&cache3.clear(),key}),cache3=result.cache;return result}return _memoizeCapped=memoizeCapped,_memoizeCapped}var _stringToPath,hasRequired_stringToPath;function require_stringToPath(){if(hasRequired_stringToPath)return _stringToPath;hasRequired_stringToPath=1;var memoizeCapped=require_memoizeCapped(),rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(string3){var result=[];return string3.charCodeAt(0)===46&&result.push(""),string3.replace(rePropName,function(match2,number3,quote,subString){result.push(quote?subString.replace(reEscapeChar,"$1"):number3||match2)}),result});return _stringToPath=stringToPath,_stringToPath}var _arrayMap,hasRequired_arrayMap;function require_arrayMap(){if(hasRequired_arrayMap)return _arrayMap;hasRequired_arrayMap=1;function arrayMap(array3,iteratee){for(var index=-1,length=array3==null?0:array3.length,result=Array(length);++index<length;)result[index]=iteratee(array3[index],index,array3);return result}return _arrayMap=arrayMap,_arrayMap}var _baseToString,hasRequired_baseToString;function require_baseToString(){if(hasRequired_baseToString)return _baseToString;hasRequired_baseToString=1;var Symbol2=require_Symbol(),arrayMap=require_arrayMap(),isArray=requireIsArray(),isSymbol=requireIsSymbol(),symbolProto=Symbol2?Symbol2.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(value){if(typeof value=="string")return value;if(isArray(value))return arrayMap(value,baseToString)+"";if(isSymbol(value))return symbolToString?symbolToString.call(value):"";var result=value+"";return result=="0"&&1/value==-1/0?"-0":result}return _baseToString=baseToString,_baseToString}var toString_1,hasRequiredToString;function requireToString(){if(hasRequiredToString)return toString_1;hasRequiredToString=1;var baseToString=require_baseToString();function toString3(value){return value==null?"":baseToString(value)}return toString_1=toString3,toString_1}var _castPath,hasRequired_castPath;function require_castPath(){if(hasRequired_castPath)return _castPath;hasRequired_castPath=1;var isArray=requireIsArray(),isKey=require_isKey(),stringToPath=require_stringToPath(),toString3=requireToString();function castPath(value,object3){return isArray(value)?value:isKey(value,object3)?[value]:stringToPath(toString3(value))}return _castPath=castPath,_castPath}var _toKey,hasRequired_toKey;function require_toKey(){if(hasRequired_toKey)return _toKey;hasRequired_toKey=1;var isSymbol=requireIsSymbol();function toKey(value){if(typeof value=="string"||isSymbol(value))return value;var result=value+"";return result=="0"&&1/value==-1/0?"-0":result}return _toKey=toKey,_toKey}var _baseGet,hasRequired_baseGet;function require_baseGet(){if(hasRequired_baseGet)return _baseGet;hasRequired_baseGet=1;var castPath=require_castPath(),toKey=require_toKey();function baseGet(object3,path){path=castPath(path,object3);for(var index=0,length=path.length;object3!=null&&index<length;)object3=object3[toKey(path[index++])];return index&&index==length?object3:void 0}return _baseGet=baseGet,_baseGet}var get_1,hasRequiredGet;function requireGet(){if(hasRequiredGet)return get_1;hasRequiredGet=1;var baseGet=require_baseGet();function get2(object3,path,defaultValue){var result=object3==null?void 0:baseGet(object3,path);return result===void 0?defaultValue:result}return get_1=get2,get_1}var getExports=requireGet(),get=getDefaultExportFromCjs(getExports),_defineProperty,hasRequired_defineProperty;function require_defineProperty(){if(hasRequired_defineProperty)return _defineProperty;hasRequired_defineProperty=1;var getNative=require_getNative(),defineProperty=(function(){try{var func=getNative(Object,"defineProperty");return func({},"",{}),func}catch{}})();return _defineProperty=defineProperty,_defineProperty}var _baseAssignValue,hasRequired_baseAssignValue;function require_baseAssignValue(){if(hasRequired_baseAssignValue)return _baseAssignValue;hasRequired_baseAssignValue=1;var defineProperty=require_defineProperty();function baseAssignValue(object3,key,value){key=="__proto__"&&defineProperty?defineProperty(object3,key,{configurable:!0,enumerable:!0,value,writable:!0}):object3[key]=value}return _baseAssignValue=baseAssignValue,_baseAssignValue}var _assignValue,hasRequired_assignValue;function require_assignValue(){if(hasRequired_assignValue)return _assignValue;hasRequired_assignValue=1;var baseAssignValue=require_baseAssignValue(),eq2=requireEq(),objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function assignValue(object3,key,value){var objValue=object3[key];(!(hasOwnProperty.call(object3,key)&&eq2(objValue,value))||value===void 0&&!(key in object3))&&baseAssignValue(object3,key,value)}return _assignValue=assignValue,_assignValue}var _isIndex,hasRequired_isIndex;function require_isIndex(){if(hasRequired_isIndex)return _isIndex;hasRequired_isIndex=1;var MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(value,length){var type=typeof value;return length=length??MAX_SAFE_INTEGER,!!length&&(type=="number"||type!="symbol"&&reIsUint.test(value))&&value>-1&&value%1==0&&value<length}return _isIndex=isIndex,_isIndex}var _baseSet,hasRequired_baseSet;function require_baseSet(){if(hasRequired_baseSet)return _baseSet;hasRequired_baseSet=1;var assignValue=require_assignValue(),castPath=require_castPath(),isIndex=require_isIndex(),isObject=requireIsObject(),toKey=require_toKey();function baseSet(object3,path,value,customizer){if(!isObject(object3))return object3;path=castPath(path,object3);for(var index=-1,length=path.length,lastIndex=length-1,nested=object3;nested!=null&&++index<length;){var key=toKey(path[index]),newValue=value;if(key==="__proto__"||key==="constructor"||key==="prototype")return object3;if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):void 0,newValue===void 0&&(newValue=isObject(objValue)?objValue:isIndex(path[index+1])?[]:{})}assignValue(nested,key,newValue),nested=nested[key]}return object3}return _baseSet=baseSet,_baseSet}var set_1,hasRequiredSet;function requireSet(){if(hasRequiredSet)return set_1;hasRequiredSet=1;var baseSet=require_baseSet();function set2(object3,path,value){return object3==null?object3:baseSet(object3,path,value)}return set_1=set2,set_1}var setExports=requireSet(),set=getDefaultExportFromCjs(setExports),_copyArray,hasRequired_copyArray;function require_copyArray(){if(hasRequired_copyArray)return _copyArray;hasRequired_copyArray=1;function copyArray3(source,array3){var index=-1,length=source.length;for(array3||(array3=Array(length));++index<length;)array3[index]=source[index];return array3}return _copyArray=copyArray3,_copyArray}var toPath_1,hasRequiredToPath;function requireToPath(){if(hasRequiredToPath)return toPath_1;hasRequiredToPath=1;var arrayMap=require_arrayMap(),copyArray3=require_copyArray(),isArray=requireIsArray(),isSymbol=requireIsSymbol(),stringToPath=require_stringToPath(),toKey=require_toKey(),toString3=requireToString();function toPath2(value){return isArray(value)?arrayMap(value,toKey):isSymbol(value)?[value]:copyArray3(stringToPath(toString3(value)))}return toPath_1=toPath2,toPath_1}var toPathExports=requireToPath(),toPath=getDefaultExportFromCjs(toPathExports),define$2={data:function(params){var defaults3={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(self2){},beforeSet:function(self2,obj){},onSet:function(self2){},canSet:function(self2){return!0}};return params=extend({},defaults3,params),function(name,value){var p2=params,self2=this,selfIsArrayLike=self2.length!==void 0,all=selfIsArrayLike?self2:[self2],single=selfIsArrayLike?self2[0]:self2;if(string(name)){var isPathLike=name.indexOf(".")!==-1,path=isPathLike&&toPath(name);if(p2.allowGetting&&value===void 0){var ret;return single&&(p2.beforeGet(single),path&&single._private[p2.field][name]===void 0?ret=get(single._private[p2.field],path):ret=single._private[p2.field][name]),ret}else if(p2.allowSetting&&value!==void 0){var valid2=!p2.immutableKeys[name];if(valid2){var change=_defineProperty$1({},name,value);p2.beforeSet(self2,change);for(var i=0,l=all.length;i<l;i++){var ele=all[i];p2.canSet(ele)&&(path&&single._private[p2.field][name]===void 0?set(ele._private[p2.field],path,value):ele._private[p2.field][name]=value)}p2.updateStyle&&self2.updateStyle(),p2.onSet(self2),p2.settingTriggersEvent&&self2[p2.triggerFnName](p2.settingEvent)}}}else if(p2.allowSetting&&plainObject(name)){var obj=name,k,v,keys=Object.keys(obj);p2.beforeSet(self2,obj);for(var _i=0;_i<keys.length;_i++){k=keys[_i],v=obj[k];var _valid=!p2.immutableKeys[k];if(_valid)for(var j=0;j<all.length;j++){var _ele=all[j];p2.canSet(_ele)&&(_ele._private[p2.field][k]=v)}}p2.updateStyle&&self2.updateStyle(),p2.onSet(self2),p2.settingTriggersEvent&&self2[p2.triggerFnName](p2.settingEvent)}else if(p2.allowBinding&&fn$6(name)){var fn3=name;self2.on(p2.bindingEvent,fn3)}else if(p2.allowGetting&&name===void 0){var _ret;return single&&(p2.beforeGet(single),_ret=single._private[p2.field]),_ret}return self2}},removeData:function(params){var defaults3={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return params=extend({},defaults3,params),function(names){var p2=params,self2=this,selfIsArrayLike=self2.length!==void 0,all=selfIsArrayLike?self2:[self2];if(string(names)){for(var keys=names.split(/\s+/),l=keys.length,i=0;i<l;i++){var key=keys[i];if(!emptyString(key)){var valid2=!p2.immutableKeys[key];if(valid2)for(var i_a=0,l_a=all.length;i_a<l_a;i_a++)all[i_a]._private[p2.field][key]=void 0}}p2.triggerEvent&&self2[p2.triggerFnName](p2.event)}else if(names===void 0){for(var _i_a=0,_l_a=all.length;_i_a<_l_a;_i_a++)for(var _privateFields=all[_i_a]._private[p2.field],_keys=Object.keys(_privateFields),_i2=0;_i2<_keys.length;_i2++){var _key=_keys[_i2],validKeyToDelete=!p2.immutableKeys[_key];validKeyToDelete&&(_privateFields[_key]=void 0)}p2.triggerEvent&&self2[p2.triggerFnName](p2.event)}return self2}}},define$1={eventAliasesOn:function(proto){var p2=proto;p2.addListener=p2.listen=p2.bind=p2.on,p2.unlisten=p2.unbind=p2.off=p2.removeListener,p2.trigger=p2.emit,p2.pon=p2.promiseOn=function(events,selector){var self2=this,args=Array.prototype.slice.call(arguments,0);return new Promise$1(function(resolve2,reject2){var callback=function(e){self2.off.apply(self2,offArgs),resolve2(e)},onArgs=args.concat([callback]),offArgs=onArgs.concat([]);self2.on.apply(self2,onArgs)})}}},define={};[define$3,define$2,define$1].forEach(function(m){extend(define,m)});var elesfn$i={animate:define.animate(),animation:define.animation(),animated:define.animated(),clearQueue:define.clearQueue(),delay:define.delay(),delayAnimation:define.delayAnimation(),stop:define.stop()},elesfn$h={classes:function(_classes){var self2=this;if(_classes===void 0){var ret=[];return self2[0]._private.classes.forEach(function(cls2){return ret.push(cls2)}),ret}else array(_classes)||(_classes=(_classes||"").match(/\S+/g)||[]);for(var changed=[],classesSet=new Set$1(_classes),j=0;j<self2.length;j++){for(var ele=self2[j],_p=ele._private,eleClasses=_p.classes,changedEle=!1,i=0;i<_classes.length;i++){var cls=_classes[i],eleHasClass=eleClasses.has(cls);if(!eleHasClass){changedEle=!0;break}}changedEle||(changedEle=eleClasses.size!==_classes.length),changedEle&&(_p.classes=classesSet,changed.push(ele))}return changed.length>0&&this.spawn(changed).updateStyle().emit("class"),self2},addClass:function(classes2){return this.toggleClass(classes2,!0)},hasClass:function(className){var ele=this[0];return ele!=null&&ele._private.classes.has(className)},toggleClass:function(classes2,toggle){array(classes2)||(classes2=classes2.match(/\S+/g)||[]);for(var self2=this,toggleUndefd=toggle===void 0,changed=[],i=0,il=self2.length;i<il;i++)for(var ele=self2[i],eleClasses=ele._private.classes,changedEle=!1,j=0;j<classes2.length;j++){var cls=classes2[j],hasClass2=eleClasses.has(cls),changedNow=!1;toggle||toggleUndefd&&!hasClass2?(eleClasses.add(cls),changedNow=!0):(!toggle||toggleUndefd&&hasClass2)&&(eleClasses.delete(cls),changedNow=!0),!changedEle&&changedNow&&(changed.push(ele),changedEle=!0)}return changed.length>0&&this.spawn(changed).updateStyle().emit("class"),self2},removeClass:function(classes2){return this.toggleClass(classes2,!1)},flashClass:function(classes2,duration){var self2=this;if(duration==null)duration=250;else if(duration===0)return self2;return self2.addClass(classes2),setTimeout(function(){self2.removeClass(classes2)},duration),self2}};elesfn$h.className=elesfn$h.classNames=elesfn$h.classes;var tokens={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:number2,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};tokens.variable="(?:[\\w-.]|(?:\\\\"+tokens.metaChar+"))+";tokens.className="(?:[\\w-]|(?:\\\\"+tokens.metaChar+"))+";tokens.value=tokens.string+"|"+tokens.number;tokens.id=tokens.variable;(function(){var ops,op,i;for(ops=tokens.comparatorOp.split("|"),i=0;i<ops.length;i++)op=ops[i],tokens.comparatorOp+="|@"+op;for(ops=tokens.comparatorOp.split("|"),i=0;i<ops.length;i++)op=ops[i],!(op.indexOf("!")>=0)&&op!=="="&&(tokens.comparatorOp+="|\\!"+op)})();var newQuery=function(){return{checks:[]}},Type={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},stateSelectors=[{selector:":selected",matches:function(ele){return ele.selected()}},{selector:":unselected",matches:function(ele){return!ele.selected()}},{selector:":selectable",matches:function(ele){return ele.selectable()}},{selector:":unselectable",matches:function(ele){return!ele.selectable()}},{selector:":locked",matches:function(ele){return ele.locked()}},{selector:":unlocked",matches:function(ele){return!ele.locked()}},{selector:":visible",matches:function(ele){return ele.visible()}},{selector:":hidden",matches:function(ele){return!ele.visible()}},{selector:":transparent",matches:function(ele){return ele.transparent()}},{selector:":grabbed",matches:function(ele){return ele.grabbed()}},{selector:":free",matches:function(ele){return!ele.grabbed()}},{selector:":removed",matches:function(ele){return ele.removed()}},{selector:":inside",matches:function(ele){return!ele.removed()}},{selector:":grabbable",matches:function(ele){return ele.grabbable()}},{selector:":ungrabbable",matches:function(ele){return!ele.grabbable()}},{selector:":animated",matches:function(ele){return ele.animated()}},{selector:":unanimated",matches:function(ele){return!ele.animated()}},{selector:":parent",matches:function(ele){return ele.isParent()}},{selector:":childless",matches:function(ele){return ele.isChildless()}},{selector:":child",matches:function(ele){return ele.isChild()}},{selector:":orphan",matches:function(ele){return ele.isOrphan()}},{selector:":nonorphan",matches:function(ele){return ele.isChild()}},{selector:":compound",matches:function(ele){return ele.isNode()?ele.isParent():ele.source().isParent()||ele.target().isParent()}},{selector:":loop",matches:function(ele){return ele.isLoop()}},{selector:":simple",matches:function(ele){return ele.isSimple()}},{selector:":active",matches:function(ele){return ele.active()}},{selector:":inactive",matches:function(ele){return!ele.active()}},{selector:":backgrounding",matches:function(ele){return ele.backgrounding()}},{selector:":nonbackgrounding",matches:function(ele){return!ele.backgrounding()}}].sort(function(a,b){return descending(a.selector,b.selector)}),lookup=(function(){for(var selToFn={},s,i=0;i<stateSelectors.length;i++)s=stateSelectors[i],selToFn[s.selector]=s.matches;return selToFn})(),stateSelectorMatches=function(sel,ele){return lookup[sel](ele)},stateSelectorRegex="("+stateSelectors.map(function(s){return s.selector}).join("|")+")",cleanMetaChars=function(str){return str.replace(new RegExp("\\\\("+tokens.metaChar+")","g"),function(match2,$1){return $1})},replaceLastQuery=function(selector,examiningQuery,replacementQuery){selector[selector.length-1]=replacementQuery},exprs=[{name:"group",query:!0,regex:"("+tokens.group+")",populate:function(selector,query,_ref){var _ref2=_slicedToArray(_ref,1),group2=_ref2[0];query.checks.push({type:Type.GROUP,value:group2==="*"?group2:group2+"s"})}},{name:"state",query:!0,regex:stateSelectorRegex,populate:function(selector,query,_ref3){var _ref4=_slicedToArray(_ref3,1),state=_ref4[0];query.checks.push({type:Type.STATE,value:state})}},{name:"id",query:!0,regex:"\\#("+tokens.id+")",populate:function(selector,query,_ref5){var _ref6=_slicedToArray(_ref5,1),id2=_ref6[0];query.checks.push({type:Type.ID,value:cleanMetaChars(id2)})}},{name:"className",query:!0,regex:"\\.("+tokens.className+")",populate:function(selector,query,_ref7){var _ref8=_slicedToArray(_ref7,1),className=_ref8[0];query.checks.push({type:Type.CLASS,value:cleanMetaChars(className)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+tokens.variable+")\\s*\\]",populate:function(selector,query,_ref9){var _ref10=_slicedToArray(_ref9,1),variable=_ref10[0];query.checks.push({type:Type.DATA_EXIST,field:cleanMetaChars(variable)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+tokens.variable+")\\s*("+tokens.comparatorOp+")\\s*("+tokens.value+")\\s*\\]",populate:function(selector,query,_ref11){var _ref12=_slicedToArray(_ref11,3),variable=_ref12[0],comparatorOp=_ref12[1],value=_ref12[2],valueIsString=new RegExp("^"+tokens.string+"$").exec(value)!=null;valueIsString?value=value.substring(1,value.length-1):value=parseFloat(value),query.checks.push({type:Type.DATA_COMPARE,field:cleanMetaChars(variable),operator:comparatorOp,value})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+tokens.boolOp+")\\s*("+tokens.variable+")\\s*\\]",populate:function(selector,query,_ref13){var _ref14=_slicedToArray(_ref13,2),boolOp=_ref14[0],variable=_ref14[1];query.checks.push({type:Type.DATA_BOOL,field:cleanMetaChars(variable),operator:boolOp})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+tokens.meta+")\\s*("+tokens.comparatorOp+")\\s*("+tokens.number+")\\s*\\]\\]",populate:function(selector,query,_ref15){var _ref16=_slicedToArray(_ref15,3),meta3=_ref16[0],comparatorOp=_ref16[1],number3=_ref16[2];query.checks.push({type:Type.META_COMPARE,field:cleanMetaChars(meta3),operator:comparatorOp,value:parseFloat(number3)})}},{name:"nextQuery",separator:!0,regex:tokens.separator,populate:function(selector,query){var currentSubject=selector.currentSubject,edgeCount=selector.edgeCount,compoundCount=selector.compoundCount,lastQ=selector[selector.length-1];currentSubject!=null&&(lastQ.subject=currentSubject,selector.currentSubject=null),lastQ.edgeCount=edgeCount,lastQ.compoundCount=compoundCount,selector.edgeCount=0,selector.compoundCount=0;var nextQuery=selector[selector.length++]=newQuery();return nextQuery}},{name:"directedEdge",separator:!0,regex:tokens.directedEdge,populate:function(selector,query){if(selector.currentSubject==null){var edgeQuery=newQuery(),source=query,target=newQuery();return edgeQuery.checks.push({type:Type.DIRECTED_EDGE,source,target}),replaceLastQuery(selector,query,edgeQuery),selector.edgeCount++,target}else{var srcTgtQ=newQuery(),_source=query,_target=newQuery();return srcTgtQ.checks.push({type:Type.NODE_SOURCE,source:_source,target:_target}),replaceLastQuery(selector,query,srcTgtQ),selector.edgeCount++,_target}}},{name:"undirectedEdge",separator:!0,regex:tokens.undirectedEdge,populate:function(selector,query){if(selector.currentSubject==null){var edgeQuery=newQuery(),source=query,target=newQuery();return edgeQuery.checks.push({type:Type.UNDIRECTED_EDGE,nodes:[source,target]}),replaceLastQuery(selector,query,edgeQuery),selector.edgeCount++,target}else{var nhoodQ=newQuery(),node=query,neighbor=newQuery();return nhoodQ.checks.push({type:Type.NODE_NEIGHBOR,node,neighbor}),replaceLastQuery(selector,query,nhoodQ),neighbor}}},{name:"child",separator:!0,regex:tokens.child,populate:function(selector,query){if(selector.currentSubject==null){var parentChildQuery=newQuery(),child=newQuery(),parent4=selector[selector.length-1];return parentChildQuery.checks.push({type:Type.CHILD,parent:parent4,child}),replaceLastQuery(selector,query,parentChildQuery),selector.compoundCount++,child}else if(selector.currentSubject===query){var compound=newQuery(),left=selector[selector.length-1],right=newQuery(),subject=newQuery(),_child=newQuery(),_parent=newQuery();return compound.checks.push({type:Type.COMPOUND_SPLIT,left,right,subject}),subject.checks=query.checks,query.checks=[{type:Type.TRUE}],_parent.checks.push({type:Type.TRUE}),right.checks.push({type:Type.PARENT,parent:_parent,child:_child}),replaceLastQuery(selector,left,compound),selector.currentSubject=subject,selector.compoundCount++,_child}else{var _parent2=newQuery(),_child2=newQuery(),pcQChecks=[{type:Type.PARENT,parent:_parent2,child:_child2}];return _parent2.checks=query.checks,query.checks=pcQChecks,selector.compoundCount++,_child2}}},{name:"descendant",separator:!0,regex:tokens.descendant,populate:function(selector,query){if(selector.currentSubject==null){var ancChQuery=newQuery(),descendant=newQuery(),ancestor=selector[selector.length-1];return ancChQuery.checks.push({type:Type.DESCENDANT,ancestor,descendant}),replaceLastQuery(selector,query,ancChQuery),selector.compoundCount++,descendant}else if(selector.currentSubject===query){var compound=newQuery(),left=selector[selector.length-1],right=newQuery(),subject=newQuery(),_descendant=newQuery(),_ancestor=newQuery();return compound.checks.push({type:Type.COMPOUND_SPLIT,left,right,subject}),subject.checks=query.checks,query.checks=[{type:Type.TRUE}],_ancestor.checks.push({type:Type.TRUE}),right.checks.push({type:Type.ANCESTOR,ancestor:_ancestor,descendant:_descendant}),replaceLastQuery(selector,left,compound),selector.currentSubject=subject,selector.compoundCount++,_descendant}else{var _ancestor2=newQuery(),_descendant2=newQuery(),adQChecks=[{type:Type.ANCESTOR,ancestor:_ancestor2,descendant:_descendant2}];return _ancestor2.checks=query.checks,query.checks=adQChecks,selector.compoundCount++,_descendant2}}},{name:"subject",modifier:!0,regex:tokens.subject,populate:function(selector,query){if(selector.currentSubject!=null&&selector.currentSubject!==query)return warn("Redefinition of subject in selector `"+selector.toString()+"`"),!1;selector.currentSubject=query;var topQ=selector[selector.length-1],topChk=topQ.checks[0],topType=topChk==null?null:topChk.type;topType===Type.DIRECTED_EDGE?topChk.type=Type.NODE_TARGET:topType===Type.UNDIRECTED_EDGE&&(topChk.type=Type.NODE_NEIGHBOR,topChk.node=topChk.nodes[1],topChk.neighbor=topChk.nodes[0],topChk.nodes=null)}}];exprs.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var consumeExpr=function(remaining){for(var expr,match2,name,j=0;j<exprs.length;j++){var e=exprs[j],n=e.name,m=remaining.match(e.regexObj);if(m!=null){match2=m,expr=e,name=n;var consumed=m[0];remaining=remaining.substring(consumed.length);break}}return{expr,match:match2,name,remaining}},consumeWhitespace=function(remaining){var match2=remaining.match(/^\s+/);if(match2){var consumed=match2[0];remaining=remaining.substring(consumed.length)}return remaining},parse=function(selector){var self2=this,remaining=self2.inputText=selector,currentQuery=self2[0]=newQuery();for(self2.length=1,remaining=consumeWhitespace(remaining);;){var exprInfo=consumeExpr(remaining);if(exprInfo.expr==null)return warn("The selector `"+selector+"`is invalid"),!1;var args=exprInfo.match.slice(1),ret=exprInfo.expr.populate(self2,currentQuery,args);if(ret===!1)return!1;if(ret!=null&&(currentQuery=ret),remaining=exprInfo.remaining,remaining.match(/^\s*$/))break}var lastQ=self2[self2.length-1];self2.currentSubject!=null&&(lastQ.subject=self2.currentSubject),lastQ.edgeCount=self2.edgeCount,lastQ.compoundCount=self2.compoundCount;for(var i=0;i<self2.length;i++){var q=self2[i];if(q.compoundCount>0&&q.edgeCount>0)return warn("The selector `"+selector+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(q.edgeCount>1)return warn("The selector `"+selector+"` is invalid because it uses multiple edge selectors"),!1;q.edgeCount===1&&warn("The selector `"+selector+"` 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(this.toStringCache!=null)return this.toStringCache;for(var clean=function(obj){return obj??""},cleanVal=function(val){return string(val)?'"'+val+'"':clean(val)},space=function(val){return" "+val+" "},checkToString=function(check,subject){var type=check.type,value=check.value;switch(type){case Type.GROUP:{var group2=clean(value);return group2.substring(0,group2.length-1)}case Type.DATA_COMPARE:{var field=check.field,operator=check.operator;return"["+field+space(clean(operator))+cleanVal(value)+"]"}case Type.DATA_BOOL:{var _operator=check.operator,_field=check.field;return"["+clean(_operator)+_field+"]"}case Type.DATA_EXIST:{var _field2=check.field;return"["+_field2+"]"}case Type.META_COMPARE:{var _operator2=check.operator,_field3=check.field;return"[["+_field3+space(clean(_operator2))+cleanVal(value)+"]]"}case Type.STATE:return value;case Type.ID:return"#"+value;case Type.CLASS:return"."+value;case Type.PARENT:case Type.CHILD:return queryToString(check.parent,subject)+space(">")+queryToString(check.child,subject);case Type.ANCESTOR:case Type.DESCENDANT:return queryToString(check.ancestor,subject)+" "+queryToString(check.descendant,subject);case Type.COMPOUND_SPLIT:{var lhs=queryToString(check.left,subject),sub=queryToString(check.subject,subject),rhs=queryToString(check.right,subject);return lhs+(lhs.length>0?" ":"")+sub+rhs}case Type.TRUE:return""}},queryToString=function(query2,subject){return query2.checks.reduce(function(str2,chk,i2){return str2+(subject===query2&&i2===0?"$":"")+checkToString(chk,subject)},"")},str="",i=0;i<this.length;i++){var query=this[i];str+=queryToString(query,query.subject),this.length>1&&i<this.length-1&&(str+=", ")}return this.toStringCache=str,str},parse$1={parse,toString},valCmp=function(fieldVal,operator,value){var matches33,isFieldStr=string(fieldVal),isFieldNum=number$1(fieldVal),isValStr=string(value),fieldStr,valStr,caseInsensitive=!1,notExpr=!1,isIneqCmp=!1;switch(operator.indexOf("!")>=0&&(operator=operator.replace("!",""),notExpr=!0),operator.indexOf("@")>=0&&(operator=operator.replace("@",""),caseInsensitive=!0),(isFieldStr||isValStr||caseInsensitive)&&(fieldStr=!isFieldStr&&!isFieldNum?"":""+fieldVal,valStr=""+value),caseInsensitive&&(fieldVal=fieldStr=fieldStr.toLowerCase(),value=valStr=valStr.toLowerCase()),operator){case"*=":matches33=fieldStr.indexOf(valStr)>=0;break;case"$=":matches33=fieldStr.indexOf(valStr,fieldStr.length-valStr.length)>=0;break;case"^=":matches33=fieldStr.indexOf(valStr)===0;break;case"=":matches33=fieldVal===value;break;case">":isIneqCmp=!0,matches33=fieldVal>value;break;case">=":isIneqCmp=!0,matches33=fieldVal>=value;break;case"<":isIneqCmp=!0,matches33=fieldVal<value;break;case"<=":isIneqCmp=!0,matches33=fieldVal<=value;break;default:matches33=!1;break}return notExpr&&(fieldVal!=null||!isIneqCmp)&&(matches33=!matches33),matches33},boolCmp=function(fieldVal,operator){switch(operator){case"?":return!!fieldVal;case"!":return!fieldVal;case"^":return fieldVal===void 0}},existCmp=function(fieldVal){return fieldVal!==void 0},data$1=function(ele,field){return ele.data(field)},meta=function(ele,field){return ele[field]()},match=[],matches$1=function(query,ele){return query.checks.every(function(chk){return match[chk.type](chk,ele)})};match[Type.GROUP]=function(check,ele){var group2=check.value;return group2==="*"||group2===ele.group()};match[Type.STATE]=function(check,ele){var stateSelector=check.value;return stateSelectorMatches(stateSelector,ele)};match[Type.ID]=function(check,ele){var id2=check.value;return ele.id()===id2};match[Type.CLASS]=function(check,ele){var cls=check.value;return ele.hasClass(cls)};match[Type.META_COMPARE]=function(check,ele){var field=check.field,operator=check.operator,value=check.value;return valCmp(meta(ele,field),operator,value)};match[Type.DATA_COMPARE]=function(check,ele){var field=check.field,operator=check.operator,value=check.value;return valCmp(data$1(ele,field),operator,value)};match[Type.DATA_BOOL]=function(check,ele){var field=check.field,operator=check.operator;return boolCmp(data$1(ele,field),operator)};match[Type.DATA_EXIST]=function(check,ele){var field=check.field;return check.operator,existCmp(data$1(ele,field))};match[Type.UNDIRECTED_EDGE]=function(check,ele){var qA=check.nodes[0],qB=check.nodes[1],src=ele.source(),tgt=ele.target();return matches$1(qA,src)&&matches$1(qB,tgt)||matches$1(qB,src)&&matches$1(qA,tgt)};match[Type.NODE_NEIGHBOR]=function(check,ele){return matches$1(check.node,ele)&&ele.neighborhood().some(function(n){return n.isNode()&&matches$1(check.neighbor,n)})};match[Type.DIRECTED_EDGE]=function(check,ele){return matches$1(check.source,ele.source())&&matches$1(check.target,ele.target())};match[Type.NODE_SOURCE]=function(check,ele){return matches$1(check.source,ele)&&ele.outgoers().some(function(n){return n.isNode()&&matches$1(check.target,n)})};match[Type.NODE_TARGET]=function(check,ele){return matches$1(check.target,ele)&&ele.incomers().some(function(n){return n.isNode()&&matches$1(check.source,n)})};match[Type.CHILD]=function(check,ele){return matches$1(check.child,ele)&&matches$1(check.parent,ele.parent())};match[Type.PARENT]=function(check,ele){return matches$1(check.parent,ele)&&ele.children().some(function(c){return matches$1(check.child,c)})};match[Type.DESCENDANT]=function(check,ele){return matches$1(check.descendant,ele)&&ele.ancestors().some(function(a){return matches$1(check.ancestor,a)})};match[Type.ANCESTOR]=function(check,ele){return matches$1(check.ancestor,ele)&&ele.descendants().some(function(d){return matches$1(check.descendant,d)})};match[Type.COMPOUND_SPLIT]=function(check,ele){return matches$1(check.subject,ele)&&matches$1(check.left,ele)&&matches$1(check.right,ele)};match[Type.TRUE]=function(){return!0};match[Type.COLLECTION]=function(check,ele){var collection4=check.value;return collection4.has(ele)};match[Type.FILTER]=function(check,ele){var filter4=check.value;return filter4(ele)};var filter=function(collection4){var self2=this;if(self2.length===1&&self2[0].checks.length===1&&self2[0].checks[0].type===Type.ID)return collection4.getElementById(self2[0].checks[0].value).collection();var selectorFunction=function(element3){for(var j=0;j<self2.length;j++){var query=self2[j];if(matches$1(query,element3))return!0}return!1};return self2.text()==null&&(selectorFunction=function(){return!0}),collection4.filter(selectorFunction)},matches31=function(ele){for(var self2=this,j=0;j<self2.length;j++){var query=self2[j];if(matches$1(query,ele))return!0}return!1},matching={matches:matches31,filter},Selector=function(selector){this.inputText=selector,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,selector==null||string(selector)&&selector.match(/^\s*$/)||(elementOrCollection(selector)?this.addQuery({checks:[{type:Type.COLLECTION,value:selector.collection()}]}):fn$6(selector)?this.addQuery({checks:[{type:Type.FILTER,value:selector}]}):string(selector)?this.parse(selector)||(this.invalid=!0):error("A selector must be created from a string; found "))},selfn=Selector.prototype;[parse$1,matching].forEach(function(p2){return extend(selfn,p2)});selfn.text=function(){return this.inputText};selfn.size=function(){return this.length};selfn.eq=function(i){return this[i]};selfn.sameText=function(otherSel){return!this.invalid&&!otherSel.invalid&&this.text()===otherSel.text()};selfn.addQuery=function(q){this[this.length++]=q};selfn.selector=selfn.toString;var elesfn$g={allAre:function(selector){var selObj=new Selector(selector);return this.every(function(ele){return selObj.matches(ele)})},is:function(selector){var selObj=new Selector(selector);return this.some(function(ele){return selObj.matches(ele)})},some:function(fn3,thisArg){for(var i=0;i<this.length;i++){var ret=thisArg?fn3.apply(thisArg,[this[i],i,this]):fn3(this[i],i,this);if(ret)return!0}return!1},every:function(fn3,thisArg){for(var i=0;i<this.length;i++){var ret=thisArg?fn3.apply(thisArg,[this[i],i,this]):fn3(this[i],i,this);if(!ret)return!1}return!0},same:function(collection4){if(this===collection4)return!0;collection4=this.cy().collection(collection4);var thisLength=this.length,collectionLength=collection4.length;return thisLength!==collectionLength?!1:thisLength===1?this[0]===collection4[0]:this.every(function(ele){return collection4.hasElementWithId(ele.id())})},anySame:function(collection4){return collection4=this.cy().collection(collection4),this.some(function(ele){return collection4.hasElementWithId(ele.id())})},allAreNeighbors:function(collection4){collection4=this.cy().collection(collection4);var nhood=this.neighborhood();return collection4.every(function(ele){return nhood.hasElementWithId(ele.id())})},contains:function(collection4){collection4=this.cy().collection(collection4);var self2=this;return collection4.every(function(ele){return self2.hasElementWithId(ele.id())})}};elesfn$g.allAreNeighbours=elesfn$g.allAreNeighbors;elesfn$g.has=elesfn$g.contains;elesfn$g.equal=elesfn$g.equals=elesfn$g.same;var cache=function(fn3,name){return function(arg1,arg2,arg3,arg4){var selectorOrEles=arg1,eles=this,key;if(selectorOrEles==null?key="":elementOrCollection(selectorOrEles)&&selectorOrEles.length===1&&(key=selectorOrEles.id()),eles.length===1&&key){var _p=eles[0]._private,tch=_p.traversalCache=_p.traversalCache||{},ch=tch[name]=tch[name]||[],hash=hashString(key),cacheHit=ch[hash];return cacheHit||(ch[hash]=fn3.call(eles,arg1,arg2,arg3,arg4))}else return fn3.call(eles,arg1,arg2,arg3,arg4)}},elesfn$f={parent:function(selector){var parents2=[];if(this.length===1){var parent4=this[0]._private.parent;if(parent4)return parent4}for(var i=0;i<this.length;i++){var ele=this[i],_parent=ele._private.parent;_parent&&parents2.push(_parent)}return this.spawn(parents2,!0).filter(selector)},parents:function(selector){for(var parents2=[],eles=this.parent();eles.nonempty();){for(var i=0;i<eles.length;i++){var ele=eles[i];parents2.push(ele)}eles=eles.parent()}return this.spawn(parents2,!0).filter(selector)},commonAncestors:function(selector){for(var ancestors,i=0;i<this.length;i++){var ele=this[i],parents2=ele.parents();ancestors=ancestors||parents2,ancestors=ancestors.intersect(parents2)}return ancestors.filter(selector)},orphans:function(selector){return this.stdFilter(function(ele){return ele.isOrphan()}).filter(selector)},nonorphans:function(selector){return this.stdFilter(function(ele){return ele.isChild()}).filter(selector)},children:cache(function(selector){for(var children=[],i=0;i<this.length;i++)for(var ele=this[i],eleChildren=ele._private.children,j=0;j<eleChildren.length;j++)children.push(eleChildren[j]);return this.spawn(children,!0).filter(selector)},"children"),siblings:function(selector){return this.parent().children().not(this).filter(selector)},isParent:function(){var ele=this[0];if(ele)return ele.isNode()&&ele._private.children.length!==0},isChildless:function(){var ele=this[0];if(ele)return ele.isNode()&&ele._private.children.length===0},isChild:function(){var ele=this[0];if(ele)return ele.isNode()&&ele._private.parent!=null},isOrphan:function(){var ele=this[0];if(ele)return ele.isNode()&&ele._private.parent==null},descendants:function(selector){var elements=[];function add3(eles){for(var i=0;i<eles.length;i++){var ele=eles[i];elements.push(ele),ele.children().nonempty()&&add3(ele.children())}}return add3(this.children()),this.spawn(elements,!0).filter(selector)}};function forEachCompound(eles,fn3,includeSelf,recursiveStep){for(var q=[],did=new Set$1,cy=eles.cy(),hasCompounds=cy.hasCompoundNodes(),i=0;i<eles.length;i++){var ele=eles[i];includeSelf?q.push(ele):hasCompounds&&recursiveStep(q,did,ele)}for(;q.length>0;){var _ele=q.shift();fn3(_ele),did.add(_ele.id()),hasCompounds&&recursiveStep(q,did,_ele)}return eles}function addChildren(q,did,ele){if(ele.isParent())for(var children=ele._private.children,i=0;i<children.length;i++){var child=children[i];did.has(child.id())||q.push(child)}}elesfn$f.forEachDown=function(fn3){var includeSelf=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return forEachCompound(this,fn3,includeSelf,addChildren)};function addParent(q,did,ele){if(ele.isChild()){var parent4=ele._private.parent;did.has(parent4.id())||q.push(parent4)}}elesfn$f.forEachUp=function(fn3){var includeSelf=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return forEachCompound(this,fn3,includeSelf,addParent)};function addParentAndChildren(q,did,ele){addParent(q,did,ele),addChildren(q,did,ele)}elesfn$f.forEachUpAndDown=function(fn3){var includeSelf=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return forEachCompound(this,fn3,includeSelf,addParentAndChildren)};elesfn$f.ancestors=elesfn$f.parents;var fn$5,elesfn$e;fn$5=elesfn$e={data:define.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:define.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:define.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:define.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:define.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:define.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var ele=this[0];if(ele)return ele._private.data.id}};fn$5.attr=fn$5.data;fn$5.removeAttr=fn$5.removeData;var data3=elesfn$e,elesfn$d={};function defineDegreeFunction(callback){return function(includeLoops){var self2=this;if(includeLoops===void 0&&(includeLoops=!0),self2.length!==0)if(self2.isNode()&&!self2.removed()){for(var degree=0,node=self2[0],connectedEdges=node._private.edges,i=0;i<connectedEdges.length;i++){var edge=connectedEdges[i];!includeLoops&&edge.isLoop()||(degree+=callback(node,edge))}return degree}else return}}extend(elesfn$d,{degree:defineDegreeFunction(function(node,edge){return edge.source().same(edge.target())?2:1}),indegree:defineDegreeFunction(function(node,edge){return edge.target().same(node)?1:0}),outdegree:defineDegreeFunction(function(node,edge){return edge.source().same(node)?1:0})});function defineDegreeBoundsFunction(degreeFn,callback){return function(includeLoops){for(var ret,nodes3=this.nodes(),i=0;i<nodes3.length;i++){var ele=nodes3[i],degree=ele[degreeFn](includeLoops);degree!==void 0&&(ret===void 0||callback(degree,ret))&&(ret=degree)}return ret}}extend(elesfn$d,{minDegree:defineDegreeBoundsFunction("degree",function(degree,min4){return degree<min4}),maxDegree:defineDegreeBoundsFunction("degree",function(degree,max5){return degree>max5}),minIndegree:defineDegreeBoundsFunction("indegree",function(degree,min4){return degree<min4}),maxIndegree:defineDegreeBoundsFunction("indegree",function(degree,max5){return degree>max5}),minOutdegree:defineDegreeBoundsFunction("outdegree",function(degree,min4){return degree<min4}),maxOutdegree:defineDegreeBoundsFunction("outdegree",function(degree,max5){return degree>max5})});extend(elesfn$d,{totalDegree:function(includeLoops){for(var total=0,nodes3=this.nodes(),i=0;i<nodes3.length;i++)total+=nodes3[i].degree(includeLoops);return total}});var fn$4,elesfn$c,beforePositionSet=function(eles,newPos,silent){for(var i=0;i<eles.length;i++){var ele=eles[i];if(!ele.locked()){var oldPos=ele._private.position,delta={x:newPos.x!=null?newPos.x-oldPos.x:0,y:newPos.y!=null?newPos.y-oldPos.y:0};ele.isParent()&&!(delta.x===0&&delta.y===0)&&ele.children().shift(delta,silent),ele.dirtyBoundingBoxCache()}}},positionDef={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(ele){ele.updateCompoundBounds()},beforeSet:function(eles,newPos){beforePositionSet(eles,newPos,!1)},onSet:function(eles){eles.dirtyCompoundBoundsCache()},canSet:function(ele){return!ele.locked()}};fn$4=elesfn$c={position:define.data(positionDef),silentPosition:define.data(extend({},positionDef,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(eles,newPos){beforePositionSet(eles,newPos,!0)},onSet:function(eles){eles.dirtyCompoundBoundsCache()}})),positions:function(pos,silent){if(plainObject(pos))silent?this.silentPosition(pos):this.position(pos);else if(fn$6(pos)){var _fn=pos,cy=this.cy();cy.startBatch();for(var i=0;i<this.length;i++){var ele=this[i],_pos=void 0;(_pos=_fn(ele,i))&&(silent?ele.silentPosition(_pos):ele.position(_pos))}cy.endBatch()}return this},silentPositions:function(pos){return this.positions(pos,!0)},shift:function(dim,val,silent){var delta;if(plainObject(dim)?(delta={x:number$1(dim.x)?dim.x:0,y:number$1(dim.y)?dim.y:0},silent=val):string(dim)&&number$1(val)&&(delta={x:0,y:0},delta[dim]=val),delta!=null){var cy=this.cy();cy.startBatch();for(var i=0;i<this.length;i++){var ele=this[i];if(!(cy.hasCompoundNodes()&&ele.isChild()&&ele.ancestors().anySame(this))){var pos=ele.position(),newPos={x:pos.x+delta.x,y:pos.y+delta.y};silent?ele.silentPosition(newPos):ele.position(newPos)}}cy.endBatch()}return this},silentShift:function(dim,val){return plainObject(dim)?this.shift(dim,!0):string(dim)&&number$1(val)&&this.shift(dim,val,!0),this},renderedPosition:function(dim,val){var ele=this[0],cy=this.cy(),zoom2=cy.zoom(),pan2=cy.pan(),rpos=plainObject(dim)?dim:void 0,setting=rpos!==void 0||val!==void 0&&string(dim);if(ele&&ele.isNode())if(setting)for(var i=0;i<this.length;i++){var _ele=this[i];val!==void 0?_ele.position(dim,(val-pan2[dim])/zoom2):rpos!==void 0&&_ele.position(renderedToModelPosition(rpos,zoom2,pan2))}else{var pos=ele.position();return rpos=modelToRenderedPosition$1(pos,zoom2,pan2),dim===void 0?rpos:rpos[dim]}else if(!setting)return;return this},relativePosition:function(dim,val){var ele=this[0],cy=this.cy(),ppos=plainObject(dim)?dim:void 0,setting=ppos!==void 0||val!==void 0&&string(dim),hasCompoundNodes2=cy.hasCompoundNodes();if(ele&&ele.isNode())if(setting)for(var i=0;i<this.length;i++){var _ele2=this[i],parent4=hasCompoundNodes2?_ele2.parent():null,hasParent=parent4&&parent4.length>0,relativeToParent=hasParent;hasParent&&(parent4=parent4[0]);var origin=relativeToParent?parent4.position():{x:0,y:0};val!==void 0?_ele2.position(dim,val+origin[dim]):ppos!==void 0&&_ele2.position({x:ppos.x+origin.x,y:ppos.y+origin.y})}else{var pos=ele.position(),_parent=hasCompoundNodes2?ele.parent():null,_hasParent=_parent&&_parent.length>0,_relativeToParent=_hasParent;_hasParent&&(_parent=_parent[0]);var _origin=_relativeToParent?_parent.position():{x:0,y:0};return ppos={x:pos.x-_origin.x,y:pos.y-_origin.y},dim===void 0?ppos:ppos[dim]}else if(!setting)return;return this}};fn$4.modelPosition=fn$4.point=fn$4.position;fn$4.modelPositions=fn$4.points=fn$4.positions;fn$4.renderedPoint=fn$4.renderedPosition;fn$4.relativePoint=fn$4.relativePosition;var position=elesfn$c,fn$3,elesfn$b;fn$3=elesfn$b={};elesfn$b.renderedBoundingBox=function(options2){var bb=this.boundingBox(options2),cy=this.cy(),zoom2=cy.zoom(),pan2=cy.pan(),x1=bb.x1*zoom2+pan2.x,x2=bb.x2*zoom2+pan2.x,y1=bb.y1*zoom2+pan2.y,y2=bb.y2*zoom2+pan2.y;return{x1,x2,y1,y2,w:x2-x1,h:y2-y1}};elesfn$b.dirtyCompoundBoundsCache=function(){var silent=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,cy=this.cy();return!cy.styleEnabled()||!cy.hasCompoundNodes()?this:(this.forEachUp(function(ele){if(ele.isParent()){var _p=ele._private;_p.compoundBoundsClean=!1,_p.bbCache=null,silent||ele.emitAndNotify("bounds")}}),this)};elesfn$b.updateCompoundBounds=function(){var force=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,cy=this.cy();if(!cy.styleEnabled()||!cy.hasCompoundNodes())return this;if(!force&&cy.batching())return this;function update(parent4){if(!parent4.isParent())return;var _p2=parent4._private,children=parent4.children(),includeLabels=parent4.pstyle("compound-sizing-wrt-labels").value==="include",min4={width:{val:parent4.pstyle("min-width").pfValue,left:parent4.pstyle("min-width-bias-left"),right:parent4.pstyle("min-width-bias-right")},height:{val:parent4.pstyle("min-height").pfValue,top:parent4.pstyle("min-height-bias-top"),bottom:parent4.pstyle("min-height-bias-bottom")}},bb=children.boundingBox({includeLabels,includeOverlays:!1,useCache:!1}),pos=_p2.position;(bb.w===0||bb.h===0)&&(bb={w:parent4.pstyle("width").pfValue,h:parent4.pstyle("height").pfValue},bb.x1=pos.x-bb.w/2,bb.x2=pos.x+bb.w/2,bb.y1=pos.y-bb.h/2,bb.y2=pos.y+bb.h/2);function computeBiasValues(propDiff,propBias,propBiasComplement){var biasDiff=0,biasComplementDiff=0,biasTotal=propBias+propBiasComplement;return propDiff>0&&biasTotal>0&&(biasDiff=propBias/biasTotal*propDiff,biasComplementDiff=propBiasComplement/biasTotal*propDiff),{biasDiff,biasComplementDiff}}function computePaddingValues(width2,height2,paddingObject,relativeTo){if(paddingObject.units==="%")switch(relativeTo){case"width":return width2>0?paddingObject.pfValue*width2:0;case"height":return height2>0?paddingObject.pfValue*height2:0;case"average":return width2>0&&height2>0?paddingObject.pfValue*(width2+height2)/2:0;case"min":return width2>0&&height2>0?width2>height2?paddingObject.pfValue*height2:paddingObject.pfValue*width2:0;case"max":return width2>0&&height2>0?width2>height2?paddingObject.pfValue*width2:paddingObject.pfValue*height2:0;default:return 0}else return paddingObject.units==="px"?paddingObject.pfValue:0}var leftVal=min4.width.left.value;min4.width.left.units==="px"&&min4.width.val>0&&(leftVal=leftVal*100/min4.width.val);var rightVal=min4.width.right.value;min4.width.right.units==="px"&&min4.width.val>0&&(rightVal=rightVal*100/min4.width.val);var topVal=min4.height.top.value;min4.height.top.units==="px"&&min4.height.val>0&&(topVal=topVal*100/min4.height.val);var bottomVal=min4.height.bottom.value;min4.height.bottom.units==="px"&&min4.height.val>0&&(bottomVal=bottomVal*100/min4.height.val);var widthBiasDiffs=computeBiasValues(min4.width.val-bb.w,leftVal,rightVal),diffLeft=widthBiasDiffs.biasDiff,diffRight=widthBiasDiffs.biasComplementDiff,heightBiasDiffs=computeBiasValues(min4.height.val-bb.h,topVal,bottomVal),diffTop=heightBiasDiffs.biasDiff,diffBottom=heightBiasDiffs.biasComplementDiff;_p2.autoPadding=computePaddingValues(bb.w,bb.h,parent4.pstyle("padding"),parent4.pstyle("padding-relative-to").value),_p2.autoWidth=Math.max(bb.w,min4.width.val),pos.x=(-diffLeft+bb.x1+bb.x2+diffRight)/2,_p2.autoHeight=Math.max(bb.h,min4.height.val),pos.y=(-diffTop+bb.y1+bb.y2+diffBottom)/2}for(var i=0;i<this.length;i++){var ele=this[i],_p=ele._private;(!_p.compoundBoundsClean||force)&&(update(ele),cy.batching()||(_p.compoundBoundsClean=!0))}return this};var noninf=function(x2){return x2===1/0||x2===-1/0?0:x2},updateBounds=function(b,x1,y1,x2,y2){x2-x1===0||y2-y1===0||x1==null||y1==null||x2==null||y2==null||(b.x1=x1<b.x1?x1:b.x1,b.x2=x2>b.x2?x2:b.x2,b.y1=y1<b.y1?y1:b.y1,b.y2=y2>b.y2?y2:b.y2,b.w=b.x2-b.x1,b.h=b.y2-b.y1)},updateBoundsFromBox=function(b,b2){return b2==null?b:updateBounds(b,b2.x1,b2.y1,b2.x2,b2.y2)},prefixedProperty=function(obj,field,prefix){return getPrefixedProperty(obj,field,prefix)},updateBoundsFromArrow=function(bounds2,ele,prefix){if(!ele.cy().headless()){var _p=ele._private,rstyle=_p.rstyle,halfArW=rstyle.arrowWidth/2,arrowType=ele.pstyle(prefix+"-arrow-shape").value,x2,y2;if(arrowType!=="none"){prefix==="source"?(x2=rstyle.srcX,y2=rstyle.srcY):prefix==="target"?(x2=rstyle.tgtX,y2=rstyle.tgtY):(x2=rstyle.midX,y2=rstyle.midY);var bbs=_p.arrowBounds=_p.arrowBounds||{},bb=bbs[prefix]=bbs[prefix]||{};bb.x1=x2-halfArW,bb.y1=y2-halfArW,bb.x2=x2+halfArW,bb.y2=y2+halfArW,bb.w=bb.x2-bb.x1,bb.h=bb.y2-bb.y1,expandBoundingBox(bb,1),updateBounds(bounds2,bb.x1,bb.y1,bb.x2,bb.y2)}}},updateBoundsFromLabel=function(bounds2,ele,prefix){if(!ele.cy().headless()){var prefixDash;prefix?prefixDash=prefix+"-":prefixDash="";var _p=ele._private,rstyle=_p.rstyle,label=ele.pstyle(prefixDash+"label").strValue;if(label){var halign=ele.pstyle("text-halign"),valign=ele.pstyle("text-valign"),labelWidth=prefixedProperty(rstyle,"labelWidth",prefix),labelHeight=prefixedProperty(rstyle,"labelHeight",prefix),labelX=prefixedProperty(rstyle,"labelX",prefix),labelY=prefixedProperty(rstyle,"labelY",prefix),marginX=ele.pstyle(prefixDash+"text-margin-x").pfValue,marginY=ele.pstyle(prefixDash+"text-margin-y").pfValue,isEdge2=ele.isEdge(),rotation=ele.pstyle(prefixDash+"text-rotation"),outlineWidth=ele.pstyle("text-outline-width").pfValue,borderWidth=ele.pstyle("text-border-width").pfValue,halfBorderWidth=borderWidth/2,padding=ele.pstyle("text-background-padding").pfValue,marginOfError=2,lh=labelHeight,lw=labelWidth,lw_2=lw/2,lh_2=lh/2,lx1,lx2,ly1,ly2;if(isEdge2)lx1=labelX-lw_2,lx2=labelX+lw_2,ly1=labelY-lh_2,ly2=labelY+lh_2;else{switch(halign.value){case"left":lx1=labelX-lw,lx2=labelX;break;case"center":lx1=labelX-lw_2,lx2=labelX+lw_2;break;case"right":lx1=labelX,lx2=labelX+lw;break}switch(valign.value){case"top":ly1=labelY-lh,ly2=labelY;break;case"center":ly1=labelY-lh_2,ly2=labelY+lh_2;break;case"bottom":ly1=labelY,ly2=labelY+lh;break}}var leftPad=marginX-Math.max(outlineWidth,halfBorderWidth)-padding-marginOfError,rightPad=marginX+Math.max(outlineWidth,halfBorderWidth)+padding+marginOfError,topPad=marginY-Math.max(outlineWidth,halfBorderWidth)-padding-marginOfError,botPad=marginY+Math.max(outlineWidth,halfBorderWidth)+padding+marginOfError;lx1+=leftPad,lx2+=rightPad,ly1+=topPad,ly2+=botPad;var bbPrefix=prefix||"main",bbs=_p.labelBounds,bb=bbs[bbPrefix]=bbs[bbPrefix]||{};bb.x1=lx1,bb.y1=ly1,bb.x2=lx2,bb.y2=ly2,bb.w=lx2-lx1,bb.h=ly2-ly1,bb.leftPad=leftPad,bb.rightPad=rightPad,bb.topPad=topPad,bb.botPad=botPad;var isAutorotate=isEdge2&&rotation.strValue==="autorotate",isPfValue=rotation.pfValue!=null&&rotation.pfValue!==0;if(isAutorotate||isPfValue){var theta=isAutorotate?prefixedProperty(_p.rstyle,"labelAngle",prefix):rotation.pfValue,cos2=Math.cos(theta),sin2=Math.sin(theta),xo=(lx1+lx2)/2,yo=(ly1+ly2)/2;if(!isEdge2){switch(halign.value){case"left":xo=lx2;break;case"right":xo=lx1;break}switch(valign.value){case"top":yo=ly2;break;case"bottom":yo=ly1;break}}var rotate2=function(x2,y2){return x2=x2-xo,y2=y2-yo,{x:x2*cos2-y2*sin2+xo,y:x2*sin2+y2*cos2+yo}},px1y1=rotate2(lx1,ly1),px1y2=rotate2(lx1,ly2),px2y1=rotate2(lx2,ly1),px2y2=rotate2(lx2,ly2);lx1=Math.min(px1y1.x,px1y2.x,px2y1.x,px2y2.x),lx2=Math.max(px1y1.x,px1y2.x,px2y1.x,px2y2.x),ly1=Math.min(px1y1.y,px1y2.y,px2y1.y,px2y2.y),ly2=Math.max(px1y1.y,px1y2.y,px2y1.y,px2y2.y)}var bbPrefixRot=bbPrefix+"Rot",bbRot=bbs[bbPrefixRot]=bbs[bbPrefixRot]||{};bbRot.x1=lx1,bbRot.y1=ly1,bbRot.x2=lx2,bbRot.y2=ly2,bbRot.w=lx2-lx1,bbRot.h=ly2-ly1,updateBounds(bounds2,lx1,ly1,lx2,ly2),updateBounds(_p.labelBounds.all,lx1,ly1,lx2,ly2)}return bounds2}},updateBoundsFromOutline=function(bounds2,ele){if(!ele.cy().headless()){var outlineOpacity=ele.pstyle("outline-opacity").value,outlineWidth=ele.pstyle("outline-width").value,outlineOffset=ele.pstyle("outline-offset").value,expansion=outlineWidth+outlineOffset;updateBoundsFromMiter(bounds2,ele,outlineOpacity,expansion,"outside",expansion/2)}},updateBoundsFromMiter=function(bounds2,ele,opacity,expansionSize,expansionPosition,useFallbackValue){if(!(opacity===0||expansionSize<=0||expansionPosition==="inside")){var cy=ele.cy(),r=cy.renderer(),rshape=r.nodeShapes[r.getNodeShape(ele)];if(rshape){var _ele$position=ele.position(),x2=_ele$position.x,y2=_ele$position.y,w=ele.width(),h=ele.height();if(rshape.hasMiterBounds){expansionPosition==="center"&&(expansionSize/=2);var mbb=rshape.miterBounds(x2,y2,w,h,expansionSize);updateBoundsFromBox(bounds2,mbb)}else useFallbackValue!=null&&useFallbackValue>0&&expandBoundingBoxSides(bounds2,[useFallbackValue,useFallbackValue,useFallbackValue,useFallbackValue])}}},updateBoundsFromMiterBorder=function(bounds2,ele){if(!ele.cy().headless()){var borderOpacity=ele.pstyle("border-opacity").value,borderWidth=ele.pstyle("border-width").pfValue,borderPosition=ele.pstyle("border-position").value;updateBoundsFromMiter(bounds2,ele,borderOpacity,borderWidth,borderPosition)}},boundingBoxImpl=function(ele,options2){var cy=ele._private.cy,styleEnabled2=cy.styleEnabled(),headless2=cy.headless(),bounds2=makeBoundingBox(),_p=ele._private,isNode2=ele.isNode(),isEdge2=ele.isEdge(),ex1,ex2,ey1,ey2,x2,y2,rstyle=_p.rstyle,manualExpansion=isNode2&&styleEnabled2?ele.pstyle("bounds-expansion").pfValue:[0],isDisplayed=function(ele2){return ele2.pstyle("display").value!=="none"},displayed=!styleEnabled2||isDisplayed(ele)&&(!isEdge2||isDisplayed(ele.source())&&isDisplayed(ele.target()));if(displayed){var overlayOpacity=0,overlayPadding=0;styleEnabled2&&options2.includeOverlays&&(overlayOpacity=ele.pstyle("overlay-opacity").value,overlayOpacity!==0&&(overlayPadding=ele.pstyle("overlay-padding").value));var underlayOpacity=0,underlayPadding=0;styleEnabled2&&options2.includeUnderlays&&(underlayOpacity=ele.pstyle("underlay-opacity").value,underlayOpacity!==0&&(underlayPadding=ele.pstyle("underlay-padding").value));var padding=Math.max(overlayPadding,underlayPadding),w=0,wHalf=0;if(styleEnabled2&&(w=ele.pstyle("width").pfValue,wHalf=w/2),isNode2&&options2.includeNodes){var pos=ele.position();x2=pos.x,y2=pos.y;var _w=ele.outerWidth(),halfW=_w/2,h=ele.outerHeight(),halfH=h/2;ex1=x2-halfW,ex2=x2+halfW,ey1=y2-halfH,ey2=y2+halfH,updateBounds(bounds2,ex1,ey1,ex2,ey2),styleEnabled2&&updateBoundsFromOutline(bounds2,ele),styleEnabled2&&options2.includeOutlines&&!headless2&&updateBoundsFromOutline(bounds2,ele),styleEnabled2&&updateBoundsFromMiterBorder(bounds2,ele)}else if(isEdge2&&options2.includeEdges)if(styleEnabled2&&!headless2){var curveStyle=ele.pstyle("curve-style").strValue;if(ex1=Math.min(rstyle.srcX,rstyle.midX,rstyle.tgtX),ex2=Math.max(rstyle.srcX,rstyle.midX,rstyle.tgtX),ey1=Math.min(rstyle.srcY,rstyle.midY,rstyle.tgtY),ey2=Math.max(rstyle.srcY,rstyle.midY,rstyle.tgtY),ex1-=wHalf,ex2+=wHalf,ey1-=wHalf,ey2+=wHalf,updateBounds(bounds2,ex1,ey1,ex2,ey2),curveStyle==="haystack"){var hpts=rstyle.haystackPts;if(hpts&&hpts.length===2){if(ex1=hpts[0].x,ey1=hpts[0].y,ex2=hpts[1].x,ey2=hpts[1].y,ex1>ex2){var temp=ex1;ex1=ex2,ex2=temp}if(ey1>ey2){var _temp=ey1;ey1=ey2,ey2=_temp}updateBounds(bounds2,ex1-wHalf,ey1-wHalf,ex2+wHalf,ey2+wHalf)}}else if(curveStyle==="bezier"||curveStyle==="unbundled-bezier"||endsWith(curveStyle,"segments")||endsWith(curveStyle,"taxi")){var pts2;switch(curveStyle){case"bezier":case"unbundled-bezier":pts2=rstyle.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":pts2=rstyle.linePts;break}if(pts2!=null)for(var j=0;j<pts2.length;j++){var pt=pts2[j];ex1=pt.x-wHalf,ex2=pt.x+wHalf,ey1=pt.y-wHalf,ey2=pt.y+wHalf,updateBounds(bounds2,ex1,ey1,ex2,ey2)}}}else{var n1=ele.source(),n1pos=n1.position(),n2=ele.target(),n2pos=n2.position();if(ex1=n1pos.x,ex2=n2pos.x,ey1=n1pos.y,ey2=n2pos.y,ex1>ex2){var _temp2=ex1;ex1=ex2,ex2=_temp2}if(ey1>ey2){var _temp3=ey1;ey1=ey2,ey2=_temp3}ex1-=wHalf,ex2+=wHalf,ey1-=wHalf,ey2+=wHalf,updateBounds(bounds2,ex1,ey1,ex2,ey2)}if(styleEnabled2&&options2.includeEdges&&isEdge2&&(updateBoundsFromArrow(bounds2,ele,"mid-source"),updateBoundsFromArrow(bounds2,ele,"mid-target"),updateBoundsFromArrow(bounds2,ele,"source"),updateBoundsFromArrow(bounds2,ele,"target")),styleEnabled2){var ghost=ele.pstyle("ghost").value==="yes";if(ghost){var gx=ele.pstyle("ghost-offset-x").pfValue,gy=ele.pstyle("ghost-offset-y").pfValue;updateBounds(bounds2,bounds2.x1+gx,bounds2.y1+gy,bounds2.x2+gx,bounds2.y2+gy)}}var bbBody=_p.bodyBounds=_p.bodyBounds||{};assignBoundingBox(bbBody,bounds2),expandBoundingBoxSides(bbBody,manualExpansion),expandBoundingBox(bbBody,1),styleEnabled2&&(ex1=bounds2.x1,ex2=bounds2.x2,ey1=bounds2.y1,ey2=bounds2.y2,updateBounds(bounds2,ex1-padding,ey1-padding,ex2+padding,ey2+padding));var bbOverlay=_p.overlayBounds=_p.overlayBounds||{};assignBoundingBox(bbOverlay,bounds2),expandBoundingBoxSides(bbOverlay,manualExpansion),expandBoundingBox(bbOverlay,1);var bbLabels=_p.labelBounds=_p.labelBounds||{};bbLabels.all!=null?clearBoundingBox(bbLabels.all):bbLabels.all=makeBoundingBox(),styleEnabled2&&options2.includeLabels&&(options2.includeMainLabels&&updateBoundsFromLabel(bounds2,ele,null),isEdge2&&(options2.includeSourceLabels&&updateBoundsFromLabel(bounds2,ele,"source"),options2.includeTargetLabels&&updateBoundsFromLabel(bounds2,ele,"target")))}return bounds2.x1=noninf(bounds2.x1),bounds2.y1=noninf(bounds2.y1),bounds2.x2=noninf(bounds2.x2),bounds2.y2=noninf(bounds2.y2),bounds2.w=noninf(bounds2.x2-bounds2.x1),bounds2.h=noninf(bounds2.y2-bounds2.y1),bounds2.w>0&&bounds2.h>0&&displayed&&(expandBoundingBoxSides(bounds2,manualExpansion),expandBoundingBox(bounds2,1)),bounds2},getKey=function(opts){var i=0,tf=function(val){return(val?1:0)<<i++},key=0;return key+=tf(opts.incudeNodes),key+=tf(opts.includeEdges),key+=tf(opts.includeLabels),key+=tf(opts.includeMainLabels),key+=tf(opts.includeSourceLabels),key+=tf(opts.includeTargetLabels),key+=tf(opts.includeOverlays),key+=tf(opts.includeOutlines),key},getBoundingBoxPosKey=function(ele){var r=function(x2){return Math.round(x2)};if(ele.isEdge()){var p1=ele.source().position(),p2=ele.target().position();return hashIntsArray([r(p1.x),r(p1.y),r(p2.x),r(p2.y)])}else{var p3=ele.position();return hashIntsArray([r(p3.x),r(p3.y)])}},cachedBoundingBoxImpl=function(ele,opts){var _p=ele._private,bb,isEdge2=ele.isEdge(),key=opts==null?defBbOptsKey:getKey(opts),usingDefOpts=key===defBbOptsKey;if(_p.bbCache==null?(bb=boundingBoxImpl(ele,defBbOpts),_p.bbCache=bb,_p.bbCachePosKey=getBoundingBoxPosKey(ele)):bb=_p.bbCache,!usingDefOpts){var isNode2=ele.isNode();bb=makeBoundingBox(),(opts.includeNodes&&isNode2||opts.includeEdges&&!isNode2)&&(opts.includeOverlays?updateBoundsFromBox(bb,_p.overlayBounds):updateBoundsFromBox(bb,_p.bodyBounds)),opts.includeLabels&&(opts.includeMainLabels&&(!isEdge2||opts.includeSourceLabels&&opts.includeTargetLabels)?updateBoundsFromBox(bb,_p.labelBounds.all):(opts.includeMainLabels&&updateBoundsFromBox(bb,_p.labelBounds.mainRot),opts.includeSourceLabels&&updateBoundsFromBox(bb,_p.labelBounds.sourceRot),opts.includeTargetLabels&&updateBoundsFromBox(bb,_p.labelBounds.targetRot))),bb.w=bb.x2-bb.x1,bb.h=bb.y2-bb.y1}return bb},defBbOpts={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},defBbOptsKey=getKey(defBbOpts),filledBbOpts=defaults$g(defBbOpts);elesfn$b.boundingBox=function(options2){var bounds2,useCache=options2===void 0||options2.useCache===void 0||options2.useCache===!0,isDirty=memoize(function(ele2){var _p=ele2._private;return _p.bbCache==null||_p.styleDirty||_p.bbCachePosKey!==getBoundingBoxPosKey(ele2)},function(ele2){return ele2.id()});if(useCache&&this.length===1&&!isDirty(this[0]))options2===void 0?options2=defBbOpts:options2=filledBbOpts(options2),bounds2=cachedBoundingBoxImpl(this[0],options2);else{bounds2=makeBoundingBox(),options2=options2||defBbOpts;var opts=filledBbOpts(options2),eles=this,cy=eles.cy(),styleEnabled2=cy.styleEnabled();this.edges().forEach(isDirty),this.nodes().forEach(isDirty),styleEnabled2&&this.recalculateRenderedStyle(useCache),this.updateCompoundBounds(!useCache);for(var i=0;i<eles.length;i++){var ele=eles[i];isDirty(ele)&&ele.dirtyBoundingBoxCache(),updateBoundsFromBox(bounds2,cachedBoundingBoxImpl(ele,opts))}}return bounds2.x1=noninf(bounds2.x1),bounds2.y1=noninf(bounds2.y1),bounds2.x2=noninf(bounds2.x2),bounds2.y2=noninf(bounds2.y2),bounds2.w=noninf(bounds2.x2-bounds2.x1),bounds2.h=noninf(bounds2.y2-bounds2.y1),bounds2};elesfn$b.dirtyBoundingBoxCache=function(){for(var i=0;i<this.length;i++){var _p=this[i]._private;_p.bbCache=null,_p.bbCachePosKey=null,_p.bodyBounds=null,_p.overlayBounds=null,_p.labelBounds.all=null,_p.labelBounds.source=null,_p.labelBounds.target=null,_p.labelBounds.main=null,_p.labelBounds.sourceRot=null,_p.labelBounds.targetRot=null,_p.labelBounds.mainRot=null,_p.arrowBounds.source=null,_p.arrowBounds.target=null,_p.arrowBounds["mid-source"]=null,_p.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};elesfn$b.boundingBoxAt=function(fn3){var nodes3=this.nodes(),cy=this.cy(),hasCompoundNodes2=cy.hasCompoundNodes(),parents2=cy.collection();if(hasCompoundNodes2&&(parents2=nodes3.filter(function(node){return node.isParent()}),nodes3=nodes3.not(parents2)),plainObject(fn3)){var obj=fn3;fn3=function(){return obj}}var storeOldPos=function(node,i){return node._private.bbAtOldPos=fn3(node,i)},getOldPos=function(node){return node._private.bbAtOldPos};cy.startBatch(),nodes3.forEach(storeOldPos).silentPositions(fn3),hasCompoundNodes2&&(parents2.dirtyCompoundBoundsCache(),parents2.dirtyBoundingBoxCache(),parents2.updateCompoundBounds(!0));var bb=copyBoundingBox(this.boundingBox({useCache:!1}));return nodes3.silentPositions(getOldPos),hasCompoundNodes2&&(parents2.dirtyCompoundBoundsCache(),parents2.dirtyBoundingBoxCache(),parents2.updateCompoundBounds(!0)),cy.endBatch(),bb};fn$3.boundingbox=fn$3.bb=fn$3.boundingBox;fn$3.renderedBoundingbox=fn$3.renderedBoundingBox;var bounds=elesfn$b,fn$2,elesfn$a;fn$2=elesfn$a={};var defineDimFns=function(opts){opts.uppercaseName=capitalize(opts.name),opts.autoName="auto"+opts.uppercaseName,opts.labelName="label"+opts.uppercaseName,opts.outerName="outer"+opts.uppercaseName,opts.uppercaseOuterName=capitalize(opts.outerName),fn$2[opts.name]=function(){var ele=this[0],_p=ele._private,cy=_p.cy,styleEnabled2=cy._private.styleEnabled;if(ele)if(styleEnabled2){if(ele.isParent())return ele.updateCompoundBounds(),_p[opts.autoName]||0;var d=ele.pstyle(opts.name);switch(d.strValue){case"label":return ele.recalculateRenderedStyle(),_p.rstyle[opts.labelName]||0;default:return d.pfValue}}else return 1},fn$2["outer"+opts.uppercaseName]=function(){var ele=this[0],_p=ele._private,cy=_p.cy,styleEnabled2=cy._private.styleEnabled;if(ele)if(styleEnabled2){var dim=ele[opts.name](),borderPos=ele.pstyle("border-position").value,border;borderPos==="center"?border=ele.pstyle("border-width").pfValue:borderPos==="outside"?border=2*ele.pstyle("border-width").pfValue:border=0;var padding=2*ele.padding();return dim+border+padding}else return 1},fn$2["rendered"+opts.uppercaseName]=function(){var ele=this[0];if(ele){var d=ele[opts.name]();return d*this.cy().zoom()}},fn$2["rendered"+opts.uppercaseOuterName]=function(){var ele=this[0];if(ele){var od=ele[opts.outerName]();return od*this.cy().zoom()}}};defineDimFns({name:"width"});defineDimFns({name:"height"});elesfn$a.padding=function(){var ele=this[0],_p=ele._private;return ele.isParent()?(ele.updateCompoundBounds(),_p.autoPadding!==void 0?_p.autoPadding:ele.pstyle("padding").pfValue):ele.pstyle("padding").pfValue};elesfn$a.paddedHeight=function(){var ele=this[0];return ele.height()+2*ele.padding()};elesfn$a.paddedWidth=function(){var ele=this[0];return ele.width()+2*ele.padding()};var widthHeight=elesfn$a,ifEdge=function(ele,getValue2){if(ele.isEdge()&&ele.takesUpSpace())return getValue2(ele)},ifEdgeRenderedPosition=function(ele,getPoint){if(ele.isEdge()&&ele.takesUpSpace()){var cy=ele.cy();return modelToRenderedPosition$1(getPoint(ele),cy.zoom(),cy.pan())}},ifEdgeRenderedPositions=function(ele,getPoints){if(ele.isEdge()&&ele.takesUpSpace()){var cy=ele.cy(),pan2=cy.pan(),zoom2=cy.zoom();return getPoints(ele).map(function(p2){return modelToRenderedPosition$1(p2,zoom2,pan2)})}},controlPoints=function(ele){return ele.renderer().getControlPoints(ele)},segmentPoints=function(ele){return ele.renderer().getSegmentPoints(ele)},sourceEndpoint=function(ele){return ele.renderer().getSourceEndpoint(ele)},targetEndpoint=function(ele){return ele.renderer().getTargetEndpoint(ele)},midpoint=function(ele){return ele.renderer().getEdgeMidpoint(ele)},pts={controlPoints:{get:controlPoints,mult:!0},segmentPoints:{get:segmentPoints,mult:!0},sourceEndpoint:{get:sourceEndpoint},targetEndpoint:{get:targetEndpoint},midpoint:{get:midpoint}},renderedName=function(name){return"rendered"+name[0].toUpperCase()+name.substr(1)},edgePoints=Object.keys(pts).reduce(function(obj,name){var spec=pts[name],rName=renderedName(name);return obj[name]=function(){return ifEdge(this,spec.get)},spec.mult?obj[rName]=function(){return ifEdgeRenderedPositions(this,spec.get)}:obj[rName]=function(){return ifEdgeRenderedPosition(this,spec.get)},obj},{}),dimensions=extend({},position,bounds,widthHeight,edgePoints);/*!
|
|
9
|
+
Event object based on jQuery events, MIT license
|
|
10
|
+
|
|
11
|
+
https://jquery.org/license/
|
|
12
|
+
https://tldrlegal.com/license/mit-license
|
|
13
|
+
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
14
|
+
*/var Event=function(src,props){this.recycle(src,props)};function returnFalse(){return!1}function returnTrue(){return!0}Event.prototype={instanceString:function(){return"event"},recycle:function(src,props){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=returnFalse,src!=null&&src.preventDefault?(this.type=src.type,this.isDefaultPrevented=src.defaultPrevented?returnTrue:returnFalse):src!=null&&src.type?props=src:this.type=src,props!=null&&(this.originalEvent=props.originalEvent,this.type=props.type!=null?props.type:this.type,this.cy=props.cy,this.target=props.target,this.position=props.position,this.renderedPosition=props.renderedPosition,this.namespace=props.namespace,this.layout=props.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var pos=this.position,zoom2=this.cy.zoom(),pan2=this.cy.pan();this.renderedPosition={x:pos.x*zoom2+pan2.x,y:pos.y*zoom2+pan2.y}}this.timeStamp=src&&src.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue,this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var eventRegex=/^([^.]+)(\.(?:[^.]+))?$/,universalNamespace=".*",defaults$8={qualifierCompare:function(q1,q2){return q1===q2},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(context){return context},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},defaultsKeys=Object.keys(defaults$8),emptyOpts={};function Emitter(){for(var opts=arguments.length>0&&arguments[0]!==void 0?arguments[0]:emptyOpts,context=arguments.length>1?arguments[1]:void 0,i=0;i<defaultsKeys.length;i++){var key=defaultsKeys[i];this[key]=opts[key]||defaults$8[key]}this.context=context||this.context,this.listeners=[],this.emitting=0}var p=Emitter.prototype,forEachEvent=function(self2,handler,events,qualifier,callback,conf,confOverrides){fn$6(qualifier)&&(callback=qualifier,qualifier=null),confOverrides&&(conf==null?conf=confOverrides:conf=extend({},conf,confOverrides));for(var eventList=array(events)?events:events.split(/\s+/),i=0;i<eventList.length;i++){var evt=eventList[i];if(!emptyString(evt)){var match2=evt.match(eventRegex);if(match2){var type=match2[1],namespace=match2[2]?match2[2]:null,ret=handler(self2,evt,type,namespace,qualifier,callback,conf);if(ret===!1)break}}}},makeEventObj=function(self2,obj){return self2.addEventFields(self2.context,obj),new Event(obj.type,obj)},forEachEventObj=function(self2,handler,events){if(event(events)){handler(self2,events);return}else if(plainObject(events)){handler(self2,makeEventObj(self2,events));return}for(var eventList=array(events)?events:events.split(/\s+/),i=0;i<eventList.length;i++){var evt=eventList[i];if(!emptyString(evt)){var match2=evt.match(eventRegex);if(match2){var type=match2[1],namespace=match2[2]?match2[2]:null,eventObj=makeEventObj(self2,{type,namespace,target:self2.context});handler(self2,eventObj)}}}};p.on=p.addListener=function(events,qualifier,callback,conf,confOverrides){return forEachEvent(this,function(self2,event3,type,namespace,qualifier2,callback2,conf2){fn$6(callback2)&&self2.listeners.push({event:event3,callback:callback2,type,namespace,qualifier:qualifier2,conf:conf2})},events,qualifier,callback,conf,confOverrides),this};p.one=function(events,qualifier,callback,conf){return this.on(events,qualifier,callback,conf,{one:!0})};p.removeListener=p.off=function(events,qualifier,callback,conf){var _this=this;this.emitting!==0&&(this.listeners=copyArray(this.listeners));for(var listeners=this.listeners,_loop=function(i2){var listener=listeners[i2];forEachEvent(_this,function(self2,event3,type,namespace,qualifier2,callback2){if((listener.type===type||events==="*")&&(!namespace&&listener.namespace!==".*"||listener.namespace===namespace)&&(!qualifier2||self2.qualifierCompare(listener.qualifier,qualifier2))&&(!callback2||listener.callback===callback2))return listeners.splice(i2,1),!1},events,qualifier,callback,conf)},i=listeners.length-1;i>=0;i--)_loop(i);return this};p.removeAllListeners=function(){return this.removeListener("*")};p.emit=p.trigger=function(events,extraParams,manualCallback){var listeners=this.listeners,numListenersBeforeEmit=listeners.length;return this.emitting++,array(extraParams)||(extraParams=[extraParams]),forEachEventObj(this,function(self2,eventObj){manualCallback!=null&&(listeners=[{event:eventObj.event,type:eventObj.type,namespace:eventObj.namespace,callback:manualCallback}],numListenersBeforeEmit=listeners.length);for(var _loop2=function(){var listener=listeners[i];if(listener.type===eventObj.type&&(!listener.namespace||listener.namespace===eventObj.namespace||listener.namespace===universalNamespace)&&self2.eventMatches(self2.context,listener,eventObj)){var args=[eventObj];extraParams!=null&&push(args,extraParams),self2.beforeEmit(self2.context,listener,eventObj),listener.conf&&listener.conf.one&&(self2.listeners=self2.listeners.filter(function(l){return l!==listener}));var context=self2.callbackContext(self2.context,listener,eventObj),ret=listener.callback.apply(context,args);self2.afterEmit(self2.context,listener,eventObj),ret===!1&&(eventObj.stopPropagation(),eventObj.preventDefault())}},i=0;i<numListenersBeforeEmit;i++)_loop2();self2.bubble(self2.context)&&!eventObj.isPropagationStopped()&&self2.parent(self2.context).emit(eventObj,extraParams)},events),this.emitting--,this};var emitterOptions$1={qualifierCompare:function(selector1,selector2){return selector1==null||selector2==null?selector1==null&&selector2==null:selector1.sameText(selector2)},eventMatches:function(ele,listener,eventObj){var selector=listener.qualifier;return selector!=null?ele!==eventObj.target&&element(eventObj.target)&&selector.matches(eventObj.target):!0},addEventFields:function(ele,evt){evt.cy=ele.cy(),evt.target=ele},callbackContext:function(ele,listener,eventObj){return listener.qualifier!=null?eventObj.target:ele},beforeEmit:function(context,listener){listener.conf&&listener.conf.once&&listener.conf.onceCollection.removeListener(listener.event,listener.qualifier,listener.callback)},bubble:function(){return!0},parent:function(ele){return ele.isChild()?ele.parent():ele.cy()}},argSelector$1=function(arg){return string(arg)?new Selector(arg):arg},elesfn$9={createEmitter:function(){for(var i=0;i<this.length;i++){var ele=this[i],_p=ele._private;_p.emitter||(_p.emitter=new Emitter(emitterOptions$1,ele))}return this},emitter:function(){return this._private.emitter},on:function(events,selector,callback){for(var argSel=argSelector$1(selector),i=0;i<this.length;i++){var ele=this[i];ele.emitter().on(events,argSel,callback)}return this},removeListener:function(events,selector,callback){for(var argSel=argSelector$1(selector),i=0;i<this.length;i++){var ele=this[i];ele.emitter().removeListener(events,argSel,callback)}return this},removeAllListeners:function(){for(var i=0;i<this.length;i++){var ele=this[i];ele.emitter().removeAllListeners()}return this},one:function(events,selector,callback){for(var argSel=argSelector$1(selector),i=0;i<this.length;i++){var ele=this[i];ele.emitter().one(events,argSel,callback)}return this},once:function(events,selector,callback){for(var argSel=argSelector$1(selector),i=0;i<this.length;i++){var ele=this[i];ele.emitter().on(events,argSel,callback,{once:!0,onceCollection:this})}},emit:function(events,extraParams){for(var i=0;i<this.length;i++){var ele=this[i];ele.emitter().emit(events,extraParams)}return this},emitAndNotify:function(event3,extraParams){if(this.length!==0)return this.cy().notify(event3,this),this.emit(event3,extraParams),this}};define.eventAliasesOn(elesfn$9);var elesfn$8={nodes:function(selector){return this.filter(function(ele){return ele.isNode()}).filter(selector)},edges:function(selector){return this.filter(function(ele){return ele.isEdge()}).filter(selector)},byGroup:function(){for(var nodes3=this.spawn(),edges3=this.spawn(),i=0;i<this.length;i++){var ele=this[i];ele.isNode()?nodes3.push(ele):edges3.push(ele)}return{nodes:nodes3,edges:edges3}},filter:function(_filter,thisArg){if(_filter===void 0)return this;if(string(_filter)||elementOrCollection(_filter))return new Selector(_filter).filter(this);if(fn$6(_filter)){for(var filterEles=this.spawn(),eles=this,i=0;i<eles.length;i++){var ele=eles[i],include=thisArg?_filter.apply(thisArg,[ele,i,eles]):_filter(ele,i,eles);include&&filterEles.push(ele)}return filterEles}return this.spawn()},not:function(toRemove){if(toRemove){string(toRemove)&&(toRemove=this.filter(toRemove));for(var elements=this.spawn(),i=0;i<this.length;i++){var element3=this[i],remove2=toRemove.has(element3);remove2||elements.push(element3)}return elements}else return this},absoluteComplement:function(){var cy=this.cy();return cy.mutableElements().not(this)},intersect:function(other){if(string(other)){var selector=other;return this.filter(selector)}for(var elements=this.spawn(),col1=this,col2=other,col1Smaller=this.length<other.length,colS=col1Smaller?col1:col2,colL=col1Smaller?col2:col1,i=0;i<colS.length;i++){var ele=colS[i];colL.has(ele)&&elements.push(ele)}return elements},xor:function(other){var cy=this._private.cy;string(other)&&(other=cy.$(other));var elements=this.spawn(),col1=this,col2=other,add3=function(col,other2){for(var i=0;i<col.length;i++){var ele=col[i],id2=ele._private.data.id,inOther=other2.hasElementWithId(id2);inOther||elements.push(ele)}};return add3(col1,col2),add3(col2,col1),elements},diff:function(other){var cy=this._private.cy;string(other)&&(other=cy.$(other));var left=this.spawn(),right=this.spawn(),both=this.spawn(),col1=this,col2=other,add3=function(col,other2,retEles){for(var i=0;i<col.length;i++){var ele=col[i],id2=ele._private.data.id,inOther=other2.hasElementWithId(id2);inOther?both.merge(ele):retEles.push(ele)}};return add3(col1,col2,left),add3(col2,col1,right),{left,right,both}},add:function(toAdd){var cy=this._private.cy;if(!toAdd)return this;if(string(toAdd)){var selector=toAdd;toAdd=cy.mutableElements().filter(selector)}for(var elements=this.spawnSelf(),i=0;i<toAdd.length;i++){var ele=toAdd[i],add3=!this.has(ele);add3&&elements.push(ele)}return elements},merge:function(toAdd){var _p=this._private,cy=_p.cy;if(!toAdd)return this;if(toAdd&&string(toAdd)){var selector=toAdd;toAdd=cy.mutableElements().filter(selector)}for(var map2=_p.map,i=0;i<toAdd.length;i++){var toAddEle=toAdd[i],id2=toAddEle._private.data.id,add3=!map2.has(id2);if(add3){var index=this.length++;this[index]=toAddEle,map2.set(id2,{ele:toAddEle,index})}}return this},unmergeAt:function(i){var ele=this[i],id2=ele.id(),_p=this._private,map2=_p.map;this[i]=void 0,map2.delete(id2);var unmergedLastEle=i===this.length-1;if(this.length>1&&!unmergedLastEle){var lastEleI=this.length-1,lastEle=this[lastEleI],lastEleId=lastEle._private.data.id;this[lastEleI]=void 0,this[i]=lastEle,map2.set(lastEleId,{ele:lastEle,index:i})}return this.length--,this},unmergeOne:function(ele){ele=ele[0];var _p=this._private,id2=ele._private.data.id,map2=_p.map,entry=map2.get(id2);if(!entry)return this;var i=entry.index;return this.unmergeAt(i),this},unmerge:function(toRemove){var cy=this._private.cy;if(!toRemove)return this;if(toRemove&&string(toRemove)){var selector=toRemove;toRemove=cy.mutableElements().filter(selector)}for(var i=0;i<toRemove.length;i++)this.unmergeOne(toRemove[i]);return this},unmergeBy:function(toRmFn){for(var i=this.length-1;i>=0;i--){var ele=this[i];toRmFn(ele)&&this.unmergeAt(i)}return this},map:function(mapFn,thisArg){for(var arr=[],eles=this,i=0;i<eles.length;i++){var ele=eles[i],ret=thisArg?mapFn.apply(thisArg,[ele,i,eles]):mapFn(ele,i,eles);arr.push(ret)}return arr},reduce:function(fn3,initialValue){for(var val=initialValue,eles=this,i=0;i<eles.length;i++)val=fn3(val,eles[i],i,eles);return val},max:function(valFn,thisArg){for(var max5=-1/0,maxEle,eles=this,i=0;i<eles.length;i++){var ele=eles[i],val=thisArg?valFn.apply(thisArg,[ele,i,eles]):valFn(ele,i,eles);val>max5&&(max5=val,maxEle=ele)}return{value:max5,ele:maxEle}},min:function(valFn,thisArg){for(var min4=1/0,minEle,eles=this,i=0;i<eles.length;i++){var ele=eles[i],val=thisArg?valFn.apply(thisArg,[ele,i,eles]):valFn(ele,i,eles);val<min4&&(min4=val,minEle=ele)}return{value:min4,ele:minEle}}},fn$1=elesfn$8;fn$1.u=fn$1["|"]=fn$1["+"]=fn$1.union=fn$1.or=fn$1.add;fn$1["\\"]=fn$1["!"]=fn$1["-"]=fn$1.difference=fn$1.relativeComplement=fn$1.subtract=fn$1.not;fn$1.n=fn$1["&"]=fn$1["."]=fn$1.and=fn$1.intersection=fn$1.intersect;fn$1["^"]=fn$1["(+)"]=fn$1["(-)"]=fn$1.symmetricDifference=fn$1.symdiff=fn$1.xor;fn$1.fnFilter=fn$1.filterFn=fn$1.stdFilter=fn$1.filter;fn$1.complement=fn$1.abscomp=fn$1.absoluteComplement;var elesfn$7={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var ele=this[0];if(ele)return ele._private.group}},zIndexSort=function(a,b){var cy=a.cy(),hasCompoundNodes2=cy.hasCompoundNodes();function getDepth(ele){var style3=ele.pstyle("z-compound-depth");return style3.value==="auto"?hasCompoundNodes2?ele.zDepth():0:style3.value==="bottom"?-1:style3.value==="top"?MAX_INT$1:0}var depthDiff=getDepth(a)-getDepth(b);if(depthDiff!==0)return depthDiff;function getEleDepth(ele){var style3=ele.pstyle("z-index-compare");return style3.value==="auto"&&ele.isNode()?1:0}var eleDiff=getEleDepth(a)-getEleDepth(b);if(eleDiff!==0)return eleDiff;var zDiff=a.pstyle("z-index").value-b.pstyle("z-index").value;return zDiff!==0?zDiff:a.poolIndex()-b.poolIndex()},elesfn$6={forEach:function(fn3,thisArg){if(fn$6(fn3))for(var N=this.length,i=0;i<N;i++){var ele=this[i],ret=thisArg?fn3.apply(thisArg,[ele,i,this]):fn3(ele,i,this);if(ret===!1)break}return this},toArray:function(){for(var array3=[],i=0;i<this.length;i++)array3.push(this[i]);return array3},slice:function(start,end){var array3=[],thisSize=this.length;end==null&&(end=thisSize),start==null&&(start=0),start<0&&(start=thisSize+start),end<0&&(end=thisSize+end);for(var i=start;i>=0&&i<end&&i<thisSize;i++)array3.push(this[i]);return this.spawn(array3)},size:function(){return this.length},eq:function(i){return this[i]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(sortFn){if(!fn$6(sortFn))return this;var sorted=this.toArray().sort(sortFn);return this.spawn(sorted)},sortByZIndex:function(){return this.sort(zIndexSort)},zDepth:function(){var ele=this[0];if(ele){var _p=ele._private,group2=_p.group;if(group2==="nodes"){var depth=_p.data.parent?ele.parents().size():0;return ele.isParent()?depth:MAX_INT$1-1}else{var src=_p.source,tgt=_p.target,srcDepth=src.zDepth(),tgtDepth=tgt.zDepth();return Math.max(srcDepth,tgtDepth,0)}}}};elesfn$6.each=elesfn$6.forEach;var defineSymbolIterator=function(){var typeofUndef="undefined",isIteratorSupported=(typeof Symbol>"u"?"undefined":_typeof(Symbol))!=typeofUndef&&_typeof(Symbol.iterator)!=typeofUndef;isIteratorSupported&&(elesfn$6[Symbol.iterator]=function(){var _this=this,entry={value:void 0,done:!1},i=0,length=this.length;return _defineProperty$1({next:function(){return i<length?entry.value=_this[i++]:(entry.value=void 0,entry.done=!0),entry}},Symbol.iterator,function(){return this})})};defineSymbolIterator();var getLayoutDimensionOptions=defaults$g({nodeDimensionsIncludeLabels:!1}),elesfn$5={layoutDimensions:function(options2){options2=getLayoutDimensionOptions(options2);var dims;if(!this.takesUpSpace())dims={w:0,h:0};else if(options2.nodeDimensionsIncludeLabels){var bbDim=this.boundingBox();dims={w:bbDim.w,h:bbDim.h}}else dims={w:this.outerWidth(),h:this.outerHeight()};return(dims.w===0||dims.h===0)&&(dims.w=dims.h=1),dims},layoutPositions:function(layout4,options2,fn3){var nodes3=this.nodes().filter(function(n){return!n.isParent()}),cy=this.cy(),layoutEles=options2.eles,getMemoizeKey=function(node2){return node2.id()},fnMem=memoize(fn3,getMemoizeKey);layout4.emit({type:"layoutstart",layout:layout4}),layout4.animations=[];var calculateSpacing=function(spacing,nodesBb,pos){var center2={x:nodesBb.x1+nodesBb.w/2,y:nodesBb.y1+nodesBb.h/2},spacingVector={x:(pos.x-center2.x)*spacing,y:(pos.y-center2.y)*spacing};return{x:center2.x+spacingVector.x,y:center2.y+spacingVector.y}},useSpacingFactor=options2.spacingFactor&&options2.spacingFactor!==1,spacingBb=function(){if(!useSpacingFactor)return null;for(var bb2=makeBoundingBox(),i2=0;i2<nodes3.length;i2++){var node2=nodes3[i2],pos=fnMem(node2,i2);expandBoundingBoxByPoint(bb2,pos.x,pos.y)}return bb2},bb=spacingBb(),getFinalPos=memoize(function(node2,i2){var newPos2=fnMem(node2,i2);if(useSpacingFactor){var spacing=Math.abs(options2.spacingFactor);newPos2=calculateSpacing(spacing,bb,newPos2)}return options2.transform!=null&&(newPos2=options2.transform(node2,newPos2)),newPos2},getMemoizeKey);if(options2.animate){for(var i=0;i<nodes3.length;i++){var node=nodes3[i],newPos=getFinalPos(node,i),animateNode=options2.animateFilter==null||options2.animateFilter(node,i);if(animateNode){var ani=node.animation({position:newPos,duration:options2.animationDuration,easing:options2.animationEasing});layout4.animations.push(ani)}else node.position(newPos)}if(options2.fit){var fitAni=cy.animation({fit:{boundingBox:layoutEles.boundingBoxAt(getFinalPos),padding:options2.padding},duration:options2.animationDuration,easing:options2.animationEasing});layout4.animations.push(fitAni)}else if(options2.zoom!==void 0&&options2.pan!==void 0){var zoomPanAni=cy.animation({zoom:options2.zoom,pan:options2.pan,duration:options2.animationDuration,easing:options2.animationEasing});layout4.animations.push(zoomPanAni)}layout4.animations.forEach(function(ani2){return ani2.play()}),layout4.one("layoutready",options2.ready),layout4.emit({type:"layoutready",layout:layout4}),Promise$1.all(layout4.animations.map(function(ani2){return ani2.promise()})).then(function(){layout4.one("layoutstop",options2.stop),layout4.emit({type:"layoutstop",layout:layout4})})}else nodes3.positions(getFinalPos),options2.fit&&cy.fit(options2.eles,options2.padding),options2.zoom!=null&&cy.zoom(options2.zoom),options2.pan&&cy.pan(options2.pan),layout4.one("layoutready",options2.ready),layout4.emit({type:"layoutready",layout:layout4}),layout4.one("layoutstop",options2.stop),layout4.emit({type:"layoutstop",layout:layout4});return this},layout:function(options2){var cy=this.cy();return cy.makeLayout(extend({},options2,{eles:this}))}};elesfn$5.createLayout=elesfn$5.makeLayout=elesfn$5.layout;function styleCache(key,fn3,ele){var _p=ele._private,cache3=_p.styleCache=_p.styleCache||[],val;return(val=cache3[key])!=null||(val=cache3[key]=fn3(ele)),val}function cacheStyleFunction(key,fn3){return key=hashString(key),function(ele){return styleCache(key,fn3,ele)}}function cachePrototypeStyleFunction(key,fn3){key=hashString(key);var selfFn=function(ele){return fn3.call(ele)};return function(){var ele=this[0];if(ele)return styleCache(key,selfFn,ele)}}var elesfn$4={recalculateRenderedStyle:function(useCache){var cy=this.cy(),renderer3=cy.renderer(),styleEnabled2=cy.styleEnabled();return renderer3&&styleEnabled2&&renderer3.recalculateRenderedStyle(this,useCache),this},dirtyStyleCache:function(){var cy=this.cy(),dirty=function(ele){return ele._private.styleCache=null};if(cy.hasCompoundNodes()){var eles;eles=this.spawnSelf().merge(this.descendants()).merge(this.parents()),eles.merge(eles.connectedEdges()),eles.forEach(dirty)}else this.forEach(function(ele){dirty(ele),ele.connectedEdges().forEach(dirty)});return this},updateStyle:function(notifyRenderer){var cy=this._private.cy;if(!cy.styleEnabled())return this;if(cy.batching()){var bEles=cy._private.batchStyleEles;return bEles.merge(this),this}var hasCompounds=cy.hasCompoundNodes(),updatedEles=this;notifyRenderer=!!(notifyRenderer||notifyRenderer===void 0),hasCompounds&&(updatedEles=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var changedEles=updatedEles;return notifyRenderer?changedEles.emitAndNotify("style"):changedEles.emit("style"),updatedEles.forEach(function(ele){return ele._private.styleDirty=!0}),this},cleanStyle:function(){var cy=this.cy();if(cy.styleEnabled())for(var i=0;i<this.length;i++){var ele=this[i];ele._private.styleDirty&&(ele._private.styleDirty=!1,cy.style().apply(ele))}},parsedStyle:function(property){var includeNonDefault=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ele=this[0],cy=ele.cy();if(cy.styleEnabled()&&ele){ele._private.styleDirty&&(ele._private.styleDirty=!1,cy.style().apply(ele));var overriddenStyle=ele._private.style[property];return overriddenStyle??(includeNonDefault?cy.style().getDefaultProperty(property):null)}},numericStyle:function(property){var ele=this[0];if(ele.cy().styleEnabled()&&ele){var pstyle=ele.pstyle(property);return pstyle.pfValue!==void 0?pstyle.pfValue:pstyle.value}},numericStyleUnits:function(property){var ele=this[0];if(ele.cy().styleEnabled()&&ele)return ele.pstyle(property).units},renderedStyle:function(property){var cy=this.cy();if(!cy.styleEnabled())return this;var ele=this[0];if(ele)return cy.style().getRenderedStyle(ele,property)},style:function(name,value){var cy=this.cy();if(!cy.styleEnabled())return this;var updateTransitions=!1,style3=cy.style();if(plainObject(name)){var props=name;style3.applyBypass(this,props,updateTransitions),this.emitAndNotify("style")}else if(string(name))if(value===void 0){var ele=this[0];return ele?style3.getStylePropertyValue(ele,name):void 0}else style3.applyBypass(this,name,value,updateTransitions),this.emitAndNotify("style");else if(name===void 0){var _ele=this[0];return _ele?style3.getRawStyle(_ele):void 0}return this},removeStyle:function(names){var cy=this.cy();if(!cy.styleEnabled())return this;var updateTransitions=!1,style3=cy.style(),eles=this;if(names===void 0)for(var i=0;i<eles.length;i++){var ele=eles[i];style3.removeAllBypasses(ele,updateTransitions)}else{names=names.split(/\s+/);for(var _i=0;_i<eles.length;_i++){var _ele2=eles[_i];style3.removeBypasses(_ele2,names,updateTransitions)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var cy=this.cy();if(!cy.styleEnabled())return 1;var hasCompoundNodes2=cy.hasCompoundNodes(),ele=this[0];if(ele){var _p=ele._private,parentOpacity=ele.pstyle("opacity").value;if(!hasCompoundNodes2)return parentOpacity;var parents2=_p.data.parent?ele.parents():null;if(parents2)for(var i=0;i<parents2.length;i++){var parent4=parents2[i],opacity=parent4.pstyle("opacity").value;parentOpacity=opacity*parentOpacity}return parentOpacity}},transparent:function(){var cy=this.cy();if(!cy.styleEnabled())return!1;var ele=this[0],hasCompoundNodes2=ele.cy().hasCompoundNodes();if(ele)return hasCompoundNodes2?ele.effectiveOpacity()===0:ele.pstyle("opacity").value===0},backgrounding:function(){var cy=this.cy();if(!cy.styleEnabled())return!1;var ele=this[0];return!!ele._private.backgrounding}};function checkCompound(ele,parentOk){var _p=ele._private,parents2=_p.data.parent?ele.parents():null;if(parents2)for(var i=0;i<parents2.length;i++){var parent4=parents2[i];if(!parentOk(parent4))return!1}return!0}function defineDerivedStateFunction(specs){var ok=specs.ok,edgeOkViaNode=specs.edgeOkViaNode||specs.ok,parentOk=specs.parentOk||specs.ok;return function(){var cy=this.cy();if(!cy.styleEnabled())return!0;var ele=this[0],hasCompoundNodes2=cy.hasCompoundNodes();if(ele){var _p=ele._private;if(!ok(ele))return!1;if(ele.isNode())return!hasCompoundNodes2||checkCompound(ele,parentOk);var src=_p.source,tgt=_p.target;return edgeOkViaNode(src)&&(!hasCompoundNodes2||checkCompound(src,edgeOkViaNode))&&(src===tgt||edgeOkViaNode(tgt)&&(!hasCompoundNodes2||checkCompound(tgt,edgeOkViaNode)))}}}var eleTakesUpSpace=cacheStyleFunction("eleTakesUpSpace",function(ele){return ele.pstyle("display").value==="element"&&ele.width()!==0&&(ele.isNode()?ele.height()!==0:!0)});elesfn$4.takesUpSpace=cachePrototypeStyleFunction("takesUpSpace",defineDerivedStateFunction({ok:eleTakesUpSpace}));var eleInteractive=cacheStyleFunction("eleInteractive",function(ele){return ele.pstyle("events").value==="yes"&&ele.pstyle("visibility").value==="visible"&&eleTakesUpSpace(ele)}),parentInteractive=cacheStyleFunction("parentInteractive",function(parent4){return parent4.pstyle("visibility").value==="visible"&&eleTakesUpSpace(parent4)});elesfn$4.interactive=cachePrototypeStyleFunction("interactive",defineDerivedStateFunction({ok:eleInteractive,parentOk:parentInteractive,edgeOkViaNode:eleTakesUpSpace}));elesfn$4.noninteractive=function(){var ele=this[0];if(ele)return!ele.interactive()};var eleVisible=cacheStyleFunction("eleVisible",function(ele){return ele.pstyle("visibility").value==="visible"&&ele.pstyle("opacity").pfValue!==0&&eleTakesUpSpace(ele)}),edgeVisibleViaNode=eleTakesUpSpace;elesfn$4.visible=cachePrototypeStyleFunction("visible",defineDerivedStateFunction({ok:eleVisible,edgeOkViaNode:edgeVisibleViaNode}));elesfn$4.hidden=function(){var ele=this[0];if(ele)return!ele.visible()};elesfn$4.isBundledBezier=cachePrototypeStyleFunction("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});elesfn$4.bypass=elesfn$4.css=elesfn$4.style;elesfn$4.renderedCss=elesfn$4.renderedStyle;elesfn$4.removeBypass=elesfn$4.removeCss=elesfn$4.removeStyle;elesfn$4.pstyle=elesfn$4.parsedStyle;var elesfn$3={};function defineSwitchFunction(params){return function(){var args=arguments,changedEles=[];if(args.length===2){var data4=args[0],handler=args[1];this.on(params.event,data4,handler)}else if(args.length===1&&fn$6(args[0])){var _handler=args[0];this.on(params.event,_handler)}else if(args.length===0||args.length===1&&array(args[0])){for(var addlEvents=args.length===1?args[0]:null,i=0;i<this.length;i++){var ele=this[i],able=!params.ableField||ele._private[params.ableField],changed=ele._private[params.field]!=params.value;if(params.overrideAble){var overrideAble2=params.overrideAble(ele);if(overrideAble2!==void 0&&(able=overrideAble2,!overrideAble2))return this}able&&(ele._private[params.field]=params.value,changed&&changedEles.push(ele))}var changedColl=this.spawn(changedEles);changedColl.updateStyle(),changedColl.emit(params.event),addlEvents&&changedColl.emit(addlEvents)}return this}}function defineSwitchSet(params){elesfn$3[params.field]=function(){var ele=this[0];if(ele){if(params.overrideField){var val=params.overrideField(ele);if(val!==void 0)return val}return ele._private[params.field]}},elesfn$3[params.on]=defineSwitchFunction({event:params.on,field:params.field,ableField:params.ableField,overrideAble:params.overrideAble,value:!0}),elesfn$3[params.off]=defineSwitchFunction({event:params.off,field:params.field,ableField:params.ableField,overrideAble:params.overrideAble,value:!1})}defineSwitchSet({field:"locked",overrideField:function(ele){return ele.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});defineSwitchSet({field:"grabbable",overrideField:function(ele){return ele.cy().autoungrabify()||ele.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});defineSwitchSet({field:"selected",ableField:"selectable",overrideAble:function(ele){return ele.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});defineSwitchSet({field:"selectable",overrideField:function(ele){return ele.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});elesfn$3.deselect=elesfn$3.unselect;elesfn$3.grabbed=function(){var ele=this[0];if(ele)return ele._private.grabbed};defineSwitchSet({field:"active",on:"activate",off:"unactivate"});defineSwitchSet({field:"pannable",on:"panify",off:"unpanify"});elesfn$3.inactive=function(){var ele=this[0];if(ele)return!ele._private.active};var elesfn$2={},defineDagExtremity=function(params){return function(selector){for(var eles=this,ret=[],i=0;i<eles.length;i++){var ele=eles[i];if(ele.isNode()){for(var disqualified=!1,edges3=ele.connectedEdges(),j=0;j<edges3.length;j++){var edge=edges3[j],src=edge.source(),tgt=edge.target();if(params.noIncomingEdges&&tgt===ele&&src!==ele||params.noOutgoingEdges&&src===ele&&tgt!==ele){disqualified=!0;break}}disqualified||ret.push(ele)}}return this.spawn(ret,!0).filter(selector)}},defineDagOneHop=function(params){return function(selector){for(var eles=this,oEles=[],i=0;i<eles.length;i++){var ele=eles[i];if(ele.isNode())for(var edges3=ele.connectedEdges(),j=0;j<edges3.length;j++){var edge=edges3[j],src=edge.source(),tgt=edge.target();params.outgoing&&src===ele?(oEles.push(edge),oEles.push(tgt)):params.incoming&&tgt===ele&&(oEles.push(edge),oEles.push(src))}}return this.spawn(oEles,!0).filter(selector)}},defineDagAllHops=function(params){return function(selector){for(var eles=this,sEles=[],sElesIds={};;){var next=params.outgoing?eles.outgoers():eles.incomers();if(next.length===0)break;for(var newNext=!1,i=0;i<next.length;i++){var n=next[i],nid=n.id();sElesIds[nid]||(sElesIds[nid]=!0,sEles.push(n),newNext=!0)}if(!newNext)break;eles=next}return this.spawn(sEles,!0).filter(selector)}};elesfn$2.clearTraversalCache=function(){for(var i=0;i<this.length;i++)this[i]._private.traversalCache=null};extend(elesfn$2,{roots:defineDagExtremity({noIncomingEdges:!0}),leaves:defineDagExtremity({noOutgoingEdges:!0}),outgoers:cache(defineDagOneHop({outgoing:!0}),"outgoers"),successors:defineDagAllHops({outgoing:!0}),incomers:cache(defineDagOneHop({incoming:!0}),"incomers"),predecessors:defineDagAllHops({})});extend(elesfn$2,{neighborhood:cache(function(selector){for(var elements=[],nodes3=this.nodes(),i=0;i<nodes3.length;i++)for(var node=nodes3[i],connectedEdges=node.connectedEdges(),j=0;j<connectedEdges.length;j++){var edge=connectedEdges[j],src=edge.source(),tgt=edge.target(),otherNode=node===src?tgt:src;otherNode.length>0&&elements.push(otherNode[0]),elements.push(edge[0])}return this.spawn(elements,!0).filter(selector)},"neighborhood"),closedNeighborhood:function(selector){return this.neighborhood().add(this).filter(selector)},openNeighborhood:function(selector){return this.neighborhood(selector)}});elesfn$2.neighbourhood=elesfn$2.neighborhood;elesfn$2.closedNeighbourhood=elesfn$2.closedNeighborhood;elesfn$2.openNeighbourhood=elesfn$2.openNeighborhood;extend(elesfn$2,{source:cache(function(selector){var ele=this[0],src;return ele&&(src=ele._private.source||ele.cy().collection()),src&&selector?src.filter(selector):src},"source"),target:cache(function(selector){var ele=this[0],tgt;return ele&&(tgt=ele._private.target||ele.cy().collection()),tgt&&selector?tgt.filter(selector):tgt},"target"),sources:defineSourceFunction({attr:"source"}),targets:defineSourceFunction({attr:"target"})});function defineSourceFunction(params){return function(selector){for(var sources=[],i=0;i<this.length;i++){var ele=this[i],src=ele._private[params.attr];src&&sources.push(src)}return this.spawn(sources,!0).filter(selector)}}extend(elesfn$2,{edgesWith:cache(defineEdgesWithFunction(),"edgesWith"),edgesTo:cache(defineEdgesWithFunction({thisIsSrc:!0}),"edgesTo")});function defineEdgesWithFunction(params){return function(otherNodes){var elements=[],cy=this._private.cy,p2=params||{};string(otherNodes)&&(otherNodes=cy.$(otherNodes));for(var h=0;h<otherNodes.length;h++)for(var edges3=otherNodes[h]._private.edges,i=0;i<edges3.length;i++){var edge=edges3[i],edgeData=edge._private.data,thisToOther=this.hasElementWithId(edgeData.source)&&otherNodes.hasElementWithId(edgeData.target),otherToThis=otherNodes.hasElementWithId(edgeData.source)&&this.hasElementWithId(edgeData.target),edgeConnectsThisAndOther=thisToOther||otherToThis;edgeConnectsThisAndOther&&((p2.thisIsSrc||p2.thisIsTgt)&&(p2.thisIsSrc&&!thisToOther||p2.thisIsTgt&&!otherToThis)||elements.push(edge))}return this.spawn(elements,!0)}}extend(elesfn$2,{connectedEdges:cache(function(selector){for(var retEles=[],eles=this,i=0;i<eles.length;i++){var node=eles[i];if(node.isNode())for(var edges3=node._private.edges,j=0;j<edges3.length;j++){var edge=edges3[j];retEles.push(edge)}}return this.spawn(retEles,!0).filter(selector)},"connectedEdges"),connectedNodes:cache(function(selector){for(var retEles=[],eles=this,i=0;i<eles.length;i++){var edge=eles[i];edge.isEdge()&&(retEles.push(edge.source()[0]),retEles.push(edge.target()[0]))}return this.spawn(retEles,!0).filter(selector)},"connectedNodes"),parallelEdges:cache(defineParallelEdgesFunction(),"parallelEdges"),codirectedEdges:cache(defineParallelEdgesFunction({codirected:!0}),"codirectedEdges")});function defineParallelEdgesFunction(params){var defaults3={codirected:!1};return params=extend({},defaults3,params),function(selector){for(var elements=[],edges3=this.edges(),p2=params,i=0;i<edges3.length;i++)for(var edge1=edges3[i],edge1_p=edge1._private,src1=edge1_p.source,srcid1=src1._private.data.id,tgtid1=edge1_p.data.target,srcEdges1=src1._private.edges,j=0;j<srcEdges1.length;j++){var edge2=srcEdges1[j],edge2data=edge2._private.data,tgtid2=edge2data.target,srcid2=edge2data.source,codirected=tgtid2===tgtid1&&srcid2===srcid1,oppdirected=srcid1===tgtid2&&tgtid1===srcid2;(p2.codirected&&codirected||!p2.codirected&&(codirected||oppdirected))&&elements.push(edge2)}return this.spawn(elements,!0).filter(selector)}}extend(elesfn$2,{components:function(root){var self2=this,cy=self2.cy(),visited=cy.collection(),unvisited=root==null?self2.nodes():root.nodes(),components2=[];root!=null&&unvisited.empty()&&(unvisited=root.sources());var visitInComponent=function(node,component2){visited.merge(node),unvisited.unmerge(node),component2.merge(node)};if(unvisited.empty())return self2.spawn();var _loop=function(){var cmpt=cy.collection();components2.push(cmpt);var root2=unvisited[0];visitInComponent(root2,cmpt),self2.bfs({directed:!1,roots:root2,visit:function(v){return visitInComponent(v,cmpt)}}),cmpt.forEach(function(node){node.connectedEdges().forEach(function(e){self2.has(e)&&cmpt.has(e.source())&&cmpt.has(e.target())&&cmpt.merge(e)})})};do _loop();while(unvisited.length>0);return components2},component:function(){var ele=this[0];return ele.cy().mutableElements().components(ele)[0]}});elesfn$2.componentsOf=elesfn$2.components;var Collection=function(cy,elements){var unique=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,removed=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(cy===void 0){error("A collection must have a reference to the core");return}var map2=new Map$1,createdElements=!1;if(!elements)elements=[];else if(elements.length>0&&plainObject(elements[0])&&!element(elements[0])){createdElements=!0;for(var eles=[],elesIds=new Set$1,i=0,l=elements.length;i<l;i++){var json2=elements[i];json2.data==null&&(json2.data={});var _data=json2.data;if(_data.id==null)_data.id=uuid();else if(cy.hasElementWithId(_data.id)||elesIds.has(_data.id))continue;var ele=new Element(cy,json2,!1);eles.push(ele),elesIds.add(_data.id)}elements=eles}this.length=0;for(var _i=0,_l=elements.length;_i<_l;_i++){var element$1=elements[_i][0];if(element$1!=null){var id2=element$1._private.data.id;(!unique||!map2.has(id2))&&(unique&&map2.set(id2,{index:this.length,ele:element$1}),this[this.length]=element$1,this.length++)}}this._private={eles:this,cy,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var m=this.lazyMap=new Map$1,eles2=this.eles,_i2=0;_i2<eles2.length;_i2++){var _ele=eles2[_i2];m.set(_ele.id(),{index:_i2,ele:_ele})}}},unique&&(this._private.map=map2),createdElements&&!removed&&this.restore()},elesfn$1=Element.prototype=Collection.prototype=Object.create(Array.prototype);elesfn$1.instanceString=function(){return"collection"};elesfn$1.spawn=function(eles,unique){return new Collection(this.cy(),eles,unique)};elesfn$1.spawnSelf=function(){return this.spawn(this)};elesfn$1.cy=function(){return this._private.cy};elesfn$1.renderer=function(){return this._private.cy.renderer()};elesfn$1.element=function(){return this[0]};elesfn$1.collection=function(){return collection(this)?this:new Collection(this._private.cy,[this])};elesfn$1.unique=function(){return new Collection(this._private.cy,this,!0)};elesfn$1.hasElementWithId=function(id2){return id2=""+id2,this._private.map.has(id2)};elesfn$1.getElementById=function(id2){id2=""+id2;var cy=this._private.cy,entry=this._private.map.get(id2);return entry?entry.ele:new Collection(cy)};elesfn$1.$id=elesfn$1.getElementById;elesfn$1.poolIndex=function(){var cy=this._private.cy,eles=cy._private.elements,id2=this[0]._private.data.id;return eles._private.map.get(id2).index};elesfn$1.indexOf=function(ele){var id2=ele[0]._private.data.id;return this._private.map.get(id2).index};elesfn$1.indexOfId=function(id2){return id2=""+id2,this._private.map.get(id2).index};elesfn$1.json=function(obj){var ele=this.element(),cy=this.cy();if(ele==null&&obj)return this;if(ele!=null){var p2=ele._private;if(plainObject(obj)){if(cy.startBatch(),obj.data){ele.data(obj.data);var _data2=p2.data;if(ele.isEdge()){var move=!1,spec={},src=obj.data.source,tgt=obj.data.target;src!=null&&src!=_data2.source&&(spec.source=""+src,move=!0),tgt!=null&&tgt!=_data2.target&&(spec.target=""+tgt,move=!0),move&&(ele=ele.move(spec))}else{var newParentValSpecd="parent"in obj.data,parent4=obj.data.parent;newParentValSpecd&&(parent4!=null||_data2.parent!=null)&&parent4!=_data2.parent&&(parent4===void 0&&(parent4=null),parent4!=null&&(parent4=""+parent4),ele=ele.move({parent:parent4}))}}obj.position&&ele.position(obj.position);var checkSwitch=function(k,trueFnName,falseFnName){var obj_k=obj[k];obj_k!=null&&obj_k!==p2[k]&&(obj_k?ele[trueFnName]():ele[falseFnName]())};return checkSwitch("removed","remove","restore"),checkSwitch("selected","select","unselect"),checkSwitch("selectable","selectify","unselectify"),checkSwitch("locked","lock","unlock"),checkSwitch("grabbable","grabify","ungrabify"),checkSwitch("pannable","panify","unpanify"),obj.classes!=null&&ele.classes(obj.classes),cy.endBatch(),this}else if(obj===void 0){var json2={data:copy(p2.data),position:copy(p2.position),group:p2.group,removed:p2.removed,selected:p2.selected,selectable:p2.selectable,locked:p2.locked,grabbable:p2.grabbable,pannable:p2.pannable,classes:null};json2.classes="";var i=0;return p2.classes.forEach(function(cls){return json2.classes+=i++===0?cls:" "+cls}),json2}}};elesfn$1.jsons=function(){for(var jsons=[],i=0;i<this.length;i++){var ele=this[i],json2=ele.json();jsons.push(json2)}return jsons};elesfn$1.clone=function(){for(var cy=this.cy(),elesArr=[],i=0;i<this.length;i++){var ele=this[i],json2=ele.json(),clone3=new Element(cy,json2,!1);elesArr.push(clone3)}return new Collection(cy,elesArr)};elesfn$1.copy=elesfn$1.clone;elesfn$1.restore=function(){for(var notifyRenderer=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,addToPool2=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,self2=this,cy=self2.cy(),cy_p=cy._private,nodes3=[],edges3=[],elements,_i3=0,l=self2.length;_i3<l;_i3++){var ele=self2[_i3];addToPool2&&!ele.removed()||(ele.isNode()?nodes3.push(ele):edges3.push(ele))}elements=nodes3.concat(edges3);var i,removeFromElements=function(){elements.splice(i,1),i--};for(i=0;i<elements.length;i++){var _ele2=elements[i],_private=_ele2._private,_data3=_private.data;if(_ele2.clearTraversalCache(),!(!addToPool2&&!_private.removed)){if(_data3.id===void 0)_data3.id=uuid();else if(number$1(_data3.id))_data3.id=""+_data3.id;else if(emptyString(_data3.id)||!string(_data3.id)){error("Can not create element with invalid string ID `"+_data3.id+"`"),removeFromElements();continue}else if(cy.hasElementWithId(_data3.id)){error("Can not create second element with ID `"+_data3.id+"`"),removeFromElements();continue}}var id2=_data3.id;if(_ele2.isNode()){var pos=_private.position;pos.x==null&&(pos.x=0),pos.y==null&&(pos.y=0)}if(_ele2.isEdge()){for(var edge=_ele2,fields=["source","target"],fieldsLength=fields.length,badSourceOrTarget=!1,j=0;j<fieldsLength;j++){var field=fields[j],val=_data3[field];number$1(val)&&(val=_data3[field]=""+_data3[field]),val==null||val===""?(error("Can not create edge `"+id2+"` with unspecified "+field),badSourceOrTarget=!0):cy.hasElementWithId(val)||(error("Can not create edge `"+id2+"` with nonexistent "+field+" `"+val+"`"),badSourceOrTarget=!0)}if(badSourceOrTarget){removeFromElements();continue}var src=cy.getElementById(_data3.source),tgt=cy.getElementById(_data3.target);src.same(tgt)?src._private.edges.push(edge):(src._private.edges.push(edge),tgt._private.edges.push(edge)),edge._private.source=src,edge._private.target=tgt}_private.map=new Map$1,_private.map.set(id2,{ele:_ele2,index:0}),_private.removed=!1,addToPool2&&cy.addToPool(_ele2)}for(var _i4=0;_i4<nodes3.length;_i4++){var node=nodes3[_i4],_data4=node._private.data;number$1(_data4.parent)&&(_data4.parent=""+_data4.parent);var parentId=_data4.parent,specifiedParent=parentId!=null;if(specifiedParent||node._private.parent){var parent4=node._private.parent?cy.collection().merge(node._private.parent):cy.getElementById(parentId);if(parent4.empty())_data4.parent=void 0;else if(parent4[0].removed())warn("Node added with missing parent, reference to parent removed"),_data4.parent=void 0,node._private.parent=null;else{for(var selfAsParent=!1,ancestor=parent4;!ancestor.empty();){if(node.same(ancestor)){selfAsParent=!0,_data4.parent=void 0;break}ancestor=ancestor.parent()}selfAsParent||(parent4[0]._private.children.push(node),node._private.parent=parent4[0],cy_p.hasCompoundNodes=!0)}}}if(elements.length>0){for(var restored=elements.length===self2.length?self2:new Collection(cy,elements),_i5=0;_i5<restored.length;_i5++){var _ele3=restored[_i5];_ele3.isNode()||(_ele3.parallelEdges().clearTraversalCache(),_ele3.source().clearTraversalCache(),_ele3.target().clearTraversalCache())}var toUpdateStyle;cy_p.hasCompoundNodes?toUpdateStyle=cy.collection().merge(restored).merge(restored.connectedNodes()).merge(restored.parent()):toUpdateStyle=restored,toUpdateStyle.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(notifyRenderer),notifyRenderer?restored.emitAndNotify("add"):addToPool2&&restored.emit("add")}return self2};elesfn$1.removed=function(){var ele=this[0];return ele&&ele._private.removed};elesfn$1.inside=function(){var ele=this[0];return ele&&!ele._private.removed};elesfn$1.remove=function(){var notifyRenderer=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,removeFromPool2=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,self2=this,elesToRemove=[],elesToRemoveIds={},cy=self2._private.cy;function addConnectedEdges(node){for(var edges3=node._private.edges,i2=0;i2<edges3.length;i2++)add3(edges3[i2])}function addChildren2(node){for(var children=node._private.children,i2=0;i2<children.length;i2++)add3(children[i2])}function add3(ele2){var alreadyAdded=elesToRemoveIds[ele2.id()];removeFromPool2&&ele2.removed()||alreadyAdded||(elesToRemoveIds[ele2.id()]=!0,ele2.isNode()?(elesToRemove.push(ele2),addConnectedEdges(ele2),addChildren2(ele2)):elesToRemove.unshift(ele2))}for(var i=0,l=self2.length;i<l;i++){var ele=self2[i];add3(ele)}function removeEdgeRef(node,edge){var connectedEdges=node._private.edges;removeFromArray(connectedEdges,edge),node.clearTraversalCache()}function removeParallelRef(pllEdge2){pllEdge2.clearTraversalCache()}var alteredParents=[];alteredParents.ids={};function removeChildRef(parent5,ele2){ele2=ele2[0],parent5=parent5[0];var children=parent5._private.children,pid=parent5.id();removeFromArray(children,ele2),ele2._private.parent=null,alteredParents.ids[pid]||(alteredParents.ids[pid]=!0,alteredParents.push(parent5))}self2.dirtyCompoundBoundsCache(),removeFromPool2&&cy.removeFromPool(elesToRemove);for(var _i6=0;_i6<elesToRemove.length;_i6++){var _ele4=elesToRemove[_i6];if(_ele4.isEdge()){var src=_ele4.source()[0],tgt=_ele4.target()[0];removeEdgeRef(src,_ele4),removeEdgeRef(tgt,_ele4);for(var pllEdges=_ele4.parallelEdges(),j=0;j<pllEdges.length;j++){var pllEdge=pllEdges[j];removeParallelRef(pllEdge),pllEdge.isBundledBezier()&&pllEdge.dirtyBoundingBoxCache()}}else{var parent4=_ele4.parent();parent4.length!==0&&removeChildRef(parent4,_ele4)}removeFromPool2&&(_ele4._private.removed=!0)}var elesStillInside=cy._private.elements;cy._private.hasCompoundNodes=!1;for(var _i7=0;_i7<elesStillInside.length;_i7++){var _ele5=elesStillInside[_i7];if(_ele5.isParent()){cy._private.hasCompoundNodes=!0;break}}var removedElements=new Collection(this.cy(),elesToRemove);removedElements.size()>0&&(notifyRenderer?removedElements.emitAndNotify("remove"):removeFromPool2&&removedElements.emit("remove"));for(var _i8=0;_i8<alteredParents.length;_i8++){var _ele6=alteredParents[_i8];(!removeFromPool2||!_ele6.removed())&&_ele6.updateStyle()}return removedElements};elesfn$1.move=function(struct){var cy=this._private.cy,eles=this,notifyRenderer=!1,modifyPool=!1,toString3=function(id2){return id2==null?id2:""+id2};if(struct.source!==void 0||struct.target!==void 0){var srcId=toString3(struct.source),tgtId=toString3(struct.target),srcExists=srcId!=null&&cy.hasElementWithId(srcId),tgtExists=tgtId!=null&&cy.hasElementWithId(tgtId);(srcExists||tgtExists)&&(cy.batch(function(){eles.remove(notifyRenderer,modifyPool),eles.emitAndNotify("moveout");for(var i=0;i<eles.length;i++){var ele=eles[i],_data5=ele._private.data;ele.isEdge()&&(srcExists&&(_data5.source=srcId),tgtExists&&(_data5.target=tgtId))}eles.restore(notifyRenderer,modifyPool)}),eles.emitAndNotify("move"))}else if(struct.parent!==void 0){var parentId=toString3(struct.parent),parentExists=parentId===null||cy.hasElementWithId(parentId);if(parentExists){var pidToAssign=parentId===null?void 0:parentId;cy.batch(function(){var updated=eles.remove(notifyRenderer,modifyPool);updated.emitAndNotify("moveout");for(var i=0;i<eles.length;i++){var ele=eles[i],_data6=ele._private.data;ele.isNode()&&(_data6.parent=pidToAssign)}updated.restore(notifyRenderer,modifyPool)}),eles.emitAndNotify("move")}}return this};[elesfn$j,elesfn$i,elesfn$h,elesfn$g,elesfn$f,data3,elesfn$d,dimensions,elesfn$9,elesfn$8,elesfn$7,elesfn$6,elesfn$5,elesfn$4,elesfn$3,elesfn$2].forEach(function(props){extend(elesfn$1,props)});var corefn$9={add:function(opts){var elements,cy=this;if(elementOrCollection(opts)){var eles=opts;if(eles._private.cy===cy)elements=eles.restore();else{for(var jsons=[],i=0;i<eles.length;i++){var ele=eles[i];jsons.push(ele.json())}elements=new Collection(cy,jsons)}}else if(array(opts)){var _jsons=opts;elements=new Collection(cy,_jsons)}else if(plainObject(opts)&&(array(opts.nodes)||array(opts.edges))){for(var elesByGroup=opts,_jsons2=[],grs=["nodes","edges"],_i=0,il=grs.length;_i<il;_i++){var group2=grs[_i],elesArray=elesByGroup[group2];if(array(elesArray))for(var j=0,jl=elesArray.length;j<jl;j++){var json2=extend({group:group2},elesArray[j]);_jsons2.push(json2)}}elements=new Collection(cy,_jsons2)}else{var _json=opts;elements=new Element(cy,_json).collection()}return elements},remove:function(collection4){if(!elementOrCollection(collection4)){if(string(collection4)){var selector=collection4;collection4=this.$(selector)}}return collection4.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function generateCubicBezier(mX1,mY1,mX2,mY2){var NEWTON_ITERATIONS=4,NEWTON_MIN_SLOPE=.001,SUBDIVISION_PRECISION=1e-7,SUBDIVISION_MAX_ITERATIONS=10,kSplineTableSize=11,kSampleStepSize=1/(kSplineTableSize-1),float32ArraySupported=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var i=0;i<4;++i)if(typeof arguments[i]!="number"||isNaN(arguments[i])||!isFinite(arguments[i]))return!1;mX1=Math.min(mX1,1),mX2=Math.min(mX2,1),mX1=Math.max(mX1,0),mX2=Math.max(mX2,0);var mSampleValues=float32ArraySupported?new Float32Array(kSplineTableSize):new Array(kSplineTableSize);function A(aA1,aA2){return 1-3*aA2+3*aA1}function B(aA1,aA2){return 3*aA2-6*aA1}function C(aA1){return 3*aA1}function calcBezier(aT,aA1,aA2){return((A(aA1,aA2)*aT+B(aA1,aA2))*aT+C(aA1))*aT}function getSlope(aT,aA1,aA2){return 3*A(aA1,aA2)*aT*aT+2*B(aA1,aA2)*aT+C(aA1)}function newtonRaphsonIterate(aX,aGuessT){for(var _i=0;_i<NEWTON_ITERATIONS;++_i){var currentSlope=getSlope(aGuessT,mX1,mX2);if(currentSlope===0)return aGuessT;var currentX=calcBezier(aGuessT,mX1,mX2)-aX;aGuessT-=currentX/currentSlope}return aGuessT}function calcSampleValues(){for(var _i2=0;_i2<kSplineTableSize;++_i2)mSampleValues[_i2]=calcBezier(_i2*kSampleStepSize,mX1,mX2)}function binarySubdivide(aX,aA,aB){var currentX,currentT,i2=0;do currentT=aA+(aB-aA)/2,currentX=calcBezier(currentT,mX1,mX2)-aX,currentX>0?aB=currentT:aA=currentT;while(Math.abs(currentX)>SUBDIVISION_PRECISION&&++i2<SUBDIVISION_MAX_ITERATIONS);return currentT}function getTForX(aX){for(var intervalStart=0,currentSample=1,lastSample=kSplineTableSize-1;currentSample!==lastSample&&mSampleValues[currentSample]<=aX;++currentSample)intervalStart+=kSampleStepSize;--currentSample;var dist3=(aX-mSampleValues[currentSample])/(mSampleValues[currentSample+1]-mSampleValues[currentSample]),guessForT=intervalStart+dist3*kSampleStepSize,initialSlope=getSlope(guessForT,mX1,mX2);return initialSlope>=NEWTON_MIN_SLOPE?newtonRaphsonIterate(aX,guessForT):initialSlope===0?guessForT:binarySubdivide(aX,intervalStart,intervalStart+kSampleStepSize)}var _precomputed=!1;function precompute(){_precomputed=!0,(mX1!==mY1||mX2!==mY2)&&calcSampleValues()}var f=function(aX){return _precomputed||precompute(),mX1===mY1&&mX2===mY2?aX:aX===0?0:aX===1?1:calcBezier(getTForX(aX),mY1,mY2)};f.getControlPoints=function(){return[{x:mX1,y:mY1},{x:mX2,y:mY2}]};var str="generateBezier("+[mX1,mY1,mX2,mY2]+")";return f.toString=function(){return str},f}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var generateSpringRK4=(function(){function springAccelerationForState(state){return-state.tension*state.x-state.friction*state.v}function springEvaluateStateWithDerivative(initialState,dt,derivative){var state={x:initialState.x+derivative.dx*dt,v:initialState.v+derivative.dv*dt,tension:initialState.tension,friction:initialState.friction};return{dx:state.v,dv:springAccelerationForState(state)}}function springIntegrateState(state,dt){var a={dx:state.v,dv:springAccelerationForState(state)},b=springEvaluateStateWithDerivative(state,dt*.5,a),c=springEvaluateStateWithDerivative(state,dt*.5,b),d=springEvaluateStateWithDerivative(state,dt,c),dxdt=1/6*(a.dx+2*(b.dx+c.dx)+d.dx),dvdt=1/6*(a.dv+2*(b.dv+c.dv)+d.dv);return state.x=state.x+dxdt*dt,state.v=state.v+dvdt*dt,state}return function springRK4Factory(tension,friction,duration){var initState={x:-1,v:0,tension:null,friction:null},path=[0],time_lapsed=0,tolerance=1/1e4,DT=16/1e3,have_duration,dt,last_state;for(tension=parseFloat(tension)||500,friction=parseFloat(friction)||20,duration=duration||null,initState.tension=tension,initState.friction=friction,have_duration=duration!==null,have_duration?(time_lapsed=springRK4Factory(tension,friction),dt=time_lapsed/duration*DT):dt=DT;last_state=springIntegrateState(last_state||initState,dt),path.push(1+last_state.x),time_lapsed+=16,Math.abs(last_state.x)>tolerance&&Math.abs(last_state.v)>tolerance;);return have_duration?function(percentComplete){return path[percentComplete*(path.length-1)|0]}:time_lapsed}})(),cubicBezier=function(t1,p1,t2,p2){var bezier=generateCubicBezier(t1,p1,t2,p2);return function(start,end,percent){return start+(end-start)*bezier(percent)}},easings={linear:function(start,end,percent){return start+(end-start)*percent},ease:cubicBezier(.25,.1,.25,1),"ease-in":cubicBezier(.42,0,1,1),"ease-out":cubicBezier(0,0,.58,1),"ease-in-out":cubicBezier(.42,0,.58,1),"ease-in-sine":cubicBezier(.47,0,.745,.715),"ease-out-sine":cubicBezier(.39,.575,.565,1),"ease-in-out-sine":cubicBezier(.445,.05,.55,.95),"ease-in-quad":cubicBezier(.55,.085,.68,.53),"ease-out-quad":cubicBezier(.25,.46,.45,.94),"ease-in-out-quad":cubicBezier(.455,.03,.515,.955),"ease-in-cubic":cubicBezier(.55,.055,.675,.19),"ease-out-cubic":cubicBezier(.215,.61,.355,1),"ease-in-out-cubic":cubicBezier(.645,.045,.355,1),"ease-in-quart":cubicBezier(.895,.03,.685,.22),"ease-out-quart":cubicBezier(.165,.84,.44,1),"ease-in-out-quart":cubicBezier(.77,0,.175,1),"ease-in-quint":cubicBezier(.755,.05,.855,.06),"ease-out-quint":cubicBezier(.23,1,.32,1),"ease-in-out-quint":cubicBezier(.86,0,.07,1),"ease-in-expo":cubicBezier(.95,.05,.795,.035),"ease-out-expo":cubicBezier(.19,1,.22,1),"ease-in-out-expo":cubicBezier(1,0,0,1),"ease-in-circ":cubicBezier(.6,.04,.98,.335),"ease-out-circ":cubicBezier(.075,.82,.165,1),"ease-in-out-circ":cubicBezier(.785,.135,.15,.86),spring:function(tension,friction,duration){if(duration===0)return easings.linear;var spring2=generateSpringRK4(tension,friction,duration);return function(start,end,percent){return start+(end-start)*spring2(percent)}},"cubic-bezier":cubicBezier};function getEasedValue(type,start,end,percent,easingFn){if(percent===1||start===end)return end;var val=easingFn(start,end,percent);return type==null||((type.roundValue||type.color)&&(val=Math.round(val)),type.min!==void 0&&(val=Math.max(val,type.min)),type.max!==void 0&&(val=Math.min(val,type.max))),val}function getValue(prop,spec){return prop.pfValue!=null||prop.value!=null?prop.pfValue!=null&&(spec==null||spec.type.units!=="%")?prop.pfValue:prop.value:prop}function ease(startProp,endProp,percent,easingFn,propSpec){var type=propSpec!=null?propSpec.type:null;percent<0?percent=0:percent>1&&(percent=1);var start=getValue(startProp,propSpec),end=getValue(endProp,propSpec);if(number$1(start)&&number$1(end))return getEasedValue(type,start,end,percent,easingFn);if(array(start)&&array(end)){for(var easedArr=[],i=0;i<end.length;i++){var si=start[i],ei=end[i];if(si!=null&&ei!=null){var val=getEasedValue(type,si,ei,percent,easingFn);easedArr.push(val)}else easedArr.push(ei)}return easedArr}}function step$1(self2,ani,now,isCore){var isEles=!isCore,_p=self2._private,ani_p=ani._private,pEasing=ani_p.easing,startTime=ani_p.startTime,cy=isCore?self2:self2.cy(),style3=cy.style();if(!ani_p.easingImpl)if(pEasing==null)ani_p.easingImpl=easings.linear;else{var easingVals;if(string(pEasing)){var easingProp=style3.parse("transition-timing-function",pEasing);easingVals=easingProp.value}else easingVals=pEasing;var name,args;string(easingVals)?(name=easingVals,args=[]):(name=easingVals[1],args=easingVals.slice(2).map(function(n){return+n})),args.length>0?(name==="spring"&&args.push(ani_p.duration),ani_p.easingImpl=easings[name].apply(null,args)):ani_p.easingImpl=easings[name]}var easing=ani_p.easingImpl,percent;if(ani_p.duration===0?percent=1:percent=(now-startTime)/ani_p.duration,ani_p.applying&&(percent=ani_p.progress),percent<0?percent=0:percent>1&&(percent=1),ani_p.delay==null){var startPos=ani_p.startPosition,endPos=ani_p.position;if(endPos&&isEles&&!self2.locked()){var newPos={};valid(startPos.x,endPos.x)&&(newPos.x=ease(startPos.x,endPos.x,percent,easing)),valid(startPos.y,endPos.y)&&(newPos.y=ease(startPos.y,endPos.y,percent,easing)),self2.position(newPos)}var startPan=ani_p.startPan,endPan=ani_p.pan,pan2=_p.pan,animatingPan=endPan!=null&&isCore;animatingPan&&(valid(startPan.x,endPan.x)&&(pan2.x=ease(startPan.x,endPan.x,percent,easing)),valid(startPan.y,endPan.y)&&(pan2.y=ease(startPan.y,endPan.y,percent,easing)),self2.emit("pan"));var startZoom=ani_p.startZoom,endZoom=ani_p.zoom,animatingZoom=endZoom!=null&&isCore;animatingZoom&&(valid(startZoom,endZoom)&&(_p.zoom=bound(_p.minZoom,ease(startZoom,endZoom,percent,easing),_p.maxZoom)),self2.emit("zoom")),(animatingPan||animatingZoom)&&self2.emit("viewport");var props=ani_p.style;if(props&&props.length>0&&isEles){for(var i=0;i<props.length;i++){var prop=props[i],_name=prop.name,end=prop,start=ani_p.startStyle[_name],propSpec=style3.properties[start.name],easedVal=ease(start,end,percent,easing,propSpec);style3.overrideBypass(self2,_name,easedVal)}self2.emit("style")}}return ani_p.progress=percent,percent}function valid(start,end){return start==null||end==null?!1:number$1(start)&&number$1(end)?!0:!!(start&&end)}function startAnimation(self2,ani,now,isCore){var ani_p=ani._private;ani_p.started=!0,ani_p.startTime=now-ani_p.progress*ani_p.duration}function stepAll(now,cy){var eles=cy._private.aniEles,doneEles=[];function stepOne(ele2,isCore){var _p=ele2._private,current=_p.animation.current,queue=_p.animation.queue,ranAnis=!1;if(current.length===0){var next=queue.shift();next&¤t.push(next)}for(var callbacks=function(_callbacks){for(var j=_callbacks.length-1;j>=0;j--){var cb=_callbacks[j];cb()}_callbacks.splice(0,_callbacks.length)},i=current.length-1;i>=0;i--){var ani=current[i],ani_p=ani._private;if(ani_p.stopped){current.splice(i,1),ani_p.hooked=!1,ani_p.playing=!1,ani_p.started=!1,callbacks(ani_p.frames);continue}!ani_p.playing&&!ani_p.applying||(ani_p.playing&&ani_p.applying&&(ani_p.applying=!1),ani_p.started||startAnimation(ele2,ani,now),step$1(ele2,ani,now,isCore),ani_p.applying&&(ani_p.applying=!1),callbacks(ani_p.frames),ani_p.step!=null&&ani_p.step(now),ani.completed()&&(current.splice(i,1),ani_p.hooked=!1,ani_p.playing=!1,ani_p.started=!1,callbacks(ani_p.completes)),ranAnis=!0)}return!isCore&¤t.length===0&&queue.length===0&&doneEles.push(ele2),ranAnis}for(var ranEleAni=!1,e=0;e<eles.length;e++){var ele=eles[e],handledThisEle=stepOne(ele);ranEleAni=ranEleAni||handledThisEle}var ranCoreAni=stepOne(cy,!0);(ranEleAni||ranCoreAni)&&(eles.length>0?cy.notify("draw",eles):cy.notify("draw")),eles.unmerge(doneEles),cy.emit("step")}var corefn$8={animate:define.animate(),animation:define.animation(),animated:define.animated(),clearQueue:define.clearQueue(),delay:define.delay(),delayAnimation:define.delayAnimation(),stop:define.stop(),addToAnimationPool:function(eles){var cy=this;cy.styleEnabled()&&cy._private.aniEles.merge(eles)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var cy=this;if(cy._private.animationsRunning=!0,!cy.styleEnabled())return;function headlessStep(){cy._private.animationsRunning&&requestAnimationFrame(function(now){stepAll(now,cy),headlessStep()})}var renderer3=cy.renderer();renderer3&&renderer3.beforeRender?renderer3.beforeRender(function(willDraw,now){stepAll(now,cy)},renderer3.beforeRenderPriorities.animations):headlessStep()}},emitterOptions={qualifierCompare:function(selector1,selector2){return selector1==null||selector2==null?selector1==null&&selector2==null:selector1.sameText(selector2)},eventMatches:function(cy,listener,eventObj){var selector=listener.qualifier;return selector!=null?cy!==eventObj.target&&element(eventObj.target)&&selector.matches(eventObj.target):!0},addEventFields:function(cy,evt){evt.cy=cy,evt.target=cy},callbackContext:function(cy,listener,eventObj){return listener.qualifier!=null?eventObj.target:cy}},argSelector2=function(arg){return string(arg)?new Selector(arg):arg},elesfn={createEmitter:function(){var _p=this._private;return _p.emitter||(_p.emitter=new Emitter(emitterOptions,this)),this},emitter:function(){return this._private.emitter},on:function(events,selector,callback){return this.emitter().on(events,argSelector2(selector),callback),this},removeListener:function(events,selector,callback){return this.emitter().removeListener(events,argSelector2(selector),callback),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(events,selector,callback){return this.emitter().one(events,argSelector2(selector),callback),this},once:function(events,selector,callback){return this.emitter().one(events,argSelector2(selector),callback),this},emit:function(events,extraParams){return this.emitter().emit(events,extraParams),this},emitAndNotify:function(event3,eles){return this.emit(event3),this.notify(event3,eles),this}};define.eventAliasesOn(elesfn);var corefn$7={png:function(options2){var renderer3=this._private.renderer;return options2=options2||{},renderer3.png(options2)},jpg:function(options2){var renderer3=this._private.renderer;return options2=options2||{},options2.bg=options2.bg||"#fff",renderer3.jpg(options2)}};corefn$7.jpeg=corefn$7.jpg;var corefn$6={layout:function(options2){var cy=this;if(options2==null){error("Layout options must be specified to make a layout");return}if(options2.name==null){error("A `name` must be specified to make a layout");return}var name=options2.name,Layout=cy.extension("layout",name);if(Layout==null){error("No such layout `"+name+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var eles;string(options2.eles)?eles=cy.$(options2.eles):eles=options2.eles!=null?options2.eles:cy.$();var layout4=new Layout(extend({},options2,{cy,eles}));return layout4}};corefn$6.createLayout=corefn$6.makeLayout=corefn$6.layout;var corefn$5={notify:function(eventName,eventEles){var _p=this._private;if(this.batching()){_p.batchNotifications=_p.batchNotifications||{};var eles=_p.batchNotifications[eventName]=_p.batchNotifications[eventName]||this.collection();eventEles!=null&&eles.merge(eventEles);return}if(_p.notificationsEnabled){var renderer3=this.renderer();this.destroyed()||!renderer3||renderer3.notify(eventName,eventEles)}},notifications:function(bool){var p2=this._private;return bool===void 0?p2.notificationsEnabled:(p2.notificationsEnabled=!!bool,this)},noNotifications:function(callback){this.notifications(!1),callback(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var _p=this._private;return _p.batchCount==null&&(_p.batchCount=0),_p.batchCount===0&&(_p.batchStyleEles=this.collection(),_p.batchNotifications={}),_p.batchCount++,this},endBatch:function(){var _p=this._private;if(_p.batchCount===0)return this;if(_p.batchCount--,_p.batchCount===0){_p.batchStyleEles.updateStyle();var renderer3=this.renderer();Object.keys(_p.batchNotifications).forEach(function(eventName){var eles=_p.batchNotifications[eventName];eles.empty()?renderer3.notify(eventName):renderer3.notify(eventName,eles)})}return this},batch:function(callback){return this.startBatch(),callback(),this.endBatch(),this},batchData:function(map2){var cy=this;return this.batch(function(){for(var ids=Object.keys(map2),i=0;i<ids.length;i++){var id2=ids[i],data4=map2[id2],ele=cy.getElementById(id2);ele.data(data4)}})}},rendererDefaults=defaults$g({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]}),corefn$4={renderTo:function(context,zoom2,pan2,pxRatio){var r=this._private.renderer;return r.renderTo(context,zoom2,pan2,pxRatio),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(options2){var cy=this,RendererProto=cy.extension("renderer",options2.name);if(RendererProto==null){error("Can not initialise: No such renderer `".concat(options2.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}options2.wheelSensitivity!==void 0&&warn("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 rOpts=rendererDefaults(options2);rOpts.cy=cy,cy._private.renderer=new RendererProto(rOpts),this.notify("init")},destroyRenderer:function(){var cy=this;cy.notify("destroy");var domEle=cy.container();if(domEle)for(domEle._cyreg=null;domEle.childNodes.length>0;)domEle.removeChild(domEle.childNodes[0]);cy._private.renderer=null,cy.mutableElements().forEach(function(ele){var _p=ele._private;_p.rscratch={},_p.rstyle={},_p.animation.current=[],_p.animation.queue=[]})},onRender:function(fn3){return this.on("render",fn3)},offRender:function(fn3){return this.off("render",fn3)}};corefn$4.invalidateDimensions=corefn$4.resize;var corefn$3={collection:function(eles,opts){return string(eles)?this.$(eles):elementOrCollection(eles)?eles.collection():array(eles)?(opts||(opts={}),new Collection(this,eles,opts.unique,opts.removed)):new Collection(this)},nodes:function(selector){var nodes3=this.$(function(ele){return ele.isNode()});return selector?nodes3.filter(selector):nodes3},edges:function(selector){var edges3=this.$(function(ele){return ele.isEdge()});return selector?edges3.filter(selector):edges3},$:function(selector){var eles=this._private.elements;return selector?eles.filter(selector):eles.spawnSelf()},mutableElements:function(){return this._private.elements}};corefn$3.elements=corefn$3.filter=corefn$3.$;var styfn$8={},TRUE="t",FALSE="f";styfn$8.apply=function(eles){for(var self2=this,_p=self2._private,cy=_p.cy,updatedEles=cy.collection(),ie=0;ie<eles.length;ie++){var ele=eles[ie],cxtMeta=self2.getContextMeta(ele);if(!cxtMeta.empty){var cxtStyle=self2.getContextStyle(cxtMeta),app=self2.applyContextStyle(cxtMeta,cxtStyle,ele);ele._private.appliedInitStyle?self2.updateTransitions(ele,app.diffProps):ele._private.appliedInitStyle=!0;var hintsDiff=self2.updateStyleHints(ele);hintsDiff&&updatedEles.push(ele)}}return updatedEles};styfn$8.getPropertiesDiff=function(oldCxtKey,newCxtKey){var self2=this,cache3=self2._private.propDiffs=self2._private.propDiffs||{},dualCxtKey=oldCxtKey+"-"+newCxtKey,cachedVal=cache3[dualCxtKey];if(cachedVal)return cachedVal;for(var diffProps=[],addedProp={},i=0;i<self2.length;i++){var cxt=self2[i],oldHasCxt=oldCxtKey[i]===TRUE,newHasCxt=newCxtKey[i]===TRUE,cxtHasDiffed=oldHasCxt!==newHasCxt,cxtHasMappedProps=cxt.mappedProperties.length>0;if(cxtHasDiffed||newHasCxt&&cxtHasMappedProps){var props=void 0;cxtHasDiffed&&cxtHasMappedProps||cxtHasDiffed?props=cxt.properties:cxtHasMappedProps&&(props=cxt.mappedProperties);for(var j=0;j<props.length;j++){for(var prop=props[j],name=prop.name,laterCxtOverrides=!1,k=i+1;k<self2.length;k++){var laterCxt=self2[k],hasLaterCxt=newCxtKey[k]===TRUE;if(hasLaterCxt&&(laterCxtOverrides=laterCxt.properties[prop.name]!=null,laterCxtOverrides))break}!addedProp[name]&&!laterCxtOverrides&&(addedProp[name]=!0,diffProps.push(name))}}}return cache3[dualCxtKey]=diffProps,diffProps};styfn$8.getContextMeta=function(ele){for(var self2=this,cxtKey="",diffProps,prevKey=ele._private.styleCxtKey||"",i=0;i<self2.length;i++){var context=self2[i],contextSelectorMatches=context.selector&&context.selector.matches(ele);contextSelectorMatches?cxtKey+=TRUE:cxtKey+=FALSE}return diffProps=self2.getPropertiesDiff(prevKey,cxtKey),ele._private.styleCxtKey=cxtKey,{key:cxtKey,diffPropNames:diffProps,empty:diffProps.length===0}};styfn$8.getContextStyle=function(cxtMeta){var cxtKey=cxtMeta.key,self2=this,cxtStyles=this._private.contextStyles=this._private.contextStyles||{};if(cxtStyles[cxtKey])return cxtStyles[cxtKey];for(var style3={_private:{key:cxtKey}},i=0;i<self2.length;i++){var cxt=self2[i],hasCxt=cxtKey[i]===TRUE;if(hasCxt)for(var j=0;j<cxt.properties.length;j++){var prop=cxt.properties[j];style3[prop.name]=prop}}return cxtStyles[cxtKey]=style3,style3};styfn$8.applyContextStyle=function(cxtMeta,cxtStyle,ele){for(var self2=this,diffProps=cxtMeta.diffPropNames,retDiffProps={},types=self2.types,i=0;i<diffProps.length;i++){var diffPropName=diffProps[i],cxtProp=cxtStyle[diffPropName],eleProp=ele.pstyle(diffPropName);if(!cxtProp)if(eleProp)eleProp.bypass?cxtProp={name:diffPropName,deleteBypassed:!0}:cxtProp={name:diffPropName,delete:!0};else continue;if(eleProp!==cxtProp){if(cxtProp.mapped===types.fn&&eleProp!=null&&eleProp.mapping!=null&&eleProp.mapping.value===cxtProp.value){var mapping=eleProp.mapping,fnValue=mapping.fnValue=cxtProp.value(ele);if(fnValue===mapping.prevFnValue)continue}var retDiffProp=retDiffProps[diffPropName]={prev:eleProp};self2.applyParsedProperty(ele,cxtProp),retDiffProp.next=ele.pstyle(diffPropName),retDiffProp.next&&retDiffProp.next.bypass&&(retDiffProp.next=retDiffProp.next.bypassed)}}return{diffProps:retDiffProps}};styfn$8.updateStyleHints=function(ele){var _p=ele._private,self2=this,propNames=self2.propertyGroupNames,propGrKeys=self2.propertyGroupKeys,propHash=function(ele2,propNames2,seedKey){return self2.getPropertiesHash(ele2,propNames2,seedKey)},oldStyleKey=_p.styleKey;if(ele.removed())return!1;var isNode2=_p.group==="nodes",overriddenStyles=ele._private.style;propNames=Object.keys(overriddenStyles);for(var i=0;i<propGrKeys.length;i++){var grKey=propGrKeys[i];_p.styleKeys[grKey]=[DEFAULT_HASH_SEED,DEFAULT_HASH_SEED_ALT]}for(var updateGrKey1=function(val,grKey2){return _p.styleKeys[grKey2][0]=hashInt(val,_p.styleKeys[grKey2][0])},updateGrKey2=function(val,grKey2){return _p.styleKeys[grKey2][1]=hashIntAlt(val,_p.styleKeys[grKey2][1])},updateGrKey=function(val,grKey2){updateGrKey1(val,grKey2),updateGrKey2(val,grKey2)},updateGrKeyWStr=function(strVal,grKey2){for(var j=0;j<strVal.length;j++){var ch=strVal.charCodeAt(j);updateGrKey1(ch,grKey2),updateGrKey2(ch,grKey2)}},N=2e9,cleanNum=function(val){return-128<val&&val<128&&Math.floor(val)!==val?N-(val*1024|0):val},_i=0;_i<propNames.length;_i++){var name=propNames[_i],parsedProp=overriddenStyles[name];if(parsedProp!=null){var propInfo=this.properties[name],type=propInfo.type,_grKey=propInfo.groupKey,normalizedNumberVal=void 0;propInfo.hashOverride!=null?normalizedNumberVal=propInfo.hashOverride(ele,parsedProp):parsedProp.pfValue!=null&&(normalizedNumberVal=parsedProp.pfValue);var numberVal=propInfo.enums==null?parsedProp.value:null,haveNormNum=normalizedNumberVal!=null,haveUnitedNum=numberVal!=null,haveNum=haveNormNum||haveUnitedNum,units=parsedProp.units;if(type.number&&haveNum&&!type.multiple){var v=haveNormNum?normalizedNumberVal:numberVal;updateGrKey(cleanNum(v),_grKey),!haveNormNum&&units!=null&&updateGrKeyWStr(units,_grKey)}else updateGrKeyWStr(parsedProp.strValue,_grKey)}}for(var hash=[DEFAULT_HASH_SEED,DEFAULT_HASH_SEED_ALT],_i2=0;_i2<propGrKeys.length;_i2++){var _grKey2=propGrKeys[_i2],grHash=_p.styleKeys[_grKey2];hash[0]=hashInt(grHash[0],hash[0]),hash[1]=hashIntAlt(grHash[1],hash[1])}_p.styleKey=combineHashes(hash[0],hash[1]);var sk=_p.styleKeys;_p.labelDimsKey=combineHashesArray(sk.labelDimensions);var labelKeys=propHash(ele,["label"],sk.labelDimensions);if(_p.labelKey=combineHashesArray(labelKeys),_p.labelStyleKey=combineHashesArray(hashArrays(sk.commonLabel,labelKeys)),!isNode2){var sourceLabelKeys=propHash(ele,["source-label"],sk.labelDimensions);_p.sourceLabelKey=combineHashesArray(sourceLabelKeys),_p.sourceLabelStyleKey=combineHashesArray(hashArrays(sk.commonLabel,sourceLabelKeys));var targetLabelKeys=propHash(ele,["target-label"],sk.labelDimensions);_p.targetLabelKey=combineHashesArray(targetLabelKeys),_p.targetLabelStyleKey=combineHashesArray(hashArrays(sk.commonLabel,targetLabelKeys))}if(isNode2){var _p$styleKeys=_p.styleKeys,nodeBody=_p$styleKeys.nodeBody,nodeBorder=_p$styleKeys.nodeBorder,nodeOutline=_p$styleKeys.nodeOutline,backgroundImage=_p$styleKeys.backgroundImage,compound=_p$styleKeys.compound,pie=_p$styleKeys.pie,stripe=_p$styleKeys.stripe,nodeKeys=[nodeBody,nodeBorder,nodeOutline,backgroundImage,compound,pie,stripe].filter(function(k){return k!=null}).reduce(hashArrays,[DEFAULT_HASH_SEED,DEFAULT_HASH_SEED_ALT]);_p.nodeKey=combineHashesArray(nodeKeys),_p.hasPie=pie!=null&&pie[0]!==DEFAULT_HASH_SEED&&pie[1]!==DEFAULT_HASH_SEED_ALT,_p.hasStripe=stripe!=null&&stripe[0]!==DEFAULT_HASH_SEED&&stripe[1]!==DEFAULT_HASH_SEED_ALT}return oldStyleKey!==_p.styleKey};styfn$8.clearStyleHints=function(ele){var _p=ele._private;_p.styleCxtKey="",_p.styleKeys={},_p.styleKey=null,_p.labelKey=null,_p.labelStyleKey=null,_p.sourceLabelKey=null,_p.sourceLabelStyleKey=null,_p.targetLabelKey=null,_p.targetLabelStyleKey=null,_p.nodeKey=null,_p.hasPie=null,_p.hasStripe=null};styfn$8.applyParsedProperty=function(ele,parsedProp){var self2=this,prop=parsedProp,style3=ele._private.style,flatProp,types=self2.types,type=self2.properties[prop.name].type,propIsBypass=prop.bypass,origProp=style3[prop.name],origPropIsBypass=origProp&&origProp.bypass,_p=ele._private,flatPropMapping="mapping",getVal=function(p2){return p2==null?null:p2.pfValue!=null?p2.pfValue:p2.value},checkTriggers=function(){var fromVal=getVal(origProp),toVal=getVal(prop);self2.checkTriggers(ele,prop.name,fromVal,toVal)};if(parsedProp.name==="curve-style"&&ele.isEdge()&&(parsedProp.value!=="bezier"&&ele.isLoop()||parsedProp.value==="haystack"&&(ele.source().isParent()||ele.target().isParent()))&&(prop=parsedProp=this.parse(parsedProp.name,"bezier",propIsBypass)),prop.delete)return style3[prop.name]=void 0,checkTriggers(),!0;if(prop.deleteBypassed)return origProp?origProp.bypass?(origProp.bypassed=void 0,checkTriggers(),!0):!1:(checkTriggers(),!0);if(prop.deleteBypass)return origProp?origProp.bypass?(style3[prop.name]=origProp.bypassed,checkTriggers(),!0):!1:(checkTriggers(),!0);var printMappingErr=function(){warn("Do not assign mappings to elements without corresponding data (i.e. ele `"+ele.id()+"` has no mapping for property `"+prop.name+"` with data field `"+prop.field+"`); try a `["+prop.field+"]` selector to limit scope to elements with `"+prop.field+"` defined")};switch(prop.mapped){case types.mapData:{for(var fields=prop.field.split("."),fieldVal=_p.data,i=0;i<fields.length&&fieldVal;i++){var field=fields[i];fieldVal=fieldVal[field]}if(fieldVal==null)return printMappingErr(),!1;var percent;if(number$1(fieldVal)){var fieldWidth=prop.fieldMax-prop.fieldMin;fieldWidth===0?percent=0:percent=(fieldVal-prop.fieldMin)/fieldWidth}else return warn("Do not use continuous mappers without specifying numeric data (i.e. `"+prop.field+": "+fieldVal+"` for `"+ele.id()+"` is non-numeric)"),!1;if(percent<0?percent=0:percent>1&&(percent=1),type.color){var r1=prop.valueMin[0],r2=prop.valueMax[0],g1=prop.valueMin[1],g2=prop.valueMax[1],b1=prop.valueMin[2],b2=prop.valueMax[2],a1=prop.valueMin[3]==null?1:prop.valueMin[3],a2=prop.valueMax[3]==null?1:prop.valueMax[3],clr=[Math.round(r1+(r2-r1)*percent),Math.round(g1+(g2-g1)*percent),Math.round(b1+(b2-b1)*percent),Math.round(a1+(a2-a1)*percent)];flatProp={bypass:prop.bypass,name:prop.name,value:clr,strValue:"rgb("+clr[0]+", "+clr[1]+", "+clr[2]+")"}}else if(type.number){var calcValue=prop.valueMin+(prop.valueMax-prop.valueMin)*percent;flatProp=this.parse(prop.name,calcValue,prop.bypass,flatPropMapping)}else return!1;if(!flatProp)return printMappingErr(),!1;flatProp.mapping=prop,prop=flatProp;break}case types.data:{for(var _fields=prop.field.split("."),_fieldVal=_p.data,_i3=0;_i3<_fields.length&&_fieldVal;_i3++){var _field=_fields[_i3];_fieldVal=_fieldVal[_field]}if(_fieldVal!=null&&(flatProp=this.parse(prop.name,_fieldVal,prop.bypass,flatPropMapping)),!flatProp)return printMappingErr(),!1;flatProp.mapping=prop,prop=flatProp;break}case types.fn:{var fn3=prop.value,fnRetVal=prop.fnValue!=null?prop.fnValue:fn3(ele);if(prop.prevFnValue=fnRetVal,fnRetVal==null)return warn("Custom function mappers may not return null (i.e. `"+prop.name+"` for ele `"+ele.id()+"` is null)"),!1;if(flatProp=this.parse(prop.name,fnRetVal,prop.bypass,flatPropMapping),!flatProp)return warn("Custom function mappers may not return invalid values for the property type (i.e. `"+prop.name+"` for ele `"+ele.id()+"` is invalid)"),!1;flatProp.mapping=copy(prop),prop=flatProp;break}case void 0:break;default:return!1}return propIsBypass?(origPropIsBypass?prop.bypassed=origProp.bypassed:prop.bypassed=origProp,style3[prop.name]=prop):origPropIsBypass?origProp.bypassed=prop:style3[prop.name]=prop,checkTriggers(),!0};styfn$8.cleanElements=function(eles,keepBypasses){for(var i=0;i<eles.length;i++){var ele=eles[i];if(this.clearStyleHints(ele),ele.dirtyCompoundBoundsCache(),ele.dirtyBoundingBoxCache(),!keepBypasses)ele._private.style={};else for(var style3=ele._private.style,propNames=Object.keys(style3),j=0;j<propNames.length;j++){var propName=propNames[j],eleProp=style3[propName];eleProp!=null&&(eleProp.bypass?eleProp.bypassed=null:style3[propName]=null)}}};styfn$8.update=function(){var cy=this._private.cy,eles=cy.mutableElements();eles.updateStyle()};styfn$8.updateTransitions=function(ele,diffProps){var self2=this,_p=ele._private,props=ele.pstyle("transition-property").value,duration=ele.pstyle("transition-duration").pfValue,delay2=ele.pstyle("transition-delay").pfValue;if(props.length>0&&duration>0){for(var style3={},anyPrev=!1,i=0;i<props.length;i++){var prop=props[i],styProp=ele.pstyle(prop),diffProp=diffProps[prop];if(diffProp){var prevProp=diffProp.prev,fromProp=prevProp,toProp=diffProp.next!=null?diffProp.next:styProp,diff2=!1,initVal=void 0,initDt=1e-6;fromProp&&(number$1(fromProp.pfValue)&&number$1(toProp.pfValue)?(diff2=toProp.pfValue-fromProp.pfValue,initVal=fromProp.pfValue+initDt*diff2):number$1(fromProp.value)&&number$1(toProp.value)?(diff2=toProp.value-fromProp.value,initVal=fromProp.value+initDt*diff2):array(fromProp.value)&&array(toProp.value)&&(diff2=fromProp.value[0]!==toProp.value[0]||fromProp.value[1]!==toProp.value[1]||fromProp.value[2]!==toProp.value[2],initVal=fromProp.strValue),diff2&&(style3[prop]=toProp.strValue,this.applyBypass(ele,prop,initVal),anyPrev=!0))}}if(!anyPrev)return;_p.transitioning=!0,new Promise$1(function(resolve2){delay2>0?ele.delayAnimation(delay2).play().promise().then(resolve2):resolve2()}).then(function(){return ele.animation({style:style3,duration,easing:ele.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){self2.removeBypasses(ele,props),ele.emitAndNotify("style"),_p.transitioning=!1})}else _p.transitioning&&(this.removeBypasses(ele,props),ele.emitAndNotify("style"),_p.transitioning=!1)};styfn$8.checkTrigger=function(ele,name,fromValue,toValue,getTrigger,onTrigger){var prop=this.properties[name],triggerCheck=getTrigger(prop);ele.removed()||triggerCheck!=null&&triggerCheck(fromValue,toValue,ele)&&onTrigger(prop)};styfn$8.checkZOrderTrigger=function(ele,name,fromValue,toValue){var _this=this;this.checkTrigger(ele,name,fromValue,toValue,function(prop){return prop.triggersZOrder},function(){_this._private.cy.notify("zorder",ele)})};styfn$8.checkBoundsTrigger=function(ele,name,fromValue,toValue){this.checkTrigger(ele,name,fromValue,toValue,function(prop){return prop.triggersBounds},function(prop){ele.dirtyCompoundBoundsCache(),ele.dirtyBoundingBoxCache()})};styfn$8.checkConnectedEdgesBoundsTrigger=function(ele,name,fromValue,toValue){this.checkTrigger(ele,name,fromValue,toValue,function(prop){return prop.triggersBoundsOfConnectedEdges},function(prop){ele.connectedEdges().forEach(function(edge){edge.dirtyBoundingBoxCache()})})};styfn$8.checkParallelEdgesBoundsTrigger=function(ele,name,fromValue,toValue){this.checkTrigger(ele,name,fromValue,toValue,function(prop){return prop.triggersBoundsOfParallelEdges},function(prop){ele.parallelEdges().forEach(function(pllEdge){pllEdge.dirtyBoundingBoxCache()})})};styfn$8.checkTriggers=function(ele,name,fromValue,toValue){ele.dirtyStyleCache(),this.checkZOrderTrigger(ele,name,fromValue,toValue),this.checkBoundsTrigger(ele,name,fromValue,toValue),this.checkConnectedEdgesBoundsTrigger(ele,name,fromValue,toValue),this.checkParallelEdgesBoundsTrigger(ele,name,fromValue,toValue)};var styfn$7={};styfn$7.applyBypass=function(eles,name,value,updateTransitions){var self2=this,props=[],isBypass=!0;if(name==="*"||name==="**"){if(value!==void 0)for(var i=0;i<self2.properties.length;i++){var prop=self2.properties[i],_name=prop.name,parsedProp=this.parse(_name,value,!0);parsedProp&&props.push(parsedProp)}}else if(string(name)){var _parsedProp=this.parse(name,value,!0);_parsedProp&&props.push(_parsedProp)}else if(plainObject(name)){var specifiedProps=name;updateTransitions=value;for(var names=Object.keys(specifiedProps),_i=0;_i<names.length;_i++){var _name2=names[_i],_value=specifiedProps[_name2];if(_value===void 0&&(_value=specifiedProps[dash2camel(_name2)]),_value!==void 0){var _parsedProp2=this.parse(_name2,_value,!0);_parsedProp2&&props.push(_parsedProp2)}}}else return!1;if(props.length===0)return!1;for(var ret=!1,_i2=0;_i2<eles.length;_i2++){for(var ele=eles[_i2],diffProps={},diffProp=void 0,j=0;j<props.length;j++){var _prop=props[j];if(updateTransitions){var prevProp=ele.pstyle(_prop.name);diffProp=diffProps[_prop.name]={prev:prevProp}}ret=this.applyParsedProperty(ele,copy(_prop))||ret,updateTransitions&&(diffProp.next=ele.pstyle(_prop.name))}ret&&this.updateStyleHints(ele),updateTransitions&&this.updateTransitions(ele,diffProps,isBypass)}return ret};styfn$7.overrideBypass=function(eles,name,value){name=camel2dash(name);for(var i=0;i<eles.length;i++){var ele=eles[i],prop=ele._private.style[name],type=this.properties[name].type,isColor=type.color,isMulti=type.mutiple,oldValue=prop?prop.pfValue!=null?prop.pfValue:prop.value:null;!prop||!prop.bypass?this.applyBypass(ele,name,value):(prop.value=value,prop.pfValue!=null&&(prop.pfValue=value),isColor?prop.strValue="rgb("+value.join(",")+")":isMulti?prop.strValue=value.join(" "):prop.strValue=""+value,this.updateStyleHints(ele)),this.checkTriggers(ele,name,oldValue,value)}};styfn$7.removeAllBypasses=function(eles,updateTransitions){return this.removeBypasses(eles,this.propertyNames,updateTransitions)};styfn$7.removeBypasses=function(eles,props,updateTransitions){for(var isBypass=!0,j=0;j<eles.length;j++){for(var ele=eles[j],diffProps={},i=0;i<props.length;i++){var name=props[i],prop=this.properties[name],prevProp=ele.pstyle(prop.name);if(!(!prevProp||!prevProp.bypass)){var value="",parsedProp=this.parse(name,value,!0),diffProp=diffProps[prop.name]={prev:prevProp};this.applyParsedProperty(ele,parsedProp),diffProp.next=ele.pstyle(prop.name)}}this.updateStyleHints(ele),updateTransitions&&this.updateTransitions(ele,diffProps,isBypass)}};var styfn$6={};styfn$6.getEmSizeInPixels=function(){var px=this.containerCss("font-size");return px!=null?parseFloat(px):1};styfn$6.containerCss=function(propName){var cy=this._private.cy,domElement3=cy.container(),containerWindow=cy.window();if(containerWindow&&domElement3&&containerWindow.getComputedStyle)return containerWindow.getComputedStyle(domElement3).getPropertyValue(propName)};var styfn$5={};styfn$5.getRenderedStyle=function(ele,prop){return prop?this.getStylePropertyValue(ele,prop,!0):this.getRawStyle(ele,!0)};styfn$5.getRawStyle=function(ele,isRenderedVal){var self2=this;if(ele=ele[0],ele){for(var rstyle={},i=0;i<self2.properties.length;i++){var prop=self2.properties[i],val=self2.getStylePropertyValue(ele,prop.name,isRenderedVal);val!=null&&(rstyle[prop.name]=val,rstyle[dash2camel(prop.name)]=val)}return rstyle}};styfn$5.getIndexedStyle=function(ele,property,subproperty,index){var pstyle=ele.pstyle(property)[subproperty][index];return pstyle??ele.cy().style().getDefaultProperty(property)[subproperty][0]};styfn$5.getStylePropertyValue=function(ele,propName,isRenderedVal){var self2=this;if(ele=ele[0],ele){var prop=self2.properties[propName];prop.alias&&(prop=prop.pointsTo);var type=prop.type,styleProp=ele.pstyle(prop.name);if(styleProp){var value=styleProp.value,units=styleProp.units,strValue=styleProp.strValue;if(isRenderedVal&&type.number&&value!=null&&number$1(value)){var zoom2=ele.cy().zoom(),getRenderedValue=function(val){return val*zoom2},getValueStringWithUnits=function(val,units2){return getRenderedValue(val)+units2},isArrayValue=array(value),haveUnits=isArrayValue?units.every(function(u){return u!=null}):units!=null;return haveUnits?isArrayValue?value.map(function(v,i){return getValueStringWithUnits(v,units[i])}).join(" "):getValueStringWithUnits(value,units):isArrayValue?value.map(function(v){return string(v)?v:""+getRenderedValue(v)}).join(" "):""+getRenderedValue(value)}else if(strValue!=null)return strValue}return null}};styfn$5.getAnimationStartStyle=function(ele,aniProps){for(var rstyle={},i=0;i<aniProps.length;i++){var aniProp=aniProps[i],name=aniProp.name,styleProp=ele.pstyle(name);styleProp!==void 0&&(plainObject(styleProp)?styleProp=this.parse(name,styleProp.strValue):styleProp=this.parse(name,styleProp)),styleProp&&(rstyle[name]=styleProp)}return rstyle};styfn$5.getPropsList=function(propsObj){var self2=this,rstyle=[],style3=propsObj,props=self2.properties;if(style3)for(var names=Object.keys(style3),i=0;i<names.length;i++){var name=names[i],val=style3[name],prop=props[name]||props[camel2dash(name)],styleProp=this.parse(prop.name,val);styleProp&&rstyle.push(styleProp)}return rstyle};styfn$5.getNonDefaultPropertiesHash=function(ele,propNames,seed){var hash=seed.slice(),name,val,strVal,chVal,i,j;for(i=0;i<propNames.length;i++)if(name=propNames[i],val=ele.pstyle(name,!1),val!=null)if(val.pfValue!=null)hash[0]=hashInt(chVal,hash[0]),hash[1]=hashIntAlt(chVal,hash[1]);else for(strVal=val.strValue,j=0;j<strVal.length;j++)chVal=strVal.charCodeAt(j),hash[0]=hashInt(chVal,hash[0]),hash[1]=hashIntAlt(chVal,hash[1]);return hash};styfn$5.getPropertiesHash=styfn$5.getNonDefaultPropertiesHash;var styfn$4={};styfn$4.appendFromJson=function(json2){for(var style3=this,i=0;i<json2.length;i++){var context=json2[i],selector=context.selector,props=context.style||context.css,names=Object.keys(props);style3.selector(selector);for(var j=0;j<names.length;j++){var name=names[j],value=props[name];style3.css(name,value)}}return style3};styfn$4.fromJson=function(json2){var style3=this;return style3.resetToDefault(),style3.appendFromJson(json2),style3};styfn$4.json=function(){for(var json2=[],i=this.defaultLength;i<this.length;i++){for(var cxt=this[i],selector=cxt.selector,props=cxt.properties,css={},j=0;j<props.length;j++){var prop=props[j];css[prop.name]=prop.strValue}json2.push({selector:selector?selector.toString():"core",style:css})}return json2};var styfn$3={};styfn$3.appendFromString=function(string3){var self2=this,style3=this,remaining=""+string3,selAndBlockStr,blockRem,propAndValStr;remaining=remaining.replace(/[/][*](\s|.)+?[*][/]/g,"");function removeSelAndBlockFromRemaining(){remaining.length>selAndBlockStr.length?remaining=remaining.substr(selAndBlockStr.length):remaining=""}function removePropAndValFromRem(){blockRem.length>propAndValStr.length?blockRem=blockRem.substr(propAndValStr.length):blockRem=""}for(;;){var nothingLeftToParse=remaining.match(/^\s*$/);if(nothingLeftToParse)break;var selAndBlock=remaining.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!selAndBlock){warn("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+remaining);break}selAndBlockStr=selAndBlock[0];var selectorStr=selAndBlock[1];if(selectorStr!=="core"){var selector=new Selector(selectorStr);if(selector.invalid){warn("Skipping parsing of block: Invalid selector found in string stylesheet: "+selectorStr),removeSelAndBlockFromRemaining();continue}}var blockStr=selAndBlock[2],invalidBlock=!1;blockRem=blockStr;for(var props=[];;){var _nothingLeftToParse=blockRem.match(/^\s*$/);if(_nothingLeftToParse)break;var propAndVal=blockRem.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!propAndVal){warn("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+blockStr),invalidBlock=!0;break}propAndValStr=propAndVal[0];var propStr=propAndVal[1],valStr=propAndVal[2],prop=self2.properties[propStr];if(!prop){warn("Skipping property: Invalid property name in: "+propAndValStr),removePropAndValFromRem();continue}var parsedProp=style3.parse(propStr,valStr);if(!parsedProp){warn("Skipping property: Invalid property definition in: "+propAndValStr),removePropAndValFromRem();continue}props.push({name:propStr,val:valStr}),removePropAndValFromRem()}if(invalidBlock){removeSelAndBlockFromRemaining();break}style3.selector(selectorStr);for(var i=0;i<props.length;i++){var _prop=props[i];style3.css(_prop.name,_prop.val)}removeSelAndBlockFromRemaining()}return style3};styfn$3.fromString=function(string3){var style3=this;return style3.resetToDefault(),style3.appendFromString(string3),style3};var styfn$2={};(function(){var number$12=number2,rgba2=rgbaNoBackRefs,hsla2=hslaNoBackRefs,hex3$1=hex3,hex6$1=hex6,data4=function(prefix){return"^"+prefix+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},mapData=function(prefix){var mapArg=number$12+"|\\w+|"+rgba2+"|"+hsla2+"|"+hex3$1+"|"+hex6$1;return"^"+prefix+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+number$12+")\\s*\\,\\s*("+number$12+")\\s*,\\s*("+mapArg+")\\s*\\,\\s*("+mapArg+")\\)$"},urlRegexes=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];styfn$2.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:data4("data")},layoutData:{mapping:!0,regex:data4("layoutData")},scratch:{mapping:!0,regex:data4("scratch")},mapData:{mapping:!0,regex:mapData("mapData")},mapLayoutData:{mapping:!0,regex:mapData("mapLayoutData")},mapScratch:{mapping:!0,regex:mapData("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:urlRegexes,singleRegexMatchValue:!0},urls:{regexes:urlRegexes,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(valArr,unitsArr){switch(valArr.length){case 2:return unitsArr[0]!=="deg"&&unitsArr[0]!=="rad"&&unitsArr[1]!=="deg"&&unitsArr[1]!=="rad";case 1:return string(valArr[0])||unitsArr[0]==="deg"||unitsArr[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+number$12+")\\s*,\\s*("+number$12+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+number$12+")\\s*,\\s*("+number$12+")\\s*,\\s*("+number$12+")\\s*,\\s*("+number$12+")\\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(valArr){var length=valArr.length;return length===1||length===2||length===4}}};var diff2={zeroNonZero:function(val1,val2){return(val1==null||val2==null)&&val1!==val2||val1==0&&val2!=0?!0:val1!=0&&val2==0},any:function(val1,val2){return val1!=val2},emptyNonEmpty:function(str1,str2){var empty1=emptyString(str1),empty2=emptyString(str2);return empty1&&!empty2||!empty1&&empty2}},t=styfn$2.types,mainLabel=[{name:"label",type:t.text,triggersBounds:diff2.any,triggersZOrder:diff2.emptyNonEmpty},{name:"text-rotation",type:t.textRotation,triggersBounds:diff2.any},{name:"text-margin-x",type:t.bidirectionalSize,triggersBounds:diff2.any},{name:"text-margin-y",type:t.bidirectionalSize,triggersBounds:diff2.any}],sourceLabel=[{name:"source-label",type:t.text,triggersBounds:diff2.any},{name:"source-text-rotation",type:t.textRotation,triggersBounds:diff2.any},{name:"source-text-margin-x",type:t.bidirectionalSize,triggersBounds:diff2.any},{name:"source-text-margin-y",type:t.bidirectionalSize,triggersBounds:diff2.any},{name:"source-text-offset",type:t.size,triggersBounds:diff2.any}],targetLabel=[{name:"target-label",type:t.text,triggersBounds:diff2.any},{name:"target-text-rotation",type:t.textRotation,triggersBounds:diff2.any},{name:"target-text-margin-x",type:t.bidirectionalSize,triggersBounds:diff2.any},{name:"target-text-margin-y",type:t.bidirectionalSize,triggersBounds:diff2.any},{name:"target-text-offset",type:t.size,triggersBounds:diff2.any}],labelDimensions=[{name:"font-family",type:t.fontFamily,triggersBounds:diff2.any},{name:"font-style",type:t.fontStyle,triggersBounds:diff2.any},{name:"font-weight",type:t.fontWeight,triggersBounds:diff2.any},{name:"font-size",type:t.size,triggersBounds:diff2.any},{name:"text-transform",type:t.textTransform,triggersBounds:diff2.any},{name:"text-wrap",type:t.textWrap,triggersBounds:diff2.any},{name:"text-overflow-wrap",type:t.textOverflowWrap,triggersBounds:diff2.any},{name:"text-max-width",type:t.size,triggersBounds:diff2.any},{name:"text-outline-width",type:t.size,triggersBounds:diff2.any},{name:"line-height",type:t.positiveNumber,triggersBounds:diff2.any}],commonLabel=[{name:"text-valign",type:t.valign,triggersBounds:diff2.any},{name:"text-halign",type:t.halign,triggersBounds:diff2.any},{name:"color",type:t.color},{name:"text-outline-color",type:t.color},{name:"text-outline-opacity",type:t.zeroOneNumber},{name:"text-background-color",type:t.color},{name:"text-background-opacity",type:t.zeroOneNumber},{name:"text-background-padding",type:t.size,triggersBounds:diff2.any},{name:"text-border-opacity",type:t.zeroOneNumber},{name:"text-border-color",type:t.color},{name:"text-border-width",type:t.size,triggersBounds:diff2.any},{name:"text-border-style",type:t.borderStyle,triggersBounds:diff2.any},{name:"text-background-shape",type:t.textBackgroundShape,triggersBounds:diff2.any},{name:"text-justification",type:t.justification},{name:"box-select-labels",type:t.bool,triggersBounds:diff2.any}],behavior=[{name:"events",type:t.bool,triggersZOrder:diff2.any},{name:"text-events",type:t.bool,triggersZOrder:diff2.any},{name:"box-selection",type:t.boxSelection,triggersZOrder:diff2.any}],visibility=[{name:"display",type:t.display,triggersZOrder:diff2.any,triggersBounds:diff2.any,triggersBoundsOfConnectedEdges:diff2.any,triggersBoundsOfParallelEdges:function(fromValue,toValue,ele){return fromValue===toValue?!1:ele.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:t.visibility,triggersZOrder:diff2.any},{name:"opacity",type:t.zeroOneNumber,triggersZOrder:diff2.zeroNonZero},{name:"text-opacity",type:t.zeroOneNumber},{name:"min-zoomed-font-size",type:t.size},{name:"z-compound-depth",type:t.zCompoundDepth,triggersZOrder:diff2.any},{name:"z-index-compare",type:t.zIndexCompare,triggersZOrder:diff2.any},{name:"z-index",type:t.number,triggersZOrder:diff2.any}],overlay=[{name:"overlay-padding",type:t.size,triggersBounds:diff2.any},{name:"overlay-color",type:t.color},{name:"overlay-opacity",type:t.zeroOneNumber,triggersBounds:diff2.zeroNonZero},{name:"overlay-shape",type:t.overlayShape,triggersBounds:diff2.any},{name:"overlay-corner-radius",type:t.cornerRadius}],underlay=[{name:"underlay-padding",type:t.size,triggersBounds:diff2.any},{name:"underlay-color",type:t.color},{name:"underlay-opacity",type:t.zeroOneNumber,triggersBounds:diff2.zeroNonZero},{name:"underlay-shape",type:t.overlayShape,triggersBounds:diff2.any},{name:"underlay-corner-radius",type:t.cornerRadius}],transition=[{name:"transition-property",type:t.propList},{name:"transition-duration",type:t.time},{name:"transition-delay",type:t.time},{name:"transition-timing-function",type:t.easing}],nodeSizeHashOverride=function(ele,parsedProp){return parsedProp.value==="label"?-ele.poolIndex():parsedProp.pfValue},nodeBody=[{name:"height",type:t.nodeSize,triggersBounds:diff2.any,hashOverride:nodeSizeHashOverride},{name:"width",type:t.nodeSize,triggersBounds:diff2.any,hashOverride:nodeSizeHashOverride},{name:"shape",type:t.nodeShape,triggersBounds:diff2.any},{name:"shape-polygon-points",type:t.polygonPointList,triggersBounds:diff2.any},{name:"corner-radius",type:t.cornerRadius},{name:"background-color",type:t.color},{name:"background-fill",type:t.fill},{name:"background-opacity",type:t.zeroOneNumber},{name:"background-blacken",type:t.nOneOneNumber},{name:"background-gradient-stop-colors",type:t.colors},{name:"background-gradient-stop-positions",type:t.percentages},{name:"background-gradient-direction",type:t.gradientDirection},{name:"padding",type:t.sizeMaybePercent,triggersBounds:diff2.any},{name:"padding-relative-to",type:t.paddingRelativeTo,triggersBounds:diff2.any},{name:"bounds-expansion",type:t.boundsExpansion,triggersBounds:diff2.any}],nodeBorder=[{name:"border-color",type:t.color},{name:"border-opacity",type:t.zeroOneNumber},{name:"border-width",type:t.size,triggersBounds:diff2.any},{name:"border-style",type:t.borderStyle},{name:"border-cap",type:t.lineCap},{name:"border-join",type:t.lineJoin},{name:"border-dash-pattern",type:t.numbers},{name:"border-dash-offset",type:t.number},{name:"border-position",type:t.linePosition}],nodeOutline=[{name:"outline-color",type:t.color},{name:"outline-opacity",type:t.zeroOneNumber},{name:"outline-width",type:t.size,triggersBounds:diff2.any},{name:"outline-style",type:t.borderStyle},{name:"outline-offset",type:t.size,triggersBounds:diff2.any}],backgroundImage=[{name:"background-image",type:t.urls},{name:"background-image-crossorigin",type:t.bgCrossOrigin},{name:"background-image-opacity",type:t.zeroOneNumbers},{name:"background-image-containment",type:t.bgContainment},{name:"background-image-smoothing",type:t.bools},{name:"background-position-x",type:t.bgPos},{name:"background-position-y",type:t.bgPos},{name:"background-width-relative-to",type:t.bgRelativeTo},{name:"background-height-relative-to",type:t.bgRelativeTo},{name:"background-repeat",type:t.bgRepeat},{name:"background-fit",type:t.bgFit},{name:"background-clip",type:t.bgClip},{name:"background-width",type:t.bgWH},{name:"background-height",type:t.bgWH},{name:"background-offset-x",type:t.bgPos},{name:"background-offset-y",type:t.bgPos}],compound=[{name:"position",type:t.position,triggersBounds:diff2.any},{name:"compound-sizing-wrt-labels",type:t.compoundIncludeLabels,triggersBounds:diff2.any},{name:"min-width",type:t.size,triggersBounds:diff2.any},{name:"min-width-bias-left",type:t.sizeMaybePercent,triggersBounds:diff2.any},{name:"min-width-bias-right",type:t.sizeMaybePercent,triggersBounds:diff2.any},{name:"min-height",type:t.size,triggersBounds:diff2.any},{name:"min-height-bias-top",type:t.sizeMaybePercent,triggersBounds:diff2.any},{name:"min-height-bias-bottom",type:t.sizeMaybePercent,triggersBounds:diff2.any}],edgeLine=[{name:"line-style",type:t.lineStyle},{name:"line-color",type:t.color},{name:"line-fill",type:t.fill},{name:"line-cap",type:t.lineCap},{name:"line-opacity",type:t.zeroOneNumber},{name:"line-dash-pattern",type:t.numbers},{name:"line-dash-offset",type:t.number},{name:"line-outline-width",type:t.size},{name:"line-outline-color",type:t.color},{name:"line-gradient-stop-colors",type:t.colors},{name:"line-gradient-stop-positions",type:t.percentages},{name:"curve-style",type:t.curveStyle,triggersBounds:diff2.any,triggersBoundsOfParallelEdges:function(fromValue,toValue){return fromValue===toValue?!1:fromValue==="bezier"||toValue==="bezier"}},{name:"haystack-radius",type:t.zeroOneNumber,triggersBounds:diff2.any},{name:"source-endpoint",type:t.edgeEndpoint,triggersBounds:diff2.any},{name:"target-endpoint",type:t.edgeEndpoint,triggersBounds:diff2.any},{name:"control-point-step-size",type:t.size,triggersBounds:diff2.any},{name:"control-point-distances",type:t.bidirectionalSizes,triggersBounds:diff2.any},{name:"control-point-weights",type:t.numbers,triggersBounds:diff2.any},{name:"segment-distances",type:t.bidirectionalSizes,triggersBounds:diff2.any},{name:"segment-weights",type:t.numbers,triggersBounds:diff2.any},{name:"segment-radii",type:t.numbers,triggersBounds:diff2.any},{name:"radius-type",type:t.radiusType,triggersBounds:diff2.any},{name:"taxi-turn",type:t.bidirectionalSizeMaybePercent,triggersBounds:diff2.any},{name:"taxi-turn-min-distance",type:t.size,triggersBounds:diff2.any},{name:"taxi-direction",type:t.axisDirection,triggersBounds:diff2.any},{name:"taxi-radius",type:t.number,triggersBounds:diff2.any},{name:"edge-distances",type:t.edgeDistances,triggersBounds:diff2.any},{name:"arrow-scale",type:t.positiveNumber,triggersBounds:diff2.any},{name:"loop-direction",type:t.angle,triggersBounds:diff2.any},{name:"loop-sweep",type:t.angle,triggersBounds:diff2.any},{name:"source-distance-from-node",type:t.size,triggersBounds:diff2.any},{name:"target-distance-from-node",type:t.size,triggersBounds:diff2.any}],ghost=[{name:"ghost",type:t.bool,triggersBounds:diff2.any},{name:"ghost-offset-x",type:t.bidirectionalSize,triggersBounds:diff2.any},{name:"ghost-offset-y",type:t.bidirectionalSize,triggersBounds:diff2.any},{name:"ghost-opacity",type:t.zeroOneNumber}],core3=[{name:"selection-box-color",type:t.color},{name:"selection-box-opacity",type:t.zeroOneNumber},{name:"selection-box-border-color",type:t.color},{name:"selection-box-border-width",type:t.size},{name:"active-bg-color",type:t.color},{name:"active-bg-opacity",type:t.zeroOneNumber},{name:"active-bg-size",type:t.size},{name:"outside-texture-bg-color",type:t.color},{name:"outside-texture-bg-opacity",type:t.zeroOneNumber}],pie=[];styfn$2.pieBackgroundN=16,pie.push({name:"pie-size",type:t.sizeMaybePercent}),pie.push({name:"pie-hole",type:t.sizeMaybePercent}),pie.push({name:"pie-start-angle",type:t.angle});for(var i=1;i<=styfn$2.pieBackgroundN;i++)pie.push({name:"pie-"+i+"-background-color",type:t.color}),pie.push({name:"pie-"+i+"-background-size",type:t.percent}),pie.push({name:"pie-"+i+"-background-opacity",type:t.zeroOneNumber});var stripe=[];styfn$2.stripeBackgroundN=16,stripe.push({name:"stripe-size",type:t.sizeMaybePercent}),stripe.push({name:"stripe-direction",type:t.axisDirectionPrimary});for(var _i=1;_i<=styfn$2.stripeBackgroundN;_i++)stripe.push({name:"stripe-"+_i+"-background-color",type:t.color}),stripe.push({name:"stripe-"+_i+"-background-size",type:t.percent}),stripe.push({name:"stripe-"+_i+"-background-opacity",type:t.zeroOneNumber});var edgeArrow=[],arrowPrefixes=styfn$2.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:t.arrowShape,triggersBounds:diff2.any},{name:"arrow-color",type:t.color},{name:"arrow-fill",type:t.arrowFill},{name:"arrow-width",type:t.arrowWidth}].forEach(function(prop2){arrowPrefixes.forEach(function(prefix){var name=prefix+"-"+prop2.name,type=prop2.type,triggersBounds=prop2.triggersBounds;edgeArrow.push({name,type,triggersBounds})})},{});var props=styfn$2.properties=[].concat(behavior,transition,visibility,overlay,underlay,ghost,commonLabel,labelDimensions,mainLabel,sourceLabel,targetLabel,nodeBody,nodeBorder,nodeOutline,backgroundImage,pie,stripe,compound,edgeLine,edgeArrow,core3),propGroups=styfn$2.propertyGroups={behavior,transition,visibility,overlay,underlay,ghost,commonLabel,labelDimensions,mainLabel,sourceLabel,targetLabel,nodeBody,nodeBorder,nodeOutline,backgroundImage,pie,stripe,compound,edgeLine,edgeArrow,core:core3},propGroupNames=styfn$2.propertyGroupNames={},propGroupKeys=styfn$2.propertyGroupKeys=Object.keys(propGroups);propGroupKeys.forEach(function(key){propGroupNames[key]=propGroups[key].map(function(prop2){return prop2.name}),propGroups[key].forEach(function(prop2){return prop2.groupKey=key})});var aliases=styfn$2.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"}];styfn$2.propertyNames=props.map(function(p2){return p2.name});for(var _i2=0;_i2<props.length;_i2++){var prop=props[_i2];props[prop.name]=prop}for(var _i3=0;_i3<aliases.length;_i3++){var alias=aliases[_i3],pointsToProp=props[alias.pointsTo],aliasProp={name:alias.name,alias:!0,pointsTo:pointsToProp};props.push(aliasProp),props[alias.name]=aliasProp}})();styfn$2.getDefaultProperty=function(name){return this.getDefaultProperties()[name]};styfn$2.getDefaultProperties=function(){var _p=this._private;if(_p.defaultProperties!=null)return _p.defaultProperties;for(var rawProps=extend({"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(css,prop2){for(var i2=1;i2<=styfn$2.pieBackgroundN;i2++){var name2=prop2.name.replace("{{i}}",i2),val2=prop2.value;css[name2]=val2}return css},{}),{"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(css,prop2){for(var i2=1;i2<=styfn$2.stripeBackgroundN;i2++){var name2=prop2.name.replace("{{i}}",i2),val2=prop2.value;css[name2]=val2}return css},{}),{"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(css,prop2){return styfn$2.arrowPrefixes.forEach(function(prefix){var name2=prefix+"-"+prop2.name,val2=prop2.value;css[name2]=val2}),css},{})),parsedProps={},i=0;i<this.properties.length;i++){var prop=this.properties[i];if(!prop.pointsTo){var name=prop.name,val=rawProps[name],parsedProp=this.parse(name,val);parsedProps[name]=parsedProp}}return _p.defaultProperties=parsedProps,_p.defaultProperties};styfn$2.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 styfn$1={};styfn$1.parse=function(name,value,propIsBypass,propIsFlat){var self2=this;if(fn$6(value))return self2.parseImplWarn(name,value,propIsBypass,propIsFlat);var flatKey=propIsFlat==="mapping"||propIsFlat===!0||propIsFlat===!1||propIsFlat==null?"dontcare":propIsFlat,bypassKey=propIsBypass?"t":"f",valueKey=""+value,argHash=hashStrings(name,valueKey,bypassKey,flatKey),propCache=self2.propCache=self2.propCache||[],ret;return(ret=propCache[argHash])||(ret=propCache[argHash]=self2.parseImplWarn(name,value,propIsBypass,propIsFlat)),(propIsBypass||propIsFlat==="mapping")&&(ret=copy(ret),ret&&(ret.value=copy(ret.value))),ret};styfn$1.parseImplWarn=function(name,value,propIsBypass,propIsFlat){var prop=this.parseImpl(name,value,propIsBypass,propIsFlat);return!prop&&value!=null&&warn("The style property `".concat(name,": ").concat(value,"` is invalid")),prop&&(prop.name==="width"||prop.name==="height")&&value==="label"&&warn("The style value of `label` is deprecated for `"+prop.name+"`"),prop};styfn$1.parseImpl=function(name,value,propIsBypass,propIsFlat){var self2=this;name=camel2dash(name);var property=self2.properties[name],passedValue=value,types=self2.types;if(!property||value===void 0)return null;property.alias&&(property=property.pointsTo,name=property.name);var valueIsString=string(value);valueIsString&&(value=value.trim());var type=property.type;if(!type)return null;if(propIsBypass&&(value===""||value===null))return{name,value,bypass:!0,deleteBypass:!0};if(fn$6(value))return{name,value,strValue:"fn",mapped:types.fn,bypass:propIsBypass};var data4,mapData;if(!(!valueIsString||propIsFlat||value.length<7||value[1]!=="a")){if(value.length>=7&&value[0]==="d"&&(data4=new RegExp(types.data.regex).exec(value))){if(propIsBypass)return!1;var mapped=types.data;return{name,value:data4,strValue:""+value,mapped,field:data4[1],bypass:propIsBypass}}else if(value.length>=10&&value[0]==="m"&&(mapData=new RegExp(types.mapData.regex).exec(value))){if(propIsBypass||type.multiple)return!1;var _mapped=types.mapData;if(!(type.color||type.number))return!1;var valueMin=this.parse(name,mapData[4]);if(!valueMin||valueMin.mapped)return!1;var valueMax=this.parse(name,mapData[5]);if(!valueMax||valueMax.mapped)return!1;if(valueMin.pfValue===valueMax.pfValue||valueMin.strValue===valueMax.strValue)return warn("`"+name+": "+value+"` is not a valid mapper because the output range is zero; converting to `"+name+": "+valueMin.strValue+"`"),this.parse(name,valueMin.strValue);if(type.color){var c1=valueMin.value,c2=valueMax.value,same2=c1[0]===c2[0]&&c1[1]===c2[1]&&c1[2]===c2[2]&&(c1[3]===c2[3]||(c1[3]==null||c1[3]===1)&&(c2[3]==null||c2[3]===1));if(same2)return!1}return{name,value:mapData,strValue:""+value,mapped:_mapped,field:mapData[1],fieldMin:parseFloat(mapData[2]),fieldMax:parseFloat(mapData[3]),valueMin:valueMin.value,valueMax:valueMax.value,bypass:propIsBypass}}}if(type.multiple&&propIsFlat!=="multiple"){var vals;if(valueIsString?vals=value.split(/\s+/):array(value)?vals=value:vals=[value],type.evenMultiple&&vals.length%2!==0)return null;for(var valArr=[],unitsArr=[],pfValArr=[],strVal="",hasEnum=!1,i=0;i<vals.length;i++){var p2=self2.parse(name,vals[i],propIsBypass,"multiple");hasEnum=hasEnum||string(p2.value),valArr.push(p2.value),pfValArr.push(p2.pfValue!=null?p2.pfValue:p2.value),unitsArr.push(p2.units),strVal+=(i>0?" ":"")+p2.strValue}return type.validate&&!type.validate(valArr,unitsArr)?null:type.singleEnum&&hasEnum?valArr.length===1&&string(valArr[0])?{name,value:valArr[0],strValue:valArr[0],bypass:propIsBypass}:null:{name,value:valArr,pfValue:pfValArr,strValue:strVal,bypass:propIsBypass,units:unitsArr}}var checkEnums=function(){for(var _i=0;_i<type.enums.length;_i++){var en=type.enums[_i];if(en===value)return{name,value,strValue:""+value,bypass:propIsBypass}}return null};if(type.number){var units,implicitUnits="px";if(type.units&&(units=type.units),type.implicitUnits&&(implicitUnits=type.implicitUnits),!type.unitless)if(valueIsString){var unitsRegex="px|em"+(type.allowPercent?"|\\%":"");units&&(unitsRegex=units);var match2=value.match("^("+number2+")("+unitsRegex+")?$");match2&&(value=match2[1],units=match2[2]||implicitUnits)}else(!units||type.implicitUnits)&&(units=implicitUnits);if(value=parseFloat(value),isNaN(value)&&type.enums===void 0)return null;if(isNaN(value)&&type.enums!==void 0)return value=passedValue,checkEnums();if(type.integer&&!integer(value)||type.min!==void 0&&(value<type.min||type.strictMin&&value===type.min)||type.max!==void 0&&(value>type.max||type.strictMax&&value===type.max))return null;var ret={name,value,strValue:""+value+(units||""),units,bypass:propIsBypass};return type.unitless||units!=="px"&&units!=="em"?ret.pfValue=value:ret.pfValue=units==="px"||!units?value:this.getEmSizeInPixels()*value,(units==="ms"||units==="s")&&(ret.pfValue=units==="ms"?value:1e3*value),(units==="deg"||units==="rad")&&(ret.pfValue=units==="rad"?value:deg2rad(value)),units==="%"&&(ret.pfValue=value/100),ret}else if(type.propList){var props=[],propsStr=""+value;if(propsStr!=="none"){for(var propsSplit=propsStr.split(/\s*,\s*|\s+/),_i2=0;_i2<propsSplit.length;_i2++){var propName=propsSplit[_i2].trim();self2.properties[propName]?props.push(propName):warn("`"+propName+"` is not a valid property name")}if(props.length===0)return null}return{name,value:props,strValue:props.length===0?"none":props.join(" "),bypass:propIsBypass}}else if(type.color){var tuple=color2tuple(value);return tuple?{name,value:tuple,pfValue:tuple,strValue:"rgb("+tuple[0]+","+tuple[1]+","+tuple[2]+")",bypass:propIsBypass}:null}else if(type.regex||type.regexes){if(type.enums){var enumProp=checkEnums();if(enumProp)return enumProp}for(var regexes=type.regexes?type.regexes:[type.regex],_i3=0;_i3<regexes.length;_i3++){var regex=new RegExp(regexes[_i3]),m=regex.exec(value);if(m)return{name,value:type.singleRegexMatchValue?m[1]:m,strValue:""+value,bypass:propIsBypass}}return null}else return type.string?{name,value:""+value,strValue:""+value,bypass:propIsBypass}:type.enums?checkEnums():null};var _Style=function(cy){if(!(this instanceof _Style))return new _Style(cy);if(!core(cy)){error("A style must have a core reference");return}this._private={cy,coreStyle:{}},this.length=0,this.resetToDefault()},styfn=_Style.prototype;styfn.instanceString=function(){return"style"};styfn.clear=function(){for(var _p=this._private,cy=_p.cy,eles=cy.elements(),i=0;i<this.length;i++)this[i]=void 0;return this.length=0,_p.contextStyles={},_p.propDiffs={},this.cleanElements(eles,!0),eles.forEach(function(ele){var ele_p=ele[0]._private;ele_p.styleDirty=!0,ele_p.appliedInitStyle=!1}),this};styfn.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};styfn.core=function(propName){return this._private.coreStyle[propName]||this.getDefaultProperty(propName)};styfn.selector=function(selectorStr){var selector=selectorStr==="core"?null:new Selector(selectorStr),i=this.length++;return this[i]={selector,properties:[],mappedProperties:[],index:i},this};styfn.css=function(){var self2=this,args=arguments;if(args.length===1)for(var map2=args[0],i=0;i<self2.properties.length;i++){var prop=self2.properties[i],mapVal=map2[prop.name];mapVal===void 0&&(mapVal=map2[dash2camel(prop.name)]),mapVal!==void 0&&this.cssRule(prop.name,mapVal)}else args.length===2&&this.cssRule(args[0],args[1]);return this};styfn.style=styfn.css;styfn.cssRule=function(name,value){var property=this.parse(name,value);if(property){var i=this.length-1;this[i].properties.push(property),this[i].properties[property.name]=property,property.name.match(/pie-(\d+)-background-size/)&&property.value&&(this._private.hasPie=!0),property.name.match(/stripe-(\d+)-background-size/)&&property.value&&(this._private.hasStripe=!0),property.mapped&&this[i].mappedProperties.push(property);var currentSelectorIsCore=!this[i].selector;currentSelectorIsCore&&(this._private.coreStyle[property.name]=property)}return this};styfn.append=function(style3){return stylesheet(style3)?style3.appendToStyle(this):array(style3)?this.appendFromJson(style3):string(style3)&&this.appendFromString(style3),this};_Style.fromJson=function(cy,json2){var style3=new _Style(cy);return style3.fromJson(json2),style3};_Style.fromString=function(cy,string3){return new _Style(cy).fromString(string3)};[styfn$8,styfn$7,styfn$6,styfn$5,styfn$4,styfn$3,styfn$2,styfn$1].forEach(function(props){extend(styfn,props)});_Style.types=styfn.types;_Style.properties=styfn.properties;_Style.propertyGroups=styfn.propertyGroups;_Style.propertyGroupNames=styfn.propertyGroupNames;_Style.propertyGroupKeys=styfn.propertyGroupKeys;var corefn$2={style:function(newStyle){if(newStyle){var s=this.setStyle(newStyle);s.update()}return this._private.style},setStyle:function(style3){var _p=this._private;return stylesheet(style3)?_p.style=style3.generateStyle(this):array(style3)?_p.style=_Style.fromJson(this,style3):string(style3)?_p.style=_Style.fromString(this,style3):_p.style=_Style(this),_p.style},updateStyle:function(){this.mutableElements().updateStyle()}},defaultSelectionType="single",corefn$1={autolock:function(bool){if(bool!==void 0)this._private.autolock=!!bool;else return this._private.autolock;return this},autoungrabify:function(bool){if(bool!==void 0)this._private.autoungrabify=!!bool;else return this._private.autoungrabify;return this},autounselectify:function(bool){if(bool!==void 0)this._private.autounselectify=!!bool;else return this._private.autounselectify;return this},selectionType:function(selType){var _p=this._private;if(_p.selectionType==null&&(_p.selectionType=defaultSelectionType),selType!==void 0)(selType==="additive"||selType==="single")&&(_p.selectionType=selType);else return _p.selectionType;return this},panningEnabled:function(bool){if(bool!==void 0)this._private.panningEnabled=!!bool;else return this._private.panningEnabled;return this},userPanningEnabled:function(bool){if(bool!==void 0)this._private.userPanningEnabled=!!bool;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(bool){if(bool!==void 0)this._private.zoomingEnabled=!!bool;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(bool){if(bool!==void 0)this._private.userZoomingEnabled=!!bool;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(bool){if(bool!==void 0)this._private.boxSelectionEnabled=!!bool;else return this._private.boxSelectionEnabled;return this},pan:function(){var args=arguments,pan2=this._private.pan,dim,val,dims,x2,y2;switch(args.length){case 0:return pan2;case 1:if(string(args[0]))return dim=args[0],pan2[dim];if(plainObject(args[0])){if(!this._private.panningEnabled)return this;dims=args[0],x2=dims.x,y2=dims.y,number$1(x2)&&(pan2.x=x2),number$1(y2)&&(pan2.y=y2),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;dim=args[0],val=args[1],(dim==="x"||dim==="y")&&number$1(val)&&(pan2[dim]=val),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(arg0,arg1){var args=arguments,pan2=this._private.pan,dim,val,dims,x2,y2;if(!this._private.panningEnabled)return this;switch(args.length){case 1:plainObject(arg0)&&(dims=args[0],x2=dims.x,y2=dims.y,number$1(x2)&&(pan2.x+=x2),number$1(y2)&&(pan2.y+=y2),this.emit("pan viewport"));break;case 2:dim=arg0,val=arg1,(dim==="x"||dim==="y")&&number$1(val)&&(pan2[dim]+=val),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(elements,padding){var viewportState=this.getFitViewport(elements,padding);if(viewportState){var _p=this._private;_p.zoom=viewportState.zoom,_p.pan=viewportState.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(elements,padding){if(number$1(elements)&&padding===void 0&&(padding=elements,elements=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var bb;if(string(elements)){var sel=elements;elements=this.$(sel)}else if(boundingBox(elements)){var bbe=elements;bb={x1:bbe.x1,y1:bbe.y1,x2:bbe.x2,y2:bbe.y2},bb.w=bb.x2-bb.x1,bb.h=bb.y2-bb.y1}else elementOrCollection(elements)||(elements=this.mutableElements());if(!(elementOrCollection(elements)&&elements.empty())){bb=bb||elements.boundingBox();var w=this.width(),h=this.height(),zoom2;if(padding=number$1(padding)?padding:0,!isNaN(w)&&!isNaN(h)&&w>0&&h>0&&!isNaN(bb.w)&&!isNaN(bb.h)&&bb.w>0&&bb.h>0){zoom2=Math.min((w-2*padding)/bb.w,(h-2*padding)/bb.h),zoom2=zoom2>this._private.maxZoom?this._private.maxZoom:zoom2,zoom2=zoom2<this._private.minZoom?this._private.minZoom:zoom2;var pan2={x:(w-zoom2*(bb.x1+bb.x2))/2,y:(h-zoom2*(bb.y1+bb.y2))/2};return{zoom:zoom2,pan:pan2}}}}},zoomRange:function(min4,max5){var _p=this._private;if(max5==null){var opts=min4;min4=opts.min,max5=opts.max}return number$1(min4)&&number$1(max5)&&min4<=max5?(_p.minZoom=min4,_p.maxZoom=max5):number$1(min4)&&max5===void 0&&min4<=_p.maxZoom?_p.minZoom=min4:number$1(max5)&&min4===void 0&&max5>=_p.minZoom&&(_p.maxZoom=max5),this},minZoom:function(zoom2){return zoom2===void 0?this._private.minZoom:this.zoomRange({min:zoom2})},maxZoom:function(zoom2){return zoom2===void 0?this._private.maxZoom:this.zoomRange({max:zoom2})},getZoomedViewport:function(params){var _p=this._private,currentPan=_p.pan,currentZoom=_p.zoom,pos,zoom2,bail=!1;if(_p.zoomingEnabled||(bail=!0),number$1(params)?zoom2=params:plainObject(params)&&(zoom2=params.level,params.position!=null?pos=modelToRenderedPosition$1(params.position,currentZoom,currentPan):params.renderedPosition!=null&&(pos=params.renderedPosition),pos!=null&&!_p.panningEnabled&&(bail=!0)),zoom2=zoom2>_p.maxZoom?_p.maxZoom:zoom2,zoom2=zoom2<_p.minZoom?_p.minZoom:zoom2,bail||!number$1(zoom2)||zoom2===currentZoom||pos!=null&&(!number$1(pos.x)||!number$1(pos.y)))return null;if(pos!=null){var pan1=currentPan,zoom1=currentZoom,zoom22=zoom2,pan2={x:-zoom22/zoom1*(pos.x-pan1.x)+pos.x,y:-zoom22/zoom1*(pos.y-pan1.y)+pos.y};return{zoomed:!0,panned:!0,zoom:zoom22,pan:pan2}}else return{zoomed:!0,panned:!1,zoom:zoom2,pan:currentPan}},zoom:function(params){if(params===void 0)return this._private.zoom;var vp=this.getZoomedViewport(params),_p=this._private;return vp==null||!vp.zoomed?this:(_p.zoom=vp.zoom,vp.panned&&(_p.pan.x=vp.pan.x,_p.pan.y=vp.pan.y),this.emit("zoom"+(vp.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(opts){var _p=this._private,zoomDefd=!0,panDefd=!0,events=[],zoomFailed=!1,panFailed=!1;if(!opts)return this;if(number$1(opts.zoom)||(zoomDefd=!1),plainObject(opts.pan)||(panDefd=!1),!zoomDefd&&!panDefd)return this;if(zoomDefd){var z=opts.zoom;z<_p.minZoom||z>_p.maxZoom||!_p.zoomingEnabled?zoomFailed=!0:(_p.zoom=z,events.push("zoom"))}if(panDefd&&(!zoomFailed||!opts.cancelOnFailedZoom)&&_p.panningEnabled){var p2=opts.pan;number$1(p2.x)&&(_p.pan.x=p2.x,panFailed=!1),number$1(p2.y)&&(_p.pan.y=p2.y,panFailed=!1),panFailed||events.push("pan")}return events.length>0&&(events.push("viewport"),this.emit(events.join(" ")),this.notify("viewport")),this},center:function(elements){var pan2=this.getCenterPan(elements);return pan2&&(this._private.pan=pan2,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(elements,zoom2){if(this._private.panningEnabled){if(string(elements)){var selector=elements;elements=this.mutableElements().filter(selector)}else elementOrCollection(elements)||(elements=this.mutableElements());if(elements.length!==0){var bb=elements.boundingBox(),w=this.width(),h=this.height();zoom2=zoom2===void 0?this._private.zoom:zoom2;var pan2={x:(w-zoom2*(bb.x1+bb.x2))/2,y:(h-zoom2*(bb.y1+bb.y2))/2};return pan2}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var _p=this._private,container2=_p.container,cy=this;return _p.sizeCache=_p.sizeCache||(container2?(function(){var style3=cy.window().getComputedStyle(container2),val=function(name){return parseFloat(style3.getPropertyValue(name))};return{width:container2.clientWidth-val("padding-left")-val("padding-right"),height:container2.clientHeight-val("padding-top")-val("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var pan2=this._private.pan,zoom2=this._private.zoom,rb=this.renderedExtent(),b={x1:(rb.x1-pan2.x)/zoom2,x2:(rb.x2-pan2.x)/zoom2,y1:(rb.y1-pan2.y)/zoom2,y2:(rb.y2-pan2.y)/zoom2};return b.w=b.x2-b.x1,b.h=b.y2-b.y1,b},renderedExtent:function(){var width2=this.width(),height2=this.height();return{x1:0,y1:0,x2:width2,y2:height2,w:width2,h:height2}},multiClickDebounceTime:function(_int){if(_int)this._private.multiClickDebounceTime=_int;else return this._private.multiClickDebounceTime;return this}};corefn$1.centre=corefn$1.center;corefn$1.autolockNodes=corefn$1.autolock;corefn$1.autoungrabifyNodes=corefn$1.autoungrabify;var fn2={data:define.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:define.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:define.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:define.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};fn2.attr=fn2.data;fn2.removeAttr=fn2.removeData;var Core=function(opts){var cy=this;opts=extend({},opts);var container2=opts.container;container2&&!htmlElement(container2)&&htmlElement(container2[0])&&(container2=container2[0]);var reg=container2?container2._cyreg:null;reg=reg||{},reg&®.cy&&(reg.cy.destroy(),reg={});var readies=reg.readies=reg.readies||[];container2&&(container2._cyreg=reg),reg.cy=cy;var head=_window!==void 0&&container2!==void 0&&!opts.headless,options2=opts;options2.layout=extend({name:head?"grid":"null"},options2.layout),options2.renderer=extend({name:head?"canvas":"null"},options2.renderer);var defVal=function(def,val,altVal){return val!==void 0?val:altVal!==void 0?altVal:def},_p=this._private={container:container2,ready:!1,options:options2,elements:new Collection(this),listeners:[],aniEles:new Collection(this),data:options2.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:defVal(!0,options2.zoomingEnabled),userZoomingEnabled:defVal(!0,options2.userZoomingEnabled),panningEnabled:defVal(!0,options2.panningEnabled),userPanningEnabled:defVal(!0,options2.userPanningEnabled),boxSelectionEnabled:defVal(!0,options2.boxSelectionEnabled),autolock:defVal(!1,options2.autolock,options2.autolockNodes),autoungrabify:defVal(!1,options2.autoungrabify,options2.autoungrabifyNodes),autounselectify:defVal(!1,options2.autounselectify),styleEnabled:options2.styleEnabled===void 0?head:options2.styleEnabled,zoom:number$1(options2.zoom)?options2.zoom:1,pan:{x:plainObject(options2.pan)&&number$1(options2.pan.x)?options2.pan.x:0,y:plainObject(options2.pan)&&number$1(options2.pan.y)?options2.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:defVal(250,options2.multiClickDebounceTime)};this.createEmitter(),this.selectionType(options2.selectionType),this.zoomRange({min:options2.minZoom,max:options2.maxZoom});var loadExtData=function(extData,next){var anyIsPromise=extData.some(promise);if(anyIsPromise)return Promise$1.all(extData).then(next);next(extData)};_p.styleEnabled&&cy.setStyle([]);var rendererOptions=extend({},options2,options2.renderer);cy.initRenderer(rendererOptions);var setElesAndLayout=function(elements,onload,ondone){cy.notifications(!1);var oldEles=cy.mutableElements();oldEles.length>0&&oldEles.remove(),elements!=null&&(plainObject(elements)||array(elements))&&cy.add(elements),cy.one("layoutready",function(e){cy.notifications(!0),cy.emit(e),cy.one("load",onload),cy.emitAndNotify("load")}).one("layoutstop",function(){cy.one("done",ondone),cy.emit("done")});var layoutOpts=extend({},cy._private.options.layout);layoutOpts.eles=cy.elements(),cy.layout(layoutOpts).run()};loadExtData([options2.style,options2.elements],function(thens){var initStyle=thens[0],initEles=thens[1];_p.styleEnabled&&cy.style().append(initStyle),setElesAndLayout(initEles,function(){cy.startAnimationLoop(),_p.ready=!0,fn$6(options2.ready)&&cy.on("ready",options2.ready);for(var i=0;i<readies.length;i++){var fn3=readies[i];cy.on("ready",fn3)}reg&&(reg.readies=[]),cy.emit("ready")},options2.done)})},corefn=Core.prototype;extend(corefn,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(fn3){return this.isReady()?this.emitter().emit("ready",[],fn3):this.on("ready",fn3),this},destroy:function(){var cy=this;if(!cy.destroyed())return cy.stopAnimationLoop(),cy.destroyRenderer(),this.emit("destroy"),cy._private.destroyed=!0,cy},hasElementWithId:function(id2){return this._private.elements.hasElementWithId(id2)},getElementById:function(id2){return this._private.elements.getElementById(id2)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(eles){return this._private.elements.merge(eles),this},removeFromPool:function(eles){return this._private.elements.unmerge(eles),this},container:function(){return this._private.container||null},window:function(){var container2=this._private.container;if(container2==null)return _window;var ownerDocument=this._private.container.ownerDocument;return ownerDocument===void 0||ownerDocument==null?_window:ownerDocument.defaultView||_window},mount:function(container2){if(container2!=null){var cy=this,_p=cy._private,options2=_p.options;return!htmlElement(container2)&&htmlElement(container2[0])&&(container2=container2[0]),cy.stopAnimationLoop(),cy.destroyRenderer(),_p.container=container2,_p.styleEnabled=!0,cy.invalidateSize(),cy.initRenderer(extend({},options2,options2.renderer,{name:options2.renderer.name==="null"?"canvas":options2.renderer.name})),cy.startAnimationLoop(),cy.style(options2.style),cy.emit("mount"),cy}},unmount:function(){var cy=this;return cy.stopAnimationLoop(),cy.destroyRenderer(),cy.initRenderer({name:"null"}),cy.emit("unmount"),cy},options:function(){return copy(this._private.options)},json:function(obj){var cy=this,_p=cy._private,eles=cy.mutableElements(),getFreshRef=function(ele){return cy.getElementById(ele.id())};if(plainObject(obj)){if(cy.startBatch(),obj.elements){var idInJson={},updateEles=function(jsons,gr2){for(var toAdd=[],toMod=[],i2=0;i2<jsons.length;i2++){var json3=jsons[i2];if(!json3.data.id){warn("cy.json() cannot handle elements without an ID attribute");continue}var id2=""+json3.data.id,ele=cy.getElementById(id2);idInJson[id2]=!0,ele.length!==0?toMod.push({ele,json:json3}):(gr2&&(json3.group=gr2),toAdd.push(json3))}cy.add(toAdd);for(var _i=0;_i<toMod.length;_i++){var _toMod$_i=toMod[_i],_ele=_toMod$_i.ele,_json=_toMod$_i.json;_ele.json(_json)}};if(array(obj.elements))updateEles(obj.elements);else for(var grs=["nodes","edges"],i=0;i<grs.length;i++){var gr=grs[i],elements=obj.elements[gr];array(elements)&&updateEles(elements,gr)}var parentsToRemove=cy.collection();eles.filter(function(ele){return!idInJson[ele.id()]}).forEach(function(ele){ele.isParent()?parentsToRemove.merge(ele):ele.remove()}),parentsToRemove.forEach(function(ele){return ele.children().move({parent:null})}),parentsToRemove.forEach(function(ele){return getFreshRef(ele).remove()})}obj.style&&cy.style(obj.style),obj.zoom!=null&&obj.zoom!==_p.zoom&&cy.zoom(obj.zoom),obj.pan&&(obj.pan.x!==_p.pan.x||obj.pan.y!==_p.pan.y)&&cy.pan(obj.pan),obj.data&&cy.data(obj.data);for(var fields=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],_i2=0;_i2<fields.length;_i2++){var f=fields[_i2];obj[f]!=null&&cy[f](obj[f])}return cy.endBatch(),this}else{var flat=!!obj,json2={};flat?json2.elements=this.elements().map(function(ele){return ele.json()}):(json2.elements={},eles.forEach(function(ele){var group2=ele.group();json2.elements[group2]||(json2.elements[group2]=[]),json2.elements[group2].push(ele.json())})),this._private.styleEnabled&&(json2.style=cy.style().json()),json2.data=copy(cy.data());var options2=_p.options;return json2.zoomingEnabled=_p.zoomingEnabled,json2.userZoomingEnabled=_p.userZoomingEnabled,json2.zoom=_p.zoom,json2.minZoom=_p.minZoom,json2.maxZoom=_p.maxZoom,json2.panningEnabled=_p.panningEnabled,json2.userPanningEnabled=_p.userPanningEnabled,json2.pan=copy(_p.pan),json2.boxSelectionEnabled=_p.boxSelectionEnabled,json2.renderer=copy(options2.renderer),json2.hideEdgesOnViewport=options2.hideEdgesOnViewport,json2.textureOnViewport=options2.textureOnViewport,json2.wheelSensitivity=options2.wheelSensitivity,json2.motionBlur=options2.motionBlur,json2.multiClickDebounceTime=options2.multiClickDebounceTime,json2}}});corefn.$id=corefn.getElementById;[corefn$9,corefn$8,elesfn,corefn$7,corefn$6,corefn$5,corefn$4,corefn$3,corefn$2,corefn$1,fn2].forEach(function(props){extend(corefn,props)});var defaults$7={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(node,i){return!0},ready:void 0,stop:void 0,transform:function(node,position3){return position3}},deprecatedOptionDefaults={maximal:!1,acyclic:!1},getInfo=function(ele){return ele.scratch("breadthfirst")},setInfo=function(ele,obj){return ele.scratch("breadthfirst",obj)};function BreadthFirstLayout(options2){this.options=extend({},defaults$7,deprecatedOptionDefaults,options2)}BreadthFirstLayout.prototype.run=function(){var options2=this.options,cy=options2.cy,eles=options2.eles,nodes3=eles.nodes().filter(function(n2){return n2.isChildless()}),graph=eles,directed=options2.directed,maximal=options2.acyclic||options2.maximal||options2.maximalAdjustments>0,hasBoundingBox=!!options2.boundingBox,bb=makeBoundingBox(hasBoundingBox?options2.boundingBox:structuredClone(cy.extent())),roots;if(elementOrCollection(options2.roots))roots=options2.roots;else if(array(options2.roots)){for(var rootsArray=[],i=0;i<options2.roots.length;i++){var id2=options2.roots[i],ele=cy.getElementById(id2);rootsArray.push(ele)}roots=cy.collection(rootsArray)}else if(string(options2.roots))roots=cy.$(options2.roots);else if(directed)roots=nodes3.roots();else{var components2=eles.components();roots=cy.collection();for(var _loop=function(){var comp=components2[_i],maxDegree=comp.maxDegree(!1),compRoots=comp.filter(function(ele2){return ele2.degree(!1)===maxDegree});roots=roots.add(compRoots)},_i=0;_i<components2.length;_i++)_loop()}var depths=[],foundByBfs={},addToDepth=function(ele2,d){depths[d]==null&&(depths[d]=[]);var i2=depths[d].length;depths[d].push(ele2),setInfo(ele2,{index:i2,depth:d})},changeDepth=function(ele2,newDepth){var _getInfo=getInfo(ele2),depth=_getInfo.depth,index=_getInfo.index;depths[depth][index]=null,ele2.isChildless()&&addToDepth(ele2,newDepth)};graph.bfs({roots,directed:options2.directed,visit:function(node,edge,pNode,i2,depth){var ele2=node[0],id3=ele2.id();ele2.isChildless()&&addToDepth(ele2,depth),foundByBfs[id3]=!0}});for(var orphanNodes=[],_i2=0;_i2<nodes3.length;_i2++){var _ele=nodes3[_i2];foundByBfs[_ele.id()]||orphanNodes.push(_ele)}var assignDepthsAt=function(i2){for(var eles2=depths[i2],j=0;j<eles2.length;j++){var _ele2=eles2[j];if(_ele2==null){eles2.splice(j,1),j--;continue}setInfo(_ele2,{depth:i2,index:j})}},adjustMaximally=function(ele2,shifted2){for(var eInfo=getInfo(ele2),incomers=ele2.incomers().filter(function(el){return el.isNode()&&eles.has(el)}),maxDepth=-1,id3=ele2.id(),k=0;k<incomers.length;k++){var incmr=incomers[k],iInfo=getInfo(incmr);maxDepth=Math.max(maxDepth,iInfo.depth)}if(eInfo.depth<=maxDepth){if(!options2.acyclic&&shifted2[id3])return null;var newDepth=maxDepth+1;return changeDepth(ele2,newDepth),shifted2[id3]=newDepth,!0}return!1};if(directed&&maximal){var Q=[],shifted={},enqueue=function(n2){return Q.push(n2)},dequeue=function(){return Q.shift()};for(nodes3.forEach(function(n2){return Q.push(n2)});Q.length>0;){var _ele3=dequeue(),didShift=adjustMaximally(_ele3,shifted);if(didShift)_ele3.outgoers().filter(function(el){return el.isNode()&&eles.has(el)}).forEach(enqueue);else if(didShift===null){warn("Detected double maximal shift for node `"+_ele3.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var minDistance=0;if(options2.avoidOverlap)for(var _i3=0;_i3<nodes3.length;_i3++){var n=nodes3[_i3],nbb=n.layoutDimensions(options2),w=nbb.w,h=nbb.h;minDistance=Math.max(minDistance,w,h)}var cachedWeightedPercent={},getWeightedPercent=function(ele2){if(cachedWeightedPercent[ele2.id()])return cachedWeightedPercent[ele2.id()];for(var eleDepth=getInfo(ele2).depth,neighbors=ele2.neighborhood(),percent=0,samples=0,_i4=0;_i4<neighbors.length;_i4++){var neighbor=neighbors[_i4];if(!(neighbor.isEdge()||neighbor.isParent()||!nodes3.has(neighbor))){var bf=getInfo(neighbor);if(bf!=null){var index=bf.index,depth=bf.depth;if(!(index==null||depth==null)){var nDepth=depths[depth].length;depth<eleDepth&&(percent+=index/nDepth,samples++)}}}}return samples=Math.max(1,samples),percent=percent/samples,samples===0&&(percent=0),cachedWeightedPercent[ele2.id()]=percent,percent},sortFn=function(a,b){var apct=getWeightedPercent(a),bpct=getWeightedPercent(b),diff2=apct-bpct;return diff2===0?ascending(a.id(),b.id()):diff2};options2.depthSort!==void 0&&(sortFn=options2.depthSort);for(var depthsLen=depths.length,_i5=0;_i5<depthsLen;_i5++)depths[_i5].sort(sortFn),assignDepthsAt(_i5);for(var orphanDepth=[],_i6=0;_i6<orphanNodes.length;_i6++)orphanDepth.push(orphanNodes[_i6]);var assignDepths=function(){for(var _i7=0;_i7<depthsLen;_i7++)assignDepthsAt(_i7)};orphanDepth.length&&(depths.unshift(orphanDepth),depthsLen=depths.length,assignDepths());for(var biggestDepthSize=0,_i8=0;_i8<depthsLen;_i8++)biggestDepthSize=Math.max(depths[_i8].length,biggestDepthSize);var center2={x:bb.x1+bb.w/2,y:bb.y1+bb.h/2},aveNodeSize=nodes3.reduce(function(acc,node){return(function(box){return{w:acc.w===-1?box.w:(acc.w+box.w)/2,h:acc.h===-1?box.h:(acc.h+box.h)/2}})(node.boundingBox({includeLabels:options2.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),distanceY=Math.max(depthsLen===1?0:hasBoundingBox?(bb.h-options2.padding*2-aveNodeSize.h)/(depthsLen-1):(bb.h-options2.padding*2-aveNodeSize.h)/(depthsLen+1),minDistance),maxDepthSize=depths.reduce(function(max5,eles2){return Math.max(max5,eles2.length)},0),getPositionTopBottom=function(ele2){var _getInfo2=getInfo(ele2),depth=_getInfo2.depth,index=_getInfo2.index;if(options2.circle){var radiusStepSize=Math.min(bb.w/2/depthsLen,bb.h/2/depthsLen);radiusStepSize=Math.max(radiusStepSize,minDistance);var radius2=radiusStepSize*depth+radiusStepSize-(depthsLen>0&&depths[0].length<=3?radiusStepSize/2:0),theta=2*Math.PI/depths[depth].length*index;return depth===0&&depths[0].length===1&&(radius2=1),{x:center2.x+radius2*Math.cos(theta),y:center2.y+radius2*Math.sin(theta)}}else{var depthSize=depths[depth].length,distanceX=Math.max(depthSize===1?0:hasBoundingBox?(bb.w-options2.padding*2-aveNodeSize.w)/((options2.grid?maxDepthSize:depthSize)-1):(bb.w-options2.padding*2-aveNodeSize.w)/((options2.grid?maxDepthSize:depthSize)+1),minDistance),epos={x:center2.x+(index+1-(depthSize+1)/2)*distanceX,y:center2.y+(depth+1-(depthsLen+1)/2)*distanceY};return epos}},rotateDegrees={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(rotateDegrees).indexOf(options2.direction)===-1&&error("Invalid direction '".concat(options2.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(rotateDegrees).join(", ")));var getPosition=function(ele2){return rotatePosAndSkewByBox(getPositionTopBottom(ele2),bb,rotateDegrees[options2.direction])};return eles.nodes().layoutPositions(this,options2,getPosition),this};var defaults$6={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(node,i){return!0},ready:void 0,stop:void 0,transform:function(node,position3){return position3}};function CircleLayout(options2){this.options=extend({},defaults$6,options2)}CircleLayout.prototype.run=function(){var params=this.options,options2=params,cy=params.cy,eles=options2.eles,clockwise=options2.counterclockwise!==void 0?!options2.counterclockwise:options2.clockwise,nodes3=eles.nodes().not(":parent");options2.sort&&(nodes3=nodes3.sort(options2.sort));for(var bb=makeBoundingBox(options2.boundingBox?options2.boundingBox:{x1:0,y1:0,w:cy.width(),h:cy.height()}),center2={x:bb.x1+bb.w/2,y:bb.y1+bb.h/2},sweep=options2.sweep===void 0?2*Math.PI-2*Math.PI/nodes3.length:options2.sweep,dTheta=sweep/Math.max(1,nodes3.length-1),r,minDistance=0,i=0;i<nodes3.length;i++){var n=nodes3[i],nbb=n.layoutDimensions(options2),w=nbb.w,h=nbb.h;minDistance=Math.max(minDistance,w,h)}if(number$1(options2.radius)?r=options2.radius:nodes3.length<=1?r=0:r=Math.min(bb.h,bb.w)/2-minDistance,nodes3.length>1&&options2.avoidOverlap){minDistance*=1.75;var dcos=Math.cos(dTheta)-Math.cos(0),dsin=Math.sin(dTheta)-Math.sin(0),rMin=Math.sqrt(minDistance*minDistance/(dcos*dcos+dsin*dsin));r=Math.max(rMin,r)}var getPos=function(ele,i2){var theta=options2.startAngle+i2*dTheta*(clockwise?1:-1),rx=r*Math.cos(theta),ry=r*Math.sin(theta),pos={x:center2.x+rx,y:center2.y+ry};return pos};return eles.nodes().layoutPositions(this,options2,getPos),this};var defaults$5={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(node){return node.degree()},levelWidth:function(nodes3){return nodes3.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(node,i){return!0},ready:void 0,stop:void 0,transform:function(node,position3){return position3}};function ConcentricLayout(options2){this.options=extend({},defaults$5,options2)}ConcentricLayout.prototype.run=function(){for(var params=this.options,options2=params,clockwise=options2.counterclockwise!==void 0?!options2.counterclockwise:options2.clockwise,cy=params.cy,eles=options2.eles,nodes3=eles.nodes().not(":parent"),bb=makeBoundingBox(options2.boundingBox?options2.boundingBox:{x1:0,y1:0,w:cy.width(),h:cy.height()}),center2={x:bb.x1+bb.w/2,y:bb.y1+bb.h/2},nodeValues=[],maxNodeSize=0,i=0;i<nodes3.length;i++){var node=nodes3[i],value=void 0;value=options2.concentric(node),nodeValues.push({value,node}),node._private.scratch.concentric=value}nodes3.updateStyle();for(var _i=0;_i<nodes3.length;_i++){var _node=nodes3[_i],nbb=_node.layoutDimensions(options2);maxNodeSize=Math.max(maxNodeSize,nbb.w,nbb.h)}nodeValues.sort(function(a,b){return b.value-a.value});for(var levelWidth2=options2.levelWidth(nodes3),levels=[[]],currentLevel=levels[0],_i2=0;_i2<nodeValues.length;_i2++){var val=nodeValues[_i2];if(currentLevel.length>0){var diff2=Math.abs(currentLevel[0].value-val.value);diff2>=levelWidth2&&(currentLevel=[],levels.push(currentLevel))}currentLevel.push(val)}var minDist=maxNodeSize+options2.minNodeSpacing;if(!options2.avoidOverlap){var firstLvlHasMulti=levels.length>0&&levels[0].length>1,maxR=Math.min(bb.w,bb.h)/2-minDist,rStep=maxR/(levels.length+firstLvlHasMulti?1:0);minDist=Math.min(minDist,rStep)}for(var r=0,_i3=0;_i3<levels.length;_i3++){var level=levels[_i3],sweep=options2.sweep===void 0?2*Math.PI-2*Math.PI/level.length:options2.sweep,dTheta=level.dTheta=sweep/Math.max(1,level.length-1);if(level.length>1&&options2.avoidOverlap){var dcos=Math.cos(dTheta)-Math.cos(0),dsin=Math.sin(dTheta)-Math.sin(0),rMin=Math.sqrt(minDist*minDist/(dcos*dcos+dsin*dsin));r=Math.max(rMin,r)}level.r=r,r+=minDist}if(options2.equidistant){for(var rDeltaMax=0,_r=0,_i4=0;_i4<levels.length;_i4++){var _level=levels[_i4],rDelta=_level.r-_r;rDeltaMax=Math.max(rDeltaMax,rDelta)}_r=0;for(var _i5=0;_i5<levels.length;_i5++){var _level2=levels[_i5];_i5===0&&(_r=_level2.r),_level2.r=_r,_r+=rDeltaMax}}for(var pos={},_i6=0;_i6<levels.length;_i6++)for(var _level3=levels[_i6],_dTheta=_level3.dTheta,_r2=_level3.r,j=0;j<_level3.length;j++){var _val=_level3[j],theta=options2.startAngle+(clockwise?1:-1)*_dTheta*j,p2={x:center2.x+_r2*Math.cos(theta),y:center2.y+_r2*Math.sin(theta)};pos[_val.node.id()]=p2}return eles.nodes().layoutPositions(this,options2,function(ele){var id2=ele.id();return pos[id2]}),this};var DEBUG,defaults$4={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(node,i){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(node){return 2048},nodeOverlap:4,idealEdgeLength:function(edge){return 32},edgeElasticity:function(edge){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function CoseLayout(options2){this.options=extend({},defaults$4,options2),this.options.layout=this;var nodes3=this.options.eles.nodes(),edges3=this.options.eles.edges(),notEdges=edges3.filter(function(e){var sourceId=e.source().data("id"),targetId=e.target().data("id"),hasSource=nodes3.some(function(n){return n.data("id")===sourceId}),hasTarget=nodes3.some(function(n){return n.data("id")===targetId});return!hasSource||!hasTarget});this.options.eles=this.options.eles.not(notEdges)}CoseLayout.prototype.run=function(){var options2=this.options,cy=options2.cy,layout4=this;layout4.stopped=!1,(options2.animate===!0||options2.animate===!1)&&layout4.emit({type:"layoutstart",layout:layout4}),options2.debug===!0?DEBUG=!0:DEBUG=!1;var layoutInfo=createLayoutInfo(cy,layout4,options2);DEBUG&&printLayoutInfo(layoutInfo),options2.randomize&&randomizePositions(layoutInfo);var startTime=performanceNow(),refresh=function(){refreshPositions(layoutInfo,cy,options2),options2.fit===!0&&cy.fit(options2.padding)},mainLoop=function(i2){return!(layout4.stopped||i2>=options2.numIter||(step(layoutInfo,options2),layoutInfo.temperature=layoutInfo.temperature*options2.coolingFactor,layoutInfo.temperature<options2.minTemp))},done=function(){if(options2.animate===!0||options2.animate===!1)refresh(),layout4.one("layoutstop",options2.stop),layout4.emit({type:"layoutstop",layout:layout4});else{var nodes3=options2.eles.nodes(),getScaledPos=getScaleInBoundsFn(layoutInfo,options2,nodes3);nodes3.layoutPositions(layout4,options2,getScaledPos)}},i=0,loopRet=!0;if(options2.animate===!0){var _frame=function(){for(var f=0;loopRet&&f<options2.refresh;)loopRet=mainLoop(i),i++,f++;if(!loopRet)separateComponents(layoutInfo,options2),done();else{var now=performanceNow();now-startTime>=options2.animationThreshold&&refresh(),requestAnimationFrame(_frame)}};_frame()}else{for(;loopRet;)loopRet=mainLoop(i),i++;separateComponents(layoutInfo,options2),done()}return this};CoseLayout.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};CoseLayout.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var createLayoutInfo=function(cy,layout4,options2){for(var edges3=options2.eles.edges(),nodes3=options2.eles.nodes(),bb=makeBoundingBox(options2.boundingBox?options2.boundingBox:{x1:0,y1:0,w:cy.width(),h:cy.height()}),layoutInfo={isCompound:cy.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:nodes3.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:edges3.size(),temperature:options2.initialTemp,clientWidth:bb.w,clientHeight:bb.h,boundingBox:bb},components2=options2.eles.components(),id2cmptId={},i=0;i<components2.length;i++)for(var component2=components2[i],j=0;j<component2.length;j++){var node=component2[j];id2cmptId[node.id()]=i}for(var i=0;i<layoutInfo.nodeSize;i++){var n=nodes3[i],nbb=n.layoutDimensions(options2),tempNode={};tempNode.isLocked=n.locked(),tempNode.id=n.data("id"),tempNode.parentId=n.data("parent"),tempNode.cmptId=id2cmptId[n.id()],tempNode.children=[],tempNode.positionX=n.position("x"),tempNode.positionY=n.position("y"),tempNode.offsetX=0,tempNode.offsetY=0,tempNode.height=nbb.w,tempNode.width=nbb.h,tempNode.maxX=tempNode.positionX+tempNode.width/2,tempNode.minX=tempNode.positionX-tempNode.width/2,tempNode.maxY=tempNode.positionY+tempNode.height/2,tempNode.minY=tempNode.positionY-tempNode.height/2,tempNode.padLeft=parseFloat(n.style("padding")),tempNode.padRight=parseFloat(n.style("padding")),tempNode.padTop=parseFloat(n.style("padding")),tempNode.padBottom=parseFloat(n.style("padding")),tempNode.nodeRepulsion=fn$6(options2.nodeRepulsion)?options2.nodeRepulsion(n):options2.nodeRepulsion,layoutInfo.layoutNodes.push(tempNode),layoutInfo.idToIndex[tempNode.id]=i}for(var queue=[],start=0,end=-1,tempGraph=[],i=0;i<layoutInfo.nodeSize;i++){var n=layoutInfo.layoutNodes[i],p_id=n.parentId;p_id!=null?layoutInfo.layoutNodes[layoutInfo.idToIndex[p_id]].children.push(n.id):(queue[++end]=n.id,tempGraph.push(n.id))}for(layoutInfo.graphSet.push(tempGraph);start<=end;){var node_id=queue[start++],node_ix=layoutInfo.idToIndex[node_id],node=layoutInfo.layoutNodes[node_ix],children=node.children;if(children.length>0){layoutInfo.graphSet.push(children);for(var i=0;i<children.length;i++)queue[++end]=children[i]}}for(var i=0;i<layoutInfo.graphSet.length;i++)for(var graph=layoutInfo.graphSet[i],j=0;j<graph.length;j++){var index=layoutInfo.idToIndex[graph[j]];layoutInfo.indexToGraph[index]=i}for(var i=0;i<layoutInfo.edgeSize;i++){var e=edges3[i],tempEdge={};tempEdge.id=e.data("id"),tempEdge.sourceId=e.data("source"),tempEdge.targetId=e.data("target");var idealLength=fn$6(options2.idealEdgeLength)?options2.idealEdgeLength(e):options2.idealEdgeLength,elasticity=fn$6(options2.edgeElasticity)?options2.edgeElasticity(e):options2.edgeElasticity,sourceIx=layoutInfo.idToIndex[tempEdge.sourceId],targetIx=layoutInfo.idToIndex[tempEdge.targetId],sourceGraph=layoutInfo.indexToGraph[sourceIx],targetGraph=layoutInfo.indexToGraph[targetIx];if(sourceGraph!=targetGraph){for(var lca=findLCA(tempEdge.sourceId,tempEdge.targetId,layoutInfo),lcaGraph=layoutInfo.graphSet[lca],depth=0,tempNode=layoutInfo.layoutNodes[sourceIx];lcaGraph.indexOf(tempNode.id)===-1;)tempNode=layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]],depth++;for(tempNode=layoutInfo.layoutNodes[targetIx];lcaGraph.indexOf(tempNode.id)===-1;)tempNode=layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]],depth++;idealLength*=depth*options2.nestingFactor}tempEdge.idealLength=idealLength,tempEdge.elasticity=elasticity,layoutInfo.layoutEdges.push(tempEdge)}return layoutInfo},findLCA=function(node1,node2,layoutInfo){var res=_findLCA_aux(node1,node2,0,layoutInfo);return 2>res.count?0:res.graph},_findLCA_aux=function(node1,node2,graphIx,layoutInfo){var graph=layoutInfo.graphSet[graphIx];if(-1<graph.indexOf(node1)&&-1<graph.indexOf(node2))return{count:2,graph:graphIx};for(var c=0,i=0;i<graph.length;i++){var nodeId=graph[i],nodeIx=layoutInfo.idToIndex[nodeId],children=layoutInfo.layoutNodes[nodeIx].children;if(children.length!==0){var childGraphIx=layoutInfo.indexToGraph[layoutInfo.idToIndex[children[0]]],result=_findLCA_aux(node1,node2,childGraphIx,layoutInfo);if(result.count!==0)if(result.count===1){if(c++,c===2)break}else return result}}return{count:c,graph:graphIx}},printLayoutInfo,randomizePositions=function(layoutInfo,cy){for(var width2=layoutInfo.clientWidth,height2=layoutInfo.clientHeight,i=0;i<layoutInfo.nodeSize;i++){var n=layoutInfo.layoutNodes[i];n.children.length===0&&!n.isLocked&&(n.positionX=Math.random()*width2,n.positionY=Math.random()*height2)}},getScaleInBoundsFn=function(layoutInfo,options2,nodes3){var bb=layoutInfo.boundingBox,coseBB={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return options2.boundingBox&&(nodes3.forEach(function(node){var lnode=layoutInfo.layoutNodes[layoutInfo.idToIndex[node.data("id")]];coseBB.x1=Math.min(coseBB.x1,lnode.positionX),coseBB.x2=Math.max(coseBB.x2,lnode.positionX),coseBB.y1=Math.min(coseBB.y1,lnode.positionY),coseBB.y2=Math.max(coseBB.y2,lnode.positionY)}),coseBB.w=coseBB.x2-coseBB.x1,coseBB.h=coseBB.y2-coseBB.y1),function(ele,i){var lnode=layoutInfo.layoutNodes[layoutInfo.idToIndex[ele.data("id")]];if(options2.boundingBox){var pctX=coseBB.w===0?.5:(lnode.positionX-coseBB.x1)/coseBB.w,pctY=coseBB.h===0?.5:(lnode.positionY-coseBB.y1)/coseBB.h;return{x:bb.x1+pctX*bb.w,y:bb.y1+pctY*bb.h}}else return{x:lnode.positionX,y:lnode.positionY}}},refreshPositions=function(layoutInfo,cy,options2){var layout4=options2.layout,nodes3=options2.eles.nodes(),getScaledPos=getScaleInBoundsFn(layoutInfo,options2,nodes3);nodes3.positions(getScaledPos),layoutInfo.ready!==!0&&(layoutInfo.ready=!0,layout4.one("layoutready",options2.ready),layout4.emit({type:"layoutready",layout:this}))},step=function(layoutInfo,options2,_step){calculateNodeForces(layoutInfo,options2),calculateEdgeForces(layoutInfo),calculateGravityForces(layoutInfo,options2),propagateForces(layoutInfo),updatePositions(layoutInfo)},calculateNodeForces=function(layoutInfo,options2){for(var i=0;i<layoutInfo.graphSet.length;i++)for(var graph=layoutInfo.graphSet[i],numNodes=graph.length,j=0;j<numNodes;j++)for(var node1=layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j]]],k=j+1;k<numNodes;k++){var node2=layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[k]]];nodeRepulsion2(node1,node2,layoutInfo,options2)}},randomDistance=function(max5){return-1+2*max5*Math.random()},nodeRepulsion2=function(node1,node2,layoutInfo,options2){var cmptId1=node1.cmptId,cmptId2=node2.cmptId;if(!(cmptId1!==cmptId2&&!layoutInfo.isCompound)){var directionX=node2.positionX-node1.positionX,directionY=node2.positionY-node1.positionY,maxRandDist=1;directionX===0&&directionY===0&&(directionX=randomDistance(maxRandDist),directionY=randomDistance(maxRandDist));var overlap=nodesOverlap(node1,node2,directionX,directionY);if(overlap>0)var force=options2.nodeOverlap*overlap,distance=Math.sqrt(directionX*directionX+directionY*directionY),forceX=force*directionX/distance,forceY=force*directionY/distance;else var point1=findClippingPoint(node1,directionX,directionY),point2=findClippingPoint(node2,-1*directionX,-1*directionY),distanceX=point2.x-point1.x,distanceY=point2.y-point1.y,distanceSqr=distanceX*distanceX+distanceY*distanceY,distance=Math.sqrt(distanceSqr),force=(node1.nodeRepulsion+node2.nodeRepulsion)/distanceSqr,forceX=force*distanceX/distance,forceY=force*distanceY/distance;node1.isLocked||(node1.offsetX-=forceX,node1.offsetY-=forceY),node2.isLocked||(node2.offsetX+=forceX,node2.offsetY+=forceY)}},nodesOverlap=function(node1,node2,dX,dY){if(dX>0)var overlapX=node1.maxX-node2.minX;else var overlapX=node2.maxX-node1.minX;if(dY>0)var overlapY=node1.maxY-node2.minY;else var overlapY=node2.maxY-node1.minY;return overlapX>=0&&overlapY>=0?Math.sqrt(overlapX*overlapX+overlapY*overlapY):0},findClippingPoint=function(node,dX,dY){var X=node.positionX,Y=node.positionY,H=node.height||1,W=node.width||1,dirSlope=dY/dX,nodeSlope=H/W,res={};return dX===0&&0<dY||dX===0&&0>dY?(res.x=X,res.y=Y+H/2,res):0<dX&&-1*nodeSlope<=dirSlope&&dirSlope<=nodeSlope?(res.x=X+W/2,res.y=Y+W*dY/2/dX,res):0>dX&&-1*nodeSlope<=dirSlope&&dirSlope<=nodeSlope?(res.x=X-W/2,res.y=Y-W*dY/2/dX,res):0<dY&&(dirSlope<=-1*nodeSlope||dirSlope>=nodeSlope)?(res.x=X+H*dX/2/dY,res.y=Y+H/2,res):(0>dY&&(dirSlope<=-1*nodeSlope||dirSlope>=nodeSlope)&&(res.x=X-H*dX/2/dY,res.y=Y-H/2),res)},calculateEdgeForces=function(layoutInfo,options2){for(var i=0;i<layoutInfo.edgeSize;i++){var edge=layoutInfo.layoutEdges[i],sourceIx=layoutInfo.idToIndex[edge.sourceId],source=layoutInfo.layoutNodes[sourceIx],targetIx=layoutInfo.idToIndex[edge.targetId],target=layoutInfo.layoutNodes[targetIx],directionX=target.positionX-source.positionX,directionY=target.positionY-source.positionY;if(!(directionX===0&&directionY===0)){var point1=findClippingPoint(source,directionX,directionY),point2=findClippingPoint(target,-1*directionX,-1*directionY),lx=point2.x-point1.x,ly=point2.y-point1.y,l=Math.sqrt(lx*lx+ly*ly),force=Math.pow(edge.idealLength-l,2)/edge.elasticity;if(l!==0)var forceX=force*lx/l,forceY=force*ly/l;else var forceX=0,forceY=0;source.isLocked||(source.offsetX+=forceX,source.offsetY+=forceY),target.isLocked||(target.offsetX-=forceX,target.offsetY-=forceY)}}},calculateGravityForces=function(layoutInfo,options2){if(options2.gravity!==0)for(var distThreshold=1,i=0;i<layoutInfo.graphSet.length;i++){var graph=layoutInfo.graphSet[i],numNodes=graph.length;if(i===0)var centerX=layoutInfo.clientHeight/2,centerY=layoutInfo.clientWidth/2;else var temp=layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[0]]],parent4=layoutInfo.layoutNodes[layoutInfo.idToIndex[temp.parentId]],centerX=parent4.positionX,centerY=parent4.positionY;for(var j=0;j<numNodes;j++){var node=layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j]]];if(!node.isLocked){var dx=centerX-node.positionX,dy=centerY-node.positionY,d=Math.sqrt(dx*dx+dy*dy);if(d>distThreshold){var fx=options2.gravity*dx/d,fy=options2.gravity*dy/d;node.offsetX+=fx,node.offsetY+=fy}}}}},propagateForces=function(layoutInfo,options2){var queue=[],start=0,end=-1;for(queue.push.apply(queue,layoutInfo.graphSet[0]),end+=layoutInfo.graphSet[0].length;start<=end;){var nodeId=queue[start++],nodeIndex=layoutInfo.idToIndex[nodeId],node=layoutInfo.layoutNodes[nodeIndex],children=node.children;if(0<children.length&&!node.isLocked){for(var offX=node.offsetX,offY=node.offsetY,i=0;i<children.length;i++){var childNode=layoutInfo.layoutNodes[layoutInfo.idToIndex[children[i]]];childNode.offsetX+=offX,childNode.offsetY+=offY,queue[++end]=children[i]}node.offsetX=0,node.offsetY=0}}},updatePositions=function(layoutInfo,options2){for(var i=0;i<layoutInfo.nodeSize;i++){var n=layoutInfo.layoutNodes[i];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var i=0;i<layoutInfo.nodeSize;i++){var n=layoutInfo.layoutNodes[i];if(!(0<n.children.length||n.isLocked)){var tempForce=limitForce(n.offsetX,n.offsetY,layoutInfo.temperature);n.positionX+=tempForce.x,n.positionY+=tempForce.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,_updateAncestryBoundaries(n,layoutInfo)}}for(var i=0;i<layoutInfo.nodeSize;i++){var n=layoutInfo.layoutNodes[i];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},limitForce=function(forceX,forceY,max5){var force=Math.sqrt(forceX*forceX+forceY*forceY);if(force>max5)var res={x:max5*forceX/force,y:max5*forceY/force};else var res={x:forceX,y:forceY};return res},_updateAncestryBoundaries=function(node,layoutInfo){var parentId=node.parentId;if(parentId!=null){var p2=layoutInfo.layoutNodes[layoutInfo.idToIndex[parentId]],flag=!1;if((p2.maxX==null||node.maxX+p2.padRight>p2.maxX)&&(p2.maxX=node.maxX+p2.padRight,flag=!0),(p2.minX==null||node.minX-p2.padLeft<p2.minX)&&(p2.minX=node.minX-p2.padLeft,flag=!0),(p2.maxY==null||node.maxY+p2.padBottom>p2.maxY)&&(p2.maxY=node.maxY+p2.padBottom,flag=!0),(p2.minY==null||node.minY-p2.padTop<p2.minY)&&(p2.minY=node.minY-p2.padTop,flag=!0),flag)return _updateAncestryBoundaries(p2,layoutInfo)}},separateComponents=function(layoutInfo,options2){for(var nodes3=layoutInfo.layoutNodes,components2=[],i=0;i<nodes3.length;i++){var node=nodes3[i],cid=node.cmptId,component2=components2[cid]=components2[cid]||[];component2.push(node)}for(var totalA=0,i=0;i<components2.length;i++){var c=components2[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var j=0;j<c.length;j++){var n=c[j];c.x1=Math.min(c.x1,n.positionX-n.width/2),c.x2=Math.max(c.x2,n.positionX+n.width/2),c.y1=Math.min(c.y1,n.positionY-n.height/2),c.y2=Math.max(c.y2,n.positionY+n.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,totalA+=c.w*c.h}}components2.sort(function(c1,c2){return c2.w*c2.h-c1.w*c1.h});for(var x2=0,y2=0,usedW=0,rowH=0,maxRowW=Math.sqrt(totalA)*layoutInfo.clientWidth/layoutInfo.clientHeight,i=0;i<components2.length;i++){var c=components2[i];if(c){for(var j=0;j<c.length;j++){var n=c[j];n.isLocked||(n.positionX+=x2-c.x1,n.positionY+=y2-c.y1)}x2+=c.w+options2.componentSpacing,usedW+=c.w+options2.componentSpacing,rowH=Math.max(rowH,c.h),usedW>maxRowW&&(y2+=rowH+options2.componentSpacing,x2=0,usedW=0,rowH=0)}}},defaults$3={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(node){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(node,i){return!0},ready:void 0,stop:void 0,transform:function(node,position3){return position3}};function GridLayout(options2){this.options=extend({},defaults$3,options2)}GridLayout.prototype.run=function(){var params=this.options,options2=params,cy=params.cy,eles=options2.eles,nodes3=eles.nodes().not(":parent");options2.sort&&(nodes3=nodes3.sort(options2.sort));var bb=makeBoundingBox(options2.boundingBox?options2.boundingBox:{x1:0,y1:0,w:cy.width(),h:cy.height()});if(bb.h===0||bb.w===0)eles.nodes().layoutPositions(this,options2,function(ele){return{x:bb.x1,y:bb.y1}});else{var cells=nodes3.size(),splits=Math.sqrt(cells*bb.h/bb.w),rows=Math.round(splits),cols=Math.round(bb.w/bb.h*splits),small=function(val){if(val==null)return Math.min(rows,cols);var min4=Math.min(rows,cols);min4==rows?rows=val:cols=val},large=function(val){if(val==null)return Math.max(rows,cols);var max5=Math.max(rows,cols);max5==rows?rows=val:cols=val},oRows=options2.rows,oCols=options2.cols!=null?options2.cols:options2.columns;if(oRows!=null&&oCols!=null)rows=oRows,cols=oCols;else if(oRows!=null&&oCols==null)rows=oRows,cols=Math.ceil(cells/rows);else if(oRows==null&&oCols!=null)cols=oCols,rows=Math.ceil(cells/cols);else if(cols*rows>cells){var sm=small(),lg=large();(sm-1)*lg>=cells?small(sm-1):(lg-1)*sm>=cells&&large(lg-1)}else for(;cols*rows<cells;){var _sm=small(),_lg=large();(_lg+1)*_sm>=cells?large(_lg+1):small(_sm+1)}var cellWidth=bb.w/cols,cellHeight=bb.h/rows;if(options2.condense&&(cellWidth=0,cellHeight=0),options2.avoidOverlap)for(var i=0;i<nodes3.length;i++){var node=nodes3[i],pos=node._private.position;(pos.x==null||pos.y==null)&&(pos.x=0,pos.y=0);var nbb=node.layoutDimensions(options2),p2=options2.avoidOverlapPadding,w=nbb.w+p2,h=nbb.h+p2;cellWidth=Math.max(cellWidth,w),cellHeight=Math.max(cellHeight,h)}for(var cellUsed={},used=function(row2,col2){return!!cellUsed["c-"+row2+"-"+col2]},use=function(row2,col2){cellUsed["c-"+row2+"-"+col2]=!0},row=0,col=0,moveToNextCell=function(){col++,col>=cols&&(col=0,row++)},id2manPos={},_i=0;_i<nodes3.length;_i++){var _node=nodes3[_i],rcPos=options2.position(_node);if(rcPos&&(rcPos.row!==void 0||rcPos.col!==void 0)){var _pos={row:rcPos.row,col:rcPos.col};if(_pos.col===void 0)for(_pos.col=0;used(_pos.row,_pos.col);)_pos.col++;else if(_pos.row===void 0)for(_pos.row=0;used(_pos.row,_pos.col);)_pos.row++;id2manPos[_node.id()]=_pos,use(_pos.row,_pos.col)}}var getPos=function(element3,i2){var x2,y2;if(element3.locked()||element3.isParent())return!1;var rcPos2=id2manPos[element3.id()];if(rcPos2)x2=rcPos2.col*cellWidth+cellWidth/2+bb.x1,y2=rcPos2.row*cellHeight+cellHeight/2+bb.y1;else{for(;used(row,col);)moveToNextCell();x2=col*cellWidth+cellWidth/2+bb.x1,y2=row*cellHeight+cellHeight/2+bb.y1,use(row,col),moveToNextCell()}return{x:x2,y:y2}};nodes3.layoutPositions(this,options2,getPos)}return this};var defaults$2={ready:function(){},stop:function(){}};function NullLayout(options2){this.options=extend({},defaults$2,options2)}NullLayout.prototype.run=function(){var options2=this.options,eles=options2.eles,layout4=this;return options2.cy,layout4.emit("layoutstart"),eles.nodes().positions(function(){return{x:0,y:0}}),layout4.one("layoutready",options2.ready),layout4.emit("layoutready"),layout4.one("layoutstop",options2.stop),layout4.emit("layoutstop"),this};NullLayout.prototype.stop=function(){return this};var defaults$1={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(node,i){return!0},ready:void 0,stop:void 0,transform:function(node,position3){return position3}};function PresetLayout(options2){this.options=extend({},defaults$1,options2)}PresetLayout.prototype.run=function(){var options2=this.options,eles=options2.eles,nodes3=eles.nodes(),posIsFn=fn$6(options2.positions);function getPosition(node){if(options2.positions==null)return copyPosition(node.position());if(posIsFn)return options2.positions(node);var pos=options2.positions[node._private.data.id];return pos??null}return nodes3.layoutPositions(this,options2,function(node,i){var position3=getPosition(node);return node.locked()||position3==null?!1:position3}),this};var defaults2={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(node,i){return!0},ready:void 0,stop:void 0,transform:function(node,position3){return position3}};function RandomLayout(options2){this.options=extend({},defaults2,options2)}RandomLayout.prototype.run=function(){var options2=this.options,cy=options2.cy,eles=options2.eles,bb=makeBoundingBox(options2.boundingBox?options2.boundingBox:{x1:0,y1:0,w:cy.width(),h:cy.height()}),getPos=function(node,i){return{x:bb.x1+Math.round(Math.random()*bb.w),y:bb.y1+Math.round(Math.random()*bb.h)}};return eles.nodes().layoutPositions(this,options2,getPos),this};var layout3=[{name:"breadthfirst",impl:BreadthFirstLayout},{name:"circle",impl:CircleLayout},{name:"concentric",impl:ConcentricLayout},{name:"cose",impl:CoseLayout},{name:"grid",impl:GridLayout},{name:"null",impl:NullLayout},{name:"preset",impl:PresetLayout},{name:"random",impl:RandomLayout}];function NullRenderer(options2){this.options=options2,this.notifications=0}var noop2=function(){},throwImgErr=function(){throw new Error("A headless instance can not render images")};NullRenderer.prototype={recalculateRenderedStyle:noop2,notify:function(){this.notifications++},init:noop2,isHeadless:function(){return!0},png:throwImgErr,jpg:throwImgErr};var BRp$f={};BRp$f.arrowShapeWidth=.3;BRp$f.registerArrowShapes=function(){var arrowShapes=this.arrowShapes={},renderer3=this,bbCollide=function(x2,y2,size3,angle2,translation,edgeWidth,padding){var x1=translation.x-size3/2-padding,x22=translation.x+size3/2+padding,y1=translation.y-size3/2-padding,y22=translation.y+size3/2+padding,inside=x1<=x2&&x2<=x22&&y1<=y2&&y2<=y22;return inside},transform7=function(x2,y2,size3,angle2,translation){var xRotated=x2*Math.cos(angle2)-y2*Math.sin(angle2),yRotated=x2*Math.sin(angle2)+y2*Math.cos(angle2),xScaled=xRotated*size3,yScaled=yRotated*size3,xTranslated=xScaled+translation.x,yTranslated=yScaled+translation.y;return{x:xTranslated,y:yTranslated}},transformPoints3=function(pts2,size3,angle2,translation){for(var retPts=[],i=0;i<pts2.length;i+=2){var x2=pts2[i],y2=pts2[i+1];retPts.push(transform7(x2,y2,size3,angle2,translation))}return retPts},pointsToArr=function(pts2){for(var ret=[],i=0;i<pts2.length;i++){var p2=pts2[i];ret.push(p2.x,p2.y)}return ret},standardGap=function(edge){return edge.pstyle("width").pfValue*edge.pstyle("arrow-scale").pfValue*2},defineArrowShape=function(name,defn){string(defn)&&(defn=arrowShapes[defn]),arrowShapes[name]=extend({name,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(x2,y2,size3,angle2,translation,padding){var points=pointsToArr(transformPoints3(this.points,size3+2*padding,angle2,translation)),inside=pointInsidePolygonPoints(x2,y2,points);return inside},roughCollide:bbCollide,draw:function(context,size3,angle2,translation){var points=transformPoints3(this.points,size3,angle2,translation);renderer3.arrowShapeImpl("polygon")(context,points)},spacing:function(edge){return 0},gap:standardGap},defn)};defineArrowShape("none",{collide:falsify,roughCollide:falsify,draw:noop$1,spacing:zeroify,gap:zeroify}),defineArrowShape("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),defineArrowShape("arrow","triangle"),defineArrowShape("triangle-backcurve",{points:arrowShapes.triangle.points,controlPoint:[0,-.15],roughCollide:bbCollide,draw:function(context,size3,angle2,translation,edgeWidth){var ptsTrans=transformPoints3(this.points,size3,angle2,translation),ctrlPt=this.controlPoint,ctrlPtTrans=transform7(ctrlPt[0],ctrlPt[1],size3,angle2,translation);renderer3.arrowShapeImpl(this.name)(context,ptsTrans,ctrlPtTrans)},gap:function(edge){return standardGap(edge)*.8}}),defineArrowShape("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(x2,y2,size3,angle2,translation,edgeWidth,padding){var triPts=pointsToArr(transformPoints3(this.points,size3+2*padding,angle2,translation)),teePts=pointsToArr(transformPoints3(this.pointsTee,size3+2*padding,angle2,translation)),inside=pointInsidePolygonPoints(x2,y2,triPts)||pointInsidePolygonPoints(x2,y2,teePts);return inside},draw:function(context,size3,angle2,translation,edgeWidth){var triPts=transformPoints3(this.points,size3,angle2,translation),teePts=transformPoints3(this.pointsTee,size3,angle2,translation);renderer3.arrowShapeImpl(this.name)(context,triPts,teePts)}}),defineArrowShape("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(x2,y2,size3,angle2,translation,edgeWidth,padding){var t=translation,circleInside=Math.pow(t.x-x2,2)+Math.pow(t.y-y2,2)<=Math.pow((size3+2*padding)*this.radius,2),triPts=pointsToArr(transformPoints3(this.points,size3+2*padding,angle2,translation));return pointInsidePolygonPoints(x2,y2,triPts)||circleInside},draw:function(context,size3,angle2,translation,edgeWidth){var triPts=transformPoints3(this.pointsTr,size3,angle2,translation);renderer3.arrowShapeImpl(this.name)(context,triPts,translation.x,translation.y,this.radius*size3)},spacing:function(edge){return renderer3.getArrowWidth(edge.pstyle("width").pfValue,edge.pstyle("arrow-scale").value)*this.radius}}),defineArrowShape("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(size3,edgeWidth){var p2=this.baseCrossLinePts.slice(),shiftFactor=edgeWidth/size3,y0=3,y1=5;return p2[y0]=p2[y0]-shiftFactor,p2[y1]=p2[y1]-shiftFactor,p2},collide:function(x2,y2,size3,angle2,translation,edgeWidth,padding){var triPts=pointsToArr(transformPoints3(this.points,size3+2*padding,angle2,translation)),teePts=pointsToArr(transformPoints3(this.crossLinePts(size3,edgeWidth),size3+2*padding,angle2,translation)),inside=pointInsidePolygonPoints(x2,y2,triPts)||pointInsidePolygonPoints(x2,y2,teePts);return inside},draw:function(context,size3,angle2,translation,edgeWidth){var triPts=transformPoints3(this.points,size3,angle2,translation),crossLinePts=transformPoints3(this.crossLinePts(size3,edgeWidth),size3,angle2,translation);renderer3.arrowShapeImpl(this.name)(context,triPts,crossLinePts)}}),defineArrowShape("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(edge){return standardGap(edge)*.525}}),defineArrowShape("circle",{radius:.15,collide:function(x2,y2,size3,angle2,translation,edgeWidth,padding){var t=translation,inside=Math.pow(t.x-x2,2)+Math.pow(t.y-y2,2)<=Math.pow((size3+2*padding)*this.radius,2);return inside},draw:function(context,size3,angle2,translation,edgeWidth){renderer3.arrowShapeImpl(this.name)(context,translation.x,translation.y,this.radius*size3)},spacing:function(edge){return renderer3.getArrowWidth(edge.pstyle("width").pfValue,edge.pstyle("arrow-scale").value)*this.radius}}),defineArrowShape("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(edge){return 1},gap:function(edge){return 1}}),defineArrowShape("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),defineArrowShape("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(edge){return edge.pstyle("width").pfValue*edge.pstyle("arrow-scale").value}}),defineArrowShape("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(edge){return .95*edge.pstyle("width").pfValue*edge.pstyle("arrow-scale").value}})};var BRp$e={};BRp$e.projectIntoViewport=function(clientX,clientY){var cy=this.cy,offsets=this.findContainerClientCoords(),offsetLeft=offsets[0],offsetTop=offsets[1],scale2=offsets[4],pan2=cy.pan(),zoom2=cy.zoom(),x2=((clientX-offsetLeft)/scale2-pan2.x)/zoom2,y2=((clientY-offsetTop)/scale2-pan2.y)/zoom2;return[x2,y2]};BRp$e.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var container2=this.container,rect=container2.getBoundingClientRect(),style3=this.cy.window().getComputedStyle(container2),styleValue=function(name){return parseFloat(style3.getPropertyValue(name))},padding={left:styleValue("padding-left"),right:styleValue("padding-right"),top:styleValue("padding-top"),bottom:styleValue("padding-bottom")},border={left:styleValue("border-left-width"),right:styleValue("border-right-width"),top:styleValue("border-top-width"),bottom:styleValue("border-bottom-width")},clientWidth=container2.clientWidth,clientHeight=container2.clientHeight,paddingHor=padding.left+padding.right,paddingVer=padding.top+padding.bottom,borderHor=border.left+border.right,scale2=rect.width/(clientWidth+borderHor),unscaledW=clientWidth-paddingHor,unscaledH=clientHeight-paddingVer,left=rect.left+padding.left+border.left,top=rect.top+padding.top+border.top;return this.containerBB=[left,top,unscaledW,unscaledH,scale2]};BRp$e.invalidateContainerClientCoordsCache=function(){this.containerBB=null};BRp$e.findNearestElement=function(x2,y2,interactiveElementsOnly,isTouch){return this.findNearestElements(x2,y2,interactiveElementsOnly,isTouch)[0]};BRp$e.findNearestElements=function(x2,y2,interactiveElementsOnly,isTouch){var self2=this,r=this,eles=r.getCachedZSortedEles(),near=[],zoom2=r.cy.zoom(),hasCompounds=r.cy.hasCompoundNodes(),edgeThreshold=(isTouch?24:8)/zoom2,nodeThreshold=(isTouch?8:2)/zoom2,labelThreshold=(isTouch?8:2)/zoom2,minSqDist=1/0,nearEdge,nearNode;interactiveElementsOnly&&(eles=eles.interactive);function addEle(ele2,sqDist){if(ele2.isNode()){if(nearNode)return;nearNode=ele2,near.push(ele2)}if(ele2.isEdge()&&(sqDist==null||sqDist<minSqDist))if(nearEdge){if(nearEdge.pstyle("z-compound-depth").value===ele2.pstyle("z-compound-depth").value&&nearEdge.pstyle("z-compound-depth").value===ele2.pstyle("z-compound-depth").value){for(var i2=0;i2<near.length;i2++)if(near[i2].isEdge()){near[i2]=ele2,nearEdge=ele2,minSqDist=sqDist??minSqDist;break}}}else near.push(ele2),nearEdge=ele2,minSqDist=sqDist??minSqDist}function checkNode(node){var width2=node.outerWidth()+2*nodeThreshold,height2=node.outerHeight()+2*nodeThreshold,hw=width2/2,hh=height2/2,pos=node.position(),cornerRadius=node.pstyle("corner-radius").value==="auto"?"auto":node.pstyle("corner-radius").pfValue,rs=node._private.rscratch;if(pos.x-hw<=x2&&x2<=pos.x+hw&&pos.y-hh<=y2&&y2<=pos.y+hh){var shape=r.nodeShapes[self2.getNodeShape(node)];if(shape.checkPoint(x2,y2,0,width2,height2,pos.x,pos.y,cornerRadius,rs))return addEle(node,0),!0}}function checkEdge(edge){var _p=edge._private,rs=_p.rscratch,styleWidth=edge.pstyle("width").pfValue,scale2=edge.pstyle("arrow-scale").value,width2=styleWidth/2+edgeThreshold,widthSq=width2*width2,width22=width2*2,src=_p.source,tgt=_p.target,sqDist;if(rs.edgeType==="segments"||rs.edgeType==="straight"||rs.edgeType==="haystack"){for(var pts2=rs.allpts,i2=0;i2+3<pts2.length;i2+=2)if(inLineVicinity(x2,y2,pts2[i2],pts2[i2+1],pts2[i2+2],pts2[i2+3],width22)&&widthSq>(sqDist=sqdistToFiniteLine(x2,y2,pts2[i2],pts2[i2+1],pts2[i2+2],pts2[i2+3])))return addEle(edge,sqDist),!0}else if(rs.edgeType==="bezier"||rs.edgeType==="multibezier"||rs.edgeType==="self"||rs.edgeType==="compound"){for(var pts2=rs.allpts,i2=0;i2+5<rs.allpts.length;i2+=4)if(inBezierVicinity(x2,y2,pts2[i2],pts2[i2+1],pts2[i2+2],pts2[i2+3],pts2[i2+4],pts2[i2+5],width22)&&widthSq>(sqDist=sqdistToQuadraticBezier(x2,y2,pts2[i2],pts2[i2+1],pts2[i2+2],pts2[i2+3],pts2[i2+4],pts2[i2+5])))return addEle(edge,sqDist),!0}for(var src=src||_p.source,tgt=tgt||_p.target,arSize=self2.getArrowWidth(styleWidth,scale2),arrows=[{name:"source",x:rs.arrowStartX,y:rs.arrowStartY,angle:rs.srcArrowAngle},{name:"target",x:rs.arrowEndX,y:rs.arrowEndY,angle:rs.tgtArrowAngle},{name:"mid-source",x:rs.midX,y:rs.midY,angle:rs.midsrcArrowAngle},{name:"mid-target",x:rs.midX,y:rs.midY,angle:rs.midtgtArrowAngle}],i2=0;i2<arrows.length;i2++){var ar=arrows[i2],shape=r.arrowShapes[edge.pstyle(ar.name+"-arrow-shape").value],edgeWidth=edge.pstyle("width").pfValue;if(shape.roughCollide(x2,y2,arSize,ar.angle,{x:ar.x,y:ar.y},edgeWidth,edgeThreshold)&&shape.collide(x2,y2,arSize,ar.angle,{x:ar.x,y:ar.y},edgeWidth,edgeThreshold))return addEle(edge),!0}hasCompounds&&near.length>0&&(checkNode(src),checkNode(tgt))}function preprop(obj,name,pre){return getPrefixedProperty(obj,name,pre)}function checkLabel(ele2,prefix){var _p=ele2._private,th=labelThreshold,prefixDash;prefix?prefixDash=prefix+"-":prefixDash="",ele2.boundingBox();var bb=_p.labelBounds[prefix||"main"],text=ele2.pstyle(prefixDash+"label").value,eventsEnabled=ele2.pstyle("text-events").strValue==="yes";if(!(!eventsEnabled||!text)){var lx=preprop(_p.rscratch,"labelX",prefix),ly=preprop(_p.rscratch,"labelY",prefix),theta=preprop(_p.rscratch,"labelAngle",prefix),ox=ele2.pstyle(prefixDash+"text-margin-x").pfValue,oy=ele2.pstyle(prefixDash+"text-margin-y").pfValue,lx1=bb.x1-th-ox,lx2=bb.x2+th-ox,ly1=bb.y1-th-oy,ly2=bb.y2+th-oy;if(theta){var cos2=Math.cos(theta),sin2=Math.sin(theta),rotate2=function(x3,y3){return x3=x3-lx,y3=y3-ly,{x:x3*cos2-y3*sin2+lx,y:x3*sin2+y3*cos2+ly}},px1y1=rotate2(lx1,ly1),px1y2=rotate2(lx1,ly2),px2y1=rotate2(lx2,ly1),px2y2=rotate2(lx2,ly2),points=[px1y1.x+ox,px1y1.y+oy,px2y1.x+ox,px2y1.y+oy,px2y2.x+ox,px2y2.y+oy,px1y2.x+ox,px1y2.y+oy];if(pointInsidePolygonPoints(x2,y2,points))return addEle(ele2),!0}else if(inBoundingBox(bb,x2,y2))return addEle(ele2),!0}}for(var i=eles.length-1;i>=0;i--){var ele=eles[i];ele.isNode()?checkNode(ele)||checkLabel(ele):checkEdge(ele)||checkLabel(ele)||checkLabel(ele,"source")||checkLabel(ele,"target")}return near};BRp$e.getAllInBox=function(x1,y1,x2,y2){var eles=this.getCachedZSortedEles().interactive,zoom2=this.cy.zoom(),labelThreshold=2/zoom2,box=[],x1c=Math.min(x1,x2),x2c=Math.max(x1,x2),y1c=Math.min(y1,y2),y2c=Math.max(y1,y2);x1=x1c,x2=x2c,y1=y1c,y2=y2c;var boxBb=makeBoundingBox({x1,y1,x2,y2}),selectionBox=[{x:boxBb.x1,y:boxBb.y1},{x:boxBb.x2,y:boxBb.y1},{x:boxBb.x2,y:boxBb.y2},{x:boxBb.x1,y:boxBb.y2}],boxEdges=[[selectionBox[0],selectionBox[1]],[selectionBox[1],selectionBox[2]],[selectionBox[2],selectionBox[3]],[selectionBox[3],selectionBox[0]]];function preprop(obj,name,pre){return getPrefixedProperty(obj,name,pre)}function getRotatedLabelBox(ele2,prefix){var _p2=ele2._private,th=labelThreshold,prefixDash="";ele2.boundingBox();var bb=_p2.labelBounds.main;if(!bb)return null;var lx=preprop(_p2.rscratch,"labelX",prefix),ly=preprop(_p2.rscratch,"labelY",prefix),theta=preprop(_p2.rscratch,"labelAngle",prefix),ox=ele2.pstyle(prefixDash+"text-margin-x").pfValue,oy=ele2.pstyle(prefixDash+"text-margin-y").pfValue,lx1=bb.x1-th-ox,lx2=bb.x2+th-ox,ly1=bb.y1-th-oy,ly2=bb.y2+th-oy;if(theta){var cos2=Math.cos(theta),sin2=Math.sin(theta),rotate2=function(x3,y3){return x3=x3-lx,y3=y3-ly,{x:x3*cos2-y3*sin2+lx,y:x3*sin2+y3*cos2+ly}};return[rotate2(lx1,ly1),rotate2(lx2,ly1),rotate2(lx2,ly2),rotate2(lx1,ly2)]}else return[{x:lx1,y:ly1},{x:lx2,y:ly1},{x:lx2,y:ly2},{x:lx1,y:ly2}]}function doLinesIntersect(p1,p2,q1,q2){function ccw(a,b2,c){return(c.y-a.y)*(b2.x-a.x)>(b2.y-a.y)*(c.x-a.x)}return ccw(p1,q1,q2)!==ccw(p2,q1,q2)&&ccw(p1,p2,q1)!==ccw(p1,p2,q2)}for(var e=0;e<eles.length;e++){var ele=eles[e];if(ele.isNode()){var node=ele,textEvents=node.pstyle("text-events").strValue==="yes",nodeBoxSelectMode=node.pstyle("box-selection").strValue,labelBoxSelectEnabled=node.pstyle("box-select-labels").strValue==="yes";if(nodeBoxSelectMode==="none")continue;var includeLabels=(nodeBoxSelectMode==="overlap"||labelBoxSelectEnabled)&&textEvents,nodeBb=node.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels});if(nodeBoxSelectMode==="contain"){var selected=!1;if(labelBoxSelectEnabled&&textEvents){var rotatedLabelBox=getRotatedLabelBox(node);rotatedLabelBox&&satPolygonIntersection(rotatedLabelBox,selectionBox)&&(box.push(node),selected=!0)}!selected&&boundingBoxInBoundingBox(boxBb,nodeBb)&&box.push(node)}else if(nodeBoxSelectMode==="overlap"&&boundingBoxesIntersect(boxBb,nodeBb)){var nodeBodyBb=node.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),nodeBodyCorners=[{x:nodeBodyBb.x1,y:nodeBodyBb.y1},{x:nodeBodyBb.x2,y:nodeBodyBb.y1},{x:nodeBodyBb.x2,y:nodeBodyBb.y2},{x:nodeBodyBb.x1,y:nodeBodyBb.y2}];if(satPolygonIntersection(nodeBodyCorners,selectionBox))box.push(node);else{var _rotatedLabelBox=getRotatedLabelBox(node);_rotatedLabelBox&&satPolygonIntersection(_rotatedLabelBox,selectionBox)&&box.push(node)}}}else{var edge=ele,_p=edge._private,rs=_p.rscratch,edgeBoxSelectMode=edge.pstyle("box-selection").strValue;if(edgeBoxSelectMode==="none")continue;if(edgeBoxSelectMode==="contain"){if(rs.startX!=null&&rs.startY!=null&&!inBoundingBox(boxBb,rs.startX,rs.startY)||rs.endX!=null&&rs.endY!=null&&!inBoundingBox(boxBb,rs.endX,rs.endY))continue;if(rs.edgeType==="bezier"||rs.edgeType==="multibezier"||rs.edgeType==="self"||rs.edgeType==="compound"||rs.edgeType==="segments"||rs.edgeType==="haystack"){for(var pts2=_p.rstyle.bezierPts||_p.rstyle.linePts||_p.rstyle.haystackPts,allInside=!0,i=0;i<pts2.length;i++)if(!pointInBoundingBox(boxBb,pts2[i])){allInside=!1;break}allInside&&box.push(edge)}else rs.edgeType==="straight"&&box.push(edge)}else if(edgeBoxSelectMode==="overlap"){var _selected=!1;if(rs.startX!=null&&rs.startY!=null&&rs.endX!=null&&rs.endY!=null&&(inBoundingBox(boxBb,rs.startX,rs.startY)||inBoundingBox(boxBb,rs.endX,rs.endY)))box.push(edge),_selected=!0;else if(!_selected&&rs.edgeType==="haystack"){for(var haystackPts=_p.rstyle.haystackPts,_i=0;_i<haystackPts.length;_i++)if(pointInBoundingBox(boxBb,haystackPts[_i])){box.push(edge),_selected=!0;break}}if(!_selected){var _pts=_p.rstyle.bezierPts||_p.rstyle.linePts||_p.rstyle.haystackPts;if((!_pts||_pts.length<2)&&rs.edgeType==="straight"&&rs.startX!=null&&rs.startY!=null&&rs.endX!=null&&rs.endY!=null&&(_pts=[{x:rs.startX,y:rs.startY},{x:rs.endX,y:rs.endY}]),!_pts||_pts.length<2)continue;for(var _i2=0;_i2<_pts.length-1;_i2++){for(var segStart=_pts[_i2],segEnd=_pts[_i2+1],b=0;b<boxEdges.length;b++){var _boxEdges$b=_slicedToArray(boxEdges[b],2),boxStart=_boxEdges$b[0],boxEnd=_boxEdges$b[1];if(doLinesIntersect(segStart,segEnd,boxStart,boxEnd)){box.push(edge),_selected=!0;break}}if(_selected)break}}}}}return box};var BRp$d={};BRp$d.calculateArrowAngles=function(edge){var rs=edge._private.rscratch,isHaystack=rs.edgeType==="haystack",isBezier=rs.edgeType==="bezier",isMultibezier=rs.edgeType==="multibezier",isSegments=rs.edgeType==="segments",isCompound=rs.edgeType==="compound",isSelf=rs.edgeType==="self",dispX,dispY,startX2,startY2,endX,endY,midX,midY;if(isHaystack?(startX2=rs.haystackPts[0],startY2=rs.haystackPts[1],endX=rs.haystackPts[2],endY=rs.haystackPts[3]):(startX2=rs.arrowStartX,startY2=rs.arrowStartY,endX=rs.arrowEndX,endY=rs.arrowEndY),midX=rs.midX,midY=rs.midY,isSegments)dispX=startX2-rs.segpts[0],dispY=startY2-rs.segpts[1];else if(isMultibezier||isCompound||isSelf||isBezier){var pts2=rs.allpts,bX=qbezierAt(pts2[0],pts2[2],pts2[4],.1),bY=qbezierAt(pts2[1],pts2[3],pts2[5],.1);dispX=startX2-bX,dispY=startY2-bY}else dispX=startX2-midX,dispY=startY2-midY;rs.srcArrowAngle=getAngleFromDisp(dispX,dispY);var midX=rs.midX,midY=rs.midY;if(isHaystack&&(midX=(startX2+endX)/2,midY=(startY2+endY)/2),dispX=endX-startX2,dispY=endY-startY2,isSegments){var pts2=rs.allpts;if(pts2.length/2%2===0){var i2=pts2.length/2,i1=i2-2;dispX=pts2[i2]-pts2[i1],dispY=pts2[i2+1]-pts2[i1+1]}else if(rs.isRound)dispX=rs.midVector[1],dispY=-rs.midVector[0];else{var i2=pts2.length/2-1,i1=i2-2;dispX=pts2[i2]-pts2[i1],dispY=pts2[i2+1]-pts2[i1+1]}}else if(isMultibezier||isCompound||isSelf){var pts2=rs.allpts,cpts=rs.ctrlpts,bp0x,bp0y,bp1x,bp1y;if(cpts.length/2%2===0){var p0=pts2.length/2-1,ic=p0+2,p1=ic+2;bp0x=qbezierAt(pts2[p0],pts2[ic],pts2[p1],0),bp0y=qbezierAt(pts2[p0+1],pts2[ic+1],pts2[p1+1],0),bp1x=qbezierAt(pts2[p0],pts2[ic],pts2[p1],1e-4),bp1y=qbezierAt(pts2[p0+1],pts2[ic+1],pts2[p1+1],1e-4)}else{var ic=pts2.length/2-1,p0=ic-2,p1=ic+2;bp0x=qbezierAt(pts2[p0],pts2[ic],pts2[p1],.4999),bp0y=qbezierAt(pts2[p0+1],pts2[ic+1],pts2[p1+1],.4999),bp1x=qbezierAt(pts2[p0],pts2[ic],pts2[p1],.5),bp1y=qbezierAt(pts2[p0+1],pts2[ic+1],pts2[p1+1],.5)}dispX=bp1x-bp0x,dispY=bp1y-bp0y}if(rs.midtgtArrowAngle=getAngleFromDisp(dispX,dispY),rs.midDispX=dispX,rs.midDispY=dispY,dispX*=-1,dispY*=-1,isSegments){var pts2=rs.allpts;if(pts2.length/2%2!==0){if(!rs.isRound){var i2=pts2.length/2-1,i3=i2+2;dispX=-(pts2[i3]-pts2[i2]),dispY=-(pts2[i3+1]-pts2[i2+1])}}}if(rs.midsrcArrowAngle=getAngleFromDisp(dispX,dispY),isSegments)dispX=endX-rs.segpts[rs.segpts.length-2],dispY=endY-rs.segpts[rs.segpts.length-1];else if(isMultibezier||isCompound||isSelf||isBezier){var pts2=rs.allpts,l=pts2.length,bX=qbezierAt(pts2[l-6],pts2[l-4],pts2[l-2],.9),bY=qbezierAt(pts2[l-5],pts2[l-3],pts2[l-1],.9);dispX=endX-bX,dispY=endY-bY}else dispX=endX-midX,dispY=endY-midY;rs.tgtArrowAngle=getAngleFromDisp(dispX,dispY)};BRp$d.getArrowWidth=BRp$d.getArrowHeight=function(edgeWidth,scale2){var cache3=this.arrowWidthCache=this.arrowWidthCache||{},cachedVal=cache3[edgeWidth+", "+scale2];return cachedVal||(cachedVal=Math.max(Math.pow(edgeWidth*13.37,.9),29)*scale2,cache3[edgeWidth+", "+scale2]=cachedVal,cachedVal)};var x,y,v1={},v2={},sinA,sinA90,radDirection,drawDirection,angle,halfAngle,cRadius,lenOut,radius,limit,startX,startY,stopX,stopY,lastPoint,asVec=function(p2,pp,v){v.x=pp.x-p2.x,v.y=pp.y-p2.y,v.len=Math.sqrt(v.x*v.x+v.y*v.y),v.nx=v.x/v.len,v.ny=v.y/v.len,v.ang=Math.atan2(v.ny,v.nx)},invertVec=function(originalV,invertedV){invertedV.x=originalV.x*-1,invertedV.y=originalV.y*-1,invertedV.nx=originalV.nx*-1,invertedV.ny=originalV.ny*-1,invertedV.ang=originalV.ang>0?-(Math.PI-originalV.ang):Math.PI+originalV.ang},calcCornerArc=function(previousPoint,currentPoint,nextPoint,radiusMax,isArcRadius){if(previousPoint!==lastPoint?asVec(currentPoint,previousPoint,v1):invertVec(v2,v1),asVec(currentPoint,nextPoint,v2),sinA=v1.nx*v2.ny-v1.ny*v2.nx,sinA90=v1.nx*v2.nx-v1.ny*-v2.ny,angle=Math.asin(Math.max(-1,Math.min(1,sinA))),Math.abs(angle)<1e-6){x=currentPoint.x,y=currentPoint.y,cRadius=radius=0;return}radDirection=1,drawDirection=!1,sinA90<0?angle<0?angle=Math.PI+angle:(angle=Math.PI-angle,radDirection=-1,drawDirection=!0):angle>0&&(radDirection=-1,drawDirection=!0),currentPoint.radius!==void 0?radius=currentPoint.radius:radius=radiusMax,halfAngle=angle/2,limit=Math.min(v1.len/2,v2.len/2),isArcRadius?(lenOut=Math.abs(Math.cos(halfAngle)*radius/Math.sin(halfAngle)),lenOut>limit?(lenOut=limit,cRadius=Math.abs(lenOut*Math.sin(halfAngle)/Math.cos(halfAngle))):cRadius=radius):(lenOut=Math.min(limit,radius),cRadius=Math.abs(lenOut*Math.sin(halfAngle)/Math.cos(halfAngle))),stopX=currentPoint.x+v2.nx*lenOut,stopY=currentPoint.y+v2.ny*lenOut,x=stopX-v2.ny*cRadius*radDirection,y=stopY+v2.nx*cRadius*radDirection,startX=currentPoint.x+v1.nx*lenOut,startY=currentPoint.y+v1.ny*lenOut,lastPoint=currentPoint};function drawPreparedRoundCorner(ctx,roundCorner){roundCorner.radius===0?ctx.lineTo(roundCorner.cx,roundCorner.cy):ctx.arc(roundCorner.cx,roundCorner.cy,roundCorner.radius,roundCorner.startAngle,roundCorner.endAngle,roundCorner.counterClockwise)}function getRoundCorner(previousPoint,currentPoint,nextPoint,radiusMax){var isArcRadius=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return radiusMax===0||currentPoint.radius===0?{cx:currentPoint.x,cy:currentPoint.y,radius:0,startX:currentPoint.x,startY:currentPoint.y,stopX:currentPoint.x,stopY:currentPoint.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(calcCornerArc(previousPoint,currentPoint,nextPoint,radiusMax,isArcRadius),{cx:x,cy:y,radius:cRadius,startX,startY,stopX,stopY,startAngle:v1.ang+Math.PI/2*radDirection,endAngle:v2.ang-Math.PI/2*radDirection,counterClockwise:drawDirection})}var AVOID_IMPOSSIBLE_BEZIER_CONSTANT=.01,AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L=Math.sqrt(2*AVOID_IMPOSSIBLE_BEZIER_CONSTANT),BRp$c={};BRp$c.findMidptPtsEtc=function(edge,pairInfo){var posPts=pairInfo.posPts,intersectionPts=pairInfo.intersectionPts,vectorNormInverse=pairInfo.vectorNormInverse,midptPts,srcManEndpt=edge.pstyle("source-endpoint"),tgtManEndpt=edge.pstyle("target-endpoint"),haveManualEndPts=srcManEndpt.units!=null&&tgtManEndpt.units!=null,recalcVectorNormInverse=function(x12,y12,x22,y22){var dy=y22-y12,dx=x22-x12,l=Math.sqrt(dx*dx+dy*dy);return{x:-dy/l,y:dx/l}},edgeDistances=edge.pstyle("edge-distances").value;switch(edgeDistances){case"node-position":midptPts=posPts;break;case"intersection":midptPts=intersectionPts;break;case"endpoints":{if(haveManualEndPts){var _this$manualEndptToPx=this.manualEndptToPx(edge.source()[0],srcManEndpt),_this$manualEndptToPx2=_slicedToArray(_this$manualEndptToPx,2),x1=_this$manualEndptToPx2[0],y1=_this$manualEndptToPx2[1],_this$manualEndptToPx3=this.manualEndptToPx(edge.target()[0],tgtManEndpt),_this$manualEndptToPx4=_slicedToArray(_this$manualEndptToPx3,2),x2=_this$manualEndptToPx4[0],y2=_this$manualEndptToPx4[1],endPts={x1,y1,x2,y2};vectorNormInverse=recalcVectorNormInverse(x1,y1,x2,y2),midptPts=endPts}else warn("Edge ".concat(edge.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),midptPts=intersectionPts;break}}return{midptPts,vectorNormInverse}};BRp$c.findHaystackPoints=function(edges3){for(var i=0;i<edges3.length;i++){var edge=edges3[i],_p=edge._private,rs=_p.rscratch;if(!rs.haystack){var angle2=Math.random()*2*Math.PI;rs.source={x:Math.cos(angle2),y:Math.sin(angle2)},angle2=Math.random()*2*Math.PI,rs.target={x:Math.cos(angle2),y:Math.sin(angle2)}}var src=_p.source,tgt=_p.target,srcPos=src.position(),tgtPos=tgt.position(),srcW=src.width(),tgtW=tgt.width(),srcH=src.height(),tgtH=tgt.height(),radius2=edge.pstyle("haystack-radius").value,halfRadius=radius2/2;rs.haystackPts=rs.allpts=[rs.source.x*srcW*halfRadius+srcPos.x,rs.source.y*srcH*halfRadius+srcPos.y,rs.target.x*tgtW*halfRadius+tgtPos.x,rs.target.y*tgtH*halfRadius+tgtPos.y],rs.midX=(rs.allpts[0]+rs.allpts[2])/2,rs.midY=(rs.allpts[1]+rs.allpts[3])/2,rs.edgeType="haystack",rs.haystack=!0,this.storeEdgeProjections(edge),this.calculateArrowAngles(edge),this.recalculateEdgeLabelProjections(edge),this.calculateLabelAngles(edge)}};BRp$c.findSegmentsPoints=function(edge,pairInfo){var rs=edge._private.rscratch,segmentWs=edge.pstyle("segment-weights"),segmentDs=edge.pstyle("segment-distances"),segmentRs=edge.pstyle("segment-radii"),segmentTs=edge.pstyle("radius-type"),segmentsN=Math.min(segmentWs.pfValue.length,segmentDs.pfValue.length),lastRadius=segmentRs.pfValue[segmentRs.pfValue.length-1],lastRadiusType=segmentTs.pfValue[segmentTs.pfValue.length-1];rs.edgeType="segments",rs.segpts=[],rs.radii=[],rs.isArcRadius=[];for(var s=0;s<segmentsN;s++){var w=segmentWs.pfValue[s],d=segmentDs.pfValue[s],w1=1-w,w2=w,_this$findMidptPtsEtc=this.findMidptPtsEtc(edge,pairInfo),midptPts=_this$findMidptPtsEtc.midptPts,vectorNormInverse=_this$findMidptPtsEtc.vectorNormInverse,adjustedMidpt={x:midptPts.x1*w1+midptPts.x2*w2,y:midptPts.y1*w1+midptPts.y2*w2};rs.segpts.push(adjustedMidpt.x+vectorNormInverse.x*d,adjustedMidpt.y+vectorNormInverse.y*d),rs.radii.push(segmentRs.pfValue[s]!==void 0?segmentRs.pfValue[s]:lastRadius),rs.isArcRadius.push((segmentTs.pfValue[s]!==void 0?segmentTs.pfValue[s]:lastRadiusType)==="arc-radius")}};BRp$c.findLoopPoints=function(edge,pairInfo,i,edgeIsUnbundled){var rs=edge._private.rscratch,dirCounts=pairInfo.dirCounts,srcPos=pairInfo.srcPos,ctrlptDists=edge.pstyle("control-point-distances"),ctrlptDist=ctrlptDists?ctrlptDists.pfValue[0]:void 0,loopDir=edge.pstyle("loop-direction").pfValue,loopSwp=edge.pstyle("loop-sweep").pfValue,stepSize=edge.pstyle("control-point-step-size").pfValue;rs.edgeType="self";var j=i,loopDist=stepSize;edgeIsUnbundled&&(j=0,loopDist=ctrlptDist);var loopAngle=loopDir-Math.PI/2,outAngle=loopAngle-loopSwp/2,inAngle=loopAngle+loopSwp/2,dc=loopDir+"_"+loopSwp;j=dirCounts[dc]===void 0?dirCounts[dc]=0:++dirCounts[dc],rs.ctrlpts=[srcPos.x+Math.cos(outAngle)*1.4*loopDist*(j/3+1),srcPos.y+Math.sin(outAngle)*1.4*loopDist*(j/3+1),srcPos.x+Math.cos(inAngle)*1.4*loopDist*(j/3+1),srcPos.y+Math.sin(inAngle)*1.4*loopDist*(j/3+1)]};BRp$c.findCompoundLoopPoints=function(edge,pairInfo,i,edgeIsUnbundled){var rs=edge._private.rscratch;rs.edgeType="compound";var srcPos=pairInfo.srcPos,tgtPos=pairInfo.tgtPos,srcW=pairInfo.srcW,srcH=pairInfo.srcH,tgtW=pairInfo.tgtW,tgtH=pairInfo.tgtH,stepSize=edge.pstyle("control-point-step-size").pfValue,ctrlptDists=edge.pstyle("control-point-distances"),ctrlptDist=ctrlptDists?ctrlptDists.pfValue[0]:void 0,j=i,loopDist=stepSize;edgeIsUnbundled&&(j=0,loopDist=ctrlptDist);var loopW=50,loopaPos={x:srcPos.x-srcW/2,y:srcPos.y-srcH/2},loopbPos={x:tgtPos.x-tgtW/2,y:tgtPos.y-tgtH/2},loopPos={x:Math.min(loopaPos.x,loopbPos.x),y:Math.min(loopaPos.y,loopbPos.y)},minCompoundStretch=.5,compoundStretchA=Math.max(minCompoundStretch,Math.log(srcW*AVOID_IMPOSSIBLE_BEZIER_CONSTANT)),compoundStretchB=Math.max(minCompoundStretch,Math.log(tgtW*AVOID_IMPOSSIBLE_BEZIER_CONSTANT));rs.ctrlpts=[loopPos.x,loopPos.y-(1+Math.pow(loopW,1.12)/100)*loopDist*(j/3+1)*compoundStretchA,loopPos.x-(1+Math.pow(loopW,1.12)/100)*loopDist*(j/3+1)*compoundStretchB,loopPos.y]};BRp$c.findStraightEdgePoints=function(edge){edge._private.rscratch.edgeType="straight"};BRp$c.findBezierPoints=function(edge,pairInfo,i,edgeIsUnbundled,edgeIsSwapped){var rs=edge._private.rscratch,stepSize=edge.pstyle("control-point-step-size").pfValue,ctrlptDists=edge.pstyle("control-point-distances"),ctrlptWs=edge.pstyle("control-point-weights"),bezierN=ctrlptDists&&ctrlptWs?Math.min(ctrlptDists.value.length,ctrlptWs.value.length):1,ctrlptDist=ctrlptDists?ctrlptDists.pfValue[0]:void 0,ctrlptWeight=ctrlptWs.value[0],multi=edgeIsUnbundled;rs.edgeType=multi?"multibezier":"bezier",rs.ctrlpts=[];for(var b=0;b<bezierN;b++){var normctrlptDist=(.5-pairInfo.eles.length/2+i)*stepSize*(edgeIsSwapped?-1:1),manctrlptDist=void 0,sign=signum(normctrlptDist);multi&&(ctrlptDist=ctrlptDists?ctrlptDists.pfValue[b]:stepSize,ctrlptWeight=ctrlptWs.value[b]),edgeIsUnbundled?manctrlptDist=ctrlptDist:manctrlptDist=ctrlptDist!==void 0?sign*ctrlptDist:void 0;var distanceFromMidpoint=manctrlptDist!==void 0?manctrlptDist:normctrlptDist,w1=1-ctrlptWeight,w2=ctrlptWeight,_this$findMidptPtsEtc2=this.findMidptPtsEtc(edge,pairInfo),midptPts=_this$findMidptPtsEtc2.midptPts,vectorNormInverse=_this$findMidptPtsEtc2.vectorNormInverse,adjustedMidpt={x:midptPts.x1*w1+midptPts.x2*w2,y:midptPts.y1*w1+midptPts.y2*w2};rs.ctrlpts.push(adjustedMidpt.x+vectorNormInverse.x*distanceFromMidpoint,adjustedMidpt.y+vectorNormInverse.y*distanceFromMidpoint)}};BRp$c.findTaxiPoints=function(edge,pairInfo){var rs=edge._private.rscratch;rs.edgeType="segments";var VERTICAL="vertical",HORIZONTAL="horizontal",LEFTWARD="leftward",RIGHTWARD="rightward",DOWNWARD="downward",UPWARD="upward",AUTO="auto",posPts=pairInfo.posPts,srcW=pairInfo.srcW,srcH=pairInfo.srcH,tgtW=pairInfo.tgtW,tgtH=pairInfo.tgtH,edgeDistances=edge.pstyle("edge-distances").value,dIncludesNodeBody=edgeDistances!=="node-position",taxiDir=edge.pstyle("taxi-direction").value,rawTaxiDir=taxiDir,taxiTurn=edge.pstyle("taxi-turn"),turnIsPercent=taxiTurn.units==="%",taxiTurnPfVal=taxiTurn.pfValue,turnIsNegative=taxiTurnPfVal<0,minD=edge.pstyle("taxi-turn-min-distance").pfValue,dw=dIncludesNodeBody?(srcW+tgtW)/2:0,dh=dIncludesNodeBody?(srcH+tgtH)/2:0,pdx=posPts.x2-posPts.x1,pdy=posPts.y2-posPts.y1,subDWH=function(dxy,dwh){return dxy>0?Math.max(dxy-dwh,0):Math.min(dxy+dwh,0)},dx=subDWH(pdx,dw),dy=subDWH(pdy,dh),isExplicitDir=!1;rawTaxiDir===AUTO?taxiDir=Math.abs(dx)>Math.abs(dy)?HORIZONTAL:VERTICAL:rawTaxiDir===UPWARD||rawTaxiDir===DOWNWARD?(taxiDir=VERTICAL,isExplicitDir=!0):(rawTaxiDir===LEFTWARD||rawTaxiDir===RIGHTWARD)&&(taxiDir=HORIZONTAL,isExplicitDir=!0);var isVert=taxiDir===VERTICAL,l=isVert?dy:dx,pl=isVert?pdy:pdx,sgnL=signum(pl),forcedDir=!1;!(isExplicitDir&&(turnIsPercent||turnIsNegative))&&(rawTaxiDir===DOWNWARD&&pl<0||rawTaxiDir===UPWARD&&pl>0||rawTaxiDir===LEFTWARD&&pl>0||rawTaxiDir===RIGHTWARD&&pl<0)&&(sgnL*=-1,l=sgnL*Math.abs(l),forcedDir=!0);var d;if(turnIsPercent){var p2=taxiTurnPfVal<0?1+taxiTurnPfVal:taxiTurnPfVal;d=p2*l}else{var k=taxiTurnPfVal<0?l:0;d=k+taxiTurnPfVal*sgnL}var getIsTooClose=function(d2){return Math.abs(d2)<minD||Math.abs(d2)>=Math.abs(l)},isTooCloseSrc=getIsTooClose(d),isTooCloseTgt=getIsTooClose(Math.abs(l)-Math.abs(d)),isTooClose=isTooCloseSrc||isTooCloseTgt;if(isTooClose&&!forcedDir)if(isVert){var lShapeInsideSrc=Math.abs(pl)<=srcH/2,lShapeInsideTgt=Math.abs(pdx)<=tgtW/2;if(lShapeInsideSrc){var x2=(posPts.x1+posPts.x2)/2,y1=posPts.y1,y2=posPts.y2;rs.segpts=[x2,y1,x2,y2]}else if(lShapeInsideTgt){var y3=(posPts.y1+posPts.y2)/2,x1=posPts.x1,x22=posPts.x2;rs.segpts=[x1,y3,x22,y3]}else rs.segpts=[posPts.x1,posPts.y2]}else{var _lShapeInsideSrc=Math.abs(pl)<=srcW/2,_lShapeInsideTgt=Math.abs(pdy)<=tgtH/2;if(_lShapeInsideSrc){var _y=(posPts.y1+posPts.y2)/2,_x=posPts.x1,_x2=posPts.x2;rs.segpts=[_x,_y,_x2,_y]}else if(_lShapeInsideTgt){var _x3=(posPts.x1+posPts.x2)/2,_y2=posPts.y1,_y3=posPts.y2;rs.segpts=[_x3,_y2,_x3,_y3]}else rs.segpts=[posPts.x2,posPts.y1]}else if(isVert){var _y4=posPts.y1+d+(dIncludesNodeBody?srcH/2*sgnL:0),_x4=posPts.x1,_x5=posPts.x2;rs.segpts=[_x4,_y4,_x5,_y4]}else{var _x6=posPts.x1+d+(dIncludesNodeBody?srcW/2*sgnL:0),_y5=posPts.y1,_y6=posPts.y2;rs.segpts=[_x6,_y5,_x6,_y6]}if(rs.isRound){var radius2=edge.pstyle("taxi-radius").value,isArcRadius=edge.pstyle("radius-type").value[0]==="arc-radius";rs.radii=new Array(rs.segpts.length/2).fill(radius2),rs.isArcRadius=new Array(rs.segpts.length/2).fill(isArcRadius)}};BRp$c.tryToCorrectInvalidPoints=function(edge,pairInfo){var rs=edge._private.rscratch;if(rs.edgeType==="bezier"){var srcPos=pairInfo.srcPos,tgtPos=pairInfo.tgtPos,srcW=pairInfo.srcW,srcH=pairInfo.srcH,tgtW=pairInfo.tgtW,tgtH=pairInfo.tgtH,srcShape=pairInfo.srcShape,tgtShape=pairInfo.tgtShape,srcCornerRadius=pairInfo.srcCornerRadius,tgtCornerRadius=pairInfo.tgtCornerRadius,srcRs=pairInfo.srcRs,tgtRs=pairInfo.tgtRs,badStart=!number$1(rs.startX)||!number$1(rs.startY),badAStart=!number$1(rs.arrowStartX)||!number$1(rs.arrowStartY),badEnd=!number$1(rs.endX)||!number$1(rs.endY),badAEnd=!number$1(rs.arrowEndX)||!number$1(rs.arrowEndY),minCpADistFactor=3,arrowW=this.getArrowWidth(edge.pstyle("width").pfValue,edge.pstyle("arrow-scale").value)*this.arrowShapeWidth,minCpADist=minCpADistFactor*arrowW,startACpDist=dist({x:rs.ctrlpts[0],y:rs.ctrlpts[1]},{x:rs.startX,y:rs.startY}),closeStartACp=startACpDist<minCpADist,endACpDist=dist({x:rs.ctrlpts[0],y:rs.ctrlpts[1]},{x:rs.endX,y:rs.endY}),closeEndACp=endACpDist<minCpADist,overlapping=!1;if(badStart||badAStart||closeStartACp){overlapping=!0;var cpD={x:rs.ctrlpts[0]-srcPos.x,y:rs.ctrlpts[1]-srcPos.y},cpL=Math.sqrt(cpD.x*cpD.x+cpD.y*cpD.y),cpM={x:cpD.x/cpL,y:cpD.y/cpL},radius2=Math.max(srcW,srcH),cpProj={x:rs.ctrlpts[0]+cpM.x*2*radius2,y:rs.ctrlpts[1]+cpM.y*2*radius2},srcCtrlPtIntn=srcShape.intersectLine(srcPos.x,srcPos.y,srcW,srcH,cpProj.x,cpProj.y,0,srcCornerRadius,srcRs);closeStartACp?(rs.ctrlpts[0]=rs.ctrlpts[0]+cpM.x*(minCpADist-startACpDist),rs.ctrlpts[1]=rs.ctrlpts[1]+cpM.y*(minCpADist-startACpDist)):(rs.ctrlpts[0]=srcCtrlPtIntn[0]+cpM.x*minCpADist,rs.ctrlpts[1]=srcCtrlPtIntn[1]+cpM.y*minCpADist)}if(badEnd||badAEnd||closeEndACp){overlapping=!0;var _cpD={x:rs.ctrlpts[0]-tgtPos.x,y:rs.ctrlpts[1]-tgtPos.y},_cpL=Math.sqrt(_cpD.x*_cpD.x+_cpD.y*_cpD.y),_cpM={x:_cpD.x/_cpL,y:_cpD.y/_cpL},_radius=Math.max(srcW,srcH),_cpProj={x:rs.ctrlpts[0]+_cpM.x*2*_radius,y:rs.ctrlpts[1]+_cpM.y*2*_radius},tgtCtrlPtIntn=tgtShape.intersectLine(tgtPos.x,tgtPos.y,tgtW,tgtH,_cpProj.x,_cpProj.y,0,tgtCornerRadius,tgtRs);closeEndACp?(rs.ctrlpts[0]=rs.ctrlpts[0]+_cpM.x*(minCpADist-endACpDist),rs.ctrlpts[1]=rs.ctrlpts[1]+_cpM.y*(minCpADist-endACpDist)):(rs.ctrlpts[0]=tgtCtrlPtIntn[0]+_cpM.x*minCpADist,rs.ctrlpts[1]=tgtCtrlPtIntn[1]+_cpM.y*minCpADist)}overlapping&&this.findEndpoints(edge)}};BRp$c.storeAllpts=function(edge){var rs=edge._private.rscratch;if(rs.edgeType==="multibezier"||rs.edgeType==="bezier"||rs.edgeType==="self"||rs.edgeType==="compound"){rs.allpts=[],rs.allpts.push(rs.startX,rs.startY);for(var b=0;b+1<rs.ctrlpts.length;b+=2)rs.allpts.push(rs.ctrlpts[b],rs.ctrlpts[b+1]),b+3<rs.ctrlpts.length&&rs.allpts.push((rs.ctrlpts[b]+rs.ctrlpts[b+2])/2,(rs.ctrlpts[b+1]+rs.ctrlpts[b+3])/2);rs.allpts.push(rs.endX,rs.endY);var m,mt;rs.ctrlpts.length/2%2===0?(m=rs.allpts.length/2-1,rs.midX=rs.allpts[m],rs.midY=rs.allpts[m+1]):(m=rs.allpts.length/2-3,mt=.5,rs.midX=qbezierAt(rs.allpts[m],rs.allpts[m+2],rs.allpts[m+4],mt),rs.midY=qbezierAt(rs.allpts[m+1],rs.allpts[m+3],rs.allpts[m+5],mt))}else if(rs.edgeType==="straight")rs.allpts=[rs.startX,rs.startY,rs.endX,rs.endY],rs.midX=(rs.startX+rs.endX+rs.arrowStartX+rs.arrowEndX)/4,rs.midY=(rs.startY+rs.endY+rs.arrowStartY+rs.arrowEndY)/4;else if(rs.edgeType==="segments"){if(rs.allpts=[],rs.allpts.push(rs.startX,rs.startY),rs.allpts.push.apply(rs.allpts,rs.segpts),rs.allpts.push(rs.endX,rs.endY),rs.isRound){rs.roundCorners=[];for(var i=2;i+3<rs.allpts.length;i+=2){var radius2=rs.radii[i/2-1],isArcRadius=rs.isArcRadius[i/2-1];rs.roundCorners.push(getRoundCorner({x:rs.allpts[i-2],y:rs.allpts[i-1]},{x:rs.allpts[i],y:rs.allpts[i+1],radius:radius2},{x:rs.allpts[i+2],y:rs.allpts[i+3]},radius2,isArcRadius))}}if(rs.segpts.length%4===0){var i2=rs.segpts.length/2,i1=i2-2;rs.midX=(rs.segpts[i1]+rs.segpts[i2])/2,rs.midY=(rs.segpts[i1+1]+rs.segpts[i2+1])/2}else{var _i=rs.segpts.length/2-1;if(!rs.isRound)rs.midX=rs.segpts[_i],rs.midY=rs.segpts[_i+1];else{var point={x:rs.segpts[_i],y:rs.segpts[_i+1]},corner=rs.roundCorners[_i/2];if(corner.radius===0){var nextPoint={x:rs.segpts[_i+2],y:rs.segpts[_i+3]};rs.midX=point.x,rs.midY=point.y,rs.midVector=[point.y-nextPoint.y,nextPoint.x-point.x]}else{var v=[point.x-corner.cx,point.y-corner.cy],factor=corner.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(c){return c*factor}),rs.midX=corner.cx+v[0],rs.midY=corner.cy+v[1],rs.midVector=v}}}}};BRp$c.checkForInvalidEdgeWarning=function(edge){var rs=edge[0]._private.rscratch;rs.nodesOverlap||number$1(rs.startX)&&number$1(rs.startY)&&number$1(rs.endX)&&number$1(rs.endY)?rs.loggedErr=!1:rs.loggedErr||(rs.loggedErr=!0,warn("Edge `"+edge.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."))};BRp$c.findEdgeControlPoints=function(edges3){var _this=this;if(!(!edges3||edges3.length===0)){for(var r=this,cy=r.cy,hasCompounds=cy.hasCompoundNodes(),hashTable=new Map$1,getKey3=function(pairId2,edgeIsUnbundled2){return[].concat(_toConsumableArray(pairId2),[edgeIsUnbundled2?1:0]).join("-")},pairIds=[],haystackEdges=[],i=0;i<edges3.length;i++){var edge=edges3[i],_p=edge._private,curveStyle=edge.pstyle("curve-style").value;if(!(edge.removed()||!edge.takesUpSpace())){if(curveStyle==="haystack"){haystackEdges.push(edge);continue}var edgeIsUnbundled=curveStyle==="unbundled-bezier"||endsWith(curveStyle,"segments")||curveStyle==="straight"||curveStyle==="straight-triangle"||endsWith(curveStyle,"taxi"),edgeIsBezier=curveStyle==="unbundled-bezier"||curveStyle==="bezier",src=_p.source,tgt=_p.target,srcIndex=src.poolIndex(),tgtIndex=tgt.poolIndex(),pairId=[srcIndex,tgtIndex].sort(),key=getKey3(pairId,edgeIsUnbundled),tableEntry=hashTable.get(key);tableEntry==null&&(tableEntry={eles:[]},pairIds.push({pairId,edgeIsUnbundled}),hashTable.set(key,tableEntry)),tableEntry.eles.push(edge),edgeIsUnbundled&&(tableEntry.hasUnbundled=!0),edgeIsBezier&&(tableEntry.hasBezier=!0)}}for(var _loop=function(){var _pairIds$p=pairIds[p2],pairId2=_pairIds$p.pairId,edgeIsUnbundled2=_pairIds$p.edgeIsUnbundled,key2=getKey3(pairId2,edgeIsUnbundled2),pairInfo=hashTable.get(key2),swappedpairInfo;if(!pairInfo.hasUnbundled){var pllEdges=pairInfo.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});clearArray(pairInfo.eles),pllEdges.forEach(function(edge2){return pairInfo.eles.push(edge2)}),pairInfo.eles.sort(function(edge1,edge2){return edge1.poolIndex()-edge2.poolIndex()})}var firstEdge=pairInfo.eles[0],src2=firstEdge.source(),tgt2=firstEdge.target();if(src2.poolIndex()>tgt2.poolIndex()){var temp=src2;src2=tgt2,tgt2=temp}var srcPos=pairInfo.srcPos=src2.position(),tgtPos=pairInfo.tgtPos=tgt2.position(),srcW=pairInfo.srcW=src2.outerWidth(),srcH=pairInfo.srcH=src2.outerHeight(),tgtW=pairInfo.tgtW=tgt2.outerWidth(),tgtH=pairInfo.tgtH=tgt2.outerHeight(),srcShape=pairInfo.srcShape=r.nodeShapes[_this.getNodeShape(src2)],tgtShape=pairInfo.tgtShape=r.nodeShapes[_this.getNodeShape(tgt2)],srcCornerRadius=pairInfo.srcCornerRadius=src2.pstyle("corner-radius").value==="auto"?"auto":src2.pstyle("corner-radius").pfValue,tgtCornerRadius=pairInfo.tgtCornerRadius=tgt2.pstyle("corner-radius").value==="auto"?"auto":tgt2.pstyle("corner-radius").pfValue,tgtRs=pairInfo.tgtRs=tgt2._private.rscratch,srcRs=pairInfo.srcRs=src2._private.rscratch;pairInfo.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var _i2=0;_i2<pairInfo.eles.length;_i2++){var _edge=pairInfo.eles[_i2],rs=_edge[0]._private.rscratch,_curveStyle=_edge.pstyle("curve-style").value,_edgeIsUnbundled=_curveStyle==="unbundled-bezier"||endsWith(_curveStyle,"segments")||endsWith(_curveStyle,"taxi"),edgeIsSwapped=!src2.same(_edge.source());if(!pairInfo.calculatedIntersection&&src2!==tgt2&&(pairInfo.hasBezier||pairInfo.hasUnbundled)){pairInfo.calculatedIntersection=!0;var srcOutside=srcShape.intersectLine(srcPos.x,srcPos.y,srcW,srcH,tgtPos.x,tgtPos.y,0,srcCornerRadius,srcRs),srcIntn=pairInfo.srcIntn=srcOutside,tgtOutside=tgtShape.intersectLine(tgtPos.x,tgtPos.y,tgtW,tgtH,srcPos.x,srcPos.y,0,tgtCornerRadius,tgtRs),tgtIntn=pairInfo.tgtIntn=tgtOutside,intersectionPts=pairInfo.intersectionPts={x1:srcOutside[0],x2:tgtOutside[0],y1:srcOutside[1],y2:tgtOutside[1]},posPts=pairInfo.posPts={x1:srcPos.x,x2:tgtPos.x,y1:srcPos.y,y2:tgtPos.y},dy=tgtOutside[1]-srcOutside[1],dx=tgtOutside[0]-srcOutside[0],l=Math.sqrt(dx*dx+dy*dy);number$1(l)&&l>=AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L||(l=Math.sqrt(Math.max(dx*dx,AVOID_IMPOSSIBLE_BEZIER_CONSTANT)+Math.max(dy*dy,AVOID_IMPOSSIBLE_BEZIER_CONSTANT)));var vector=pairInfo.vector={x:dx,y:dy},vectorNorm=pairInfo.vectorNorm={x:vector.x/l,y:vector.y/l},vectorNormInverse={x:-vectorNorm.y,y:vectorNorm.x};pairInfo.nodesOverlap=!number$1(l)||tgtShape.checkPoint(srcOutside[0],srcOutside[1],0,tgtW,tgtH,tgtPos.x,tgtPos.y,tgtCornerRadius,tgtRs)||srcShape.checkPoint(tgtOutside[0],tgtOutside[1],0,srcW,srcH,srcPos.x,srcPos.y,srcCornerRadius,srcRs),pairInfo.vectorNormInverse=vectorNormInverse,swappedpairInfo={nodesOverlap:pairInfo.nodesOverlap,dirCounts:pairInfo.dirCounts,calculatedIntersection:!0,hasBezier:pairInfo.hasBezier,hasUnbundled:pairInfo.hasUnbundled,eles:pairInfo.eles,srcPos:tgtPos,srcRs:tgtRs,tgtPos:srcPos,tgtRs:srcRs,srcW:tgtW,srcH:tgtH,tgtW:srcW,tgtH:srcH,srcIntn:tgtIntn,tgtIntn:srcIntn,srcShape:tgtShape,tgtShape:srcShape,posPts:{x1:posPts.x2,y1:posPts.y2,x2:posPts.x1,y2:posPts.y1},intersectionPts:{x1:intersectionPts.x2,y1:intersectionPts.y2,x2:intersectionPts.x1,y2:intersectionPts.y1},vector:{x:-vector.x,y:-vector.y},vectorNorm:{x:-vectorNorm.x,y:-vectorNorm.y},vectorNormInverse:{x:-vectorNormInverse.x,y:-vectorNormInverse.y}}}var passedPairInfo=edgeIsSwapped?swappedpairInfo:pairInfo;rs.nodesOverlap=passedPairInfo.nodesOverlap,rs.srcIntn=passedPairInfo.srcIntn,rs.tgtIntn=passedPairInfo.tgtIntn,rs.isRound=_curveStyle.startsWith("round"),hasCompounds&&(src2.isParent()||src2.isChild()||tgt2.isParent()||tgt2.isChild())&&(src2.parents().anySame(tgt2)||tgt2.parents().anySame(src2)||src2.same(tgt2)&&src2.isParent())?_this.findCompoundLoopPoints(_edge,passedPairInfo,_i2,_edgeIsUnbundled):src2===tgt2?_this.findLoopPoints(_edge,passedPairInfo,_i2,_edgeIsUnbundled):_curveStyle.endsWith("segments")?_this.findSegmentsPoints(_edge,passedPairInfo):_curveStyle.endsWith("taxi")?_this.findTaxiPoints(_edge,passedPairInfo):_curveStyle==="straight"||!_edgeIsUnbundled&&pairInfo.eles.length%2===1&&_i2===Math.floor(pairInfo.eles.length/2)?_this.findStraightEdgePoints(_edge):_this.findBezierPoints(_edge,passedPairInfo,_i2,_edgeIsUnbundled,edgeIsSwapped),_this.findEndpoints(_edge),_this.tryToCorrectInvalidPoints(_edge,passedPairInfo),_this.checkForInvalidEdgeWarning(_edge),_this.storeAllpts(_edge),_this.storeEdgeProjections(_edge),_this.calculateArrowAngles(_edge),_this.recalculateEdgeLabelProjections(_edge),_this.calculateLabelAngles(_edge)}},p2=0;p2<pairIds.length;p2++)_loop();this.findHaystackPoints(haystackEdges)}};function getPts(pts2){var retPts=[];if(pts2!=null){for(var i=0;i<pts2.length;i+=2){var x2=pts2[i],y2=pts2[i+1];retPts.push({x:x2,y:y2})}return retPts}}BRp$c.getSegmentPoints=function(edge){var rs=edge[0]._private.rscratch;this.recalculateRenderedStyle(edge);var type=rs.edgeType;if(type==="segments")return getPts(rs.segpts)};BRp$c.getControlPoints=function(edge){var rs=edge[0]._private.rscratch;this.recalculateRenderedStyle(edge);var type=rs.edgeType;if(type==="bezier"||type==="multibezier"||type==="self"||type==="compound")return getPts(rs.ctrlpts)};BRp$c.getEdgeMidpoint=function(edge){var rs=edge[0]._private.rscratch;return this.recalculateRenderedStyle(edge),{x:rs.midX,y:rs.midY}};var BRp$b={};BRp$b.manualEndptToPx=function(node,prop){var r=this,npos=node.position(),w=node.outerWidth(),h=node.outerHeight(),rs=node._private.rscratch;if(prop.value.length===2){var p2=[prop.pfValue[0],prop.pfValue[1]];return prop.units[0]==="%"&&(p2[0]=p2[0]*w),prop.units[1]==="%"&&(p2[1]=p2[1]*h),p2[0]+=npos.x,p2[1]+=npos.y,p2}else{var angle2=prop.pfValue[0];angle2=-Math.PI/2+angle2;var l=2*Math.max(w,h),_p=[npos.x+Math.cos(angle2)*l,npos.y+Math.sin(angle2)*l];return r.nodeShapes[this.getNodeShape(node)].intersectLine(npos.x,npos.y,w,h,_p[0],_p[1],0,node.pstyle("corner-radius").value==="auto"?"auto":node.pstyle("corner-radius").pfValue,rs)}};BRp$b.findEndpoints=function(edge){var _ref,_tgtManEndpt$pfValue,_ref2,_srcManEndpt$pfValue,r=this,intersect2,source=edge.source()[0],target=edge.target()[0],srcPos=source.position(),tgtPos=target.position(),tgtArShape=edge.pstyle("target-arrow-shape").value,srcArShape=edge.pstyle("source-arrow-shape").value,tgtDist=edge.pstyle("target-distance-from-node").pfValue,srcDist=edge.pstyle("source-distance-from-node").pfValue,srcRs=source._private.rscratch,tgtRs=target._private.rscratch,curveStyle=edge.pstyle("curve-style").value,rs=edge._private.rscratch,et=rs.edgeType,taxi=endsWith(curveStyle,"taxi"),self2=et==="self"||et==="compound",bezier=et==="bezier"||et==="multibezier"||self2,multi=et!=="bezier",lines=et==="straight"||et==="segments",segments=et==="segments",hasEndpts=bezier||multi||lines,overrideEndpts=self2||taxi,srcManEndpt=edge.pstyle("source-endpoint"),srcManEndptVal=overrideEndpts?"outside-to-node":srcManEndpt.value,srcCornerRadius=source.pstyle("corner-radius").value==="auto"?"auto":source.pstyle("corner-radius").pfValue,tgtManEndpt=edge.pstyle("target-endpoint"),tgtManEndptVal=overrideEndpts?"outside-to-node":tgtManEndpt.value,tgtCornerRadius=target.pstyle("corner-radius").value==="auto"?"auto":target.pstyle("corner-radius").pfValue;rs.srcManEndpt=srcManEndpt,rs.tgtManEndpt=tgtManEndpt;var p1,p2,p1_i,p2_i,tgtManEndptPt=(_ref=(tgtManEndpt==null||(_tgtManEndpt$pfValue=tgtManEndpt.pfValue)===null||_tgtManEndpt$pfValue===void 0?void 0:_tgtManEndpt$pfValue.length)===2?tgtManEndpt.pfValue:null)!==null&&_ref!==void 0?_ref:[0,0],srcManEndptPt=(_ref2=(srcManEndpt==null||(_srcManEndpt$pfValue=srcManEndpt.pfValue)===null||_srcManEndpt$pfValue===void 0?void 0:_srcManEndpt$pfValue.length)===2?srcManEndpt.pfValue:null)!==null&&_ref2!==void 0?_ref2:[0,0];if(bezier){var cpStart=[rs.ctrlpts[0],rs.ctrlpts[1]],cpEnd=multi?[rs.ctrlpts[rs.ctrlpts.length-2],rs.ctrlpts[rs.ctrlpts.length-1]]:cpStart;p1=cpEnd,p2=cpStart}else if(lines){var srcArrowFromPt=segments?rs.segpts.slice(0,2):[tgtPos.x+tgtManEndptPt[0],tgtPos.y+tgtManEndptPt[1]],tgtArrowFromPt=segments?rs.segpts.slice(rs.segpts.length-2):[srcPos.x+srcManEndptPt[0],srcPos.y+srcManEndptPt[1]];p1=tgtArrowFromPt,p2=srcArrowFromPt}if(tgtManEndptVal==="inside-to-node")intersect2=[tgtPos.x,tgtPos.y];else if(tgtManEndpt.units)intersect2=this.manualEndptToPx(target,tgtManEndpt);else if(tgtManEndptVal==="outside-to-line")intersect2=rs.tgtIntn;else if(tgtManEndptVal==="outside-to-node"||tgtManEndptVal==="outside-to-node-or-label"?p1_i=p1:(tgtManEndptVal==="outside-to-line"||tgtManEndptVal==="outside-to-line-or-label")&&(p1_i=[srcPos.x,srcPos.y]),intersect2=r.nodeShapes[this.getNodeShape(target)].intersectLine(tgtPos.x,tgtPos.y,target.outerWidth(),target.outerHeight(),p1_i[0],p1_i[1],0,tgtCornerRadius,tgtRs),tgtManEndptVal==="outside-to-node-or-label"||tgtManEndptVal==="outside-to-line-or-label"){var trs=target._private.rscratch,lw=trs.labelWidth,lh=trs.labelHeight,lx=trs.labelX,ly=trs.labelY,lw2=lw/2,lh2=lh/2,va=target.pstyle("text-valign").value;va==="top"?ly-=lh2:va==="bottom"&&(ly+=lh2);var ha=target.pstyle("text-halign").value;ha==="left"?lx-=lw2:ha==="right"&&(lx+=lw2);var labelIntersect=polygonIntersectLine(p1_i[0],p1_i[1],[lx-lw2,ly-lh2,lx+lw2,ly-lh2,lx+lw2,ly+lh2,lx-lw2,ly+lh2],tgtPos.x,tgtPos.y);if(labelIntersect.length>0){var refPt=srcPos,intSqdist=sqdist(refPt,array2point(intersect2)),labIntSqdist=sqdist(refPt,array2point(labelIntersect)),minSqDist=intSqdist;if(labIntSqdist<intSqdist&&(intersect2=labelIntersect,minSqDist=labIntSqdist),labelIntersect.length>2){var labInt2SqDist=sqdist(refPt,{x:labelIntersect[2],y:labelIntersect[3]});labInt2SqDist<minSqDist&&(intersect2=[labelIntersect[2],labelIntersect[3]])}}}var arrowEnd=shortenIntersection(intersect2,p1,r.arrowShapes[tgtArShape].spacing(edge)+tgtDist),edgeEnd=shortenIntersection(intersect2,p1,r.arrowShapes[tgtArShape].gap(edge)+tgtDist);if(rs.endX=edgeEnd[0],rs.endY=edgeEnd[1],rs.arrowEndX=arrowEnd[0],rs.arrowEndY=arrowEnd[1],srcManEndptVal==="inside-to-node")intersect2=[srcPos.x,srcPos.y];else if(srcManEndpt.units)intersect2=this.manualEndptToPx(source,srcManEndpt);else if(srcManEndptVal==="outside-to-line")intersect2=rs.srcIntn;else if(srcManEndptVal==="outside-to-node"||srcManEndptVal==="outside-to-node-or-label"?p2_i=p2:(srcManEndptVal==="outside-to-line"||srcManEndptVal==="outside-to-line-or-label")&&(p2_i=[tgtPos.x,tgtPos.y]),intersect2=r.nodeShapes[this.getNodeShape(source)].intersectLine(srcPos.x,srcPos.y,source.outerWidth(),source.outerHeight(),p2_i[0],p2_i[1],0,srcCornerRadius,srcRs),srcManEndptVal==="outside-to-node-or-label"||srcManEndptVal==="outside-to-line-or-label"){var srs=source._private.rscratch,_lw=srs.labelWidth,_lh=srs.labelHeight,_lx=srs.labelX,_ly=srs.labelY,_lw2=_lw/2,_lh2=_lh/2,_va=source.pstyle("text-valign").value;_va==="top"?_ly-=_lh2:_va==="bottom"&&(_ly+=_lh2);var _ha=source.pstyle("text-halign").value;_ha==="left"?_lx-=_lw2:_ha==="right"&&(_lx+=_lw2);var _labelIntersect=polygonIntersectLine(p2_i[0],p2_i[1],[_lx-_lw2,_ly-_lh2,_lx+_lw2,_ly-_lh2,_lx+_lw2,_ly+_lh2,_lx-_lw2,_ly+_lh2],srcPos.x,srcPos.y);if(_labelIntersect.length>0){var _refPt=tgtPos,_intSqdist=sqdist(_refPt,array2point(intersect2)),_labIntSqdist=sqdist(_refPt,array2point(_labelIntersect)),_minSqDist=_intSqdist;if(_labIntSqdist<_intSqdist&&(intersect2=[_labelIntersect[0],_labelIntersect[1]],_minSqDist=_labIntSqdist),_labelIntersect.length>2){var _labInt2SqDist=sqdist(_refPt,{x:_labelIntersect[2],y:_labelIntersect[3]});_labInt2SqDist<_minSqDist&&(intersect2=[_labelIntersect[2],_labelIntersect[3]])}}}var arrowStart=shortenIntersection(intersect2,p2,r.arrowShapes[srcArShape].spacing(edge)+srcDist),edgeStart=shortenIntersection(intersect2,p2,r.arrowShapes[srcArShape].gap(edge)+srcDist);rs.startX=edgeStart[0],rs.startY=edgeStart[1],rs.arrowStartX=arrowStart[0],rs.arrowStartY=arrowStart[1],hasEndpts&&(!number$1(rs.startX)||!number$1(rs.startY)||!number$1(rs.endX)||!number$1(rs.endY)?rs.badLine=!0:rs.badLine=!1)};BRp$b.getSourceEndpoint=function(edge){var rs=edge[0]._private.rscratch;switch(this.recalculateRenderedStyle(edge),rs.edgeType){case"haystack":return{x:rs.haystackPts[0],y:rs.haystackPts[1]};default:return{x:rs.arrowStartX,y:rs.arrowStartY}}};BRp$b.getTargetEndpoint=function(edge){var rs=edge[0]._private.rscratch;switch(this.recalculateRenderedStyle(edge),rs.edgeType){case"haystack":return{x:rs.haystackPts[2],y:rs.haystackPts[3]};default:return{x:rs.arrowEndX,y:rs.arrowEndY}}};var BRp$a={};function pushBezierPts(r,edge,pts2){for(var qbezierAt$1=function(p1,p22,p3,t){return qbezierAt(p1,p22,p3,t)},_p=edge._private,bpts=_p.rstyle.bezierPts,i=0;i<r.bezierProjPcts.length;i++){var p2=r.bezierProjPcts[i];bpts.push({x:qbezierAt$1(pts2[0],pts2[2],pts2[4],p2),y:qbezierAt$1(pts2[1],pts2[3],pts2[5],p2)})}}BRp$a.storeEdgeProjections=function(edge){var _p=edge._private,rs=_p.rscratch,et=rs.edgeType;if(_p.rstyle.bezierPts=null,_p.rstyle.linePts=null,_p.rstyle.haystackPts=null,et==="multibezier"||et==="bezier"||et==="self"||et==="compound"){_p.rstyle.bezierPts=[];for(var i=0;i+5<rs.allpts.length;i+=4)pushBezierPts(this,edge,rs.allpts.slice(i,i+6))}else if(et==="segments")for(var lpts=_p.rstyle.linePts=[],i=0;i+1<rs.allpts.length;i+=2)lpts.push({x:rs.allpts[i],y:rs.allpts[i+1]});else if(et==="haystack"){var hpts=rs.haystackPts;_p.rstyle.haystackPts=[{x:hpts[0],y:hpts[1]},{x:hpts[2],y:hpts[3]}]}_p.rstyle.arrowWidth=this.getArrowWidth(edge.pstyle("width").pfValue,edge.pstyle("arrow-scale").value)*this.arrowShapeWidth};BRp$a.recalculateEdgeProjections=function(edges3){this.findEdgeControlPoints(edges3)};var BRp$9={};BRp$9.recalculateNodeLabelProjection=function(node){var content=node.pstyle("label").strValue;if(!emptyString(content)){var textX,textY,_p=node._private,nodeWidth=node.width(),nodeHeight=node.height(),padding=node.padding(),nodePos=node.position(),textHalign=node.pstyle("text-halign").strValue,textValign=node.pstyle("text-valign").strValue,rs=_p.rscratch,rstyle=_p.rstyle;switch(textHalign){case"left":textX=nodePos.x-nodeWidth/2-padding;break;case"right":textX=nodePos.x+nodeWidth/2+padding;break;default:textX=nodePos.x}switch(textValign){case"top":textY=nodePos.y-nodeHeight/2-padding;break;case"bottom":textY=nodePos.y+nodeHeight/2+padding;break;default:textY=nodePos.y}rs.labelX=textX,rs.labelY=textY,rstyle.labelX=textX,rstyle.labelY=textY,this.calculateLabelAngles(node),this.applyLabelDimensions(node)}};var lineAngleFromDelta=function(dx,dy){var angle2=Math.atan(dy/dx);return dx===0&&angle2<0&&(angle2=angle2*-1),angle2},lineAngle=function(p0,p1){var dx=p1.x-p0.x,dy=p1.y-p0.y;return lineAngleFromDelta(dx,dy)},bezierAngle=function(p0,p1,p2,t){var t0=bound(0,t-.001,1),t1=bound(0,t+.001,1),lp0=qbezierPtAt(p0,p1,p2,t0),lp1=qbezierPtAt(p0,p1,p2,t1);return lineAngle(lp0,lp1)};BRp$9.recalculateEdgeLabelProjections=function(edge){var p2,_p=edge._private,rs=_p.rscratch,r=this,content={mid:edge.pstyle("label").strValue,source:edge.pstyle("source-label").strValue,target:edge.pstyle("target-label").strValue};if(content.mid||content.source||content.target){p2={x:rs.midX,y:rs.midY};var setRs=function(propName,prefix,value){setPrefixedProperty(_p.rscratch,propName,prefix,value),setPrefixedProperty(_p.rstyle,propName,prefix,value)};setRs("labelX",null,p2.x),setRs("labelY",null,p2.y);var midAngle=lineAngleFromDelta(rs.midDispX,rs.midDispY);setRs("labelAutoAngle",null,midAngle);var _createControlPointInfo=function(){if(_createControlPointInfo.cache)return _createControlPointInfo.cache;for(var ctrlpts=[],i=0;i+5<rs.allpts.length;i+=4){var p0={x:rs.allpts[i],y:rs.allpts[i+1]},p1={x:rs.allpts[i+2],y:rs.allpts[i+3]},p22={x:rs.allpts[i+4],y:rs.allpts[i+5]};ctrlpts.push({p0,p1,p2:p22,startDist:0,length:0,segments:[]})}var bpts=_p.rstyle.bezierPts,nProjs=r.bezierProjPcts.length;function addSegment(cp2,p02,p12,t0,t1){var length=dist(p02,p12),prevSegment=cp2.segments[cp2.segments.length-1],segment={p0:p02,p1:p12,t0,t1,startDist:prevSegment?prevSegment.startDist+prevSegment.length:0,length};cp2.segments.push(segment),cp2.length+=length}for(var _i=0;_i<ctrlpts.length;_i++){var cp=ctrlpts[_i],prevCp=ctrlpts[_i-1];prevCp&&(cp.startDist=prevCp.startDist+prevCp.length),addSegment(cp,cp.p0,bpts[_i*nProjs],0,r.bezierProjPcts[0]);for(var j=0;j<nProjs-1;j++)addSegment(cp,bpts[_i*nProjs+j],bpts[_i*nProjs+j+1],r.bezierProjPcts[j],r.bezierProjPcts[j+1]);addSegment(cp,bpts[_i*nProjs+nProjs-1],cp.p2,r.bezierProjPcts[nProjs-1],1)}return _createControlPointInfo.cache=ctrlpts},calculateEndProjection=function(prefix){var angle2,isSrc=prefix==="source";if(content[prefix]){var offset=edge.pstyle(prefix+"-text-offset").pfValue;switch(rs.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var cps=_createControlPointInfo(),selected,startDist=0,totalDist=0,i=0;i<cps.length;i++){for(var _cp=cps[isSrc?i:cps.length-1-i],j=0;j<_cp.segments.length;j++){var _seg=_cp.segments[isSrc?j:_cp.segments.length-1-j],lastSeg=i===cps.length-1&&j===_cp.segments.length-1;if(startDist=totalDist,totalDist+=_seg.length,totalDist>=offset||lastSeg){selected={cp:_cp,segment:_seg};break}}if(selected)break}var cp=selected.cp,seg=selected.segment,tSegment=(offset-startDist)/seg.length,segDt=seg.t1-seg.t0,t=isSrc?seg.t0+segDt*tSegment:seg.t1-segDt*tSegment;t=bound(0,t,1),p2=qbezierPtAt(cp.p0,cp.p1,cp.p2,t),angle2=bezierAngle(cp.p0,cp.p1,cp.p2,t);break}case"straight":case"segments":case"haystack":{for(var d=0,di,d0,p0,p1,l=rs.allpts.length,_i2=0;_i2+3<l&&(isSrc?(p0={x:rs.allpts[_i2],y:rs.allpts[_i2+1]},p1={x:rs.allpts[_i2+2],y:rs.allpts[_i2+3]}):(p0={x:rs.allpts[l-2-_i2],y:rs.allpts[l-1-_i2]},p1={x:rs.allpts[l-4-_i2],y:rs.allpts[l-3-_i2]}),di=dist(p0,p1),d0=d,d+=di,!(d>=offset));_i2+=2);var pD=offset-d0,_t=pD/di;_t=bound(0,_t,1),p2=lineAt(p0,p1,_t),angle2=lineAngle(p0,p1);break}}setRs("labelX",prefix,p2.x),setRs("labelY",prefix,p2.y),setRs("labelAutoAngle",prefix,angle2)}};calculateEndProjection("source"),calculateEndProjection("target"),this.applyLabelDimensions(edge)}};BRp$9.applyLabelDimensions=function(ele){this.applyPrefixedLabelDimensions(ele),ele.isEdge()&&(this.applyPrefixedLabelDimensions(ele,"source"),this.applyPrefixedLabelDimensions(ele,"target"))};BRp$9.applyPrefixedLabelDimensions=function(ele,prefix){var _p=ele._private,text=this.getLabelText(ele,prefix),cacheKey=hashString(text,ele._private.labelDimsKey);if(getPrefixedProperty(_p.rscratch,"prefixedLabelDimsKey",prefix)!==cacheKey){setPrefixedProperty(_p.rscratch,"prefixedLabelDimsKey",prefix,cacheKey);var labelDims=this.calculateLabelDimensions(ele,text),lineHeight=ele.pstyle("line-height").pfValue,textWrap=ele.pstyle("text-wrap").strValue,lines=getPrefixedProperty(_p.rscratch,"labelWrapCachedLines",prefix)||[],numLines=textWrap!=="wrap"?1:Math.max(lines.length,1),normPerLineHeight=labelDims.height/numLines,labelLineHeight=normPerLineHeight*lineHeight,width2=labelDims.width,height2=labelDims.height+(numLines-1)*(lineHeight-1)*normPerLineHeight;setPrefixedProperty(_p.rstyle,"labelWidth",prefix,width2),setPrefixedProperty(_p.rscratch,"labelWidth",prefix,width2),setPrefixedProperty(_p.rstyle,"labelHeight",prefix,height2),setPrefixedProperty(_p.rscratch,"labelHeight",prefix,height2),setPrefixedProperty(_p.rscratch,"labelLineHeight",prefix,labelLineHeight)}};BRp$9.getLabelText=function(ele,prefix){var _p=ele._private,pfd=prefix?prefix+"-":"",text=ele.pstyle(pfd+"label").strValue,textTransform=ele.pstyle("text-transform").value,rscratch=function(propName,value){return value?(setPrefixedProperty(_p.rscratch,propName,prefix,value),value):getPrefixedProperty(_p.rscratch,propName,prefix)};if(!text)return"";textTransform=="none"||(textTransform=="uppercase"?text=text.toUpperCase():textTransform=="lowercase"&&(text=text.toLowerCase()));var wrapStyle=ele.pstyle("text-wrap").value;if(wrapStyle==="wrap"){var labelKey=rscratch("labelKey");if(labelKey!=null&&rscratch("labelWrapKey")===labelKey)return rscratch("labelWrapCachedText");for(var zwsp="",lines=text.split(`
|
|
15
|
+
`),maxW=ele.pstyle("text-max-width").pfValue,overflow=ele.pstyle("text-overflow-wrap").value,overflowAny=overflow==="anywhere",wrappedLines=[],separatorRegex=/[\s\u200b]+|$/g,l=0;l<lines.length;l++){var line=lines[l],lineDims=this.calculateLabelDimensions(ele,line),lineW=lineDims.width;if(overflowAny){var processedLine=line.split("").join(zwsp);line=processedLine}if(lineW>maxW){var separatorMatches=line.matchAll(separatorRegex),subline="",previousIndex=0,_iterator=_createForOfIteratorHelper(separatorMatches),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var separatorMatch=_step.value,wordSeparator=separatorMatch[0],word=line.substring(previousIndex,separatorMatch.index);previousIndex=separatorMatch.index+wordSeparator.length;var testLine=subline.length===0?word:subline+word+wordSeparator,testDims=this.calculateLabelDimensions(ele,testLine),testW=testDims.width;testW<=maxW?subline+=word+wordSeparator:(subline&&wrappedLines.push(subline),subline=word+wordSeparator)}}catch(err){_iterator.e(err)}finally{_iterator.f()}subline.match(/^[\s\u200b]+$/)||wrappedLines.push(subline)}else wrappedLines.push(line)}rscratch("labelWrapCachedLines",wrappedLines),text=rscratch("labelWrapCachedText",wrappedLines.join(`
|
|
16
|
+
`)),rscratch("labelWrapKey",labelKey)}else if(wrapStyle==="ellipsis"){var _maxW=ele.pstyle("text-max-width").pfValue,ellipsized="",ellipsis="…",incLastCh=!1;if(this.calculateLabelDimensions(ele,text).width<_maxW)return text;for(var i=0;i<text.length;i++){var widthWithNextCh=this.calculateLabelDimensions(ele,ellipsized+text[i]+ellipsis).width;if(widthWithNextCh>_maxW)break;ellipsized+=text[i],i===text.length-1&&(incLastCh=!0)}return incLastCh||(ellipsized+=ellipsis),ellipsized}return text};BRp$9.getLabelJustification=function(ele){var justification=ele.pstyle("text-justification").strValue,textHalign=ele.pstyle("text-halign").strValue;if(justification==="auto")if(ele.isNode())switch(textHalign){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return justification};BRp$9.calculateLabelDimensions=function(ele,text){var r=this,containerWindow=r.cy.window(),document2=containerWindow.document,padding=0,fStyle=ele.pstyle("font-style").strValue,size3=ele.pstyle("font-size").pfValue,family=ele.pstyle("font-family").strValue,weight8=ele.pstyle("font-weight").strValue,canvas=this.labelCalcCanvas,c2d=this.labelCalcCanvasContext;if(!canvas){canvas=this.labelCalcCanvas=document2.createElement("canvas"),c2d=this.labelCalcCanvasContext=canvas.getContext("2d");var ds=canvas.style;ds.position="absolute",ds.left="-9999px",ds.top="-9999px",ds.zIndex="-1",ds.visibility="hidden",ds.pointerEvents="none"}c2d.font="".concat(fStyle," ").concat(weight8," ").concat(size3,"px ").concat(family);for(var width2=0,height2=0,lines=text.split(`
|
|
17
|
+
`),i=0;i<lines.length;i++){var line=lines[i],metrics=c2d.measureText(line),w=Math.ceil(metrics.width),h=size3;width2=Math.max(w,width2),height2+=h}return width2+=padding,height2+=padding,{width:width2,height:height2}};BRp$9.calculateLabelAngle=function(ele,prefix){var _p=ele._private,rs=_p.rscratch,isEdge2=ele.isEdge(),prefixDash=prefix?prefix+"-":"",rot=ele.pstyle(prefixDash+"text-rotation"),rotStr=rot.strValue;return rotStr==="none"?0:isEdge2&&rotStr==="autorotate"?rs.labelAutoAngle:rotStr==="autorotate"?0:rot.pfValue};BRp$9.calculateLabelAngles=function(ele){var r=this,isEdge2=ele.isEdge(),_p=ele._private,rs=_p.rscratch;rs.labelAngle=r.calculateLabelAngle(ele),isEdge2&&(rs.sourceLabelAngle=r.calculateLabelAngle(ele,"source"),rs.targetLabelAngle=r.calculateLabelAngle(ele,"target"))};var BRp$8={},TOO_SMALL_CUT_RECT=28,warnedCutRect=!1;BRp$8.getNodeShape=function(node){var r=this,shape=node.pstyle("shape").value;if(shape==="cutrectangle"&&(node.width()<TOO_SMALL_CUT_RECT||node.height()<TOO_SMALL_CUT_RECT))return warnedCutRect||(warn("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),warnedCutRect=!0),"rectangle";if(node.isParent())return shape==="rectangle"||shape==="roundrectangle"||shape==="round-rectangle"||shape==="cutrectangle"||shape==="cut-rectangle"||shape==="barrel"?shape:"rectangle";if(shape==="polygon"){var points=node.pstyle("shape-polygon-points").value;return r.nodeShapes.makePolygon(points).name}return shape};var BRp$7={};BRp$7.registerCalculationListeners=function(){var cy=this.cy,elesToUpdate=cy.collection(),r=this,enqueue=function(eles){var dirtyStyleCaches=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(elesToUpdate.merge(eles),dirtyStyleCaches)for(var i=0;i<eles.length;i++){var ele=eles[i],_p=ele._private,rstyle=_p.rstyle;rstyle.clean=!1,rstyle.cleanConnected=!1}};r.binder(cy).on("bounds.* dirty.*",function(e){var ele=e.target;enqueue(ele)}).on("style.* background.*",function(e){var ele=e.target;enqueue(ele,!1)});var updateEleCalcs=function(willDraw){if(willDraw){var fns=r.onUpdateEleCalcsFns;elesToUpdate.cleanStyle();for(var i=0;i<elesToUpdate.length;i++){var ele=elesToUpdate[i],rstyle=ele._private.rstyle;ele.isNode()&&!rstyle.cleanConnected&&(enqueue(ele.connectedEdges()),rstyle.cleanConnected=!0)}if(fns)for(var _i=0;_i<fns.length;_i++){var fn3=fns[_i];fn3(willDraw,elesToUpdate)}r.recalculateRenderedStyle(elesToUpdate),elesToUpdate=cy.collection()}};r.flushRenderedStyleQueue=function(){updateEleCalcs(!0)},r.beforeRender(updateEleCalcs,r.beforeRenderPriorities.eleCalcs)};BRp$7.onUpdateEleCalcs=function(fn3){var fns=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];fns.push(fn3)};BRp$7.recalculateRenderedStyle=function(eles,useCache){var isCleanConnected=function(ele2){return ele2._private.rstyle.cleanConnected};if(eles.length!==0){var edges3=[],nodes3=[];if(!this.destroyed){useCache===void 0&&(useCache=!0);for(var i=0;i<eles.length;i++){var ele=eles[i],_p=ele._private,rstyle=_p.rstyle;ele.isEdge()&&(!isCleanConnected(ele.source())||!isCleanConnected(ele.target()))&&(rstyle.clean=!1),ele.isEdge()&&ele.isBundledBezier()&&ele.parallelEdges().some(function(ele2){return!ele2._private.rstyle.clean&&ele2.isBundledBezier()})&&(rstyle.clean=!1),!(useCache&&rstyle.clean||ele.removed())&&ele.pstyle("display").value!=="none"&&(_p.group==="nodes"?nodes3.push(ele):edges3.push(ele),rstyle.clean=!0)}for(var _i2=0;_i2<nodes3.length;_i2++){var _ele=nodes3[_i2],_p2=_ele._private,_rstyle=_p2.rstyle,pos=_ele.position();this.recalculateNodeLabelProjection(_ele),_rstyle.nodeX=pos.x,_rstyle.nodeY=pos.y,_rstyle.nodeW=_ele.pstyle("width").pfValue,_rstyle.nodeH=_ele.pstyle("height").pfValue}this.recalculateEdgeProjections(edges3);for(var _i3=0;_i3<edges3.length;_i3++){var _ele2=edges3[_i3],_p3=_ele2._private,_rstyle2=_p3.rstyle,rs=_p3.rscratch;_rstyle2.srcX=rs.arrowStartX,_rstyle2.srcY=rs.arrowStartY,_rstyle2.tgtX=rs.arrowEndX,_rstyle2.tgtY=rs.arrowEndY,_rstyle2.midX=rs.midX,_rstyle2.midY=rs.midY,_rstyle2.labelAngle=rs.labelAngle,_rstyle2.sourceLabelAngle=rs.sourceLabelAngle,_rstyle2.targetLabelAngle=rs.targetLabelAngle}}}};var BRp$6={};BRp$6.updateCachedGrabbedEles=function(){var eles=this.cachedZSortedEles;if(eles){eles.drag=[],eles.nondrag=[];for(var grabTargets=[],i=0;i<eles.length;i++){var ele=eles[i],rs=ele._private.rscratch;ele.grabbed()&&!ele.isParent()?grabTargets.push(ele):rs.inDragLayer?eles.drag.push(ele):eles.nondrag.push(ele)}for(var i=0;i<grabTargets.length;i++){var ele=grabTargets[i];eles.drag.push(ele)}}};BRp$6.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};BRp$6.getCachedZSortedEles=function(forceRecalc){if(forceRecalc||!this.cachedZSortedEles){var eles=this.cy.mutableElements().toArray();eles.sort(zIndexSort),eles.interactive=eles.filter(function(ele){return ele.interactive()}),this.cachedZSortedEles=eles,this.updateCachedGrabbedEles()}else eles=this.cachedZSortedEles;return eles};var BRp$5={};[BRp$e,BRp$d,BRp$c,BRp$b,BRp$a,BRp$9,BRp$8,BRp$7,BRp$6].forEach(function(props){extend(BRp$5,props)});var BRp$4={};BRp$4.getCachedImage=function(url,crossOrigin,onLoad){var r=this,imageCache=r.imageCache=r.imageCache||{},cache3=imageCache[url];if(cache3)return cache3.image.complete||cache3.image.addEventListener("load",onLoad),cache3.image;cache3=imageCache[url]=imageCache[url]||{};var image=cache3.image=new Image;image.addEventListener("load",onLoad),image.addEventListener("error",function(){image.error=!0});var dataUriPrefix="data:",isDataUri=url.substring(0,dataUriPrefix.length).toLowerCase()===dataUriPrefix;return isDataUri||(crossOrigin=crossOrigin==="null"?null:crossOrigin,image.crossOrigin=crossOrigin),image.src=url,image};var BRp$3={};BRp$3.registerBinding=function(target,event3,handler,useCapture){var args=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(target)){for(var res=[],i=0;i<target.length;i++){var t=target[i];if(t!==void 0){var b=this.binder(t);res.push(b.on.apply(b,args))}}return res}var b=this.binder(target);return b.on.apply(b,args)};BRp$3.binder=function(tgt){var r=this,containerWindow=r.cy.window(),tgtIsDom=tgt===containerWindow||tgt===containerWindow.document||tgt===containerWindow.document.body||domElement(tgt);if(r.supportsPassiveEvents==null){var supportsPassive=!1;try{var opts=Object.defineProperty({},"passive",{get:function(){return supportsPassive=!0,!0}});containerWindow.addEventListener("test",null,opts)}catch{}r.supportsPassiveEvents=supportsPassive}var on3=function(event3,handler,useCapture){var args=Array.prototype.slice.call(arguments);return tgtIsDom&&r.supportsPassiveEvents&&(args[2]={capture:useCapture??!1,passive:!1,once:!1}),r.bindings.push({target:tgt,args}),(tgt.addEventListener||tgt.on).apply(tgt,args),this};return{on:on3,addEventListener:on3,addListener:on3,bind:on3}};BRp$3.nodeIsDraggable=function(node){return node&&node.isNode()&&!node.locked()&&node.grabbable()};BRp$3.nodeIsGrabbable=function(node){return this.nodeIsDraggable(node)&&node.interactive()};BRp$3.load=function(){var r=this,containerWindow=r.cy.window(),isSelected=function(ele){return ele.selected()},getShadowRoot=function(element3){var rootNode=element3.getRootNode();if(rootNode&&rootNode.nodeType===11&&rootNode.host!==void 0)return rootNode},triggerEvents=function(target,names,e,position3){target==null&&(target=r.cy);for(var i=0;i<names.length;i++){var name=names[i];target.emit({originalEvent:e,type:name,position:position3})}},isMultSelKeyDown=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},allowPanningPassthrough=function(down,downs){var allowPassthrough=!0;if(r.cy.hasCompoundNodes()&&down&&down.pannable())for(var i=0;downs&&i<downs.length;i++){var down=downs[i];if(down.isNode()&&down.isParent()&&!down.pannable()){allowPassthrough=!1;break}}else allowPassthrough=!0;return allowPassthrough},setGrabbed=function(ele){ele[0]._private.grabbed=!0},setFreed=function(ele){ele[0]._private.grabbed=!1},setInDragLayer=function(ele){ele[0]._private.rscratch.inDragLayer=!0},setOutDragLayer=function(ele){ele[0]._private.rscratch.inDragLayer=!1},setGrabTarget=function(ele){ele[0]._private.rscratch.isGrabTarget=!0},removeGrabTarget=function(ele){ele[0]._private.rscratch.isGrabTarget=!1},addToDragList=function(ele,opts){var list=opts.addToList,listHasEle=list.has(ele);!listHasEle&&ele.grabbable()&&!ele.locked()&&(list.merge(ele),setGrabbed(ele))},addDescendantsToDrag=function(node,opts){if(node.cy().hasCompoundNodes()&&!(opts.inDragLayer==null&&opts.addToList==null)){var innerNodes=node.descendants();opts.inDragLayer&&(innerNodes.forEach(setInDragLayer),innerNodes.connectedEdges().forEach(setInDragLayer)),opts.addToList&&addToDragList(innerNodes,opts)}},addNodesToDrag=function(nodes3,opts){opts=opts||{};var hasCompoundNodes2=nodes3.cy().hasCompoundNodes();opts.inDragLayer&&(nodes3.forEach(setInDragLayer),nodes3.neighborhood().stdFilter(function(ele){return!hasCompoundNodes2||ele.isEdge()}).forEach(setInDragLayer)),opts.addToList&&nodes3.forEach(function(ele){addToDragList(ele,opts)}),addDescendantsToDrag(nodes3,opts),updateAncestorsInDragLayer(nodes3,{inDragLayer:opts.inDragLayer}),r.updateCachedGrabbedEles()},addNodeToDrag=addNodesToDrag,freeDraggedElements=function(grabbedEles){grabbedEles&&(r.getCachedZSortedEles().forEach(function(ele){setFreed(ele),setOutDragLayer(ele),removeGrabTarget(ele)}),r.updateCachedGrabbedEles())},updateAncestorsInDragLayer=function(node,opts){if(!(opts.inDragLayer==null&&opts.addToList==null)&&node.cy().hasCompoundNodes()){var parent4=node.ancestors().orphans();if(!parent4.same(node)){var nodes3=parent4.descendants().spawnSelf().merge(parent4).unmerge(node).unmerge(node.descendants()),edges3=nodes3.connectedEdges();opts.inDragLayer&&(edges3.forEach(setInDragLayer),nodes3.forEach(setInDragLayer)),opts.addToList&&nodes3.forEach(function(ele){addToDragList(ele,opts)})}}},blurActiveDomElement=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},haveMutationsApi=typeof MutationObserver<"u",haveResizeObserverApi=typeof ResizeObserver<"u";haveMutationsApi?(r.removeObserver=new MutationObserver(function(mutns){for(var i=0;i<mutns.length;i++){var mutn=mutns[i],rNodes=mutn.removedNodes;if(rNodes)for(var j=0;j<rNodes.length;j++){var rNode=rNodes[j];if(rNode===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(e){r.destroy()});var onResize=debounce(function(){r.cy.resize()},100);haveMutationsApi&&(r.styleObserver=new MutationObserver(onResize),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(containerWindow,"resize",onResize),haveResizeObserverApi&&(r.resizeObserver=new ResizeObserver(onResize),r.resizeObserver.observe(r.container));var forEachUp=function(domEle,fn3){for(;domEle!=null;)fn3(domEle),domEle=domEle.parentNode},invalidateCoords=function(){r.invalidateContainerClientCoordsCache()};forEachUp(r.container,function(domEle){r.registerBinding(domEle,"transitionend",invalidateCoords),r.registerBinding(domEle,"animationend",invalidateCoords),r.registerBinding(domEle,"scroll",invalidateCoords)}),r.registerBinding(r.container,"contextmenu",function(e){e.preventDefault()});var inBoxSelection=function(){return r.selection[4]!==0},eventInContainer=function(e){for(var containerPageCoords=r.findContainerClientCoords(),x2=containerPageCoords[0],y2=containerPageCoords[1],width2=containerPageCoords[2],height2=containerPageCoords[3],positions2=e.touches?e.touches:[e],atLeastOnePosInside=!1,i=0;i<positions2.length;i++){var p2=positions2[i];if(x2<=p2.clientX&&p2.clientX<=x2+width2&&y2<=p2.clientY&&p2.clientY<=y2+height2){atLeastOnePosInside=!0;break}}if(!atLeastOnePosInside)return!1;for(var container2=r.container,target=e.target,tParent=target.parentNode,containerIsTarget=!1;tParent;){if(tParent===container2){containerIsTarget=!0;break}tParent=tParent.parentNode}return!!containerIsTarget};r.registerBinding(r.container,"mousedown",function(e){if(eventInContainer(e)&&!(r.hoverData.which===1&&e.which!==1)){e.preventDefault(),blurActiveDomElement(),r.hoverData.capture=!0,r.hoverData.which=e.which;var cy=r.cy,gpos=[e.clientX,e.clientY],pos=r.projectIntoViewport(gpos[0],gpos[1]),select=r.selection,nears=r.findNearestElements(pos[0],pos[1],!0,!1),near=nears[0],draggedElements=r.dragData.possibleDragElements;r.hoverData.mdownPos=pos,r.hoverData.mdownGPos=gpos;var makeEvent=function(type){return{originalEvent:e,type,position:{x:pos[0],y:pos[1]}}},checkForTaphold=function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var ele=r.hoverData.down;ele?ele.emit(makeEvent("taphold")):cy.emit(makeEvent("taphold"))}},r.tapholdDuration)};if(e.which==3){r.hoverData.cxtStarted=!0;var cxtEvt={originalEvent:e,type:"cxttapstart",position:{x:pos[0],y:pos[1]}};near?(near.activate(),near.emit(cxtEvt),r.hoverData.down=near):cy.emit(cxtEvt),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(e.which==1){near&&near.activate();{if(near!=null&&r.nodeIsGrabbable(near)){var triggerGrab=function(ele){ele.emit(makeEvent("grab"))};if(setGrabTarget(near),!near.selected())draggedElements=r.dragData.possibleDragElements=cy.collection(),addNodeToDrag(near,{addToList:draggedElements}),near.emit(makeEvent("grabon")).emit(makeEvent("grab"));else{draggedElements=r.dragData.possibleDragElements=cy.collection();var selectedNodes=cy.$(function(ele){return ele.isNode()&&ele.selected()&&r.nodeIsGrabbable(ele)});addNodesToDrag(selectedNodes,{addToList:draggedElements}),near.emit(makeEvent("grabon")),selectedNodes.forEach(triggerGrab)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=near,r.hoverData.downs=nears,r.hoverData.downTime=new Date().getTime()}triggerEvents(near,["mousedown","tapstart","vmousedown"],e,{x:pos[0],y:pos[1]}),near==null?(select[4]=1,r.data.bgActivePosistion={x:pos[0],y:pos[1]},r.redrawHint("select",!0),r.redraw()):near.pannable()&&(select[4]=1),checkForTaphold()}select[0]=select[2]=pos[0],select[1]=select[3]=pos[1]}},!1);var shadowRoot=getShadowRoot(r.container);r.registerBinding([containerWindow,shadowRoot],"mousemove",function(e){var capture=r.hoverData.capture;if(!(!capture&&!eventInContainer(e))){var preventDefault2=!1,cy=r.cy,zoom2=cy.zoom(),gpos=[e.clientX,e.clientY],pos=r.projectIntoViewport(gpos[0],gpos[1]),mdownPos=r.hoverData.mdownPos,mdownGPos=r.hoverData.mdownGPos,select=r.selection,near=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(near=r.findNearestElement(pos[0],pos[1],!0,!1));var last2=r.hoverData.last,down=r.hoverData.down,disp=[pos[0]-select[2],pos[1]-select[3]],draggedElements=r.dragData.possibleDragElements,isOverThresholdDrag;if(mdownGPos){var dx=gpos[0]-mdownGPos[0],dx2=dx*dx,dy=gpos[1]-mdownGPos[1],dy2=dy*dy,dist22=dx2+dy2;r.hoverData.isOverThresholdDrag=isOverThresholdDrag=dist22>=r.desktopTapThreshold2}var multSelKeyDown=isMultSelKeyDown(e);isOverThresholdDrag&&(r.hoverData.tapholdCancelled=!0);var updateDragDelta=function(){var dragDelta2=r.hoverData.dragDelta=r.hoverData.dragDelta||[];dragDelta2.length===0?(dragDelta2.push(disp[0]),dragDelta2.push(disp[1])):(dragDelta2[0]+=disp[0],dragDelta2[1]+=disp[1])};preventDefault2=!0,triggerEvents(near,["mousemove","vmousemove","tapdrag"],e,{x:pos[0],y:pos[1]});var makeEvent=function(type){return{originalEvent:e,type,position:{x:pos[0],y:pos[1]}}},goIntoBoxMode=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||cy.emit(makeEvent("boxstart")),select[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(isOverThresholdDrag){var cxtEvt=makeEvent("cxtdrag");down?down.emit(cxtEvt):cy.emit(cxtEvt),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||near!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit(makeEvent("cxtdragout")),r.hoverData.cxtOver=near,near&&near.emit(makeEvent("cxtdragover")))}}else if(r.hoverData.dragging){if(preventDefault2=!0,cy.panningEnabled()&&cy.userPanningEnabled()){var deltaP;if(r.hoverData.justStartedPan){var mdPos=r.hoverData.mdownPos;deltaP={x:(pos[0]-mdPos[0])*zoom2,y:(pos[1]-mdPos[1])*zoom2},r.hoverData.justStartedPan=!1}else deltaP={x:disp[0]*zoom2,y:disp[1]*zoom2};cy.panBy(deltaP),cy.emit(makeEvent("dragpan")),r.hoverData.dragged=!0}pos=r.projectIntoViewport(e.clientX,e.clientY)}else if(select[4]==1&&(down==null||down.pannable())){if(isOverThresholdDrag){if(!r.hoverData.dragging&&cy.boxSelectionEnabled()&&(multSelKeyDown||!cy.panningEnabled()||!cy.userPanningEnabled()))goIntoBoxMode();else if(!r.hoverData.selecting&&cy.panningEnabled()&&cy.userPanningEnabled()){var allowPassthrough=allowPanningPassthrough(down,r.hoverData.downs);allowPassthrough&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,select[4]=0,r.data.bgActivePosistion=array2point(mdownPos),r.redrawHint("select",!0),r.redraw())}down&&down.pannable()&&down.active()&&down.unactivate()}}else{if(down&&down.pannable()&&down.active()&&down.unactivate(),(!down||!down.grabbed())&&near!=last2&&(last2&&triggerEvents(last2,["mouseout","tapdragout"],e,{x:pos[0],y:pos[1]}),near&&triggerEvents(near,["mouseover","tapdragover"],e,{x:pos[0],y:pos[1]}),r.hoverData.last=near),down)if(isOverThresholdDrag){if(cy.boxSelectionEnabled()&&multSelKeyDown)down&&down.grabbed()&&(freeDraggedElements(draggedElements),down.emit(makeEvent("freeon")),draggedElements.emit(makeEvent("free")),r.dragData.didDrag&&(down.emit(makeEvent("dragfreeon")),draggedElements.emit(makeEvent("dragfree")))),goIntoBoxMode();else if(down&&down.grabbed()&&r.nodeIsDraggable(down)){var justStartedDrag=!r.dragData.didDrag;justStartedDrag&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||addNodesToDrag(draggedElements,{inDragLayer:!0});var totalShift={x:0,y:0};if(number$1(disp[0])&&number$1(disp[1])&&(totalShift.x+=disp[0],totalShift.y+=disp[1],justStartedDrag)){var dragDelta=r.hoverData.dragDelta;dragDelta&&number$1(dragDelta[0])&&number$1(dragDelta[1])&&(totalShift.x+=dragDelta[0],totalShift.y+=dragDelta[1])}r.hoverData.draggingEles=!0,draggedElements.silentShift(totalShift).emit(makeEvent("position")).emit(makeEvent("drag")),r.redrawHint("drag",!0),r.redraw()}}else updateDragDelta();preventDefault2=!0}if(select[2]=pos[0],select[3]=pos[1],preventDefault2)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1);var clickTimeout,didDoubleClick,prevClickTimeStamp;r.registerBinding(containerWindow,"mouseup",function(e){if(!(r.hoverData.which===1&&e.which!==1&&r.hoverData.capture)){var capture=r.hoverData.capture;if(capture){r.hoverData.capture=!1;var cy=r.cy,pos=r.projectIntoViewport(e.clientX,e.clientY),select=r.selection,near=r.findNearestElement(pos[0],pos[1],!0,!1),draggedElements=r.dragData.possibleDragElements,down=r.hoverData.down,multSelKeyDown=isMultSelKeyDown(e);r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,down&&down.unactivate();var makeEvent=function(type){return{originalEvent:e,type,position:{x:pos[0],y:pos[1]}}};if(r.hoverData.which===3){var cxtEvt=makeEvent("cxttapend");if(down?down.emit(cxtEvt):cy.emit(cxtEvt),!r.hoverData.cxtDragged){var cxtTap=makeEvent("cxttap");down?down.emit(cxtTap):cy.emit(cxtTap)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(triggerEvents(near,["mouseup","tapend","vmouseup"],e,{x:pos[0],y:pos[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(triggerEvents(down,["click","tap","vclick"],e,{x:pos[0],y:pos[1]}),didDoubleClick=!1,e.timeStamp-prevClickTimeStamp<=cy.multiClickDebounceTime()?(clickTimeout&&clearTimeout(clickTimeout),didDoubleClick=!0,prevClickTimeStamp=null,triggerEvents(down,["dblclick","dbltap","vdblclick"],e,{x:pos[0],y:pos[1]})):(clickTimeout=setTimeout(function(){didDoubleClick||triggerEvents(down,["oneclick","onetap","voneclick"],e,{x:pos[0],y:pos[1]})},cy.multiClickDebounceTime()),prevClickTimeStamp=e.timeStamp)),down==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!isMultSelKeyDown(e)&&(cy.$(isSelected).unselect(["tapunselect"]),draggedElements.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=draggedElements=cy.collection()),near==down&&!r.dragData.didDrag&&!r.hoverData.selecting&&near!=null&&near._private.selectable&&(r.hoverData.dragging||(cy.selectionType()==="additive"||multSelKeyDown?near.selected()?near.unselect(["tapunselect"]):near.select(["tapselect"]):multSelKeyDown||(cy.$(isSelected).unmerge(near).unselect(["tapunselect"]),near.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var box=cy.collection(r.getAllInBox(select[0],select[1],select[2],select[3]));r.redrawHint("select",!0),box.length>0&&r.redrawHint("eles",!0),cy.emit(makeEvent("boxend"));var eleWouldBeSelected=function(ele){return ele.selectable()&&!ele.selected()};cy.selectionType()==="additive"||multSelKeyDown||cy.$(isSelected).unmerge(box).unselect(),box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect")),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!select[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var downWasGrabbed=down&&down.grabbed();freeDraggedElements(draggedElements),downWasGrabbed&&(down.emit(makeEvent("freeon")),draggedElements.emit(makeEvent("free")),r.dragData.didDrag&&(down.emit(makeEvent("dragfreeon")),draggedElements.emit(makeEvent("dragfree"))))}}select[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 wheelDeltas=[],wheelDeltaN=4,inaccurateScrollDevice,inaccurateScrollFactor=1e5,allAreDivisibleBy=function(list,factor){for(var i=0;i<list.length;i++)if(list[i]%factor!==0)return!1;return!0},allAreSameMagnitude=function(list){for(var firstMag=Math.abs(list[0]),i=1;i<list.length;i++)if(Math.abs(list[i])!==firstMag)return!1;return!0},wheelHandler=function(e){var clamp=!1,delta=e.deltaY;if(delta==null&&(e.wheelDeltaY!=null?delta=e.wheelDeltaY/4:e.wheelDelta!=null&&(delta=e.wheelDelta/4)),delta!==0){if(inaccurateScrollDevice==null)if(wheelDeltas.length>=wheelDeltaN){var wds=wheelDeltas;if(inaccurateScrollDevice=allAreDivisibleBy(wds,5),!inaccurateScrollDevice){var firstMag=Math.abs(wds[0]);inaccurateScrollDevice=allAreSameMagnitude(wds)&&firstMag>5}if(inaccurateScrollDevice)for(var i=0;i<wds.length;i++)inaccurateScrollFactor=Math.min(Math.abs(wds[i]),inaccurateScrollFactor)}else wheelDeltas.push(delta),clamp=!0;else inaccurateScrollDevice&&(inaccurateScrollFactor=Math.min(Math.abs(delta),inaccurateScrollFactor));if(!r.scrollingPage){var cy=r.cy,zoom2=cy.zoom(),pan2=cy.pan(),pos=r.projectIntoViewport(e.clientX,e.clientY),rpos=[pos[0]*zoom2+pan2.x,pos[1]*zoom2+pan2.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||inBoxSelection()){e.preventDefault();return}if(cy.panningEnabled()&&cy.userPanningEnabled()&&cy.zoomingEnabled()&&cy.userZoomingEnabled()){e.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);var diff2;clamp&&Math.abs(delta)>5&&(delta=signum(delta)*5),diff2=delta/-250,inaccurateScrollDevice&&(diff2/=inaccurateScrollFactor,diff2*=3),diff2=diff2*r.wheelSensitivity;var needsWheelFix=e.deltaMode===1;needsWheelFix&&(diff2*=33);var newZoom=cy.zoom()*Math.pow(10,diff2);e.type==="gesturechange"&&(newZoom=r.gestureStartZoom*e.scale),cy.zoom({level:newZoom,renderedPosition:{x:rpos[0],y:rpos[1]}}),cy.emit({type:e.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:e,position:{x:pos[0],y:pos[1]}})}}}};r.registerBinding(r.container,"wheel",wheelHandler,!0),r.registerBinding(containerWindow,"scroll",function(e){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(e){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||e.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(e){r.hasTouchStarted||wheelHandler(e)},!0),r.registerBinding(r.container,"mouseout",function(e){var pos=r.projectIntoViewport(e.clientX,e.clientY);r.cy.emit({originalEvent:e,type:"mouseout",position:{x:pos[0],y:pos[1]}})},!1),r.registerBinding(r.container,"mouseover",function(e){var pos=r.projectIntoViewport(e.clientX,e.clientY);r.cy.emit({originalEvent:e,type:"mouseover",position:{x:pos[0],y:pos[1]}})},!1);var f1x1,f1y1,f2x1,f2y1,distance1,distance1Sq,center1,modelCenter1,offsetLeft,offsetTop,containerWidth,containerHeight,twoFingersStartInside,distance=function(x1,y1,x2,y2){return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))},distanceSq=function(x1,y1,x2,y2){return(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)},touchstartHandler;r.registerBinding(r.container,"touchstart",touchstartHandler=function(e){if(r.hasTouchStarted=!0,!!eventInContainer(e)){blurActiveDomElement(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var cy=r.cy,now=r.touchData.now,earlier=r.touchData.earlier;if(e.touches[0]){var pos=r.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);now[0]=pos[0],now[1]=pos[1]}if(e.touches[1]){var pos=r.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);now[2]=pos[0],now[3]=pos[1]}if(e.touches[2]){var pos=r.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);now[4]=pos[0],now[5]=pos[1]}var makeEvent=function(type){return{originalEvent:e,type,position:{x:now[0],y:now[1]}}};if(e.touches[1]){r.touchData.singleTouchMoved=!0,freeDraggedElements(r.dragData.touchDragEles);var offsets=r.findContainerClientCoords();offsetLeft=offsets[0],offsetTop=offsets[1],containerWidth=offsets[2],containerHeight=offsets[3],f1x1=e.touches[0].clientX-offsetLeft,f1y1=e.touches[0].clientY-offsetTop,f2x1=e.touches[1].clientX-offsetLeft,f2y1=e.touches[1].clientY-offsetTop,twoFingersStartInside=0<=f1x1&&f1x1<=containerWidth&&0<=f2x1&&f2x1<=containerWidth&&0<=f1y1&&f1y1<=containerHeight&&0<=f2y1&&f2y1<=containerHeight;var pan2=cy.pan(),zoom2=cy.zoom();distance1=distance(f1x1,f1y1,f2x1,f2y1),distance1Sq=distanceSq(f1x1,f1y1,f2x1,f2y1),center1=[(f1x1+f2x1)/2,(f1y1+f2y1)/2],modelCenter1=[(center1[0]-pan2.x)/zoom2,(center1[1]-pan2.y)/zoom2];var cxtDistThreshold=200,cxtDistThresholdSq=cxtDistThreshold*cxtDistThreshold;if(distance1Sq<cxtDistThresholdSq&&!e.touches[2]){var near1=r.findNearestElement(now[0],now[1],!0,!0),near2=r.findNearestElement(now[2],now[3],!0,!0);near1&&near1.isNode()?(near1.activate().emit(makeEvent("cxttapstart")),r.touchData.start=near1):near2&&near2.isNode()?(near2.activate().emit(makeEvent("cxttapstart")),r.touchData.start=near2):cy.emit(makeEvent("cxttapstart")),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,r.redraw();return}}if(e.touches[2])cy.boxSelectionEnabled()&&e.preventDefault();else if(!e.touches[1]){if(e.touches[0]){var nears=r.findNearestElements(now[0],now[1],!0,!0),near=nears[0];if(near!=null&&(near.activate(),r.touchData.start=near,r.touchData.starts=nears,r.nodeIsGrabbable(near))){var draggedEles=r.dragData.touchDragEles=cy.collection(),selectedNodes=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),near.selected()?(selectedNodes=cy.$(function(ele){return ele.selected()&&r.nodeIsGrabbable(ele)}),addNodesToDrag(selectedNodes,{addToList:draggedEles})):addNodeToDrag(near,{addToList:draggedEles}),setGrabTarget(near),near.emit(makeEvent("grabon")),selectedNodes?selectedNodes.forEach(function(n){n.emit(makeEvent("grab"))}):near.emit(makeEvent("grab"))}triggerEvents(near,["touchstart","tapstart","vmousedown"],e,{x:now[0],y:now[1]}),near==null&&(r.data.bgActivePosistion={x:pos[0],y:pos[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(){r.touchData.singleTouchMoved===!1&&!r.pinching&&!r.touchData.selecting&&triggerEvents(r.touchData.start,["taphold"],e,{x:now[0],y:now[1]})},r.tapholdDuration)}}if(e.touches.length>=1){for(var sPos=r.touchData.startPosition=[null,null,null,null,null,null],i=0;i<now.length;i++)sPos[i]=earlier[i]=now[i];var touch0=e.touches[0];r.touchData.startGPosition=[touch0.clientX,touch0.clientY]}}},!1);var touchmoveHandler;r.registerBinding(containerWindow,"touchmove",touchmoveHandler=function(e){var capture=r.touchData.capture;if(!(!capture&&!eventInContainer(e))){var select=r.selection,cy=r.cy,now=r.touchData.now,earlier=r.touchData.earlier,zoom2=cy.zoom();if(e.touches[0]){var pos=r.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);now[0]=pos[0],now[1]=pos[1]}if(e.touches[1]){var pos=r.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);now[2]=pos[0],now[3]=pos[1]}if(e.touches[2]){var pos=r.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);now[4]=pos[0],now[5]=pos[1]}var makeEvent=function(type){return{originalEvent:e,type,position:{x:now[0],y:now[1]}}},startGPos=r.touchData.startGPosition,isOverThresholdDrag;if(capture&&e.touches[0]&&startGPos){for(var disp=[],j=0;j<now.length;j++)disp[j]=now[j]-earlier[j];var dx=e.touches[0].clientX-startGPos[0],dx2=dx*dx,dy=e.touches[0].clientY-startGPos[1],dy2=dy*dy,dist22=dx2+dy2;isOverThresholdDrag=dist22>=r.touchTapThreshold2}if(capture&&r.touchData.cxt){e.preventDefault();var f1x2=e.touches[0].clientX-offsetLeft,f1y2=e.touches[0].clientY-offsetTop,f2x2=e.touches[1].clientX-offsetLeft,f2y2=e.touches[1].clientY-offsetTop,distance2Sq=distanceSq(f1x2,f1y2,f2x2,f2y2),factorSq=distance2Sq/distance1Sq,distThreshold=150,distThresholdSq=distThreshold*distThreshold,factorThreshold=1.5,factorThresholdSq=factorThreshold*factorThreshold;if(factorSq>=factorThresholdSq||distance2Sq>=distThresholdSq){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var cxtEvt=makeEvent("cxttapend");r.touchData.start?(r.touchData.start.unactivate().emit(cxtEvt),r.touchData.start=null):cy.emit(cxtEvt)}}if(capture&&r.touchData.cxt){var cxtEvt=makeEvent("cxtdrag");r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(cxtEvt):cy.emit(cxtEvt),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var near=r.findNearestElement(now[0],now[1],!0,!0);(!r.touchData.cxtOver||near!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit(makeEvent("cxtdragout")),r.touchData.cxtOver=near,near&&near.emit(makeEvent("cxtdragover")))}else if(capture&&e.touches[2]&&cy.boxSelectionEnabled())e.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||cy.emit(makeEvent("boxstart")),r.touchData.selecting=!0,r.touchData.didSelect=!0,select[4]=1,!select||select.length===0||select[0]===void 0?(select[0]=(now[0]+now[2]+now[4])/3,select[1]=(now[1]+now[3]+now[5])/3,select[2]=(now[0]+now[2]+now[4])/3+1,select[3]=(now[1]+now[3]+now[5])/3+1):(select[2]=(now[0]+now[2]+now[4])/3,select[3]=(now[1]+now[3]+now[5])/3),r.redrawHint("select",!0),r.redraw();else if(capture&&e.touches[1]&&!r.touchData.didSelect&&cy.zoomingEnabled()&&cy.panningEnabled()&&cy.userZoomingEnabled()&&cy.userPanningEnabled()){e.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var draggedEles=r.dragData.touchDragEles;if(draggedEles){r.redrawHint("drag",!0);for(var i=0;i<draggedEles.length;i++){var de_p=draggedEles[i]._private;de_p.grabbed=!1,de_p.rscratch.inDragLayer=!1}}var _start=r.touchData.start,f1x2=e.touches[0].clientX-offsetLeft,f1y2=e.touches[0].clientY-offsetTop,f2x2=e.touches[1].clientX-offsetLeft,f2y2=e.touches[1].clientY-offsetTop,distance2=distance(f1x2,f1y2,f2x2,f2y2),factor=distance2/distance1;if(twoFingersStartInside){var df1x=f1x2-f1x1,df1y=f1y2-f1y1,df2x=f2x2-f2x1,df2y=f2y2-f2y1,tx=(df1x+df2x)/2,ty=(df1y+df2y)/2,zoom1=cy.zoom(),zoom22=zoom1*factor,pan1=cy.pan(),ctrx=modelCenter1[0]*zoom1+pan1.x,ctry=modelCenter1[1]*zoom1+pan1.y,pan2={x:-zoom22/zoom1*(ctrx-pan1.x-tx)+ctrx,y:-zoom22/zoom1*(ctry-pan1.y-ty)+ctry};if(_start&&_start.active()){var draggedEles=r.dragData.touchDragEles;freeDraggedElements(draggedEles),r.redrawHint("drag",!0),r.redrawHint("eles",!0),_start.unactivate().emit(makeEvent("freeon")),draggedEles.emit(makeEvent("free")),r.dragData.didDrag&&(_start.emit(makeEvent("dragfreeon")),draggedEles.emit(makeEvent("dragfree")))}cy.viewport({zoom:zoom22,pan:pan2,cancelOnFailedZoom:!0}),cy.emit(makeEvent("pinchzoom")),distance1=distance2,f1x1=f1x2,f1y1=f1y2,f2x1=f2x2,f2y1=f2y2,r.pinching=!0}if(e.touches[0]){var pos=r.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);now[0]=pos[0],now[1]=pos[1]}if(e.touches[1]){var pos=r.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);now[2]=pos[0],now[3]=pos[1]}if(e.touches[2]){var pos=r.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);now[4]=pos[0],now[5]=pos[1]}}else if(e.touches[0]&&!r.touchData.didSelect){var start=r.touchData.start,last2=r.touchData.last,near;if(!r.hoverData.draggingEles&&!r.swipePanning&&(near=r.findNearestElement(now[0],now[1],!0,!0)),capture&&start!=null&&e.preventDefault(),capture&&start!=null&&r.nodeIsDraggable(start))if(isOverThresholdDrag){var draggedEles=r.dragData.touchDragEles,justStartedDrag=!r.dragData.didDrag;justStartedDrag&&addNodesToDrag(draggedEles,{inDragLayer:!0}),r.dragData.didDrag=!0;var totalShift={x:0,y:0};if(number$1(disp[0])&&number$1(disp[1])&&(totalShift.x+=disp[0],totalShift.y+=disp[1],justStartedDrag)){r.redrawHint("eles",!0);var dragDelta=r.touchData.dragDelta;dragDelta&&number$1(dragDelta[0])&&number$1(dragDelta[1])&&(totalShift.x+=dragDelta[0],totalShift.y+=dragDelta[1])}r.hoverData.draggingEles=!0,draggedEles.silentShift(totalShift).emit(makeEvent("position")).emit(makeEvent("drag")),r.redrawHint("drag",!0),r.touchData.startPosition[0]==earlier[0]&&r.touchData.startPosition[1]==earlier[1]&&r.redrawHint("eles",!0),r.redraw()}else{var dragDelta=r.touchData.dragDelta=r.touchData.dragDelta||[];dragDelta.length===0?(dragDelta.push(disp[0]),dragDelta.push(disp[1])):(dragDelta[0]+=disp[0],dragDelta[1]+=disp[1])}if(triggerEvents(start||near,["touchmove","tapdrag","vmousemove"],e,{x:now[0],y:now[1]}),(!start||!start.grabbed())&&near!=last2&&(last2&&last2.emit(makeEvent("tapdragout")),near&&near.emit(makeEvent("tapdragover"))),r.touchData.last=near,capture)for(var i=0;i<now.length;i++)now[i]&&r.touchData.startPosition[i]&&isOverThresholdDrag&&(r.touchData.singleTouchMoved=!0);if(capture&&(start==null||start.pannable())&&cy.panningEnabled()&&cy.userPanningEnabled()){var allowPassthrough=allowPanningPassthrough(start,r.touchData.starts);allowPassthrough&&(e.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=array2point(r.touchData.startPosition)),r.swipePanning?(cy.panBy({x:disp[0]*zoom2,y:disp[1]*zoom2}),cy.emit(makeEvent("dragpan"))):isOverThresholdDrag&&(r.swipePanning=!0,cy.panBy({x:dx*zoom2,y:dy*zoom2}),cy.emit(makeEvent("dragpan")),start&&(start.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var pos=r.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);now[0]=pos[0],now[1]=pos[1]}}for(var j=0;j<now.length;j++)earlier[j]=now[j];capture&&e.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var touchcancelHandler;r.registerBinding(containerWindow,"touchcancel",touchcancelHandler=function(e){var start=r.touchData.start;r.touchData.capture=!1,start&&start.unactivate()});var touchendHandler,didDoubleTouch,touchTimeout,prevTouchTimeStamp;if(r.registerBinding(containerWindow,"touchend",touchendHandler=function(e){var start=r.touchData.start,capture=r.touchData.capture;if(capture)e.touches.length===0&&(r.touchData.capture=!1),e.preventDefault();else return;var select=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var cy=r.cy,zoom2=cy.zoom(),now=r.touchData.now,earlier=r.touchData.earlier;if(e.touches[0]){var pos=r.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);now[0]=pos[0],now[1]=pos[1]}if(e.touches[1]){var pos=r.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);now[2]=pos[0],now[3]=pos[1]}if(e.touches[2]){var pos=r.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);now[4]=pos[0],now[5]=pos[1]}var makeEvent=function(type){return{originalEvent:e,type,position:{x:now[0],y:now[1]}}};start&&start.unactivate();var ctxTapend;if(r.touchData.cxt){if(ctxTapend=makeEvent("cxttapend"),start?start.emit(ctxTapend):cy.emit(ctxTapend),!r.touchData.cxtDragged){var ctxTap=makeEvent("cxttap");start?start.emit(ctxTap):cy.emit(ctxTap)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!e.touches[2]&&cy.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var box=cy.collection(r.getAllInBox(select[0],select[1],select[2],select[3]));select[0]=void 0,select[1]=void 0,select[2]=void 0,select[3]=void 0,select[4]=0,r.redrawHint("select",!0),cy.emit(makeEvent("boxend"));var eleWouldBeSelected=function(ele){return ele.selectable()&&!ele.selected()};box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect")),box.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(start!=null&&start.unactivate(),e.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!e.touches[1]){if(!e.touches[0]){if(!e.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var draggedEles=r.dragData.touchDragEles;if(start!=null){var startWasGrabbed=start._private.grabbed;freeDraggedElements(draggedEles),r.redrawHint("drag",!0),r.redrawHint("eles",!0),startWasGrabbed&&(start.emit(makeEvent("freeon")),draggedEles.emit(makeEvent("free")),r.dragData.didDrag&&(start.emit(makeEvent("dragfreeon")),draggedEles.emit(makeEvent("dragfree")))),triggerEvents(start,["touchend","tapend","vmouseup","tapdragout"],e,{x:now[0],y:now[1]}),start.unactivate(),r.touchData.start=null}else{var near=r.findNearestElement(now[0],now[1],!0,!0);triggerEvents(near,["touchend","tapend","vmouseup","tapdragout"],e,{x:now[0],y:now[1]})}var dx=r.touchData.startPosition[0]-now[0],dx2=dx*dx,dy=r.touchData.startPosition[1]-now[1],dy2=dy*dy,dist22=dx2+dy2,rdist2=dist22*zoom2*zoom2;r.touchData.singleTouchMoved||(start||cy.$(":selected").unselect(["tapunselect"]),triggerEvents(start,["tap","vclick"],e,{x:now[0],y:now[1]}),didDoubleTouch=!1,e.timeStamp-prevTouchTimeStamp<=cy.multiClickDebounceTime()?(touchTimeout&&clearTimeout(touchTimeout),didDoubleTouch=!0,prevTouchTimeStamp=null,triggerEvents(start,["dbltap","vdblclick"],e,{x:now[0],y:now[1]})):(touchTimeout=setTimeout(function(){didDoubleTouch||triggerEvents(start,["onetap","voneclick"],e,{x:now[0],y:now[1]})},cy.multiClickDebounceTime()),prevTouchTimeStamp=e.timeStamp)),start!=null&&!r.dragData.didDrag&&start._private.selectable&&rdist2<r.touchTapThreshold2&&!r.pinching&&(cy.selectionType()==="single"?(cy.$(isSelected).unmerge(start).unselect(["tapunselect"]),start.select(["tapselect"])):start.selected()?start.unselect(["tapunselect"]):start.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var j=0;j<now.length;j++)earlier[j]=now[j];r.dragData.didDrag=!1,e.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),e.touches.length<2&&(e.touches.length===1&&(r.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},!1),typeof TouchEvent>"u"){var pointers=[],makeTouch=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},makePointer=function(e){return{event:e,touch:makeTouch(e)}},addPointer=function(e){pointers.push(makePointer(e))},removePointer=function(e){for(var i=0;i<pointers.length;i++){var p2=pointers[i];if(p2.event.pointerId===e.pointerId){pointers.splice(i,1);return}}},updatePointer=function(e){var p2=pointers.filter(function(p3){return p3.event.pointerId===e.pointerId})[0];p2.event=e,p2.touch=makeTouch(e)},addTouchesToEvent=function(e){e.touches=pointers.map(function(p2){return p2.touch})},pointerIsMouse=function(e){return e.pointerType==="mouse"||e.pointerType===4};r.registerBinding(r.container,"pointerdown",function(e){pointerIsMouse(e)||(e.preventDefault(),addPointer(e),addTouchesToEvent(e),touchstartHandler(e))}),r.registerBinding(r.container,"pointerup",function(e){pointerIsMouse(e)||(removePointer(e),addTouchesToEvent(e),touchendHandler(e))}),r.registerBinding(r.container,"pointercancel",function(e){pointerIsMouse(e)||(removePointer(e),addTouchesToEvent(e),touchcancelHandler(e))}),r.registerBinding(r.container,"pointermove",function(e){pointerIsMouse(e)||(e.preventDefault(),updatePointer(e),addTouchesToEvent(e),touchmoveHandler(e))})}};var BRp$2={};BRp$2.generatePolygon=function(name,points){return this.nodeShapes[name]={renderer:this,name,points,draw:function(context,centerX,centerY,width2,height2,cornerRadius){this.renderer.nodeShapeImpl("polygon",context,centerX,centerY,width2,height2,this.points)},intersectLine:function(nodeX,nodeY,width2,height2,x2,y2,padding,cornerRadius){return polygonIntersectLine(x2,y2,this.points,nodeX,nodeY,width2/2,height2/2,padding)},checkPoint:function(x2,y2,padding,width2,height2,centerX,centerY,cornerRadius){return pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2,height2,[0,-1],padding)},hasMiterBounds:name!=="rectangle",miterBounds:function(centerX,centerY,width2,height2,strokeWidth,strokePosition){return miterBox(this.points,centerX,centerY,width2,height2,strokeWidth)}}};BRp$2.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(context,centerX,centerY,width2,height2,cornerRadius){this.renderer.nodeShapeImpl(this.name,context,centerX,centerY,width2,height2)},intersectLine:function(nodeX,nodeY,width2,height2,x2,y2,padding,cornerRadius){return intersectLineEllipse(x2,y2,nodeX,nodeY,width2/2+padding,height2/2+padding)},checkPoint:function(x2,y2,padding,width2,height2,centerX,centerY,cornerRadius){return checkInEllipse(x2,y2,width2,height2,centerX,centerY,padding)}}};BRp$2.generateRoundPolygon=function(name,points){return this.nodeShapes[name]={renderer:this,name,points,getOrCreateCorners:function(centerX,centerY,width2,height2,cornerRadius,rs,field){if(rs[field]!==void 0&&rs[field+"-cx"]===centerX&&rs[field+"-cy"]===centerY)return rs[field];rs[field]=new Array(points.length/2),rs[field+"-cx"]=centerX,rs[field+"-cy"]=centerY;var halfW=width2/2,halfH=height2/2;cornerRadius=cornerRadius==="auto"?getRoundPolygonRadius(width2,height2):cornerRadius;for(var p2=new Array(points.length/2),_i=0;_i<points.length/2;_i++)p2[_i]={x:centerX+halfW*points[_i*2],y:centerY+halfH*points[_i*2+1]};var i,p1,p22,p3,len=p2.length;for(p1=p2[len-1],i=0;i<len;i++)p22=p2[i%len],p3=p2[(i+1)%len],rs[field][i]=getRoundCorner(p1,p22,p3,cornerRadius),p1=p22,p22=p3;return rs[field]},draw:function(context,centerX,centerY,width2,height2,cornerRadius,rs){this.renderer.nodeShapeImpl("round-polygon",context,centerX,centerY,width2,height2,this.points,this.getOrCreateCorners(centerX,centerY,width2,height2,cornerRadius,rs,"drawCorners"))},intersectLine:function(nodeX,nodeY,width2,height2,x2,y2,padding,cornerRadius,rs){return roundPolygonIntersectLine(x2,y2,this.points,nodeX,nodeY,width2,height2,padding,this.getOrCreateCorners(nodeX,nodeY,width2,height2,cornerRadius,rs,"corners"))},checkPoint:function(x2,y2,padding,width2,height2,centerX,centerY,cornerRadius,rs){return pointInsideRoundPolygon(x2,y2,this.points,centerX,centerY,width2,height2,this.getOrCreateCorners(centerX,centerY,width2,height2,cornerRadius,rs,"corners"))}}};BRp$2.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:generateUnitNgonPointsFitToSquare(4,0),draw:function(context,centerX,centerY,width2,height2,cornerRadius){this.renderer.nodeShapeImpl(this.name,context,centerX,centerY,width2,height2,this.points,cornerRadius)},intersectLine:function(nodeX,nodeY,width2,height2,x2,y2,padding,cornerRadius){return roundRectangleIntersectLine(x2,y2,nodeX,nodeY,width2,height2,padding,cornerRadius)},checkPoint:function(x2,y2,padding,width2,height2,centerX,centerY,cornerRadius){var halfWidth=width2/2,halfHeight=height2/2;cornerRadius=cornerRadius==="auto"?getRoundRectangleRadius(width2,height2):cornerRadius,cornerRadius=Math.min(halfWidth,halfHeight,cornerRadius);var diam=cornerRadius*2;return!!(pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2,height2-diam,[0,-1],padding)||pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2-diam,height2,[0,-1],padding)||checkInEllipse(x2,y2,diam,diam,centerX-halfWidth+cornerRadius,centerY-halfHeight+cornerRadius,padding)||checkInEllipse(x2,y2,diam,diam,centerX+halfWidth-cornerRadius,centerY-halfHeight+cornerRadius,padding)||checkInEllipse(x2,y2,diam,diam,centerX+halfWidth-cornerRadius,centerY+halfHeight-cornerRadius,padding)||checkInEllipse(x2,y2,diam,diam,centerX-halfWidth+cornerRadius,centerY+halfHeight-cornerRadius,padding))}}};BRp$2.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:getCutRectangleCornerLength(),points:generateUnitNgonPointsFitToSquare(4,0),draw:function(context,centerX,centerY,width2,height2,cornerRadius){this.renderer.nodeShapeImpl(this.name,context,centerX,centerY,width2,height2,null,cornerRadius)},generateCutTrianglePts:function(width2,height2,centerX,centerY,cornerRadius){var cl=cornerRadius==="auto"?this.cornerLength:cornerRadius,hh=height2/2,hw=width2/2,xBegin=centerX-hw,xEnd=centerX+hw,yBegin=centerY-hh,yEnd=centerY+hh;return{topLeft:[xBegin,yBegin+cl,xBegin+cl,yBegin,xBegin+cl,yBegin+cl],topRight:[xEnd-cl,yBegin,xEnd,yBegin+cl,xEnd-cl,yBegin+cl],bottomRight:[xEnd,yEnd-cl,xEnd-cl,yEnd,xEnd-cl,yEnd-cl],bottomLeft:[xBegin+cl,yEnd,xBegin,yEnd-cl,xBegin+cl,yEnd-cl]}},intersectLine:function(nodeX,nodeY,width2,height2,x2,y2,padding,cornerRadius){var cPts=this.generateCutTrianglePts(width2+2*padding,height2+2*padding,nodeX,nodeY,cornerRadius),pts2=[].concat.apply([],[cPts.topLeft.splice(0,4),cPts.topRight.splice(0,4),cPts.bottomRight.splice(0,4),cPts.bottomLeft.splice(0,4)]);return polygonIntersectLine(x2,y2,pts2,nodeX,nodeY)},checkPoint:function(x2,y2,padding,width2,height2,centerX,centerY,cornerRadius){var cl=cornerRadius==="auto"?this.cornerLength:cornerRadius;if(pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2,height2-2*cl,[0,-1],padding)||pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2-2*cl,height2,[0,-1],padding))return!0;var cutTrianglePts=this.generateCutTrianglePts(width2,height2,centerX,centerY);return pointInsidePolygonPoints(x2,y2,cutTrianglePts.topLeft)||pointInsidePolygonPoints(x2,y2,cutTrianglePts.topRight)||pointInsidePolygonPoints(x2,y2,cutTrianglePts.bottomRight)||pointInsidePolygonPoints(x2,y2,cutTrianglePts.bottomLeft)}}};BRp$2.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:generateUnitNgonPointsFitToSquare(4,0),draw:function(context,centerX,centerY,width2,height2,cornerRadius){this.renderer.nodeShapeImpl(this.name,context,centerX,centerY,width2,height2)},intersectLine:function(nodeX,nodeY,width2,height2,x2,y2,padding,cornerRadius){var t0=.15,t1=.5,t2=.85,bPts=this.generateBarrelBezierPts(width2+2*padding,height2+2*padding,nodeX,nodeY),approximateBarrelCurvePts=function(pts3){var m0=qbezierPtAt({x:pts3[0],y:pts3[1]},{x:pts3[2],y:pts3[3]},{x:pts3[4],y:pts3[5]},t0),m1=qbezierPtAt({x:pts3[0],y:pts3[1]},{x:pts3[2],y:pts3[3]},{x:pts3[4],y:pts3[5]},t1),m2=qbezierPtAt({x:pts3[0],y:pts3[1]},{x:pts3[2],y:pts3[3]},{x:pts3[4],y:pts3[5]},t2);return[pts3[0],pts3[1],m0.x,m0.y,m1.x,m1.y,m2.x,m2.y,pts3[4],pts3[5]]},pts2=[].concat(approximateBarrelCurvePts(bPts.topLeft),approximateBarrelCurvePts(bPts.topRight),approximateBarrelCurvePts(bPts.bottomRight),approximateBarrelCurvePts(bPts.bottomLeft));return polygonIntersectLine(x2,y2,pts2,nodeX,nodeY)},generateBarrelBezierPts:function(width2,height2,centerX,centerY){var hh=height2/2,hw=width2/2,xBegin=centerX-hw,xEnd=centerX+hw,yBegin=centerY-hh,yEnd=centerY+hh,curveConstants=getBarrelCurveConstants(width2,height2),hOffset=curveConstants.heightOffset,wOffset=curveConstants.widthOffset,ctrlPtXOffset=curveConstants.ctrlPtOffsetPct*width2,pts2={topLeft:[xBegin,yBegin+hOffset,xBegin+ctrlPtXOffset,yBegin,xBegin+wOffset,yBegin],topRight:[xEnd-wOffset,yBegin,xEnd-ctrlPtXOffset,yBegin,xEnd,yBegin+hOffset],bottomRight:[xEnd,yEnd-hOffset,xEnd-ctrlPtXOffset,yEnd,xEnd-wOffset,yEnd],bottomLeft:[xBegin+wOffset,yEnd,xBegin+ctrlPtXOffset,yEnd,xBegin,yEnd-hOffset]};return pts2.topLeft.isTop=!0,pts2.topRight.isTop=!0,pts2.bottomLeft.isBottom=!0,pts2.bottomRight.isBottom=!0,pts2},checkPoint:function(x2,y2,padding,width2,height2,centerX,centerY,cornerRadius){var curveConstants=getBarrelCurveConstants(width2,height2),hOffset=curveConstants.heightOffset,wOffset=curveConstants.widthOffset;if(pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2,height2-2*hOffset,[0,-1],padding)||pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2-2*wOffset,height2,[0,-1],padding))return!0;for(var barrelCurvePts=this.generateBarrelBezierPts(width2,height2,centerX,centerY),getCurveT=function(x3,y3,curvePts){var x0=curvePts[4],x1=curvePts[2],x22=curvePts[0],y02=curvePts[5],y23=curvePts[1],xMin=Math.min(x0,x22),xMax=Math.max(x0,x22),yMin=Math.min(y02,y23),yMax=Math.max(y02,y23);if(xMin<=x3&&x3<=xMax&&yMin<=y3&&y3<=yMax){var coeff=bezierPtsToQuadCoeff(x0,x1,x22),roots=solveQuadratic(coeff[0],coeff[1],coeff[2],x3),validRoots=roots.filter(function(r){return 0<=r&&r<=1});if(validRoots.length>0)return validRoots[0]}return null},curveRegions=Object.keys(barrelCurvePts),i=0;i<curveRegions.length;i++){var corner=curveRegions[i],cornerPts=barrelCurvePts[corner],t=getCurveT(x2,y2,cornerPts);if(t!=null){var y0=cornerPts[5],y1=cornerPts[3],y22=cornerPts[1],bezY=qbezierAt(y0,y1,y22,t);if(cornerPts.isTop&&bezY<=y2||cornerPts.isBottom&&y2<=bezY)return!0}}return!1}}};BRp$2.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:generateUnitNgonPointsFitToSquare(4,0),draw:function(context,centerX,centerY,width2,height2,cornerRadius){this.renderer.nodeShapeImpl(this.name,context,centerX,centerY,width2,height2,this.points,cornerRadius)},intersectLine:function(nodeX,nodeY,width2,height2,x2,y2,padding,cornerRadius){var topStartX=nodeX-(width2/2+padding),topStartY=nodeY-(height2/2+padding),topEndY=topStartY,topEndX=nodeX+(width2/2+padding),topIntersections=finiteLinesIntersect(x2,y2,nodeX,nodeY,topStartX,topStartY,topEndX,topEndY,!1);return topIntersections.length>0?topIntersections:roundRectangleIntersectLine(x2,y2,nodeX,nodeY,width2,height2,padding,cornerRadius)},checkPoint:function(x2,y2,padding,width2,height2,centerX,centerY,cornerRadius){cornerRadius=cornerRadius==="auto"?getRoundRectangleRadius(width2,height2):cornerRadius;var diam=2*cornerRadius;if(pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2,height2-diam,[0,-1],padding)||pointInsidePolygon(x2,y2,this.points,centerX,centerY,width2-diam,height2,[0,-1],padding))return!0;var outerWidth=width2/2+2*padding,outerHeight=height2/2+2*padding,points=[centerX-outerWidth,centerY-outerHeight,centerX-outerWidth,centerY,centerX+outerWidth,centerY,centerX+outerWidth,centerY-outerHeight];return!!(pointInsidePolygonPoints(x2,y2,points)||checkInEllipse(x2,y2,diam,diam,centerX+width2/2-cornerRadius,centerY+height2/2-cornerRadius,padding)||checkInEllipse(x2,y2,diam,diam,centerX-width2/2+cornerRadius,centerY+height2/2-cornerRadius,padding))}}};BRp$2.registerNodeShapes=function(){var nodeShapes=this.nodeShapes={},renderer3=this;this.generateEllipse(),this.generatePolygon("triangle",generateUnitNgonPointsFitToSquare(3,0)),this.generateRoundPolygon("round-triangle",generateUnitNgonPointsFitToSquare(3,0)),this.generatePolygon("rectangle",generateUnitNgonPointsFitToSquare(4,0)),nodeShapes.square=nodeShapes.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var diamondPoints=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",diamondPoints),this.generateRoundPolygon("round-diamond",diamondPoints)}this.generatePolygon("pentagon",generateUnitNgonPointsFitToSquare(5,0)),this.generateRoundPolygon("round-pentagon",generateUnitNgonPointsFitToSquare(5,0)),this.generatePolygon("hexagon",generateUnitNgonPointsFitToSquare(6,0)),this.generateRoundPolygon("round-hexagon",generateUnitNgonPointsFitToSquare(6,0)),this.generatePolygon("heptagon",generateUnitNgonPointsFitToSquare(7,0)),this.generateRoundPolygon("round-heptagon",generateUnitNgonPointsFitToSquare(7,0)),this.generatePolygon("octagon",generateUnitNgonPointsFitToSquare(8,0)),this.generateRoundPolygon("round-octagon",generateUnitNgonPointsFitToSquare(8,0));var star5Points=new Array(20);{var outerPoints=generateUnitNgonPoints(5,0),innerPoints=generateUnitNgonPoints(5,Math.PI/5),innerRadius=.5*(3-Math.sqrt(5));innerRadius*=1.57;for(var i=0;i<innerPoints.length/2;i++)innerPoints[i*2]*=innerRadius,innerPoints[i*2+1]*=innerRadius;for(var i=0;i<20/4;i++)star5Points[i*4]=outerPoints[i*2],star5Points[i*4+1]=outerPoints[i*2+1],star5Points[i*4+2]=innerPoints[i*2],star5Points[i*4+3]=innerPoints[i*2+1]}star5Points=fitPolygonToSquare(star5Points),this.generatePolygon("star",star5Points),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 tagPoints=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",tagPoints),this.generateRoundPolygon("round-tag",tagPoints)}nodeShapes.makePolygon=function(points){var key=points.join("$"),name="polygon-"+key,shape;return(shape=this[name])?shape:renderer3.generatePolygon(name,points)}};var BRp$1={};BRp$1.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};BRp$1.redraw=function(options2){options2=options2||staticEmptyObject();var r=this;r.averageRedrawTime===void 0&&(r.averageRedrawTime=0),r.lastRedrawTime===void 0&&(r.lastRedrawTime=0),r.lastDrawTime===void 0&&(r.lastDrawTime=0),r.requestedFrame=!0,r.renderOptions=options2};BRp$1.beforeRender=function(fn3,priority3){if(!this.destroyed){priority3==null&&error("Priority is not optional for beforeRender");var cbs=this.beforeRenderCallbacks;cbs.push({fn:fn3,priority:priority3}),cbs.sort(function(a,b){return b.priority-a.priority})}};var beforeRenderCallbacks=function(r,willDraw,startTime){for(var cbs=r.beforeRenderCallbacks,i=0;i<cbs.length;i++)cbs[i].fn(willDraw,startTime)};BRp$1.startRenderLoop=function(){var r=this,cy=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var _renderFn=function(requestTime){if(!r.destroyed){if(!cy.batching())if(r.requestedFrame&&!r.skipFrame){beforeRenderCallbacks(r,!0,requestTime);var startTime=performanceNow();r.render(r.renderOptions);var endTime=r.lastDrawTime=performanceNow();r.averageRedrawTime===void 0&&(r.averageRedrawTime=endTime-startTime),r.redrawCount===void 0&&(r.redrawCount=0),r.redrawCount++,r.redrawTotalTime===void 0&&(r.redrawTotalTime=0);var duration=endTime-startTime;r.redrawTotalTime+=duration,r.lastRedrawTime=duration,r.averageRedrawTime=r.averageRedrawTime/2+duration/2,r.requestedFrame=!1}else beforeRenderCallbacks(r,!1,requestTime);r.skipFrame=!1,requestAnimationFrame(_renderFn)}};requestAnimationFrame(_renderFn)}};var BaseRenderer=function(options2){this.init(options2)},BR=BaseRenderer,BRp=BR.prototype;BRp.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];BRp.init=function(options2){var r=this;r.options=options2,r.cy=options2.cy;var ctr=r.container=options2.cy.container(),containerWindow=r.cy.window();if(containerWindow){var document2=containerWindow.document,head=document2.head,stylesheetId="__________cytoscape_stylesheet",className="__________cytoscape_container",stylesheetAlreadyExists=document2.getElementById(stylesheetId)!=null;if(ctr.className.indexOf(className)<0&&(ctr.className=(ctr.className||"")+" "+className),!stylesheetAlreadyExists){var stylesheet3=document2.createElement("style");stylesheet3.id=stylesheetId,stylesheet3.textContent="."+className+" { position: relative; }",head.insertBefore(stylesheet3,head.children[0])}var computedStyle=containerWindow.getComputedStyle(ctr),position3=computedStyle.getPropertyValue("position");position3==="static"&&warn("A Cytoscape container has style position:static and so can not use UI extensions properly")}r.selection=[void 0,void 0,void 0,void 0,0],r.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],r.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},r.dragData={possibleDragElements:[]},r.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]},r.redraws=0,r.showFps=options2.showFps,r.debug=options2.debug,r.webgl=options2.webgl,r.hideEdgesOnViewport=options2.hideEdgesOnViewport,r.textureOnViewport=options2.textureOnViewport,r.wheelSensitivity=options2.wheelSensitivity,r.motionBlurEnabled=options2.motionBlur,r.forcedPixelRatio=number$1(options2.pixelRatio)?options2.pixelRatio:null,r.motionBlur=options2.motionBlur,r.motionBlurOpacity=options2.motionBlurOpacity,r.motionBlurTransparency=1-r.motionBlurOpacity,r.motionBlurPxRatio=1,r.mbPxRBlurry=1,r.minMbLowQualFrames=4,r.fullQualityMb=!1,r.clearedForMotionBlur=[],r.desktopTapThreshold=options2.desktopTapThreshold,r.desktopTapThreshold2=options2.desktopTapThreshold*options2.desktopTapThreshold,r.touchTapThreshold=options2.touchTapThreshold,r.touchTapThreshold2=options2.touchTapThreshold*options2.touchTapThreshold,r.tapholdDuration=500,r.bindings=[],r.beforeRenderCallbacks=[],r.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},r.registerNodeShapes(),r.registerArrowShapes(),r.registerCalculationListeners()};BRp.notify=function(eventName,eles){var r=this,cy=r.cy;if(!this.destroyed){if(eventName==="init"){r.load();return}if(eventName==="destroy"){r.destroy();return}(eventName==="add"||eventName==="remove"||eventName==="move"&&cy.hasCompoundNodes()||eventName==="load"||eventName==="zorder"||eventName==="mount")&&r.invalidateCachedZSortedEles(),eventName==="viewport"&&r.redrawHint("select",!0),eventName==="gc"&&r.redrawHint("gc",!0),(eventName==="load"||eventName==="resize"||eventName==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};BRp.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var i=0;i<r.bindings.length;i++){var binding=r.bindings[i],b=binding,tgt=b.target;(tgt.off||tgt.removeEventListener).apply(tgt,b.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{}};BRp.isHeadless=function(){return!1};[BRp$f,BRp$5,BRp$4,BRp$3,BRp$2,BRp$1].forEach(function(props){extend(BRp,props)});var fullFpsTime=1e3/60,defs={setupDequeueing:function(opts){return function(){var self2=this,r=this.renderer;if(!self2.dequeueingSetup){self2.dequeueingSetup=!0;var queueRedraw=debounce(function(){r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},opts.deqRedrawThreshold),dequeue=function(willDraw,frameStartTime){var startTime=performanceNow(),avgRenderTime=r.averageRedrawTime,renderTime=r.lastRedrawTime,deqd=[],extent2=r.cy.extent(),pixelRatio=r.getPixelRatio();for(willDraw||r.flushRenderedStyleQueue();;){var now=performanceNow(),duration=now-startTime,frameDuration=now-frameStartTime;if(renderTime<fullFpsTime){var timeAvailable=fullFpsTime-(willDraw?avgRenderTime:0);if(frameDuration>=opts.deqFastCost*timeAvailable)break}else if(willDraw){if(duration>=opts.deqCost*renderTime||duration>=opts.deqAvgCost*avgRenderTime)break}else if(frameDuration>=opts.deqNoDrawCost*fullFpsTime)break;var thisDeqd=opts.deq(self2,pixelRatio,extent2);if(thisDeqd.length>0)for(var i=0;i<thisDeqd.length;i++)deqd.push(thisDeqd[i]);else break}deqd.length>0&&(opts.onDeqd(self2,deqd),!willDraw&&opts.shouldRedraw(self2,deqd,pixelRatio,extent2)&&queueRedraw())},priority3=opts.priority||noop$1;r.beforeRender(dequeue,priority3(self2))}}}},ElementTextureCacheLookup=(function(){function ElementTextureCacheLookup2(getKey3){var doesEleInvalidateKey=arguments.length>1&&arguments[1]!==void 0?arguments[1]:falsify;_classCallCheck(this,ElementTextureCacheLookup2),this.idsByKey=new Map$1,this.keyForId=new Map$1,this.cachesByLvl=new Map$1,this.lvls=[],this.getKey=getKey3,this.doesEleInvalidateKey=doesEleInvalidateKey}return _createClass(ElementTextureCacheLookup2,[{key:"getIdsFor",value:function(key){key==null&&error("Can not get id list for null key");var idsByKey=this.idsByKey,ids=this.idsByKey.get(key);return ids||(ids=new Set$1,idsByKey.set(key,ids)),ids}},{key:"addIdForKey",value:function(key,id2){key!=null&&this.getIdsFor(key).add(id2)}},{key:"deleteIdForKey",value:function(key,id2){key!=null&&this.getIdsFor(key).delete(id2)}},{key:"getNumberOfIdsForKey",value:function(key){return key==null?0:this.getIdsFor(key).size}},{key:"updateKeyMappingFor",value:function(ele){var id2=ele.id(),prevKey=this.keyForId.get(id2),currKey=this.getKey(ele);this.deleteIdForKey(prevKey,id2),this.addIdForKey(currKey,id2),this.keyForId.set(id2,currKey)}},{key:"deleteKeyMappingFor",value:function(ele){var id2=ele.id(),prevKey=this.keyForId.get(id2);this.deleteIdForKey(prevKey,id2),this.keyForId.delete(id2)}},{key:"keyHasChangedFor",value:function(ele){var id2=ele.id(),prevKey=this.keyForId.get(id2),newKey=this.getKey(ele);return prevKey!==newKey}},{key:"isInvalid",value:function(ele){return this.keyHasChangedFor(ele)||this.doesEleInvalidateKey(ele)}},{key:"getCachesAt",value:function(lvl){var cachesByLvl=this.cachesByLvl,lvls=this.lvls,caches=cachesByLvl.get(lvl);return caches||(caches=new Map$1,cachesByLvl.set(lvl,caches),lvls.push(lvl)),caches}},{key:"getCache",value:function(key,lvl){return this.getCachesAt(lvl).get(key)}},{key:"get",value:function(ele,lvl){var key=this.getKey(ele),cache3=this.getCache(key,lvl);return cache3!=null&&this.updateKeyMappingFor(ele),cache3}},{key:"getForCachedKey",value:function(ele,lvl){var key=this.keyForId.get(ele.id()),cache3=this.getCache(key,lvl);return cache3}},{key:"hasCache",value:function(key,lvl){return this.getCachesAt(lvl).has(key)}},{key:"has",value:function(ele,lvl){var key=this.getKey(ele);return this.hasCache(key,lvl)}},{key:"setCache",value:function(key,lvl,cache3){cache3.key=key,this.getCachesAt(lvl).set(key,cache3)}},{key:"set",value:function(ele,lvl,cache3){var key=this.getKey(ele);this.setCache(key,lvl,cache3),this.updateKeyMappingFor(ele)}},{key:"deleteCache",value:function(key,lvl){this.getCachesAt(lvl).delete(key)}},{key:"delete",value:function(ele,lvl){var key=this.getKey(ele);this.deleteCache(key,lvl)}},{key:"invalidateKey",value:function(key){var _this=this;this.lvls.forEach(function(lvl){return _this.deleteCache(key,lvl)})}},{key:"invalidate",value:function(ele){var id2=ele.id(),key=this.keyForId.get(id2);this.deleteKeyMappingFor(ele);var entireKeyInvalidated=this.doesEleInvalidateKey(ele);return entireKeyInvalidated&&this.invalidateKey(key),entireKeyInvalidated||this.getNumberOfIdsForKey(key)===0}}])})(),minTxrH=25,txrStepH=50,minLvl$1=-4,maxLvl$1=3,maxZoom$1=7.99,eleTxrSpacing=8,defTxrWidth=1024,maxTxrW=1024,maxTxrH=1024,minUtility=.2,maxFullness=.8,maxFullnessChecks=10,deqCost$1=.15,deqAvgCost$1=.1,deqNoDrawCost$1=.9,deqFastCost$1=.9,deqRedrawThreshold$1=100,maxDeqSize$1=1,getTxrReasons={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},initDefaults=defaults$g({getKey:null,doesEleInvalidateKey:falsify,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:trueify,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ElementTextureCache=function(renderer3,initOptions){var self2=this;self2.renderer=renderer3,self2.onDequeues=[];var opts=initDefaults(initOptions);extend(self2,opts),self2.lookup=new ElementTextureCacheLookup(opts.getKey,opts.doesEleInvalidateKey),self2.setupDequeueing()},ETCp=ElementTextureCache.prototype;ETCp.reasons=getTxrReasons;ETCp.getTextureQueue=function(txrH){var self2=this;return self2.eleImgCaches=self2.eleImgCaches||{},self2.eleImgCaches[txrH]=self2.eleImgCaches[txrH]||[]};ETCp.getRetiredTextureQueue=function(txrH){var self2=this,rtxtrQs=self2.eleImgCaches.retired=self2.eleImgCaches.retired||{},rtxtrQ=rtxtrQs[txrH]=rtxtrQs[txrH]||[];return rtxtrQ};ETCp.getElementQueue=function(){var self2=this,q=self2.eleCacheQueue=self2.eleCacheQueue||new Heap(function(a,b){return b.reqs-a.reqs});return q};ETCp.getElementKeyToQueue=function(){var self2=this,k2q=self2.eleKeyToCacheQueue=self2.eleKeyToCacheQueue||{};return k2q};ETCp.getElement=function(ele,bb,pxRatio,lvl,reason){var self2=this,r=this.renderer,zoom2=r.cy.zoom(),lookup2=this.lookup;if(!bb||bb.w===0||bb.h===0||isNaN(bb.w)||isNaN(bb.h)||!ele.visible()||ele.removed()||!self2.allowEdgeTxrCaching&&ele.isEdge()||!self2.allowParentTxrCaching&&ele.isParent())return null;if(lvl==null&&(lvl=Math.ceil(log2(zoom2*pxRatio))),lvl<minLvl$1)lvl=minLvl$1;else if(zoom2>=maxZoom$1||lvl>maxLvl$1)return null;var scale2=Math.pow(2,lvl),eleScaledH=bb.h*scale2,eleScaledW=bb.w*scale2,scaledLabelShown=r.eleTextBiggerThanMin(ele,scale2);if(!this.isVisible(ele,scaledLabelShown))return null;var eleCache=lookup2.get(ele,lvl);if(eleCache&&eleCache.invalidated&&(eleCache.invalidated=!1,eleCache.texture.invalidatedWidth-=eleCache.width),eleCache)return eleCache;var txrH;if(eleScaledH<=minTxrH?txrH=minTxrH:eleScaledH<=txrStepH?txrH=txrStepH:txrH=Math.ceil(eleScaledH/txrStepH)*txrStepH,eleScaledH>maxTxrH||eleScaledW>maxTxrW)return null;var txrQ=self2.getTextureQueue(txrH),txr=txrQ[txrQ.length-2],addNewTxr=function(){return self2.recycleTexture(txrH,eleScaledW)||self2.addTexture(txrH,eleScaledW)};txr||(txr=txrQ[txrQ.length-1]),txr||(txr=addNewTxr()),txr.width-txr.usedWidth<eleScaledW&&(txr=addNewTxr());for(var scalableFrom=function(otherCache){return otherCache&&otherCache.scaledLabelShown===scaledLabelShown},deqing=reason&&reason===getTxrReasons.dequeue,highQualityReq=reason&&reason===getTxrReasons.highQuality,downscaleReq=reason&&reason===getTxrReasons.downscale,higherCache,l=lvl+1;l<=maxLvl$1;l++){var c=lookup2.get(ele,l);if(c){higherCache=c;break}}var oneUpCache=higherCache&&higherCache.level===lvl+1?higherCache:null,downscale=function(){txr.context.drawImage(oneUpCache.texture.canvas,oneUpCache.x,0,oneUpCache.width,oneUpCache.height,txr.usedWidth,0,eleScaledW,eleScaledH)};if(txr.context.setTransform(1,0,0,1,0,0),txr.context.clearRect(txr.usedWidth,0,eleScaledW,txrH),scalableFrom(oneUpCache))downscale();else if(scalableFrom(higherCache))if(highQualityReq){for(var _l=higherCache.level;_l>lvl;_l--)oneUpCache=self2.getElement(ele,bb,pxRatio,_l,getTxrReasons.downscale);downscale()}else return self2.queueElement(ele,higherCache.level-1),higherCache;else{var lowerCache;if(!deqing&&!highQualityReq&&!downscaleReq)for(var _l2=lvl-1;_l2>=minLvl$1;_l2--){var _c=lookup2.get(ele,_l2);if(_c){lowerCache=_c;break}}if(scalableFrom(lowerCache))return self2.queueElement(ele,lvl),lowerCache;txr.context.translate(txr.usedWidth,0),txr.context.scale(scale2,scale2),this.drawElement(txr.context,ele,bb,scaledLabelShown,!1),txr.context.scale(1/scale2,1/scale2),txr.context.translate(-txr.usedWidth,0)}return eleCache={x:txr.usedWidth,texture:txr,level:lvl,scale:scale2,width:eleScaledW,height:eleScaledH,scaledLabelShown},txr.usedWidth+=Math.ceil(eleScaledW+eleTxrSpacing),txr.eleCaches.push(eleCache),lookup2.set(ele,lvl,eleCache),self2.checkTextureFullness(txr),eleCache};ETCp.invalidateElements=function(eles){for(var i=0;i<eles.length;i++)this.invalidateElement(eles[i])};ETCp.invalidateElement=function(ele){var self2=this,lookup2=self2.lookup,caches=[],invalid=lookup2.isInvalid(ele);if(invalid){for(var lvl=minLvl$1;lvl<=maxLvl$1;lvl++){var cache3=lookup2.getForCachedKey(ele,lvl);cache3&&caches.push(cache3)}var noOtherElesUseCache=lookup2.invalidate(ele);if(noOtherElesUseCache)for(var i=0;i<caches.length;i++){var _cache=caches[i],txr=_cache.texture;txr.invalidatedWidth+=_cache.width,_cache.invalidated=!0,self2.checkTextureUtility(txr)}self2.removeFromQueue(ele)}};ETCp.checkTextureUtility=function(txr){txr.invalidatedWidth>=minUtility*txr.width&&this.retireTexture(txr)};ETCp.checkTextureFullness=function(txr){var self2=this,txrQ=self2.getTextureQueue(txr.height);txr.usedWidth/txr.width>maxFullness&&txr.fullnessChecks>=maxFullnessChecks?removeFromArray(txrQ,txr):txr.fullnessChecks++};ETCp.retireTexture=function(txr){var self2=this,txrH=txr.height,txrQ=self2.getTextureQueue(txrH),lookup2=this.lookup;removeFromArray(txrQ,txr),txr.retired=!0;for(var eleCaches=txr.eleCaches,i=0;i<eleCaches.length;i++){var eleCache=eleCaches[i];lookup2.deleteCache(eleCache.key,eleCache.level)}clearArray(eleCaches);var rtxtrQ=self2.getRetiredTextureQueue(txrH);rtxtrQ.push(txr)};ETCp.addTexture=function(txrH,minW){var self2=this,txrQ=self2.getTextureQueue(txrH),txr={};return txrQ.push(txr),txr.eleCaches=[],txr.height=txrH,txr.width=Math.max(defTxrWidth,minW),txr.usedWidth=0,txr.invalidatedWidth=0,txr.fullnessChecks=0,txr.canvas=self2.renderer.makeOffscreenCanvas(txr.width,txr.height),txr.context=txr.canvas.getContext("2d"),txr};ETCp.recycleTexture=function(txrH,minW){for(var self2=this,txrQ=self2.getTextureQueue(txrH),rtxtrQ=self2.getRetiredTextureQueue(txrH),i=0;i<rtxtrQ.length;i++){var txr=rtxtrQ[i];if(txr.width>=minW)return txr.retired=!1,txr.usedWidth=0,txr.invalidatedWidth=0,txr.fullnessChecks=0,clearArray(txr.eleCaches),txr.context.setTransform(1,0,0,1,0,0),txr.context.clearRect(0,0,txr.width,txr.height),removeFromArray(rtxtrQ,txr),txrQ.push(txr),txr}};ETCp.queueElement=function(ele,lvl){var self2=this,q=self2.getElementQueue(),k2q=self2.getElementKeyToQueue(),key=this.getKey(ele),existingReq=k2q[key];if(existingReq)existingReq.level=Math.max(existingReq.level,lvl),existingReq.eles.merge(ele),existingReq.reqs++,q.updateItem(existingReq);else{var req={eles:ele.spawn().merge(ele),level:lvl,reqs:1,key};q.push(req),k2q[key]=req}};ETCp.dequeue=function(pxRatio){for(var self2=this,q=self2.getElementQueue(),k2q=self2.getElementKeyToQueue(),dequeued=[],lookup2=self2.lookup,i=0;i<maxDeqSize$1&&q.size()>0;i++){var req=q.pop(),key=req.key,ele=req.eles[0],cacheExists=lookup2.hasCache(ele,req.level);if(k2q[key]=null,cacheExists)continue;dequeued.push(req);var bb=self2.getBoundingBox(ele);self2.getElement(ele,bb,pxRatio,req.level,getTxrReasons.dequeue)}return dequeued};ETCp.removeFromQueue=function(ele){var self2=this,q=self2.getElementQueue(),k2q=self2.getElementKeyToQueue(),key=this.getKey(ele),req=k2q[key];req!=null&&(req.eles.length===1?(req.reqs=MAX_INT$1,q.updateItem(req),q.pop(),k2q[key]=null):req.eles.unmerge(ele))};ETCp.onDequeue=function(fn3){this.onDequeues.push(fn3)};ETCp.offDequeue=function(fn3){removeFromArray(this.onDequeues,fn3)};ETCp.setupDequeueing=defs.setupDequeueing({deqRedrawThreshold:deqRedrawThreshold$1,deqCost:deqCost$1,deqAvgCost:deqAvgCost$1,deqNoDrawCost:deqNoDrawCost$1,deqFastCost:deqFastCost$1,deq:function(self2,pxRatio,extent2){return self2.dequeue(pxRatio,extent2)},onDeqd:function(self2,deqd){for(var i=0;i<self2.onDequeues.length;i++){var fn3=self2.onDequeues[i];fn3(deqd)}},shouldRedraw:function(self2,deqd,pxRatio,extent2){for(var i=0;i<deqd.length;i++)for(var eles=deqd[i].eles,j=0;j<eles.length;j++){var bb=eles[j].boundingBox();if(boundingBoxesIntersect(bb,extent2))return!0}return!1},priority:function(self2){return self2.renderer.beforeRenderPriorities.eleTxrDeq}});var defNumLayers=1,minLvl=-4,maxLvl=2,maxZoom2=3.99,deqRedrawThreshold=50,refineEleDebounceTime=50,deqCost=.15,deqAvgCost=.1,deqNoDrawCost=.9,deqFastCost=.9,maxDeqSize=1,invalidThreshold=250,maxLayerArea=4e3*4e3,maxLayerDim=32767,useHighQualityEleTxrReqs=!0,LayeredTextureCache=function(renderer3){var self2=this,r=self2.renderer=renderer3,cy=r.cy;self2.layersByLevel={},self2.firstGet=!0,self2.lastInvalidationTime=performanceNow()-2*invalidThreshold,self2.skipping=!1,self2.eleTxrDeqs=cy.collection(),self2.scheduleElementRefinement=debounce(function(){self2.refineElementTextures(self2.eleTxrDeqs),self2.eleTxrDeqs.unmerge(self2.eleTxrDeqs)},refineEleDebounceTime),r.beforeRender(function(willDraw,now){now-self2.lastInvalidationTime<=invalidThreshold?self2.skipping=!0:self2.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip);var qSort=function(a,b){return b.reqs-a.reqs};self2.layersQueue=new Heap(qSort),self2.setupDequeueing()},LTCp=LayeredTextureCache.prototype,layerIdPool=0,MAX_INT=Math.pow(2,53)-1;LTCp.makeLayer=function(bb,lvl){var scale2=Math.pow(2,lvl),w=Math.ceil(bb.w*scale2),h=Math.ceil(bb.h*scale2),canvas=this.renderer.makeOffscreenCanvas(w,h),layer={id:layerIdPool=++layerIdPool%MAX_INT,bb,level:lvl,width:w,height:h,canvas,context:canvas.getContext("2d"),eles:[],elesQueue:[],reqs:0},cxt=layer.context,dx=-layer.bb.x1,dy=-layer.bb.y1;return cxt.scale(scale2,scale2),cxt.translate(dx,dy),layer};LTCp.getLayers=function(eles,pxRatio,lvl){var self2=this,r=self2.renderer,cy=r.cy,zoom2=cy.zoom(),firstGet=self2.firstGet;if(self2.firstGet=!1,lvl==null){if(lvl=Math.ceil(log2(zoom2*pxRatio)),lvl<minLvl)lvl=minLvl;else if(zoom2>=maxZoom2||lvl>maxLvl)return null}self2.validateLayersElesOrdering(lvl,eles);var layersByLvl=self2.layersByLevel,scale2=Math.pow(2,lvl),layers=layersByLvl[lvl]=layersByLvl[lvl]||[],bb,lvlComplete=self2.levelIsComplete(lvl,eles),tmpLayers,checkTempLevels=function(){var canUseAsTmpLvl=function(l){if(self2.validateLayersElesOrdering(l,eles),self2.levelIsComplete(l,eles))return tmpLayers=layersByLvl[l],!0},checkLvls=function(dir){if(!tmpLayers)for(var l=lvl+dir;minLvl<=l&&l<=maxLvl&&!canUseAsTmpLvl(l);l+=dir);};checkLvls(1),checkLvls(-1);for(var i2=layers.length-1;i2>=0;i2--){var layer2=layers[i2];layer2.invalid&&removeFromArray(layers,layer2)}};if(!lvlComplete)checkTempLevels();else return layers;var getBb=function(){if(!bb){bb=makeBoundingBox();for(var i2=0;i2<eles.length;i2++)updateBoundingBox(bb,eles[i2].boundingBox())}return bb},makeLayer=function(opts){opts=opts||{};var after=opts.after;getBb();var w=Math.ceil(bb.w*scale2),h=Math.ceil(bb.h*scale2);if(w>maxLayerDim||h>maxLayerDim)return null;var area=w*h;if(area>maxLayerArea)return null;var layer2=self2.makeLayer(bb,lvl);if(after!=null){var index=layers.indexOf(after)+1;layers.splice(index,0,layer2)}else(opts.insert===void 0||opts.insert)&&layers.unshift(layer2);return layer2};if(self2.skipping&&!firstGet)return null;for(var layer=null,maxElesPerLayer=eles.length/defNumLayers,allowLazyQueueing=!firstGet,i=0;i<eles.length;i++){var ele=eles[i],rs=ele._private.rscratch,caches=rs.imgLayerCaches=rs.imgLayerCaches||{},existingLayer=caches[lvl];if(existingLayer){layer=existingLayer;continue}if((!layer||layer.eles.length>=maxElesPerLayer||!boundingBoxInBoundingBox(layer.bb,ele.boundingBox()))&&(layer=makeLayer({insert:!0,after:layer}),!layer))return null;tmpLayers||allowLazyQueueing?self2.queueLayer(layer,ele):self2.drawEleInLayer(layer,ele,lvl,pxRatio),layer.eles.push(ele),caches[lvl]=layer}return tmpLayers||(allowLazyQueueing?null:layers)};LTCp.getEleLevelForLayerLevel=function(lvl,pxRatio){return lvl};LTCp.drawEleInLayer=function(layer,ele,lvl,pxRatio){var self2=this,r=this.renderer,context=layer.context,bb=ele.boundingBox();bb.w===0||bb.h===0||!ele.visible()||(lvl=self2.getEleLevelForLayerLevel(lvl,pxRatio),r.setImgSmoothing(context,!1),r.drawCachedElement(context,ele,null,null,lvl,useHighQualityEleTxrReqs),r.setImgSmoothing(context,!0))};LTCp.levelIsComplete=function(lvl,eles){var self2=this,layers=self2.layersByLevel[lvl];if(!layers||layers.length===0)return!1;for(var numElesInLayers=0,i=0;i<layers.length;i++){var layer=layers[i];if(layer.reqs>0||layer.invalid)return!1;numElesInLayers+=layer.eles.length}return numElesInLayers===eles.length};LTCp.validateLayersElesOrdering=function(lvl,eles){var layers=this.layersByLevel[lvl];if(layers)for(var i=0;i<layers.length;i++){for(var layer=layers[i],offset=-1,j=0;j<eles.length;j++)if(layer.eles[0]===eles[j]){offset=j;break}if(offset<0){this.invalidateLayer(layer);continue}for(var o=offset,j=0;j<layer.eles.length;j++)if(layer.eles[j]!==eles[o+j]){this.invalidateLayer(layer);break}}};LTCp.updateElementsInLayers=function(eles,update){for(var self2=this,isEles=element(eles[0]),i=0;i<eles.length;i++)for(var req=isEles?null:eles[i],ele=isEles?eles[i]:eles[i].ele,rs=ele._private.rscratch,caches=rs.imgLayerCaches=rs.imgLayerCaches||{},l=minLvl;l<=maxLvl;l++){var layer=caches[l];layer&&(req&&self2.getEleLevelForLayerLevel(layer.level)!==req.level||update(layer,ele,req))}};LTCp.haveLayers=function(){for(var self2=this,haveLayers=!1,l=minLvl;l<=maxLvl;l++){var layers=self2.layersByLevel[l];if(layers&&layers.length>0){haveLayers=!0;break}}return haveLayers};LTCp.invalidateElements=function(eles){var self2=this;eles.length!==0&&(self2.lastInvalidationTime=performanceNow(),!(eles.length===0||!self2.haveLayers())&&self2.updateElementsInLayers(eles,function(layer,ele,req){self2.invalidateLayer(layer)}))};LTCp.invalidateLayer=function(layer){if(this.lastInvalidationTime=performanceNow(),!layer.invalid){var lvl=layer.level,eles=layer.eles,layers=this.layersByLevel[lvl];removeFromArray(layers,layer),layer.elesQueue=[],layer.invalid=!0,layer.replacement&&(layer.replacement.invalid=!0);for(var i=0;i<eles.length;i++){var caches=eles[i]._private.rscratch.imgLayerCaches;caches&&(caches[lvl]=null)}}};LTCp.refineElementTextures=function(eles){var self2=this;self2.updateElementsInLayers(eles,function(layer,ele,req){var rLyr=layer.replacement;if(rLyr||(rLyr=layer.replacement=self2.makeLayer(layer.bb,layer.level),rLyr.replaces=layer,rLyr.eles=layer.eles),!rLyr.reqs)for(var i=0;i<rLyr.eles.length;i++)self2.queueLayer(rLyr,rLyr.eles[i])})};LTCp.enqueueElementRefinement=function(ele){this.eleTxrDeqs.merge(ele),this.scheduleElementRefinement()};LTCp.queueLayer=function(layer,ele){var self2=this,q=self2.layersQueue,elesQ=layer.elesQueue,hasId=elesQ.hasId=elesQ.hasId||{};if(!layer.replacement){if(ele){if(hasId[ele.id()])return;elesQ.push(ele),hasId[ele.id()]=!0}layer.reqs?(layer.reqs++,q.updateItem(layer)):(layer.reqs=1,q.push(layer))}};LTCp.dequeue=function(pxRatio){for(var self2=this,q=self2.layersQueue,deqd=[],eleDeqs=0;eleDeqs<maxDeqSize&&q.size()!==0;){var layer=q.peek();if(layer.replacement){q.pop();continue}if(layer.replaces&&layer!==layer.replaces.replacement){q.pop();continue}if(layer.invalid){q.pop();continue}var ele=layer.elesQueue.shift();ele&&(self2.drawEleInLayer(layer,ele,layer.level,pxRatio),eleDeqs++),deqd.length===0&&deqd.push(!0),layer.elesQueue.length===0&&(q.pop(),layer.reqs=0,layer.replaces&&self2.applyLayerReplacement(layer),self2.requestRedraw())}return deqd};LTCp.applyLayerReplacement=function(layer){var self2=this,layersInLevel=self2.layersByLevel[layer.level],replaced=layer.replaces,index=layersInLevel.indexOf(replaced);if(!(index<0||replaced.invalid)){layersInLevel[index]=layer;for(var i=0;i<layer.eles.length;i++){var _p=layer.eles[i]._private,cache3=_p.imgLayerCaches=_p.imgLayerCaches||{};cache3&&(cache3[layer.level]=layer)}self2.requestRedraw()}};LTCp.requestRedraw=debounce(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);LTCp.setupDequeueing=defs.setupDequeueing({deqRedrawThreshold,deqCost,deqAvgCost,deqNoDrawCost,deqFastCost,deq:function(self2,pxRatio){return self2.dequeue(pxRatio)},onDeqd:noop$1,shouldRedraw:trueify,priority:function(self2){return self2.renderer.beforeRenderPriorities.lyrTxrDeq}});var CRp$b={},impl;function polygon(context,points){for(var i=0;i<points.length;i++){var pt=points[i];context.lineTo(pt.x,pt.y)}}function triangleBackcurve(context,points,controlPoint){for(var firstPt,i=0;i<points.length;i++){var pt=points[i];i===0&&(firstPt=pt),context.lineTo(pt.x,pt.y)}context.quadraticCurveTo(controlPoint.x,controlPoint.y,firstPt.x,firstPt.y)}function triangleTee(context,trianglePoints,teePoints){context.beginPath&&context.beginPath();for(var triPts=trianglePoints,i=0;i<triPts.length;i++){var pt=triPts[i];context.lineTo(pt.x,pt.y)}var teePts=teePoints,firstTeePt=teePoints[0];context.moveTo(firstTeePt.x,firstTeePt.y);for(var i=1;i<teePts.length;i++){var pt=teePts[i];context.lineTo(pt.x,pt.y)}context.closePath&&context.closePath()}function circleTriangle(context,trianglePoints,rx,ry,r){context.beginPath&&context.beginPath(),context.arc(rx,ry,r,0,Math.PI*2,!1);var triPts=trianglePoints,firstTrPt=triPts[0];context.moveTo(firstTrPt.x,firstTrPt.y);for(var i=0;i<triPts.length;i++){var pt=triPts[i];context.lineTo(pt.x,pt.y)}context.closePath&&context.closePath()}function circle$1(context,rx,ry,r){context.arc(rx,ry,r,0,Math.PI*2,!1)}CRp$b.arrowShapeImpl=function(name){return(impl||(impl={polygon,"triangle-backcurve":triangleBackcurve,"triangle-tee":triangleTee,"circle-triangle":circleTriangle,"triangle-cross":triangleTee,circle:circle$1}))[name]};var CRp$a={};CRp$a.drawElement=function(context,ele,shiftToOriginWithBb,showLabel,showOverlay,showOpacity){var r=this;ele.isNode()?r.drawNode(context,ele,shiftToOriginWithBb,showLabel,showOverlay,showOpacity):r.drawEdge(context,ele,shiftToOriginWithBb,showLabel,showOverlay,showOpacity)};CRp$a.drawElementOverlay=function(context,ele){var r=this;ele.isNode()?r.drawNodeOverlay(context,ele):r.drawEdgeOverlay(context,ele)};CRp$a.drawElementUnderlay=function(context,ele){var r=this;ele.isNode()?r.drawNodeUnderlay(context,ele):r.drawEdgeUnderlay(context,ele)};CRp$a.drawCachedElementPortion=function(context,ele,eleTxrCache,pxRatio,lvl,reason,getRotation,getOpacity3){var r=this,bb=eleTxrCache.getBoundingBox(ele);if(!(bb.w===0||bb.h===0)){var eleCache=eleTxrCache.getElement(ele,bb,pxRatio,lvl,reason);if(eleCache!=null){var opacity=getOpacity3(r,ele);if(opacity===0)return;var theta=getRotation(r,ele),x1=bb.x1,y1=bb.y1,w=bb.w,h=bb.h,x2,y2,sx,sy,smooth;if(theta!==0){var rotPt=eleTxrCache.getRotationPoint(ele);sx=rotPt.x,sy=rotPt.y,context.translate(sx,sy),context.rotate(theta),smooth=r.getImgSmoothing(context),smooth||r.setImgSmoothing(context,!0);var off=eleTxrCache.getRotationOffset(ele);x2=off.x,y2=off.y}else x2=x1,y2=y1;var oldGlobalAlpha;opacity!==1&&(oldGlobalAlpha=context.globalAlpha,context.globalAlpha=oldGlobalAlpha*opacity),context.drawImage(eleCache.texture.canvas,eleCache.x,0,eleCache.width,eleCache.height,x2,y2,w,h),opacity!==1&&(context.globalAlpha=oldGlobalAlpha),theta!==0&&(context.rotate(-theta),context.translate(-sx,-sy),smooth||r.setImgSmoothing(context,!1))}else eleTxrCache.drawElement(context,ele)}};var getZeroRotation=function(){return 0},getLabelRotation=function(r,ele){return r.getTextAngle(ele,null)},getSourceLabelRotation=function(r,ele){return r.getTextAngle(ele,"source")},getTargetLabelRotation=function(r,ele){return r.getTextAngle(ele,"target")},getOpacity=function(r,ele){return ele.effectiveOpacity()},getTextOpacity=function(e,ele){return ele.pstyle("text-opacity").pfValue*ele.effectiveOpacity()};CRp$a.drawCachedElement=function(context,ele,pxRatio,extent2,lvl,requestHighQuality){var r=this,_r$data=r.data,eleTxrCache=_r$data.eleTxrCache,lblTxrCache=_r$data.lblTxrCache,slbTxrCache=_r$data.slbTxrCache,tlbTxrCache=_r$data.tlbTxrCache,bb=ele.boundingBox(),reason=requestHighQuality===!0?eleTxrCache.reasons.highQuality:null;if(!(bb.w===0||bb.h===0||!ele.visible())&&(!extent2||boundingBoxesIntersect(bb,extent2))){var isEdge2=ele.isEdge(),badLine=ele.element()._private.rscratch.badLine;r.drawElementUnderlay(context,ele),r.drawCachedElementPortion(context,ele,eleTxrCache,pxRatio,lvl,reason,getZeroRotation,getOpacity),(!isEdge2||!badLine)&&r.drawCachedElementPortion(context,ele,lblTxrCache,pxRatio,lvl,reason,getLabelRotation,getTextOpacity),isEdge2&&!badLine&&(r.drawCachedElementPortion(context,ele,slbTxrCache,pxRatio,lvl,reason,getSourceLabelRotation,getTextOpacity),r.drawCachedElementPortion(context,ele,tlbTxrCache,pxRatio,lvl,reason,getTargetLabelRotation,getTextOpacity)),r.drawElementOverlay(context,ele)}};CRp$a.drawElements=function(context,eles){for(var r=this,i=0;i<eles.length;i++){var ele=eles[i];r.drawElement(context,ele)}};CRp$a.drawCachedElements=function(context,eles,pxRatio,extent2){for(var r=this,i=0;i<eles.length;i++){var ele=eles[i];r.drawCachedElement(context,ele,pxRatio,extent2)}};CRp$a.drawCachedNodes=function(context,eles,pxRatio,extent2){for(var r=this,i=0;i<eles.length;i++){var ele=eles[i];ele.isNode()&&r.drawCachedElement(context,ele,pxRatio,extent2)}};CRp$a.drawLayeredElements=function(context,eles,pxRatio,extent2){var r=this,layers=r.data.lyrTxrCache.getLayers(eles,pxRatio);if(layers)for(var i=0;i<layers.length;i++){var layer=layers[i],bb=layer.bb;bb.w===0||bb.h===0||context.drawImage(layer.canvas,bb.x1,bb.y1,bb.w,bb.h)}else r.drawCachedElements(context,eles,pxRatio,extent2)};var CRp$9={};CRp$9.drawEdge=function(context,edge,shiftToOriginWithBb){var drawLabel=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,shouldDrawOverlay=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,shouldDrawOpacity=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,r=this,rs=edge._private.rscratch;if(!(shouldDrawOpacity&&!edge.visible())&&!(rs.badLine||rs.allpts==null||isNaN(rs.allpts[0]))){var bb;shiftToOriginWithBb&&(bb=shiftToOriginWithBb,context.translate(-bb.x1,-bb.y1));var opacity=shouldDrawOpacity?edge.pstyle("opacity").value:1,lineOpacity=shouldDrawOpacity?edge.pstyle("line-opacity").value:1,curveStyle=edge.pstyle("curve-style").value,lineStyle=edge.pstyle("line-style").value,edgeWidth=edge.pstyle("width").pfValue,lineCap=edge.pstyle("line-cap").value,lineOutlineWidth=edge.pstyle("line-outline-width").value,lineOutlineColor=edge.pstyle("line-outline-color").value,effectiveLineOpacity=opacity*lineOpacity,effectiveArrowOpacity=opacity*lineOpacity,drawLine=function(){var strokeOpacity=arguments.length>0&&arguments[0]!==void 0?arguments[0]:effectiveLineOpacity;curveStyle==="straight-triangle"?(r.eleStrokeStyle(context,edge,strokeOpacity),r.drawEdgeTrianglePath(edge,context,rs.allpts)):(context.lineWidth=edgeWidth,context.lineCap=lineCap,r.eleStrokeStyle(context,edge,strokeOpacity),r.drawEdgePath(edge,context,rs.allpts,lineStyle),context.lineCap="butt")},drawLineOutline=function(){var strokeOpacity=arguments.length>0&&arguments[0]!==void 0?arguments[0]:effectiveLineOpacity;if(context.lineWidth=edgeWidth+lineOutlineWidth,context.lineCap=lineCap,lineOutlineWidth>0)r.colorStrokeStyle(context,lineOutlineColor[0],lineOutlineColor[1],lineOutlineColor[2],strokeOpacity);else{context.lineCap="butt";return}curveStyle==="straight-triangle"?r.drawEdgeTrianglePath(edge,context,rs.allpts):(r.drawEdgePath(edge,context,rs.allpts,lineStyle),context.lineCap="butt")},drawOverlay=function(){shouldDrawOverlay&&r.drawEdgeOverlay(context,edge)},drawUnderlay=function(){shouldDrawOverlay&&r.drawEdgeUnderlay(context,edge)},drawArrows=function(){var arrowOpacity=arguments.length>0&&arguments[0]!==void 0?arguments[0]:effectiveArrowOpacity;r.drawArrowheads(context,edge,arrowOpacity)},drawText=function(){r.drawElementText(context,edge,null,drawLabel)};context.lineJoin="round";var ghost=edge.pstyle("ghost").value==="yes";if(ghost){var gx=edge.pstyle("ghost-offset-x").pfValue,gy=edge.pstyle("ghost-offset-y").pfValue,ghostOpacity=edge.pstyle("ghost-opacity").value,effectiveGhostOpacity=effectiveLineOpacity*ghostOpacity;context.translate(gx,gy),drawLine(effectiveGhostOpacity),drawArrows(effectiveGhostOpacity),context.translate(-gx,-gy)}else drawLineOutline();drawUnderlay(),drawLine(),drawArrows(),drawOverlay(),drawText(),shiftToOriginWithBb&&context.translate(bb.x1,bb.y1)}};var drawEdgeOverlayUnderlay=function(overlayOrUnderlay){if(!["overlay","underlay"].includes(overlayOrUnderlay))throw new Error("Invalid state");return function(context,edge){if(edge.visible()){var opacity=edge.pstyle("".concat(overlayOrUnderlay,"-opacity")).value;if(opacity!==0){var r=this,usePaths=r.usePaths(),rs=edge._private.rscratch,padding=edge.pstyle("".concat(overlayOrUnderlay,"-padding")).pfValue,width2=2*padding,color=edge.pstyle("".concat(overlayOrUnderlay,"-color")).value;context.lineWidth=width2,rs.edgeType==="self"&&!usePaths?context.lineCap="butt":context.lineCap="round",r.colorStrokeStyle(context,color[0],color[1],color[2],opacity),r.drawEdgePath(edge,context,rs.allpts,"solid")}}}};CRp$9.drawEdgeOverlay=drawEdgeOverlayUnderlay("overlay");CRp$9.drawEdgeUnderlay=drawEdgeOverlayUnderlay("underlay");CRp$9.drawEdgePath=function(edge,context,pts2,type){var rs=edge._private.rscratch,canvasCxt=context,path,pathCacheHit=!1,usePaths=this.usePaths(),lineDashPattern=edge.pstyle("line-dash-pattern").pfValue,lineDashOffset=edge.pstyle("line-dash-offset").pfValue;if(usePaths){var pathCacheKey=pts2.join("$"),keyMatches=rs.pathCacheKey&&rs.pathCacheKey===pathCacheKey;keyMatches?(path=context=rs.pathCache,pathCacheHit=!0):(path=context=new Path2D,rs.pathCacheKey=pathCacheKey,rs.pathCache=path)}if(canvasCxt.setLineDash)switch(type){case"dotted":canvasCxt.setLineDash([1,1]);break;case"dashed":canvasCxt.setLineDash(lineDashPattern),canvasCxt.lineDashOffset=lineDashOffset;break;case"solid":canvasCxt.setLineDash([]);break}if(!pathCacheHit&&!rs.badLine)switch(context.beginPath&&context.beginPath(),context.moveTo(pts2[0],pts2[1]),rs.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var i=2;i+3<pts2.length;i+=4)context.quadraticCurveTo(pts2[i],pts2[i+1],pts2[i+2],pts2[i+3]);break;case"straight":case"haystack":for(var _i=2;_i+1<pts2.length;_i+=2)context.lineTo(pts2[_i],pts2[_i+1]);break;case"segments":if(rs.isRound){var _iterator=_createForOfIteratorHelper(rs.roundCorners),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var corner=_step.value;drawPreparedRoundCorner(context,corner)}}catch(err){_iterator.e(err)}finally{_iterator.f()}context.lineTo(pts2[pts2.length-2],pts2[pts2.length-1])}else for(var _i2=2;_i2+1<pts2.length;_i2+=2)context.lineTo(pts2[_i2],pts2[_i2+1]);break}context=canvasCxt,usePaths?context.stroke(path):context.stroke(),context.setLineDash&&context.setLineDash([])};CRp$9.drawEdgeTrianglePath=function(edge,context,pts2){context.fillStyle=context.strokeStyle;for(var edgeWidth=edge.pstyle("width").pfValue,i=0;i+1<pts2.length;i+=2){var vector=[pts2[i+2]-pts2[i],pts2[i+3]-pts2[i+1]],length=Math.sqrt(vector[0]*vector[0]+vector[1]*vector[1]),normal=[vector[1]/length,-vector[0]/length],triangleHead=[normal[0]*edgeWidth/2,normal[1]*edgeWidth/2];context.beginPath(),context.moveTo(pts2[i]-triangleHead[0],pts2[i+1]-triangleHead[1]),context.lineTo(pts2[i]+triangleHead[0],pts2[i+1]+triangleHead[1]),context.lineTo(pts2[i+2],pts2[i+3]),context.closePath(),context.fill()}};CRp$9.drawArrowheads=function(context,edge,opacity){var rs=edge._private.rscratch,isHaystack=rs.edgeType==="haystack";isHaystack||this.drawArrowhead(context,edge,"source",rs.arrowStartX,rs.arrowStartY,rs.srcArrowAngle,opacity),this.drawArrowhead(context,edge,"mid-target",rs.midX,rs.midY,rs.midtgtArrowAngle,opacity),this.drawArrowhead(context,edge,"mid-source",rs.midX,rs.midY,rs.midsrcArrowAngle,opacity),isHaystack||this.drawArrowhead(context,edge,"target",rs.arrowEndX,rs.arrowEndY,rs.tgtArrowAngle,opacity)};CRp$9.drawArrowhead=function(context,edge,prefix,x2,y2,angle2,opacity){if(!(isNaN(x2)||x2==null||isNaN(y2)||y2==null||isNaN(angle2)||angle2==null)){var self2=this,arrowShape=edge.pstyle(prefix+"-arrow-shape").value;if(arrowShape!=="none"){var arrowClearFill=edge.pstyle(prefix+"-arrow-fill").value==="hollow"?"both":"filled",arrowFill=edge.pstyle(prefix+"-arrow-fill").value,edgeWidth=edge.pstyle("width").pfValue,pArrowWidth=edge.pstyle(prefix+"-arrow-width"),arrowWidth=pArrowWidth.value==="match-line"?edgeWidth:pArrowWidth.pfValue;pArrowWidth.units==="%"&&(arrowWidth*=edgeWidth);var edgeOpacity=edge.pstyle("opacity").value;opacity===void 0&&(opacity=edgeOpacity);var gco=context.globalCompositeOperation;(opacity!==1||arrowFill==="hollow")&&(context.globalCompositeOperation="destination-out",self2.colorFillStyle(context,255,255,255,1),self2.colorStrokeStyle(context,255,255,255,1),self2.drawArrowShape(edge,context,arrowClearFill,edgeWidth,arrowShape,arrowWidth,x2,y2,angle2),context.globalCompositeOperation=gco);var color=edge.pstyle(prefix+"-arrow-color").value;self2.colorFillStyle(context,color[0],color[1],color[2],opacity),self2.colorStrokeStyle(context,color[0],color[1],color[2],opacity),self2.drawArrowShape(edge,context,arrowFill,edgeWidth,arrowShape,arrowWidth,x2,y2,angle2)}}};CRp$9.drawArrowShape=function(edge,context,fill,edgeWidth,shape,shapeWidth,x2,y2,angle2){var r=this,usePaths=this.usePaths()&&shape!=="triangle-cross",pathCacheHit=!1,path,canvasContext=context,translation={x:x2,y:y2},scale2=edge.pstyle("arrow-scale").value,size3=this.getArrowWidth(edgeWidth,scale2),shapeImpl=r.arrowShapes[shape];if(usePaths){var cache3=r.arrowPathCache=r.arrowPathCache||[],key=hashString(shape),cachedPath=cache3[key];cachedPath!=null?(path=context=cachedPath,pathCacheHit=!0):(path=context=new Path2D,cache3[key]=path)}pathCacheHit||(context.beginPath&&context.beginPath(),usePaths?shapeImpl.draw(context,1,0,{x:0,y:0},1):shapeImpl.draw(context,size3,angle2,translation,edgeWidth),context.closePath&&context.closePath()),context=canvasContext,usePaths&&(context.translate(x2,y2),context.rotate(angle2),context.scale(size3,size3)),(fill==="filled"||fill==="both")&&(usePaths?context.fill(path):context.fill()),(fill==="hollow"||fill==="both")&&(context.lineWidth=shapeWidth/(usePaths?size3:1),context.lineJoin="miter",usePaths?context.stroke(path):context.stroke()),usePaths&&(context.scale(1/size3,1/size3),context.rotate(-angle2),context.translate(-x2,-y2))};var CRp$8={};CRp$8.safeDrawImage=function(context,img,ix,iy,iw,ih,x2,y2,w,h){if(!(iw<=0||ih<=0||w<=0||h<=0))try{context.drawImage(img,ix,iy,iw,ih,x2,y2,w,h)}catch(e){warn(e)}};CRp$8.drawInscribedImage=function(context,img,node,index,nodeOpacity){var r=this,pos=node.position(),nodeX=pos.x,nodeY=pos.y,styleObj=node.cy().style(),getIndexedStyle=styleObj.getIndexedStyle.bind(styleObj),fit2=getIndexedStyle(node,"background-fit","value",index),repeat=getIndexedStyle(node,"background-repeat","value",index),nodeW=node.width(),nodeH=node.height(),paddingX2=node.padding()*2,nodeTW=nodeW+(getIndexedStyle(node,"background-width-relative-to","value",index)==="inner"?0:paddingX2),nodeTH=nodeH+(getIndexedStyle(node,"background-height-relative-to","value",index)==="inner"?0:paddingX2),rs=node._private.rscratch,clip=getIndexedStyle(node,"background-clip","value",index),shouldClip=clip==="node",imgOpacity=getIndexedStyle(node,"background-image-opacity","value",index)*nodeOpacity,smooth=getIndexedStyle(node,"background-image-smoothing","value",index),cornerRadius=node.pstyle("corner-radius").value;cornerRadius!=="auto"&&(cornerRadius=node.pstyle("corner-radius").pfValue);var imgW=img.width||img.cachedW,imgH=img.height||img.cachedH;(imgW==null||imgH==null)&&(document.body.appendChild(img),imgW=img.cachedW=img.width||img.offsetWidth,imgH=img.cachedH=img.height||img.offsetHeight,document.body.removeChild(img));var w=imgW,h=imgH;if(getIndexedStyle(node,"background-width","value",index)!=="auto"&&(getIndexedStyle(node,"background-width","units",index)==="%"?w=getIndexedStyle(node,"background-width","pfValue",index)*nodeTW:w=getIndexedStyle(node,"background-width","pfValue",index)),getIndexedStyle(node,"background-height","value",index)!=="auto"&&(getIndexedStyle(node,"background-height","units",index)==="%"?h=getIndexedStyle(node,"background-height","pfValue",index)*nodeTH:h=getIndexedStyle(node,"background-height","pfValue",index)),!(w===0||h===0)){if(fit2==="contain"){var scale2=Math.min(nodeTW/w,nodeTH/h);w*=scale2,h*=scale2}else if(fit2==="cover"){var scale2=Math.max(nodeTW/w,nodeTH/h);w*=scale2,h*=scale2}var x2=nodeX-nodeTW/2,posXUnits=getIndexedStyle(node,"background-position-x","units",index),posXPfVal=getIndexedStyle(node,"background-position-x","pfValue",index);posXUnits==="%"?x2+=(nodeTW-w)*posXPfVal:x2+=posXPfVal;var offXUnits=getIndexedStyle(node,"background-offset-x","units",index),offXPfVal=getIndexedStyle(node,"background-offset-x","pfValue",index);offXUnits==="%"?x2+=(nodeTW-w)*offXPfVal:x2+=offXPfVal;var y2=nodeY-nodeTH/2,posYUnits=getIndexedStyle(node,"background-position-y","units",index),posYPfVal=getIndexedStyle(node,"background-position-y","pfValue",index);posYUnits==="%"?y2+=(nodeTH-h)*posYPfVal:y2+=posYPfVal;var offYUnits=getIndexedStyle(node,"background-offset-y","units",index),offYPfVal=getIndexedStyle(node,"background-offset-y","pfValue",index);offYUnits==="%"?y2+=(nodeTH-h)*offYPfVal:y2+=offYPfVal,rs.pathCache&&(x2-=nodeX,y2-=nodeY,nodeX=0,nodeY=0);var gAlpha=context.globalAlpha;context.globalAlpha=imgOpacity;var smoothingEnabled=r.getImgSmoothing(context),isSmoothingSwitched=!1;if(smooth==="no"&&smoothingEnabled?(r.setImgSmoothing(context,!1),isSmoothingSwitched=!0):smooth==="yes"&&!smoothingEnabled&&(r.setImgSmoothing(context,!0),isSmoothingSwitched=!0),repeat==="no-repeat")shouldClip&&(context.save(),rs.pathCache?context.clip(rs.pathCache):(r.nodeShapes[r.getNodeShape(node)].draw(context,nodeX,nodeY,nodeTW,nodeTH,cornerRadius,rs),context.clip())),r.safeDrawImage(context,img,0,0,imgW,imgH,x2,y2,w,h),shouldClip&&context.restore();else{var pattern=context.createPattern(img,repeat);context.fillStyle=pattern,r.nodeShapes[r.getNodeShape(node)].draw(context,nodeX,nodeY,nodeTW,nodeTH,cornerRadius,rs),context.translate(x2,y2),context.fill(),context.translate(-x2,-y2)}context.globalAlpha=gAlpha,isSmoothingSwitched&&r.setImgSmoothing(context,smoothingEnabled)}};var CRp$7={};CRp$7.eleTextBiggerThanMin=function(ele,scale2){if(!scale2){var zoom2=ele.cy().zoom(),pxRatio=this.getPixelRatio(),lvl=Math.ceil(log2(zoom2*pxRatio));scale2=Math.pow(2,lvl)}var computedSize=ele.pstyle("font-size").pfValue*scale2,minSize=ele.pstyle("min-zoomed-font-size").pfValue;return!(computedSize<minSize)};CRp$7.drawElementText=function(context,ele,shiftToOriginWithBb,force,prefix){var useEleOpacity=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,r=this;if(force==null){if(useEleOpacity&&!r.eleTextBiggerThanMin(ele))return}else if(force===!1)return;if(ele.isNode()){var label=ele.pstyle("label");if(!label||!label.value)return;var justification=r.getLabelJustification(ele);context.textAlign=justification,context.textBaseline="bottom"}else{var badLine=ele.element()._private.rscratch.badLine,_label=ele.pstyle("label"),srcLabel=ele.pstyle("source-label"),tgtLabel=ele.pstyle("target-label");if(badLine||(!_label||!_label.value)&&(!srcLabel||!srcLabel.value)&&(!tgtLabel||!tgtLabel.value))return;context.textAlign="center",context.textBaseline="bottom"}var applyRotation=!shiftToOriginWithBb,bb;shiftToOriginWithBb&&(bb=shiftToOriginWithBb,context.translate(-bb.x1,-bb.y1)),prefix==null?(r.drawText(context,ele,null,applyRotation,useEleOpacity),ele.isEdge()&&(r.drawText(context,ele,"source",applyRotation,useEleOpacity),r.drawText(context,ele,"target",applyRotation,useEleOpacity))):r.drawText(context,ele,prefix,applyRotation,useEleOpacity),shiftToOriginWithBb&&context.translate(bb.x1,bb.y1)};CRp$7.getFontCache=function(context){var cache3;this.fontCaches=this.fontCaches||[];for(var i=0;i<this.fontCaches.length;i++)if(cache3=this.fontCaches[i],cache3.context===context)return cache3;return cache3={context},this.fontCaches.push(cache3),cache3};CRp$7.setupTextStyle=function(context,ele){var useEleOpacity=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,labelStyle=ele.pstyle("font-style").strValue,labelSize=ele.pstyle("font-size").pfValue+"px",labelFamily=ele.pstyle("font-family").strValue,labelWeight=ele.pstyle("font-weight").strValue,opacity=useEleOpacity?ele.effectiveOpacity()*ele.pstyle("text-opacity").value:1,outlineOpacity=ele.pstyle("text-outline-opacity").value*opacity,color=ele.pstyle("color").value,outlineColor=ele.pstyle("text-outline-color").value;context.font=labelStyle+" "+labelWeight+" "+labelSize+" "+labelFamily,context.lineJoin="round",this.colorFillStyle(context,color[0],color[1],color[2],opacity),this.colorStrokeStyle(context,outlineColor[0],outlineColor[1],outlineColor[2],outlineOpacity)};function circle(ctx,x2,y2,width2,height2){var diameter=Math.min(width2,height2),radius2=diameter/2,centerX=x2+width2/2,centerY=y2+height2/2;ctx.beginPath(),ctx.arc(centerX,centerY,radius2,0,Math.PI*2),ctx.closePath()}function roundRect(ctx,x2,y2,width2,height2){var radius2=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,r=Math.min(radius2,width2/2,height2/2);ctx.beginPath(),ctx.moveTo(x2+r,y2),ctx.lineTo(x2+width2-r,y2),ctx.quadraticCurveTo(x2+width2,y2,x2+width2,y2+r),ctx.lineTo(x2+width2,y2+height2-r),ctx.quadraticCurveTo(x2+width2,y2+height2,x2+width2-r,y2+height2),ctx.lineTo(x2+r,y2+height2),ctx.quadraticCurveTo(x2,y2+height2,x2,y2+height2-r),ctx.lineTo(x2,y2+r),ctx.quadraticCurveTo(x2,y2,x2+r,y2),ctx.closePath()}CRp$7.getTextAngle=function(ele,prefix){var theta,_p=ele._private,rscratch=_p.rscratch,pdash=prefix?prefix+"-":"",rotation=ele.pstyle(pdash+"text-rotation");if(rotation.strValue==="autorotate"){var textAngle=getPrefixedProperty(rscratch,"labelAngle",prefix);theta=ele.isEdge()?textAngle:0}else rotation.strValue==="none"?theta=0:theta=rotation.pfValue;return theta};CRp$7.drawText=function(context,ele,prefix){var applyRotation=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,useEleOpacity=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,_p=ele._private,rscratch=_p.rscratch,parentOpacity=useEleOpacity?ele.effectiveOpacity():1;if(!(useEleOpacity&&(parentOpacity===0||ele.pstyle("text-opacity").value===0))){prefix==="main"&&(prefix=null);var textX=getPrefixedProperty(rscratch,"labelX",prefix),textY=getPrefixedProperty(rscratch,"labelY",prefix),orgTextX,orgTextY,text=this.getLabelText(ele,prefix);if(text!=null&&text!==""&&!isNaN(textX)&&!isNaN(textY)){this.setupTextStyle(context,ele,useEleOpacity);var pdash=prefix?prefix+"-":"",textW=getPrefixedProperty(rscratch,"labelWidth",prefix),textH=getPrefixedProperty(rscratch,"labelHeight",prefix),marginX=ele.pstyle(pdash+"text-margin-x").pfValue,marginY=ele.pstyle(pdash+"text-margin-y").pfValue,isEdge2=ele.isEdge(),halign=ele.pstyle("text-halign").value,valign=ele.pstyle("text-valign").value;isEdge2&&(halign="center",valign="center"),textX+=marginX,textY+=marginY;var theta;switch(applyRotation?theta=this.getTextAngle(ele,prefix):theta=0,theta!==0&&(orgTextX=textX,orgTextY=textY,context.translate(orgTextX,orgTextY),context.rotate(theta),textX=0,textY=0),valign){case"top":break;case"center":textY+=textH/2;break;case"bottom":textY+=textH;break}var backgroundOpacity=ele.pstyle("text-background-opacity").value,borderOpacity=ele.pstyle("text-border-opacity").value,textBorderWidth=ele.pstyle("text-border-width").pfValue,backgroundPadding=ele.pstyle("text-background-padding").pfValue,styleShape=ele.pstyle("text-background-shape").strValue,rounded=styleShape==="round-rectangle"||styleShape==="roundrectangle",circled=styleShape==="circle",roundRadius=2;if(backgroundOpacity>0||textBorderWidth>0&&borderOpacity>0){var textFill=context.fillStyle,textStroke=context.strokeStyle,textLineWidth=context.lineWidth,textBackgroundColor=ele.pstyle("text-background-color").value,textBorderColor=ele.pstyle("text-border-color").value,textBorderStyle=ele.pstyle("text-border-style").value,doFill=backgroundOpacity>0,doStroke=textBorderWidth>0&&borderOpacity>0,bgX=textX-backgroundPadding;switch(halign){case"left":bgX-=textW;break;case"center":bgX-=textW/2;break}var bgY=textY-textH-backgroundPadding,bgW=textW+2*backgroundPadding,bgH=textH+2*backgroundPadding;if(doFill&&(context.fillStyle="rgba(".concat(textBackgroundColor[0],",").concat(textBackgroundColor[1],",").concat(textBackgroundColor[2],",").concat(backgroundOpacity*parentOpacity,")")),doStroke&&(context.strokeStyle="rgba(".concat(textBorderColor[0],",").concat(textBorderColor[1],",").concat(textBorderColor[2],",").concat(borderOpacity*parentOpacity,")"),context.lineWidth=textBorderWidth,context.setLineDash))switch(textBorderStyle){case"dotted":context.setLineDash([1,1]);break;case"dashed":context.setLineDash([4,2]);break;case"double":context.lineWidth=textBorderWidth/4,context.setLineDash([]);break;case"solid":default:context.setLineDash([]);break}if(rounded?(context.beginPath(),roundRect(context,bgX,bgY,bgW,bgH,roundRadius)):circled?(context.beginPath(),circle(context,bgX,bgY,bgW,bgH)):(context.beginPath(),context.rect(bgX,bgY,bgW,bgH)),doFill&&context.fill(),doStroke&&context.stroke(),doStroke&&textBorderStyle==="double"){var whiteWidth=textBorderWidth/2;context.beginPath(),rounded?roundRect(context,bgX+whiteWidth,bgY+whiteWidth,bgW-2*whiteWidth,bgH-2*whiteWidth,roundRadius):context.rect(bgX+whiteWidth,bgY+whiteWidth,bgW-2*whiteWidth,bgH-2*whiteWidth),context.stroke()}context.fillStyle=textFill,context.strokeStyle=textStroke,context.lineWidth=textLineWidth,context.setLineDash&&context.setLineDash([])}var lineWidth=2*ele.pstyle("text-outline-width").pfValue;if(lineWidth>0&&(context.lineWidth=lineWidth),ele.pstyle("text-wrap").value==="wrap"){var lines=getPrefixedProperty(rscratch,"labelWrapCachedLines",prefix),lineHeight=getPrefixedProperty(rscratch,"labelLineHeight",prefix),halfTextW=textW/2,justification=this.getLabelJustification(ele);switch(justification==="auto"||(halign==="left"?justification==="left"?textX+=-textW:justification==="center"&&(textX+=-halfTextW):halign==="center"?justification==="left"?textX+=-halfTextW:justification==="right"&&(textX+=halfTextW):halign==="right"&&(justification==="center"?textX+=halfTextW:justification==="right"&&(textX+=textW))),valign){case"top":textY-=(lines.length-1)*lineHeight;break;case"center":case"bottom":textY-=(lines.length-1)*lineHeight;break}for(var l=0;l<lines.length;l++)lineWidth>0&&context.strokeText(lines[l],textX,textY),context.fillText(lines[l],textX,textY),textY+=lineHeight}else lineWidth>0&&context.strokeText(text,textX,textY),context.fillText(text,textX,textY);theta!==0&&(context.rotate(-theta),context.translate(-orgTextX,-orgTextY))}}};var CRp$6={};CRp$6.drawNode=function(context,node,shiftToOriginWithBb){var drawLabel=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,shouldDrawOverlay=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,shouldDrawOpacity=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,r=this,nodeWidth,nodeHeight,_p=node._private,rs=_p.rscratch,pos=node.position();if(!(!number$1(pos.x)||!number$1(pos.y))&&!(shouldDrawOpacity&&!node.visible())){var eleOpacity=shouldDrawOpacity?node.effectiveOpacity():1,usePaths=r.usePaths(),path,pathCacheHit=!1,padding=node.padding();nodeWidth=node.width()+2*padding,nodeHeight=node.height()+2*padding;var bb;shiftToOriginWithBb&&(bb=shiftToOriginWithBb,context.translate(-bb.x1,-bb.y1));for(var bgImgProp=node.pstyle("background-image"),urls=bgImgProp.value,urlDefined=new Array(urls.length),image=new Array(urls.length),numImages=0,i=0;i<urls.length;i++){var url=urls[i],defd=urlDefined[i]=url!=null&&url!=="none";if(defd){var bgImgCrossOrigin=node.cy().style().getIndexedStyle(node,"background-image-crossorigin","value",i);numImages++,image[i]=r.getCachedImage(url,bgImgCrossOrigin,function(){_p.backgroundTimestamp=Date.now(),node.emitAndNotify("background")})}}var darkness=node.pstyle("background-blacken").value,borderWidth=node.pstyle("border-width").pfValue,bgOpacity=node.pstyle("background-opacity").value*eleOpacity,borderColor=node.pstyle("border-color").value,borderStyle=node.pstyle("border-style").value,borderJoin=node.pstyle("border-join").value,borderCap=node.pstyle("border-cap").value,borderPosition=node.pstyle("border-position").value,borderPattern=node.pstyle("border-dash-pattern").pfValue,borderOffset=node.pstyle("border-dash-offset").pfValue,borderOpacity=node.pstyle("border-opacity").value*eleOpacity,outlineWidth=node.pstyle("outline-width").pfValue,outlineColor=node.pstyle("outline-color").value,outlineStyle=node.pstyle("outline-style").value,outlineOpacity=node.pstyle("outline-opacity").value*eleOpacity,outlineOffset=node.pstyle("outline-offset").value,cornerRadius=node.pstyle("corner-radius").value;cornerRadius!=="auto"&&(cornerRadius=node.pstyle("corner-radius").pfValue);var setupShapeColor=function(){var bgOpy=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bgOpacity;r.eleFillStyle(context,node,bgOpy)},setupBorderColor=function(){var bdrOpy=arguments.length>0&&arguments[0]!==void 0?arguments[0]:borderOpacity;r.colorStrokeStyle(context,borderColor[0],borderColor[1],borderColor[2],bdrOpy)},setupOutlineColor=function(){var otlnOpy=arguments.length>0&&arguments[0]!==void 0?arguments[0]:outlineOpacity;r.colorStrokeStyle(context,outlineColor[0],outlineColor[1],outlineColor[2],otlnOpy)},getPath=function(width2,height2,shape,points){var pathCache=r.nodePathCache=r.nodePathCache||[],key=hashStrings(shape==="polygon"?shape+","+points.join(","):shape,""+height2,""+width2,""+cornerRadius),cachedPath=pathCache[key],path2,cacheHit=!1;return cachedPath!=null?(path2=cachedPath,cacheHit=!0,rs.pathCache=path2):(path2=new Path2D,pathCache[key]=rs.pathCache=path2),{path:path2,cacheHit}},styleShape=node.pstyle("shape").strValue,shapePts=node.pstyle("shape-polygon-points").pfValue;if(usePaths){context.translate(pos.x,pos.y);var shapePath=getPath(nodeWidth,nodeHeight,styleShape,shapePts);path=shapePath.path,pathCacheHit=shapePath.cacheHit}var drawShape=function(){if(!pathCacheHit){var npos=pos;usePaths&&(npos={x:0,y:0}),r.nodeShapes[r.getNodeShape(node)].draw(path||context,npos.x,npos.y,nodeWidth,nodeHeight,cornerRadius,rs)}usePaths?context.fill(path):context.fill()},drawImages=function(){for(var nodeOpacity=arguments.length>0&&arguments[0]!==void 0?arguments[0]:eleOpacity,inside=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,prevBging=_p.backgrounding,totalCompleted=0,_i=0;_i<image.length;_i++){var bgContainment=node.cy().style().getIndexedStyle(node,"background-image-containment","value",_i);if(inside&&bgContainment==="over"||!inside&&bgContainment==="inside"){totalCompleted++;continue}urlDefined[_i]&&image[_i].complete&&!image[_i].error&&(totalCompleted++,r.drawInscribedImage(context,image[_i],node,_i,nodeOpacity))}_p.backgrounding=totalCompleted!==numImages,prevBging!==_p.backgrounding&&node.updateStyle(!1)},drawPie=function(){var redrawShape=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,pieOpacity=arguments.length>1&&arguments[1]!==void 0?arguments[1]:eleOpacity;r.hasPie(node)&&(r.drawPie(context,node,pieOpacity),redrawShape&&(usePaths||r.nodeShapes[r.getNodeShape(node)].draw(context,pos.x,pos.y,nodeWidth,nodeHeight,cornerRadius,rs)))},drawStripe=function(){var redrawShape=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,stripeOpacity=arguments.length>1&&arguments[1]!==void 0?arguments[1]:eleOpacity;r.hasStripe(node)&&(context.save(),usePaths?context.clip(rs.pathCache):(r.nodeShapes[r.getNodeShape(node)].draw(context,pos.x,pos.y,nodeWidth,nodeHeight,cornerRadius,rs),context.clip()),r.drawStripe(context,node,stripeOpacity),context.restore(),redrawShape&&(usePaths||r.nodeShapes[r.getNodeShape(node)].draw(context,pos.x,pos.y,nodeWidth,nodeHeight,cornerRadius,rs)))},darken=function(){var darkenOpacity=arguments.length>0&&arguments[0]!==void 0?arguments[0]:eleOpacity,opacity=(darkness>0?darkness:-darkness)*darkenOpacity,c=darkness>0?0:255;darkness!==0&&(r.colorFillStyle(context,c,c,c,opacity),usePaths?context.fill(path):context.fill())},drawBorder=function(){if(borderWidth>0){if(context.lineWidth=borderWidth,context.lineCap=borderCap,context.lineJoin=borderJoin,context.setLineDash)switch(borderStyle){case"dotted":context.setLineDash([1,1]);break;case"dashed":context.setLineDash(borderPattern),context.lineDashOffset=borderOffset;break;case"solid":case"double":context.setLineDash([]);break}if(borderPosition!=="center"){if(context.save(),context.lineWidth*=2,borderPosition==="inside")usePaths?context.clip(path):context.clip();else{var region=new Path2D;region.rect(-nodeWidth/2-borderWidth,-nodeHeight/2-borderWidth,nodeWidth+2*borderWidth,nodeHeight+2*borderWidth),region.addPath(path),context.clip(region,"evenodd")}usePaths?context.stroke(path):context.stroke(),context.restore()}else usePaths?context.stroke(path):context.stroke();if(borderStyle==="double"){context.lineWidth=borderWidth/3;var gco=context.globalCompositeOperation;context.globalCompositeOperation="destination-out",usePaths?context.stroke(path):context.stroke(),context.globalCompositeOperation=gco}context.setLineDash&&context.setLineDash([])}},drawOutline=function(){if(outlineWidth>0){if(context.lineWidth=outlineWidth,context.lineCap="butt",context.setLineDash)switch(outlineStyle){case"dotted":context.setLineDash([1,1]);break;case"dashed":context.setLineDash([4,2]);break;case"solid":case"double":context.setLineDash([]);break}var npos=pos;usePaths&&(npos={x:0,y:0});var shape=r.getNodeShape(node),bWidth=borderWidth;borderPosition==="inside"&&(bWidth=0),borderPosition==="outside"&&(bWidth*=2);var scaleX=(nodeWidth+bWidth+(outlineWidth+outlineOffset))/nodeWidth,scaleY=(nodeHeight+bWidth+(outlineWidth+outlineOffset))/nodeHeight,sWidth=nodeWidth*scaleX,sHeight=nodeHeight*scaleY,points=r.nodeShapes[shape].points,_path;if(usePaths){var outlinePath=getPath(sWidth,sHeight,shape,points);_path=outlinePath.path}if(shape==="ellipse")r.drawEllipsePath(_path||context,npos.x,npos.y,sWidth,sHeight);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(shape)){var sMult=0,offsetX=0,offsetY=0;shape==="round-diamond"?sMult=(bWidth+outlineOffset+outlineWidth)*1.4:shape==="round-heptagon"?(sMult=(bWidth+outlineOffset+outlineWidth)*1.075,offsetY=-(bWidth/2+outlineOffset+outlineWidth)/35):shape==="round-hexagon"?sMult=(bWidth+outlineOffset+outlineWidth)*1.12:shape==="round-pentagon"?(sMult=(bWidth+outlineOffset+outlineWidth)*1.13,offsetY=-(bWidth/2+outlineOffset+outlineWidth)/15):shape==="round-tag"?(sMult=(bWidth+outlineOffset+outlineWidth)*1.12,offsetX=(bWidth/2+outlineWidth+outlineOffset)*.07):shape==="round-triangle"&&(sMult=(bWidth+outlineOffset+outlineWidth)*(Math.PI/2),offsetY=-(bWidth+outlineOffset/2+outlineWidth)/Math.PI),sMult!==0&&(scaleX=(nodeWidth+sMult)/nodeWidth,sWidth=nodeWidth*scaleX,["round-hexagon","round-tag"].includes(shape)||(scaleY=(nodeHeight+sMult)/nodeHeight,sHeight=nodeHeight*scaleY)),cornerRadius=cornerRadius==="auto"?getRoundPolygonRadius(sWidth,sHeight):cornerRadius;for(var halfW=sWidth/2,halfH=sHeight/2,radius2=cornerRadius+(bWidth+outlineWidth+outlineOffset)/2,p2=new Array(points.length/2),corners=new Array(points.length/2),_i2=0;_i2<points.length/2;_i2++)p2[_i2]={x:npos.x+offsetX+halfW*points[_i2*2],y:npos.y+offsetY+halfH*points[_i2*2+1]};var _i3,p1,p22,p3,len=p2.length;for(p1=p2[len-1],_i3=0;_i3<len;_i3++)p22=p2[_i3%len],p3=p2[(_i3+1)%len],corners[_i3]=getRoundCorner(p1,p22,p3,radius2),p1=p22,p22=p3;r.drawRoundPolygonPath(_path||context,npos.x+offsetX,npos.y+offsetY,nodeWidth*scaleX,nodeHeight*scaleY,points,corners)}else if(["roundrectangle","round-rectangle"].includes(shape))cornerRadius=cornerRadius==="auto"?getRoundRectangleRadius(sWidth,sHeight):cornerRadius,r.drawRoundRectanglePath(_path||context,npos.x,npos.y,sWidth,sHeight,cornerRadius+(bWidth+outlineWidth+outlineOffset)/2);else if(["cutrectangle","cut-rectangle"].includes(shape))cornerRadius=cornerRadius==="auto"?getCutRectangleCornerLength():cornerRadius,r.drawCutRectanglePath(_path||context,npos.x,npos.y,sWidth,sHeight,null,cornerRadius+(bWidth+outlineWidth+outlineOffset)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(shape))cornerRadius=cornerRadius==="auto"?getRoundRectangleRadius(sWidth,sHeight):cornerRadius,r.drawBottomRoundRectanglePath(_path||context,npos.x,npos.y,sWidth,sHeight,cornerRadius+(bWidth+outlineWidth+outlineOffset)/2);else if(shape==="barrel")r.drawBarrelPath(_path||context,npos.x,npos.y,sWidth,sHeight);else if(shape.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(shape)){var pad=(bWidth+outlineWidth+outlineOffset)/nodeWidth;points=joinLines(expandPolygon(points,pad)),r.drawPolygonPath(_path||context,npos.x,npos.y,nodeWidth,nodeHeight,points)}else{var _pad=(bWidth+outlineWidth+outlineOffset)/nodeWidth;points=joinLines(expandPolygon(points,-_pad)),r.drawPolygonPath(_path||context,npos.x,npos.y,nodeWidth,nodeHeight,points)}if(usePaths?context.stroke(_path):context.stroke(),outlineStyle==="double"){context.lineWidth=bWidth/3;var gco=context.globalCompositeOperation;context.globalCompositeOperation="destination-out",usePaths?context.stroke(_path):context.stroke(),context.globalCompositeOperation=gco}context.setLineDash&&context.setLineDash([])}},drawOverlay=function(){shouldDrawOverlay&&r.drawNodeOverlay(context,node,pos,nodeWidth,nodeHeight)},drawUnderlay=function(){shouldDrawOverlay&&r.drawNodeUnderlay(context,node,pos,nodeWidth,nodeHeight)},drawText=function(){r.drawElementText(context,node,null,drawLabel)},ghost=node.pstyle("ghost").value==="yes";if(ghost){var gx=node.pstyle("ghost-offset-x").pfValue,gy=node.pstyle("ghost-offset-y").pfValue,ghostOpacity=node.pstyle("ghost-opacity").value,effGhostOpacity=ghostOpacity*eleOpacity;context.translate(gx,gy),setupOutlineColor(),drawOutline(),setupShapeColor(ghostOpacity*bgOpacity),drawShape(),drawImages(effGhostOpacity,!0),setupBorderColor(ghostOpacity*borderOpacity),drawBorder(),drawPie(darkness!==0||borderWidth!==0),drawStripe(darkness!==0||borderWidth!==0),drawImages(effGhostOpacity,!1),darken(effGhostOpacity),context.translate(-gx,-gy)}usePaths&&context.translate(-pos.x,-pos.y),drawUnderlay(),usePaths&&context.translate(pos.x,pos.y),setupOutlineColor(),drawOutline(),setupShapeColor(),drawShape(),drawImages(eleOpacity,!0),setupBorderColor(),drawBorder(),drawPie(darkness!==0||borderWidth!==0),drawStripe(darkness!==0||borderWidth!==0),drawImages(eleOpacity,!1),darken(),usePaths&&context.translate(-pos.x,-pos.y),drawText(),drawOverlay(),shiftToOriginWithBb&&context.translate(bb.x1,bb.y1)}};var drawNodeOverlayUnderlay=function(overlayOrUnderlay){if(!["overlay","underlay"].includes(overlayOrUnderlay))throw new Error("Invalid state");return function(context,node,pos,nodeWidth,nodeHeight){var r=this;if(node.visible()){var padding=node.pstyle("".concat(overlayOrUnderlay,"-padding")).pfValue,opacity=node.pstyle("".concat(overlayOrUnderlay,"-opacity")).value,color=node.pstyle("".concat(overlayOrUnderlay,"-color")).value,shape=node.pstyle("".concat(overlayOrUnderlay,"-shape")).value,radius2=node.pstyle("".concat(overlayOrUnderlay,"-corner-radius")).value;if(opacity>0){if(pos=pos||node.position(),nodeWidth==null||nodeHeight==null){var _padding=node.padding();nodeWidth=node.width()+2*_padding,nodeHeight=node.height()+2*_padding}r.colorFillStyle(context,color[0],color[1],color[2],opacity),r.nodeShapes[shape].draw(context,pos.x,pos.y,nodeWidth+padding*2,nodeHeight+padding*2,radius2),context.fill()}}}};CRp$6.drawNodeOverlay=drawNodeOverlayUnderlay("overlay");CRp$6.drawNodeUnderlay=drawNodeOverlayUnderlay("underlay");CRp$6.hasPie=function(node){return node=node[0],node._private.hasPie};CRp$6.hasStripe=function(node){return node=node[0],node._private.hasStripe};CRp$6.drawPie=function(context,node,nodeOpacity,pos){node=node[0],pos=pos||node.position();var cyStyle=node.cy().style(),pieSize=node.pstyle("pie-size"),hole=node.pstyle("pie-hole"),overallStartAngle=node.pstyle("pie-start-angle").pfValue,x2=pos.x,y2=pos.y,nodeW=node.width(),nodeH=node.height(),radius2=Math.min(nodeW,nodeH)/2,holeRadius,lastPercent=0,usePaths=this.usePaths();if(usePaths&&(x2=0,y2=0),pieSize.units==="%"?radius2=radius2*pieSize.pfValue:pieSize.pfValue!==void 0&&(radius2=pieSize.pfValue/2),hole.units==="%"?holeRadius=radius2*hole.pfValue:hole.pfValue!==void 0&&(holeRadius=hole.pfValue/2),!(holeRadius>=radius2))for(var i=1;i<=cyStyle.pieBackgroundN;i++){var size3=node.pstyle("pie-"+i+"-background-size").value,color=node.pstyle("pie-"+i+"-background-color").value,opacity=node.pstyle("pie-"+i+"-background-opacity").value*nodeOpacity,percent=size3/100;percent+lastPercent>1&&(percent=1-lastPercent);var angleStart=1.5*Math.PI+2*Math.PI*lastPercent;angleStart+=overallStartAngle;var angleDelta=2*Math.PI*percent,angleEnd=angleStart+angleDelta;size3===0||lastPercent>=1||lastPercent+percent>1||(holeRadius===0?(context.beginPath(),context.moveTo(x2,y2),context.arc(x2,y2,radius2,angleStart,angleEnd),context.closePath()):(context.beginPath(),context.arc(x2,y2,radius2,angleStart,angleEnd),context.arc(x2,y2,holeRadius,angleEnd,angleStart,!0),context.closePath()),this.colorFillStyle(context,color[0],color[1],color[2],opacity),context.fill(),lastPercent+=percent)}};CRp$6.drawStripe=function(context,node,nodeOpacity,pos){node=node[0],pos=pos||node.position();var cyStyle=node.cy().style(),x2=pos.x,y2=pos.y,nodeW=node.width(),nodeH=node.height(),lastPercent=0,usePaths=this.usePaths();context.save();var direction=node.pstyle("stripe-direction").value,stripeSize=node.pstyle("stripe-size");switch(direction){case"vertical":break;case"righward":context.rotate(-Math.PI/2);break}var stripeW=nodeW,stripeH=nodeH;stripeSize.units==="%"?(stripeW=stripeW*stripeSize.pfValue,stripeH=stripeH*stripeSize.pfValue):stripeSize.pfValue!==void 0&&(stripeW=stripeSize.pfValue,stripeH=stripeSize.pfValue),usePaths&&(x2=0,y2=0),y2-=stripeW/2,x2-=stripeH/2;for(var i=1;i<=cyStyle.stripeBackgroundN;i++){var size3=node.pstyle("stripe-"+i+"-background-size").value,color=node.pstyle("stripe-"+i+"-background-color").value,opacity=node.pstyle("stripe-"+i+"-background-opacity").value*nodeOpacity,percent=size3/100;percent+lastPercent>1&&(percent=1-lastPercent),!(size3===0||lastPercent>=1||lastPercent+percent>1)&&(context.beginPath(),context.rect(x2,y2+stripeH*lastPercent,stripeW,stripeH*percent),context.closePath(),this.colorFillStyle(context,color[0],color[1],color[2],opacity),context.fill(),lastPercent+=percent)}context.restore()};var CRp$5={},motionBlurDelay=100;CRp$5.getPixelRatio=function(){var context=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var containerWindow=this.cy.window(),backingStore=context.backingStorePixelRatio||context.webkitBackingStorePixelRatio||context.mozBackingStorePixelRatio||context.msBackingStorePixelRatio||context.oBackingStorePixelRatio||context.backingStorePixelRatio||1;return(containerWindow.devicePixelRatio||1)/backingStore};CRp$5.paintCache=function(context){for(var caches=this.paintCaches=this.paintCaches||[],needToCreateCache=!0,cache3,i=0;i<caches.length;i++)if(cache3=caches[i],cache3.context===context){needToCreateCache=!1;break}return needToCreateCache&&(cache3={context},caches.push(cache3)),cache3};CRp$5.createGradientStyleFor=function(context,shapeStyleName,ele,fill,opacity){var gradientStyle,usePaths=this.usePaths(),colors2=ele.pstyle(shapeStyleName+"-gradient-stop-colors").value,positions2=ele.pstyle(shapeStyleName+"-gradient-stop-positions").pfValue;if(fill==="radial-gradient")if(ele.isEdge()){var start=ele.sourceEndpoint(),end=ele.targetEndpoint(),mid=ele.midpoint(),d1=dist(start,mid),d2=dist(end,mid);gradientStyle=context.createRadialGradient(mid.x,mid.y,0,mid.x,mid.y,Math.max(d1,d2))}else{var pos=usePaths?{x:0,y:0}:ele.position(),width2=ele.paddedWidth(),height2=ele.paddedHeight();gradientStyle=context.createRadialGradient(pos.x,pos.y,0,pos.x,pos.y,Math.max(width2,height2))}else if(ele.isEdge()){var _start=ele.sourceEndpoint(),_end=ele.targetEndpoint();gradientStyle=context.createLinearGradient(_start.x,_start.y,_end.x,_end.y)}else{var _pos=usePaths?{x:0,y:0}:ele.position(),_width=ele.paddedWidth(),_height=ele.paddedHeight(),halfWidth=_width/2,halfHeight=_height/2,direction=ele.pstyle("background-gradient-direction").value;switch(direction){case"to-bottom":gradientStyle=context.createLinearGradient(_pos.x,_pos.y-halfHeight,_pos.x,_pos.y+halfHeight);break;case"to-top":gradientStyle=context.createLinearGradient(_pos.x,_pos.y+halfHeight,_pos.x,_pos.y-halfHeight);break;case"to-left":gradientStyle=context.createLinearGradient(_pos.x+halfWidth,_pos.y,_pos.x-halfWidth,_pos.y);break;case"to-right":gradientStyle=context.createLinearGradient(_pos.x-halfWidth,_pos.y,_pos.x+halfWidth,_pos.y);break;case"to-bottom-right":case"to-right-bottom":gradientStyle=context.createLinearGradient(_pos.x-halfWidth,_pos.y-halfHeight,_pos.x+halfWidth,_pos.y+halfHeight);break;case"to-top-right":case"to-right-top":gradientStyle=context.createLinearGradient(_pos.x-halfWidth,_pos.y+halfHeight,_pos.x+halfWidth,_pos.y-halfHeight);break;case"to-bottom-left":case"to-left-bottom":gradientStyle=context.createLinearGradient(_pos.x+halfWidth,_pos.y-halfHeight,_pos.x-halfWidth,_pos.y+halfHeight);break;case"to-top-left":case"to-left-top":gradientStyle=context.createLinearGradient(_pos.x+halfWidth,_pos.y+halfHeight,_pos.x-halfWidth,_pos.y-halfHeight);break}}if(!gradientStyle)return null;for(var hasPositions=positions2.length===colors2.length,length=colors2.length,i=0;i<length;i++)gradientStyle.addColorStop(hasPositions?positions2[i]:i/(length-1),"rgba("+colors2[i][0]+","+colors2[i][1]+","+colors2[i][2]+","+opacity+")");return gradientStyle};CRp$5.gradientFillStyle=function(context,ele,fill,opacity){var gradientStyle=this.createGradientStyleFor(context,"background",ele,fill,opacity);if(!gradientStyle)return null;context.fillStyle=gradientStyle};CRp$5.colorFillStyle=function(context,r,g,b,a){context.fillStyle="rgba("+r+","+g+","+b+","+a+")"};CRp$5.eleFillStyle=function(context,ele,opacity){var backgroundFill=ele.pstyle("background-fill").value;if(backgroundFill==="linear-gradient"||backgroundFill==="radial-gradient")this.gradientFillStyle(context,ele,backgroundFill,opacity);else{var backgroundColor=ele.pstyle("background-color").value;this.colorFillStyle(context,backgroundColor[0],backgroundColor[1],backgroundColor[2],opacity)}};CRp$5.gradientStrokeStyle=function(context,ele,fill,opacity){var gradientStyle=this.createGradientStyleFor(context,"line",ele,fill,opacity);if(!gradientStyle)return null;context.strokeStyle=gradientStyle};CRp$5.colorStrokeStyle=function(context,r,g,b,a){context.strokeStyle="rgba("+r+","+g+","+b+","+a+")"};CRp$5.eleStrokeStyle=function(context,ele,opacity){var lineFill=ele.pstyle("line-fill").value;if(lineFill==="linear-gradient"||lineFill==="radial-gradient")this.gradientStrokeStyle(context,ele,lineFill,opacity);else{var lineColor=ele.pstyle("line-color").value;this.colorStrokeStyle(context,lineColor[0],lineColor[1],lineColor[2],opacity)}};CRp$5.matchCanvasSize=function(container2){var r=this,data4=r.data,bb=r.findContainerClientCoords(),width2=bb[2],height2=bb[3],pixelRatio=r.getPixelRatio(),mbPxRatio=r.motionBlurPxRatio;(container2===r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE]||container2===r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG])&&(pixelRatio=mbPxRatio);var canvasWidth=width2*pixelRatio,canvasHeight=height2*pixelRatio,canvas;if(!(canvasWidth===r.canvasWidth&&canvasHeight===r.canvasHeight)){r.fontCaches=null;var canvasContainer=data4.canvasContainer;canvasContainer.style.width=width2+"px",canvasContainer.style.height=height2+"px";for(var i=0;i<r.CANVAS_LAYERS;i++)canvas=data4.canvases[i],canvas.width=canvasWidth,canvas.height=canvasHeight,canvas.style.width=width2+"px",canvas.style.height=height2+"px";for(var i=0;i<r.BUFFER_COUNT;i++)canvas=data4.bufferCanvases[i],canvas.width=canvasWidth,canvas.height=canvasHeight,canvas.style.width=width2+"px",canvas.style.height=height2+"px";r.textureMult=1,pixelRatio<=1&&(canvas=data4.bufferCanvases[r.TEXTURE_BUFFER],r.textureMult=2,canvas.width=canvasWidth*r.textureMult,canvas.height=canvasHeight*r.textureMult),r.canvasWidth=canvasWidth,r.canvasHeight=canvasHeight,r.pixelRatio=pixelRatio}};CRp$5.renderTo=function(cxt,zoom2,pan2,pxRatio){this.render({forcedContext:cxt,forcedZoom:zoom2,forcedPan:pan2,drawAllLayers:!0,forcedPxRatio:pxRatio})};CRp$5.clearCanvas=function(){var r=this,data4=r.data;function clear(context){context.clearRect(0,0,r.canvasWidth,r.canvasHeight)}clear(data4.contexts[r.NODE]),clear(data4.contexts[r.DRAG])};CRp$5.render=function(options2){var r=this;options2=options2||staticEmptyObject();var cy=r.cy,forcedContext=options2.forcedContext,drawAllLayers=options2.drawAllLayers,drawOnlyNodeLayer=options2.drawOnlyNodeLayer,forcedZoom=options2.forcedZoom,forcedPan=options2.forcedPan,pixelRatio=options2.forcedPxRatio===void 0?this.getPixelRatio():options2.forcedPxRatio,data4=r.data,needDraw=data4.canvasNeedsRedraw,textureDraw=r.textureOnViewport&&!forcedContext&&(r.pinching||r.hoverData.dragging||r.swipePanning||r.data.wheelZooming),motionBlur=options2.motionBlur!==void 0?options2.motionBlur:r.motionBlur,mbPxRatio=r.motionBlurPxRatio,hasCompoundNodes2=cy.hasCompoundNodes(),inNodeDragGesture=r.hoverData.draggingEles,inBoxSelection=!!(r.hoverData.selecting||r.touchData.selecting);motionBlur=motionBlur&&!forcedContext&&r.motionBlurEnabled&&!inBoxSelection;var motionBlurFadeEffect=motionBlur;forcedContext||(r.prevPxRatio!==pixelRatio&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container),r.redrawHint("eles",!0),r.redrawHint("drag",!0)),r.prevPxRatio=pixelRatio),!forcedContext&&r.motionBlurTimeout&&clearTimeout(r.motionBlurTimeout),motionBlur&&(r.mbFrames==null&&(r.mbFrames=0),r.mbFrames++,r.mbFrames<3&&(motionBlurFadeEffect=!1),r.mbFrames>r.minMbLowQualFrames&&(r.motionBlurPxRatio=r.mbPxRBlurry)),r.clearingMotionBlur&&(r.motionBlurPxRatio=1),r.textureDrawLastFrame&&!textureDraw&&(needDraw[r.NODE]=!0,needDraw[r.SELECT_BOX]=!0);var style3=cy.style(),zoom2=cy.zoom(),effectiveZoom=forcedZoom!==void 0?forcedZoom:zoom2,pan2=cy.pan(),effectivePan={x:pan2.x,y:pan2.y},vp={zoom:zoom2,pan:{x:pan2.x,y:pan2.y}},prevVp=r.prevViewport,viewportIsDiff=prevVp===void 0||vp.zoom!==prevVp.zoom||vp.pan.x!==prevVp.pan.x||vp.pan.y!==prevVp.pan.y;!viewportIsDiff&&!(inNodeDragGesture&&!hasCompoundNodes2)&&(r.motionBlurPxRatio=1),forcedPan&&(effectivePan=forcedPan),effectiveZoom*=pixelRatio,effectivePan.x*=pixelRatio,effectivePan.y*=pixelRatio;var eles=r.getCachedZSortedEles();function mbclear(context2,x2,y2,w,h){var gco=context2.globalCompositeOperation;context2.globalCompositeOperation="destination-out",r.colorFillStyle(context2,255,255,255,r.motionBlurTransparency),context2.fillRect(x2,y2,w,h),context2.globalCompositeOperation=gco}function setContextTransform2(context2,clear2){var ePan,eZoom,w,h;!r.clearingMotionBlur&&(context2===data4.bufferContexts[r.MOTIONBLUR_BUFFER_NODE]||context2===data4.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG])?(ePan={x:pan2.x*mbPxRatio,y:pan2.y*mbPxRatio},eZoom=zoom2*mbPxRatio,w=r.canvasWidth*mbPxRatio,h=r.canvasHeight*mbPxRatio):(ePan=effectivePan,eZoom=effectiveZoom,w=r.canvasWidth,h=r.canvasHeight),context2.setTransform(1,0,0,1,0,0),clear2==="motionBlur"?mbclear(context2,0,0,w,h):!forcedContext&&(clear2===void 0||clear2)&&context2.clearRect(0,0,w,h),drawAllLayers||(context2.translate(ePan.x,ePan.y),context2.scale(eZoom,eZoom)),forcedPan&&context2.translate(forcedPan.x,forcedPan.y),forcedZoom&&context2.scale(forcedZoom,forcedZoom)}if(textureDraw||(r.textureDrawLastFrame=!1),textureDraw){if(r.textureDrawLastFrame=!0,!r.textureCache){r.textureCache={},r.textureCache.bb=cy.mutableElements().boundingBox(),r.textureCache.texture=r.data.bufferCanvases[r.TEXTURE_BUFFER];var cxt=r.data.bufferContexts[r.TEXTURE_BUFFER];cxt.setTransform(1,0,0,1,0,0),cxt.clearRect(0,0,r.canvasWidth*r.textureMult,r.canvasHeight*r.textureMult),r.render({forcedContext:cxt,drawOnlyNodeLayer:!0,forcedPxRatio:pixelRatio*r.textureMult});var vp=r.textureCache.viewport={zoom:cy.zoom(),pan:cy.pan(),width:r.canvasWidth,height:r.canvasHeight};vp.mpan={x:(0-vp.pan.x)/vp.zoom,y:(0-vp.pan.y)/vp.zoom}}needDraw[r.DRAG]=!1,needDraw[r.NODE]=!1;var context=data4.contexts[r.NODE],texture=r.textureCache.texture,vp=r.textureCache.viewport;context.setTransform(1,0,0,1,0,0),motionBlur?mbclear(context,0,0,vp.width,vp.height):context.clearRect(0,0,vp.width,vp.height);var outsideBgColor=style3.core("outside-texture-bg-color").value,outsideBgOpacity=style3.core("outside-texture-bg-opacity").value;r.colorFillStyle(context,outsideBgColor[0],outsideBgColor[1],outsideBgColor[2],outsideBgOpacity),context.fillRect(0,0,vp.width,vp.height);var zoom2=cy.zoom();setContextTransform2(context,!1),context.clearRect(vp.mpan.x,vp.mpan.y,vp.width/vp.zoom/pixelRatio,vp.height/vp.zoom/pixelRatio),context.drawImage(texture,vp.mpan.x,vp.mpan.y,vp.width/vp.zoom/pixelRatio,vp.height/vp.zoom/pixelRatio)}else r.textureOnViewport&&!forcedContext&&(r.textureCache=null);var extent2=cy.extent(),vpManip=r.pinching||r.hoverData.dragging||r.swipePanning||r.data.wheelZooming||r.hoverData.draggingEles||r.cy.animated(),hideEdges=r.hideEdgesOnViewport&&vpManip,needMbClear=[];if(needMbClear[r.NODE]=!needDraw[r.NODE]&&motionBlur&&!r.clearedForMotionBlur[r.NODE]||r.clearingMotionBlur,needMbClear[r.NODE]&&(r.clearedForMotionBlur[r.NODE]=!0),needMbClear[r.DRAG]=!needDraw[r.DRAG]&&motionBlur&&!r.clearedForMotionBlur[r.DRAG]||r.clearingMotionBlur,needMbClear[r.DRAG]&&(r.clearedForMotionBlur[r.DRAG]=!0),needDraw[r.NODE]||drawAllLayers||drawOnlyNodeLayer||needMbClear[r.NODE]){var useBuffer=motionBlur&&!needMbClear[r.NODE]&&mbPxRatio!==1,context=forcedContext||(useBuffer?r.data.bufferContexts[r.MOTIONBLUR_BUFFER_NODE]:data4.contexts[r.NODE]),clear=motionBlur&&!useBuffer?"motionBlur":void 0;setContextTransform2(context,clear),hideEdges?r.drawCachedNodes(context,eles.nondrag,pixelRatio,extent2):r.drawLayeredElements(context,eles.nondrag,pixelRatio,extent2),r.debug&&r.drawDebugPoints(context,eles.nondrag),!drawAllLayers&&!motionBlur&&(needDraw[r.NODE]=!1)}if(!drawOnlyNodeLayer&&(needDraw[r.DRAG]||drawAllLayers||needMbClear[r.DRAG])){var useBuffer=motionBlur&&!needMbClear[r.DRAG]&&mbPxRatio!==1,context=forcedContext||(useBuffer?r.data.bufferContexts[r.MOTIONBLUR_BUFFER_DRAG]:data4.contexts[r.DRAG]);setContextTransform2(context,motionBlur&&!useBuffer?"motionBlur":void 0),hideEdges?r.drawCachedNodes(context,eles.drag,pixelRatio,extent2):r.drawCachedElements(context,eles.drag,pixelRatio,extent2),r.debug&&r.drawDebugPoints(context,eles.drag),!drawAllLayers&&!motionBlur&&(needDraw[r.DRAG]=!1)}if(this.drawSelectionRectangle(options2,setContextTransform2),motionBlur&&mbPxRatio!==1){var cxtNode=data4.contexts[r.NODE],txtNode=r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_NODE],cxtDrag=data4.contexts[r.DRAG],txtDrag=r.data.bufferCanvases[r.MOTIONBLUR_BUFFER_DRAG],drawMotionBlur=function(cxt2,txt,needClear){cxt2.setTransform(1,0,0,1,0,0),needClear||!motionBlurFadeEffect?cxt2.clearRect(0,0,r.canvasWidth,r.canvasHeight):mbclear(cxt2,0,0,r.canvasWidth,r.canvasHeight);var pxr=mbPxRatio;cxt2.drawImage(txt,0,0,r.canvasWidth*pxr,r.canvasHeight*pxr,0,0,r.canvasWidth,r.canvasHeight)};(needDraw[r.NODE]||needMbClear[r.NODE])&&(drawMotionBlur(cxtNode,txtNode,needMbClear[r.NODE]),needDraw[r.NODE]=!1),(needDraw[r.DRAG]||needMbClear[r.DRAG])&&(drawMotionBlur(cxtDrag,txtDrag,needMbClear[r.DRAG]),needDraw[r.DRAG]=!1)}r.prevViewport=vp,r.clearingMotionBlur&&(r.clearingMotionBlur=!1,r.motionBlurCleared=!0,r.motionBlur=!0),motionBlur&&(r.motionBlurTimeout=setTimeout(function(){r.motionBlurTimeout=null,r.clearedForMotionBlur[r.NODE]=!1,r.clearedForMotionBlur[r.DRAG]=!1,r.motionBlur=!1,r.clearingMotionBlur=!textureDraw,r.mbFrames=0,needDraw[r.NODE]=!0,needDraw[r.DRAG]=!0,r.redraw()},motionBlurDelay)),forcedContext||cy.emit("render")};var fpsHeight;CRp$5.drawSelectionRectangle=function(options2,setContextTransform2){var r=this,cy=r.cy,data4=r.data,style3=cy.style(),drawOnlyNodeLayer=options2.drawOnlyNodeLayer,drawAllLayers=options2.drawAllLayers,needDraw=data4.canvasNeedsRedraw,forcedContext=options2.forcedContext;if(r.showFps||!drawOnlyNodeLayer&&needDraw[r.SELECT_BOX]&&!drawAllLayers){var context=forcedContext||data4.contexts[r.SELECT_BOX];if(setContextTransform2(context),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var zoom2=r.cy.zoom(),borderWidth=style3.core("selection-box-border-width").value/zoom2;context.lineWidth=borderWidth,context.fillStyle="rgba("+style3.core("selection-box-color").value[0]+","+style3.core("selection-box-color").value[1]+","+style3.core("selection-box-color").value[2]+","+style3.core("selection-box-opacity").value+")",context.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),borderWidth>0&&(context.strokeStyle="rgba("+style3.core("selection-box-border-color").value[0]+","+style3.core("selection-box-border-color").value[1]+","+style3.core("selection-box-border-color").value[2]+","+style3.core("selection-box-opacity").value+")",context.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(data4.bgActivePosistion&&!r.hoverData.selecting){var zoom2=r.cy.zoom(),pos=data4.bgActivePosistion;context.fillStyle="rgba("+style3.core("active-bg-color").value[0]+","+style3.core("active-bg-color").value[1]+","+style3.core("active-bg-color").value[2]+","+style3.core("active-bg-opacity").value+")",context.beginPath(),context.arc(pos.x,pos.y,style3.core("active-bg-size").pfValue/zoom2,0,2*Math.PI),context.fill()}var timeToRender=r.lastRedrawTime;if(r.showFps&&timeToRender){timeToRender=Math.round(timeToRender);var fps=Math.round(1e3/timeToRender),text="1 frame = "+timeToRender+" ms = "+fps+" fps";if(context.setTransform(1,0,0,1,0,0),context.fillStyle="rgba(255, 0, 0, 0.75)",context.strokeStyle="rgba(255, 0, 0, 0.75)",context.font="30px Arial",!fpsHeight){var dims=context.measureText(text);fpsHeight=dims.actualBoundingBoxAscent}context.fillText(text,0,fpsHeight);var maxFps=60;context.strokeRect(0,fpsHeight+10,250,20),context.fillRect(0,fpsHeight+10,250*Math.min(fps/maxFps,1),20)}drawAllLayers||(needDraw[r.SELECT_BOX]=!1)}};function compileShader(gl,type,source){var shader=gl.createShader(type);if(gl.shaderSource(shader,source),gl.compileShader(shader),!gl.getShaderParameter(shader,gl.COMPILE_STATUS))throw new Error(gl.getShaderInfoLog(shader));return shader}function createProgram(gl,vertexSource,fragementSource){var vertexShader=compileShader(gl,gl.VERTEX_SHADER,vertexSource),fragmentShader=compileShader(gl,gl.FRAGMENT_SHADER,fragementSource),program=gl.createProgram();if(gl.attachShader(program,vertexShader),gl.attachShader(program,fragmentShader),gl.linkProgram(program),!gl.getProgramParameter(program,gl.LINK_STATUS))throw new Error("Could not initialize shaders");return program}function createTextureCanvas(r,width2,height2){height2===void 0&&(height2=width2);var canvas=r.makeOffscreenCanvas(width2,height2),ctx=canvas.context=canvas.getContext("2d");return canvas.clear=function(){return ctx.clearRect(0,0,canvas.width,canvas.height)},canvas.clear(),canvas}function getEffectivePanZoom(r){var pixelRatio=r.pixelRatio,zoom2=r.cy.zoom(),pan2=r.cy.pan();return{zoom:zoom2*pixelRatio,pan:{x:pan2.x*pixelRatio,y:pan2.y*pixelRatio}}}function getEffectiveZoom(r){var pixelRatio=r.pixelRatio,zoom2=r.cy.zoom();return zoom2*pixelRatio}function modelToRenderedPosition2(r,pan2,zoom2,x2,y2){var rx=x2*zoom2+pan2.x,ry=y2*zoom2+pan2.y;return ry=Math.round(r.canvasHeight-ry),[rx,ry]}function isSimpleShape(node,renderTarget){return renderTarget.picking?!0:node.pstyle("background-fill").value!=="solid"||node.pstyle("background-image").strValue!=="none"?!1:node.pstyle("border-width").value===0||node.pstyle("border-opacity").value===0?!0:node.pstyle("border-style").value==="solid"}function arrayEqual(a1,a2){if(a1.length!==a2.length)return!1;for(var i=0;i<a1.length;i++)if(a1[i]!==a2[i])return!1;return!0}function toWebGLColor(color,opacity,outArray){var r=color[0]/255,g=color[1]/255,b=color[2]/255,a=opacity,arr=outArray||new Array(4);return arr[0]=r*a,arr[1]=g*a,arr[2]=b*a,arr[3]=a,arr}function indexToVec4(index,outArray){var arr=outArray||new Array(4);return arr[0]=(index>>0&255)/255,arr[1]=(index>>8&255)/255,arr[2]=(index>>16&255)/255,arr[3]=(index>>24&255)/255,arr}function vec4ToIndex(vec4){return vec4[0]+(vec4[1]<<8)+(vec4[2]<<16)+(vec4[3]<<24)}function createTexture(gl,debugID){var texture=gl.createTexture();return texture.buffer=function(offscreenCanvas){gl.bindTexture(gl.TEXTURE_2D,texture),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR_MIPMAP_NEAREST),gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,offscreenCanvas),gl.generateMipmap(gl.TEXTURE_2D),gl.bindTexture(gl.TEXTURE_2D,null)},texture.deleteTexture=function(){gl.deleteTexture(texture)},texture}function getTypeInfo(gl,glslType){switch(glslType){case"float":return[1,gl.FLOAT,4];case"vec2":return[2,gl.FLOAT,4];case"vec3":return[3,gl.FLOAT,4];case"vec4":return[4,gl.FLOAT,4];case"int":return[1,gl.INT,4];case"ivec2":return[2,gl.INT,4]}}function createTypedArray(gl,glType,dataOrSize){switch(glType){case gl.FLOAT:return new Float32Array(dataOrSize);case gl.INT:return new Int32Array(dataOrSize)}}function createTypedArrayView(gl,glType,array3,stride,size3,i){switch(glType){case gl.FLOAT:return new Float32Array(array3.buffer,i*stride,size3);case gl.INT:return new Int32Array(array3.buffer,i*stride,size3)}}function createBufferStaticDraw(gl,type,attributeLoc,dataArray){var _getTypeInfo=getTypeInfo(gl,type),_getTypeInfo2=_slicedToArray(_getTypeInfo,2),size3=_getTypeInfo2[0],glType=_getTypeInfo2[1],data4=createTypedArray(gl,glType,dataArray),buffer=gl.createBuffer();return gl.bindBuffer(gl.ARRAY_BUFFER,buffer),gl.bufferData(gl.ARRAY_BUFFER,data4,gl.STATIC_DRAW),glType===gl.FLOAT?gl.vertexAttribPointer(attributeLoc,size3,glType,!1,0,0):glType===gl.INT&&gl.vertexAttribIPointer(attributeLoc,size3,glType,0,0),gl.enableVertexAttribArray(attributeLoc),gl.bindBuffer(gl.ARRAY_BUFFER,null),buffer}function createBufferDynamicDraw(gl,instances,type,attributeLoc){var _getTypeInfo3=getTypeInfo(gl,type),_getTypeInfo4=_slicedToArray(_getTypeInfo3,3),size3=_getTypeInfo4[0],glType=_getTypeInfo4[1],bytes=_getTypeInfo4[2],dataArray=createTypedArray(gl,glType,instances*size3),stride=size3*bytes,buffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buffer),gl.bufferData(gl.ARRAY_BUFFER,instances*stride,gl.DYNAMIC_DRAW),gl.enableVertexAttribArray(attributeLoc),glType===gl.FLOAT?gl.vertexAttribPointer(attributeLoc,size3,glType,!1,stride,0):glType===gl.INT&&gl.vertexAttribIPointer(attributeLoc,size3,glType,stride,0),gl.vertexAttribDivisor(attributeLoc,1),gl.bindBuffer(gl.ARRAY_BUFFER,null);for(var views=new Array(instances),i=0;i<instances;i++)views[i]=createTypedArrayView(gl,glType,dataArray,stride,size3,i);return buffer.dataArray=dataArray,buffer.stride=stride,buffer.size=size3,buffer.getView=function(i2){return views[i2]},buffer.setPoint=function(i2,x2,y2){var view=views[i2];view[0]=x2,view[1]=y2},buffer.bufferSubData=function(count){gl.bindBuffer(gl.ARRAY_BUFFER,buffer),count?gl.bufferSubData(gl.ARRAY_BUFFER,0,dataArray,0,count*size3):gl.bufferSubData(gl.ARRAY_BUFFER,0,dataArray)},buffer}function create3x3MatrixBufferDynamicDraw(gl,instances,attributeLoc){for(var matrixSize=9,matrixData=new Float32Array(instances*matrixSize),matrixViews=new Array(instances),i=0;i<instances;i++){var byteOffset=i*matrixSize*4;matrixViews[i]=new Float32Array(matrixData.buffer,byteOffset,matrixSize)}var buffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buffer),gl.bufferData(gl.ARRAY_BUFFER,matrixData.byteLength,gl.DYNAMIC_DRAW);for(var _i=0;_i<3;_i++){var loc=attributeLoc+_i;gl.enableVertexAttribArray(loc),gl.vertexAttribPointer(loc,3,gl.FLOAT,!1,36,_i*12),gl.vertexAttribDivisor(loc,1)}return gl.bindBuffer(gl.ARRAY_BUFFER,null),buffer.getMatrixView=function(i2){return matrixViews[i2]},buffer.setData=function(matrix,i2){matrixViews[i2].set(matrix,0)},buffer.bufferSubData=function(){gl.bindBuffer(gl.ARRAY_BUFFER,buffer),gl.bufferSubData(gl.ARRAY_BUFFER,0,matrixData)},buffer}function createPickingFrameBuffer(gl){var fb=gl.createFramebuffer();gl.bindFramebuffer(gl.FRAMEBUFFER,fb);var targetTexture=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,targetTexture),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,targetTexture,0),gl.bindFramebuffer(gl.FRAMEBUFFER,null),fb.setFramebufferAttachmentSizes=function(width2,height2){gl.bindTexture(gl.TEXTURE_2D,targetTexture),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,width2,height2,0,gl.RGBA,gl.UNSIGNED_BYTE,null)},fb}var ARRAY_TYPE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var y2=0,i=arguments.length;i--;)y2+=arguments[i]*arguments[i];return Math.sqrt(y2)});function create(){var out=new ARRAY_TYPE(9);return ARRAY_TYPE!=Float32Array&&(out[1]=0,out[2]=0,out[3]=0,out[5]=0,out[6]=0,out[7]=0),out[0]=1,out[4]=1,out[8]=1,out}function identity2(out){return out[0]=1,out[1]=0,out[2]=0,out[3]=0,out[4]=1,out[5]=0,out[6]=0,out[7]=0,out[8]=1,out}function multiply(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],b00=b[0],b01=b[1],b02=b[2],b10=b[3],b11=b[4],b12=b[5],b20=b[6],b21=b[7],b22=b[8];return out[0]=b00*a00+b01*a10+b02*a20,out[1]=b00*a01+b01*a11+b02*a21,out[2]=b00*a02+b01*a12+b02*a22,out[3]=b10*a00+b11*a10+b12*a20,out[4]=b10*a01+b11*a11+b12*a21,out[5]=b10*a02+b11*a12+b12*a22,out[6]=b20*a00+b21*a10+b22*a20,out[7]=b20*a01+b21*a11+b22*a21,out[8]=b20*a02+b21*a12+b22*a22,out}function translate(out,a,v){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],x2=v[0],y2=v[1];return out[0]=a00,out[1]=a01,out[2]=a02,out[3]=a10,out[4]=a11,out[5]=a12,out[6]=x2*a00+y2*a10+a20,out[7]=x2*a01+y2*a11+a21,out[8]=x2*a02+y2*a12+a22,out}function rotate(out,a,rad){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],s=Math.sin(rad),c=Math.cos(rad);return out[0]=c*a00+s*a10,out[1]=c*a01+s*a11,out[2]=c*a02+s*a12,out[3]=c*a10-s*a00,out[4]=c*a11-s*a01,out[5]=c*a12-s*a02,out[6]=a20,out[7]=a21,out[8]=a22,out}function scale(out,a,v){var x2=v[0],y2=v[1];return out[0]=x2*a[0],out[1]=x2*a[1],out[2]=x2*a[2],out[3]=y2*a[3],out[4]=y2*a[4],out[5]=y2*a[5],out[6]=a[6],out[7]=a[7],out[8]=a[8],out}function projection(out,width2,height2){return out[0]=2/width2,out[1]=0,out[2]=0,out[3]=0,out[4]=-2/height2,out[5]=0,out[6]=-1,out[7]=1,out[8]=1,out}var Atlas=(function(){function Atlas2(r,texSize,texRows,createTextureCanvas2){_classCallCheck(this,Atlas2),this.debugID=Math.floor(Math.random()*1e4),this.r=r,this.texSize=texSize,this.texRows=texRows,this.texHeight=Math.floor(texSize/texRows),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=createTextureCanvas2(r,texSize,texSize),this.scratch=createTextureCanvas2(r,texSize,this.texHeight,"scratch")}return _createClass(Atlas2,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(_ref){var w=_ref.w,h=_ref.h,texHeight=this.texHeight,maxTexWidth=this.texSize,scale2=texHeight/h,texW=w*scale2,texH=h*scale2;return texW>maxTexWidth&&(scale2=maxTexWidth/w,texW=w*scale2,texH=h*scale2),{scale:scale2,texW,texH}}},{key:"draw",value:function(key,bb,doDrawing){var _this=this;if(this.locked)throw new Error("can't draw, atlas is locked");var texSize=this.texSize,texRows=this.texRows,texHeight=this.texHeight,_this$getScale=this.getScale(bb),scale2=_this$getScale.scale,texW=_this$getScale.texW,texH=_this$getScale.texH,drawAt=function(location,canvas){if(doDrawing&&canvas){var context=canvas.context,x2=location.x,row=location.row,xOffset=x2,yOffset=texHeight*row;context.save(),context.translate(xOffset,yOffset),context.scale(scale2,scale2),doDrawing(context,bb),context.restore()}},locations=[null,null],drawNormal=function(){drawAt(_this.freePointer,_this.canvas),locations[0]={x:_this.freePointer.x,y:_this.freePointer.row*texHeight,w:texW,h:texH},locations[1]={x:_this.freePointer.x+texW,y:_this.freePointer.row*texHeight,w:0,h:texH},_this.freePointer.x+=texW,_this.freePointer.x==texSize&&(_this.freePointer.x=0,_this.freePointer.row++)},drawWrapped=function(){var scratch=_this.scratch,canvas=_this.canvas;scratch.clear(),drawAt({x:0,row:0},scratch);var firstTexW=texSize-_this.freePointer.x,secondTexW=texW-firstTexW,h=texHeight;{var dx=_this.freePointer.x,dy=_this.freePointer.row*texHeight,w=firstTexW;canvas.context.drawImage(scratch,0,0,w,h,dx,dy,w,h),locations[0]={x:dx,y:dy,w,h:texH}}{var sx=firstTexW,_dy=(_this.freePointer.row+1)*texHeight,_w=secondTexW;canvas&&canvas.context.drawImage(scratch,sx,0,_w,h,0,_dy,_w,h),locations[1]={x:0,y:_dy,w:_w,h:texH}}_this.freePointer.x=secondTexW,_this.freePointer.row++},moveToStartOfNextRow=function(){_this.freePointer.x=0,_this.freePointer.row++};if(this.freePointer.x+texW<=texSize)drawNormal();else{if(this.freePointer.row>=texRows-1)return!1;this.freePointer.x===texSize?(moveToStartOfNextRow(),drawNormal()):this.enableWrapping?drawWrapped():(moveToStartOfNextRow(),drawNormal())}return this.keyToLocation.set(key,locations),this.needsBuffer=!0,locations}},{key:"getOffsets",value:function(key){return this.keyToLocation.get(key)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(bb){if(this.locked)return!1;var texSize=this.texSize,texRows=this.texRows,_this$getScale2=this.getScale(bb),texW=_this$getScale2.texW;return this.freePointer.x+texW>texSize?this.freePointer.row<texRows-1:!0}},{key:"bufferIfNeeded",value:function(gl){this.texture||(this.texture=createTexture(gl,this.debugID)),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}}])})(),AtlasCollection=(function(){function AtlasCollection2(r,texSize,texRows,createTextureCanvas2){_classCallCheck(this,AtlasCollection2),this.r=r,this.texSize=texSize,this.texRows=texRows,this.createTextureCanvas=createTextureCanvas2,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return _createClass(AtlasCollection2,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,texSize=this.texSize,texRows=this.texRows,createTextureCanvas2=this.createTextureCanvas;return new Atlas(r,texSize,texRows,createTextureCanvas2)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,texSize=this.texSize,texRows=this.texRows,createTextureCanvas2=this.createTextureCanvas,texHeight=Math.floor(texSize/texRows);this.scratch=createTextureCanvas2(r,texSize,texHeight,"scratch")}return this.scratch}},{key:"draw",value:function(key,bb,doDrawing){var atlas=this.styleKeyToAtlas.get(key);return atlas||(atlas=this.atlases[this.atlases.length-1],(!atlas||!atlas.canFit(bb))&&(atlas&&atlas.lock(),atlas=this._createAtlas(),this.atlases.push(atlas)),atlas.draw(key,bb,doDrawing),this.styleKeyToAtlas.set(key,atlas)),atlas}},{key:"getAtlas",value:function(key){return this.styleKeyToAtlas.get(key)}},{key:"hasAtlas",value:function(key){return this.styleKeyToAtlas.has(key)}},{key:"markKeyForGC",value:function(key){this.markedKeys.add(key)}},{key:"gc",value:function(){var _this2=this,markedKeys=this.markedKeys;if(markedKeys.size===0){console.log("nothing to garbage collect");return}var newAtlases=[],newStyleKeyToAtlas=new Map,newAtlas=null,_iterator=_createForOfIteratorHelper(this.atlases),_step;try{var _loop=function(){var atlas=_step.value,keys=atlas.getKeys(),keysToCollect=intersection(markedKeys,keys);if(keysToCollect.size===0)return newAtlases.push(atlas),keys.forEach(function(k){return newStyleKeyToAtlas.set(k,atlas)}),1;newAtlas||(newAtlas=_this2._createAtlas(),newAtlases.push(newAtlas));var _iterator2=_createForOfIteratorHelper(keys),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var key=_step2.value;if(!keysToCollect.has(key)){var _atlas$getOffsets=atlas.getOffsets(key),_atlas$getOffsets2=_slicedToArray(_atlas$getOffsets,2),s1=_atlas$getOffsets2[0],s2=_atlas$getOffsets2[1];newAtlas.canFit({w:s1.w+s2.w,h:s1.h})||(newAtlas.lock(),newAtlas=_this2._createAtlas(),newAtlases.push(newAtlas)),atlas.canvas&&(_this2._copyTextureToNewAtlas(key,atlas,newAtlas),newStyleKeyToAtlas.set(key,newAtlas))}}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}atlas.dispose()};for(_iterator.s();!(_step=_iterator.n()).done;)_loop()}catch(err){_iterator.e(err)}finally{_iterator.f()}this.atlases=newAtlases,this.styleKeyToAtlas=newStyleKeyToAtlas,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(key,oldAtlas,newAtlas){var _oldAtlas$getOffsets=oldAtlas.getOffsets(key),_oldAtlas$getOffsets2=_slicedToArray(_oldAtlas$getOffsets,2),s1=_oldAtlas$getOffsets2[0],s2=_oldAtlas$getOffsets2[1];if(s2.w===0)newAtlas.draw(key,s1,function(context){context.drawImage(oldAtlas.canvas,s1.x,s1.y,s1.w,s1.h,0,0,s1.w,s1.h)});else{var scratch=this._getScratchCanvas();scratch.clear(),scratch.context.drawImage(oldAtlas.canvas,s1.x,s1.y,s1.w,s1.h,0,0,s1.w,s1.h),scratch.context.drawImage(oldAtlas.canvas,s2.x,s2.y,s2.w,s2.h,s1.w,0,s2.w,s2.h);var w=s1.w+s2.w,h=s1.h;newAtlas.draw(key,{w,h},function(context){context.drawImage(scratch,0,0,w,h,0,0,w,h)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function intersection(set1,set2){return set1.intersection?set1.intersection(set2):new Set(_toConsumableArray(set1).filter(function(x2){return set2.has(x2)}))}var AtlasManager=(function(){function AtlasManager2(r,globalOptions){_classCallCheck(this,AtlasManager2),this.r=r,this.globalOptions=globalOptions,this.atlasSize=globalOptions.webglTexSize,this.maxAtlasesPerBatch=globalOptions.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return _createClass(AtlasManager2,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(collectionName,atlasCollectionOptions){var _this$globalOptions=this.globalOptions,webglTexSize=_this$globalOptions.webglTexSize,createTextureCanvas2=_this$globalOptions.createTextureCanvas,texRows=atlasCollectionOptions.texRows,cachedCreateTextureCanvas=this._cacheScratchCanvas(createTextureCanvas2),atlasCollection=new AtlasCollection(this.r,webglTexSize,texRows,cachedCreateTextureCanvas);this.collections.set(collectionName,atlasCollection)}},{key:"addRenderType",value:function(type,renderTypeOptions){var collection4=renderTypeOptions.collection;if(!this.collections.has(collection4))throw new Error("invalid atlas collection name '".concat(collection4,"'"));var atlasCollection=this.collections.get(collection4),opts=extend({type,atlasCollection},renderTypeOptions);this.renderTypes.set(type,opts)}},{key:"getRenderTypeOpts",value:function(type){return this.renderTypes.get(type)}},{key:"getAtlasCollection",value:function(name){return this.collections.get(name)}},{key:"_cacheScratchCanvas",value:function(createTextureCanvas2){var prevW=-1,prevH=-1,scratchCanvas=null;return function(r,w,h,scratch){return scratch?((!scratchCanvas||w!=prevW||h!=prevH)&&(prevW=w,prevH=h,scratchCanvas=createTextureCanvas2(r,w,h)),scratchCanvas):createTextureCanvas2(r,w,h)}}},{key:"_key",value:function(renderType,id2){return"".concat(renderType,"-").concat(id2)}},{key:"invalidate",value:function(eles){var _this3=this,_ref2=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_ref2$forceRedraw=_ref2.forceRedraw,forceRedraw=_ref2$forceRedraw===void 0?!1:_ref2$forceRedraw,_ref2$filterEle=_ref2.filterEle,filterEle=_ref2$filterEle===void 0?function(){return!0}:_ref2$filterEle,_ref2$filterType=_ref2.filterType,filterType=_ref2$filterType===void 0?function(){return!0}:_ref2$filterType,needGC=!1,runGCNow=!1,_iterator3=_createForOfIteratorHelper(eles),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var ele=_step3.value;if(filterEle(ele)){var _iterator4=_createForOfIteratorHelper(this.renderTypes.values()),_step4;try{var _loop2=function(){var opts=_step4.value,renderType=opts.type;if(filterType(renderType)){var atlasCollection=_this3.collections.get(opts.collection),key=opts.getKey(ele),keyArray=Array.isArray(key)?key:[key];if(forceRedraw)keyArray.forEach(function(key2){return atlasCollection.markKeyForGC(key2)}),runGCNow=!0;else{var id2=opts.getID?opts.getID(ele):ele.id(),mapKey=_this3._key(renderType,id2),oldKeyArray=_this3.typeAndIdToKey.get(mapKey);oldKeyArray!==void 0&&!arrayEqual(keyArray,oldKeyArray)&&(needGC=!0,_this3.typeAndIdToKey.delete(mapKey),oldKeyArray.forEach(function(oldKey){return atlasCollection.markKeyForGC(oldKey)}))}}};for(_iterator4.s();!(_step4=_iterator4.n()).done;)_loop2()}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}return runGCNow&&(this.gc(),needGC=!1),needGC}},{key:"gc",value:function(){var _iterator5=_createForOfIteratorHelper(this.collections.values()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var collection4=_step5.value;collection4.gc()}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}}},{key:"getOrCreateAtlas",value:function(ele,type,bb,styleKey){var opts=this.renderTypes.get(type),atlasCollection=this.collections.get(opts.collection),drawn=!1,atlas=atlasCollection.draw(styleKey,bb,function(context){opts.drawClipped?(context.save(),context.beginPath(),context.rect(0,0,bb.w,bb.h),context.clip(),opts.drawElement(context,ele,bb,!0,!0),context.restore()):opts.drawElement(context,ele,bb,!0,!0),drawn=!0});if(drawn){var id2=opts.getID?opts.getID(ele):ele.id(),mapKey=this._key(type,id2);this.typeAndIdToKey.has(mapKey)?this.typeAndIdToKey.get(mapKey).push(styleKey):this.typeAndIdToKey.set(mapKey,[styleKey])}return atlas}},{key:"getAtlasInfo",value:function(ele,type){var _this4=this,opts=this.renderTypes.get(type),key=opts.getKey(ele),keyArray=Array.isArray(key)?key:[key];return keyArray.map(function(styleKey){var bb=opts.getBoundingBox(ele,styleKey),atlas=_this4.getOrCreateAtlas(ele,type,bb,styleKey),_atlas$getOffsets3=atlas.getOffsets(styleKey),_atlas$getOffsets4=_slicedToArray(_atlas$getOffsets3,2),tex1=_atlas$getOffsets4[0],tex2=_atlas$getOffsets4[1];return{atlas,tex:tex1,tex1,tex2,bb}})}},{key:"getDebugInfo",value:function(){var debugInfo=[],_iterator6=_createForOfIteratorHelper(this.collections),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _step6$value=_slicedToArray(_step6.value,2),name=_step6$value[0],collection4=_step6$value[1],_collection$getCounts=collection4.getCounts(),keyCount=_collection$getCounts.keyCount,atlasCount=_collection$getCounts.atlasCount;debugInfo.push({type:name,keyCount,atlasCount})}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}return debugInfo}}])})(),AtlasBatchManager=(function(){function AtlasBatchManager2(globalOptions){_classCallCheck(this,AtlasBatchManager2),this.globalOptions=globalOptions,this.atlasSize=globalOptions.webglTexSize,this.maxAtlasesPerBatch=globalOptions.webglTexPerBatch,this.batchAtlases=[]}return _createClass(AtlasBatchManager2,[{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(v,i){return i})}},{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(atlas){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(atlas):!0}},{key:"getAtlasIndexForBatch",value:function(atlas){var atlasID=this.batchAtlases.indexOf(atlas);if(atlasID<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(atlas),atlasID=this.batchAtlases.length-1}return atlasID}}])})(),circleSD=`
|
|
18
|
+
float circleSD(vec2 p, float r) {
|
|
19
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
20
|
+
}
|
|
21
|
+
`,rectangleSD=`
|
|
22
|
+
float rectangleSD(vec2 p, vec2 b) {
|
|
23
|
+
vec2 d = abs(p)-b;
|
|
24
|
+
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
25
|
+
}
|
|
26
|
+
`,roundRectangleSD=`
|
|
27
|
+
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
28
|
+
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
29
|
+
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
30
|
+
vec2 q = abs(p) - b + cr.x;
|
|
31
|
+
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
32
|
+
}
|
|
33
|
+
`,ellipseSD=`
|
|
34
|
+
float ellipseSD(vec2 p, vec2 ab) {
|
|
35
|
+
p = abs( p ); // symmetry
|
|
36
|
+
|
|
37
|
+
// find root with Newton solver
|
|
38
|
+
vec2 q = ab*(p-ab);
|
|
39
|
+
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
40
|
+
for( int i=0; i<5; i++ ) {
|
|
41
|
+
vec2 cs = vec2(cos(w),sin(w));
|
|
42
|
+
vec2 u = ab*vec2( cs.x,cs.y);
|
|
43
|
+
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
44
|
+
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// compute final point and distance
|
|
48
|
+
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
49
|
+
|
|
50
|
+
// return signed distance
|
|
51
|
+
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
52
|
+
}
|
|
53
|
+
`,RENDER_TARGET={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},TEX_PICKING_MODE={IGNORE:1,USE_BB:2},TEXTURE=0,EDGE_STRAIGHT=1,EDGE_CURVE_SEGMENT=2,EDGE_ARROW=3,RECTANGLE=4,ROUND_RECTANGLE=5,BOTTOM_ROUND_RECTANGLE=6,ELLIPSE=7,ElementDrawingWebGL=(function(){function ElementDrawingWebGL2(r,gl,opts){_classCallCheck(this,ElementDrawingWebGL2),this.r=r,this.gl=gl,this.maxInstances=opts.webglBatchSize,this.atlasSize=opts.webglTexSize,this.bgColor=opts.bgColor,this.debug=opts.webglDebug,this.batchDebugInfo=[],opts.enableWrapping=!0,opts.createTextureCanvas=createTextureCanvas,this.atlasManager=new AtlasManager(r,opts),this.batchManager=new AtlasBatchManager(opts),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(RENDER_TARGET.SCREEN),this.pickingProgram=this._createShaderProgram(RENDER_TARGET.PICKING),this.vao=this._createVAO()}return _createClass(ElementDrawingWebGL2,[{key:"addAtlasCollection",value:function(collectionName,opts){this.atlasManager.addAtlasCollection(collectionName,opts)}},{key:"addTextureAtlasRenderType",value:function(typeName,opts){this.atlasManager.addRenderType(typeName,opts)}},{key:"addSimpleShapeRenderType",value:function(typeName,opts){this.simpleShapeOptions.set(typeName,opts)}},{key:"invalidate",value:function(eles){var _ref=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},type=_ref.type,atlasManager=this.atlasManager;return type?atlasManager.invalidate(eles,{filterType:function(t){return t===type},forceRedraw:!0}):atlasManager.invalidate(eles)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(renderTarget){var gl=this.gl,vertexShaderSource=`#version 300 es
|
|
54
|
+
precision highp float;
|
|
55
|
+
|
|
56
|
+
uniform mat3 uPanZoomMatrix;
|
|
57
|
+
uniform int uAtlasSize;
|
|
58
|
+
|
|
59
|
+
// instanced
|
|
60
|
+
in vec2 aPosition; // a vertex from the unit square
|
|
61
|
+
|
|
62
|
+
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
63
|
+
in int aVertType; // the type of thing we are rendering
|
|
64
|
+
|
|
65
|
+
// the z-index that is output when using picking mode
|
|
66
|
+
in vec4 aIndex;
|
|
67
|
+
|
|
68
|
+
// For textures
|
|
69
|
+
in int aAtlasId; // which shader unit/atlas to use
|
|
70
|
+
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
71
|
+
|
|
72
|
+
// for edges
|
|
73
|
+
in vec4 aPointAPointB;
|
|
74
|
+
in vec4 aPointCPointD;
|
|
75
|
+
in vec2 aLineWidth; // also used for node border width
|
|
76
|
+
|
|
77
|
+
// simple shapes
|
|
78
|
+
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
79
|
+
in vec4 aColor; // also used for edges
|
|
80
|
+
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
81
|
+
|
|
82
|
+
// output values passed to the fragment shader
|
|
83
|
+
out vec2 vTexCoord;
|
|
84
|
+
out vec4 vColor;
|
|
85
|
+
out vec2 vPosition;
|
|
86
|
+
// flat values are not interpolated
|
|
87
|
+
flat out int vAtlasId;
|
|
88
|
+
flat out int vVertType;
|
|
89
|
+
flat out vec2 vTopRight;
|
|
90
|
+
flat out vec2 vBotLeft;
|
|
91
|
+
flat out vec4 vCornerRadius;
|
|
92
|
+
flat out vec4 vBorderColor;
|
|
93
|
+
flat out vec2 vBorderWidth;
|
|
94
|
+
flat out vec4 vIndex;
|
|
95
|
+
|
|
96
|
+
void main(void) {
|
|
97
|
+
int vid = gl_VertexID;
|
|
98
|
+
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
99
|
+
|
|
100
|
+
if(aVertType == `.concat(TEXTURE,`) {
|
|
101
|
+
float texX = aTex.x; // texture coordinates
|
|
102
|
+
float texY = aTex.y;
|
|
103
|
+
float texW = aTex.z;
|
|
104
|
+
float texH = aTex.w;
|
|
105
|
+
|
|
106
|
+
if(vid == 1 || vid == 2 || vid == 4) {
|
|
107
|
+
texX += texW;
|
|
108
|
+
}
|
|
109
|
+
if(vid == 2 || vid == 4 || vid == 5) {
|
|
110
|
+
texY += texH;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
float d = float(uAtlasSize);
|
|
114
|
+
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
115
|
+
|
|
116
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
117
|
+
}
|
|
118
|
+
else if(aVertType == `).concat(RECTANGLE," || aVertType == ").concat(ELLIPSE,`
|
|
119
|
+
|| aVertType == `).concat(ROUND_RECTANGLE," || aVertType == ").concat(BOTTOM_ROUND_RECTANGLE,`) { // simple shapes
|
|
120
|
+
|
|
121
|
+
// the bounding box is needed by the fragment shader
|
|
122
|
+
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
123
|
+
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
124
|
+
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
125
|
+
|
|
126
|
+
// calculations are done in the fragment shader, just pass these along
|
|
127
|
+
vColor = aColor;
|
|
128
|
+
vCornerRadius = aCornerRadius;
|
|
129
|
+
vBorderColor = aBorderColor;
|
|
130
|
+
vBorderWidth = aLineWidth;
|
|
131
|
+
|
|
132
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
133
|
+
}
|
|
134
|
+
else if(aVertType == `).concat(EDGE_STRAIGHT,`) {
|
|
135
|
+
vec2 source = aPointAPointB.xy;
|
|
136
|
+
vec2 target = aPointAPointB.zw;
|
|
137
|
+
|
|
138
|
+
// adjust the geometry so that the line is centered on the edge
|
|
139
|
+
position.y = position.y - 0.5;
|
|
140
|
+
|
|
141
|
+
// stretch the unit square into a long skinny rectangle
|
|
142
|
+
vec2 xBasis = target - source;
|
|
143
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
144
|
+
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
145
|
+
|
|
146
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
147
|
+
vColor = aColor;
|
|
148
|
+
}
|
|
149
|
+
else if(aVertType == `).concat(EDGE_CURVE_SEGMENT,`) {
|
|
150
|
+
vec2 pointA = aPointAPointB.xy;
|
|
151
|
+
vec2 pointB = aPointAPointB.zw;
|
|
152
|
+
vec2 pointC = aPointCPointD.xy;
|
|
153
|
+
vec2 pointD = aPointCPointD.zw;
|
|
154
|
+
|
|
155
|
+
// adjust the geometry so that the line is centered on the edge
|
|
156
|
+
position.y = position.y - 0.5;
|
|
157
|
+
|
|
158
|
+
vec2 p0, p1, p2, pos;
|
|
159
|
+
if(position.x == 0.0) { // The left side of the unit square
|
|
160
|
+
p0 = pointA;
|
|
161
|
+
p1 = pointB;
|
|
162
|
+
p2 = pointC;
|
|
163
|
+
pos = position;
|
|
164
|
+
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
165
|
+
p0 = pointD;
|
|
166
|
+
p1 = pointC;
|
|
167
|
+
p2 = pointB;
|
|
168
|
+
pos = vec2(0.0, -position.y);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
vec2 p01 = p1 - p0;
|
|
172
|
+
vec2 p12 = p2 - p1;
|
|
173
|
+
vec2 p21 = p1 - p2;
|
|
174
|
+
|
|
175
|
+
// Find the normal vector.
|
|
176
|
+
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
177
|
+
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
178
|
+
|
|
179
|
+
// Find the vector perpendicular to p0 -> p1.
|
|
180
|
+
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
181
|
+
|
|
182
|
+
// Determine the bend direction.
|
|
183
|
+
float sigma = sign(dot(p01 + p21, normal));
|
|
184
|
+
float width = aLineWidth[0];
|
|
185
|
+
|
|
186
|
+
if(sign(pos.y) == -sigma) {
|
|
187
|
+
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
188
|
+
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
189
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
190
|
+
} else {
|
|
191
|
+
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
192
|
+
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
193
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
vColor = aColor;
|
|
197
|
+
}
|
|
198
|
+
else if(aVertType == `).concat(EDGE_ARROW,` && vid < 3) {
|
|
199
|
+
// massage the first triangle into an edge arrow
|
|
200
|
+
if(vid == 0)
|
|
201
|
+
position = vec2(-0.15, -0.3);
|
|
202
|
+
if(vid == 1)
|
|
203
|
+
position = vec2( 0.0, 0.0);
|
|
204
|
+
if(vid == 2)
|
|
205
|
+
position = vec2( 0.15, -0.3);
|
|
206
|
+
|
|
207
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
208
|
+
vColor = aColor;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
vAtlasId = aAtlasId;
|
|
215
|
+
vVertType = aVertType;
|
|
216
|
+
vIndex = aIndex;
|
|
217
|
+
}
|
|
218
|
+
`),idxs=this.batchManager.getIndexArray(),fragmentShaderSource=`#version 300 es
|
|
219
|
+
precision highp float;
|
|
220
|
+
|
|
221
|
+
// declare texture unit for each texture atlas in the batch
|
|
222
|
+
`.concat(idxs.map(function(i2){return"uniform sampler2D uTexture".concat(i2,";")}).join(`
|
|
223
|
+
`),`
|
|
224
|
+
|
|
225
|
+
uniform vec4 uBGColor;
|
|
226
|
+
uniform float uZoom;
|
|
227
|
+
|
|
228
|
+
in vec2 vTexCoord;
|
|
229
|
+
in vec4 vColor;
|
|
230
|
+
in vec2 vPosition; // model coordinates
|
|
231
|
+
|
|
232
|
+
flat in int vAtlasId;
|
|
233
|
+
flat in vec4 vIndex;
|
|
234
|
+
flat in int vVertType;
|
|
235
|
+
flat in vec2 vTopRight;
|
|
236
|
+
flat in vec2 vBotLeft;
|
|
237
|
+
flat in vec4 vCornerRadius;
|
|
238
|
+
flat in vec4 vBorderColor;
|
|
239
|
+
flat in vec2 vBorderWidth;
|
|
240
|
+
|
|
241
|
+
out vec4 outColor;
|
|
242
|
+
|
|
243
|
+
`).concat(circleSD,`
|
|
244
|
+
`).concat(rectangleSD,`
|
|
245
|
+
`).concat(roundRectangleSD,`
|
|
246
|
+
`).concat(ellipseSD,`
|
|
247
|
+
|
|
248
|
+
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
249
|
+
return vec4(
|
|
250
|
+
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
251
|
+
top.a + (bot.a * (1.0 - top.a))
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
256
|
+
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
257
|
+
// note 1.5 is an aribitrary value chosen because it looks good
|
|
258
|
+
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
void main(void) {
|
|
262
|
+
if(vVertType == `).concat(TEXTURE,`) {
|
|
263
|
+
// look up the texel from the texture unit
|
|
264
|
+
`).concat(idxs.map(function(i2){return"if(vAtlasId == ".concat(i2,") outColor = texture(uTexture").concat(i2,", vTexCoord);")}).join(`
|
|
265
|
+
else `),`
|
|
266
|
+
}
|
|
267
|
+
else if(vVertType == `).concat(EDGE_ARROW,`) {
|
|
268
|
+
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
269
|
+
outColor = blend(vColor, uBGColor);
|
|
270
|
+
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
271
|
+
}
|
|
272
|
+
else if(vVertType == `).concat(RECTANGLE,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
273
|
+
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
274
|
+
}
|
|
275
|
+
else if(vVertType == `).concat(RECTANGLE," || vVertType == ").concat(ELLIPSE,`
|
|
276
|
+
|| vVertType == `).concat(ROUND_RECTANGLE," || vVertType == ").concat(BOTTOM_ROUND_RECTANGLE,`) { // use SDF
|
|
277
|
+
|
|
278
|
+
float outerBorder = vBorderWidth[0];
|
|
279
|
+
float innerBorder = vBorderWidth[1];
|
|
280
|
+
float borderPadding = outerBorder * 2.0;
|
|
281
|
+
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
282
|
+
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
283
|
+
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
284
|
+
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
285
|
+
|
|
286
|
+
float d; // signed distance
|
|
287
|
+
if(vVertType == `).concat(RECTANGLE,`) {
|
|
288
|
+
d = rectangleSD(p, b);
|
|
289
|
+
} else if(vVertType == `).concat(ELLIPSE,` && w == h) {
|
|
290
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
291
|
+
} else if(vVertType == `).concat(ELLIPSE,`) {
|
|
292
|
+
d = ellipseSD(p, b);
|
|
293
|
+
} else {
|
|
294
|
+
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
298
|
+
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
299
|
+
if(d > 0.0) {
|
|
300
|
+
if(d > outerBorder) {
|
|
301
|
+
discard;
|
|
302
|
+
} else {
|
|
303
|
+
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
if(d > innerBorder) {
|
|
307
|
+
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
308
|
+
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
309
|
+
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
vec4 outerColor;
|
|
313
|
+
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
314
|
+
outerColor = vec4(0);
|
|
315
|
+
} else if(innerBorder == 0.0) {
|
|
316
|
+
outerColor = vBorderColor;
|
|
317
|
+
} else {
|
|
318
|
+
outerColor = blend(vBorderColor, vColor);
|
|
319
|
+
}
|
|
320
|
+
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
outColor = vColor;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
`).concat(renderTarget.picking?`if(outColor.a == 0.0) discard;
|
|
329
|
+
else outColor = vIndex;`:"",`
|
|
330
|
+
}
|
|
331
|
+
`),program=createProgram(gl,vertexShaderSource,fragmentShaderSource);program.aPosition=gl.getAttribLocation(program,"aPosition"),program.aIndex=gl.getAttribLocation(program,"aIndex"),program.aVertType=gl.getAttribLocation(program,"aVertType"),program.aTransform=gl.getAttribLocation(program,"aTransform"),program.aAtlasId=gl.getAttribLocation(program,"aAtlasId"),program.aTex=gl.getAttribLocation(program,"aTex"),program.aPointAPointB=gl.getAttribLocation(program,"aPointAPointB"),program.aPointCPointD=gl.getAttribLocation(program,"aPointCPointD"),program.aLineWidth=gl.getAttribLocation(program,"aLineWidth"),program.aColor=gl.getAttribLocation(program,"aColor"),program.aCornerRadius=gl.getAttribLocation(program,"aCornerRadius"),program.aBorderColor=gl.getAttribLocation(program,"aBorderColor"),program.uPanZoomMatrix=gl.getUniformLocation(program,"uPanZoomMatrix"),program.uAtlasSize=gl.getUniformLocation(program,"uAtlasSize"),program.uBGColor=gl.getUniformLocation(program,"uBGColor"),program.uZoom=gl.getUniformLocation(program,"uZoom"),program.uTextures=[];for(var i=0;i<this.batchManager.getMaxAtlasesPerBatch();i++)program.uTextures.push(gl.getUniformLocation(program,"uTexture".concat(i)));return program}},{key:"_createVAO",value:function(){var unitSquare=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=unitSquare.length/2;var n=this.maxInstances,gl=this.gl,program=this.program,vao=gl.createVertexArray();return gl.bindVertexArray(vao),createBufferStaticDraw(gl,"vec2",program.aPosition,unitSquare),this.transformBuffer=create3x3MatrixBufferDynamicDraw(gl,n,program.aTransform),this.indexBuffer=createBufferDynamicDraw(gl,n,"vec4",program.aIndex),this.vertTypeBuffer=createBufferDynamicDraw(gl,n,"int",program.aVertType),this.atlasIdBuffer=createBufferDynamicDraw(gl,n,"int",program.aAtlasId),this.texBuffer=createBufferDynamicDraw(gl,n,"vec4",program.aTex),this.pointAPointBBuffer=createBufferDynamicDraw(gl,n,"vec4",program.aPointAPointB),this.pointCPointDBuffer=createBufferDynamicDraw(gl,n,"vec4",program.aPointCPointD),this.lineWidthBuffer=createBufferDynamicDraw(gl,n,"vec2",program.aLineWidth),this.colorBuffer=createBufferDynamicDraw(gl,n,"vec4",program.aColor),this.cornerRadiusBuffer=createBufferDynamicDraw(gl,n,"vec4",program.aCornerRadius),this.borderColorBuffer=createBufferDynamicDraw(gl,n,"vec4",program.aBorderColor),gl.bindVertexArray(null),vao}},{key:"buffers",get:function(){var _this=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(k){return endsWith(k,"Buffer")}).map(function(k){return _this[k]})),this._buffers}},{key:"startFrame",value:function(panZoomMatrix){var renderTarget=arguments.length>1&&arguments[1]!==void 0?arguments[1]:RENDER_TARGET.SCREEN;this.panZoomMatrix=panZoomMatrix,this.renderTarget=renderTarget,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(ele,opts){return ele.visible()?opts&&opts.isVisible?opts.isVisible(ele):!0:!1}},{key:"drawTexture",value:function(ele,eleIndex,type){var atlasManager=this.atlasManager,batchManager=this.batchManager,opts=atlasManager.getRenderTypeOpts(type);if(this._isVisible(ele,opts)&&!(ele.isEdge()&&!this._isValidEdge(ele))){if(this.renderTarget.picking&&opts.getTexPickingMode){var mode=opts.getTexPickingMode(ele);if(mode===TEX_PICKING_MODE.IGNORE)return;if(mode==TEX_PICKING_MODE.USE_BB){this.drawPickingRectangle(ele,eleIndex,type);return}}var atlasInfoArray=atlasManager.getAtlasInfo(ele,type),_iterator=_createForOfIteratorHelper(atlasInfoArray),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var atlasInfo=_step.value,atlas=atlasInfo.atlas,tex1=atlasInfo.tex1,tex2=atlasInfo.tex2;batchManager.canAddToCurrentBatch(atlas)||this.endBatch();for(var atlasIndex=batchManager.getAtlasIndexForBatch(atlas),_i=0,_arr=[[tex1,!0],[tex2,!1]];_i<_arr.length;_i++){var _arr$_i=_slicedToArray(_arr[_i],2),tex=_arr$_i[0],first2=_arr$_i[1];if(tex.w!=0){var instance=this.instanceCount;this.vertTypeBuffer.getView(instance)[0]=TEXTURE;var indexView=this.indexBuffer.getView(instance);indexToVec4(eleIndex,indexView);var atlasIdView=this.atlasIdBuffer.getView(instance);atlasIdView[0]=atlasIndex;var texView=this.texBuffer.getView(instance);texView[0]=tex.x,texView[1]=tex.y,texView[2]=tex.w,texView[3]=tex.h;var matrixView=this.transformBuffer.getMatrixView(instance);this.setTransformMatrix(ele,matrixView,opts,atlasInfo,first2),this.instanceCount++,first2||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(err){_iterator.e(err)}finally{_iterator.f()}}}},{key:"setTransformMatrix",value:function(ele,matrix,opts,atlasInfo){var first2=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,padding=0;if(opts.shapeProps&&opts.shapeProps.padding&&(padding=ele.pstyle(opts.shapeProps.padding).pfValue),atlasInfo){var bb=atlasInfo.bb,tex1=atlasInfo.tex1,tex2=atlasInfo.tex2,ratio=tex1.w/(tex1.w+tex2.w);first2||(ratio=1-ratio);var adjBB=this._getAdjustedBB(bb,padding,first2,ratio);this._applyTransformMatrix(matrix,adjBB,opts,ele)}else{var _bb=opts.getBoundingBox(ele),_adjBB=this._getAdjustedBB(_bb,padding,!0,1);this._applyTransformMatrix(matrix,_adjBB,opts,ele)}}},{key:"_applyTransformMatrix",value:function(matrix,adjBB,opts,ele){var x2,y2;identity2(matrix);var theta=opts.getRotation?opts.getRotation(ele):0;if(theta!==0){var _opts$getRotationPoin=opts.getRotationPoint(ele),sx=_opts$getRotationPoin.x,sy=_opts$getRotationPoin.y;translate(matrix,matrix,[sx,sy]),rotate(matrix,matrix,theta);var offset=opts.getRotationOffset(ele);x2=offset.x+(adjBB.xOffset||0),y2=offset.y+(adjBB.yOffset||0)}else x2=adjBB.x1,y2=adjBB.y1;translate(matrix,matrix,[x2,y2]),scale(matrix,matrix,[adjBB.w,adjBB.h])}},{key:"_getAdjustedBB",value:function(bb,padding,first2,ratio){var x1=bb.x1,y1=bb.y1,w=bb.w,h=bb.h,yOffset=bb.yOffset;padding&&(x1-=padding,y1-=padding,w+=2*padding,h+=2*padding);var xOffset=0,adjW=w*ratio;return first2&&ratio<1?w=adjW:!first2&&ratio<1&&(xOffset=w-adjW,x1+=xOffset,w=adjW),{x1,y1,w,h,xOffset,yOffset}}},{key:"drawPickingRectangle",value:function(ele,eleIndex,type){var opts=this.atlasManager.getRenderTypeOpts(type),instance=this.instanceCount;this.vertTypeBuffer.getView(instance)[0]=RECTANGLE;var indexView=this.indexBuffer.getView(instance);indexToVec4(eleIndex,indexView);var colorView=this.colorBuffer.getView(instance);toWebGLColor([0,0,0],1,colorView);var matrixView=this.transformBuffer.getMatrixView(instance);this.setTransformMatrix(ele,matrixView,opts),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(node,eleIndex,type){var opts=this.simpleShapeOptions.get(type);if(this._isVisible(node,opts)){var props=opts.shapeProps,vertType=this._getVertTypeForShape(node,props.shape);if(vertType===void 0||opts.isSimple&&!opts.isSimple(node,this.renderTarget)){this.drawTexture(node,eleIndex,type);return}var instance=this.instanceCount;if(this.vertTypeBuffer.getView(instance)[0]=vertType,vertType===ROUND_RECTANGLE||vertType===BOTTOM_ROUND_RECTANGLE){var bb=opts.getBoundingBox(node),radius2=this._getCornerRadius(node,props.radius,bb),radiusView=this.cornerRadiusBuffer.getView(instance);radiusView[0]=radius2,radiusView[1]=radius2,radiusView[2]=radius2,radiusView[3]=radius2,vertType===BOTTOM_ROUND_RECTANGLE&&(radiusView[0]=0,radiusView[2]=0)}var indexView=this.indexBuffer.getView(instance);indexToVec4(eleIndex,indexView);var opacity=this.renderTarget.picking?1:node.pstyle(props.opacity).value,color=node.pstyle(props.color).value,colorView=this.colorBuffer.getView(instance);toWebGLColor(color,opacity,colorView);var lineWidthView=this.lineWidthBuffer.getView(instance);if(lineWidthView[0]=0,lineWidthView[1]=0,props.border){var borderWidth=node.pstyle("border-width").value;if(borderWidth>0){var borderColor=node.pstyle("border-color").value,borderOpacity=node.pstyle("border-opacity").value,borderColorView=this.borderColorBuffer.getView(instance);toWebGLColor(borderColor,borderOpacity,borderColorView);var borderPos=node.pstyle("border-position").value;if(borderPos==="inside")lineWidthView[0]=0,lineWidthView[1]=-borderWidth;else if(borderPos==="outside")lineWidthView[0]=borderWidth,lineWidthView[1]=0;else{var halfWidth=borderWidth/2;lineWidthView[0]=halfWidth,lineWidthView[1]=-halfWidth}}}var matrixView=this.transformBuffer.getMatrixView(instance);this.setTransformMatrix(node,matrixView,opts),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(node,shapeProp){var shape=node.pstyle(shapeProp).value;switch(shape){case"rectangle":return RECTANGLE;case"ellipse":return ELLIPSE;case"roundrectangle":case"round-rectangle":return ROUND_RECTANGLE;case"bottom-round-rectangle":return BOTTOM_ROUND_RECTANGLE;default:return}}},{key:"_getCornerRadius",value:function(node,radiusProp,_ref2){var w=_ref2.w,h=_ref2.h;if(node.pstyle(radiusProp).value==="auto")return getRoundRectangleRadius(w,h);var radius2=node.pstyle(radiusProp).pfValue,halfWidth=w/2,halfHeight=h/2;return Math.min(radius2,halfHeight,halfWidth)}},{key:"drawEdgeArrow",value:function(edge,eleIndex,prefix){if(edge.visible()){var rs=edge._private.rscratch,x2,y2,angle2;if(prefix==="source"?(x2=rs.arrowStartX,y2=rs.arrowStartY,angle2=rs.srcArrowAngle):(x2=rs.arrowEndX,y2=rs.arrowEndY,angle2=rs.tgtArrowAngle),!(isNaN(x2)||x2==null||isNaN(y2)||y2==null||isNaN(angle2)||angle2==null)){var arrowShape=edge.pstyle(prefix+"-arrow-shape").value;if(arrowShape!=="none"){var color=edge.pstyle(prefix+"-arrow-color").value,baseOpacity=edge.pstyle("opacity").value,lineOpacity=edge.pstyle("line-opacity").value,opacity=baseOpacity*lineOpacity,lineWidth=edge.pstyle("width").pfValue,scale$1=edge.pstyle("arrow-scale").value,size3=this.r.getArrowWidth(lineWidth,scale$1),instance=this.instanceCount,transform7=this.transformBuffer.getMatrixView(instance);identity2(transform7),translate(transform7,transform7,[x2,y2]),scale(transform7,transform7,[size3,size3]),rotate(transform7,transform7,angle2),this.vertTypeBuffer.getView(instance)[0]=EDGE_ARROW;var indexView=this.indexBuffer.getView(instance);indexToVec4(eleIndex,indexView);var colorView=this.colorBuffer.getView(instance);toWebGLColor(color,opacity,colorView),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(edge,eleIndex){if(edge.visible()){var points=this._getEdgePoints(edge);if(points){var baseOpacity=edge.pstyle("opacity").value,lineOpacity=edge.pstyle("line-opacity").value,width2=edge.pstyle("width").pfValue,color=edge.pstyle("line-color").value,opacity=baseOpacity*lineOpacity;if(points.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),points.length==4){var instance=this.instanceCount;this.vertTypeBuffer.getView(instance)[0]=EDGE_STRAIGHT;var indexView=this.indexBuffer.getView(instance);indexToVec4(eleIndex,indexView);var colorView=this.colorBuffer.getView(instance);toWebGLColor(color,opacity,colorView);var lineWidthBuffer=this.lineWidthBuffer.getView(instance);lineWidthBuffer[0]=width2;var sourceTargetView=this.pointAPointBBuffer.getView(instance);sourceTargetView[0]=points[0],sourceTargetView[1]=points[1],sourceTargetView[2]=points[2],sourceTargetView[3]=points[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var i=0;i<points.length-2;i+=2){var _instance=this.instanceCount;this.vertTypeBuffer.getView(_instance)[0]=EDGE_CURVE_SEGMENT;var _indexView=this.indexBuffer.getView(_instance);indexToVec4(eleIndex,_indexView);var _colorView=this.colorBuffer.getView(_instance);toWebGLColor(color,opacity,_colorView);var _lineWidthBuffer=this.lineWidthBuffer.getView(_instance);_lineWidthBuffer[0]=width2;var pAx=points[i-2],pAy=points[i-1],pBx=points[i],pBy=points[i+1],pCx=points[i+2],pCy=points[i+3],pDx=points[i+4],pDy=points[i+5];i==0&&(pAx=2*pBx-pCx+.001,pAy=2*pBy-pCy+.001),i==points.length-4&&(pDx=2*pCx-pBx+.001,pDy=2*pCy-pBy+.001);var pointABView=this.pointAPointBBuffer.getView(_instance);pointABView[0]=pAx,pointABView[1]=pAy,pointABView[2]=pBx,pointABView[3]=pBy;var pointCDView=this.pointCPointDBuffer.getView(_instance);pointCDView[0]=pCx,pointCDView[1]=pCy,pointCDView[2]=pDx,pointCDView[3]=pDy,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(edge){var rs=edge._private.rscratch;return!(rs.badLine||rs.allpts==null||isNaN(rs.allpts[0]))}},{key:"_getEdgePoints",value:function(edge){var rs=edge._private.rscratch;if(this._isValidEdge(edge)){var controlPoints3=rs.allpts;if(controlPoints3.length==4)return controlPoints3;var numSegments=this._getNumSegments(edge);return this._getCurveSegmentPoints(controlPoints3,numSegments)}}},{key:"_getNumSegments",value:function(edge){var numSegments=15;return Math.min(Math.max(numSegments,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(controlPoints3,segments){if(controlPoints3.length==4)return controlPoints3;for(var curvePoints=Array((segments+1)*2),i=0;i<=segments;i++)if(i==0)curvePoints[0]=controlPoints3[0],curvePoints[1]=controlPoints3[1];else if(i==segments)curvePoints[i*2]=controlPoints3[controlPoints3.length-2],curvePoints[i*2+1]=controlPoints3[controlPoints3.length-1];else{var t=i/segments;this._setCurvePoint(controlPoints3,t,curvePoints,i*2)}return curvePoints}},{key:"_setCurvePoint",value:function(points,t,curvePoints,cpi){if(points.length<=2)curvePoints[cpi]=points[0],curvePoints[cpi+1]=points[1];else{for(var newpoints=Array(points.length-2),i=0;i<newpoints.length;i+=2){var x2=(1-t)*points[i]+t*points[i+2],y2=(1-t)*points[i+1]+t*points[i+3];newpoints[i]=x2,newpoints[i+1]=y2}return this._setCurvePoint(newpoints,t,curvePoints,cpi)}}},{key:"endBatch",value:function(){var gl=this.gl,vao=this.vao,vertexCount=this.vertexCount,count=this.instanceCount;if(count!==0){var program=this.renderTarget.picking?this.pickingProgram:this.program;gl.useProgram(program),gl.bindVertexArray(vao);var _iterator2=_createForOfIteratorHelper(this.buffers),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var buffer=_step2.value;buffer.bufferSubData(count)}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}for(var atlases=this.batchManager.getAtlases(),i=0;i<atlases.length;i++)atlases[i].bufferIfNeeded(gl);for(var _i2=0;_i2<atlases.length;_i2++)gl.activeTexture(gl.TEXTURE0+_i2),gl.bindTexture(gl.TEXTURE_2D,atlases[_i2].texture),gl.uniform1i(program.uTextures[_i2],_i2);gl.uniform1f(program.uZoom,getEffectiveZoom(this.r)),gl.uniformMatrix3fv(program.uPanZoomMatrix,!1,this.panZoomMatrix),gl.uniform1i(program.uAtlasSize,this.batchManager.getAtlasSize());var webglBgColor=toWebGLColor(this.bgColor,1);gl.uniform4fv(program.uBGColor,webglBgColor),gl.drawArraysInstanced(gl.TRIANGLES,0,vertexCount,count),gl.bindVertexArray(null),gl.bindTexture(gl.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count,atlasCount:atlases.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var atlasInfo=this.atlasManager.getDebugInfo(),totalAtlases=atlasInfo.reduce(function(count,info){return count+info.atlasCount},0),batchInfo=this.batchDebugInfo,totalInstances=batchInfo.reduce(function(count,info){return count+info.count},0);return{atlasInfo,totalAtlases,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:batchInfo.length,batchInfo,totalInstances}}}])})(),CRp$4={};CRp$4.initWebgl=function(opts,fns){var r=this,gl=r.data.contexts[r.WEBGL];opts.bgColor=getBGColor(r),opts.webglTexSize=Math.min(opts.webglTexSize,gl.getParameter(gl.MAX_TEXTURE_SIZE)),opts.webglTexRows=Math.min(opts.webglTexRows,54),opts.webglTexRowsNodes=Math.min(opts.webglTexRowsNodes,54),opts.webglBatchSize=Math.min(opts.webglBatchSize,16384),opts.webglTexPerBatch=Math.min(opts.webglTexPerBatch,gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=opts.webglDebug,r.webglDebugShowAtlases=opts.webglDebugShowAtlases,r.pickingFrameBuffer=createPickingFrameBuffer(gl),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new ElementDrawingWebGL(r,gl,opts);var getLabelRotation3=function(prop){return function(ele){return r.getTextAngle(ele,prop)}},isLabelVisible=function(prop){return function(ele){var label=ele.pstyle(prop);return label&&label.value}},isLayerVisible=function(prefix){return function(node){return node.pstyle("".concat(prefix,"-opacity")).value>0}},getTexPickingMode=function(ele){var enabled=ele.pstyle("text-events").strValue==="yes";return enabled?TEX_PICKING_MODE.USE_BB:TEX_PICKING_MODE.IGNORE},getBBForSimpleShape=function(node){var _node$position=node.position(),x2=_node$position.x,y2=_node$position.y,w=node.outerWidth(),h=node.outerHeight();return{w,h,x1:x2-w/2,y1:y2-h/2}};r.drawing.addAtlasCollection("node",{texRows:opts.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:opts.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:fns.getStyleKey,getBoundingBox:fns.getElementBox,drawElement:fns.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:getBBForSimpleShape,isSimple:isSimpleShape,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:getBBForSimpleShape,isVisible:isLayerVisible("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:getBBForSimpleShape,isVisible:isLayerVisible("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode,getKey:getStyleKeysForLabel(fns.getLabelKey,null),getBoundingBox:getBoundingBoxForLabel(fns.getLabelBox,null),drawClipped:!0,drawElement:fns.drawLabel,getRotation:getLabelRotation3(null),getRotationPoint:fns.getLabelRotationPoint,getRotationOffset:fns.getLabelRotationOffset,isVisible:isLabelVisible("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode,getKey:getStyleKeysForLabel(fns.getSourceLabelKey,"source"),getBoundingBox:getBoundingBoxForLabel(fns.getSourceLabelBox,"source"),drawClipped:!0,drawElement:fns.drawSourceLabel,getRotation:getLabelRotation3("source"),getRotationPoint:fns.getSourceLabelRotationPoint,getRotationOffset:fns.getSourceLabelRotationOffset,isVisible:isLabelVisible("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode,getKey:getStyleKeysForLabel(fns.getTargetLabelKey,"target"),getBoundingBox:getBoundingBoxForLabel(fns.getTargetLabelBox,"target"),drawClipped:!0,drawElement:fns.drawTargetLabel,getRotation:getLabelRotation3("target"),getRotationPoint:fns.getTargetLabelRotationPoint,getRotationOffset:fns.getTargetLabelRotationOffset,isVisible:isLabelVisible("target-label")});var setGCFlag=debounce(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(willDraw,eles){var gcNeeded=!1;eles&&eles.length>0&&(gcNeeded|=r.drawing.invalidate(eles)),gcNeeded&&setGCFlag()}),overrideCanvasRendererFunctions(r)};function getBGColor(r){var container2=r.cy.container(),cssColor=container2&&container2.style&&container2.style.backgroundColor||"white";return color2tuple(cssColor)}function getLabelLines(ele,prefix){var rs=ele._private.rscratch;return getPrefixedProperty(rs,"labelWrapCachedLines",prefix)||[]}var getStyleKeysForLabel=function(getKey3,prefix){return function(ele){var key=getKey3(ele),lines=getLabelLines(ele,prefix);return lines.length>1?lines.map(function(line,index){return"".concat(key,"_").concat(index)}):key}},getBoundingBoxForLabel=function(getBoundingBox,prefix){return function(ele,styleKey){var bb=getBoundingBox(ele);if(typeof styleKey=="string"){var ui=styleKey.indexOf("_");if(ui>0){var lineIndex=Number(styleKey.substring(ui+1)),lines=getLabelLines(ele,prefix),h=bb.h/lines.length,yOffset=h*lineIndex,y1=bb.y1+yOffset;return{x1:bb.x1,w:bb.w,y1,h,yOffset}}}return bb}};function overrideCanvasRendererFunctions(r){{var renderCanvas=r.render;r.render=function(options2){options2=options2||{};var cy=r.cy;r.webgl&&(cy.zoom()>maxZoom$1?(clearWebgl(r),renderCanvas.call(r,options2)):(clearCanvas(r),renderWebgl(r,options2,RENDER_TARGET.SCREEN)))}}{var baseFunc=r.matchCanvasSize;r.matchCanvasSize=function(container2){baseFunc.call(r,container2),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(x2,y2,interactiveElementsOnly,isTouch){return findNearestElementsWebgl(r,x2,y2)};{var _baseFunc=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){_baseFunc.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var _baseFunc2=r.notify;r.notify=function(eventName,eles){_baseFunc2.call(r,eventName,eles),eventName==="viewport"||eventName==="bounds"?r.pickingFrameBuffer.needsDraw=!0:eventName==="background"&&r.drawing.invalidate(eles,{type:"node-body"})}}}function clearWebgl(r){var gl=r.data.contexts[r.WEBGL];gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT)}function clearCanvas(r){var clear=function(context){context.save(),context.setTransform(1,0,0,1,0,0),context.clearRect(0,0,r.canvasWidth,r.canvasHeight),context.restore()};clear(r.data.contexts[r.NODE]),clear(r.data.contexts[r.DRAG])}function createPanZoomMatrix(r){var width2=r.canvasWidth,height2=r.canvasHeight,_util$getEffectivePan=getEffectivePanZoom(r),pan2=_util$getEffectivePan.pan,zoom2=_util$getEffectivePan.zoom,transform7=create();translate(transform7,transform7,[pan2.x,pan2.y]),scale(transform7,transform7,[zoom2,zoom2]);var projection$1=create();projection(projection$1,width2,height2);var product=create();return multiply(product,projection$1,transform7),product}function setContextTransform(r,context){var width2=r.canvasWidth,height2=r.canvasHeight,_util$getEffectivePan2=getEffectivePanZoom(r),pan2=_util$getEffectivePan2.pan,zoom2=_util$getEffectivePan2.zoom;context.setTransform(1,0,0,1,0,0),context.clearRect(0,0,width2,height2),context.translate(pan2.x,pan2.y),context.scale(zoom2,zoom2)}function drawSelectionRectangle(r,options2){r.drawSelectionRectangle(options2,function(context){return setContextTransform(r,context)})}function drawAxes(r){var context=r.data.contexts[r.NODE];context.save(),setContextTransform(r,context),context.strokeStyle="rgba(0, 0, 0, 0.3)",context.beginPath(),context.moveTo(-1e3,0),context.lineTo(1e3,0),context.stroke(),context.beginPath(),context.moveTo(0,-1e3),context.lineTo(0,1e3),context.stroke(),context.restore()}function drawAtlases(r){var draw=function(drawing,name,row){for(var collection4=drawing.atlasManager.getAtlasCollection(name),context=r.data.contexts[r.NODE],atlases=collection4.atlases,_i=0;_i<atlases.length;_i++){var atlas=atlases[_i],canvas=atlas.canvas;if(canvas){var w=canvas.width,h=canvas.height,x2=w*_i,y2=canvas.height*row,scale2=.4;context.save(),context.scale(scale2,scale2),context.drawImage(canvas,x2,y2),context.strokeStyle="black",context.rect(x2,y2,w,h),context.stroke(),context.restore()}}},i=0;draw(r.drawing,"node",i++),draw(r.drawing,"label",i++)}function getPickingIndexes(r,mX1,mY1,mX2,mY2){var x2,y2,w,h,_util$getEffectivePan3=getEffectivePanZoom(r),pan2=_util$getEffectivePan3.pan,zoom2=_util$getEffectivePan3.zoom;{var _util$modelToRendered=modelToRenderedPosition2(r,pan2,zoom2,mX1,mY1),_util$modelToRendered2=_slicedToArray(_util$modelToRendered,2),cX1=_util$modelToRendered2[0],cY1=_util$modelToRendered2[1],t=6;x2=cX1-t/2,y2=cY1-t/2,w=t,h=t}if(w===0||h===0)return[];var gl=r.data.contexts[r.WEBGL];gl.bindFramebuffer(gl.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(gl.viewport(0,0,gl.canvas.width,gl.canvas.height),renderWebgl(r,null,RENDER_TARGET.PICKING),r.pickingFrameBuffer.needsDraw=!1);var n=w*h,data4=new Uint8Array(n*4);gl.readPixels(x2,y2,w,h,gl.RGBA,gl.UNSIGNED_BYTE,data4),gl.bindFramebuffer(gl.FRAMEBUFFER,null);for(var indexes=new Set,i=0;i<n;i++){var pixel=data4.slice(i*4,i*4+4),index=vec4ToIndex(pixel)-1;index>=0&&indexes.add(index)}return indexes}function findNearestElementsWebgl(r,x2,y2){var indexes=getPickingIndexes(r,x2,y2),eles=r.getCachedZSortedEles(),node,edge,_iterator=_createForOfIteratorHelper(indexes),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var index=_step.value,ele=eles[index];if(!node&&ele.isNode()&&(node=ele),!edge&&ele.isEdge()&&(edge=ele),node&&edge)break}}catch(err){_iterator.e(err)}finally{_iterator.f()}return[node,edge].filter(Boolean)}function drawEle(r,index,ele){var drawing=r.drawing;index+=1,ele.isNode()?(drawing.drawNode(ele,index,"node-underlay"),drawing.drawNode(ele,index,"node-body"),drawing.drawTexture(ele,index,"label"),drawing.drawNode(ele,index,"node-overlay")):(drawing.drawEdgeLine(ele,index),drawing.drawEdgeArrow(ele,index,"source"),drawing.drawEdgeArrow(ele,index,"target"),drawing.drawTexture(ele,index,"label"),drawing.drawTexture(ele,index,"edge-source-label"),drawing.drawTexture(ele,index,"edge-target-label"))}function renderWebgl(r,options2,renderTarget){var start;r.webglDebug&&(start=performance.now());var drawing=r.drawing,eleCount=0;if(renderTarget.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&drawSelectionRectangle(r,options2),r.data.canvasNeedsRedraw[r.NODE]||renderTarget.picking){var gl=r.data.contexts[r.WEBGL];renderTarget.screen?(gl.clearColor(0,0,0,0),gl.enable(gl.BLEND),gl.blendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA)):gl.disable(gl.BLEND),gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT),gl.viewport(0,0,gl.canvas.width,gl.canvas.height);var panZoomMatrix=createPanZoomMatrix(r),eles=r.getCachedZSortedEles();if(eleCount=eles.length,drawing.startFrame(panZoomMatrix,renderTarget),renderTarget.screen){for(var i=0;i<eles.nondrag.length;i++)drawEle(r,i,eles.nondrag[i]);for(var _i2=0;_i2<eles.drag.length;_i2++)drawEle(r,_i2,eles.drag[_i2])}else if(renderTarget.picking)for(var _i3=0;_i3<eles.length;_i3++)drawEle(r,_i3,eles[_i3]);drawing.endFrame(),renderTarget.screen&&r.webglDebugShowAtlases&&(drawAxes(r),drawAtlases(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var end=performance.now(),compact=!1,time2=Math.ceil(end-start),debugInfo=drawing.getDebugInfo(),report=["".concat(eleCount," elements"),"".concat(debugInfo.totalInstances," instances"),"".concat(debugInfo.batchCount," batches"),"".concat(debugInfo.totalAtlases," atlases"),"".concat(debugInfo.wrappedCount," wrapped textures"),"".concat(debugInfo.simpleCount," simple shapes")].join(", ");if(compact)console.log("WebGL (".concat(renderTarget.name,") - time ").concat(time2,"ms, ").concat(report));else{console.log("WebGL (".concat(renderTarget.name,") - frame time ").concat(time2,"ms")),console.log("Totals:"),console.log(" ".concat(report)),console.log("Texture Atlases Used:");var atlasInfo=debugInfo.atlasInfo,_iterator2=_createForOfIteratorHelper(atlasInfo),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var info=_step2.value;console.log(" ".concat(info.type,": ").concat(info.keyCount," keys, ").concat(info.atlasCount," atlases"))}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}console.log("")}}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,drawing.gc())}var CRp$3={};CRp$3.drawPolygonPath=function(context,x2,y2,width2,height2,points){var halfW=width2/2,halfH=height2/2;context.beginPath&&context.beginPath(),context.moveTo(x2+halfW*points[0],y2+halfH*points[1]);for(var i=1;i<points.length/2;i++)context.lineTo(x2+halfW*points[i*2],y2+halfH*points[i*2+1]);context.closePath()};CRp$3.drawRoundPolygonPath=function(context,x2,y2,width2,height2,points,corners){corners.forEach(function(corner){return drawPreparedRoundCorner(context,corner)}),context.closePath()};CRp$3.drawRoundRectanglePath=function(context,x2,y2,width2,height2,radius2){var halfWidth=width2/2,halfHeight=height2/2,cornerRadius=radius2==="auto"?getRoundRectangleRadius(width2,height2):Math.min(radius2,halfHeight,halfWidth);context.beginPath&&context.beginPath(),context.moveTo(x2,y2-halfHeight),context.arcTo(x2+halfWidth,y2-halfHeight,x2+halfWidth,y2,cornerRadius),context.arcTo(x2+halfWidth,y2+halfHeight,x2,y2+halfHeight,cornerRadius),context.arcTo(x2-halfWidth,y2+halfHeight,x2-halfWidth,y2,cornerRadius),context.arcTo(x2-halfWidth,y2-halfHeight,x2,y2-halfHeight,cornerRadius),context.lineTo(x2,y2-halfHeight),context.closePath()};CRp$3.drawBottomRoundRectanglePath=function(context,x2,y2,width2,height2,radius2){var halfWidth=width2/2,halfHeight=height2/2,cornerRadius=radius2==="auto"?getRoundRectangleRadius(width2,height2):radius2;context.beginPath&&context.beginPath(),context.moveTo(x2,y2-halfHeight),context.lineTo(x2+halfWidth,y2-halfHeight),context.lineTo(x2+halfWidth,y2),context.arcTo(x2+halfWidth,y2+halfHeight,x2,y2+halfHeight,cornerRadius),context.arcTo(x2-halfWidth,y2+halfHeight,x2-halfWidth,y2,cornerRadius),context.lineTo(x2-halfWidth,y2-halfHeight),context.lineTo(x2,y2-halfHeight),context.closePath()};CRp$3.drawCutRectanglePath=function(context,x2,y2,width2,height2,points,corners){var halfWidth=width2/2,halfHeight=height2/2,cornerLength=corners==="auto"?getCutRectangleCornerLength():corners;context.beginPath&&context.beginPath(),context.moveTo(x2-halfWidth+cornerLength,y2-halfHeight),context.lineTo(x2+halfWidth-cornerLength,y2-halfHeight),context.lineTo(x2+halfWidth,y2-halfHeight+cornerLength),context.lineTo(x2+halfWidth,y2+halfHeight-cornerLength),context.lineTo(x2+halfWidth-cornerLength,y2+halfHeight),context.lineTo(x2-halfWidth+cornerLength,y2+halfHeight),context.lineTo(x2-halfWidth,y2+halfHeight-cornerLength),context.lineTo(x2-halfWidth,y2-halfHeight+cornerLength),context.closePath()};CRp$3.drawBarrelPath=function(context,x2,y2,width2,height2){var halfWidth=width2/2,halfHeight=height2/2,xBegin=x2-halfWidth,xEnd=x2+halfWidth,yBegin=y2-halfHeight,yEnd=y2+halfHeight,barrelCurveConstants=getBarrelCurveConstants(width2,height2),wOffset=barrelCurveConstants.widthOffset,hOffset=barrelCurveConstants.heightOffset,ctrlPtXOffset=barrelCurveConstants.ctrlPtOffsetPct*wOffset;context.beginPath&&context.beginPath(),context.moveTo(xBegin,yBegin+hOffset),context.lineTo(xBegin,yEnd-hOffset),context.quadraticCurveTo(xBegin+ctrlPtXOffset,yEnd,xBegin+wOffset,yEnd),context.lineTo(xEnd-wOffset,yEnd),context.quadraticCurveTo(xEnd-ctrlPtXOffset,yEnd,xEnd,yEnd-hOffset),context.lineTo(xEnd,yBegin+hOffset),context.quadraticCurveTo(xEnd-ctrlPtXOffset,yBegin,xEnd-wOffset,yBegin),context.lineTo(xBegin+wOffset,yBegin),context.quadraticCurveTo(xBegin+ctrlPtXOffset,yBegin,xBegin,yBegin+hOffset),context.closePath()};var sin0=Math.sin(0),cos0=Math.cos(0),sin={},cos={},ellipseStepSize=Math.PI/40;for(var i=0*Math.PI;i<2*Math.PI;i+=ellipseStepSize)sin[i]=Math.sin(i),cos[i]=Math.cos(i);CRp$3.drawEllipsePath=function(context,centerX,centerY,width2,height2){if(context.beginPath&&context.beginPath(),context.ellipse)context.ellipse(centerX,centerY,width2/2,height2/2,0,0,2*Math.PI);else for(var xPos,yPos,rw=width2/2,rh=height2/2,i=0*Math.PI;i<2*Math.PI;i+=ellipseStepSize)xPos=centerX-rw*sin[i]*sin0+rw*cos[i]*cos0,yPos=centerY+rh*cos[i]*sin0+rh*sin[i]*cos0,i===0?context.moveTo(xPos,yPos):context.lineTo(xPos,yPos);context.closePath()};var CRp$2={};CRp$2.createBuffer=function(w,h){var buffer=document.createElement("canvas");return buffer.width=w,buffer.height=h,[buffer,buffer.getContext("2d")]};CRp$2.bufferCanvasImage=function(options2){var cy=this.cy,eles=cy.mutableElements(),bb=eles.boundingBox(),ctrRect=this.findContainerClientCoords(),width2=options2.full?Math.ceil(bb.w):ctrRect[2],height2=options2.full?Math.ceil(bb.h):ctrRect[3],specdMaxDims=number$1(options2.maxWidth)||number$1(options2.maxHeight),pxRatio=this.getPixelRatio(),scale2=1;if(options2.scale!==void 0)width2*=options2.scale,height2*=options2.scale,scale2=options2.scale;else if(specdMaxDims){var maxScaleW=1/0,maxScaleH=1/0;number$1(options2.maxWidth)&&(maxScaleW=scale2*options2.maxWidth/width2),number$1(options2.maxHeight)&&(maxScaleH=scale2*options2.maxHeight/height2),scale2=Math.min(maxScaleW,maxScaleH),width2*=scale2,height2*=scale2}specdMaxDims||(width2*=pxRatio,height2*=pxRatio,scale2*=pxRatio);var buffCanvas=document.createElement("canvas");buffCanvas.width=width2,buffCanvas.height=height2,buffCanvas.style.width=width2+"px",buffCanvas.style.height=height2+"px";var buffCxt=buffCanvas.getContext("2d");if(width2>0&&height2>0){buffCxt.clearRect(0,0,width2,height2),buffCxt.globalCompositeOperation="source-over";var zsortedEles=this.getCachedZSortedEles();if(options2.full)buffCxt.translate(-bb.x1*scale2,-bb.y1*scale2),buffCxt.scale(scale2,scale2),this.drawElements(buffCxt,zsortedEles),buffCxt.scale(1/scale2,1/scale2),buffCxt.translate(bb.x1*scale2,bb.y1*scale2);else{var pan2=cy.pan(),translation={x:pan2.x*scale2,y:pan2.y*scale2};scale2*=cy.zoom(),buffCxt.translate(translation.x,translation.y),buffCxt.scale(scale2,scale2),this.drawElements(buffCxt,zsortedEles),buffCxt.scale(1/scale2,1/scale2),buffCxt.translate(-translation.x,-translation.y)}options2.bg&&(buffCxt.globalCompositeOperation="destination-over",buffCxt.fillStyle=options2.bg,buffCxt.rect(0,0,width2,height2),buffCxt.fill())}return buffCanvas};function b64ToBlob(b64,mimeType){for(var bytes=atob(b64),buff=new ArrayBuffer(bytes.length),buffUint8=new Uint8Array(buff),i=0;i<bytes.length;i++)buffUint8[i]=bytes.charCodeAt(i);return new Blob([buff],{type:mimeType})}function b64UriToB64(b64uri){var i=b64uri.indexOf(",");return b64uri.substr(i+1)}function output(options2,canvas,mimeType){var getB64Uri=function(){return canvas.toDataURL(mimeType,options2.quality)};switch(options2.output){case"blob-promise":return new Promise$1(function(resolve2,reject2){try{canvas.toBlob(function(blob){blob!=null?resolve2(blob):reject2(new Error("`canvas.toBlob()` sent a null value in its callback"))},mimeType,options2.quality)}catch(err){reject2(err)}});case"blob":return b64ToBlob(b64UriToB64(getB64Uri()),mimeType);case"base64":return b64UriToB64(getB64Uri());case"base64uri":default:return getB64Uri()}}CRp$2.png=function(options2){return output(options2,this.bufferCanvasImage(options2),"image/png")};CRp$2.jpg=function(options2){return output(options2,this.bufferCanvasImage(options2),"image/jpeg")};var CRp$1={};CRp$1.nodeShapeImpl=function(name,context,centerX,centerY,width2,height2,points,corners){switch(name){case"ellipse":return this.drawEllipsePath(context,centerX,centerY,width2,height2);case"polygon":return this.drawPolygonPath(context,centerX,centerY,width2,height2,points);case"round-polygon":return this.drawRoundPolygonPath(context,centerX,centerY,width2,height2,points,corners);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(context,centerX,centerY,width2,height2,corners);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(context,centerX,centerY,width2,height2,points,corners);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(context,centerX,centerY,width2,height2,corners);case"barrel":return this.drawBarrelPath(context,centerX,centerY,width2,height2)}};var CR=CanvasRenderer,CRp=CanvasRenderer.prototype;CRp.CANVAS_LAYERS=3;CRp.SELECT_BOX=0;CRp.DRAG=1;CRp.NODE=2;CRp.WEBGL=3;CRp.CANVAS_TYPES=["2d","2d","2d","webgl2"];CRp.BUFFER_COUNT=3;CRp.TEXTURE_BUFFER=0;CRp.MOTIONBLUR_BUFFER_NODE=1;CRp.MOTIONBLUR_BUFFER_DRAG=2;function CanvasRenderer(options2){var r=this,containerWindow=r.cy.window(),document2=containerWindow.document;options2.webgl&&(CRp.CANVAS_LAYERS=r.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),r.data={canvases:new Array(CRp.CANVAS_LAYERS),contexts:new Array(CRp.CANVAS_LAYERS),canvasNeedsRedraw:new Array(CRp.CANVAS_LAYERS),bufferCanvases:new Array(CRp.BUFFER_COUNT),bufferContexts:new Array(CRp.CANVAS_LAYERS)};var tapHlOffAttr="-webkit-tap-highlight-color",tapHlOffStyle="rgba(0,0,0,0)";r.data.canvasContainer=document2.createElement("div");var containerStyle=r.data.canvasContainer.style;r.data.canvasContainer.style[tapHlOffAttr]=tapHlOffStyle,containerStyle.position="relative",containerStyle.zIndex="0",containerStyle.overflow="hidden";var container2=options2.cy.container();container2.appendChild(r.data.canvasContainer),container2.style[tapHlOffAttr]=tapHlOffStyle;var styleMap={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};ms()&&(styleMap["-ms-touch-action"]="none",styleMap["touch-action"]="none");for(var i=0;i<CRp.CANVAS_LAYERS;i++){var canvas=r.data.canvases[i]=document2.createElement("canvas"),type=CRp.CANVAS_TYPES[i];r.data.contexts[i]=canvas.getContext(type),r.data.contexts[i]||error("Could not create canvas of type "+type),Object.keys(styleMap).forEach(function(k){canvas.style[k]=styleMap[k]}),canvas.style.position="absolute",canvas.setAttribute("data-id","layer"+i),canvas.style.zIndex=String(CRp.CANVAS_LAYERS-i),r.data.canvasContainer.appendChild(canvas),r.data.canvasNeedsRedraw[i]=!1}r.data.topCanvas=r.data.canvases[0],r.data.canvases[CRp.NODE].setAttribute("data-id","layer"+CRp.NODE+"-node"),r.data.canvases[CRp.SELECT_BOX].setAttribute("data-id","layer"+CRp.SELECT_BOX+"-selectbox"),r.data.canvases[CRp.DRAG].setAttribute("data-id","layer"+CRp.DRAG+"-drag"),r.data.canvases[CRp.WEBGL]&&r.data.canvases[CRp.WEBGL].setAttribute("data-id","layer"+CRp.WEBGL+"-webgl");for(var i=0;i<CRp.BUFFER_COUNT;i++)r.data.bufferCanvases[i]=document2.createElement("canvas"),r.data.bufferContexts[i]=r.data.bufferCanvases[i].getContext("2d"),r.data.bufferCanvases[i].style.position="absolute",r.data.bufferCanvases[i].setAttribute("data-id","buffer"+i),r.data.bufferCanvases[i].style.zIndex=String(-i-1),r.data.bufferCanvases[i].style.visibility="hidden";r.pathsEnabled=!0;var emptyBb=makeBoundingBox(),getBoxCenter=function(bb){return{x:(bb.x1+bb.x2)/2,y:(bb.y1+bb.y2)/2}},getCenterOffset=function(bb){return{x:-bb.w/2,y:-bb.h/2}},backgroundTimestampHasChanged=function(ele){var _p=ele[0]._private,same2=_p.oldBackgroundTimestamp===_p.backgroundTimestamp;return!same2},getStyleKey=function(ele){return ele[0]._private.nodeKey},getLabelKey=function(ele){return ele[0]._private.labelStyleKey},getSourceLabelKey=function(ele){return ele[0]._private.sourceLabelStyleKey},getTargetLabelKey=function(ele){return ele[0]._private.targetLabelStyleKey},drawElement=function(context,ele,bb,scaledLabelShown,useEleOpacity){return r.drawElement(context,ele,bb,!1,!1,useEleOpacity)},drawLabel=function(context,ele,bb,scaledLabelShown,useEleOpacity){return r.drawElementText(context,ele,bb,scaledLabelShown,"main",useEleOpacity)},drawSourceLabel=function(context,ele,bb,scaledLabelShown,useEleOpacity){return r.drawElementText(context,ele,bb,scaledLabelShown,"source",useEleOpacity)},drawTargetLabel=function(context,ele,bb,scaledLabelShown,useEleOpacity){return r.drawElementText(context,ele,bb,scaledLabelShown,"target",useEleOpacity)},getElementBox=function(ele){return ele.boundingBox(),ele[0]._private.bodyBounds},getLabelBox=function(ele){return ele.boundingBox(),ele[0]._private.labelBounds.main||emptyBb},getSourceLabelBox=function(ele){return ele.boundingBox(),ele[0]._private.labelBounds.source||emptyBb},getTargetLabelBox=function(ele){return ele.boundingBox(),ele[0]._private.labelBounds.target||emptyBb},isLabelVisibleAtScale=function(ele,scaledLabelShown){return scaledLabelShown},getElementRotationPoint=function(ele){return getBoxCenter(getElementBox(ele))},addTextMargin=function(prefix,pt,ele){var pre=prefix?prefix+"-":"";return{x:pt.x+ele.pstyle(pre+"text-margin-x").pfValue,y:pt.y+ele.pstyle(pre+"text-margin-y").pfValue}},getRsPt=function(ele,x2,y2){var rs=ele[0]._private.rscratch;return{x:rs[x2],y:rs[y2]}},getLabelRotationPoint=function(ele){return addTextMargin("",getRsPt(ele,"labelX","labelY"),ele)},getSourceLabelRotationPoint=function(ele){return addTextMargin("source",getRsPt(ele,"sourceLabelX","sourceLabelY"),ele)},getTargetLabelRotationPoint=function(ele){return addTextMargin("target",getRsPt(ele,"targetLabelX","targetLabelY"),ele)},getElementRotationOffset=function(ele){return getCenterOffset(getElementBox(ele))},getSourceLabelRotationOffset=function(ele){return getCenterOffset(getSourceLabelBox(ele))},getTargetLabelRotationOffset=function(ele){return getCenterOffset(getTargetLabelBox(ele))},getLabelRotationOffset=function(ele){var bb=getLabelBox(ele),p2=getCenterOffset(getLabelBox(ele));if(ele.isNode()){switch(ele.pstyle("text-halign").value){case"left":p2.x=-bb.w-(bb.leftPad||0);break;case"right":p2.x=-(bb.rightPad||0);break}switch(ele.pstyle("text-valign").value){case"top":p2.y=-bb.h-(bb.topPad||0);break;case"bottom":p2.y=-(bb.botPad||0);break}}return p2},eleTxrCache=r.data.eleTxrCache=new ElementTextureCache(r,{getKey:getStyleKey,doesEleInvalidateKey:backgroundTimestampHasChanged,drawElement,getBoundingBox:getElementBox,getRotationPoint:getElementRotationPoint,getRotationOffset:getElementRotationOffset,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),lblTxrCache=r.data.lblTxrCache=new ElementTextureCache(r,{getKey:getLabelKey,drawElement:drawLabel,getBoundingBox:getLabelBox,getRotationPoint:getLabelRotationPoint,getRotationOffset:getLabelRotationOffset,isVisible:isLabelVisibleAtScale}),slbTxrCache=r.data.slbTxrCache=new ElementTextureCache(r,{getKey:getSourceLabelKey,drawElement:drawSourceLabel,getBoundingBox:getSourceLabelBox,getRotationPoint:getSourceLabelRotationPoint,getRotationOffset:getSourceLabelRotationOffset,isVisible:isLabelVisibleAtScale}),tlbTxrCache=r.data.tlbTxrCache=new ElementTextureCache(r,{getKey:getTargetLabelKey,drawElement:drawTargetLabel,getBoundingBox:getTargetLabelBox,getRotationPoint:getTargetLabelRotationPoint,getRotationOffset:getTargetLabelRotationOffset,isVisible:isLabelVisibleAtScale}),lyrTxrCache=r.data.lyrTxrCache=new LayeredTextureCache(r);r.onUpdateEleCalcs(function(willDraw,eles){eleTxrCache.invalidateElements(eles),lblTxrCache.invalidateElements(eles),slbTxrCache.invalidateElements(eles),tlbTxrCache.invalidateElements(eles),lyrTxrCache.invalidateElements(eles);for(var _i=0;_i<eles.length;_i++){var _p=eles[_i]._private;_p.oldBackgroundTimestamp=_p.backgroundTimestamp}});var refineInLayers=function(reqs){for(var i2=0;i2<reqs.length;i2++)lyrTxrCache.enqueueElementRefinement(reqs[i2].ele)};eleTxrCache.onDequeue(refineInLayers),lblTxrCache.onDequeue(refineInLayers),slbTxrCache.onDequeue(refineInLayers),tlbTxrCache.onDequeue(refineInLayers),options2.webgl&&r.initWebgl(options2,{getStyleKey,getLabelKey,getSourceLabelKey,getTargetLabelKey,drawElement,drawLabel,drawSourceLabel,drawTargetLabel,getElementBox,getLabelBox,getSourceLabelBox,getTargetLabelBox,getElementRotationPoint,getElementRotationOffset,getLabelRotationPoint,getSourceLabelRotationPoint,getTargetLabelRotationPoint,getLabelRotationOffset,getSourceLabelRotationOffset,getTargetLabelRotationOffset})}CRp.redrawHint=function(group2,bool){var r=this;switch(group2){case"eles":r.data.canvasNeedsRedraw[CRp.NODE]=bool;break;case"drag":r.data.canvasNeedsRedraw[CRp.DRAG]=bool;break;case"select":r.data.canvasNeedsRedraw[CRp.SELECT_BOX]=bool;break;case"gc":r.data.gc=!0;break}};var pathsImpld=typeof Path2D<"u";CRp.path2dEnabled=function(on3){if(on3===void 0)return this.pathsEnabled;this.pathsEnabled=!!on3};CRp.usePaths=function(){return pathsImpld&&this.pathsEnabled};CRp.setImgSmoothing=function(context,bool){context.imageSmoothingEnabled!=null?context.imageSmoothingEnabled=bool:(context.webkitImageSmoothingEnabled=bool,context.mozImageSmoothingEnabled=bool,context.msImageSmoothingEnabled=bool)};CRp.getImgSmoothing=function(context){return context.imageSmoothingEnabled!=null?context.imageSmoothingEnabled:context.webkitImageSmoothingEnabled||context.mozImageSmoothingEnabled||context.msImageSmoothingEnabled};CRp.makeOffscreenCanvas=function(width2,height2){var canvas;if((typeof OffscreenCanvas>"u"?"undefined":_typeof(OffscreenCanvas))!=="undefined")canvas=new OffscreenCanvas(width2,height2);else{var containerWindow=this.cy.window(),document2=containerWindow.document;canvas=document2.createElement("canvas"),canvas.width=width2,canvas.height=height2}return canvas};[CRp$b,CRp$a,CRp$9,CRp$8,CRp$7,CRp$6,CRp$5,CRp$4,CRp$3,CRp$2,CRp$1].forEach(function(props){extend(CRp,props)});var renderer2=[{name:"null",impl:NullRenderer},{name:"base",impl:BR},{name:"canvas",impl:CR}],incExts=[{type:"layout",extensions:layout3},{type:"renderer",extensions:renderer2}],extensions={},modules={};function setExtension(type,name,registrant){var ext=registrant,overrideErr=function(field){warn("Can not register `"+name+"` for `"+type+"` since `"+field+"` already exists in the prototype and can not be overridden")};if(type==="core"){if(Core.prototype[name])return overrideErr(name);Core.prototype[name]=registrant}else if(type==="collection"){if(Collection.prototype[name])return overrideErr(name);Collection.prototype[name]=registrant}else if(type==="layout"){for(var Layout=function(options2){this.options=options2,registrant.call(this,options2),plainObject(this._private)||(this._private={}),this._private.cy=options2.cy,this._private.listeners=[],this.createEmitter()},layoutProto=Layout.prototype=Object.create(registrant.prototype),optLayoutFns=[],i=0;i<optLayoutFns.length;i++){var fnName=optLayoutFns[i];layoutProto[fnName]=layoutProto[fnName]||function(){return this}}layoutProto.start&&!layoutProto.run?layoutProto.run=function(){return this.start(),this}:!layoutProto.start&&layoutProto.run&&(layoutProto.start=function(){return this.run(),this});var regStop=registrant.prototype.stop;layoutProto.stop=function(){var opts=this.options;if(opts&&opts.animate){var anis=this.animations;if(anis)for(var _i=0;_i<anis.length;_i++)anis[_i].stop()}return regStop?regStop.call(this):this.emit("layoutstop"),this},layoutProto.destroy||(layoutProto.destroy=function(){return this}),layoutProto.cy=function(){return this._private.cy};var getCy=function(layout4){return layout4._private.cy},emitterOpts={addEventFields:function(layout4,evt){evt.layout=layout4,evt.cy=getCy(layout4),evt.target=layout4},bubble:function(){return!0},parent:function(layout4){return getCy(layout4)}};extend(layoutProto,{createEmitter:function(){return this._private.emitter=new Emitter(emitterOpts,this),this},emitter:function(){return this._private.emitter},on:function(evt,cb){return this.emitter().on(evt,cb),this},one:function(evt,cb){return this.emitter().one(evt,cb),this},once:function(evt,cb){return this.emitter().one(evt,cb),this},removeListener:function(evt,cb){return this.emitter().removeListener(evt,cb),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(evt,params){return this.emitter().emit(evt,params),this}}),define.eventAliasesOn(layoutProto),ext=Layout}else if(type==="renderer"&&name!=="null"&&name!=="base"){var BaseRenderer3=getExtension("renderer","base"),bProto=BaseRenderer3.prototype,RegistrantRenderer=registrant,rProto=registrant.prototype,Renderer=function(){BaseRenderer3.apply(this,arguments),RegistrantRenderer.apply(this,arguments)},proto=Renderer.prototype;for(var pName in bProto){var pVal=bProto[pName],existsInR=rProto[pName]!=null;if(existsInR)return overrideErr(pName);proto[pName]=pVal}for(var _pName in rProto)proto[_pName]=rProto[_pName];bProto.clientFunctions.forEach(function(name2){proto[name2]=proto[name2]||function(){error("Renderer does not implement `renderer."+name2+"()` on its prototype")}}),ext=Renderer}else if(type==="__proto__"||type==="constructor"||type==="prototype")return error(type+" is an illegal type to be registered, possibly lead to prototype pollutions");return setMap({map:extensions,keys:[type,name],value:ext})}function getExtension(type,name){return getMap({map:extensions,keys:[type,name]})}function setModule(type,name,moduleType,moduleName,registrant){return setMap({map:modules,keys:[type,name,moduleType,moduleName],value:registrant})}function getModule(type,name,moduleType,moduleName){return getMap({map:modules,keys:[type,name,moduleType,moduleName]})}var extension=function(){if(arguments.length===2)return getExtension.apply(null,arguments);if(arguments.length===3)return setExtension.apply(null,arguments);if(arguments.length===4)return getModule.apply(null,arguments);if(arguments.length===5)return setModule.apply(null,arguments);error("Invalid extension access syntax")};Core.prototype.extension=extension;incExts.forEach(function(group2){group2.extensions.forEach(function(ext){setExtension(group2.type,ext.name,ext.impl)})});var _Stylesheet=function(){if(!(this instanceof _Stylesheet))return new _Stylesheet;this.length=0},sheetfn=_Stylesheet.prototype;sheetfn.instanceString=function(){return"stylesheet"};sheetfn.selector=function(selector){var i=this.length++;return this[i]={selector,properties:[]},this};sheetfn.css=function(name,value){var i=this.length-1;if(string(name))this[i].properties.push({name,value});else if(plainObject(name))for(var map2=name,propNames=Object.keys(map2),j=0;j<propNames.length;j++){var key=propNames[j],mapVal=map2[key];if(mapVal!=null){var prop=_Style.properties[key]||_Style.properties[dash2camel(key)];if(prop!=null){var _name=prop.name,_value=mapVal;this[i].properties.push({name:_name,value:_value})}}}return this};sheetfn.style=sheetfn.css;sheetfn.generateStyle=function(cy){var style3=new _Style(cy);return this.appendToStyle(style3)};sheetfn.appendToStyle=function(style3){for(var i=0;i<this.length;i++){var context=this[i],selector=context.selector,props=context.properties;style3.selector(selector);for(var j=0;j<props.length;j++){var prop=props[j];style3.css(prop.name,prop.value)}}return style3};var version="3.33.2",cytoscape=function(options2){if(options2===void 0&&(options2={}),plainObject(options2))return new Core(options2);if(string(options2))return extension.apply(extension,arguments)};cytoscape.use=function(ext){var args=Array.prototype.slice.call(arguments,1);return args.unshift(cytoscape),ext.apply(null,args),this};cytoscape.warnings=function(bool){return warnings(bool)};cytoscape.version=version;cytoscape.stylesheet=cytoscape.Stylesheet=_Stylesheet;export{cytoscape as c};
|